@gem-sdk/components 18.4.2 → 18.4.4

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.
@@ -0,0 +1 @@
1
+ "use strict";exports.checkIsEmpty=e=>{let t=document.createElement("div");t.innerHTML=e;let r=t.querySelector("embed, img, input, picture, video");return!r&&!t?.textContent?.trim()},exports.removeScriptTags=e=>e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/>/gi,"");
@@ -1,11 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react");const s=["SCRIPT"],l=["EMBED","IMG","INPUT","PICTURE","VIDEO"];exports.default=(p,n)=>{let a=e.useEditorMode(),{editorData:i}=p||{},{customLabel:o}=n||{},r=t.useCallback((e,t,s)=>`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react"),s=require("../common/helpers.js");exports.default=(p,r)=>{let o=e.useEditorMode(),{editorData:l}=p||{},{customLabel:i}=r||{},a=t.useMemo(()=>`
2
2
  <p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
3
- <span>${o||"Custom Code"}</span>
4
- ${e||t||s?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Publish the page to see the content.</span>':""}
5
- </p>`,[o]),c=(e,t)=>{let p=document.createElement("div");p.innerHTML=e;let n=p.childNodes,a=!1,i=!0;if(n.length>0){n.forEach(e=>{s.includes(e?.tagName)&&(a=!0,e?.remove())});let e=p.childNodes;e.forEach(e=>{if(l.includes(e?.tagName))i=!1;else if(e?.nodeName!=="#comment"){let t=e?.textContent?.trim();t&&(i=!1)}})}return i&&(i=!p?.textContent?.trim()),t&&(a=!0),{empty:i,hasScript:a}},g=t.useMemo(()=>{if("edit"===a){let{empty:e,hasScript:t}=c(i?.html||"",i?.javascript||"");if(t)return`
6
- <div class="gp-py-4 gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
7
- <p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
8
- Publish the page to see the content.
9
- </p>
10
- </div>
11
- `;if(e)return r(i?.css||"",i?.javascript||"",i?.html||"")}return i?.html?.trim()},[a,i?.html,i?.javascript,i?.css,r]);return{mode:a,htmlPlainText:g,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};
3
+ <span>${i||"Custom Code"}</span>
4
+ ${l?.css||l?.javascript||l?.html?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5" data-test="publish-hint">Publish the page to see the content.</span>':""}
5
+ </p>`,[i]),n=t.useMemo(()=>{if("edit"===o){let e=s.removeScriptTags(l?.html||""),t=s.checkIsEmpty(e);return t?a:e.trim()}return l?.html?.trim()},[o,l?.html,a]);return{mode:o,htmlPlainText:n,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("./common/common.js"),i=require("./components/feature-gallery/FeatureImageWithGallery.liquid.js"),r=require("./components/gallery-carousel/GalleryCarousel.liquid.js"),s=require("./components/gallery-grid/GalleryGrid.liquid.js"),a=require("../../../helpers.js"),o=require("./common/productGallery.js"),l=require("./composables/getProductImagesClassName.js"),d=require("./composables/getProductImagesStyles.js"),u=require("@gem-sdk/system"),p=require("./common/getBorderActiveCss.js"),g=require("../../helpers/function.js");exports.default=n=>{let c=t.setDefaultWhenUndefineSetting(n),{setting:m,styles:f,builderProps:y,style:$}=c,{rawChildren:S,pageContext:I}=n,{enableLazyLoadImage:h}=I??{},v={...m,...f},q=`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("./common/common.js"),r=require("./components/feature-gallery/FeatureImageWithGallery.liquid.js"),i=require("./components/gallery-carousel/GalleryCarousel.liquid.js"),s=require("./components/gallery-grid/GalleryGrid.liquid.js"),a=require("../../../helpers.js"),o=require("./common/productGallery.js"),l=require("./composables/getProductImagesClassName.js"),d=require("./composables/getProductImagesStyles.js"),u=require("@gem-sdk/system"),p=require("./common/getBorderActiveCss.js"),n=require("../../helpers/function.js");exports.default=c=>{let g=t.setDefaultWhenUndefineSetting(c),{setting:m,styles:f,builderProps:y,style:$}=g,{rawChildren:S,pageContext:I}=c,{enableLazyLoadImage:h}=I??{},q={...m,...f},v=`
2
2
  {
3
3
  "id":${JSON.stringify(y?.uid)},
4
4
  "pageContext": ${JSON.stringify(a.filterPageContext(I))},
@@ -9,35 +9,33 @@
9
9
  "collectionUrl": {{ collection.url | json | escape }},
10
10
  "collection": {{ collection | json | escape}}
11
11
  }
12
- `,j=u.createAttr({"section-id":"{{section.id}}","data-id":`${y?.uid}`}),{isOnlyFeatureAllDevices:C,isRenderGalleryGrid:F}=t.getConditionRenderGalleryImages(v?.position,m?.type),O=F?{}:u.createAttr({"data-only-image":u.LiquidIf("product.media.size > 1","false","true")}),{wrapperClasses:P,productImagesGalleryClasses:L}=l.getProductImagesClassName(n),b=u.createClass({"gp-grid gp-w-full !gp-m-0 gp-relative":!0}),D=u.createClass({"gp-w-full !gp-m-0 gp-relative":!0}),{wrapContainerStyle:G,wrapContainerStyleOnlyOneImage:z,galleryImageStyle:A}=d.getProductImagesStyles(v),N=o.getShapeByLayout({shape:v.shape,shapeForBottom:v.shapeForBottom,shapeFor1Col:v.shapeFor1Col,shapeFor2Col:v.shapeFor2Col,shapeForFtOnly:v.shapeForFtOnly,shapeForInsideBottom:v.shapeForInsideBottom??o.sizeSettingDefaultForNewLayout,shapeForInside:v.shapeForInside??o.sizeSettingDefaultForNewLayout},v.position),_=t.getStyleInsideLayout(v.position,N,v?.spacing),B=i=>{let r=t.getProductBadgeVisibilityStyle(v?.position,i);return e.template`
13
- <div style="${g.getStyleOfObject(r)}">
14
- ${e.WrapRenderChildren({uid:y?.uid||"",customProps:S?.[0].customProps},S?.map(t=>{if(t)return e.template`${e.RenderChildren({...t,isInsideProductImage:!0,imageData:{imageShape:f?.ftShape,imageAlign:f?.align,imageLayout:f?.position},dotData:{dotSize:m?.ftDotSize,dotGapToCarousel:m?.ftDotGapToCarousel,dotStyle:m?.ftDotStyle}})}`}))}
15
- </div>
16
- `};return e.template`
17
- ${u.If(m?.borderActive?.border!=="none",u.LiquidIf("product.media.size > 1",`<style>${p.getBorderActiveCss({settings:v,uid:y?.uid,type:"Liquid"})}</style>`),"")}
12
+ `,j=u.createAttr({"section-id":"{{section.id}}","data-id":`${y?.uid}`}),{isOnlyFeatureAllDevices:C,isRenderGalleryGrid:F}=t.getConditionRenderGalleryImages(q?.position,m?.type),L=F?{}:u.createAttr({"data-only-image":u.LiquidIf("product.media.size > 1","false","true")}),{wrapperClasses:P,productImagesGalleryClasses:O}=l.getProductImagesClassName(c),D=u.createClass({"gp-grid gp-w-full !gp-m-0 gp-relative":!0}),b=u.createClass({"gp-w-full !gp-m-0 gp-relative":!0}),{wrapContainerStyle:G,wrapContainerStyleOnlyOneImage:z,galleryImageStyle:A}=d.getProductImagesStyles(q),N=o.getShapeByLayout({shape:q.shape,shapeForBottom:q.shapeForBottom,shapeFor1Col:q.shapeFor1Col,shapeFor2Col:q.shapeFor2Col,shapeForFtOnly:q.shapeForFtOnly,shapeForInsideBottom:q.shapeForInsideBottom??o.sizeSettingDefaultForNewLayout,shapeForInside:q.shapeForInside??o.sizeSettingDefaultForNewLayout},q.position),_=t.getStyleInsideLayout(q.position,N,q?.spacing),B=()=>e.template`
13
+ ${e.WrapRenderChildren({uid:y?.uid||"",customProps:S?.[0].customProps},S?.map(t=>{if(t)return e.template`${e.RenderChildren({...t,isInsideProductImage:!0,imageData:{imageShape:f?.ftShape,imageAlign:f?.align,imageLayout:f?.position},dotData:{dotSize:m?.ftDotSize,dotGapToCarousel:m?.ftDotGapToCarousel,dotStyle:m?.ftDotStyle}})}`}))}
14
+ `;return e.template`
15
+ ${u.If(m?.borderActive?.border!=="none",u.LiquidIf("product.media.size > 1",`<style>${p.getBorderActiveCss({settings:q,uid:y?.uid,type:"Liquid"})}</style>`),"")}
18
16
  ${u.Liquid(`
19
17
  {% assign featured_image = product.featured_image %}
20
18
  ${u.LiquidIf("variant != null and variant.featured_image != null","{% assign featured_image = variant.featured_image %}")}
21
19
  `)}
22
20
  <gp-product-images-v3
23
- gp-data='${q}'
21
+ gp-data='${v}'
24
22
  ${{...j}}
25
23
  style="${{...$}}"
26
24
  class="${P}"
27
25
  >
28
26
  <div
29
- class="${u.LiquidIf("product.media.size > 1",`${b}`,`${D}`)}"
30
- style="${u.LiquidIf("product.media.size > 1",g.getStyleOfObject(G),g.getStyleOfObject(z))}"
27
+ class="${u.LiquidIf("product.media.size > 1",`${D}`,`${b}`)}"
28
+ style="${u.LiquidIf("product.media.size > 1",n.getStyleOfObject(G),n.getStyleOfObject(z))}"
31
29
  >
32
- ${i.default({builderPropUID:`gp-carousel-${y?.uid}`,...v,children:B("feature"),enableLazyLoadImage:h})}
30
+ ${r.default({builderPropUID:`gp-carousel-${y?.uid}`,...q,children:B(),enableLazyLoadImage:h})}
33
31
  ${u.If(!C,e.template`
34
32
  <div
35
- class="${L}"
36
- style="${g.getStyleOfObject(A)}"
37
- ${{...O}}
33
+ class="${O}"
34
+ style="${n.getStyleOfObject(A)}"
35
+ ${{...L}}
38
36
  >
39
- ${u.LiquidIf("product.media.size > 1",r.default({builderPropUID:`gp-gallery-${y?.uid}`,...v,enableLazyLoadImage:h}))}
40
- ${u.If(F,s.default({builderPropUID:y?.uid,wrapperStyle:{..._},children:B("grid"),...v,enableLazyLoadImage:h}))}
37
+ ${u.LiquidIf("product.media.size > 1",i.default({builderPropUID:`gp-gallery-${y?.uid}`,...q,enableLazyLoadImage:h}))}
38
+ ${u.If(F,s.default({builderPropUID:y?.uid,wrapperStyle:{..._},children:B(),...q,enableLazyLoadImage:h}))}
41
39
  </div>
42
40
  `)}
43
41
  </div>
@@ -1 +1 @@
1
- "use strict";var e=require("@gem-sdk/core");const t=["one-col","two-col"],o=e=>"one-col"===e||"two-col"===e,r=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let o=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(o))?t:Number(o)},i=t=>{let o={};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t,r)?.shapeValue;if(i)o={...o,[r]:i};else{let i=e.getResponsiveValueByScreen(t,r)?.shape;switch(i){case"square":o={...o,[r]:"1/1"};break;case"vertical":o={...o,[r]:"3/4"};break;case"horizontal":o={...o,[r]:"4/3"};break;case"original":o={...o,[r]:""}}}}),e.makeAspectRatio(o)},l=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},s=(t,r)=>{let i=e.getResponsiveValueByScreen(t,r);return o(i)},n=e=>{let t=e.match(/\d+/g);return t?t[0]:e};exports.checkAddOverFlowClass=e=>{let t=e?.["--radius"],o=e?.["--bblr"]||"0px",r=e?.["--bbrr"]||"0px",i=e?.["--btlr"]||"0px",l=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==o||"0px"!==r||"0px"!==i||"0px"!==l},exports.convertSpacing=e=>{if(!e)return{desktop:5};let t=r(e.desktop,5),o=r(e.tablet,t),i=r(e.mobile,o);return{desktop:t,tablet:o,mobile:i}},exports.convertSpacingForIndisdeLayout=l,exports.convertUnitToNumber=r,exports.getAspectRatio=i,exports.getConditionRenderGalleryImages=(t,r)=>{let i=!0,l=!1;return["desktop","mobile","tablet"].forEach(s=>{let n=e.getResponsiveValueByScreen(t,s),a=e.getResponsiveValueByScreen(r,s);n&&"only-feature"!==n&&(i=!1),(o(n)||"images"===a)&&(l=!0)}),{isOnlyFeatureAllDevices:i,isRenderGalleryGrid:l}},exports.getDisplayStyle=(e,t)=>{let o={};return["desktop","mobile","tablet"].forEach(r=>{o={...o,[`--d${"desktop"===r?"":`-${r}`}`]:`${e(r)?"none":t}`}}),o},exports.getPaddingBottomByShapeSetting=t=>{let o=i(t),r={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(i=>{let l=e.getResponsiveValueByScreen(t,i),s=l?.height,a=l?.width||"",p=n(s||""),u=a.toString().match(/px/g)?n(a):a;if(s&&a&&!isNaN(Number(p))&&!isNaN(Number(u))){r={...r,[i]:`${Number(p)/Number(u)*100}%`};return}if(s&&!isNaN(Number(p))){r={...r,[i]:s};return}let d=o?.[i]!=="auto"&&o?.[i]?o?.[i]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";r={...r,[i]:`calc((${d})*100%)`}}),r},exports.getProductBadgeVisibilityStyle=(t,o="feature")=>{let r={desktop:"none",tablet:"none",mobile:"none"};return e.DEVICES.forEach(e=>{let i=s(t,e);r[e]=("grid"===o?i:!i)?"block":"none"}),e.makeStyleResponsive("d",r)},exports.getSrcImage=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,exports.getStyleGridLayout=t=>{let o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let r=!1;e.DEVICES.forEach(i=>{let l=e.getResponsiveValueByScreen(t.position,i),s=e.getResponsiveValueByScreen(t.ratioLayout,i),n=e.getResponsiveValueByScreen(t.ratioLayoutRight,i),a="desktop"===i?"--gtc":`--gtc-${i}`,p="desktop"===i?"--gtr":`--gtr-${i}`,u="left"===l?s:n,d=["left","right"].includes(l||"");d&&u?(r=!0,Object.assign(o={...o,[a]:`minmax(0, ${u[0]}fr) minmax(0, ${u[1]}fr)`},{[p]:"fit-content(0)"})):r&&Object.assign(o,{[p]:"unset"})})}return o},exports.getStyleGridOrderForFeature=t=>{let o={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t.position,r),l="desktop"===r?"--o":`--o-${r}`;o={...o,[l]:"left"===i?"1":"0"}}),o},exports.getStyleGridOrderForGallery=t=>{let o={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t.position,r),l="desktop"===r?"--o":`--o-${r}`;o={...o,[l]:"left"===i?"0":"1"}}),o},exports.getStyleInsideLayout=(o,r,i)=>{let s={},n={},a={},p={},u={},d={};return["desktop","mobile","tablet"].forEach(c=>{let m=e.getResponsiveValueByScreen(o,c),g=e.getResponsiveValueByScreen(r,c)?.width,b=e.getResponsiveValueByScreen(i,c);if(s={...s,[c]:["inside-bottom","inside-left","inside-right"].includes(m)?"absolute":"static"},["inside-bottom"].includes(m)){let e=l(b);g=`calc(100% - ${e})`}["bottom-center",...t].includes(m)&&(g="100%"),a={...a,[c]:"inside-bottom"===m?`${b}`:"auto"},p={...p,[c]:["inside-left","inside-right"].includes(m)?`${b}`:"auto"},d={...d,[c]:["inside-bottom","inside-left"].includes(m)?`${b}`:"auto"},u={...u,[c]:"inside-right"===m?`${b}`:"auto"},n={...n,[c]:g}}),{...e.makeStyleResponsive("pos",s),...e.makeStyleResponsive("w",e.removeNullUndefined(n)),...e.makeStyleResponsive("bottom",e.removeNullUndefined(a)),...e.makeStyleResponsive("top",e.removeNullUndefined(p)),...e.makeStyleResponsive("left",e.removeNullUndefined(d)),...e.makeStyleResponsive("right",e.removeNullUndefined(u))}},exports.getTypeWidthDevice=e=>{let t=e?.desktop,o=e?.tablet===void 0?t:e?.tablet,r=e?.mobile===void 0?o:e?.mobile;return{desktop:t,tablet:o,mobile:r}},exports.setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}});
1
+ "use strict";var e=require("@gem-sdk/core");const t=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let o=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(o))?t:Number(o)},o=t=>{let o={};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t,r)?.shapeValue;if(i)o={...o,[r]:i};else{let i=e.getResponsiveValueByScreen(t,r)?.shape;switch(i){case"square":o={...o,[r]:"1/1"};break;case"vertical":o={...o,[r]:"3/4"};break;case"horizontal":o={...o,[r]:"4/3"};break;case"original":o={...o,[r]:""}}}}),e.makeAspectRatio(o)},r=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},i=e=>{let t=e.match(/\d+/g);return t?t[0]:e};exports.checkAddOverFlowClass=e=>{let t=e?.["--radius"],o=e?.["--bblr"]||"0px",r=e?.["--bbrr"]||"0px",i=e?.["--btlr"]||"0px",l=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==o||"0px"!==r||"0px"!==i||"0px"!==l},exports.convertSpacing=e=>{if(!e)return{desktop:5};let o=t(e.desktop,5),r=t(e.tablet,o),i=t(e.mobile,r);return{desktop:o,tablet:r,mobile:i}},exports.convertSpacingForIndisdeLayout=r,exports.convertUnitToNumber=t,exports.getAspectRatio=o,exports.getConditionRenderGalleryImages=(t,o)=>{let r=!0,i=!1;return["desktop","mobile","tablet"].forEach(l=>{let s=e.getResponsiveValueByScreen(t,l),n=e.getResponsiveValueByScreen(o,l);s&&"only-feature"!==s&&(r=!1),(["two-col","one-col"].includes(s)||"images"===n)&&(i=!0)}),{isOnlyFeatureAllDevices:r,isRenderGalleryGrid:i}},exports.getDisplayStyle=(e,t)=>{let o={};return["desktop","mobile","tablet"].forEach(r=>{o={...o,[`--d${"desktop"===r?"":`-${r}`}`]:`${e(r)?"none":t}`}}),o},exports.getPaddingBottomByShapeSetting=t=>{let r=o(t),l={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(o=>{let s=e.getResponsiveValueByScreen(t,o),n=s?.height,a=s?.width||"",p=i(n||""),u=a.toString().match(/px/g)?i(a):a;if(n&&a&&!isNaN(Number(p))&&!isNaN(Number(u))){l={...l,[o]:`${Number(p)/Number(u)*100}%`};return}if(n&&!isNaN(Number(p))){l={...l,[o]:n};return}let d=r?.[o]!=="auto"&&r?.[o]?r?.[o]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";l={...l,[o]:`calc((${d})*100%)`}}),l},exports.getSrcImage=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,exports.getStyleGridLayout=t=>{let o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let r=!1;e.DEVICES.forEach(i=>{let l=e.getResponsiveValueByScreen(t.position,i),s=e.getResponsiveValueByScreen(t.ratioLayout,i),n=e.getResponsiveValueByScreen(t.ratioLayoutRight,i),a="desktop"===i?"--gtc":`--gtc-${i}`,p="desktop"===i?"--gtr":`--gtr-${i}`,u="left"===l?s:n,d=["left","right"].includes(l||"");d&&u?(r=!0,Object.assign(o={...o,[a]:`minmax(0, ${u[0]}fr) minmax(0, ${u[1]}fr)`},{[p]:"fit-content(0)"})):r&&Object.assign(o,{[p]:"unset"})})}return o},exports.getStyleGridOrderForFeature=t=>{let o={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t.position,r),l="desktop"===r?"--o":`--o-${r}`;o={...o,[l]:"left"===i?"1":"0"}}),o},exports.getStyleGridOrderForGallery=t=>{let o={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(r=>{let i=e.getResponsiveValueByScreen(t.position,r),l="desktop"===r?"--o":`--o-${r}`;o={...o,[l]:"left"===i?"0":"1"}}),o},exports.getStyleInsideLayout=(t,o,i)=>{let l={},s={},n={},a={},p={},u={};return["desktop","mobile","tablet"].forEach(d=>{let c=e.getResponsiveValueByScreen(t,d),m=e.getResponsiveValueByScreen(o,d)?.width,g=e.getResponsiveValueByScreen(i,d);if(l={...l,[d]:["inside-bottom","inside-left","inside-right"].includes(c)?"absolute":"static"},["inside-bottom"].includes(c)){let e=r(g);m=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(c)&&(m="100%"),n={...n,[d]:"inside-bottom"===c?`${g}`:"auto"},a={...a,[d]:["inside-left","inside-right"].includes(c)?`${g}`:"auto"},u={...u,[d]:["inside-bottom","inside-left"].includes(c)?`${g}`:"auto"},p={...p,[d]:"inside-right"===c?`${g}`:"auto"},s={...s,[d]:m}}),{...e.makeStyleResponsive("pos",l),...e.makeStyleResponsive("w",e.removeNullUndefined(s)),...e.makeStyleResponsive("bottom",e.removeNullUndefined(n)),...e.makeStyleResponsive("top",e.removeNullUndefined(a)),...e.makeStyleResponsive("left",e.removeNullUndefined(u)),...e.makeStyleResponsive("right",e.removeNullUndefined(p))}},exports.getTypeWidthDevice=e=>{let t=e?.desktop,o=e?.tablet===void 0?t:e?.tablet,r=e?.mobile===void 0?o:e?.mobile;return{desktop:t,tablet:o,mobile:r}},exports.setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}});
@@ -0,0 +1 @@
1
+ let e=e=>{let t=document.createElement("div");t.innerHTML=e;let r=t.querySelector("embed, img, input, picture, video");return!r&&!t?.textContent?.trim()},t=e=>e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/>/gi,"");export{e as checkIsEmpty,t as removeScriptTags};
@@ -1,11 +1,5 @@
1
- import{useEditorMode as e}from"@gem-sdk/core";import{useCallback as t,useMemo as p}from"react";let l=["SCRIPT"],s=["EMBED","IMG","INPUT","PICTURE","VIDEO"],n=(n,a)=>{let o=e(),{editorData:i}=n||{},{customLabel:r}=a||{},g=t((e,t,p)=>`
1
+ import{useEditorMode as t}from"@gem-sdk/core";import{useMemo as e}from"react";import{removeScriptTags as p,checkIsEmpty as o}from"../common/helpers.js";let s=(s,l)=>{let r=t(),{editorData:a}=s||{},{customLabel:i}=l||{},m=e(()=>`
2
2
  <p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
3
- <span>${r||"Custom Code"}</span>
4
- ${e||t||p?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Publish the page to see the content.</span>':""}
5
- </p>`,[r]),c=(e,t)=>{let p=document.createElement("div");p.innerHTML=e;let n=p.childNodes,a=!1,o=!0;if(n.length>0){n.forEach(e=>{l.includes(e?.tagName)&&(a=!0,e?.remove())});let e=p.childNodes;e.forEach(e=>{if(s.includes(e?.tagName))o=!1;else if(e?.nodeName!=="#comment"){let t=e?.textContent?.trim();t&&(o=!1)}})}return o&&(o=!p?.textContent?.trim()),t&&(a=!0),{empty:o,hasScript:a}},d=p(()=>{if("edit"===o){let{empty:e,hasScript:t}=c(i?.html||"",i?.javascript||"");if(t)return`
6
- <div class="gp-py-4 gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
7
- <p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
8
- Publish the page to see the content.
9
- </p>
10
- </div>
11
- `;if(e)return g(i?.css||"",i?.javascript||"",i?.html||"")}return i?.html?.trim()},[o,i?.html,i?.javascript,i?.css,g]);return{mode:o,htmlPlainText:d,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};export{n as default};
3
+ <span>${i||"Custom Code"}</span>
4
+ ${a?.css||a?.javascript||a?.html?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5" data-test="publish-hint">Publish the page to see the content.</span>':""}
5
+ </p>`,[i]),n=e(()=>{if("edit"===r){let t=p(a?.html||""),e=o(t);return e?m:t.trim()}return a?.html?.trim()},[r,a?.html,m]);return{mode:r,htmlPlainText:n,handleDoubleClickCustomCode:t=>{if(2===t.detail){let t=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(t)}}}};export{s as default};
@@ -1,46 +1,44 @@
1
- import{isLocalEnv as e,baseAssetURL as o,template as r,WrapRenderChildren as t,RenderChildren as s}from"@gem-sdk/core";import{getConditionRenderGalleryImages as i,getStyleInsideLayout as a,setDefaultWhenUndefineSetting as p,getProductBadgeVisibilityStyle as l}from"./common/common.js";import d from"./components/feature-gallery/FeatureImageWithGallery.liquid.js";import m from"./components/gallery-carousel/GalleryCarousel.liquid.js";import c from"./components/gallery-grid/GalleryGrid.liquid.js";import{filterPageContext as u,getSettingPreloadData as n}from"../../../helpers.js";import{getShapeByLayout as g,sizeSettingDefaultForNewLayout as f}from"./common/productGallery.js";import{getProductImagesClassName as $}from"./composables/getProductImagesClassName.js";import{getProductImagesStyles as y}from"./composables/getProductImagesStyles.js";import{createAttr as h,LiquidIf as v,createClass as S,If as j,Liquid as F}from"@gem-sdk/system";import{getBorderActiveCss as I}from"./common/getBorderActiveCss.js";import{getStyleOfObject as C}from"../../helpers/function.js";let P=P=>{let G=p(P),{setting:D,styles:b,builderProps:z,style:O}=G,{rawChildren:_,pageContext:N}=P,{enableLazyLoadImage:A}=N??{},B={...D,...b},U=`
1
+ import{isLocalEnv as e,baseAssetURL as o,template as r,WrapRenderChildren as s,RenderChildren as t}from"@gem-sdk/core";import{getConditionRenderGalleryImages as i,getStyleInsideLayout as a,setDefaultWhenUndefineSetting as p}from"./common/common.js";import l from"./components/feature-gallery/FeatureImageWithGallery.liquid.js";import d from"./components/gallery-carousel/GalleryCarousel.liquid.js";import m from"./components/gallery-grid/GalleryGrid.liquid.js";import{filterPageContext as c,getSettingPreloadData as u}from"../../../helpers.js";import{getShapeByLayout as n,sizeSettingDefaultForNewLayout as g}from"./common/productGallery.js";import{getProductImagesClassName as f}from"./composables/getProductImagesClassName.js";import{getProductImagesStyles as $}from"./composables/getProductImagesStyles.js";import{createAttr as y,LiquidIf as h,createClass as v,If as S,Liquid as j}from"@gem-sdk/system";import{getBorderActiveCss as F}from"./common/getBorderActiveCss.js";import{getStyleOfObject as I}from"../../helpers/function.js";let C=C=>{let P=p(C),{setting:G,styles:D,builderProps:b,style:z}=P,{rawChildren:O,pageContext:_}=C,{enableLazyLoadImage:N}=_??{},A={...G,...D},B=`
2
2
  {
3
- "id":${JSON.stringify(z?.uid)},
4
- "pageContext": ${JSON.stringify(u(N))},
5
- "setting":${JSON.stringify(D)},
6
- "styles":${JSON.stringify(b)},
3
+ "id":${JSON.stringify(b?.uid)},
4
+ "pageContext": ${JSON.stringify(c(_))},
5
+ "setting":${JSON.stringify(G)},
6
+ "styles":${JSON.stringify(D)},
7
7
  "productUrl":{{product.url | json | escape}},
8
8
  "product":{{product | json | escape}},
9
9
  "collectionUrl": {{ collection.url | json | escape }},
10
10
  "collection": {{ collection | json | escape}}
11
11
  }
12
- `,k=h({"section-id":"{{section.id}}","data-id":`${z?.uid}`}),{isOnlyFeatureAllDevices:q,isRenderGalleryGrid:E}=i(B?.position,D?.type),J=E?{}:h({"data-only-image":v("product.media.size > 1","false","true")}),{wrapperClasses:w,productImagesGalleryClasses:T}=$(P),x=S({"gp-grid gp-w-full !gp-m-0 gp-relative":!0}),L=S({"gp-w-full !gp-m-0 gp-relative":!0}),{wrapContainerStyle:M,wrapContainerStyleOnlyOneImage:R,galleryImageStyle:V}=y(B),W=g({shape:B.shape,shapeForBottom:B.shapeForBottom,shapeFor1Col:B.shapeFor1Col,shapeFor2Col:B.shapeFor2Col,shapeForFtOnly:B.shapeForFtOnly,shapeForInsideBottom:B.shapeForInsideBottom??f,shapeForInside:B.shapeForInside??f},B.position),H=a(B.position,W,B?.spacing),K=e=>{let o=l(B?.position,e);return r`
13
- <div style="${C(o)}">
14
- ${t({uid:z?.uid||"",customProps:_?.[0].customProps},_?.map(e=>{if(e)return r`${s({...e,isInsideProductImage:!0,imageData:{imageShape:b?.ftShape,imageAlign:b?.align,imageLayout:b?.position},dotData:{dotSize:D?.ftDotSize,dotGapToCarousel:D?.ftDotGapToCarousel,dotStyle:D?.ftDotStyle}})}`}))}
15
- </div>
16
- `};return r`
17
- ${j(D?.borderActive?.border!=="none",v("product.media.size > 1",`<style>${I({settings:B,uid:z?.uid,type:"Liquid"})}</style>`),"")}
18
- ${F(`
12
+ `,U=y({"section-id":"{{section.id}}","data-id":`${b?.uid}`}),{isOnlyFeatureAllDevices:k,isRenderGalleryGrid:q}=i(A?.position,G?.type),E=q?{}:y({"data-only-image":h("product.media.size > 1","false","true")}),{wrapperClasses:J,productImagesGalleryClasses:w}=f(C),T=v({"gp-grid gp-w-full !gp-m-0 gp-relative":!0}),x=v({"gp-w-full !gp-m-0 gp-relative":!0}),{wrapContainerStyle:L,wrapContainerStyleOnlyOneImage:M,galleryImageStyle:R}=$(A),V=n({shape:A.shape,shapeForBottom:A.shapeForBottom,shapeFor1Col:A.shapeFor1Col,shapeFor2Col:A.shapeFor2Col,shapeForFtOnly:A.shapeForFtOnly,shapeForInsideBottom:A.shapeForInsideBottom??g,shapeForInside:A.shapeForInside??g},A.position),W=a(A.position,V,A?.spacing),H=()=>r`
13
+ ${s({uid:b?.uid||"",customProps:O?.[0].customProps},O?.map(e=>{if(e)return r`${t({...e,isInsideProductImage:!0,imageData:{imageShape:D?.ftShape,imageAlign:D?.align,imageLayout:D?.position},dotData:{dotSize:G?.ftDotSize,dotGapToCarousel:G?.ftDotGapToCarousel,dotStyle:G?.ftDotStyle}})}`}))}
14
+ `;return r`
15
+ ${S(G?.borderActive?.border!=="none",h("product.media.size > 1",`<style>${F({settings:A,uid:b?.uid,type:"Liquid"})}</style>`),"")}
16
+ ${j(`
19
17
  {% assign featured_image = product.featured_image %}
20
- ${v("variant != null and variant.featured_image != null","{% assign featured_image = variant.featured_image %}")}
18
+ ${h("variant != null and variant.featured_image != null","{% assign featured_image = variant.featured_image %}")}
21
19
  `)}
22
20
  <gp-product-images-v3
23
- gp-data='${U}'
24
- ${{...k}}
25
- style="${{...O}}"
26
- class="${w}"
21
+ gp-data='${B}'
22
+ ${{...U}}
23
+ style="${{...z}}"
24
+ class="${J}"
27
25
  >
28
26
  <div
29
- class="${v("product.media.size > 1",`${x}`,`${L}`)}"
30
- style="${v("product.media.size > 1",C(M),C(R))}"
27
+ class="${h("product.media.size > 1",`${T}`,`${x}`)}"
28
+ style="${h("product.media.size > 1",I(L),I(M))}"
31
29
  >
32
- ${d({builderPropUID:`gp-carousel-${z?.uid}`,...B,children:K("feature"),enableLazyLoadImage:A})}
33
- ${j(!q,r`
30
+ ${l({builderPropUID:`gp-carousel-${b?.uid}`,...A,children:H(),enableLazyLoadImage:N})}
31
+ ${S(!k,r`
34
32
  <div
35
- class="${T}"
36
- style="${C(V)}"
37
- ${{...J}}
33
+ class="${w}"
34
+ style="${I(R)}"
35
+ ${{...E}}
38
36
  >
39
- ${v("product.media.size > 1",m({builderPropUID:`gp-gallery-${z?.uid}`,...B,enableLazyLoadImage:A}))}
40
- ${j(E,c({builderPropUID:z?.uid,wrapperStyle:{...H},children:K("grid"),...B,enableLazyLoadImage:A}))}
37
+ ${h("product.media.size > 1",d({builderPropUID:`gp-gallery-${b?.uid}`,...A,enableLazyLoadImage:N}))}
38
+ ${S(q,m({builderPropUID:b?.uid,wrapperStyle:{...W},children:H(),...A,enableLazyLoadImage:N}))}
41
39
  </div>
42
40
  `)}
43
41
  </div>
44
42
  </gp-product-images-v3>
45
- ${j(e,`<script ${n('class="gps-link" delay',"src")}="{{ 'gp-product-images-v3-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${n('class="gps-link" delay',"src")}="${o}/assets-v2/gp-product-images-v3-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
46
- `};export{P as default};
43
+ ${S(e,`<script ${u('class="gps-link" delay',"src")}="{{ 'gp-product-images-v3-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${u('class="gps-link" delay',"src")}="${o}/assets-v2/gp-product-images-v3-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
44
+ `};export{C as default};
@@ -1 +1 @@
1
- import{getResponsiveValueByScreen as e,makeAspectRatio as t,DEVICES as o,makeStyleResponsive as i,removeNullUndefined as r}from"@gem-sdk/core";let l=["one-col","two-col"],a=e=>"one-col"===e||"two-col"===e,n=e=>{let t=e?.desktop,o=e?.tablet===void 0?t:e?.tablet,i=e?.mobile===void 0?o:e?.mobile;return{desktop:t,tablet:o,mobile:i}},s=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let o=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(o))?t:Number(o)},d=e=>{if(!e)return{desktop:5};let t=s(e.desktop,5),o=s(e.tablet,t),i=s(e.mobile,o);return{desktop:t,tablet:o,mobile:i}},u=(e,t)=>{let o={};return["desktop","mobile","tablet"].forEach(i=>{o={...o,[`--d${"desktop"===i?"":`-${i}`}`]:`${e(i)?"none":t}`}}),o},b=e=>{let t=e?.["--radius"],o=e?.["--bblr"]||"0px",i=e?.["--bbrr"]||"0px",r=e?.["--btlr"]||"0px",l=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==o||"0px"!==i||"0px"!==r||"0px"!==l},c=o=>{let i={};return["desktop","mobile","tablet"].forEach(t=>{let r=e(o,t)?.shapeValue;if(r)i={...i,[t]:r};else{let r=e(o,t)?.shape;switch(r){case"square":i={...i,[t]:"1/1"};break;case"vertical":i={...i,[t]:"3/4"};break;case"horizontal":i={...i,[t]:"4/3"};break;case"original":i={...i,[t]:""}}}}),t(i)},m=t=>{let i={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let r=!1;o.forEach(o=>{let l=e(t.position,o),a=e(t.ratioLayout,o),n=e(t.ratioLayoutRight,o),s="desktop"===o?"--gtc":`--gtc-${o}`,d="desktop"===o?"--gtr":`--gtr-${o}`,u="left"===l?a:n,b=["left","right"].includes(l||"");b&&u?(r=!0,Object.assign(i={...i,[s]:`minmax(0, ${u[0]}fr) minmax(0, ${u[1]}fr)`},{[d]:"fit-content(0)"})):r&&Object.assign(i,{[d]:"unset"})})}return i},g=t=>{let o={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"1":"0"}}),o},p=t=>{let o={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"0":"1"}}),o},f=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,h=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},k=(t,o,a)=>{let n={},s={},d={},u={},b={},c={};return["desktop","mobile","tablet"].forEach(i=>{let r=e(t,i),m=e(o,i)?.width,g=e(a,i);if(n={...n,[i]:["inside-bottom","inside-left","inside-right"].includes(r)?"absolute":"static"},["inside-bottom"].includes(r)){let e=h(g);m=`calc(100% - ${e})`}["bottom-center",...l].includes(r)&&(m="100%"),d={...d,[i]:"inside-bottom"===r?`${g}`:"auto"},u={...u,[i]:["inside-left","inside-right"].includes(r)?`${g}`:"auto"},c={...c,[i]:["inside-bottom","inside-left"].includes(r)?`${g}`:"auto"},b={...b,[i]:"inside-right"===r?`${g}`:"auto"},s={...s,[i]:m}}),{...i("pos",n),...i("w",r(s)),...i("bottom",r(d)),...i("top",r(u)),...i("left",r(c)),...i("right",r(b))}},$=(t,o)=>{let i=!0,r=!1;return["desktop","mobile","tablet"].forEach(l=>{let n=e(t,l),s=e(o,l);n&&"only-feature"!==n&&(i=!1),(a(n)||"images"===s)&&(r=!0)}),{isOnlyFeatureAllDevices:i,isRenderGalleryGrid:r}},y=(t,o)=>{let i=e(t,o);return a(i)},x=(e,t="feature")=>{let r={desktop:"none",tablet:"none",mobile:"none"};return o.forEach(o=>{let i=y(e,o);r[o]=("grid"===t?i:!i)?"block":"none"}),i("d",r)},N=e=>({...e,setting:{...e.setting}}),w=e=>{let t=e.match(/\d+/g);return t?t[0]:e},S=t=>{let o=c(t),i={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(r=>{let l=e(t,r),a=l?.height,n=l?.width||"",s=w(a||""),d=n.toString().match(/px/g)?w(n):n;if(a&&n&&!isNaN(Number(s))&&!isNaN(Number(d))){i={...i,[r]:`${Number(s)/Number(d)*100}%`};return}if(a&&!isNaN(Number(s))){i={...i,[r]:a};return}let u=o?.[r]!=="auto"&&o?.[r]?o?.[r]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";i={...i,[r]:`calc((${u})*100%)`}}),i};export{b as checkAddOverFlowClass,d as convertSpacing,h as convertSpacingForIndisdeLayout,s as convertUnitToNumber,c as getAspectRatio,$ as getConditionRenderGalleryImages,u as getDisplayStyle,S as getPaddingBottomByShapeSetting,x as getProductBadgeVisibilityStyle,f as getSrcImage,m as getStyleGridLayout,g as getStyleGridOrderForFeature,p as getStyleGridOrderForGallery,k as getStyleInsideLayout,n as getTypeWidthDevice,N as setDefaultWhenUndefineSetting};
1
+ import{getResponsiveValueByScreen as e,makeAspectRatio as t,DEVICES as i,makeStyleResponsive as o,removeNullUndefined as r}from"@gem-sdk/core";let l=e=>{let t=e?.desktop,i=e?.tablet===void 0?t:e?.tablet,o=e?.mobile===void 0?i:e?.mobile;return{desktop:t,tablet:i,mobile:o}},a=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let i=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(i))?t:Number(i)},n=e=>{if(!e)return{desktop:5};let t=a(e.desktop,5),i=a(e.tablet,t),o=a(e.mobile,i);return{desktop:t,tablet:i,mobile:o}},s=(e,t)=>{let i={};return["desktop","mobile","tablet"].forEach(o=>{i={...i,[`--d${"desktop"===o?"":`-${o}`}`]:`${e(o)?"none":t}`}}),i},d=e=>{let t=e?.["--radius"],i=e?.["--bblr"]||"0px",o=e?.["--bbrr"]||"0px",r=e?.["--btlr"]||"0px",l=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==i||"0px"!==o||"0px"!==r||"0px"!==l},u=i=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{let r=e(i,t)?.shapeValue;if(r)o={...o,[t]:r};else{let r=e(i,t)?.shape;switch(r){case"square":o={...o,[t]:"1/1"};break;case"vertical":o={...o,[t]:"3/4"};break;case"horizontal":o={...o,[t]:"4/3"};break;case"original":o={...o,[t]:""}}}}),t(o)},b=t=>{let o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let r=!1;i.forEach(i=>{let l=e(t.position,i),a=e(t.ratioLayout,i),n=e(t.ratioLayoutRight,i),s="desktop"===i?"--gtc":`--gtc-${i}`,d="desktop"===i?"--gtr":`--gtr-${i}`,u="left"===l?a:n,b=["left","right"].includes(l||"");b&&u?(r=!0,Object.assign(o={...o,[s]:`minmax(0, ${u[0]}fr) minmax(0, ${u[1]}fr)`},{[d]:"fit-content(0)"})):r&&Object.assign(o,{[d]:"unset"})})}return o},c=t=>{let i={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t.position,o),l="desktop"===o?"--o":`--o-${o}`;i={...i,[l]:"left"===r?"1":"0"}}),i},m=t=>{let i={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t.position,o),l="desktop"===o?"--o":`--o-${o}`;i={...i,[l]:"left"===r?"0":"1"}}),i},p=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,g=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},f=(t,i,l)=>{let a={},n={},s={},d={},u={},b={};return["desktop","mobile","tablet"].forEach(o=>{let r=e(t,o),c=e(i,o)?.width,m=e(l,o);if(a={...a,[o]:["inside-bottom","inside-left","inside-right"].includes(r)?"absolute":"static"},["inside-bottom"].includes(r)){let e=g(m);c=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(r)&&(c="100%"),s={...s,[o]:"inside-bottom"===r?`${m}`:"auto"},d={...d,[o]:["inside-left","inside-right"].includes(r)?`${m}`:"auto"},b={...b,[o]:["inside-bottom","inside-left"].includes(r)?`${m}`:"auto"},u={...u,[o]:"inside-right"===r?`${m}`:"auto"},n={...n,[o]:c}}),{...o("pos",a),...o("w",r(n)),...o("bottom",r(s)),...o("top",r(d)),...o("left",r(b)),...o("right",r(u))}},h=(t,i)=>{let o=!0,r=!1;return["desktop","mobile","tablet"].forEach(l=>{let a=e(t,l),n=e(i,l);a&&"only-feature"!==a&&(o=!1),(["two-col","one-col"].includes(a)||"images"===n)&&(r=!0)}),{isOnlyFeatureAllDevices:o,isRenderGalleryGrid:r}},k=e=>({...e,setting:{...e.setting}}),$=e=>{let t=e.match(/\d+/g);return t?t[0]:e},y=t=>{let i=u(t),o={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(r=>{let l=e(t,r),a=l?.height,n=l?.width||"",s=$(a||""),d=n.toString().match(/px/g)?$(n):n;if(a&&n&&!isNaN(Number(s))&&!isNaN(Number(d))){o={...o,[r]:`${Number(s)/Number(d)*100}%`};return}if(a&&!isNaN(Number(s))){o={...o,[r]:a};return}let u=i?.[r]!=="auto"&&i?.[r]?i?.[r]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";o={...o,[r]:`calc((${u})*100%)`}}),o};export{d as checkAddOverFlowClass,n as convertSpacing,g as convertSpacingForIndisdeLayout,a as convertUnitToNumber,u as getAspectRatio,h as getConditionRenderGalleryImages,s as getDisplayStyle,y as getPaddingBottomByShapeSetting,p as getSrcImage,b as getStyleGridLayout,c as getStyleGridOrderForFeature,m as getStyleGridOrderForGallery,f as getStyleInsideLayout,l as getTypeWidthDevice,k as setDefaultWhenUndefineSetting};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "18.4.2",
3
+ "version": "18.4.4",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",