@gem-sdk/core 2.0.0-dev.1290 → 2.0.0-dev.1305
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 useSWR=require("swr"),getCollection=require("./queries/get-collection.js"),getProduct=require("./queries/get-product.js"),getProducts=require("./queries/get-products.js"),query=require("./query.js");const prefetchQueries=(e,t)=>{let r=[];return Object.keys(e).forEach(s=>{let u;let o=e[s];switch(o.tag){case"Product":{if(o.settings?.isAuto)break;let e={id:o.settings?.productSetting?.productId??"latest",isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateProductQueryKey(e)),func:getProduct.getProduct,variables:e};break}case"ProductList":{let e=o.settings?.productSetting;if(e?.productSrc==="Collection"){let r={id:e?.collectionId??"latest",numberOfProducts:o.settings?.numberOfProducts??4,orderBy:o.settings?.orderBy,isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateCollectionQueryKey(r)),func:getCollection.getCollection,variables:r}}else{let r={ids:[...e?.productIds??[]].sort(),isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateProductsQueryKey(r)),func:getProducts.getProducts,variables:r}}}}u&&r.push(u)}),r.reduce((e,t)=>e.some(e=>e.key===t.key)?e:[...e,t],[])};exports.prefetchQueries=prefetchQueries;
|
|
1
|
+
"use strict";var useSWR=require("swr"),getCollection=require("./queries/get-collection.js"),getProduct=require("./queries/get-product.js"),getProducts=require("./queries/get-products.js"),query=require("./query.js");const prefetchQueries=(e,t)=>{let r=[];return Object.keys(e).forEach(s=>{let u;let o=e[s];switch(o.tag){case"Product":{if(o.settings?.isAuto)break;let e={id:o.settings?.productSetting?.productId??"latest",isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateProductQueryKey(e)),func:getProduct.getProduct,variables:e};break}case"ProductList":case"ProductListV3":{let e=o.settings?.productSetting;if(e?.productSrc==="Collection"){let r={id:e?.collectionId??"latest",numberOfProducts:o.settings?.numberOfProducts??4,orderBy:o.settings?.orderBy,isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateCollectionQueryKey(r)),func:getCollection.getCollection,variables:r}}else{let r={ids:[...e?.productIds??[]].sort(),isSample:t?.isSample,isStorefront:t?.isStorefront};u={key:useSWR.unstable_serialize(query.generateProductsQueryKey(r)),func:getProducts.getProducts,variables:r}}}}u&&r.push(u)}),r.reduce((e,t)=>e.some(e=>e.key===t.key)?e:[...e,t],[])};exports.prefetchQueries=prefetchQueries;
|
package/dist/cjs/helpers/size.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";var makeStyle=require("./make-style.js"),constant=require("./constant.js"),getResonsiveValue=require("./get-resonsive-value.js");function getCustomSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.horizontal,[`--pr${i}`]:e?.[t]?.horizontal,[`--pt${i}`]:e?.[t]?.vertical,[`--pb${i}`]:e?.[t]?.vertical}}const composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`gp-g-s-${e}`}const composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
|
|
2
2
|
${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
|
|
3
3
|
${i?`padding-top: ${i}; padding-bottom: ${i};`:void 0}
|
|
4
|
-
`},makeGlobalSize=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("height",e)),padding:getPaddingGlobalSize(e),gap:getGlobalSizeGap(e)}),makeGlobalSizeIcon=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("width",e)),minWidth:makeStyle.makeStyleResponsive("minw",getWidthHeightGlobalSize("width",e)),padding:getPaddingGlobalSize(e)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let i={},l=["desktop","mobile","tablet"];return l.forEach(l=>{i={...i,[l]:getResonsiveValue.getResponsiveValueByScreen(t,l)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i),a=l?.shapeValue,o=l?.height;t={...t,[i]:a?"auto":o||"auto"}}),t},getWidthByShapeGlobalSize=(e,t,i)=>{let l={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let o=getResonsiveValue.getResponsiveValueByScreen(e,a),s=o?.width;t&&(s=o?.width||"auto"),i&&(s=o?.width||"100%"),s&&(l={...l,[a]:s})}),l},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(l)t={...t,[i]:l};else{let l=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(l){case"square":t={...t,[i]:"1/1"};break;case"vertical":t={...t,[i]:"3/4"};break;case"horizontal":t={...t,[i]:"4/3"};break;case"original":t={...t,[i]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.padding?.left,[`--pr${i}`]:e?.[t]?.padding?.right,[`--pt${i}`]:e?.[t]?.padding?.top,[`--pb${i}`]:e?.[t]?.padding?.bottom}}const getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile")),getValueByDevice=(e,t)=>e?.[t]===void 0?e?.desktop===void 0?e?.tablet:e?.desktop:e?.[t],getPaddingStyleByDevice=(e,t)=>{if(!e)return{};let i=constant.devicesMapping[t||""]??"";return{[`--pl${i}`]:e?.left,[`--pr${i}`]:e?.right,[`--pt${i}`]:e?.top,[`--pb${i}`]:e?.bottom}},getResponsiveStylePadding=e=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getPaddingStyleByDevice(e?.desktop),...getPaddingStyleByDevice(e?.tablet,"tablet"),...getPaddingStyleByDevice(e?.mobile,"mobile")}},getFlexGrowClassByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i),a=l?.height,o=l?.shapeValue,s="desktop"===i?"gp-flex-1 gp-h-full":`${i}:gp-flex-1 ${i}:gp-h-full`,g="desktop"===i?"gp-flex-none gp-h-auto":`${i}:gp-flex-none ${i}:gp-h-auto`;t={...t,[s]:"100%"===a&&!o,[g]:"100%"!==a}}),t};exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getFlexGrowClassByShapeGlobalSize=getFlexGrowClassByShapeGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getPaddingStyleByDevice=getPaddingStyleByDevice,exports.getResponsiveStylePadding=getResponsiveStylePadding,exports.getValueByDevice=getValueByDevice,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,exports.makeGlobalSizeIcon=makeGlobalSizeIcon,exports.makeStyleWithDefault=makeStyleWithDefault;
|
|
4
|
+
`},makeGlobalSize=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("height",e)),padding:getPaddingGlobalSize(e),gap:getGlobalSizeGap(e)}),makeGlobalSizeIcon=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("width",e)),minWidth:makeStyle.makeStyleResponsive("minw",getWidthHeightGlobalSize("width",e)),padding:getPaddingGlobalSize(e)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let i={},l=["desktop","mobile","tablet"];return l.forEach(l=>{i={...i,[l]:getResonsiveValue.getResponsiveValueByScreen(t,l)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i),a=l?.shapeValue,o=l?.height;t={...t,[i]:a?"auto":o||"auto"}}),t},getWidthByShapeGlobalSize=(e,t,i)=>{let l={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let o=getResonsiveValue.getResponsiveValueByScreen(e,a),s=o?.width;t&&(s=o?.width||"auto"),i&&(s=o?.width||"100%"),s&&(l={...l,[a]:s})}),l},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(l)t={...t,[i]:l};else{let l=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(l){case"square":t={...t,[i]:"1/1"};break;case"vertical":t={...t,[i]:"3/4"};break;case"horizontal":t={...t,[i]:"4/3"};break;case"original":case"custom":t={...t,[i]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.padding?.left,[`--pr${i}`]:e?.[t]?.padding?.right,[`--pt${i}`]:e?.[t]?.padding?.top,[`--pb${i}`]:e?.[t]?.padding?.bottom}}const getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile")),getValueByDevice=(e,t)=>e?.[t]===void 0?e?.desktop===void 0?e?.tablet:e?.desktop:e?.[t],getPaddingStyleByDevice=(e,t)=>{if(!e)return{};let i=constant.devicesMapping[t||""]??"";return{[`--pl${i}`]:e?.left,[`--pr${i}`]:e?.right,[`--pt${i}`]:e?.top,[`--pb${i}`]:e?.bottom}},getResponsiveStylePadding=e=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getPaddingStyleByDevice(e?.desktop),...getPaddingStyleByDevice(e?.tablet,"tablet"),...getPaddingStyleByDevice(e?.mobile,"mobile")}},getFlexGrowClassByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let l=getResonsiveValue.getResponsiveValueByScreen(e,i),a=l?.height,o=l?.shapeValue,s="desktop"===i?"gp-flex-1 gp-h-full":`${i}:gp-flex-1 ${i}:gp-h-full`,g="desktop"===i?"gp-flex-none gp-h-auto":`${i}:gp-flex-none ${i}:gp-h-auto`;t={...t,[s]:"100%"===a&&!o,[g]:"100%"!==a}}),t};exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getFlexGrowClassByShapeGlobalSize=getFlexGrowClassByShapeGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getPaddingStyleByDevice=getPaddingStyleByDevice,exports.getResponsiveStylePadding=getResponsiveStylePadding,exports.getValueByDevice=getValueByDevice,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,exports.makeGlobalSizeIcon=makeGlobalSizeIcon,exports.makeStyleWithDefault=makeStyleWithDefault;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unstable_serialize as e}from"swr";import{getCollection as t}from"./queries/get-collection.js";import{getProduct as r}from"./queries/get-product.js";import{getProducts as s}from"./queries/get-products.js";import{generateCollectionQueryKey as o,generateProductsQueryKey as i,generateProductQueryKey as c}from"./query.js";let prefetchQueries=(u,l)=>{let n=[];return Object.keys(u).forEach(p=>{let
|
|
1
|
+
import{unstable_serialize as e}from"swr";import{getCollection as t}from"./queries/get-collection.js";import{getProduct as r}from"./queries/get-product.js";import{getProducts as s}from"./queries/get-products.js";import{generateCollectionQueryKey as o,generateProductsQueryKey as i,generateProductQueryKey as c}from"./query.js";let prefetchQueries=(u,l)=>{let n=[];return Object.keys(u).forEach(p=>{let d;let f=u[p];switch(f.tag){case"Product":{if(f.settings?.isAuto)break;let t={id:f.settings?.productSetting?.productId??"latest",isSample:l?.isSample,isStorefront:l?.isStorefront};d={key:e(c(t)),func:r,variables:t};break}case"ProductList":case"ProductListV3":{let r=f.settings?.productSetting;if(r?.productSrc==="Collection"){let s={id:r?.collectionId??"latest",numberOfProducts:f.settings?.numberOfProducts??4,orderBy:f.settings?.orderBy,isSample:l?.isSample,isStorefront:l?.isStorefront};d={key:e(o(s)),func:t,variables:s}}else{let t={ids:[...r?.productIds??[]].sort(),isSample:l?.isSample,isStorefront:l?.isStorefront};d={key:e(i(t)),func:s,variables:t}}}}d&&n.push(d)}),n.reduce((e,t)=>e.some(e=>e.key===t.key)?e:[...e,t],[])};export{prefetchQueries};
|
package/dist/esm/helpers/size.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{makeStyleResponsive as e}from"./make-style.js";import{devicesMapping as t}from"./constant.js";import{getResponsiveValueByScreen as i}from"./get-resonsive-value.js";function getCustomSizeCSSByDevice(e,i){if(!e||!i)return{};let l=t[i]??"";return{[`--pl${l}`]:e?.[i]?.horizontal,[`--pr${l}`]:e?.[i]?.horizontal,[`--pt${l}`]:e?.[i]?.vertical,[`--pb${l}`]:e?.[i]?.vertical}}let composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`gp-g-s-${e}`}let composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
|
|
2
2
|
${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
|
|
3
3
|
${i?`padding-top: ${i}; padding-bottom: ${i};`:void 0}
|
|
4
|
-
`},makeGlobalSize=t=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",t),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:e("h",getWidthHeightGlobalSize("height",t)),padding:getPaddingGlobalSize(t),gap:getGlobalSizeGap(t)}),makeGlobalSizeIcon=t=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",t),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:e("h",getWidthHeightGlobalSize("width",t)),minWidth:e("minw",getWidthHeightGlobalSize("width",t)),padding:getPaddingGlobalSize(t)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let l={},a=["desktop","mobile","tablet"];return a.forEach(a=>{l={...l,[a]:i(t,a)?.[e]}}),l},getHeightByShapeGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l),o=a?.shapeValue,g=a?.height;t={...t,[l]:o?"auto":g||"auto"}}),t},getWidthByShapeGlobalSize=(e,t,l)=>{let a={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let g=i(e,o),d=g?.width;t&&(d=g?.width||"auto"),l&&(d=g?.width||"100%"),d&&(a={...a,[o]:d})}),a},getAspectRatioGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l)?.shapeValue;if(a)t={...t,[l]:a};else{let a=i(e,l)?.shape;switch(a){case"square":t={...t,[l]:"1/1"};break;case"vertical":t={...t,[l]:"3/4"};break;case"horizontal":t={...t,[l]:"4/3"};break;case"original":t={...t,[l]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,i){if(!e||!i)return{};let l=t[i]??"";return{[`--pl${l}`]:e?.[i]?.padding?.left,[`--pr${l}`]:e?.[i]?.padding?.right,[`--pt${l}`]:e?.[i]?.padding?.top,[`--pb${l}`]:e?.[i]?.padding?.bottom}}let getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile")),getValueByDevice=(e,t)=>e?.[t]===void 0?e?.desktop===void 0?e?.tablet:e?.desktop:e?.[t],getPaddingStyleByDevice=(e,i)=>{if(!e)return{};let l=t[i||""]??"";return{[`--pl${l}`]:e?.left,[`--pr${l}`]:e?.right,[`--pt${l}`]:e?.top,[`--pb${l}`]:e?.bottom}},getResponsiveStylePadding=e=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getPaddingStyleByDevice(e?.desktop),...getPaddingStyleByDevice(e?.tablet,"tablet"),...getPaddingStyleByDevice(e?.mobile,"mobile")}},getFlexGrowClassByShapeGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l),o=a?.height,g=a?.shapeValue,d="desktop"===l?"gp-flex-1 gp-h-full":`${l}:gp-flex-1 ${l}:gp-h-full`,p="desktop"===l?"gp-flex-none gp-h-auto":`${l}:gp-flex-none ${l}:gp-h-auto`;t={...t,[d]:"100%"===o&&!g,[p]:"100%"!==o}}),t};export{composeSize,composeSizeCss,genSizeClass,getAspectRatioGlobalSize,getFlexGrowClassByShapeGlobalSize,getGlobalSizeGap,getHeightByShapeGlobalSize,getPaddingGlobalSize,getPaddingStyleByDevice,getResponsiveStylePadding,getValueByDevice,getWidthByShapeGlobalSize,getWidthHeightGlobalSize,makeGlobalSize,makeGlobalSizeIcon,makeStyleWithDefault};
|
|
4
|
+
`},makeGlobalSize=t=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",t),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:e("h",getWidthHeightGlobalSize("height",t)),padding:getPaddingGlobalSize(t),gap:getGlobalSizeGap(t)}),makeGlobalSizeIcon=t=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",t),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:e("h",getWidthHeightGlobalSize("width",t)),minWidth:e("minw",getWidthHeightGlobalSize("width",t)),padding:getPaddingGlobalSize(t)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let l={},a=["desktop","mobile","tablet"];return a.forEach(a=>{l={...l,[a]:i(t,a)?.[e]}}),l},getHeightByShapeGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l),o=a?.shapeValue,g=a?.height;t={...t,[l]:o?"auto":g||"auto"}}),t},getWidthByShapeGlobalSize=(e,t,l)=>{let a={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let g=i(e,o),d=g?.width;t&&(d=g?.width||"auto"),l&&(d=g?.width||"100%"),d&&(a={...a,[o]:d})}),a},getAspectRatioGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l)?.shapeValue;if(a)t={...t,[l]:a};else{let a=i(e,l)?.shape;switch(a){case"square":t={...t,[l]:"1/1"};break;case"vertical":t={...t,[l]:"3/4"};break;case"horizontal":t={...t,[l]:"4/3"};break;case"original":case"custom":t={...t,[l]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,i){if(!e||!i)return{};let l=t[i]??"";return{[`--pl${l}`]:e?.[i]?.padding?.left,[`--pr${l}`]:e?.[i]?.padding?.right,[`--pt${l}`]:e?.[i]?.padding?.top,[`--pb${l}`]:e?.[i]?.padding?.bottom}}let getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile")),getValueByDevice=(e,t)=>e?.[t]===void 0?e?.desktop===void 0?e?.tablet:e?.desktop:e?.[t],getPaddingStyleByDevice=(e,i)=>{if(!e)return{};let l=t[i||""]??"";return{[`--pl${l}`]:e?.left,[`--pr${l}`]:e?.right,[`--pt${l}`]:e?.top,[`--pb${l}`]:e?.bottom}},getResponsiveStylePadding=e=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getPaddingStyleByDevice(e?.desktop),...getPaddingStyleByDevice(e?.tablet,"tablet"),...getPaddingStyleByDevice(e?.mobile,"mobile")}},getFlexGrowClassByShapeGlobalSize=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=i(e,l),o=a?.height,g=a?.shapeValue,d="desktop"===l?"gp-flex-1 gp-h-full":`${l}:gp-flex-1 ${l}:gp-h-full`,p="desktop"===l?"gp-flex-none gp-h-auto":`${l}:gp-flex-none ${l}:gp-h-auto`;t={...t,[d]:"100%"===o&&!g,[p]:"100%"!==o}}),t};export{composeSize,composeSizeCss,genSizeClass,getAspectRatioGlobalSize,getFlexGrowClassByShapeGlobalSize,getGlobalSizeGap,getHeightByShapeGlobalSize,getPaddingGlobalSize,getPaddingStyleByDevice,getResponsiveStylePadding,getValueByDevice,getWidthByShapeGlobalSize,getWidthHeightGlobalSize,makeGlobalSize,makeGlobalSizeIcon,makeStyleWithDefault};
|