@gem-sdk/core 1.31.7 → 1.31.10
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/components/Render.liquid.js +1 -1
- package/dist/cjs/helpers/colors.js +1 -0
- package/dist/cjs/helpers/compose-advance-style.js +48 -0
- package/dist/cjs/index.js +4 -0
- package/dist/esm/components/Render.liquid.js +1 -1
- package/dist/esm/helpers/colors.js +1 -0
- package/dist/esm/helpers/compose-advance-style.js +45 -1
- package/dist/esm/index.js +1 -1
- package/dist/types/index.d.ts +5981 -1
- package/package.json +1 -1
|
@@ -228,7 +228,7 @@ const appendAnimation = (props, liquid)=>{
|
|
|
228
228
|
all: tag === 'Section' ? '' : 'inherit'
|
|
229
229
|
};
|
|
230
230
|
return render.template`
|
|
231
|
-
${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets/gp-animation.js" defer="defer"></script>`)}
|
|
231
|
+
${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
232
232
|
<gp-animation
|
|
233
233
|
gp-data='${JSON.stringify({
|
|
234
234
|
config: animation,
|
|
@@ -155,6 +155,7 @@ const getSingleColorVariable = (color)=>{
|
|
|
155
155
|
return `var(--g-c-${color}, ${color})`;
|
|
156
156
|
};
|
|
157
157
|
function isColor(color) {
|
|
158
|
+
if (!color || typeof color !== 'string') return false;
|
|
158
159
|
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
|
|
159
160
|
}
|
|
160
161
|
const getGlobalColorStyle = (data)=>{
|
|
@@ -215,6 +215,54 @@ const splitStyle = (keys, style = {})=>{
|
|
|
215
215
|
restStyle
|
|
216
216
|
];
|
|
217
217
|
};
|
|
218
|
+
const filterAttrInStyle = (style, filterKeys)=>{
|
|
219
|
+
if (!style || !filterKeys) return {};
|
|
220
|
+
const newStyle = {
|
|
221
|
+
...style
|
|
222
|
+
};
|
|
223
|
+
Object.entries(newStyle).forEach(([key])=>{
|
|
224
|
+
if (!filterKeys.includes(key)) {
|
|
225
|
+
delete newStyle[key];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
return newStyle;
|
|
229
|
+
};
|
|
230
|
+
const removeAttrInStyle = (style, filterKeys)=>{
|
|
231
|
+
if (!style || !filterKeys) return {};
|
|
232
|
+
const newStyle = {
|
|
233
|
+
...style
|
|
234
|
+
};
|
|
235
|
+
Object.entries(newStyle).forEach(([key])=>{
|
|
236
|
+
if (filterKeys.includes(key)) {
|
|
237
|
+
delete newStyle[key];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
return newStyle;
|
|
241
|
+
};
|
|
242
|
+
const filterCornerInStyle = (style)=>{
|
|
243
|
+
const cornerKeys = [
|
|
244
|
+
'--bblr',
|
|
245
|
+
'--bbrr',
|
|
246
|
+
'--btlr',
|
|
247
|
+
'--btrr'
|
|
248
|
+
];
|
|
249
|
+
return filterAttrInStyle(style, cornerKeys);
|
|
250
|
+
};
|
|
251
|
+
const removePaddingYInStyle = (style)=>{
|
|
252
|
+
const keys = [
|
|
253
|
+
'--pt',
|
|
254
|
+
'--pt-tablet',
|
|
255
|
+
'--pt-mobile',
|
|
256
|
+
'--pb',
|
|
257
|
+
'--pb-tablet',
|
|
258
|
+
'--pb-mobile'
|
|
259
|
+
];
|
|
260
|
+
return removeAttrInStyle(style, keys);
|
|
261
|
+
};
|
|
218
262
|
|
|
219
263
|
exports.composeAdvanceStyle = composeAdvanceStyle;
|
|
264
|
+
exports.filterAttrInStyle = filterAttrInStyle;
|
|
265
|
+
exports.filterCornerInStyle = filterCornerInStyle;
|
|
266
|
+
exports.removeAttrInStyle = removeAttrInStyle;
|
|
267
|
+
exports.removePaddingYInStyle = removePaddingYInStyle;
|
|
220
268
|
exports.splitStyle = splitStyle;
|
package/dist/cjs/index.js
CHANGED
|
@@ -249,6 +249,10 @@ 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;
|
|
254
|
+
exports.removeAttrInStyle = composeAdvanceStyle.removeAttrInStyle;
|
|
255
|
+
exports.removePaddingYInStyle = composeAdvanceStyle.removePaddingYInStyle;
|
|
252
256
|
exports.splitStyle = composeAdvanceStyle.splitStyle;
|
|
253
257
|
exports.composePositionLineHeight = iconList.composePositionLineHeight;
|
|
254
258
|
exports.composePostionIconList = iconList.composePostionIconList;
|
|
@@ -224,7 +224,7 @@ const appendAnimation = (props, liquid)=>{
|
|
|
224
224
|
all: tag === 'Section' ? '' : 'inherit'
|
|
225
225
|
};
|
|
226
226
|
return template`
|
|
227
|
-
${RenderIf(isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${baseAssetURL}/assets/gp-animation.js" defer="defer"></script>`)}
|
|
227
|
+
${RenderIf(isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
228
228
|
<gp-animation
|
|
229
229
|
gp-data='${JSON.stringify({
|
|
230
230
|
config: animation,
|
|
@@ -153,6 +153,7 @@ const getSingleColorVariable = (color)=>{
|
|
|
153
153
|
return `var(--g-c-${color}, ${color})`;
|
|
154
154
|
};
|
|
155
155
|
function isColor(color) {
|
|
156
|
+
if (!color || typeof color !== 'string') return false;
|
|
156
157
|
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
|
|
157
158
|
}
|
|
158
159
|
const getGlobalColorStyle = (data)=>{
|
|
@@ -213,5 +213,49 @@ const splitStyle = (keys, style = {})=>{
|
|
|
213
213
|
restStyle
|
|
214
214
|
];
|
|
215
215
|
};
|
|
216
|
+
const filterAttrInStyle = (style, filterKeys)=>{
|
|
217
|
+
if (!style || !filterKeys) return {};
|
|
218
|
+
const newStyle = {
|
|
219
|
+
...style
|
|
220
|
+
};
|
|
221
|
+
Object.entries(newStyle).forEach(([key])=>{
|
|
222
|
+
if (!filterKeys.includes(key)) {
|
|
223
|
+
delete newStyle[key];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return newStyle;
|
|
227
|
+
};
|
|
228
|
+
const removeAttrInStyle = (style, filterKeys)=>{
|
|
229
|
+
if (!style || !filterKeys) return {};
|
|
230
|
+
const newStyle = {
|
|
231
|
+
...style
|
|
232
|
+
};
|
|
233
|
+
Object.entries(newStyle).forEach(([key])=>{
|
|
234
|
+
if (filterKeys.includes(key)) {
|
|
235
|
+
delete newStyle[key];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return newStyle;
|
|
239
|
+
};
|
|
240
|
+
const filterCornerInStyle = (style)=>{
|
|
241
|
+
const cornerKeys = [
|
|
242
|
+
'--bblr',
|
|
243
|
+
'--bbrr',
|
|
244
|
+
'--btlr',
|
|
245
|
+
'--btrr'
|
|
246
|
+
];
|
|
247
|
+
return filterAttrInStyle(style, cornerKeys);
|
|
248
|
+
};
|
|
249
|
+
const removePaddingYInStyle = (style)=>{
|
|
250
|
+
const keys = [
|
|
251
|
+
'--pt',
|
|
252
|
+
'--pt-tablet',
|
|
253
|
+
'--pt-mobile',
|
|
254
|
+
'--pb',
|
|
255
|
+
'--pb-tablet',
|
|
256
|
+
'--pb-mobile'
|
|
257
|
+
];
|
|
258
|
+
return removeAttrInStyle(style, keys);
|
|
259
|
+
};
|
|
216
260
|
|
|
217
|
-
export { composeAdvanceStyle, splitStyle };
|
|
261
|
+
export { composeAdvanceStyle, filterAttrInStyle, filterCornerInStyle, removeAttrInStyle, removePaddingYInStyle, splitStyle };
|
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, removeAttrInStyle, removePaddingYInStyle, 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';
|