@gem-sdk/pages 1.43.0-dev.67 → 1.43.0-dev.84
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/libs/helpers/gen-css.js +12 -2
- package/dist/cjs/libs/helpers/gen-fonts.js +12 -5
- package/dist/cjs/pages/builder.js +2 -1
- package/dist/esm/libs/helpers/gen-css.js +12 -2
- package/dist/esm/libs/helpers/gen-fonts.js +12 -5
- package/dist/esm/pages/builder.js +2 -1
- package/dist/types/index.d.ts +5 -2
- package/package.json +5 -5
|
@@ -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
|
}
|
|
@@ -15,7 +15,7 @@ var AddSectionImageToLayout = require('../components/image-to-layout/AddSectionI
|
|
|
15
15
|
var Toolbar = require('../components/builder/Toolbar.js');
|
|
16
16
|
var SwitchView = require('../components/builder/SwitchView.js');
|
|
17
17
|
|
|
18
|
-
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate })=>{
|
|
18
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate, pageName })=>{
|
|
19
19
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
20
20
|
const isDisableHeaderFooter = ()=>{
|
|
21
21
|
return isThemeSectionEditor;
|
|
@@ -60,6 +60,7 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
60
60
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
61
61
|
data: sectionData,
|
|
62
62
|
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
63
|
+
pageName: pageName,
|
|
63
64
|
state: initState,
|
|
64
65
|
isThemeSectionEditor: isThemeSectionEditor,
|
|
65
66
|
children: [
|
|
@@ -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
|
}
|
|
@@ -13,7 +13,7 @@ import AddSectionImageToLayout from '../components/image-to-layout/AddSectionIma
|
|
|
13
13
|
import Toolbar from '../components/builder/Toolbar.js';
|
|
14
14
|
import Devices from '../components/builder/SwitchView.js';
|
|
15
15
|
|
|
16
|
-
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate })=>{
|
|
16
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate, pageName })=>{
|
|
17
17
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
18
18
|
const isDisableHeaderFooter = ()=>{
|
|
19
19
|
return isThemeSectionEditor;
|
|
@@ -58,6 +58,7 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
58
58
|
children: /*#__PURE__*/ jsx(SectionProvider, {
|
|
59
59
|
data: sectionData,
|
|
60
60
|
children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
|
|
61
|
+
pageName: pageName,
|
|
61
62
|
state: initState,
|
|
62
63
|
isThemeSectionEditor: isThemeSectionEditor,
|
|
63
64
|
children: [
|
package/dist/types/index.d.ts
CHANGED
|
@@ -177,13 +177,16 @@ type BuilderPageProps = {
|
|
|
177
177
|
isThemeSectionEditor?: boolean;
|
|
178
178
|
hiddenToolbar?: boolean;
|
|
179
179
|
isOriginTemplate?: boolean;
|
|
180
|
+
pageName: string;
|
|
180
181
|
};
|
|
181
182
|
declare const BuilderPage: React.FC<BuilderPageProps>;
|
|
182
183
|
|
|
183
184
|
declare const getStaticPaths: GetStaticPaths;
|
|
184
185
|
|
|
186
|
+
type TypographyV2FontFamilyType = 'google' | 'custom' | 'theme';
|
|
187
|
+
|
|
185
188
|
type FontItem = {
|
|
186
|
-
type:
|
|
189
|
+
type: TypographyV2FontFamilyType;
|
|
187
190
|
family: string;
|
|
188
191
|
variants: string[];
|
|
189
192
|
subsets: string[];
|
|
@@ -194,7 +197,7 @@ type FontOption = {
|
|
|
194
197
|
effect?: string;
|
|
195
198
|
};
|
|
196
199
|
declare function getFonts(fonts: FontItem[], option?: FontOption, isImportFontByUrl?: boolean): Promise<string>;
|
|
197
|
-
declare const getFontFromGlobalStyle: (data?: string) => Promise<string
|
|
200
|
+
declare const getFontFromGlobalStyle: (data?: string) => "" | Promise<string>;
|
|
198
201
|
|
|
199
202
|
declare const getFontsFromDataBuilder: (dataBuilder: Record<string, any>) => FontItem[];
|
|
200
203
|
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.84",
|
|
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.84",
|
|
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"
|