@gem-sdk/core 3.1.0 → 3.1.16

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,19 +1,19 @@
1
- "use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=o=>`gp-g-${o}`,composeTypographyCss=o=>{let e=o?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=e?.desktop??{};return`
1
+ "use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=e=>`gp-g-${e}`,composeTypographyCss=e=>{let o=e?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=o?.desktop??{};return`
2
2
  ${t?`fontFamily: ${composeFontFamilyTypographyV2({fontFamily:t})};`:""}
3
3
  ${p?`font-size: ${p};`:""}
4
4
  ${s?`font-style: ${s};`:""}
5
5
  ${a?`font-weight: ${a};`:""}
6
6
  ${l?`letter-spacing: ${l};`:""}
7
7
  ${y?`line-height: ${y};`:""}
8
- `},composeTypographyV2Css=(o,e)=>{let t=o?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l,textShadow:r,hasShadowText:n}=t??{},i=o?.attrs,m=r&&"none"!==r.type&&!1!==r.enable,{bold:c,italic:g,underline:h,transform:$,color:T}=i??{},f=e?"!important":"";return`
9
- ${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:o?.type})} ${f}`:""};
10
- ${s?.desktop?`font-size: ${s?.desktop} ${f}`:""};
11
- ${T?`color: ${colors.getSingleColorVariable(T)} ${f}`:""};
12
- ${c?`font-weight: bold ${f}`:a?`font-weight: ${a} ${f}`:""};
13
- ${l?`letter-spacing: ${l} ${f}`:""};
14
- ${y?.desktop?`line-height: ${y?.desktop} ${f}`:""};
15
- ${g?`font-style: italic ${f}`:""};
16
- ${h?`text-decoration-line: underline ${f}`:""};
17
- ${$?`text-transform: ${$} ${f}`:""};
8
+ `},composeTypographyV2Css=(e,o)=>{let t=e?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l,textShadow:r,hasShadowText:n}=t??{},i=e?.attrs,m=r&&"none"!==r.type&&!1!==r.enable,{bold:c,italic:g,underline:h,transform:$,color:f}=i??{},T=o?"!important":"";return`
9
+ ${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:e?.type})} ${T}`:""};
10
+ ${s?.desktop?`font-size: ${s?.desktop} ${T}`:""};
11
+ ${f?`color: ${colors.getSingleColorVariable(f)} ${T}`:""};
12
+ ${c?`font-weight: bold ${T}`:a?`font-weight: ${a} ${T}`:""};
13
+ ${l?`letter-spacing: ${l} ${T}`:""};
14
+ ${y?.desktop?`line-height: ${y?.desktop} ${T}`:""};
15
+ ${g?`font-style: italic ${T}`:""};
16
+ ${h?`text-decoration-line: underline ${T}`:""};
17
+ ${$?`text-transform: ${$} ${T}`:""};
18
18
  ${m&&n?`text-shadow: ${composeTextShadowCss(r||{})}`:"none"};
