@gem-sdk/core 1.48.0-dev.6 → 1.48.0-dev.61

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.
@@ -74,8 +74,10 @@ const composeTypographyV2 = (value, attrs)=>{
74
74
  });
75
75
  };
76
76
  const composeFontFamilyTypographyV2 = (value)=>{
77
- const fontFamily = value?.fontFamily;
78
- if (!fontFamily) return;
77
+ const { fontFamily, isCustom, fallbackFontFamily } = value || {};
78
+ if (!fontFamily) {
79
+ return isCustom ? fallbackFontFamily : undefined;
80
+ }
79
81
  if (typeof fontFamily === 'string') {
80
82
  return getFontUsedByTypographyV2({
81
83
  fontFamily,
@@ -117,15 +119,7 @@ const composeTypographyClassName = (typo, typography)=>{
117
119
  return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
118
120
  };
119
121
  const composeFallbackTypographyStyle = (tag)=>{
120
- if ([
121
- 'heading',
122
- 'heading-1',
123
- 'heading-2',
124
- 'heading-3',
125
- 'heading-4',
126
- 'heading-5',
127
- 'heading-6'
128
- ].includes(tag)) {
122
+ if (tag.toLocaleLowerCase().includes('heading')) {
129
123
  return 'var(--g-font-heading, heading)';
130
124
  }
131
125
  return 'var(--g-font-body, body)';
@@ -135,7 +129,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
135
129
  const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
136
130
  const customTypo = {
137
131
  ...typo.custom,
138
- fallbackFontFamily: fallbackFontFamily
132
+ fallbackFontFamily: fallbackFontFamily,
133
+ isCustom: isCustomTypo(typo.custom)
139
134
  };
140
135
  return {
141
136
  ...composeTypographyV2(customTypo, typo.attrs),
@@ -146,8 +141,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
146
141
  ...!typography?.type ? composeTypography(typography?.custom) : {}
147
142
  };
148
143
  };
149
- const isCustomTypo = (typoProps)=>{
150
- return typoProps && Object.keys(typoProps).length > 1 || typoProps && Object.keys(typoProps).length === 1 && !typoProps.fontSize;
144
+ const isCustomTypo = (customTypo)=>{
145
+ return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
151
146
  };
152
147
 
153
148
  export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass };
package/dist/esm/index.js CHANGED
@@ -66,7 +66,7 @@ export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption }
66
66
  export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
67
67
  export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
68
68
  export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, styles, template } from './helpers/render.js';
69
- export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
69
+ export { composeShadowCss, getResonsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
70
70
  export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, getGlobalSizeGap, getHeightByShapeGlobalSize, getPaddingGlobalSize, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeGlobalSizeIcon, makeStyleWithDefault } from './helpers/size.js';
71
71
  export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
72
72
  export { useAddToCart } from './hooks/cart/use-add-to-cart.js';