@gem-sdk/pages 1.12.0-next.62 → 1.12.0-next.66
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/builder/Toolbox.js +6 -23
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/libs/helpers/gen-fonts.js +27 -16
- package/dist/esm/components/builder/Toolbox.js +7 -24
- package/dist/esm/index.js +1 -1
- package/dist/esm/libs/helpers/gen-fonts.js +27 -17
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -2
|
@@ -163,29 +163,12 @@ const Toolbox = ()=>{
|
|
|
163
163
|
});
|
|
164
164
|
// Check link google font to <head>
|
|
165
165
|
if (detail.propValue?.custom) {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (isFontFamily) {
|
|
173
|
-
isFontFamily.variants.push(customFontWeight);
|
|
174
|
-
} else {
|
|
175
|
-
setFonts([
|
|
176
|
-
...fonts,
|
|
177
|
-
{
|
|
178
|
-
family: customFontFamily,
|
|
179
|
-
variants: [
|
|
180
|
-
customFontWeight
|
|
181
|
-
],
|
|
182
|
-
subsets: [],
|
|
183
|
-
type: 'google'
|
|
184
|
-
}
|
|
185
|
-
]);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
166
|
+
const settings = {
|
|
167
|
+
[detail.propName]: detail.propValue
|
|
168
|
+
};
|
|
169
|
+
const currentFonts = JSON.parse(JSON.stringify(fonts));
|
|
170
|
+
genFonts.getFontFromGroupSetting(currentFonts, settings);
|
|
171
|
+
setFonts(currentFonts);
|
|
189
172
|
}
|
|
190
173
|
}
|
|
191
174
|
} catch {
|
package/dist/cjs/index.js
CHANGED
|
@@ -61,6 +61,7 @@ exports.StaticPage = _static.default;
|
|
|
61
61
|
exports.BuilderPage = builder.BuilderPage;
|
|
62
62
|
exports.StaticPageV2 = staticV2.StaticPageV2;
|
|
63
63
|
exports.getStaticPaths = getStaticPaths.getStaticPaths;
|
|
64
|
+
exports.getFontFromGroupSetting = genFonts.getFontFromGroupSetting;
|
|
64
65
|
exports.getFontsFromDataBuilder = genFonts.getFontsFromDataBuilder;
|
|
65
66
|
exports.getFontFromGlobalStyle = googleFonts.getFontFromGlobalStyle;
|
|
66
67
|
exports.getFonts = googleFonts.getFonts;
|
|
@@ -19,22 +19,32 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
19
19
|
const value = groupSetting[attr];
|
|
20
20
|
if (value) {
|
|
21
21
|
const customFontFamily = value.custom?.fontFamily;
|
|
22
|
-
const
|
|
23
|
-
if (customFontFamily &&
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
const customFontVariants = value.custom?.fontVariants;
|
|
23
|
+
if (customFontFamily && customFontVariants?.length) {
|
|
24
|
+
const variants = customFontVariants.map((item)=>{
|
|
25
|
+
switch(item){
|
|
26
|
+
case 'regular':
|
|
27
|
+
return '400';
|
|
28
|
+
}
|
|
29
|
+
return item;
|
|
30
|
+
});
|
|
31
|
+
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
32
|
+
if (customFontWeight) {
|
|
33
|
+
const isExist = fonts.find((item)=>item.family == customFontFamily && item.variants.includes(customFontWeight));
|
|
34
|
+
if (!isExist) {
|
|
35
|
+
const isFontFamily = fonts.find((item)=>item.family == customFontFamily);
|
|
36
|
+
if (isFontFamily) {
|
|
37
|
+
isFontFamily.variants.push(customFontWeight);
|
|
38
|
+
} else {
|
|
39
|
+
fonts.push({
|
|
40
|
+
family: customFontFamily,
|
|
41
|
+
variants: [
|
|
42
|
+
customFontWeight
|
|
43
|
+
],
|
|
44
|
+
subsets: [],
|
|
45
|
+
type: 'google'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
}
|
|
@@ -43,4 +53,5 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
43
53
|
}
|
|
44
54
|
};
|
|
45
55
|
|
|
56
|
+
exports.getFontFromGroupSetting = getFontFromGroupSetting;
|
|
46
57
|
exports.getFontsFromDataBuilder = getFontsFromDataBuilder;
|
|
@@ -6,7 +6,7 @@ import { genCSS } from '../../libs/helpers/gen-css.js';
|
|
|
6
6
|
import { getStorefrontApi } from '../../libs/get-storefront-api.js';
|
|
7
7
|
import { shopifyCdnWithGoogleFonts } from '../../libs/shopify-cdn-with-google-fonts.js';
|
|
8
8
|
import { normalizeBuilderData } from '../../libs/helpers/normalize.js';
|
|
9
|
-
import { getFontsFromDataBuilder } from '../../libs/helpers/gen-fonts.js';
|
|
9
|
+
import { getFontsFromDataBuilder, getFontFromGroupSetting } from '../../libs/helpers/gen-fonts.js';
|
|
10
10
|
|
|
11
11
|
const globalStyleId = 'global-style';
|
|
12
12
|
const globalFontId = 'google-font-builder';
|
|
@@ -159,29 +159,12 @@ const Toolbox = ()=>{
|
|
|
159
159
|
});
|
|
160
160
|
// Check link google font to <head>
|
|
161
161
|
if (detail.propValue?.custom) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (isFontFamily) {
|
|
169
|
-
isFontFamily.variants.push(customFontWeight);
|
|
170
|
-
} else {
|
|
171
|
-
setFonts([
|
|
172
|
-
...fonts,
|
|
173
|
-
{
|
|
174
|
-
family: customFontFamily,
|
|
175
|
-
variants: [
|
|
176
|
-
customFontWeight
|
|
177
|
-
],
|
|
178
|
-
subsets: [],
|
|
179
|
-
type: 'google'
|
|
180
|
-
}
|
|
181
|
-
]);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
162
|
+
const settings = {
|
|
163
|
+
[detail.propName]: detail.propValue
|
|
164
|
+
};
|
|
165
|
+
const currentFonts = JSON.parse(JSON.stringify(fonts));
|
|
166
|
+
getFontFromGroupSetting(currentFonts, settings);
|
|
167
|
+
setFonts(currentFonts);
|
|
185
168
|
}
|
|
186
169
|
}
|
|
187
170
|
} catch {
|
package/dist/esm/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { default as StaticPage } from './pages/static.js';
|
|
|
21
21
|
export { BuilderPage } from './pages/builder.js';
|
|
22
22
|
export { StaticPageV2 } from './pages/static-v2.js';
|
|
23
23
|
export { getStaticPaths } from './libs/getStaticPaths.js';
|
|
24
|
-
export { getFontsFromDataBuilder } from './libs/helpers/gen-fonts.js';
|
|
24
|
+
export { getFontFromGroupSetting, getFontsFromDataBuilder } from './libs/helpers/gen-fonts.js';
|
|
25
25
|
export { getFontFromGlobalStyle, getFonts } from './libs/google-fonts.js';
|
|
26
26
|
export { getStorefrontApi } from './libs/get-storefront-api.js';
|
|
27
27
|
export { ErrorBoundary } from './components/ErrorBoundary.js';
|
|
@@ -17,22 +17,32 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
17
17
|
const value = groupSetting[attr];
|
|
18
18
|
if (value) {
|
|
19
19
|
const customFontFamily = value.custom?.fontFamily;
|
|
20
|
-
const
|
|
21
|
-
if (customFontFamily &&
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const customFontVariants = value.custom?.fontVariants;
|
|
21
|
+
if (customFontFamily && customFontVariants?.length) {
|
|
22
|
+
const variants = customFontVariants.map((item)=>{
|
|
23
|
+
switch(item){
|
|
24
|
+
case 'regular':
|
|
25
|
+
return '400';
|
|
26
|
+
}
|
|
27
|
+
return item;
|
|
28
|
+
});
|
|
29
|
+
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
30
|
+
if (customFontWeight) {
|
|
31
|
+
const isExist = fonts.find((item)=>item.family == customFontFamily && item.variants.includes(customFontWeight));
|
|
32
|
+
if (!isExist) {
|
|
33
|
+
const isFontFamily = fonts.find((item)=>item.family == customFontFamily);
|
|
34
|
+
if (isFontFamily) {
|
|
35
|
+
isFontFamily.variants.push(customFontWeight);
|
|
36
|
+
} else {
|
|
37
|
+
fonts.push({
|
|
38
|
+
family: customFontFamily,
|
|
39
|
+
variants: [
|
|
40
|
+
customFontWeight
|
|
41
|
+
],
|
|
42
|
+
subsets: [],
|
|
43
|
+
type: 'google'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
}
|
|
@@ -41,4 +51,4 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
41
51
|
}
|
|
42
52
|
};
|
|
43
53
|
|
|
44
|
-
export { getFontsFromDataBuilder };
|
|
54
|
+
export { getFontFromGroupSetting, getFontsFromDataBuilder };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -168,6 +168,7 @@ declare function getFonts(fonts: FontItem[], option?: FontOption, maxSize?: numb
|
|
|
168
168
|
declare const getFontFromGlobalStyle: (data?: string, maxSize?: number) => Promise<string> | "";
|
|
169
169
|
|
|
170
170
|
declare const getFontsFromDataBuilder: (dataBuilder: Record<string, any>) => FontItem[];
|
|
171
|
+
declare const getFontFromGroupSetting: (fonts: FontItem[], groupSetting: Record<string, any>) => void;
|
|
171
172
|
|
|
172
173
|
declare const getStorefrontApi: (handle: string, provider?: 'BIGCOMMERCE' | 'SHOPIFY') => string;
|
|
173
174
|
|
|
@@ -216,4 +217,4 @@ type Props = {
|
|
|
216
217
|
};
|
|
217
218
|
declare const TikTokPixel: ({ pixelId }: Props) => JSX.Element | null;
|
|
218
219
|
|
|
219
|
-
export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFallbackV2, getFontFromGlobalStyle, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, useTrackingView };
|
|
220
|
+
export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, useTrackingView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.12.0-next.
|
|
3
|
+
"version": "1.12.0-next.66",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"next-seo": "^6.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "1.12.0-next.
|
|
28
|
+
"@gem-sdk/core": "1.12.0-next.65",
|
|
29
29
|
"@gem-sdk/plugin-cookie-bar": "*",
|
|
30
30
|
"@gem-sdk/plugin-quick-view": "*",
|
|
31
31
|
"@gem-sdk/plugin-sticky-add-to-cart": "*"
|