@gem-sdk/core 2.0.0-dev.305 → 2.0.0-dev.324
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/ComponentToolbarPreview.js +4 -2
- package/dist/cjs/helpers/borders.js +64 -0
- package/dist/cjs/helpers/make-style.js +27 -4
- package/dist/cjs/helpers/typography.js +19 -1
- package/dist/cjs/index.js +8 -0
- package/dist/esm/components/ComponentToolbarPreview.js +4 -2
- package/dist/esm/helpers/borders.js +63 -1
- package/dist/esm/helpers/make-style.js +27 -5
- package/dist/esm/helpers/typography.js +19 -2
- package/dist/esm/index.js +5 -3
- package/dist/types/index.d.ts +11115 -10777
- package/package.json +3 -3
|
@@ -100,9 +100,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
const getSectionNumber = ()=>{
|
|
103
|
+
const getSectionNumber = react.useCallback(()=>{
|
|
104
104
|
return root?.childrens?.length || 0;
|
|
105
|
-
}
|
|
105
|
+
}, [
|
|
106
|
+
root?.childrens?.length
|
|
107
|
+
]);
|
|
106
108
|
const getDeleteTooltipPosition = react.useCallback(()=>{
|
|
107
109
|
if (props.tag == 'Section') return 'bottom';
|
|
108
110
|
const $toolbar = document.body.querySelector('#storefront')?.querySelector('[data-toolbar-active="true"]');
|
|
@@ -87,6 +87,34 @@ const handleConvertBorderWidth = (value, type)=>{
|
|
|
87
87
|
};
|
|
88
88
|
return makeStyle.makeStyleState('bw', newVal);
|
|
89
89
|
};
|
|
90
|
+
const getInputBorderWidth = (data, position)=>{
|
|
91
|
+
return {
|
|
92
|
+
desktop: {
|
|
93
|
+
normal: data.desktop?.normal?.width?.split(' ')?.[position],
|
|
94
|
+
hover: data.desktop?.hover?.width?.split(' ')?.[position]
|
|
95
|
+
},
|
|
96
|
+
tablet: {
|
|
97
|
+
normal: data.tablet?.normal?.width?.split(' ')?.[position],
|
|
98
|
+
hover: data.tablet?.hover?.width?.split(' ')?.[position]
|
|
99
|
+
},
|
|
100
|
+
mobile: {
|
|
101
|
+
normal: data.mobile?.normal?.width?.split(' ')?.[position],
|
|
102
|
+
hover: data.mobile?.hover?.width?.split(' ')?.[position]
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const handleConvertInputBorderWidth = (value, qtyStyle)=>{
|
|
107
|
+
if (!value) return undefined;
|
|
108
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
109
|
+
const data = value;
|
|
110
|
+
return {
|
|
111
|
+
...makeStyle.makeStyleResponsiveState('btw', getInputBorderWidth(data, 0)),
|
|
112
|
+
...makeStyle.makeStyleResponsiveState('bbw', getInputBorderWidth(data, 2)),
|
|
113
|
+
...qtyStyle === 'minimalist' ? makeStyle.makeStyleResponsiveState('brw', getInputBorderWidth(data, 1)) : {},
|
|
114
|
+
...qtyStyle === 'minimalist' ? makeStyle.makeStyleResponsiveState('blw', getInputBorderWidth(data, 3)) : {}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
90
118
|
const handleConvertBorderColor = (value)=>{
|
|
91
119
|
if (!value) return undefined;
|
|
92
120
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -118,6 +146,40 @@ const handleConvertBorderColor = (value)=>{
|
|
|
118
146
|
};
|
|
119
147
|
return colors.getGlobalColorStateStyle('bc', newVal);
|
|
120
148
|
};
|
|
149
|
+
const handleConvertInputBorderColor = (value)=>{
|
|
150
|
+
if (!value) return undefined;
|
|
151
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
152
|
+
const data = value;
|
|
153
|
+
const newVal = {
|
|
154
|
+
desktop: {
|
|
155
|
+
normal: data.desktop?.normal?.color,
|
|
156
|
+
hover: data.desktop?.hover?.color,
|
|
157
|
+
focus: data.desktop?.focus?.color
|
|
158
|
+
},
|
|
159
|
+
tablet: {
|
|
160
|
+
normal: data.tablet?.normal?.color,
|
|
161
|
+
hover: data.tablet?.hover?.color,
|
|
162
|
+
focus: data.tablet?.focus?.color
|
|
163
|
+
},
|
|
164
|
+
mobile: {
|
|
165
|
+
normal: data.mobile?.normal?.color,
|
|
166
|
+
hover: data.mobile?.hover?.color,
|
|
167
|
+
focus: data.mobile?.focus?.color
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
...colors.getGlobalColorStateResponsiveStyle('btc', newVal),
|
|
172
|
+
...colors.getGlobalColorStateResponsiveStyle('bbc', newVal)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const data = value;
|
|
176
|
+
const newVal = {
|
|
177
|
+
normal: data?.normal?.color,
|
|
178
|
+
hover: data?.hover?.color,
|
|
179
|
+
focus: data?.focus?.color
|
|
180
|
+
};
|
|
181
|
+
return colors.getGlobalColorStateStyle('bc', newVal);
|
|
182
|
+
};
|
|
121
183
|
const handleConvertClassColor = (value)=>{
|
|
122
184
|
if (!value) return undefined;
|
|
123
185
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -213,3 +275,5 @@ exports.handleConvertBorderStyle = handleConvertBorderStyle;
|
|
|
213
275
|
exports.handleConvertBorderWidth = handleConvertBorderWidth;
|
|
214
276
|
exports.handleConvertClassColor = handleConvertClassColor;
|
|
215
277
|
exports.handleConvertClassColorDynamicBtn = handleConvertClassColorDynamicBtn;
|
|
278
|
+
exports.handleConvertInputBorderColor = handleConvertInputBorderColor;
|
|
279
|
+
exports.handleConvertInputBorderWidth = handleConvertInputBorderWidth;
|
|
@@ -147,12 +147,34 @@ const makeLineClamp = (lineClampValue, hasLineClampValue)=>{
|
|
|
147
147
|
mobile: getVal('mobile', lineClampValue, hasLineClampValue)
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
|
+
const getResponsiveWidthValue = (key, value, unit)=>{
|
|
151
|
+
if (unit) return `${value?.[key]}${unit}`;
|
|
152
|
+
if (value?.[key] === 'default') return '1200px';
|
|
153
|
+
return value?.[key];
|
|
154
|
+
};
|
|
150
155
|
const makeStyleResponsiveWidth = (value, unit)=>{
|
|
151
|
-
const getResponsiveValue = (key)=>unit ? `${value?.[key]}${unit}` : value?.[key] === 'default' ? '1200px' : value?.[key];
|
|
152
156
|
return {
|
|
153
|
-
'--w':
|
|
154
|
-
'--w-tablet':
|
|
155
|
-
'--w-mobile':
|
|
157
|
+
'--w': getResponsiveWidthValue('desktop', value, unit),
|
|
158
|
+
'--w-tablet': getResponsiveWidthValue('tablet', value, unit),
|
|
159
|
+
'--w-mobile': getResponsiveWidthValue('mobile', value, unit)
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
const getResponsiveWidthValueWithoutAuto = (key, value, unit)=>{
|
|
163
|
+
if (unit) return `${value?.[key]}${unit}`;
|
|
164
|
+
switch(value?.[key]){
|
|
165
|
+
case 'default':
|
|
166
|
+
return '1200px';
|
|
167
|
+
case 'Auto':
|
|
168
|
+
return '100%';
|
|
169
|
+
default:
|
|
170
|
+
return value?.[key];
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const makeStyleResponsiveWidthWithoutAuto = (value, unit)=>{
|
|
174
|
+
return {
|
|
175
|
+
'--w': getResponsiveWidthValueWithoutAuto('desktop', value, unit),
|
|
176
|
+
'--w-tablet': getResponsiveWidthValueWithoutAuto('tablet', value, unit),
|
|
177
|
+
'--w-mobile': getResponsiveWidthValueWithoutAuto('mobile', value, unit)
|
|
156
178
|
};
|
|
157
179
|
};
|
|
158
180
|
|
|
@@ -167,6 +189,7 @@ exports.makeStyleResponsive = makeStyleResponsive;
|
|
|
167
189
|
exports.makeStyleResponsiveByScreen = makeStyleResponsiveByScreen;
|
|
168
190
|
exports.makeStyleResponsiveState = makeStyleResponsiveState;
|
|
169
191
|
exports.makeStyleResponsiveWidth = makeStyleResponsiveWidth;
|
|
192
|
+
exports.makeStyleResponsiveWidthWithoutAuto = makeStyleResponsiveWidthWithoutAuto;
|
|
170
193
|
exports.makeStyleState = makeStyleState;
|
|
171
194
|
exports.makeWidth = makeWidth;
|
|
172
195
|
exports.removeNullUndefined = removeNullUndefined;
|
|
@@ -22,7 +22,7 @@ const composeTypographyCss = (typography)=>{
|
|
|
22
22
|
};
|
|
23
23
|
const composeTypographyV2Css = (typography, isImportant)=>{
|
|
24
24
|
const typographyCustom = typography?.custom;
|
|
25
|
-
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
|
|
25
|
+
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, textShadow } = typographyCustom ?? {};
|
|
26
26
|
const typographyAttrs = typography?.attrs;
|
|
27
27
|
const { bold, italic, underline, transform, color } = typographyAttrs ?? {};
|
|
28
28
|
const composeImportant = isImportant ? '!important' : '';
|
|
@@ -39,8 +39,20 @@ const composeTypographyV2Css = (typography, isImportant)=>{
|
|
|
39
39
|
${italic ? `font-style: italic ${composeImportant}` : ''};
|
|
40
40
|
${underline ? `text-decoration-line: underline ${composeImportant}` : ''};
|
|
41
41
|
${transform ? `text-transform: ${transform} ${composeImportant}` : ''};
|
|
42
|
+
${textShadow && textShadow.type !== 'none' ? `text-shadow: ${composeTextShadowCss(textShadow)}` : 'none'};
|
|
42
43
|
`;
|
|
43
44
|
};
|
|
45
|
+
const composeTextShadowCss = (textShadow)=>{
|
|
46
|
+
const angle = typeof textShadow?.angle === 'number' ? textShadow?.angle : 0;
|
|
47
|
+
const angleInRadians = angle * Math.PI / 180;
|
|
48
|
+
const distance = parseFloat(textShadow?.distance ?? '0');
|
|
49
|
+
if (isNaN(distance)) {
|
|
50
|
+
return 'none';
|
|
51
|
+
}
|
|
52
|
+
const xOffset = Math.round(Math.cos(angleInRadians) * distance * 100) / 100;
|
|
53
|
+
const yOffset = Math.round(Math.sin(angleInRadians) * distance * 100) / 100;
|
|
54
|
+
return `${xOffset}px ${yOffset}px ${textShadow?.blur ?? '0'} ${textShadow.color}`;
|
|
55
|
+
};
|
|
44
56
|
const composeTextHoverColorCss = (device, colorHoverConfig, isImportant)=>{
|
|
45
57
|
if (colorHoverConfig) {
|
|
46
58
|
const composeImportant = isImportant ? '!important' : '';
|
|
@@ -155,10 +167,16 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
155
167
|
const isCustomTypo = (customTypo)=>{
|
|
156
168
|
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
157
169
|
};
|
|
170
|
+
const composeTypoHover = (attrs)=>{
|
|
171
|
+
return {
|
|
172
|
+
'--hvr-c': colors.getSingleColorVariable(attrs?.color) || ''
|
|
173
|
+
};
|
|
174
|
+
};
|
|
158
175
|
|
|
159
176
|
exports.composeFallbackTypographyStyle = composeFallbackTypographyStyle;
|
|
160
177
|
exports.composeFontFamilyTypographyV2 = composeFontFamilyTypographyV2;
|
|
161
178
|
exports.composeTextHoverColorCss = composeTextHoverColorCss;
|
|
179
|
+
exports.composeTypoHover = composeTypoHover;
|
|
162
180
|
exports.composeTypography = composeTypography;
|
|
163
181
|
exports.composeTypographyAttr = composeTypographyAttr;
|
|
164
182
|
exports.composeTypographyClassName = composeTypographyClassName;
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,6 +28,8 @@ var storeProperty_generated = require('./graphql/queries/store-property.generate
|
|
|
28
28
|
var previewPage_generated = require('./graphql/queries/preview-page.generated.js');
|
|
29
29
|
var publishedShopMetas_generated = require('./graphql/queries/published-shop-metas.generated.js');
|
|
30
30
|
var shopShopify_generated = require('./graphql/queries/shop-shopify.generated.js');
|
|
31
|
+
var articles_generated = require('./graphql/queries/articles.generated.js');
|
|
32
|
+
var blogs_generated = require('./graphql/queries/blogs.generated.js');
|
|
31
33
|
var LibraryTemplate_generated = require('./graphql-app-api/queries/LibraryTemplate.generated.js');
|
|
32
34
|
var ThemePage_generated = require('./graphql-app-api/queries/ThemePage.generated.js');
|
|
33
35
|
var SaleFunnelDiscounts_generated = require('./graphql-app-api/queries/SaleFunnelDiscounts.generated.js');
|
|
@@ -167,6 +169,8 @@ exports.StorePropertyDocument = storeProperty_generated.StorePropertyDocument;
|
|
|
167
169
|
exports.PreviewThemePageDocument = previewPage_generated.PreviewThemePageDocument;
|
|
168
170
|
exports.PublishedShopMetasDocument = publishedShopMetas_generated.PublishedShopMetasDocument;
|
|
169
171
|
exports.ShopShopifyDocument = shopShopify_generated.ShopShopifyDocument;
|
|
172
|
+
exports.ArticlesDocument = articles_generated.ArticlesDocument;
|
|
173
|
+
exports.BlogsDocument = blogs_generated.BlogsDocument;
|
|
170
174
|
exports.LibraryTemplateDocument = LibraryTemplate_generated.LibraryTemplateDocument;
|
|
171
175
|
exports.ThemePageDocument = ThemePage_generated.ThemePageDocument;
|
|
172
176
|
exports.SaleFunnelDiscountsDocument = SaleFunnelDiscounts_generated.SaleFunnelDiscountsDocument;
|
|
@@ -182,6 +186,8 @@ exports.handleConvertBorderStyle = borders.handleConvertBorderStyle;
|
|
|
182
186
|
exports.handleConvertBorderWidth = borders.handleConvertBorderWidth;
|
|
183
187
|
exports.handleConvertClassColor = borders.handleConvertClassColor;
|
|
184
188
|
exports.handleConvertClassColorDynamicBtn = borders.handleConvertClassColorDynamicBtn;
|
|
189
|
+
exports.handleConvertInputBorderColor = borders.handleConvertInputBorderColor;
|
|
190
|
+
exports.handleConvertInputBorderWidth = borders.handleConvertInputBorderWidth;
|
|
185
191
|
exports.getCarouselContainerHeight = carousel.getCarouselContainerHeight;
|
|
186
192
|
exports.makeContainerWidthOrHeight = carousel.makeContainerWidthOrHeight;
|
|
187
193
|
exports.makeDotGapToCarouselStyle = carousel.makeDotGapToCarouselStyle;
|
|
@@ -264,6 +270,7 @@ exports.makeStyleResponsive = makeStyle.makeStyleResponsive;
|
|
|
264
270
|
exports.makeStyleResponsiveByScreen = makeStyle.makeStyleResponsiveByScreen;
|
|
265
271
|
exports.makeStyleResponsiveState = makeStyle.makeStyleResponsiveState;
|
|
266
272
|
exports.makeStyleResponsiveWidth = makeStyle.makeStyleResponsiveWidth;
|
|
273
|
+
exports.makeStyleResponsiveWidthWithoutAuto = makeStyle.makeStyleResponsiveWidthWithoutAuto;
|
|
267
274
|
exports.makeStyleState = makeStyle.makeStyleState;
|
|
268
275
|
exports.makeWidth = makeStyle.makeWidth;
|
|
269
276
|
exports.removeNullUndefined = makeStyle.removeNullUndefined;
|
|
@@ -316,6 +323,7 @@ exports.makeStyleWithDefault = size.makeStyleWithDefault;
|
|
|
316
323
|
exports.composeFallbackTypographyStyle = typography.composeFallbackTypographyStyle;
|
|
317
324
|
exports.composeFontFamilyTypographyV2 = typography.composeFontFamilyTypographyV2;
|
|
318
325
|
exports.composeTextHoverColorCss = typography.composeTextHoverColorCss;
|
|
326
|
+
exports.composeTypoHover = typography.composeTypoHover;
|
|
319
327
|
exports.composeTypography = typography.composeTypography;
|
|
320
328
|
exports.composeTypographyAttr = typography.composeTypographyAttr;
|
|
321
329
|
exports.composeTypographyClassName = typography.composeTypographyClassName;
|
|
@@ -96,9 +96,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
const getSectionNumber = ()=>{
|
|
99
|
+
const getSectionNumber = useCallback(()=>{
|
|
100
100
|
return root?.childrens?.length || 0;
|
|
101
|
-
}
|
|
101
|
+
}, [
|
|
102
|
+
root?.childrens?.length
|
|
103
|
+
]);
|
|
102
104
|
const getDeleteTooltipPosition = useCallback(()=>{
|
|
103
105
|
if (props.tag == 'Section') return 'bottom';
|
|
104
106
|
const $toolbar = document.body.querySelector('#storefront')?.querySelector('[data-toolbar-active="true"]');
|
|
@@ -85,6 +85,34 @@ const handleConvertBorderWidth = (value, type)=>{
|
|
|
85
85
|
};
|
|
86
86
|
return makeStyleState('bw', newVal);
|
|
87
87
|
};
|
|
88
|
+
const getInputBorderWidth = (data, position)=>{
|
|
89
|
+
return {
|
|
90
|
+
desktop: {
|
|
91
|
+
normal: data.desktop?.normal?.width?.split(' ')?.[position],
|
|
92
|
+
hover: data.desktop?.hover?.width?.split(' ')?.[position]
|
|
93
|
+
},
|
|
94
|
+
tablet: {
|
|
95
|
+
normal: data.tablet?.normal?.width?.split(' ')?.[position],
|
|
96
|
+
hover: data.tablet?.hover?.width?.split(' ')?.[position]
|
|
97
|
+
},
|
|
98
|
+
mobile: {
|
|
99
|
+
normal: data.mobile?.normal?.width?.split(' ')?.[position],
|
|
100
|
+
hover: data.mobile?.hover?.width?.split(' ')?.[position]
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const handleConvertInputBorderWidth = (value, qtyStyle)=>{
|
|
105
|
+
if (!value) return undefined;
|
|
106
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
107
|
+
const data = value;
|
|
108
|
+
return {
|
|
109
|
+
...makeStyleResponsiveState('btw', getInputBorderWidth(data, 0)),
|
|
110
|
+
...makeStyleResponsiveState('bbw', getInputBorderWidth(data, 2)),
|
|
111
|
+
...qtyStyle === 'minimalist' ? makeStyleResponsiveState('brw', getInputBorderWidth(data, 1)) : {},
|
|
112
|
+
...qtyStyle === 'minimalist' ? makeStyleResponsiveState('blw', getInputBorderWidth(data, 3)) : {}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
88
116
|
const handleConvertBorderColor = (value)=>{
|
|
89
117
|
if (!value) return undefined;
|
|
90
118
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -116,6 +144,40 @@ const handleConvertBorderColor = (value)=>{
|
|
|
116
144
|
};
|
|
117
145
|
return getGlobalColorStateStyle('bc', newVal);
|
|
118
146
|
};
|
|
147
|
+
const handleConvertInputBorderColor = (value)=>{
|
|
148
|
+
if (!value) return undefined;
|
|
149
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
150
|
+
const data = value;
|
|
151
|
+
const newVal = {
|
|
152
|
+
desktop: {
|
|
153
|
+
normal: data.desktop?.normal?.color,
|
|
154
|
+
hover: data.desktop?.hover?.color,
|
|
155
|
+
focus: data.desktop?.focus?.color
|
|
156
|
+
},
|
|
157
|
+
tablet: {
|
|
158
|
+
normal: data.tablet?.normal?.color,
|
|
159
|
+
hover: data.tablet?.hover?.color,
|
|
160
|
+
focus: data.tablet?.focus?.color
|
|
161
|
+
},
|
|
162
|
+
mobile: {
|
|
163
|
+
normal: data.mobile?.normal?.color,
|
|
164
|
+
hover: data.mobile?.hover?.color,
|
|
165
|
+
focus: data.mobile?.focus?.color
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
...getGlobalColorStateResponsiveStyle('btc', newVal),
|
|
170
|
+
...getGlobalColorStateResponsiveStyle('bbc', newVal)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const data = value;
|
|
174
|
+
const newVal = {
|
|
175
|
+
normal: data?.normal?.color,
|
|
176
|
+
hover: data?.hover?.color,
|
|
177
|
+
focus: data?.focus?.color
|
|
178
|
+
};
|
|
179
|
+
return getGlobalColorStateStyle('bc', newVal);
|
|
180
|
+
};
|
|
119
181
|
const handleConvertClassColor = (value)=>{
|
|
120
182
|
if (!value) return undefined;
|
|
121
183
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -202,4 +264,4 @@ const composeBorderDevice = (value, device)=>{
|
|
|
202
264
|
};
|
|
203
265
|
};
|
|
204
266
|
|
|
205
|
-
export { composeBorderCss, composeBorderResponsive, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn };
|
|
267
|
+
export { composeBorderCss, composeBorderResponsive, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, handleConvertInputBorderColor, handleConvertInputBorderWidth };
|
|
@@ -145,13 +145,35 @@ const makeLineClamp = (lineClampValue, hasLineClampValue)=>{
|
|
|
145
145
|
mobile: getVal('mobile', lineClampValue, hasLineClampValue)
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
+
const getResponsiveWidthValue = (key, value, unit)=>{
|
|
149
|
+
if (unit) return `${value?.[key]}${unit}`;
|
|
150
|
+
if (value?.[key] === 'default') return '1200px';
|
|
151
|
+
return value?.[key];
|
|
152
|
+
};
|
|
148
153
|
const makeStyleResponsiveWidth = (value, unit)=>{
|
|
149
|
-
const getResponsiveValue = (key)=>unit ? `${value?.[key]}${unit}` : value?.[key] === 'default' ? '1200px' : value?.[key];
|
|
150
154
|
return {
|
|
151
|
-
'--w':
|
|
152
|
-
'--w-tablet':
|
|
153
|
-
'--w-mobile':
|
|
155
|
+
'--w': getResponsiveWidthValue('desktop', value, unit),
|
|
156
|
+
'--w-tablet': getResponsiveWidthValue('tablet', value, unit),
|
|
157
|
+
'--w-mobile': getResponsiveWidthValue('mobile', value, unit)
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
const getResponsiveWidthValueWithoutAuto = (key, value, unit)=>{
|
|
161
|
+
if (unit) return `${value?.[key]}${unit}`;
|
|
162
|
+
switch(value?.[key]){
|
|
163
|
+
case 'default':
|
|
164
|
+
return '1200px';
|
|
165
|
+
case 'Auto':
|
|
166
|
+
return '100%';
|
|
167
|
+
default:
|
|
168
|
+
return value?.[key];
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const makeStyleResponsiveWidthWithoutAuto = (value, unit)=>{
|
|
172
|
+
return {
|
|
173
|
+
'--w': getResponsiveWidthValueWithoutAuto('desktop', value, unit),
|
|
174
|
+
'--w-tablet': getResponsiveWidthValueWithoutAuto('tablet', value, unit),
|
|
175
|
+
'--w-mobile': getResponsiveWidthValueWithoutAuto('mobile', value, unit)
|
|
154
176
|
};
|
|
155
177
|
};
|
|
156
178
|
|
|
157
|
-
export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleResponsiveWidth, makeStyleState, makeWidth, removeNullUndefined };
|
|
179
|
+
export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleResponsiveWidth, makeStyleResponsiveWidthWithoutAuto, makeStyleState, makeWidth, removeNullUndefined };
|
|
@@ -20,7 +20,7 @@ const composeTypographyCss = (typography)=>{
|
|
|
20
20
|
};
|
|
21
21
|
const composeTypographyV2Css = (typography, isImportant)=>{
|
|
22
22
|
const typographyCustom = typography?.custom;
|
|
23
|
-
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
|
|
23
|
+
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, textShadow } = typographyCustom ?? {};
|
|
24
24
|
const typographyAttrs = typography?.attrs;
|
|
25
25
|
const { bold, italic, underline, transform, color } = typographyAttrs ?? {};
|
|
26
26
|
const composeImportant = isImportant ? '!important' : '';
|
|
@@ -37,8 +37,20 @@ const composeTypographyV2Css = (typography, isImportant)=>{
|
|
|
37
37
|
${italic ? `font-style: italic ${composeImportant}` : ''};
|
|
38
38
|
${underline ? `text-decoration-line: underline ${composeImportant}` : ''};
|
|
39
39
|
${transform ? `text-transform: ${transform} ${composeImportant}` : ''};
|
|
40
|
+
${textShadow && textShadow.type !== 'none' ? `text-shadow: ${composeTextShadowCss(textShadow)}` : 'none'};
|
|
40
41
|
`;
|
|
41
42
|
};
|
|
43
|
+
const composeTextShadowCss = (textShadow)=>{
|
|
44
|
+
const angle = typeof textShadow?.angle === 'number' ? textShadow?.angle : 0;
|
|
45
|
+
const angleInRadians = angle * Math.PI / 180;
|
|
46
|
+
const distance = parseFloat(textShadow?.distance ?? '0');
|
|
47
|
+
if (isNaN(distance)) {
|
|
48
|
+
return 'none';
|
|
49
|
+
}
|
|
50
|
+
const xOffset = Math.round(Math.cos(angleInRadians) * distance * 100) / 100;
|
|
51
|
+
const yOffset = Math.round(Math.sin(angleInRadians) * distance * 100) / 100;
|
|
52
|
+
return `${xOffset}px ${yOffset}px ${textShadow?.blur ?? '0'} ${textShadow.color}`;
|
|
53
|
+
};
|
|
42
54
|
const composeTextHoverColorCss = (device, colorHoverConfig, isImportant)=>{
|
|
43
55
|
if (colorHoverConfig) {
|
|
44
56
|
const composeImportant = isImportant ? '!important' : '';
|
|
@@ -153,5 +165,10 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
153
165
|
const isCustomTypo = (customTypo)=>{
|
|
154
166
|
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
155
167
|
};
|
|
168
|
+
const composeTypoHover = (attrs)=>{
|
|
169
|
+
return {
|
|
170
|
+
'--hvr-c': getSingleColorVariable(attrs?.color) || ''
|
|
171
|
+
};
|
|
172
|
+
};
|
|
156
173
|
|
|
157
|
-
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTextHoverColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass };
|
|
174
|
+
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTextHoverColorCss, composeTypoHover, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass };
|
package/dist/esm/index.js
CHANGED
|
@@ -26,13 +26,15 @@ export { StorePropertyDocument } from './graphql/queries/store-property.generate
|
|
|
26
26
|
export { PreviewThemePageDocument } from './graphql/queries/preview-page.generated.js';
|
|
27
27
|
export { PublishedShopMetasDocument } from './graphql/queries/published-shop-metas.generated.js';
|
|
28
28
|
export { ShopShopifyDocument } from './graphql/queries/shop-shopify.generated.js';
|
|
29
|
+
export { ArticlesDocument } from './graphql/queries/articles.generated.js';
|
|
30
|
+
export { BlogsDocument } from './graphql/queries/blogs.generated.js';
|
|
29
31
|
export { LibraryTemplateDocument } from './graphql-app-api/queries/LibraryTemplate.generated.js';
|
|
30
32
|
export { ThemePageDocument } from './graphql-app-api/queries/ThemePage.generated.js';
|
|
31
33
|
export { SaleFunnelDiscountsDocument } from './graphql-app-api/queries/SaleFunnelDiscounts.generated.js';
|
|
32
34
|
export { LibrarySaleFunnelDocument } from './graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js';
|
|
33
35
|
export { ShopLibraryPageDocument } from './graphql-app-api/queries/ShopLibraryPage.generated.js';
|
|
34
36
|
export { SaleFunnelOfferDocument } from './graphql-app-api/queries/SaleFunnelOffer.generated.js';
|
|
35
|
-
export { composeBorderCss, composeBorderResponsive, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn } from './helpers/borders.js';
|
|
37
|
+
export { composeBorderCss, composeBorderResponsive, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, handleConvertInputBorderColor, handleConvertInputBorderWidth } from './helpers/borders.js';
|
|
36
38
|
export { getCarouselContainerHeight, makeContainerWidthOrHeight, makeDotGapToCarouselStyle } from './helpers/carousel.js';
|
|
37
39
|
export { cls } from './helpers/cls.js';
|
|
38
40
|
export { animations } from './helpers/animations.js';
|
|
@@ -66,7 +68,7 @@ export { convertHTML } from './helpers/covert-entities-html.js';
|
|
|
66
68
|
export { composePositionLineHeight, composePostionIconList } from './helpers/icon-list.js';
|
|
67
69
|
export { isDefined } from './helpers/is-defined.js';
|
|
68
70
|
export { composeGridLayout, convertOldLayout, getLayoutClasses, gridToArrayRegex, optionLayoutStyle } from './helpers/layout.js';
|
|
69
|
-
export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleResponsiveWidth, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
|
|
71
|
+
export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleResponsiveWidth, makeStyleResponsiveWidthWithoutAuto, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
|
|
70
72
|
export { convertTextAlignToJustify, getAlignmentClasses } from './helpers/align.js';
|
|
71
73
|
export { filterTruthyStyles } from './helpers/filter-truthy-styles.js';
|
|
72
74
|
export { checkInStock } from './helpers/variant.js';
|
|
@@ -76,7 +78,7 @@ export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSF
|
|
|
76
78
|
export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, styles, template } from './helpers/render.js';
|
|
77
79
|
export { composeShadow, composeShadowCss, getResponsiveStyleShadow, getResponsiveStyleShadowWithoutState, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
78
80
|
export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, getGlobalSizeGap, getHeightByShapeGlobalSize, getPaddingGlobalSize, getPaddingStyleByDevice, getResponsiveStylePadding, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeGlobalSizeIcon, makeStyleWithDefault } from './helpers/size.js';
|
|
79
|
-
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTextHoverColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
|
|
81
|
+
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTextHoverColorCss, composeTypoHover, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
|
|
80
82
|
export { useArticlesQuery, useBlogsQuery } from './hooks/articles/useArticlesQuery.js';
|
|
81
83
|
export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
|
|
82
84
|
export { useCartData } from './hooks/cart/use-cart-data.js';
|