@gem-sdk/components 2.0.0-staging.757 → 2.0.0-staging.759
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/product/components/FileUpload/components/config/setting.js +1 -1
- package/dist/cjs/product/components/ProductImagesV2/common/common.js +1 -1
- package/dist/esm/product/components/FileUpload/components/config/setting.js +1 -1
- package/dist/esm/product/components/ProductImagesV2/common/common.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Settings=[{id:"setting",controls:[{id:"textContent",type:"textarea",default:"Click or drop your image to upload (Max $max_size)"},{id:"translate",type:"input",default:"textContent"},{id:"fileUploadLayout",label:"Layout",type:"layout-selector",iconViewBox:"0 0 72 72",enableItemBackground:!0,itemSpacing:"large",itemPerRow:2,options:[{label:"Vertical",value:"vertical",iconName:"gp-product-file-upload-vertical-layout"},{label:"Horizontal",value:"horizontal",iconName:"gp-product-file-upload-horizontal-layout"}]},{id:"arrangeContent",label:"Arrange content",type:"segment",default:"center",options:[{label:"Left",value:"start",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
"use strict";const Settings=[{id:"setting",controls:[{id:"textContent",type:"textarea",default:"Click or drop your image to upload (Max $max_size)"},{id:"translate",type:"input",default:"textContent"},{id:"fileUploadLayout",label:"Layout",type:"layout-selector",iconViewBox:"0 0 72 72",enableItemBackground:!0,itemSpacing:"large",itemPerRow:2,default:"vertical",options:[{label:"Vertical",value:"vertical",iconName:"gp-product-file-upload-vertical-layout"},{label:"Horizontal",value:"horizontal",iconName:"gp-product-file-upload-horizontal-layout"}]},{id:"arrangeContent",label:"Arrange content",type:"segment",default:"center",options:[{label:"Left",value:"start",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8867 22.375C11.8867 22.7202 12.1665 23 12.5117 23C12.8569 23 13.1367 22.7202 13.1367 22.375L13.1367 18.7683C13.3322 18.8374 13.5426 18.875 13.7617 18.875L21.2617 18.875C22.2973 18.875 23.1367 18.0355 23.1367 17L23.1367 11.5C23.1367 10.4645 22.2973 9.625 21.2617 9.625L13.7617 9.625C13.5426 9.625 13.3322 9.6626 13.1367 9.7317L13.1367 6.12408C13.1367 5.77891 12.8569 5.49908 12.5117 5.49908C12.1665 5.49908 11.8867 5.77891 11.8867 6.12408L11.8867 22.375ZM13.7617 17.625C13.4166 17.625 13.1367 17.3452 13.1367 17L13.1367 11.5C13.1367 11.1548 13.4166 10.875 13.7617 10.875L21.2617 10.875C21.6069 10.875 21.8867 11.1548 21.8867 11.5L21.8867 17C21.8867 17.3452 21.6069 17.625 21.2617 17.625L13.7617 17.625Z" fill="currentColor"/>
|
|
3
3
|
</svg>
|
|
4
4
|
`},{label:"Center",value:"center",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");const 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}},convertUnitToNumber=(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)},convertSpacing=e=>e?{desktop:convertUnitToNumber(e.desktop,5),tablet:convertUnitToNumber(e.tablet,5),mobile:convertUnitToNumber(e.mobile,5)}:{desktop:5},getDisplayStyle=(e,t)=>{let o={},r=["desktop","mobile","tablet"];return r.forEach(r=>{o={...o,[`--d${"desktop"===r?"":`-${r}`}`]:`${e(r)?"none":t}`}}),o},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},getAspectRatio=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e,o)?.shapeValue;if(r)t={...t,[o]:r};else{let r=core.getResponsiveValueByScreen(e,o)?.shape;switch(r){case"square":t={...t,[o]:"1/1"};break;case"vertical":t={...t,[o]:"3/4"};break;case"horizontal":t={...t,[o]:"4/3"};break;case"original":t={...t,[o]:""}}}}),core.makeAspectRatio(t)},getStyleGridLayout=e=>{let t=["desktop","tablet","mobile"],o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!e.isHiddenGalleryImages){let r=!1;t.forEach(t=>{let i=core.getResponsiveValueByScreen(e.position,t),l=core.getResponsiveValueByScreen(e.ratioLayout,t),n=core.getResponsiveValueByScreen(e.ratioLayoutRight,t),a="desktop"===t?"--gtc":`--gtc-${t}`,s="desktop"===t?"--gtr":`--gtr-${t}`,c="left"===i?l:n,d=["left","right"].includes(i||"");d&&c?(r=!0,Object.assign(o={...o,[a]:`minmax(0, ${c[0]}fr) minmax(0, ${c[1]}fr)`},{[s]:"fit-content(0)"})):r&&Object.assign(o,{[s]:"unset"})})}return o},getStyleGridOrderForFeature=e=>{let t={"--o":"0","--o-tablet":"0","--o-mobile":"0"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e.position,o),i="desktop"===o?"--o":`--o-${o}`;t={...t,[i]:"left"===r?"1":"0"}}),t},getStyleGridOrderForGallery=e=>{let t={"--o":"1","--o-tablet":"1","--o-mobile":"1"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e.position,o),i="desktop"===o?"--o":`--o-${o}`;t={...t,[i]:"left"===r?"0":"1"}}),t},getSrcImage=e=>`{{${e} | img_url: '480x480'}} 480w, {{${e} | img_url: '768x768'}} 768w,{{${e} | img_url: '1024x1024'}} 1024w,{{${e} | img_url: '1440x1440'}} 1440w`,convertSpacingForIndisdeLayout=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},getStyleInsideLayout=(e,t,o)=>{let r=["desktop","mobile","tablet"],i={},l={},n={},a={},s={},c={};return r.forEach(r=>{let d=core.getResponsiveValueByScreen(e,r),g=core.getResponsiveValueByScreen(t,r)?.width,u=core.getResponsiveValueByScreen(o,r);if(i={...i,[r]:["inside-bottom","inside-left","inside-right"].includes(d)?"absolute":"static"},["inside-bottom"].includes(d)){let e=convertSpacingForIndisdeLayout(u);g=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(d)&&(g="100%"),n={...n,[r]:"inside-bottom"===d?`${u}`:"auto"},a={...a,[r]:["inside-left","inside-right"].includes(d)?`${u}`:"auto"},c={...c,[r]:["inside-bottom","inside-left"].includes(d)?`${u}`:"auto"},s={...s,[r]:"inside-right"===d?`${u}`:"auto"},l={...l,[r]:g}}),{...core.makeStyleResponsive("pos",i),...core.makeStyleResponsive("w",core.removeNullUndefined(l)),...core.makeStyleResponsive("bottom",core.removeNullUndefined(n)),...core.makeStyleResponsive("top",core.removeNullUndefined(a)),...core.makeStyleResponsive("left",core.removeNullUndefined(c)),...core.makeStyleResponsive("right",core.removeNullUndefined(s))}},getConditionRenderGalleryImages=e=>{let t=["desktop","mobile","tablet"],o=!0,r=!1;return t.forEach(t=>{let i=core.getResponsiveValueByScreen(e,t);i&&"only-feature"!==i&&(o=!1),["two-col","one-col"].includes(i)&&(r=!0)}),{isOnlyFeatureAllDevices:o,isRenderGalleryGrid:r}},setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}}),getValueFromValueContainUnit=e=>{let t=e.match(/\d+/g);return t?t[0]:e},getPaddingBottomByShapeSetting=e=>{let t=getAspectRatio(e),o={desktop:"auto",mobile:"auto",tablet:"auto"},r=["desktop","mobile","tablet"];return r.forEach(r=>{let i=core.getResponsiveValueByScreen(e,r),l=i?.height,n=i?.width||"",a=getValueFromValueContainUnit(l||""),s=n
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const 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}},convertUnitToNumber=(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)},convertSpacing=e=>e?{desktop:convertUnitToNumber(e.desktop,5),tablet:convertUnitToNumber(e.tablet,5),mobile:convertUnitToNumber(e.mobile,5)}:{desktop:5},getDisplayStyle=(e,t)=>{let o={},r=["desktop","mobile","tablet"];return r.forEach(r=>{o={...o,[`--d${"desktop"===r?"":`-${r}`}`]:`${e(r)?"none":t}`}}),o},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},getAspectRatio=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e,o)?.shapeValue;if(r)t={...t,[o]:r};else{let r=core.getResponsiveValueByScreen(e,o)?.shape;switch(r){case"square":t={...t,[o]:"1/1"};break;case"vertical":t={...t,[o]:"3/4"};break;case"horizontal":t={...t,[o]:"4/3"};break;case"original":t={...t,[o]:""}}}}),core.makeAspectRatio(t)},getStyleGridLayout=e=>{let t=["desktop","tablet","mobile"],o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!e.isHiddenGalleryImages){let r=!1;t.forEach(t=>{let i=core.getResponsiveValueByScreen(e.position,t),l=core.getResponsiveValueByScreen(e.ratioLayout,t),n=core.getResponsiveValueByScreen(e.ratioLayoutRight,t),a="desktop"===t?"--gtc":`--gtc-${t}`,s="desktop"===t?"--gtr":`--gtr-${t}`,c="left"===i?l:n,d=["left","right"].includes(i||"");d&&c?(r=!0,Object.assign(o={...o,[a]:`minmax(0, ${c[0]}fr) minmax(0, ${c[1]}fr)`},{[s]:"fit-content(0)"})):r&&Object.assign(o,{[s]:"unset"})})}return o},getStyleGridOrderForFeature=e=>{let t={"--o":"0","--o-tablet":"0","--o-mobile":"0"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e.position,o),i="desktop"===o?"--o":`--o-${o}`;t={...t,[i]:"left"===r?"1":"0"}}),t},getStyleGridOrderForGallery=e=>{let t={"--o":"1","--o-tablet":"1","--o-mobile":"1"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let r=core.getResponsiveValueByScreen(e.position,o),i="desktop"===o?"--o":`--o-${o}`;t={...t,[i]:"left"===r?"0":"1"}}),t},getSrcImage=e=>`{{${e} | img_url: '480x480'}} 480w, {{${e} | img_url: '768x768'}} 768w,{{${e} | img_url: '1024x1024'}} 1024w,{{${e} | img_url: '1440x1440'}} 1440w`,convertSpacingForIndisdeLayout=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},getStyleInsideLayout=(e,t,o)=>{let r=["desktop","mobile","tablet"],i={},l={},n={},a={},s={},c={};return r.forEach(r=>{let d=core.getResponsiveValueByScreen(e,r),g=core.getResponsiveValueByScreen(t,r)?.width,u=core.getResponsiveValueByScreen(o,r);if(i={...i,[r]:["inside-bottom","inside-left","inside-right"].includes(d)?"absolute":"static"},["inside-bottom"].includes(d)){let e=convertSpacingForIndisdeLayout(u);g=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(d)&&(g="100%"),n={...n,[r]:"inside-bottom"===d?`${u}`:"auto"},a={...a,[r]:["inside-left","inside-right"].includes(d)?`${u}`:"auto"},c={...c,[r]:["inside-bottom","inside-left"].includes(d)?`${u}`:"auto"},s={...s,[r]:"inside-right"===d?`${u}`:"auto"},l={...l,[r]:g}}),{...core.makeStyleResponsive("pos",i),...core.makeStyleResponsive("w",core.removeNullUndefined(l)),...core.makeStyleResponsive("bottom",core.removeNullUndefined(n)),...core.makeStyleResponsive("top",core.removeNullUndefined(a)),...core.makeStyleResponsive("left",core.removeNullUndefined(c)),...core.makeStyleResponsive("right",core.removeNullUndefined(s))}},getConditionRenderGalleryImages=e=>{let t=["desktop","mobile","tablet"],o=!0,r=!1;return t.forEach(t=>{let i=core.getResponsiveValueByScreen(e,t);i&&"only-feature"!==i&&(o=!1),["two-col","one-col"].includes(i)&&(r=!0)}),{isOnlyFeatureAllDevices:o,isRenderGalleryGrid:r}},setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}}),getValueFromValueContainUnit=e=>{let t=e.match(/\d+/g);return t?t[0]:e},getPaddingBottomByShapeSetting=e=>{let t=getAspectRatio(e),o={desktop:"auto",mobile:"auto",tablet:"auto"},r=["desktop","mobile","tablet"];return r.forEach(r=>{let i=core.getResponsiveValueByScreen(e,r),l=i?.height,n=i?.width||"",a=getValueFromValueContainUnit(l||""),s=n.toString().match(/px/g)?getValueFromValueContainUnit(n):n;if(l&&n&&!isNaN(Number(a))&&!isNaN(Number(s))){o={...o,[r]:`${Number(a)/Number(s)*100}%`};return}if(l&&!isNaN(Number(a))){o={...o,[r]:l};return}let c=t?.[r]!=="auto"&&t?.[r]?t?.[r]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";o={...o,[r]:`calc((${c})*100%)`}}),o};exports.checkAddOverFlowClass=checkAddOverFlowClass,exports.convertSpacing=convertSpacing,exports.convertSpacingForIndisdeLayout=convertSpacingForIndisdeLayout,exports.convertUnitToNumber=convertUnitToNumber,exports.getAspectRatio=getAspectRatio,exports.getConditionRenderGalleryImages=getConditionRenderGalleryImages,exports.getDisplayStyle=getDisplayStyle,exports.getPaddingBottomByShapeSetting=getPaddingBottomByShapeSetting,exports.getSrcImage=getSrcImage,exports.getStyleGridLayout=getStyleGridLayout,exports.getStyleGridOrderForFeature=getStyleGridOrderForFeature,exports.getStyleGridOrderForGallery=getStyleGridOrderForGallery,exports.getStyleInsideLayout=getStyleInsideLayout,exports.getTypeWidthDevice=getTypeWidthDevice,exports.setDefaultWhenUndefineSetting=setDefaultWhenUndefineSetting;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let Settings=[{id:"setting",controls:[{id:"textContent",type:"textarea",default:"Click or drop your image to upload (Max $max_size)"},{id:"translate",type:"input",default:"textContent"},{id:"fileUploadLayout",label:"Layout",type:"layout-selector",iconViewBox:"0 0 72 72",enableItemBackground:!0,itemSpacing:"large",itemPerRow:2,options:[{label:"Vertical",value:"vertical",iconName:"gp-product-file-upload-vertical-layout"},{label:"Horizontal",value:"horizontal",iconName:"gp-product-file-upload-horizontal-layout"}]},{id:"arrangeContent",label:"Arrange content",type:"segment",default:"center",options:[{label:"Left",value:"start",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
let Settings=[{id:"setting",controls:[{id:"textContent",type:"textarea",default:"Click or drop your image to upload (Max $max_size)"},{id:"translate",type:"input",default:"textContent"},{id:"fileUploadLayout",label:"Layout",type:"layout-selector",iconViewBox:"0 0 72 72",enableItemBackground:!0,itemSpacing:"large",itemPerRow:2,default:"vertical",options:[{label:"Vertical",value:"vertical",iconName:"gp-product-file-upload-vertical-layout"},{label:"Horizontal",value:"horizontal",iconName:"gp-product-file-upload-horizontal-layout"}]},{id:"arrangeContent",label:"Arrange content",type:"segment",default:"center",options:[{label:"Left",value:"start",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8867 22.375C11.8867 22.7202 12.1665 23 12.5117 23C12.8569 23 13.1367 22.7202 13.1367 22.375L13.1367 18.7683C13.3322 18.8374 13.5426 18.875 13.7617 18.875L21.2617 18.875C22.2973 18.875 23.1367 18.0355 23.1367 17L23.1367 11.5C23.1367 10.4645 22.2973 9.625 21.2617 9.625L13.7617 9.625C13.5426 9.625 13.3322 9.6626 13.1367 9.7317L13.1367 6.12408C13.1367 5.77891 12.8569 5.49908 12.5117 5.49908C12.1665 5.49908 11.8867 5.77891 11.8867 6.12408L11.8867 22.375ZM13.7617 17.625C13.4166 17.625 13.1367 17.3452 13.1367 17L13.1367 11.5C13.1367 11.1548 13.4166 10.875 13.7617 10.875L21.2617 10.875C21.6069 10.875 21.8867 11.1548 21.8867 11.5L21.8867 17C21.8867 17.3452 21.6069 17.625 21.2617 17.625L13.7617 17.625Z" fill="currentColor"/>
|
|
3
3
|
</svg>
|
|
4
4
|
`},{label:"Center",value:"center",type:"align-v",icon:`<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getResponsiveValueByScreen as e,makeAspectRatio as t,makeStyleResponsive as o,removeNullUndefined as i}from"@gem-sdk/core";let getTypeWidthDevice=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}},convertUnitToNumber=(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)},convertSpacing=e=>e?{desktop:convertUnitToNumber(e.desktop,5),tablet:convertUnitToNumber(e.tablet,5),mobile:convertUnitToNumber(e.mobile,5)}:{desktop:5},getDisplayStyle=(e,t)=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(i=>{o={...o,[`--d${"desktop"===i?"":`-${i}`}`]:`${e(i)?"none":t}`}}),o},checkAddOverFlowClass=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},getAspectRatio=o=>{let i={},r=["desktop","mobile","tablet"];return r.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)},getStyleGridLayout=t=>{let o=["desktop","tablet","mobile"],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,c=["left","right"].includes(l||"");c&&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},getStyleGridOrderForFeature=t=>{let o={"--o":"0","--o-tablet":"0","--o-mobile":"0"},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"1":"0"}}),o},getStyleGridOrderForGallery=t=>{let o={"--o":"1","--o-tablet":"1","--o-mobile":"1"},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"0":"1"}}),o},getSrcImage=e=>`{{${e} | img_url: '480x480'}} 480w, {{${e} | img_url: '768x768'}} 768w,{{${e} | img_url: '1024x1024'}} 1024w,{{${e} | img_url: '1440x1440'}} 1440w`,convertSpacingForIndisdeLayout=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},getStyleInsideLayout=(t,r,l)=>{let a=["desktop","mobile","tablet"],n={},s={},d={},u={},c={},g={};return a.forEach(o=>{let i=e(t,o),a=e(r,o)?.width,m=e(l,o);if(n={...n,[o]:["inside-bottom","inside-left","inside-right"].includes(i)?"absolute":"static"},["inside-bottom"].includes(i)){let e=convertSpacingForIndisdeLayout(m);a=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(i)&&(a="100%"),d={...d,[o]:"inside-bottom"===i?`${m}`:"auto"},u={...u,[o]:["inside-left","inside-right"].includes(i)?`${m}`:"auto"},g={...g,[o]:["inside-bottom","inside-left"].includes(i)?`${m}`:"auto"},c={...c,[o]:"inside-right"===i?`${m}`:"auto"},s={...s,[o]:a}}),{...o("pos",n),...o("w",i(s)),...o("bottom",i(d)),...o("top",i(u)),...o("left",i(g)),...o("right",i(c))}},getConditionRenderGalleryImages=t=>{let o=["desktop","mobile","tablet"],i=!0,r=!1;return o.forEach(o=>{let l=e(t,o);l&&"only-feature"!==l&&(i=!1),["two-col","one-col"].includes(l)&&(r=!0)}),{isOnlyFeatureAllDevices:i,isRenderGalleryGrid:r}},setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}}),getValueFromValueContainUnit=e=>{let t=e.match(/\d+/g);return t?t[0]:e},getPaddingBottomByShapeSetting=t=>{let o=getAspectRatio(t),i={desktop:"auto",mobile:"auto",tablet:"auto"},r=["desktop","mobile","tablet"];return r.forEach(r=>{let l=e(t,r),a=l?.height,n=l?.width||"",s=getValueFromValueContainUnit(a||""),d=n
|
|
1
|
+
import{getResponsiveValueByScreen as e,makeAspectRatio as t,makeStyleResponsive as o,removeNullUndefined as i}from"@gem-sdk/core";let getTypeWidthDevice=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}},convertUnitToNumber=(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)},convertSpacing=e=>e?{desktop:convertUnitToNumber(e.desktop,5),tablet:convertUnitToNumber(e.tablet,5),mobile:convertUnitToNumber(e.mobile,5)}:{desktop:5},getDisplayStyle=(e,t)=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(i=>{o={...o,[`--d${"desktop"===i?"":`-${i}`}`]:`${e(i)?"none":t}`}}),o},checkAddOverFlowClass=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},getAspectRatio=o=>{let i={},r=["desktop","mobile","tablet"];return r.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)},getStyleGridLayout=t=>{let o=["desktop","tablet","mobile"],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,c=["left","right"].includes(l||"");c&&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},getStyleGridOrderForFeature=t=>{let o={"--o":"0","--o-tablet":"0","--o-mobile":"0"},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"1":"0"}}),o},getStyleGridOrderForGallery=t=>{let o={"--o":"1","--o-tablet":"1","--o-mobile":"1"},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=e(t.position,i),l="desktop"===i?"--o":`--o-${i}`;o={...o,[l]:"left"===r?"0":"1"}}),o},getSrcImage=e=>`{{${e} | img_url: '480x480'}} 480w, {{${e} | img_url: '768x768'}} 768w,{{${e} | img_url: '1024x1024'}} 1024w,{{${e} | img_url: '1440x1440'}} 1440w`,convertSpacingForIndisdeLayout=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},getStyleInsideLayout=(t,r,l)=>{let a=["desktop","mobile","tablet"],n={},s={},d={},u={},c={},g={};return a.forEach(o=>{let i=e(t,o),a=e(r,o)?.width,m=e(l,o);if(n={...n,[o]:["inside-bottom","inside-left","inside-right"].includes(i)?"absolute":"static"},["inside-bottom"].includes(i)){let e=convertSpacingForIndisdeLayout(m);a=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(i)&&(a="100%"),d={...d,[o]:"inside-bottom"===i?`${m}`:"auto"},u={...u,[o]:["inside-left","inside-right"].includes(i)?`${m}`:"auto"},g={...g,[o]:["inside-bottom","inside-left"].includes(i)?`${m}`:"auto"},c={...c,[o]:"inside-right"===i?`${m}`:"auto"},s={...s,[o]:a}}),{...o("pos",n),...o("w",i(s)),...o("bottom",i(d)),...o("top",i(u)),...o("left",i(g)),...o("right",i(c))}},getConditionRenderGalleryImages=t=>{let o=["desktop","mobile","tablet"],i=!0,r=!1;return o.forEach(o=>{let l=e(t,o);l&&"only-feature"!==l&&(i=!1),["two-col","one-col"].includes(l)&&(r=!0)}),{isOnlyFeatureAllDevices:i,isRenderGalleryGrid:r}},setDefaultWhenUndefineSetting=e=>({...e,setting:{...e.setting}}),getValueFromValueContainUnit=e=>{let t=e.match(/\d+/g);return t?t[0]:e},getPaddingBottomByShapeSetting=t=>{let o=getAspectRatio(t),i={desktop:"auto",mobile:"auto",tablet:"auto"},r=["desktop","mobile","tablet"];return r.forEach(r=>{let l=e(t,r),a=l?.height,n=l?.width||"",s=getValueFromValueContainUnit(a||""),d=n.toString().match(/px/g)?getValueFromValueContainUnit(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{checkAddOverFlowClass,convertSpacing,convertSpacingForIndisdeLayout,convertUnitToNumber,getAspectRatio,getConditionRenderGalleryImages,getDisplayStyle,getPaddingBottomByShapeSetting,getSrcImage,getStyleGridLayout,getStyleGridOrderForFeature,getStyleGridOrderForGallery,getStyleInsideLayout,getTypeWidthDevice,setDefaultWhenUndefineSetting};
|