@openeventkit/event-site 2.0.98 → 2.0.100
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/gatsby-node.js +1 -1
- package/package.json +2 -2
- package/src/utils/cssUtils.js +48 -71
package/gatsby-node.js
CHANGED
|
@@ -337,7 +337,7 @@ exports.onPreBootstrap = async () => {
|
|
|
337
337
|
if(siteFonts && Object.keys(siteFonts).length > 0) {
|
|
338
338
|
// Generate the SCSS file
|
|
339
339
|
const scssFontsFile = generateFontFile(siteFonts);
|
|
340
|
-
if(scssFontsFile) {
|
|
340
|
+
if (scssFontsFile) {
|
|
341
341
|
const standalone = __dirname === path.resolve();
|
|
342
342
|
let fontFilePath = FONTS_SCSS_FILE_PATH;
|
|
343
343
|
if (!standalone) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeventkit/event-site",
|
|
3
3
|
"description": "Event Site",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.100",
|
|
5
5
|
"author": "Tipit LLC",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@mui/base": "^5.0.0-alpha.114",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"stream-browserify": "^3.0.0",
|
|
122
122
|
"stream-chat": "^2.7.2",
|
|
123
123
|
"stream-chat-react": "3.1.7",
|
|
124
|
-
"summit-registration-lite": "5.0.
|
|
124
|
+
"summit-registration-lite": "5.0.24",
|
|
125
125
|
"superagent": "8.0.9",
|
|
126
126
|
"sweetalert2": "^9.17.0",
|
|
127
127
|
"upcoming-events-widget": "3.0.5",
|
package/src/utils/cssUtils.js
CHANGED
|
@@ -1,85 +1,62 @@
|
|
|
1
1
|
const getFontFormat = (format) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
case 'woff':
|
|
11
|
-
formatString = "format('woff')";
|
|
12
|
-
break;
|
|
13
|
-
case 'woff2':
|
|
14
|
-
formatString = "format('woff2')";
|
|
15
|
-
break;
|
|
16
|
-
default:
|
|
17
|
-
formatString = null;
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
return formatString;
|
|
21
|
-
}
|
|
2
|
+
const formatMap = {
|
|
3
|
+
"ttf": "format(\"truetype\")",
|
|
4
|
+
"otf": "format(\"opentype\")",
|
|
5
|
+
"woff": "format(\"woff\")",
|
|
6
|
+
"woff2": "format(\"woff2\")",
|
|
7
|
+
};
|
|
8
|
+
return formatMap[format] || "";
|
|
9
|
+
};
|
|
22
10
|
|
|
23
|
-
const getFontSrc = (fontPath) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
|
|
11
|
+
const getFontSrc = (fontPath) => fontPath.replace(/^\/static/, "");
|
|
12
|
+
|
|
13
|
+
const generateFontFace = (fontFamily, fontData, fontWeight) => {
|
|
14
|
+
if (!fontFamily || !fontData || !fontData.fontFile || !fontData.fontFormat) return "";
|
|
15
|
+
|
|
16
|
+
const { fontFile, fontFormat } = fontData;
|
|
17
|
+
return `@font-face {
|
|
18
|
+
font-family: "${fontFamily}";
|
|
19
|
+
src: url("${getFontSrc(fontFile)}") ${getFontFormat(fontFormat)};
|
|
20
|
+
font-weight: ${fontWeight};
|
|
21
|
+
}`;
|
|
22
|
+
};
|
|
28
23
|
|
|
29
|
-
const generateFontFile = (
|
|
30
|
-
|
|
31
|
-
if(!fontData?.fontFamily) return null;
|
|
32
|
-
if(!fontData?.regularFont?.fontFile) return null;
|
|
33
|
-
if(!fontData?.regularFont?.fontFormat) return null;
|
|
34
|
-
if(!fontData?.boldFont?.fontFile) return null;
|
|
35
|
-
if(!fontData?.boldFont?.fontFormat) return null;
|
|
24
|
+
const generateFontFile = (fontsData) => {
|
|
25
|
+
if (!fontsData || !fontsData.fontFamily || !fontsData.regularFont || !fontsData.boldFont) return null;
|
|
36
26
|
|
|
37
|
-
const
|
|
38
|
-
$font-family: "${fontData.fontFamily}";
|
|
27
|
+
const { fontFamily, regularFont, boldFont } = fontsData;
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
29
|
+
if (!regularFont.fontFile || !regularFont.fontFormat) return null;
|
|
30
|
+
if (!boldFont.fontFile || !boldFont.fontFormat) return null;
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`@font-face {
|
|
47
|
-
font-family: "${fontData.fontFamily}";
|
|
48
|
-
src: url("${getFontSrc(fontData.regularFont?.fontFile)}") ${getFontFormat(fontData.regularFont?.fontFormat)};
|
|
49
|
-
font-weight: normal;
|
|
50
|
-
}`
|
|
51
|
-
:
|
|
52
|
-
''
|
|
53
|
-
}
|
|
32
|
+
const regularFontFace = generateFontFace(fontFamily, regularFont, "normal");
|
|
33
|
+
const boldFontFace = generateFontFace(fontFamily, boldFont, "bold");
|
|
54
34
|
|
|
55
|
-
${
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
35
|
+
return `$font-family: "${fontFamily}";
|
|
36
|
+
|
|
37
|
+
:root {
|
|
38
|
+
--font_family: "${fontFamily}" !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${regularFontFace}
|
|
42
|
+
${boldFontFace}
|
|
64
43
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
%font-regular {
|
|
45
|
+
font-family: var(--font_family);
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
}
|
|
69
48
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
49
|
+
%font-semi {
|
|
50
|
+
font-family: var(--font_family);
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
}
|
|
74
53
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`;
|
|
80
|
-
return scssFonts;
|
|
54
|
+
%font-bold {
|
|
55
|
+
font-family: var(--font_family);
|
|
56
|
+
font-weight: 700;
|
|
57
|
+
}`;
|
|
81
58
|
};
|
|
82
59
|
|
|
83
60
|
module.exports = {
|
|
84
61
|
generateFontFile
|
|
85
|
-
}
|
|
62
|
+
};
|