@gem-sdk/core 1.14.0-dev.393 → 1.14.0-dev.397
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/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`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)}),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={},a=["desktop","mobile","tablet"];return a.forEach(a=>{i={...i,[a]:getResonsiveValue.getResponsiveValueByScreen(t,a)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.shapeValue,l=a?.height;t={...t,[i]:o?"auto":l||"auto"}}),t},getWidthByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.width;t={...t,[i]:o||"auto"}}),t},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(a)t={...t,[i]:a};else{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(a){case"square":t={...t,[i]:"1/1"};break;case"vertical":t={...t,[i]:"3/4"};break;case"horizontal":t={...t,[i]:"4/3"}}}}),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"));exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,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)}),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={},a=["desktop","mobile","tablet"];return a.forEach(a=>{i={...i,[a]:getResonsiveValue.getResponsiveValueByScreen(t,a)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.shapeValue,l=a?.height;t={...t,[i]:o?"auto":l||"auto"}}),t},getWidthByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.width;t={...t,[i]:o||"auto"}}),t},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(a)t={...t,[i]:a};else{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(a){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"));exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,exports.makeStyleWithDefault=makeStyleWithDefault;
|
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 a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.horizontal,[`--pr${a}`]:e?.[i]?.horizontal,[`--pt${a}`]:e?.[i]?.vertical,[`--pb${a}`]:e?.[i]?.vertical}}let composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`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)}),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 a={},l=["desktop","mobile","tablet"];return l.forEach(l=>{a={...a,[l]:i(t,l)?.[e]}}),a},getHeightByShapeGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a),o=l?.shapeValue,g=l?.height;t={...t,[a]:o?"auto":g||"auto"}}),t},getWidthByShapeGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a),o=l?.width;t={...t,[a]:o||"auto"}}),t},getAspectRatioGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a)?.shapeValue;if(l)t={...t,[a]:l};else{let l=i(e,a)?.shape;switch(l){case"square":t={...t,[a]:"1/1"};break;case"vertical":t={...t,[a]:"3/4"};break;case"horizontal":t={...t,[a]:"4/3"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,i){if(!e||!i)return{};let a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.padding?.left,[`--pr${a}`]:e?.[i]?.padding?.right,[`--pt${a}`]:e?.[i]?.padding?.top,[`--pb${a}`]:e?.[i]?.padding?.bottom}}let getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile"));export{composeSize,composeSizeCss,genSizeClass,getAspectRatioGlobalSize,getGlobalSizeGap,getHeightByShapeGlobalSize,getPaddingGlobalSize,getWidthByShapeGlobalSize,getWidthHeightGlobalSize,makeGlobalSize,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)}),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 a={},l=["desktop","mobile","tablet"];return l.forEach(l=>{a={...a,[l]:i(t,l)?.[e]}}),a},getHeightByShapeGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a),o=l?.shapeValue,g=l?.height;t={...t,[a]:o?"auto":g||"auto"}}),t},getWidthByShapeGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a),o=l?.width;t={...t,[a]:o||"auto"}}),t},getAspectRatioGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a)?.shapeValue;if(l)t={...t,[a]:l};else{let l=i(e,a)?.shape;switch(l){case"square":t={...t,[a]:"1/1"};break;case"vertical":t={...t,[a]:"3/4"};break;case"horizontal":t={...t,[a]:"4/3"};break;case"original":t={...t,[a]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,i){if(!e||!i)return{};let a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.padding?.left,[`--pr${a}`]:e?.[i]?.padding?.right,[`--pt${a}`]:e?.[i]?.padding?.top,[`--pb${a}`]:e?.[i]?.padding?.bottom}}let getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile"));export{composeSize,composeSizeCss,genSizeClass,getAspectRatioGlobalSize,getGlobalSizeGap,getHeightByShapeGlobalSize,getPaddingGlobalSize,getWidthByShapeGlobalSize,getWidthHeightGlobalSize,makeGlobalSize,makeStyleWithDefault};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.14.0-dev.
|
|
3
|
+
"version": "1.14.0-dev.397",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gem-sdk/adapter-shopify": "1.14.0-dev.284",
|
|
28
|
-
"@gem-sdk/styles": "1.14.0-dev.
|
|
28
|
+
"@gem-sdk/styles": "1.14.0-dev.395"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|