@gem-sdk/core 1.9.15 → 1.9.17
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/helpers/borders.js +44 -0
- package/dist/cjs/helpers/colors.js +44 -0
- package/dist/cjs/helpers/radius.js +29 -0
- package/dist/cjs/helpers/shadow.js +1 -0
- package/dist/cjs/helpers/typography.js +13 -0
- package/dist/cjs/index.js +7 -0
- package/dist/esm/helpers/borders.js +44 -2
- package/dist/esm/helpers/colors.js +42 -1
- package/dist/esm/helpers/radius.js +29 -1
- package/dist/esm/helpers/shadow.js +1 -1
- package/dist/esm/helpers/typography.js +13 -1
- package/dist/esm/index.js +4 -4
- package/dist/types/index.d.ts +9 -1
- package/package.json +1 -1
|
@@ -134,9 +134,53 @@ const handleConvertClassColor = (value)=>{
|
|
|
134
134
|
};
|
|
135
135
|
return colors.getGlobalColorStateClass('border', newVal);
|
|
136
136
|
};
|
|
137
|
+
const handleConvertClassColorDynamicBtn = (value)=>{
|
|
138
|
+
if (!value) return undefined;
|
|
139
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
140
|
+
const data = value;
|
|
141
|
+
const newVal = {
|
|
142
|
+
desktop: {
|
|
143
|
+
normal: data.desktop?.normal?.color,
|
|
144
|
+
hover: data.desktop?.hover?.color,
|
|
145
|
+
focus: data.desktop?.focus?.color
|
|
146
|
+
},
|
|
147
|
+
tablet: {
|
|
148
|
+
normal: data.tablet?.normal?.color,
|
|
149
|
+
hover: data.tablet?.hover?.color,
|
|
150
|
+
focus: data.tablet?.focus?.color
|
|
151
|
+
},
|
|
152
|
+
mobile: {
|
|
153
|
+
normal: data.mobile?.normal?.color,
|
|
154
|
+
hover: data.mobile?.hover?.color,
|
|
155
|
+
focus: data.mobile?.focus?.color
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return colors.getGlobalColorStateResponsiveClassDynamicBtn('border', newVal);
|
|
159
|
+
}
|
|
160
|
+
const data = value;
|
|
161
|
+
const newVal = {
|
|
162
|
+
normal: data?.normal?.color,
|
|
163
|
+
hover: data?.hover?.color,
|
|
164
|
+
focus: data?.focus?.color
|
|
165
|
+
};
|
|
166
|
+
return colors.getGlobalColorStateClassDynamicBtn('border', newVal);
|
|
167
|
+
};
|
|
168
|
+
const composeBorderCss = (borderV)=>{
|
|
169
|
+
if (!borderV) return '';
|
|
170
|
+
const { border , width , color , isCustom } = borderV;
|
|
171
|
+
if (isCustom) {
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
return `${border ? `border-style: ${border};` : ''}
|
|
175
|
+
${width ? `border-width: ${width};` : undefined}
|
|
176
|
+
${color ? `border-color: ${colors.getSingleColorVariable(color)};` : undefined}
|
|
177
|
+
`;
|
|
178
|
+
};
|
|
137
179
|
|
|
180
|
+
exports.composeBorderCss = composeBorderCss;
|
|
138
181
|
exports.getBorderStyle = getBorderStyle;
|
|
139
182
|
exports.handleConvertBorderColor = handleConvertBorderColor;
|
|
140
183
|
exports.handleConvertBorderStyle = handleConvertBorderStyle;
|
|
141
184
|
exports.handleConvertBorderWidth = handleConvertBorderWidth;
|
|
142
185
|
exports.handleConvertClassColor = handleConvertClassColor;
|
|
186
|
+
exports.handleConvertClassColorDynamicBtn = handleConvertClassColorDynamicBtn;
|
|
@@ -34,6 +34,18 @@ const getGlobalColorStateClass = (type, data)=>{
|
|
|
34
34
|
}
|
|
35
35
|
}).filter(isDefined.isDefined).join(' ');
|
|
36
36
|
};
|
|
37
|
+
const getGlobalColorStateClassDynamicBtn = (type, data)=>{
|
|
38
|
+
if (!data) return '';
|
|
39
|
+
return Object.entries(data).map(([state, value])=>{
|
|
40
|
+
const clName = getGlobalColorClass(type, value);
|
|
41
|
+
if (!clName) return undefined;
|
|
42
|
+
if (state === 'normal') {
|
|
43
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${clName}`;
|
|
44
|
+
} else {
|
|
45
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${state}:${clName}`;
|
|
46
|
+
}
|
|
47
|
+
}).filter(isDefined.isDefined).join(' ');
|
|
48
|
+
};
|
|
37
49
|
const getGlobalColorStateResponsiveClass = (type, data)=>{
|
|
38
50
|
if (!data) return '';
|
|
39
51
|
return Object.entries(data).map(([device, objectState])=>{
|
|
@@ -60,6 +72,32 @@ const getGlobalColorStateResponsiveClass = (type, data)=>{
|
|
|
60
72
|
}
|
|
61
73
|
}).filter(Boolean).join(' ');
|
|
62
74
|
};
|
|
75
|
+
const getGlobalColorStateResponsiveClassDynamicBtn = (type, data)=>{
|
|
76
|
+
if (!data) return '';
|
|
77
|
+
return Object.entries(data).map(([device, objectState])=>{
|
|
78
|
+
if (device === 'desktop') {
|
|
79
|
+
return Object.entries(objectState).map(([state, value])=>{
|
|
80
|
+
const clName = getGlobalColorClass(type, value);
|
|
81
|
+
if (!clName) return undefined;
|
|
82
|
+
if (state === 'normal') {
|
|
83
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${clName}`;
|
|
84
|
+
} else {
|
|
85
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${state}:${clName}`;
|
|
86
|
+
}
|
|
87
|
+
}).filter(isDefined.isDefined).join(' ');
|
|
88
|
+
} else {
|
|
89
|
+
return Object.entries(objectState).map(([state, value])=>{
|
|
90
|
+
const clName = getGlobalColorClass(type, value);
|
|
91
|
+
if (!clName) return undefined;
|
|
92
|
+
if (state === 'normal') {
|
|
93
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${device}:${clName}`;
|
|
94
|
+
} else {
|
|
95
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${device}:${state}:${clName}`;
|
|
96
|
+
}
|
|
97
|
+
}).filter(isDefined.isDefined).join(' ');
|
|
98
|
+
}
|
|
99
|
+
}).filter(Boolean).join(' ');
|
|
100
|
+
};
|
|
63
101
|
const getGlobalColorResponsiveStyle = (type, data)=>{
|
|
64
102
|
if (!data) return {};
|
|
65
103
|
return Object.fromEntries(Object.entries(data).map(([device, value])=>{
|
|
@@ -125,13 +163,19 @@ const getGlobalColorStyle = (data)=>{
|
|
|
125
163
|
'--c': getSingleColorVariable(data)
|
|
126
164
|
};
|
|
127
165
|
};
|
|
166
|
+
const composeTextColorCss = (color)=>{
|
|
167
|
+
return `${color ? `color: ${getSingleColorVariable(color)} !important;` : ''}`;
|
|
168
|
+
};
|
|
128
169
|
|
|
170
|
+
exports.composeTextColorCss = composeTextColorCss;
|
|
129
171
|
exports.getGlobalColorCSSProp = getGlobalColorCSSProp;
|
|
130
172
|
exports.getGlobalColorClass = getGlobalColorClass;
|
|
131
173
|
exports.getGlobalColorResponsiveClass = getGlobalColorResponsiveClass;
|
|
132
174
|
exports.getGlobalColorResponsiveStyle = getGlobalColorResponsiveStyle;
|
|
133
175
|
exports.getGlobalColorStateClass = getGlobalColorStateClass;
|
|
176
|
+
exports.getGlobalColorStateClassDynamicBtn = getGlobalColorStateClassDynamicBtn;
|
|
134
177
|
exports.getGlobalColorStateResponsiveClass = getGlobalColorStateResponsiveClass;
|
|
178
|
+
exports.getGlobalColorStateResponsiveClassDynamicBtn = getGlobalColorStateResponsiveClassDynamicBtn;
|
|
135
179
|
exports.getGlobalColorStateResponsiveStyle = getGlobalColorStateResponsiveStyle;
|
|
136
180
|
exports.getGlobalColorStateStyle = getGlobalColorStateStyle;
|
|
137
181
|
exports.getGlobalColorStyle = getGlobalColorStyle;
|
|
@@ -97,7 +97,36 @@ const getRadiusStyleActiveState = (radiusValue)=>{
|
|
|
97
97
|
}
|
|
98
98
|
return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
|
|
99
99
|
};
|
|
100
|
+
const composeCornerCss = (value)=>{
|
|
101
|
+
if (!value) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const { radiusType , bblr , bbrr , btlr , btrr } = value;
|
|
105
|
+
let radiusValue = undefined;
|
|
106
|
+
switch(radiusType){
|
|
107
|
+
case 'medium':
|
|
108
|
+
case 'large':
|
|
109
|
+
case 'small':
|
|
110
|
+
radiusValue = `border-radius: var(--g-radius-${radiusType});`;
|
|
111
|
+
break;
|
|
112
|
+
case 'circle':
|
|
113
|
+
case 'none':
|
|
114
|
+
case 'custom':
|
|
115
|
+
radiusValue = `
|
|
116
|
+
${bblr ? `border-bottom-left-radius: ${bblr};` : ''}
|
|
117
|
+
|
|
118
|
+
${bbrr ? `border-bottom-right-radius: ${bbrr};` : ''}
|
|
119
|
+
|
|
120
|
+
${btlr ? `border-top-left-radius: ${btlr};` : ''}
|
|
121
|
+
|
|
122
|
+
${btrr ? `border-top-right-radius: ${btrr};` : ''}
|
|
123
|
+
`;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return radiusValue;
|
|
127
|
+
};
|
|
100
128
|
|
|
129
|
+
exports.composeCornerCss = composeCornerCss;
|
|
101
130
|
exports.composeRadius = composeRadius;
|
|
102
131
|
exports.getCornerCSSFromGlobal = getCornerCSSFromGlobal;
|
|
103
132
|
exports.getCustomRadius = getCustomRadius;
|
|
@@ -3,5 +3,18 @@
|
|
|
3
3
|
const genTypoClass = (name)=>{
|
|
4
4
|
return `g-${name}`;
|
|
5
5
|
};
|
|
6
|
+
const composeTypographyCss = (typography)=>{
|
|
7
|
+
const typographyCustom = typography?.custom;
|
|
8
|
+
const { fontFamily , fontSize , fontStyle , fontWeight , lineHeight , letterSpacing } = typographyCustom?.desktop ?? {};
|
|
9
|
+
return `
|
|
10
|
+
${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily});` : ''}
|
|
11
|
+
${fontSize ? `font-size: ${fontSize};` : ''}
|
|
12
|
+
${fontStyle ? `font-style: ${fontStyle};` : ''}
|
|
13
|
+
${fontWeight ? `font-weight: ${fontWeight};` : ''}
|
|
14
|
+
${letterSpacing ? `letter-spacing: ${letterSpacing};` : ''}
|
|
15
|
+
${lineHeight ? `line-height: ${lineHeight};` : ''}
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
6
18
|
|
|
19
|
+
exports.composeTypographyCss = composeTypographyCss;
|
|
7
20
|
exports.genTypoClass = genTypoClass;
|
package/dist/cjs/index.js
CHANGED
|
@@ -125,11 +125,13 @@ exports.PublishedThemePagesDocument = publishedThemePages_generated.PublishedThe
|
|
|
125
125
|
exports.ProductsDocument = products_generated.ProductsDocument;
|
|
126
126
|
exports.StorePropertyDocument = storeProperty_generated.StorePropertyDocument;
|
|
127
127
|
exports.PreviewPageDocument = previewPage_generated.PreviewPageDocument;
|
|
128
|
+
exports.composeBorderCss = borders.composeBorderCss;
|
|
128
129
|
exports.getBorderStyle = borders.getBorderStyle;
|
|
129
130
|
exports.handleConvertBorderColor = borders.handleConvertBorderColor;
|
|
130
131
|
exports.handleConvertBorderStyle = borders.handleConvertBorderStyle;
|
|
131
132
|
exports.handleConvertBorderWidth = borders.handleConvertBorderWidth;
|
|
132
133
|
exports.handleConvertClassColor = borders.handleConvertClassColor;
|
|
134
|
+
exports.handleConvertClassColorDynamicBtn = borders.handleConvertClassColorDynamicBtn;
|
|
133
135
|
exports.cls = cls.cls;
|
|
134
136
|
exports.composeAdvanceStyle = composeAdvanceStyle.composeAdvanceStyle;
|
|
135
137
|
exports.flattenConnection = flattenConnection.flattenConnection;
|
|
@@ -163,18 +165,23 @@ exports.convertOldLayout = layout.convertOldLayout;
|
|
|
163
165
|
exports.gridToArrayRegex = layout.gridToArrayRegex;
|
|
164
166
|
exports.optionLayoutStyle = layout.optionLayoutStyle;
|
|
165
167
|
exports.isDefined = isDefined.isDefined;
|
|
168
|
+
exports.composeTextColorCss = colors.composeTextColorCss;
|
|
166
169
|
exports.getGlobalColorCSSProp = colors.getGlobalColorCSSProp;
|
|
167
170
|
exports.getGlobalColorClass = colors.getGlobalColorClass;
|
|
168
171
|
exports.getGlobalColorResponsiveClass = colors.getGlobalColorResponsiveClass;
|
|
169
172
|
exports.getGlobalColorResponsiveStyle = colors.getGlobalColorResponsiveStyle;
|
|
170
173
|
exports.getGlobalColorStateClass = colors.getGlobalColorStateClass;
|
|
174
|
+
exports.getGlobalColorStateClassDynamicBtn = colors.getGlobalColorStateClassDynamicBtn;
|
|
171
175
|
exports.getGlobalColorStateResponsiveClass = colors.getGlobalColorStateResponsiveClass;
|
|
176
|
+
exports.getGlobalColorStateResponsiveClassDynamicBtn = colors.getGlobalColorStateResponsiveClassDynamicBtn;
|
|
172
177
|
exports.getGlobalColorStateResponsiveStyle = colors.getGlobalColorStateResponsiveStyle;
|
|
173
178
|
exports.getGlobalColorStateStyle = colors.getGlobalColorStateStyle;
|
|
174
179
|
exports.getGlobalColorStyle = colors.getGlobalColorStyle;
|
|
175
180
|
exports.getSingleColorVariable = colors.getSingleColorVariable;
|
|
176
181
|
exports.isColor = colors.isColor;
|
|
182
|
+
exports.composeTypographyCss = typography.composeTypographyCss;
|
|
177
183
|
exports.genTypoClass = typography.genTypoClass;
|
|
184
|
+
exports.composeCornerCss = radius.composeCornerCss;
|
|
178
185
|
exports.composeRadius = radius.composeRadius;
|
|
179
186
|
exports.getCornerCSSFromGlobal = radius.getCornerCSSFromGlobal;
|
|
180
187
|
exports.getCustomRadius = radius.getCustomRadius;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSingleColorVariable, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStateResponsiveClass, getGlobalColorStateClass } from './colors.js';
|
|
1
|
+
import { getSingleColorVariable, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStateResponsiveClass, getGlobalColorStateClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateClassDynamicBtn } from './colors.js';
|
|
2
2
|
import { makeStyle, makeStyleResponsiveState, makeStyleState } from './make-style.js';
|
|
3
3
|
|
|
4
4
|
const getBorderStyle = (value)=>{
|
|
@@ -132,5 +132,47 @@ const handleConvertClassColor = (value)=>{
|
|
|
132
132
|
};
|
|
133
133
|
return getGlobalColorStateClass('border', newVal);
|
|
134
134
|
};
|
|
135
|
+
const handleConvertClassColorDynamicBtn = (value)=>{
|
|
136
|
+
if (!value) return undefined;
|
|
137
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
138
|
+
const data = value;
|
|
139
|
+
const newVal = {
|
|
140
|
+
desktop: {
|
|
141
|
+
normal: data.desktop?.normal?.color,
|
|
142
|
+
hover: data.desktop?.hover?.color,
|
|
143
|
+
focus: data.desktop?.focus?.color
|
|
144
|
+
},
|
|
145
|
+
tablet: {
|
|
146
|
+
normal: data.tablet?.normal?.color,
|
|
147
|
+
hover: data.tablet?.hover?.color,
|
|
148
|
+
focus: data.tablet?.focus?.color
|
|
149
|
+
},
|
|
150
|
+
mobile: {
|
|
151
|
+
normal: data.mobile?.normal?.color,
|
|
152
|
+
hover: data.mobile?.hover?.color,
|
|
153
|
+
focus: data.mobile?.focus?.color
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return getGlobalColorStateResponsiveClassDynamicBtn('border', newVal);
|
|
157
|
+
}
|
|
158
|
+
const data = value;
|
|
159
|
+
const newVal = {
|
|
160
|
+
normal: data?.normal?.color,
|
|
161
|
+
hover: data?.hover?.color,
|
|
162
|
+
focus: data?.focus?.color
|
|
163
|
+
};
|
|
164
|
+
return getGlobalColorStateClassDynamicBtn('border', newVal);
|
|
165
|
+
};
|
|
166
|
+
const composeBorderCss = (borderV)=>{
|
|
167
|
+
if (!borderV) return '';
|
|
168
|
+
const { border , width , color , isCustom } = borderV;
|
|
169
|
+
if (isCustom) {
|
|
170
|
+
return '';
|
|
171
|
+
}
|
|
172
|
+
return `${border ? `border-style: ${border};` : ''}
|
|
173
|
+
${width ? `border-width: ${width};` : undefined}
|
|
174
|
+
${color ? `border-color: ${getSingleColorVariable(color)};` : undefined}
|
|
175
|
+
`;
|
|
176
|
+
};
|
|
135
177
|
|
|
136
|
-
export { getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor };
|
|
178
|
+
export { composeBorderCss, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn };
|
|
@@ -32,6 +32,18 @@ const getGlobalColorStateClass = (type, data)=>{
|
|
|
32
32
|
}
|
|
33
33
|
}).filter(isDefined).join(' ');
|
|
34
34
|
};
|
|
35
|
+
const getGlobalColorStateClassDynamicBtn = (type, data)=>{
|
|
36
|
+
if (!data) return '';
|
|
37
|
+
return Object.entries(data).map(([state, value])=>{
|
|
38
|
+
const clName = getGlobalColorClass(type, value);
|
|
39
|
+
if (!clName) return undefined;
|
|
40
|
+
if (state === 'normal') {
|
|
41
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${clName}`;
|
|
42
|
+
} else {
|
|
43
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${state}:${clName}`;
|
|
44
|
+
}
|
|
45
|
+
}).filter(isDefined).join(' ');
|
|
46
|
+
};
|
|
35
47
|
const getGlobalColorStateResponsiveClass = (type, data)=>{
|
|
36
48
|
if (!data) return '';
|
|
37
49
|
return Object.entries(data).map(([device, objectState])=>{
|
|
@@ -58,6 +70,32 @@ const getGlobalColorStateResponsiveClass = (type, data)=>{
|
|
|
58
70
|
}
|
|
59
71
|
}).filter(Boolean).join(' ');
|
|
60
72
|
};
|
|
73
|
+
const getGlobalColorStateResponsiveClassDynamicBtn = (type, data)=>{
|
|
74
|
+
if (!data) return '';
|
|
75
|
+
return Object.entries(data).map(([device, objectState])=>{
|
|
76
|
+
if (device === 'desktop') {
|
|
77
|
+
return Object.entries(objectState).map(([state, value])=>{
|
|
78
|
+
const clName = getGlobalColorClass(type, value);
|
|
79
|
+
if (!clName) return undefined;
|
|
80
|
+
if (state === 'normal') {
|
|
81
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${clName}`;
|
|
82
|
+
} else {
|
|
83
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${state}:${clName}`;
|
|
84
|
+
}
|
|
85
|
+
}).filter(isDefined).join(' ');
|
|
86
|
+
} else {
|
|
87
|
+
return Object.entries(objectState).map(([state, value])=>{
|
|
88
|
+
const clName = getGlobalColorClass(type, value);
|
|
89
|
+
if (!clName) return undefined;
|
|
90
|
+
if (state === 'normal') {
|
|
91
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${device}:${clName}`;
|
|
92
|
+
} else {
|
|
93
|
+
return String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${device}:${state}:${clName}`;
|
|
94
|
+
}
|
|
95
|
+
}).filter(isDefined).join(' ');
|
|
96
|
+
}
|
|
97
|
+
}).filter(Boolean).join(' ');
|
|
98
|
+
};
|
|
61
99
|
const getGlobalColorResponsiveStyle = (type, data)=>{
|
|
62
100
|
if (!data) return {};
|
|
63
101
|
return Object.fromEntries(Object.entries(data).map(([device, value])=>{
|
|
@@ -123,5 +161,8 @@ const getGlobalColorStyle = (data)=>{
|
|
|
123
161
|
'--c': getSingleColorVariable(data)
|
|
124
162
|
};
|
|
125
163
|
};
|
|
164
|
+
const composeTextColorCss = (color)=>{
|
|
165
|
+
return `${color ? `color: ${getSingleColorVariable(color)} !important;` : ''}`;
|
|
166
|
+
};
|
|
126
167
|
|
|
127
|
-
export { getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor };
|
|
168
|
+
export { composeTextColorCss, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor };
|
|
@@ -95,5 +95,33 @@ const getRadiusStyleActiveState = (radiusValue)=>{
|
|
|
95
95
|
}
|
|
96
96
|
return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
|
|
97
97
|
};
|
|
98
|
+
const composeCornerCss = (value)=>{
|
|
99
|
+
if (!value) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const { radiusType , bblr , bbrr , btlr , btrr } = value;
|
|
103
|
+
let radiusValue = undefined;
|
|
104
|
+
switch(radiusType){
|
|
105
|
+
case 'medium':
|
|
106
|
+
case 'large':
|
|
107
|
+
case 'small':
|
|
108
|
+
radiusValue = `border-radius: var(--g-radius-${radiusType});`;
|
|
109
|
+
break;
|
|
110
|
+
case 'circle':
|
|
111
|
+
case 'none':
|
|
112
|
+
case 'custom':
|
|
113
|
+
radiusValue = `
|
|
114
|
+
${bblr ? `border-bottom-left-radius: ${bblr};` : ''}
|
|
115
|
+
|
|
116
|
+
${bbrr ? `border-bottom-right-radius: ${bbrr};` : ''}
|
|
117
|
+
|
|
118
|
+
${btlr ? `border-top-left-radius: ${btlr};` : ''}
|
|
119
|
+
|
|
120
|
+
${btrr ? `border-top-right-radius: ${btrr};` : ''}
|
|
121
|
+
`;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
return radiusValue;
|
|
125
|
+
};
|
|
98
126
|
|
|
99
|
-
export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
|
|
127
|
+
export { composeCornerCss, composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
const genTypoClass = (name)=>{
|
|
2
2
|
return `g-${name}`;
|
|
3
3
|
};
|
|
4
|
+
const composeTypographyCss = (typography)=>{
|
|
5
|
+
const typographyCustom = typography?.custom;
|
|
6
|
+
const { fontFamily , fontSize , fontStyle , fontWeight , lineHeight , letterSpacing } = typographyCustom?.desktop ?? {};
|
|
7
|
+
return `
|
|
8
|
+
${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily});` : ''}
|
|
9
|
+
${fontSize ? `font-size: ${fontSize};` : ''}
|
|
10
|
+
${fontStyle ? `font-style: ${fontStyle};` : ''}
|
|
11
|
+
${fontWeight ? `font-weight: ${fontWeight};` : ''}
|
|
12
|
+
${letterSpacing ? `letter-spacing: ${letterSpacing};` : ''}
|
|
13
|
+
${lineHeight ? `line-height: ${lineHeight};` : ''}
|
|
14
|
+
`;
|
|
15
|
+
};
|
|
4
16
|
|
|
5
|
-
export { genTypoClass };
|
|
17
|
+
export { composeTypographyCss, genTypoClass };
|
package/dist/esm/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { PublishedThemePagesDocument } from './graphql/queries/published-theme-p
|
|
|
21
21
|
export { ProductsDocument } from './graphql/queries/products.generated.js';
|
|
22
22
|
export { StorePropertyDocument } from './graphql/queries/store-property.generated.js';
|
|
23
23
|
export { PreviewPageDocument } from './graphql/queries/preview-page.generated.js';
|
|
24
|
-
export { getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor } from './helpers/borders.js';
|
|
24
|
+
export { composeBorderCss, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn } from './helpers/borders.js';
|
|
25
25
|
export { cls } from './helpers/cls.js';
|
|
26
26
|
export { composeAdvanceStyle } from './helpers/compose-advance-style.js';
|
|
27
27
|
export { flattenConnection } from './helpers/flatten-connection.js';
|
|
@@ -42,9 +42,9 @@ export { getStyleBackgroundByDevice } from './helpers/background.js';
|
|
|
42
42
|
export { genVariable } from './helpers/css-variable.js';
|
|
43
43
|
export { composeGridLayout, convertOldLayout, gridToArrayRegex, optionLayoutStyle } from './helpers/layout.js';
|
|
44
44
|
export { isDefined } from './helpers/is-defined.js';
|
|
45
|
-
export { getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor } from './helpers/colors.js';
|
|
46
|
-
export { genTypoClass } from './helpers/typography.js';
|
|
47
|
-
export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
45
|
+
export { composeTextColorCss, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor } from './helpers/colors.js';
|
|
46
|
+
export { composeTypographyCss, genTypoClass } from './helpers/typography.js';
|
|
47
|
+
export { composeCornerCss, composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
48
48
|
export { getSelectedVariant, parseSelectedOption } from './helpers/product.js';
|
|
49
49
|
import * as fpixel from './helpers/tracking/fpixel.js';
|
|
50
50
|
export { fpixel };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ type AlignItemProp = 'left' | 'center' | 'right';
|
|
|
126
126
|
type JudgeMeReviewsWidgetType = 'single_product_preview_badge' | 'review_widget' | 'reviews_carousel' | 'all_reviews_widget' | 'verified_reviews_count_badge' | 'all_reviews_text';
|
|
127
127
|
type LooxReviewsWidgetType = 'reviews_widget' | 'rating_widget' | 'carousel_widget';
|
|
128
128
|
type RyviuWidgetType = 'reviews' | 'badge' | 'badgeCollection' | 'carousel' | 'masonry';
|
|
129
|
+
type RivyoWidgetType = 'reviews' | 'badge' | 'testimonials' | 'allReviewsPage';
|
|
129
130
|
type KlaviyoWidgetType = 'popup_widget' | 'flyout_widget' | 'embed_widget' | 'full_page_widget';
|
|
130
131
|
type ObjectLayoutValue = {
|
|
131
132
|
display?: 'fill' | 'fit';
|
|
@@ -7294,6 +7295,8 @@ declare const handleConvertBorderStyle: (value?: BorderStyle) => {} | undefined;
|
|
|
7294
7295
|
declare const handleConvertBorderWidth: (value?: BorderStyle) => {} | undefined;
|
|
7295
7296
|
declare const handleConvertBorderColor: (value?: BorderStyle) => React.CSSProperties | undefined;
|
|
7296
7297
|
declare const handleConvertClassColor: (value?: BorderStyle) => string | undefined;
|
|
7298
|
+
declare const handleConvertClassColorDynamicBtn: (value?: BorderStyle) => string | undefined;
|
|
7299
|
+
declare const composeBorderCss: (borderV?: Border | undefined) => string;
|
|
7297
7300
|
|
|
7298
7301
|
type ClassValue = ClassDictionary | string | null | undefined;
|
|
7299
7302
|
interface ClassDictionary {
|
|
@@ -7385,22 +7388,27 @@ declare const getGlobalColorCSSProp: (color?: ColorValueType) => string | undefi
|
|
|
7385
7388
|
declare const getGlobalColorClass: (type: ColorType, color?: ColorValueType) => string;
|
|
7386
7389
|
declare const getGlobalColorResponsiveClass: (type: ColorType, data?: ObjectDevices<ColorValueType>) => string;
|
|
7387
7390
|
declare const getGlobalColorStateClass: (type: ColorType, data?: StateProp<ColorValueType>) => string;
|
|
7391
|
+
declare const getGlobalColorStateClassDynamicBtn: (type: ColorType, data?: StateProp<ColorValueType>) => string;
|
|
7388
7392
|
declare const getGlobalColorStateResponsiveClass: (type: ColorType, data?: ResponsiveStateProp<ColorValueType>) => string;
|
|
7393
|
+
declare const getGlobalColorStateResponsiveClassDynamicBtn: (type: ColorType, data?: ResponsiveStateProp<ColorValueType>) => string;
|
|
7389
7394
|
declare const getGlobalColorResponsiveStyle: (type: ColorProp, data?: ObjectDevices<ColorValueType>) => React.CSSProperties;
|
|
7390
7395
|
declare const getGlobalColorStateStyle: (type: ColorProp, data?: StateProp<ColorValueType>) => React.CSSProperties;
|
|
7391
7396
|
declare const getGlobalColorStateResponsiveStyle: (type: ColorProp, data?: ResponsiveStateProp<ColorValueType>) => React.CSSProperties;
|
|
7392
7397
|
declare const getSingleColorVariable: (color?: ColorValueType) => string | undefined;
|
|
7393
7398
|
declare function isColor(color: string): boolean;
|
|
7394
7399
|
declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSProperties;
|
|
7400
|
+
declare const composeTextColorCss: (color?: ColorValueType) => string;
|
|
7395
7401
|
|
|
7396
7402
|
type TypographyClass = `g-${TypographyType}`;
|
|
7397
7403
|
declare const genTypoClass: (name: TypographyType) => TypographyClass;
|
|
7404
|
+
declare const composeTypographyCss: (typography: TypographySetting | undefined) => string;
|
|
7398
7405
|
|
|
7399
7406
|
declare const getCornerCSSFromGlobal: (corner: CornerRadius) => React.CSSProperties;
|
|
7400
7407
|
declare const getRadiusCSSFromGlobal: (state: StateType, key?: RoundedSize, device?: NameDevices) => React.CSSProperties;
|
|
7401
7408
|
declare const getCustomRadius: (state: StateType, radius?: CornerRadius, device?: NameDevices) => React.CSSProperties;
|
|
7402
7409
|
declare const composeRadius: (value?: StateProp<CornerRadius> | ResponsiveStateProp<CornerRadius>) => React.CSSProperties;
|
|
7403
7410
|
declare const getRadiusStyleActiveState: (radiusValue?: StateProp<CornerRadius>) => React.CSSProperties;
|
|
7411
|
+
declare const composeCornerCss: (value?: CornerRadius | undefined) => string | undefined;
|
|
7404
7412
|
|
|
7405
7413
|
declare function getSelectedVariant(variants?: Maybe<VariantSelectFragment>[], choices?: {
|
|
7406
7414
|
[key: string]: string;
|
|
@@ -7704,4 +7712,4 @@ declare const fetchMedias: (fetcher: FetchFunc, { id, isSample, isStorefront }:
|
|
|
7704
7712
|
|
|
7705
7713
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
7706
7714
|
|
|
7707
|
-
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeGridLayout, composeRadius, composeSize, composeSpacing, convertOldLayout, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|
|
7715
|
+
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeBorderCss, composeCornerCss, composeGridLayout, composeRadius, composeSize, composeSpacing, composeTextColorCss, composeTypographyCss, convertOldLayout, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|