@gem-sdk/pages 1.43.0-dev.67 → 1.43.0-dev.80
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.
|
@@ -63,7 +63,15 @@ const getValueByDevice = (data, device)=>{
|
|
|
63
63
|
key,
|
|
64
64
|
value?.family
|
|
65
65
|
];
|
|
66
|
-
}))
|
|
66
|
+
})),
|
|
67
|
+
theme: {
|
|
68
|
+
font: Object.fromEntries(Object.entries(data?.theme?.font ?? {}).map(([key, value])=>{
|
|
69
|
+
return [
|
|
70
|
+
key,
|
|
71
|
+
value?.family
|
|
72
|
+
];
|
|
73
|
+
}))
|
|
74
|
+
}
|
|
67
75
|
};
|
|
68
76
|
return deviceData;
|
|
69
77
|
};
|
|
@@ -80,7 +88,9 @@ const genCSSVariable = (deviceData)=>{
|
|
|
80
88
|
if (value === undefined) return undefined;
|
|
81
89
|
if ([
|
|
82
90
|
'font-heading',
|
|
83
|
-
'font-body'
|
|
91
|
+
'font-body',
|
|
92
|
+
'theme-font-heading',
|
|
93
|
+
'theme-font-body'
|
|
84
94
|
].includes(key)) {
|
|
85
95
|
return `--g-${key}: ${quoteFontName(value)}`;
|
|
86
96
|
}
|
|
@@ -18,7 +18,14 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
18
18
|
if (Object.prototype.hasOwnProperty.call(groupSetting, attr)) {
|
|
19
19
|
const value = groupSetting[attr];
|
|
20
20
|
if (value) {
|
|
21
|
-
|
|
21
|
+
let customFontFamily = value.custom?.fontFamily;
|
|
22
|
+
if (typeof customFontFamily === 'string') {
|
|
23
|
+
customFontFamily = {
|
|
24
|
+
value: value.custom?.fontFamily || '',
|
|
25
|
+
type: 'google'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const fontFamily = customFontFamily?.value;
|
|
22
29
|
let customFontVariants = value.custom?.fontVariants;
|
|
23
30
|
if (!customFontVariants?.length) {
|
|
24
31
|
customFontVariants = [
|
|
@@ -35,9 +42,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
35
42
|
});
|
|
36
43
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
37
44
|
if (customFontWeight) {
|
|
38
|
-
const isExist = fonts.find((item)=>item.family ==
|
|
45
|
+
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
39
46
|
if (!isExist) {
|
|
40
|
-
const isFontFamily = fonts.find((item)=>item.family ==
|
|
47
|
+
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
41
48
|
if (isFontFamily) {
|
|
42
49
|
isFontFamily.variants.push(customFontWeight);
|
|
43
50
|
} else {
|
|
@@ -50,10 +57,10 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
fonts.push({
|
|
53
|
-
family:
|
|
60
|
+
family: fontFamily || '',
|
|
54
61
|
variants: fontVariants,
|
|
55
62
|
subsets: [],
|
|
56
|
-
type:
|
|
63
|
+
type: customFontFamily.type
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
}
|
|
@@ -61,7 +61,15 @@ const getValueByDevice = (data, device)=>{
|
|
|
61
61
|
key,
|
|
62
62
|
value?.family
|
|
63
63
|
];
|
|
64
|
-
}))
|
|
64
|
+
})),
|
|
65
|
+
theme: {
|
|
66
|
+
font: Object.fromEntries(Object.entries(data?.theme?.font ?? {}).map(([key, value])=>{
|
|
67
|
+
return [
|
|
68
|
+
key,
|
|
69
|
+
value?.family
|
|
70
|
+
];
|
|
71
|
+
}))
|
|
72
|
+
}
|
|
65
73
|
};
|
|
66
74
|
return deviceData;
|
|
67
75
|
};
|
|
@@ -78,7 +86,9 @@ const genCSSVariable = (deviceData)=>{
|
|
|
78
86
|
if (value === undefined) return undefined;
|
|
79
87
|
if ([
|
|
80
88
|
'font-heading',
|
|
81
|
-
'font-body'
|
|
89
|
+
'font-body',
|
|
90
|
+
'theme-font-heading',
|
|
91
|
+
'theme-font-body'
|
|
82
92
|
].includes(key)) {
|
|
83
93
|
return `--g-${key}: ${quoteFontName(value)}`;
|
|
84
94
|
}
|
|
@@ -16,7 +16,14 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
16
16
|
if (Object.prototype.hasOwnProperty.call(groupSetting, attr)) {
|
|
17
17
|
const value = groupSetting[attr];
|
|
18
18
|
if (value) {
|
|
19
|
-
|
|
19
|
+
let customFontFamily = value.custom?.fontFamily;
|
|
20
|
+
if (typeof customFontFamily === 'string') {
|
|
21
|
+
customFontFamily = {
|
|
22
|
+
value: value.custom?.fontFamily || '',
|
|
23
|
+
type: 'google'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const fontFamily = customFontFamily?.value;
|
|
20
27
|
let customFontVariants = value.custom?.fontVariants;
|
|
21
28
|
if (!customFontVariants?.length) {
|
|
22
29
|
customFontVariants = [
|
|
@@ -33,9 +40,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
33
40
|
});
|
|
34
41
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
35
42
|
if (customFontWeight) {
|
|
36
|
-
const isExist = fonts.find((item)=>item.family ==
|
|
43
|
+
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
37
44
|
if (!isExist) {
|
|
38
|
-
const isFontFamily = fonts.find((item)=>item.family ==
|
|
45
|
+
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
39
46
|
if (isFontFamily) {
|
|
40
47
|
isFontFamily.variants.push(customFontWeight);
|
|
41
48
|
} else {
|
|
@@ -48,10 +55,10 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
fonts.push({
|
|
51
|
-
family:
|
|
58
|
+
family: fontFamily || '',
|
|
52
59
|
variants: fontVariants,
|
|
53
60
|
subsets: [],
|
|
54
|
-
type:
|
|
61
|
+
type: customFontFamily.type
|
|
55
62
|
});
|
|
56
63
|
}
|
|
57
64
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -182,8 +182,10 @@ declare const BuilderPage: React.FC<BuilderPageProps>;
|
|
|
182
182
|
|
|
183
183
|
declare const getStaticPaths: GetStaticPaths;
|
|
184
184
|
|
|
185
|
+
type TypographyV2FontFamilyType = 'google' | 'custom' | 'theme';
|
|
186
|
+
|
|
185
187
|
type FontItem = {
|
|
186
|
-
type:
|
|
188
|
+
type: TypographyV2FontFamilyType;
|
|
187
189
|
family: string;
|
|
188
190
|
variants: string[];
|
|
189
191
|
subsets: string[];
|
|
@@ -194,7 +196,7 @@ type FontOption = {
|
|
|
194
196
|
effect?: string;
|
|
195
197
|
};
|
|
196
198
|
declare function getFonts(fonts: FontItem[], option?: FontOption, isImportFontByUrl?: boolean): Promise<string>;
|
|
197
|
-
declare const getFontFromGlobalStyle: (data?: string) => Promise<string
|
|
199
|
+
declare const getFontFromGlobalStyle: (data?: string) => "" | Promise<string>;
|
|
198
200
|
|
|
199
201
|
declare const getFontsFromDataBuilder: (dataBuilder: Record<string, any>) => FontItem[];
|
|
200
202
|
declare const getFontFromGroupSetting: (fonts: FontItem[], groupSetting: Record<string, any>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.43.0-dev.
|
|
3
|
+
"version": "1.43.0-dev.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"next": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "1.43.0-dev.
|
|
30
|
-
"@gem-sdk/plugin-cookie-bar": "1.43.0-dev.
|
|
31
|
-
"@gem-sdk/plugin-quick-view": "1.43.0-dev.
|
|
32
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "1.43.0-dev.
|
|
29
|
+
"@gem-sdk/core": "1.43.0-dev.80",
|
|
30
|
+
"@gem-sdk/plugin-cookie-bar": "1.43.0-dev.80",
|
|
31
|
+
"@gem-sdk/plugin-quick-view": "1.43.0-dev.80",
|
|
32
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "1.43.0-dev.80"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"next": ">=13"
|