19
- `},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let s=Math.round(Math.cos(t)*p*100)/100,a=Math.round(Math.sin(t)*p*100)/100;return`${s}px ${a}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(o,e)=>{if(o){let t=e?"!important":"",p=colors.getSingleColorVariable(o.hover);return`${p?`color: ${p} ${t}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}const composeTypography=o=>o?makeStyle.removeNullUndefined({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,e)=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:e?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...makeStyle.makeStyleResponsive("size",o?.fontSize),...makeStyle.makeStyleResponsive("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:s}=o||{};return e?"string"==typeof e?getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):"object"==typeof e&&"string"==typeof e?.value?"theme"===e.type?`var(${e?.value}), var(--g-font-body)`:getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):void 0:t?p:void 0},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=o=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?"italic":void 0,weight:o?.bold?"bold":void 0,c:colors.getSingleColorVariable(o?.color),tt:o?.transform,tdl:o?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeFontFamilyTypographyV2=composeFontFamilyTypographyV2,exports.composeTextHoverColorCss=composeTextHoverColorCss,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
19
+ `},composeTextShadowCss=e=>{let o="number"==typeof e?.angle?e?.angle:0,t=o*Math.PI/180,p=parseFloat(e?.distance??"0");if(isNaN(p))return"none";let s=Math.round(Math.cos(t)*p*100)/100,a=Math.round(Math.sin(t)*p*100)/100;return`${s}px ${a}px ${e?.blur??"0"} ${e.color}`},composeTextHoverColorCss=(e,o)=>{if(e){let t=o?"!important":"",p=colors.getSingleColorVariable(e.hover);return`${p?`color: ${p} ${t}`:""}`}};function getCustomCSSByDevice(e,o){if(!e||!o)return{};let t="desktop"!==o&&o?`-${o}`:"",{fontFamily:p}=e?.[o]??{};return{[`--size${t}`]:e?.[o]?.fontSize,[`--lh${t}`]:e?.[o]?.lineHeight,[`--fs${t}`]:e?.[o]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:e?.[o]?.fontWeight,[`--ls${t}`]:e?.[o]?.letterSpacing}}const composeTypography=e=>e?makeStyle.removeNullUndefined({...getCustomCSSByDevice(e,"desktop"),...getCustomCSSByDevice(e,"tablet"),...getCustomCSSByDevice(e,"mobile")}):{},composeTypographyV2=(e,o)=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?void 0:e?.fontStyle,ff:composeFontFamilyTypographyV2(e),weight:o?.bold?void 0:e?.fontWeight,ls:e?.letterSpacing}),...makeStyle.makeStyleResponsive("size",e?.fontSize),...makeStyle.makeStyleResponsive("lh",e?.lineHeight)}):{},composeFontFamilyTypographyV2=e=>{let{fontFamily:o,isCustom:t,fallbackFontFamily:p,type:s}=e||{};if(!o)return t?p:void 0;if("string"==typeof o)return getFontUsedByTypographyV2({fontFamily:o,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")});if("object"==typeof o&&"string"==typeof o?.value){if("theme"===o.type){let e=o?.value.includes("--g-theme-font")?`var(${o?.value})`:o?.value;return`${e}, var(--g-font-body)`}return getFontUsedByTypographyV2({fontFamily:o.value,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")})}},getFontUsedByTypographyV2=({fontFamily:e,fallbackFontFamily:o})=>{if(e)return`var(--g-font-${e?.replace(/ /g,"-")}, '${e}'), ${o}`},composeTypographyAttr=e=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?"italic":void 0,weight:e?.bold?"bold":void 0,c:colors.getSingleColorVariable(e?.color),tt:e?.transform,tdl:e?.underline?"underline":void 0})}):{},composeTypographyClassName=(e,o)=>e?e?.type&&!isCustomTypo(e.custom)?genTypoClass(e.type):"":o?.type&&genTypoClass(o?.type),composeFallbackTypographyStyle=e=>e.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(e,o,t)=>{if(e){let o=composeFallbackTypographyStyle(e.type??"heading"),p={...e.custom,fallbackFontFamily:o,isCustom:isCustomTypo(e.custom)};return{...composeTypographyV2(p,e.attrs),...!t&&composeTypographyAttr(e.attrs)}}return{...o?.type?{}:composeTypography(o?.custom)}},isCustomTypo=e=>e&&Object.keys(e).length>1||e&&1===Object.keys(e).length&&!e.fontSize;exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeFontFamilyTypographyV2=composeFontFamilyTypographyV2,exports.composeTextHoverColorCss=composeTextHoverColorCss,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=a||"${{amount}}";function s(e,a){return void 0===e?a:e}function n(e,a,o,r){if(a=s(a,2),o=s(o,","),r=s(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),n=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return n+i}switch(t.match(r)[1]){case"amount":o=n(e,2);break;case"amount_no_decimals":o=n(e,0);break;case"amount_with_comma_separator":o=n(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=n(e,0,".",",");break;case"amount_with_apostrophe_separator":o=n(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=n(e,0," ");break;case"amount_with_space_separator":o=n(e,2," ",",");break;case"amount_with_period_and_space_separator":o=n(e,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,a)=>{let{moneyFormat:o,moneyWithCurrencyFormat:r}=shop.useMoneyFormat();return a?formatMoney(`${e}`,r||o):formatMoney(`${e}`,o)};exports.formatMoney=formatMoney,exports.shopifyPriceRounding=shopifyPriceRounding,exports.useFormatMoney=useFormatMoney;
2
+ "use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t="string"!=typeof a?a:a.replace(/<[^>]*>/g,""),s=t||"${{amount}}";function n(e,a){return void 0===e?a:e}function i(e,a,o,r){if(a=n(a,2),o=n(o,","),r=n(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}let u=s.match(r);if(!u)return s;switch(u[1]){case"amount":o=i(e,2);break;case"amount_no_decimals":o=i(e,0);break;case"amount_with_comma_separator":o=i(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=i(e,0,".",",");break;case"amount_with_apostrophe_separator":o=i(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=i(e,0," ");break;case"amount_with_space_separator":o=i(e,2," ",",");break;case"amount_with_period_and_space_separator":o=i(e,2," ",".")}return s.replace(r,o)},useFormatMoney=(e,a)=>{let{moneyFormat:o,moneyWithCurrencyFormat:r}=shop.useMoneyFormat();return a?formatMoney(`${e}`,r||o):formatMoney(`${e}`,o)};exports.formatMoney=formatMoney,exports.shopifyPriceRounding=shopifyPriceRounding,exports.useFormatMoney=useFormatMoney;
@@ -5,15 +5,15 @@ import{getSingleColorVariable as o}from"./colors.js";import{removeNullUndefined
5
5
  ${s?`font-weight: ${s};`:""}
6
6
  ${l?`letter-spacing: ${l};`:""}
7
7
  ${y?`line-height: ${y};`:""}
8
- `},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:y,lineHeight:l,letterSpacing:r,textShadow:n,hasShadowText:i}=p??{},g=e?.attrs,c=n&&"none"!==n.type&&!1!==n.enable,{bold:m,italic:h,underline:$,transform:f,color:d}=g??{},T=t?"!important":"";return`
9
- ${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${T}`:""};
10
- ${s?.desktop?`font-size: ${s?.desktop} ${T}`:""};
11
- ${d?`color: ${o(d)} ${T}`:""};
12
- ${m?`font-weight: bold ${T}`:y?`font-weight: ${y} ${T}`:""};
13
- ${r?`letter-spacing: ${r} ${T}`:""};
14
- ${l?.desktop?`line-height: ${l?.desktop} ${T}`:""};
15
- ${h?`font-style: italic ${T}`:""};
16
- ${$?`text-decoration-line: underline ${T}`:""};
17
- ${f?`text-transform: ${f} ${T}`:""};
8
+ `},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:y,lineHeight:l,letterSpacing:r,textShadow:n,hasShadowText:i}=p??{},g=e?.attrs,c=n&&"none"!==n.type&&!1!==n.enable,{bold:m,italic:h,underline:$,transform:f,color:u}=g??{},d=t?"!important":"";return`
9
+ ${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${d}`:""};
10
+ ${s?.desktop?`font-size: ${s?.desktop} ${d}`:""};
11
+ ${u?`color: ${o(u)} ${d}`:""};
12
+ ${m?`font-weight: bold ${d}`:y?`font-weight: ${y} ${d}`:""};
13
+ ${r?`letter-spacing: ${r} ${d}`:""};
14
+ ${l?.desktop?`line-height: ${l?.desktop} ${d}`:""};
15
+ ${h?`font-style: italic ${d}`:""};
16
+ ${$?`text-decoration-line: underline ${d}`:""};
17
+ ${f?`text-transform: ${f} ${d}`:""};
18
18
  ${c&&i?`text-shadow: ${composeTextShadowCss(n||{})}`:"none"};
19
- `},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let a=Math.round(Math.cos(t)*p*100)/100,s=Math.round(Math.sin(t)*p*100)/100;return`${a}px ${s}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}let composeTypography=o=>o?e({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,a)=>o?e({...t({fs:a?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:a?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...p("size",o?.fontSize),...p("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:a}=o||{};return e?"string"==typeof e?getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")}):"object"==typeof e&&"string"==typeof e?.value?"theme"===e.type?`var(${e?.value}), var(--g-font-body)`:getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")}):void 0:t?p:void 0},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=p=>p?e({...t({fs:p?.italic?"italic":void 0,weight:p?.bold?"bold":void 0,c:o(p?.color),tt:p?.transform,tdl:p?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;export{composeFallbackTypographyStyle,composeFontFamilyTypographyV2,composeTextHoverColorCss,composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass};
19
+ `},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let a=Math.round(Math.cos(t)*p*100)/100,s=Math.round(Math.sin(t)*p*100)/100;return`${a}px ${s}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}let composeTypography=o=>o?e({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,a)=>o?e({...t({fs:a?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:a?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...p("size",o?.fontSize),...p("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:a}=o||{};if(!e)return t?p:void 0;if("string"==typeof e)return getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")});if("object"==typeof e&&"string"==typeof e?.value){if("theme"===e.type){let o=e?.value.includes("--g-theme-font")?`var(${e?.value})`:e?.value;return`${o}, var(--g-font-body)`}return getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")})}},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=p=>p?e({...t({fs:p?.italic?"italic":void 0,weight:p?.bold?"bold":void 0,c:o(p?.color),tt:p?.transform,tdl:p?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;export{composeFallbackTypographyStyle,composeFontFamilyTypographyV2,composeTextHoverColorCss,composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{useMoneyFormat as a}from"./shop.js";let shopifyPriceRounding=(a,e)=>parseFloat(`${a}`).toFixed(Number(e)),formatMoney=function(a,e){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=e||"${{amount}}";function n(a,e){return void 0===a?e:a}function s(a,e,o,r){if(e=n(e,2),o=n(o,","),r=n(r,"."),isNaN(a)||null==a)return 0;a=shopifyPriceRounding(a,Number(e));let t=a.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}switch(t.match(r)[1]){case"amount":o=s(a,2);break;case"amount_no_decimals":o=s(a,0);break;case"amount_with_comma_separator":o=s(a,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=s(a,0,".",",");break;case"amount_with_apostrophe_separator":o=s(a,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=s(a,0," ");break;case"amount_with_space_separator":o=s(a,2," ",",");break;case"amount_with_period_and_space_separator":o=s(a,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=a();return o?formatMoney(`${e}`,t||r):formatMoney(`${e}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
2
+ import{useMoneyFormat as e}from"./shop.js";let shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t="string"!=typeof a?a:a.replace(/<[^>]*>/g,""),n=t||"${{amount}}";function s(e,a){return void 0===e?a:e}function i(e,a,o,r){if(a=s(a,2),o=s(o,","),r=s(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),n=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return n+i}let c=n.match(r);if(!c)return n;switch(c[1]){case"amount":o=i(e,2);break;case"amount_no_decimals":o=i(e,0);break;case"amount_with_comma_separator":o=i(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=i(e,0,".",",");break;case"amount_with_apostrophe_separator":o=i(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=i(e,0," ");break;case"amount_with_space_separator":o=i(e,2," ",",");break;case"amount_with_period_and_space_separator":o=i(e,2," ",".")}return n.replace(r,o)},useFormatMoney=(a,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=e();return o?formatMoney(`${a}`,t||r):formatMoney(`${a}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "3.1.0",
3
+ "version": "3.1.16",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",