@arclux/brand 1.0.3 → 1.0.4
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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Convert a base64 string to a same-origin blob URL (bypasses font-src 'self' CSP). */
|
|
2
|
+
export function base64ToBlobUrl(b64, mime = 'font/woff2') {
|
|
3
|
+
const bin = atob(b64);
|
|
4
|
+
const buf = new Uint8Array(bin.length);
|
|
5
|
+
for (let i = 0; i < bin.length; i++) buf[i] = bin.charCodeAt(i);
|
|
6
|
+
return URL.createObjectURL(new Blob([buf], { type: mime }));
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { tokenStyles } from '../shared-styles.js';
|
|
3
3
|
import { tekturSubsetBase64 } from '../assets/tektur-font.js';
|
|
4
|
+
import { base64ToBlobUrl } from '../assets/blob-url.js';
|
|
4
5
|
import './logo-wordmark.js';
|
|
5
6
|
|
|
6
7
|
// @font-face must be in document scope — shadow DOM won't pick it up.
|
|
@@ -8,11 +9,12 @@ let fontInjected = false;
|
|
|
8
9
|
function injectFont() {
|
|
9
10
|
if (fontInjected) return;
|
|
10
11
|
fontInjected = true;
|
|
12
|
+
const url = base64ToBlobUrl(tekturSubsetBase64);
|
|
11
13
|
const style = document.createElement('style');
|
|
12
14
|
style.textContent = `
|
|
13
15
|
@font-face {
|
|
14
16
|
font-family: 'Tektur Subset';
|
|
15
|
-
src: url('
|
|
17
|
+
src: url('${url}') format('woff2');
|
|
16
18
|
font-weight: 400 900;
|
|
17
19
|
font-display: block;
|
|
18
20
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { tokenStyles } from '../shared-styles.js';
|
|
3
3
|
import { hostGroteskSubsetBase64 } from '../assets/wordmark-font.js';
|
|
4
|
+
import { base64ToBlobUrl } from '../assets/blob-url.js';
|
|
4
5
|
|
|
5
6
|
const SIZES = {
|
|
6
7
|
sm: { fontSize: '15px', fontWeight: '500', letterSpacing: '6px' },
|
|
@@ -14,11 +15,12 @@ let fontInjected = false;
|
|
|
14
15
|
function injectFont() {
|
|
15
16
|
if (fontInjected) return;
|
|
16
17
|
fontInjected = true;
|
|
18
|
+
const url = base64ToBlobUrl(hostGroteskSubsetBase64);
|
|
17
19
|
const style = document.createElement('style');
|
|
18
20
|
style.textContent = `
|
|
19
21
|
@font-face {
|
|
20
22
|
font-family: 'Host Grotesk Subset';
|
|
21
|
-
src: url('
|
|
23
|
+
src: url('${url}') format('woff2');
|
|
22
24
|
font-weight: 100 900;
|
|
23
25
|
font-display: block;
|
|
24
26
|
}
|