@gem-sdk/core 1.23.0-staging.275 → 1.23.0-staging.284

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.
@@ -223,6 +223,29 @@ const splitStyle = (keys, style = {})=>{
223
223
  restStyle
224
224
  ];
225
225
  };
226
+ const filterAttrInStyle = (style, filterKeys)=>{
227
+ if (!style || !filterKeys) return {};
228
+ const newStyle = {
229
+ ...style
230
+ };
231
+ Object.entries(newStyle).forEach(([key])=>{
232
+ if (!filterKeys.includes(key)) {
233
+ delete newStyle[key];
234
+ }
235
+ });
236
+ return newStyle;
237
+ };
238
+ const filterCornerInStyle = (style)=>{
239
+ const cornerKeys = [
240
+ '--bblr',
241
+ '--bbrr',
242
+ '--btlr',
243
+ '--btrr'
244
+ ];
245
+ return filterAttrInStyle(style, cornerKeys);
246
+ };
226
247
 
227
248
  exports.composeAdvanceStyle = composeAdvanceStyle;
249
+ exports.filterAttrInStyle = filterAttrInStyle;
250
+ exports.filterCornerInStyle = filterCornerInStyle;
228
251
  exports.splitStyle = splitStyle;
@@ -61,7 +61,7 @@ const composeTypographyV2 = (value, attrs)=>{
61
61
  return makeStyle.removeNullUndefined({
62
62
  ...makeStyle.makeStyle({
63
63
  fs: !attrs?.italic ? value?.fontStyle : undefined,
64
- ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, ${value.fontFamily})` : undefined,
64
+ ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}')` : undefined,
65
65
  weight: !attrs?.bold ? value?.fontWeight : undefined,
66
66
  ls: value?.letterSpacing,
67
67
  lh: value?.lineHeight
package/dist/cjs/index.js CHANGED
@@ -249,6 +249,8 @@ exports.generateCollectionQueryKey = query.generateCollectionQueryKey;
249
249
  exports.generateProductQueryKey = query.generateProductQueryKey;
250
250
  exports.generateProductsQueryKey = query.generateProductsQueryKey;
251
251
  exports.composeAdvanceStyle = composeAdvanceStyle.composeAdvanceStyle;
252
+ exports.filterAttrInStyle = composeAdvanceStyle.filterAttrInStyle;
253
+ exports.filterCornerInStyle = composeAdvanceStyle.filterCornerInStyle;
252
254
  exports.splitStyle = composeAdvanceStyle.splitStyle;
253
255
  exports.composePositionLineHeight = iconList.composePositionLineHeight;
254
256
  exports.composePostionIconList = iconList.composePostionIconList;
@@ -221,5 +221,26 @@ const splitStyle = (keys, style = {})=>{
221
221
  restStyle
222
222
  ];
223
223
  };
224
+ const filterAttrInStyle = (style, filterKeys)=>{
225
+ if (!style || !filterKeys) return {};
226
+ const newStyle = {
227
+ ...style
228
+ };
229
+ Object.entries(newStyle).forEach(([key])=>{
230
+ if (!filterKeys.includes(key)) {
231
+ delete newStyle[key];
232
+ }
233
+ });
234
+ return newStyle;
235
+ };
236
+ const filterCornerInStyle = (style)=>{
237
+ const cornerKeys = [
238
+ '--bblr',
239
+ '--bbrr',
240
+ '--btlr',
241
+ '--btrr'
242
+ ];
243
+ return filterAttrInStyle(style, cornerKeys);
244
+ };
224
245
 
225
- export { composeAdvanceStyle, splitStyle };
246
+ export { composeAdvanceStyle, filterAttrInStyle, filterCornerInStyle, splitStyle };
@@ -59,7 +59,7 @@ const composeTypographyV2 = (value, attrs)=>{
59
59
  return removeNullUndefined({
60
60
  ...makeStyle({
61
61
  fs: !attrs?.italic ? value?.fontStyle : undefined,
62
- ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, ${value.fontFamily})` : undefined,
62
+ ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}')` : undefined,
63
63
  weight: !attrs?.bold ? value?.fontWeight : undefined,
64
64
  ls: value?.letterSpacing,
65
65
  lh: value?.lineHeight
package/dist/esm/index.js CHANGED
@@ -58,7 +58,7 @@ export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, ge
58
58
  export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
59
59
  export { GRADIENT_BGR_KEY, composeBackgroundCss, getBgImageByDevice, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getStyleBackgroundByDevice, makeFixedBgAttachment } from './helpers/background.js';
60
60
  export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
61
- export { composeAdvanceStyle, splitStyle } from './helpers/compose-advance-style.js';
61
+ export { composeAdvanceStyle, filterAttrInStyle, filterCornerInStyle, splitStyle } from './helpers/compose-advance-style.js';
62
62
  export { composePositionLineHeight, composePostionIconList } from './helpers/icon-list.js';
63
63
  export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
64
64
  export { useCartData } from './hooks/cart/use-cart-data.js';