@gem-sdk/core 1.14.0-dev.729 → 1.14.0-dev.731
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 isDefined=require("./is-defined.js"),constant=require("./constant.js");const getGlobalColorCSSProp=e=>getSingleColorVariable(e),getGlobalColorClass=(e,t)=>"string"!=typeof t||!t||t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent")?""
|
|
1
|
+
"use strict";var isDefined=require("./is-defined.js"),constant=require("./constant.js");const getGlobalColorCSSProp=e=>getSingleColorVariable(e),getGlobalColorClass=(e,t)=>"string"!=typeof t||!t||t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent")?"":`gp-${e}-g-${t}`,getGlobalColorResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?`${t}:${s}`:`${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${s}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"desktop"===t?[`--${e}`,getSingleColorVariable(o)]:[`--${e}-${t}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping?.[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):{},getGlobalColorStateResponsiveStyle=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.fromEntries(Object.entries(o).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):Object.fromEntries(Object.entries(o).map(([o,l])=>"active"===o?[]:[`-${constant.stateMapping[o]}-${e}-${t}`,getSingleColorVariable(l)]).filter(isDefined.isDefined))).reduce((e,t)=>({...e,...t}),{}):{},getSingleColorVariable=e=>{if(e&&"string"==typeof e)return isColor(e)?e:`var(--g-c-${e}, ${e})`};function isColor(e){return!!e&&"string"==typeof e&&(e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent"))}const getGlobalColorStyle=e=>e?{"--c":getSingleColorVariable(e)}:{},composeTextColorCss=e=>`${e?`color: ${getSingleColorVariable(e)} !important;`:""}`;exports.composeTextColorCss=composeTextColorCss,exports.getGlobalColorCSSProp=getGlobalColorCSSProp,exports.getGlobalColorClass=getGlobalColorClass,exports.getGlobalColorResponsiveClass=getGlobalColorResponsiveClass,exports.getGlobalColorResponsiveStyle=getGlobalColorResponsiveStyle,exports.getGlobalColorStateClass=getGlobalColorStateClass,exports.getGlobalColorStateClassDynamicBtn=getGlobalColorStateClassDynamicBtn,exports.getGlobalColorStateResponsiveClass=getGlobalColorStateResponsiveClass,exports.getGlobalColorStateResponsiveClassDynamicBtn=getGlobalColorStateResponsiveClassDynamicBtn,exports.getGlobalColorStateResponsiveStyle=getGlobalColorStateResponsiveStyle,exports.getGlobalColorStateStyle=getGlobalColorStateStyle,exports.getGlobalColorStyle=getGlobalColorStyle,exports.getSingleColorVariable=getSingleColorVariable,exports.isColor=isColor;
|
package/dist/cjs/helpers/size.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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`
|
|
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
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,t)=>{let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let o=getResonsiveValue.getResponsiveValueByScreen(e,a),l=t?o?.width||"auto":o?.width;l&&(i={...i,[a]:l})}),i},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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isDefined as t}from"./is-defined.js";import{stateMapping as e}from"./constant.js";let getGlobalColorCSSProp=t=>getSingleColorVariable(t),getGlobalColorClass=(t,e)=>"string"!=typeof e||!e||e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent")?""
|
|
1
|
+
import{isDefined as t}from"./is-defined.js";import{stateMapping as e}from"./constant.js";let getGlobalColorCSSProp=t=>getSingleColorVariable(t),getGlobalColorClass=(t,e)=>"string"!=typeof e||!e||e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent")?"":`gp-${t}-g-${e}`,getGlobalColorResponsiveClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateResponsiveClass=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?`${o}:${r}`:`${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${r}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(t,e)=>e?Object.fromEntries(Object.entries(e).map(([e,o])=>"desktop"===e?[`--${t}`,getSingleColorVariable(o)]:[`--${t}-${e}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(o,l)=>l?Object.fromEntries(Object.entries(l).map(([t,l])=>"active"===t?[]:[`-${e?.[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):{},getGlobalColorStateResponsiveStyle=(o,l)=>l?Object.entries(l).map(([l,r])=>"desktop"===l?Object.fromEntries(Object.entries(r).map(([t,l])=>"active"===t?[]:[`-${e[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):Object.fromEntries(Object.entries(r).map(([t,r])=>"active"===t?[]:[`-${e[t]}-${o}-${l}`,getSingleColorVariable(r)]).filter(t))).reduce((t,e)=>({...t,...e}),{}):{},getSingleColorVariable=t=>{if(t&&"string"==typeof t)return isColor(t)?t:`var(--g-c-${t}, ${t})`};function isColor(t){return!!t&&"string"==typeof t&&(t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent"))}let getGlobalColorStyle=t=>t?{"--c":getSingleColorVariable(t)}:{},composeTextColorCss=t=>`${t?`color: ${getSingleColorVariable(t)} !important;`:""}`;export{composeTextColorCss,getGlobalColorCSSProp,getGlobalColorClass,getGlobalColorResponsiveClass,getGlobalColorResponsiveStyle,getGlobalColorStateClass,getGlobalColorStateClassDynamicBtn,getGlobalColorStateResponsiveClass,getGlobalColorStateResponsiveClassDynamicBtn,getGlobalColorStateResponsiveStyle,getGlobalColorStateStyle,getGlobalColorStyle,getSingleColorVariable,isColor};
|
package/dist/esm/helpers/size.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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`
|
|
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`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
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,t)=>{let a={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let o=i(e,l),g=t?o?.width||"auto":o?.width;g&&(a={...a,[l]:g})}),a},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.731",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@gem-sdk/adapter-shopify": "1.14.0-dev.619",
|
|
31
|
-
"@gem-sdk/styles": "1.14.0-dev.
|
|
31
|
+
"@gem-sdk/styles": "1.14.0-dev.731"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"react-error-boundary": "4.0.10",
|