@gem-sdk/components 17.0.0-dev.124 → 17.0.0-dev.127
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@gem-sdk/core"),t=require("../../image/common/helpers.js"),o=require("../../constant.js"),r=require("./const.js");const l=(t,o,r)=>{let l={};return e.DEVICES.map(i=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=e.getResponsiveValueByScreen(r,i);l={...l,[i]:1>=(s?.cols?.length||1)?a:n}}),l},i=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},s=e=>{let o=i(e);return{desktop:t.createBlurDataURL(o?.desktop?.width??0,o?.desktop?.height??0),tablet:t.createBlurDataURL(o?.tablet?.width??o?.desktop?.width??0,o?.tablet?.height??o?.desktop?.width??0),mobile:t.createBlurDataURL(o?.mobile?.width??o?.tablet?.width??o?.desktop?.width??0,o?.mobile?.height??o?.tablet?.height??o?.desktop?.width??0)}},a=(o,r,l,a)=>{if(!o)return"";let n=i(o),p=e.getResponsiveValueByScreen(o,r),b=l?`url(${s(o)[r]})`:`url(${t.getImageSrc(e.getResponsiveValueByScreen(n,r),r,a)})`,g=p?.color?`, ${p.color}`:"";return p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type==="image"?`${b}${g}`:p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type!=="image"?`${p.color}`:p?.type==="image"?b:"url()"},n=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},p=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},b=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:r})=>{let l=p(e,t);return l?{...r,[o]:l}:r},g=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},c=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},u=(t,o)=>{let r=!1,l=e.DEVICES.reduce((l,i)=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=c(s,a?.type==="video");return n&&(l[i]=n,r=!0),l},{});return{aspectRatio:r?l:void 0}},d=(t,o,r)=>e.DEVICES.reduce((l,i)=>{let s=e.getValueByDevice(t,i),a=s?.type==="video"?s?.videoType:void 0,n=e.getValueByDevice(o,i),p=r?.[i];return p&&"youtube"===a&&"cover"!==n&&(l[i]=p),l},{}),m=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,y=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:s?"150%":a?"100vh":"100%"}}),e.makeStyleResponsive("h",r)},h=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:a?"100vw":"100%"}}),e.makeStyleResponsive("w",r)},f=t=>{let o={};return["desktop","mobile","tablet"].forEach(e=>{o={...o,[e]:t[e]?.attachment==="fixed"?"0px":""}}),e.makeStyleResponsive("top",o)},I=(e,t=0,o=0)=>{let r=t,l=t;if(t>o?r=o:l=o,e>=999){let t=e-r;return t>0?t:0}let i=e-l;return i>0?i:0},v=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let r=t[e]?.cols??[],l=r.length<=1,i=o[e];if(l&&i)return["space-between","top","center","bottom"].includes(i)?i:void 0},k=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,r=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:r}},S=(t,o)=>{if(!t||!o)return 16/9;let r=e.getResponsiveValueByScreen(t,o),l=r?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},x=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${r.VIDEO_IFRAME_SCALE})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${r.VIDEO_IFRAME_SCALE})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${r.VIDEO_IFRAME_SCALE})`}}};exports.collectAspectRatioByDevice=u,exports.collectYoutubeAspectRatio=d,exports.debounce=function(e,t){let o;return function(...r){clearTimeout(o),o=setTimeout(()=>e.apply(this,r),t)}},exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",exports.getAspectRatio=(e,t)=>{let{aspectRatio:o}=u(e,t);return o},exports.getAttachmentDevice=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o]?.attachment;t={...t,[o]:"fixed"===r?"fixed":"absolute"}}),t},exports.getBackgroundImageHeroBanner=(t,o=!1,r=!1)=>{if(!t)return;let l={};return e.DEVICES.forEach(e=>{l={...l,[e]:a(t,e,o,r)}}),e.makeStyleResponsive("bgi",l)},exports.getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:o.HREF_TO_SALES_PAGE,target:"_self"}:t},exports.getBgImage=i,exports.getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),exports.getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",r=e.tablet||o,l=e.mobile||r;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[r]}`]:!0,[`mobile:gp-justify-${t[l]}`]:!0}},exports.getClassForContentByFitContent=(t,o)=>{let r={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!n(l,o),a=i?.shape,p=i?.height;r={...r,[l]:"original"===a&&"fit-content"!==p&&!s}}),e.cls(r.desktop?"!gp-absolute":"",r.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",r.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},exports.getClassForStretchContent=t=>{let o={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(r=>{let l=e.getResponsiveValueByScreen(t,r);o={...o,[r]:l}}),e.cls("space-between"===o.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===o.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${t?.tablet}`,"space-between"===o.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${t?.mobile}`)},exports.getClassSpaceBetween=(t,o)=>{let r=k(t),l=k(o),i={desktop:v({device:"desktop",settingLayoutRes:r,contentPosition1ColRes:l}),tablet:v({device:"tablet",settingLayoutRes:r,contentPosition1ColRes:l}),mobile:v({device:"mobile",settingLayoutRes:r,contentPosition1ColRes:l})},s={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute tablet:[&>*:nth-child(2)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute mobile:[&>*:nth-child(2)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},a={};return e.DEVICES.forEach(e=>{let t=i[e],o=s?.[t]?.[e];a[o]=!0}),a},exports.getClassSpaceBetweenLeftRight=e=>{let t=k(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",r=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",l=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":r,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":l,"mobile:!gp-h-auto":!l}},exports.getClipPath=(e,t)=>{if(!t)return`${r.DEFAULT_CLIP_PATH}`;let[o,l,i,s]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:p,bblr:b}=t,g=I(parseInt(a??"0")||0,o,s),c=I(parseInt(n??"0")||0,o,l),u=I(parseInt(p??"0")||0,l,i),d=I(parseInt(b??"0")||0,i,s);return[g,c,u,d].every(e=>0===e)?`${r.DEFAULT_CLIP_PATH}`:`inset(0 0 0 round ${g}px ${c}px ${u}px ${d}px)`},exports.getContainerRatio=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},exports.getContentPosition=l,exports.getDataVideoHeroBannerResponsive=n,exports.getDisplayStyleByFitContent=(t,o)=>{let r={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!n(l,o),a=i?.shape,p=i?.height;r={...r,[l]:"original"!==a||"fit-content"===p||s?"none":"block"}}),e.makeStyleResponsive("d",r)},exports.getEnableBgImageByDevice=(t,o)=>{if(!e.getResponsiveValueByScreen(i(o),t))return!1;if(!o?.[t]){if("mobile"===t)return o?.tablet?.type==="image"||o?.desktop?.type==="image"&&!o?.tablet;if("tablet"===t)return o?.desktop?.type==="image"}return o?.[t]?.type==="image"},exports.getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,r="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||r},exports.getPercentageVisible=(e,t)=>{let{top:o,height:r}=e,l=-r;return o<l?0:o>t?100:Math.min(Math.max((o-l)/(t-l)*100,0),100)},exports.getResponsiveSetting=k,exports.getStyleAspectRatioHeroBannerCustom=(t,o)=>{let r=e.getAspectRatioGlobalSize(o);return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(o,l),s=!!n(l,t);s&&(r=b({shapeByDevice:i,fallbackRatio:"auto",device:l,currentResult:r}))}),e.makeStyleResponsive("aspect",r)},exports.getStyleHeroBannerBg=(e,t)=>{let o=y(e,t),r=h(e,t),l=f(e);return{...o,...r,...l}},exports.getVideoAspectRatio=S,exports.getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},exports.getWidth=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o];r&&(t={...t,[o]:"default"===r?"var(--g-ct-w, 1200px)":r})}),t},exports.getYoutubeAspectRatio=(e,t,o)=>{let r=d(e,t,o);return Object.keys(r).length?r:void 0},exports.horizontalAlign=(e,t,o)=>g(l(e,t,o)),exports.imagePlaceholder=s,exports.isScaleImage=m,exports.mapContentPositionToHorizontal=g,exports.opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},r=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:r}},exports.resetVideoIframeStyle=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},exports.resetVideoWrapperStyle=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},exports.scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),exports.setVideoIframeAlign=(e,t)=>{if(!e)return;let o=x(t);e.style.top=o.top,e.style.transform=o.transform},exports.setVideoWrapperStyle=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},exports.showVideoType=t=>e.DEVICES.some(o=>{let r=e.getValueByDevice(t,o);return r?.type!=="color"&&r?.type!=="image"&&!!r&&(r?.videoType==="html5"&&r?.videoHtml5||r?.videoType==="youtube"&&r?.video)}),exports.updateVideoIframeSize=({iframeEl:t,containerRatio:o,videoObjectFit:l,background:i,currentDevice:s,isYoutubeVideoMigrated:a})=>{let n,p;let b=S(i,s),g=e.getResponsiveValueByScreen(i,s);if(!t||!o)return;let c=g?.videoAlign||"top",u=x(c);if("contain"===l){Object.assign(t.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${r.VIDEO_IFRAME_SCALE})`});return}o>=b?(n=100,p=o/b*100):(p=100,n=b/o*100),Object.assign(t.style,{position:"absolute",top:u.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${p}%`,maxWidth:"none",transform:u.transform})};
|
|
1
|
+
"use strict";var e=require("@gem-sdk/core"),t=require("../../image/common/helpers.js"),o=require("../../constant.js"),r=require("./const.js");const l=(t,o,r)=>{let l={};return e.DEVICES.map(i=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=e.getResponsiveValueByScreen(r,i);l={...l,[i]:1>=(s?.cols?.length||1)?a:n}}),l},i=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},s=e=>{let o=i(e);return{desktop:t.createBlurDataURL(o?.desktop?.width??0,o?.desktop?.height??0),tablet:t.createBlurDataURL(o?.tablet?.width??o?.desktop?.width??0,o?.tablet?.height??o?.desktop?.width??0),mobile:t.createBlurDataURL(o?.mobile?.width??o?.tablet?.width??o?.desktop?.width??0,o?.mobile?.height??o?.tablet?.height??o?.desktop?.width??0)}},a=(o,r,l,a)=>{if(!o)return"";let n=i(o),p=e.getResponsiveValueByScreen(o,r),b=l?`url(${s(o)[r]})`:`url(${t.getImageSrc(e.getResponsiveValueByScreen(n,r),r,a)})`,g=p?.color?`, ${p.color}`:"";return p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type==="image"?`${b}${g}`:p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type!=="image"?`${p.color}`:p?.type==="image"?b:"url()"},n=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},p=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},b=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:r})=>{let l=p(e,t);return l?{...r,[o]:l}:r},g=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},c=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},u=(t,o)=>{let r=!1,l=e.DEVICES.reduce((l,i)=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=c(s,a?.type==="video");return n&&(l[i]=n,r=!0),l},{});return{aspectRatio:r?l:void 0}},d=(t,o,r)=>e.DEVICES.reduce((l,i)=>{let s=e.getValueByDevice(t,i),a=s?.type==="video"?s?.videoType:void 0,n=e.getValueByDevice(o,i),p=r?.[i];return p&&"youtube"===a&&"cover"!==n&&(l[i]=p),l},{}),m=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,y=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:s?"150%":a?"100vh":"100%"}}),e.makeStyleResponsive("h",r)},h=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:a?"100vw":"100%"}}),e.makeStyleResponsive("w",r)},f=t=>{let o={};return["desktop","mobile","tablet"].forEach(e=>{o={...o,[e]:t[e]?.attachment==="fixed"?"0px":""}}),e.makeStyleResponsive("top",o)},I=(e,t=0,o=0)=>{let r=t,l=t;if(t>o?r=o:l=o,e>=999){let t=e-r;return t>0?t:0}let i=e-l;return i>0?i:0},v=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let r=t[e]?.cols??[],l=r.length<=1,i=o[e];if(l&&i)return["space-between","top","center","bottom"].includes(i)?i:void 0},k=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,r=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:r}},S=(t,o)=>{if(!t||!o)return 16/9;let r=e.getResponsiveValueByScreen(t,o),l=r?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},x=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${r.VIDEO_IFRAME_SCALE})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${r.VIDEO_IFRAME_SCALE})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${r.VIDEO_IFRAME_SCALE})`}}};exports.collectAspectRatioByDevice=u,exports.collectYoutubeAspectRatio=d,exports.debounce=function(e,t){let o;return function(...r){clearTimeout(o),o=setTimeout(()=>e.apply(this,r),t)}},exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",exports.getAspectRatio=(e,t)=>{let{aspectRatio:o}=u(e,t);return o},exports.getAttachmentDevice=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o]?.attachment;t={...t,[o]:"fixed"===r?"fixed":"absolute"}}),t},exports.getBackgroundImageHeroBanner=(t,o=!1,r=!1)=>{if(!t)return;let l={};return e.DEVICES.forEach(e=>{l={...l,[e]:a(t,e,o,r)}}),e.makeStyleResponsive("bgi",l)},exports.getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:o.HREF_TO_SALES_PAGE,target:"_self"}:t},exports.getBgImage=i,exports.getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),exports.getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",r=e.tablet||o,l=e.mobile||r;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[r]}`]:!0,[`mobile:gp-justify-${t[l]}`]:!0}},exports.getClassForContentByFitContent=(t,o)=>{let r={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!n(l,o),a=i?.shape,p=i?.height;r={...r,[l]:"original"===a&&"fit-content"!==p&&!s}}),e.cls(r.desktop?"!gp-absolute":"",r.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",r.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},exports.getClassForStretchContent=t=>{let o={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(r=>{let l=e.getResponsiveValueByScreen(t,r);o={...o,[r]:l}}),e.cls("space-between"===o.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===o.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${t?.tablet}`,"space-between"===o.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${t?.mobile}`)},exports.getClassSpaceBetween=(t,o)=>{let r=k(t),l=k(o),i={desktop:v({device:"desktop",settingLayoutRes:r,contentPosition1ColRes:l}),tablet:v({device:"tablet",settingLayoutRes:r,contentPosition1ColRes:l}),mobile:v({device:"mobile",settingLayoutRes:r,contentPosition1ColRes:l})},s={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},a={};return e.DEVICES.forEach(e=>{let t=i[e],o=s?.[t]?.[e];a[o]=!0}),a},exports.getClassSpaceBetweenLeftRight=e=>{let t=k(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",r=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",l=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":r,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":l,"mobile:!gp-h-auto":!l}},exports.getClipPath=(e,t)=>{if(!t)return`${r.DEFAULT_CLIP_PATH}`;let[o,l,i,s]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:p,bblr:b}=t,g=I(parseInt(a??"0")||0,o,s),c=I(parseInt(n??"0")||0,o,l),u=I(parseInt(p??"0")||0,l,i),d=I(parseInt(b??"0")||0,i,s);return[g,c,u,d].every(e=>0===e)?`${r.DEFAULT_CLIP_PATH}`:`inset(0 0 0 round ${g}px ${c}px ${u}px ${d}px)`},exports.getContainerRatio=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},exports.getContentPosition=l,exports.getDataVideoHeroBannerResponsive=n,exports.getDisplayStyleByFitContent=(t,o)=>{let r={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!n(l,o),a=i?.shape,p=i?.height;r={...r,[l]:"original"!==a||"fit-content"===p||s?"none":"block"}}),e.makeStyleResponsive("d",r)},exports.getEnableBgImageByDevice=(t,o)=>{if(!e.getResponsiveValueByScreen(i(o),t))return!1;if(!o?.[t]){if("mobile"===t)return o?.tablet?.type==="image"||o?.desktop?.type==="image"&&!o?.tablet;if("tablet"===t)return o?.desktop?.type==="image"}return o?.[t]?.type==="image"},exports.getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,r="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||r},exports.getPercentageVisible=(e,t)=>{let{top:o,height:r}=e,l=-r;return o<l?0:o>t?100:Math.min(Math.max((o-l)/(t-l)*100,0),100)},exports.getResponsiveSetting=k,exports.getStyleAspectRatioHeroBannerCustom=(t,o)=>{let r=e.getAspectRatioGlobalSize(o);return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(o,l),s=!!n(l,t);s&&(r=b({shapeByDevice:i,fallbackRatio:"auto",device:l,currentResult:r}))}),e.makeStyleResponsive("aspect",r)},exports.getStyleHeroBannerBg=(e,t)=>{let o=y(e,t),r=h(e,t),l=f(e);return{...o,...r,...l}},exports.getVideoAspectRatio=S,exports.getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},exports.getWidth=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o];r&&(t={...t,[o]:"default"===r?"var(--g-ct-w, 1200px)":r})}),t},exports.getYoutubeAspectRatio=(e,t,o)=>{let r=d(e,t,o);return Object.keys(r).length?r:void 0},exports.horizontalAlign=(e,t,o)=>g(l(e,t,o)),exports.imagePlaceholder=s,exports.isScaleImage=m,exports.mapContentPositionToHorizontal=g,exports.opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},r=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:r}},exports.resetVideoIframeStyle=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},exports.resetVideoWrapperStyle=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},exports.scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),exports.setVideoIframeAlign=(e,t)=>{if(!e)return;let o=x(t);e.style.top=o.top,e.style.transform=o.transform},exports.setVideoWrapperStyle=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},exports.showVideoType=t=>e.DEVICES.some(o=>{let r=e.getValueByDevice(t,o);return r?.type!=="color"&&r?.type!=="image"&&!!r&&(r?.videoType==="html5"&&r?.videoHtml5||r?.videoType==="youtube"&&r?.video)}),exports.updateVideoIframeSize=({iframeEl:t,containerRatio:o,videoObjectFit:l,background:i,currentDevice:s,isYoutubeVideoMigrated:a})=>{let n,p;let b=S(i,s),g=e.getResponsiveValueByScreen(i,s);if(!t||!o)return;let c=g?.videoAlign||"top",u=x(c);if("contain"===l){Object.assign(t.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${r.VIDEO_IFRAME_SCALE})`});return}o>=b?(n=100,p=o/b*100):(p=100,n=b/o*100),Object.assign(t.style,{position:"absolute",top:u.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${p}%`,maxWidth:"none",transform:u.transform})};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../helpers.js"),s=require("../../text/components/Text.liquid.js"),l=require("@gem-sdk/system"),a=require("../common/classes.js"),i=require("../common/styles.js"),r=require("../common/helpers.js");exports.default=c=>{let{builderProps:o,builderAttrs:n,style:p,setting:d,styles:g,pageContext:y}=c,u=o?.builderData?.advanced,$=l.createClass({[o?.uid??""]:!0}),m=l.createClass(a.getClassWraplistIcon()),S=l.createClass(a.getClassColListIcon()),v=l.createClass(a.getClassWrapItemIcon({builderProps:o})),I=l.createClass(a.getClassWrapIcon()),C=l.createClass(a.getClassIcon()),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../helpers.js"),s=require("../../text/components/Text.liquid.js"),l=require("@gem-sdk/system"),a=require("../common/classes.js"),i=require("../common/styles.js"),r=require("../common/helpers.js");exports.default=c=>{let{builderProps:o,builderAttrs:n,style:p,setting:d,styles:g,pageContext:y}=c,u=o?.builderData?.advanced,$=l.createClass({[o?.uid??""]:!0}),m=l.createClass(a.getClassWraplistIcon()),S=l.createClass(a.getClassColListIcon()),v=l.createClass(a.getClassWrapItemIcon({builderProps:o})),I=l.createClass(a.getClassWrapIcon()),C=l.createClass(a.getClassIcon()),q=l.createClass(a.getClassTextItem({setting:d})),f=l.createStyle(i.getStyleContainerIconlistMain({styles:g,style:p,type:"liquid",advanced:u})),j=l.createStyle(i.getStyleWraplistIcon({styles:g,uid:o?.uid??"",pageContext:y,type:"Liquid"})),x=l.createStyle(i.getStyleColListIcon({styles:g})),T=l.createStyle(i.getStyleWrapIcon({styles:g,setting:d})),W=l.createStyle(i.getStyleWrapItemIcon({styles:g})),h=l.createStyle(i.getStyleIcon({styles:g,setting:d})),k=i.getStyleTypoText({setting:d}),A=l.createAttr({...n}),E=r.getTextIconNotFound("liquid"),L=r.getvalueMap({setting:d});return e.template`
|
|
2
2
|
{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
|
|
3
3
|
<gp-icon-list
|
|
4
4
|
${{...A}}
|
|
5
5
|
${{...o}}
|
|
6
6
|
data-id="${o?.uid}"
|
|
7
|
-
style="${
|
|
7
|
+
style="${f}"
|
|
8
8
|
className="${$}"
|
|
9
9
|
>
|
|
10
|
-
<script gp-data type="application/json">${
|
|
10
|
+
<script gp-data type="application/json">${e.dataStringify({position:g?.position,iconWidth:d?.iconWidth}).replaceAll("'","'")}</script>
|
|
11
11
|
${l.If(!L||!L.length,e.template`<div>${E}</div>`,e.template`
|
|
12
12
|
<div class="${m}" style="${j}">
|
|
13
13
|
<div class="${S}" style="${x}">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
${t}
|
|
27
27
|
</span>
|
|
28
28
|
</div>
|
|
29
|
-
${s.default({setting:{text:a?.toString(),htmlTag:"div",options:{customClass:{wrapper:"gp-w-full"}},isForceValue:!0},styles:k,className:
|
|
29
|
+
${s.default({setting:{text:a?.toString(),htmlTag:"div",options:{customClass:{wrapper:"gp-w-full"}},isForceValue:!0},styles:k,className:q})}
|
|
30
30
|
</div>`}).join(" ")}
|
|
31
31
|
</div>
|
|
32
32
|
</div>`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEVICES as e,makeStyleResponsive as t,getValueByDevice as o,getAspectRatioGlobalSize as l,getResponsiveValueByScreen as i,cls as r,GRADIENT_BGR_KEY as a}from"@gem-sdk/core";import{getImageSrc as n,createBlurDataURL as s}from"../../image/common/helpers.js";import{HREF_TO_SALES_PAGE as p}from"../../constant.js";import{DEFAULT_CLIP_PATH as b,VIDEO_IFRAME_SCALE as g}from"./const.js";let d=(t,o,l)=>{let r={};return e.map(e=>{let a=i(t,e),n=i(o,e),s=i(l,e);r={...r,[e]:1>=(a?.cols?.length||1)?n:s}}),r},c=(e,t)=>{if(!i(m(t),e))return!1;if(!t?.[e]){if("mobile"===e)return t?.tablet?.type==="image"||t?.desktop?.type==="image"&&!t?.tablet;if("tablet"===e)return t?.desktop?.type==="image"}return t?.[e]?.type==="image"},m=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},u=e=>{let t=m(e);return{desktop:s(t?.desktop?.width??0,t?.desktop?.height??0),tablet:s(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:s(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},h=(e,t,o,l)=>{if(!e)return"";let r=m(e),s=i(e,t),p=o?`url(${u(e)[t]})`:`url(${n(i(r,t),t,l)})`,b=s?.color?`, ${s.color}`:"";return s?.color?.includes(a)&&s?.type==="image"?`${p}${b}`:s?.color?.includes(a)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?p:"url()"},y=(o,l=!1,i=!1)=>{if(!o)return;let r={};return e.forEach(e=>{r={...r,[e]:h(o,e,l,i)}}),t("bgi",r)},f=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},I=(e,t,o)=>S(d(e,t,o)),v=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),k=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},w=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},C=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},A=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:l})=>{let i=C(e,t);return i?{...l,[o]:i}:l},j=(e,o)=>{let r=l(o);return["desktop","mobile","tablet"].forEach(t=>{let l=i(o,t),a=!!k(t,e);a&&(r=A({shapeByDevice:l,fallbackRatio:"auto",device:t,currentResult:r}))}),t("aspect",r)},S=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},Z=(e,o)=>{let l={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=!!k(t,o),n=r?.shape,s=r?.height;l={...l,[t]:"original"!==n||"fit-content"===s||a?"none":"block"}}),t("d",l)},B=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},P=(t,o)=>{let l=!1,r=e.reduce((e,r)=>{let a=i(t,r),n=i(o,r),s=B(a,n?.type==="video");return s&&(e[r]=s,l=!0),e},{});return{aspectRatio:l?r:void 0}},x=(t,l,i)=>e.reduce((e,r)=>{let a=o(t,r),n=a?.type==="video"?a?.videoType:void 0,s=o(l,r),p=i?.[r];return p&&"youtube"===n&&"cover"!==s&&(e[r]=p),e},{}),$=(e,t)=>{let{aspectRatio:o}=P(e,t);return o},D=(e,t,o)=>{let l=x(e,t,o);return Object.keys(l).length?l:void 0},R=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},T=(e,t)=>{let{top:o,height:l}=e,i=-l;return o<i?0:o>t?100:Math.min(Math.max((o-i)/(t-i)*100,0),100)},V=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,z=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:a?"150%":n?"100vh":"100%"}}),t("h",l)},M=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:n?"100vw":"100%"}}),t("w",l)},W=e=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{o={...o,[t]:e[t]?.attachment==="fixed"?"0px":""}}),t("top",o)},E=(e,t)=>{let o=z(e,t),l=M(e,t),i=W(e);return{...o,...l,...i}},G=(e,t=0,o=0)=>{let l=t,i=t;if(t>o?l=o:i=o,e>=999){let t=e-l;return t>0?t:0}let r=e-i;return r>0?r:0},L=(e,t)=>{if(!t)return`${b}`;let[o,l,i,r]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:s,bblr:p}=t,g=G(parseInt(a??"0")||0,o,r),d=G(parseInt(n??"0")||0,o,l),c=G(parseInt(s??"0")||0,l,i),m=G(parseInt(p??"0")||0,i,r);return[g,d,c,m].every(e=>0===e)?`${b}`:`inset(0 0 0 round ${g}px ${d}px ${c}px ${m}px)`},H=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),N=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let l=t[e]?.cols??[],i=l.length<=1,r=o[e];if(i&&r)return["space-between","top","center","bottom"].includes(r)?r:void 0},J=(t,o)=>{let l=Y(t),i=Y(o),r={desktop:N({device:"desktop",settingLayoutRes:l,contentPosition1ColRes:i}),tablet:N({device:"tablet",settingLayoutRes:l,contentPosition1ColRes:i}),mobile:N({device:"mobile",settingLayoutRes:l,contentPosition1ColRes:i})},a={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute tablet:[&>*:nth-child(2)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute mobile:[&>*:nth-child(2)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},n={};return e.forEach(e=>{let t=r[e],o=a?.[t]?.[e];n[o]=!0}),n},K=e=>{let t=Y(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",l=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",i=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":l,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":i,"mobile:!gp-h-auto":!i}},O=e=>{let t={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(o=>{let l=i(e,o);t={...t,[o]:l}}),r("space-between"===t.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===t.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${e?.tablet}`,"space-between"===t.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${e?.mobile}`)},X=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let r=i(e,l),a=!!k(l,t),n=r?.shape,s=r?.height;o={...o,[l]:"original"===n&&"fit-content"!==s&&!a}}),r(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},F=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",l=e.tablet||o,i=e.mobile||l;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[l]}`]:!0,[`mobile:gp-justify-${t[i]}`]:!0}},Y=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},U=t=>e.some(e=>{let l=o(t,e);return l?.type!=="color"&&l?.type!=="image"&&!!l&&(l?.videoType==="html5"&&l?.videoHtml5||l?.videoType==="youtube"&&l?.video)});function Q(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}let _="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",q=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:p,target:"_self"}:t},ee=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",et=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},eo=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,l="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||l},el=(e,t)=>{if(!e||!t)return 16/9;let o=i(e,t),l=o?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},ei=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},er=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},ea=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},en=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},es=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${g})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${g})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${g})`}}},ep=(e,t)=>{if(!e)return;let o=es(t);e.style.top=o.top,e.style.transform=o.transform},eb=({iframeEl:e,containerRatio:t,videoObjectFit:o,background:l,currentDevice:r,isYoutubeVideoMigrated:a})=>{let n,s;let p=el(l,r),b=i(l,r);if(!e||!t)return;let d=b?.videoAlign||"top",c=es(d);if("contain"===o){Object.assign(e.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${g})`});return}t>=p?(n=100,s=t/p*100):(s=100,n=p/t*100),Object.assign(e.style,{position:"absolute",top:c.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${s}%`,maxWidth:"none",transform:c.transform})};export{P as collectAspectRatioByDevice,x as collectYoutubeAspectRatio,Q as debounce,_ as fallbackImg,ee as formatHoverScale,$ as getAspectRatio,f as getAttachmentDevice,y as getBackgroundImageHeroBanner,q as getBannerLink,m as getBgImage,H as getClassAlignBanner,F as getClassContentPosition,X as getClassForContentByFitContent,O as getClassForStretchContent,J as getClassSpaceBetween,K as getClassSpaceBetweenLeftRight,L as getClipPath,en as getContainerRatio,d as getContentPosition,k as getDataVideoHeroBannerResponsive,Z as getDisplayStyleByFitContent,c as getEnableBgImageByDevice,eo as getOpacityHover,T as getPercentageVisible,Y as getResponsiveSetting,j as getStyleAspectRatioHeroBannerCustom,E as getStyleHeroBannerBg,el as getVideoAspectRatio,w as getVisibilityStyle,R as getWidth,D as getYoutubeAspectRatio,I as horizontalAlign,u as imagePlaceholder,V as isScaleImage,S as mapContentPositionToHorizontal,et as opacityEnabledData,ei as resetVideoIframeStyle,ea as resetVideoWrapperStyle,v as scrollToContentBanner,ep as setVideoIframeAlign,er as setVideoWrapperStyle,U as showVideoType,eb as updateVideoIframeSize};
|
|
1
|
+
import{DEVICES as e,makeStyleResponsive as t,getValueByDevice as o,getAspectRatioGlobalSize as l,getResponsiveValueByScreen as i,cls as r,GRADIENT_BGR_KEY as a}from"@gem-sdk/core";import{getImageSrc as n,createBlurDataURL as s}from"../../image/common/helpers.js";import{HREF_TO_SALES_PAGE as p}from"../../constant.js";import{DEFAULT_CLIP_PATH as b,VIDEO_IFRAME_SCALE as g}from"./const.js";let d=(t,o,l)=>{let r={};return e.map(e=>{let a=i(t,e),n=i(o,e),s=i(l,e);r={...r,[e]:1>=(a?.cols?.length||1)?n:s}}),r},c=(e,t)=>{if(!i(m(t),e))return!1;if(!t?.[e]){if("mobile"===e)return t?.tablet?.type==="image"||t?.desktop?.type==="image"&&!t?.tablet;if("tablet"===e)return t?.desktop?.type==="image"}return t?.[e]?.type==="image"},m=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},u=e=>{let t=m(e);return{desktop:s(t?.desktop?.width??0,t?.desktop?.height??0),tablet:s(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:s(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},h=(e,t,o,l)=>{if(!e)return"";let r=m(e),s=i(e,t),p=o?`url(${u(e)[t]})`:`url(${n(i(r,t),t,l)})`,b=s?.color?`, ${s.color}`:"";return s?.color?.includes(a)&&s?.type==="image"?`${p}${b}`:s?.color?.includes(a)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?p:"url()"},y=(o,l=!1,i=!1)=>{if(!o)return;let r={};return e.forEach(e=>{r={...r,[e]:h(o,e,l,i)}}),t("bgi",r)},f=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},I=(e,t,o)=>S(d(e,t,o)),v=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),k=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},w=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},C=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},A=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:l})=>{let i=C(e,t);return i?{...l,[o]:i}:l},j=(e,o)=>{let r=l(o);return["desktop","mobile","tablet"].forEach(t=>{let l=i(o,t),a=!!k(t,e);a&&(r=A({shapeByDevice:l,fallbackRatio:"auto",device:t,currentResult:r}))}),t("aspect",r)},S=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},Z=(e,o)=>{let l={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=!!k(t,o),n=r?.shape,s=r?.height;l={...l,[t]:"original"!==n||"fit-content"===s||a?"none":"block"}}),t("d",l)},B=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},P=(t,o)=>{let l=!1,r=e.reduce((e,r)=>{let a=i(t,r),n=i(o,r),s=B(a,n?.type==="video");return s&&(e[r]=s,l=!0),e},{});return{aspectRatio:l?r:void 0}},x=(t,l,i)=>e.reduce((e,r)=>{let a=o(t,r),n=a?.type==="video"?a?.videoType:void 0,s=o(l,r),p=i?.[r];return p&&"youtube"===n&&"cover"!==s&&(e[r]=p),e},{}),$=(e,t)=>{let{aspectRatio:o}=P(e,t);return o},D=(e,t,o)=>{let l=x(e,t,o);return Object.keys(l).length?l:void 0},R=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},T=(e,t)=>{let{top:o,height:l}=e,i=-l;return o<i?0:o>t?100:Math.min(Math.max((o-i)/(t-i)*100,0),100)},V=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,z=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:a?"150%":n?"100vh":"100%"}}),t("h",l)},M=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:n?"100vw":"100%"}}),t("w",l)},W=e=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{o={...o,[t]:e[t]?.attachment==="fixed"?"0px":""}}),t("top",o)},E=(e,t)=>{let o=z(e,t),l=M(e,t),i=W(e);return{...o,...l,...i}},G=(e,t=0,o=0)=>{let l=t,i=t;if(t>o?l=o:i=o,e>=999){let t=e-l;return t>0?t:0}let r=e-i;return r>0?r:0},L=(e,t)=>{if(!t)return`${b}`;let[o,l,i,r]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:s,bblr:p}=t,g=G(parseInt(a??"0")||0,o,r),d=G(parseInt(n??"0")||0,o,l),c=G(parseInt(s??"0")||0,l,i),m=G(parseInt(p??"0")||0,i,r);return[g,d,c,m].every(e=>0===e)?`${b}`:`inset(0 0 0 round ${g}px ${d}px ${c}px ${m}px)`},H=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),N=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let l=t[e]?.cols??[],i=l.length<=1,r=o[e];if(i&&r)return["space-between","top","center","bottom"].includes(r)?r:void 0},J=(t,o)=>{let l=Y(t),i=Y(o),r={desktop:N({device:"desktop",settingLayoutRes:l,contentPosition1ColRes:i}),tablet:N({device:"tablet",settingLayoutRes:l,contentPosition1ColRes:i}),mobile:N({device:"mobile",settingLayoutRes:l,contentPosition1ColRes:i})},a={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},n={};return e.forEach(e=>{let t=r[e],o=a?.[t]?.[e];n[o]=!0}),n},K=e=>{let t=Y(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",l=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",i=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":l,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":i,"mobile:!gp-h-auto":!i}},O=e=>{let t={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(o=>{let l=i(e,o);t={...t,[o]:l}}),r("space-between"===t.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===t.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${e?.tablet}`,"space-between"===t.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${e?.mobile}`)},X=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let r=i(e,l),a=!!k(l,t),n=r?.shape,s=r?.height;o={...o,[l]:"original"===n&&"fit-content"!==s&&!a}}),r(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},F=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",l=e.tablet||o,i=e.mobile||l;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[l]}`]:!0,[`mobile:gp-justify-${t[i]}`]:!0}},Y=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},U=t=>e.some(e=>{let l=o(t,e);return l?.type!=="color"&&l?.type!=="image"&&!!l&&(l?.videoType==="html5"&&l?.videoHtml5||l?.videoType==="youtube"&&l?.video)});function Q(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}let _="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",q=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:p,target:"_self"}:t},ee=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",et=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},eo=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,l="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||l},el=(e,t)=>{if(!e||!t)return 16/9;let o=i(e,t),l=o?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},ei=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},er=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},ea=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},en=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},es=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${g})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${g})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${g})`}}},ep=(e,t)=>{if(!e)return;let o=es(t);e.style.top=o.top,e.style.transform=o.transform},eb=({iframeEl:e,containerRatio:t,videoObjectFit:o,background:l,currentDevice:r,isYoutubeVideoMigrated:a})=>{let n,s;let p=el(l,r),b=i(l,r);if(!e||!t)return;let d=b?.videoAlign||"top",c=es(d);if("contain"===o){Object.assign(e.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${g})`});return}t>=p?(n=100,s=t/p*100):(s=100,n=p/t*100),Object.assign(e.style,{position:"absolute",top:c.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${s}%`,maxWidth:"none",transform:c.transform})};export{P as collectAspectRatioByDevice,x as collectYoutubeAspectRatio,Q as debounce,_ as fallbackImg,ee as formatHoverScale,$ as getAspectRatio,f as getAttachmentDevice,y as getBackgroundImageHeroBanner,q as getBannerLink,m as getBgImage,H as getClassAlignBanner,F as getClassContentPosition,X as getClassForContentByFitContent,O as getClassForStretchContent,J as getClassSpaceBetween,K as getClassSpaceBetweenLeftRight,L as getClipPath,en as getContainerRatio,d as getContentPosition,k as getDataVideoHeroBannerResponsive,Z as getDisplayStyleByFitContent,c as getEnableBgImageByDevice,eo as getOpacityHover,T as getPercentageVisible,Y as getResponsiveSetting,j as getStyleAspectRatioHeroBannerCustom,E as getStyleHeroBannerBg,el as getVideoAspectRatio,w as getVisibilityStyle,R as getWidth,D as getYoutubeAspectRatio,I as horizontalAlign,u as imagePlaceholder,V as isScaleImage,S as mapContentPositionToHorizontal,et as opacityEnabledData,ei as resetVideoIframeStyle,ea as resetVideoWrapperStyle,v as scrollToContentBanner,ep as setVideoIframeAlign,er as setVideoWrapperStyle,U as showVideoType,eb as updateVideoIframeSize};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import{dataStringify as s,template as i,RenderIf as t,isLocalEnv as e,baseAssetURL as l}from"@gem-sdk/core";import{getSettingPreloadData as o}from"../../helpers.js";import r from"../../text/components/Text.liquid.js";import{createClass as p,createStyle as a,createAttr as d,If as
|
|
1
|
+
import{dataStringify as s,template as i,RenderIf as t,isLocalEnv as e,baseAssetURL as l}from"@gem-sdk/core";import{getSettingPreloadData as o}from"../../helpers.js";import r from"../../text/components/Text.liquid.js";import{createClass as p,createStyle as a,createAttr as d,If as c}from"@gem-sdk/system";import{getClassWraplistIcon as n,getClassColListIcon as m,getClassWrapItemIcon as $,getClassWrapIcon as u,getClassIcon as g,getClassTextItem as v}from"../common/classes.js";import{getStyleContainerIconlistMain as y,getStyleWraplistIcon as f,getStyleColListIcon as j,getStyleWrapIcon as h,getStyleWrapItemIcon as q,getStyleIcon as x,getStyleTypoText as S}from"../common/styles.js";import{getvalueMap as k,getTextIconTranslations as E,getTextIconNotFound as A}from"../common/helpers.js";let N=N=>{let{builderProps:T,builderAttrs:V,style:_,setting:w,styles:C,pageContext:G}=N,I=T?.builderData?.advanced,L=p({[T?.uid??""]:!0}),O=p(n()),W=p(m()),b=p($({builderProps:T})),D=p(u()),F=p(g()),M=p(v({setting:w})),P=a(y({styles:C,style:_,type:"liquid",advanced:I})),R=a(f({styles:C,uid:T?.uid??"",pageContext:G,type:"Liquid"})),z=a(j({styles:C})),B=a(h({styles:C,setting:w})),H=a(q({styles:C})),J=a(x({styles:C,setting:w})),K=S({setting:w}),Q=d({...V}),U=A("liquid"),X=k({setting:w});return i`
|
|
2
2
|
{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
|
|
3
3
|
<gp-icon-list
|
|
4
4
|
${{...Q}}
|
|
5
|
-
${{...
|
|
6
|
-
data-id="${
|
|
7
|
-
style="${
|
|
8
|
-
className="${
|
|
5
|
+
${{...T}}
|
|
6
|
+
data-id="${T?.uid}"
|
|
7
|
+
style="${P}"
|
|
8
|
+
className="${L}"
|
|
9
9
|
>
|
|
10
|
-
<script gp-data type="application/json">${
|
|
11
|
-
${
|
|
12
|
-
<div class="${
|
|
13
|
-
<div class="${W}" style="${
|
|
14
|
-
${X?.map((s,t)=>{let e=E({setting:
|
|
10
|
+
<script gp-data type="application/json">${s({position:C?.position,iconWidth:w?.iconWidth}).replaceAll("'","'")}</script>
|
|
11
|
+
${c(!X||!X.length,i`<div>${U}</div>`,i`
|
|
12
|
+
<div class="${O}" style="${R}">
|
|
13
|
+
<div class="${W}" style="${z}">
|
|
14
|
+
${X?.map((s,t)=>{let e=E({setting:w,builderProps:T,pageContext:G,key:t,type:"liquid"});return i`
|
|
15
15
|
<div
|
|
16
16
|
key="${t}"
|
|
17
17
|
data-index="${t}"
|
|
18
18
|
class="${b}"
|
|
19
|
-
style="${
|
|
19
|
+
style="${H}"
|
|
20
20
|
>
|
|
21
|
-
<div class="${D}" style="${
|
|
21
|
+
<div class="${D}" style="${B}">
|
|
22
22
|
<span
|
|
23
23
|
class="${F}"
|
|
24
|
-
style="${
|
|
24
|
+
style="${J}"
|
|
25
25
|
>
|
|
26
26
|
${s}
|
|
27
27
|
</span>
|
|
28
28
|
</div>
|
|
29
|
-
${r({setting:{text:e?.toString(),htmlTag:"div",options:{customClass:{wrapper:"gp-w-full"}},isForceValue:!0},styles:K,className:
|
|
29
|
+
${r({setting:{text:e?.toString(),htmlTag:"div",options:{customClass:{wrapper:"gp-w-full"}},isForceValue:!0},styles:K,className:M})}
|
|
30
30
|
</div>`}).join(" ")}
|
|
31
31
|
</div>
|
|
32
32
|
</div>`)}
|
|
33
33
|
</gp-icon-list>
|
|
34
34
|
${t(e,`<script ${o('class="gps-link" delay',"src")}="{{ 'gp-icon-list-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${o('class="gps-link" delay',"src")}="${l}/assets-v2/gp-icon-list-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
35
|
-
`};export{
|
|
35
|
+
`};export{N as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "17.0.0-dev.
|
|
3
|
+
"version": "17.0.0-dev.127",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"i18n:extract": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/translate/extract-texts-to-locales.js && node ./scripts/translate/en-keys-usage.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "17.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "17.0.0-dev.125",
|
|
30
30
|
"@gem-sdk/styles": "17.0.0-dev.118",
|
|
31
31
|
"@gem-sdk/system": "17.0.0-dev.93",
|
|
32
32
|
"@types/react-transition-group": "^4.4.12",
|