@aleph-alpha/config-css 0.21.1 → 0.21.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aleph-alpha/config-css",
3
3
  "license": "Apache-2.0",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "prettier": "@aleph-alpha/prettier-config-frontend",
@@ -12,11 +12,21 @@ import { inter500 } from './assets/fonts/inter500.woff2';
12
12
  import { inter600 } from './assets/fonts/inter600.woff2';
13
13
  import { inter700 } from './assets/fonts/inter700.woff2';
14
14
 
15
- const LEGACY_DATA_URI_PREFIX = 'data:@file/octet-stream;base64,';
16
-
17
15
  const normalizeEmbeddedFontDataUri = (fontDataUri: string, mimeType = 'font/woff2') => {
18
- if (!fontDataUri.startsWith(LEGACY_DATA_URI_PREFIX)) return fontDataUri;
19
- return `data:${mimeType};base64,${fontDataUri.slice(LEGACY_DATA_URI_PREFIX.length)}`;
16
+ const normalizedUri = fontDataUri.trim();
17
+ const legacyPrefixes = [
18
+ 'data:@file/octet-stream;base64,',
19
+ 'data:@file/binary;base64,',
20
+ 'data:%40file/octet-stream;base64,',
21
+ 'data:%40file/binary;base64,',
22
+ ];
23
+
24
+ const matchedPrefix = legacyPrefixes.find((prefix) => normalizedUri.startsWith(prefix));
25
+ if (matchedPrefix) {
26
+ return `data:${mimeType};base64,${normalizedUri.slice(matchedPrefix.length)}`;
27
+ }
28
+
29
+ return normalizedUri;
20
30
  };
21
31
 
22
32
  export const presetWebFontsAlephAlpha = (): Preset => ({
@@ -46,9 +56,6 @@ export const presetWebFontsAlephAlpha = (): Preset => ({
46
56
  const inter700Src = normalizeEmbeddedFontDataUri(inter700);
47
57
 
48
58
  return `
49
- :root {
50
- --custom-font-family: Raleway;
51
- }
52
59
 
53
60
  /* Raleway fonts (legacy support) */
54
61
  @font-face {