@aleph-alpha/config-css 0.17.20 → 0.18.0
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/CHANGELOG.md +10 -0
- package/README.md +30 -0
- package/dist/index.js +322 -265
- package/package.json +1 -1
- package/src/assets/fonts/inter400.woff2.ts +2 -0
- package/src/assets/fonts/inter500.woff2.ts +2 -0
- package/src/assets/fonts/inter600.woff2.ts +2 -0
- package/src/assets/fonts/inter700.woff2.ts +2 -0
- package/src/assets/fonts/montserrat500.woff2.ts +2 -0
- package/src/assets/fonts/montserrat600.woff2.ts +2 -0
- package/src/assets/fonts/montserrat700.woff2.ts +2 -0
- package/src/presetWebFontsAlephAlpha.ts +66 -2
- package/src/utils/convert-fonts.js +48 -0
|
@@ -4,18 +4,29 @@ import { raleway600 } from './assets/fonts/raleway600.woff2';
|
|
|
4
4
|
import { raleway700 } from './assets/fonts/raleway700.woff2';
|
|
5
5
|
import { roboto500 } from './assets/fonts/roboto500.woff2';
|
|
6
6
|
import { roboto700 } from './assets/fonts/roboto700.woff2';
|
|
7
|
+
import { montserrat500 } from './assets/fonts/montserrat500.woff2';
|
|
8
|
+
import { montserrat600 } from './assets/fonts/montserrat600.woff2';
|
|
9
|
+
import { montserrat700 } from './assets/fonts/montserrat700.woff2';
|
|
10
|
+
import { inter400 } from './assets/fonts/inter400.woff2';
|
|
11
|
+
import { inter500 } from './assets/fonts/inter500.woff2';
|
|
12
|
+
import { inter600 } from './assets/fonts/inter600.woff2';
|
|
13
|
+
import { inter700 } from './assets/fonts/inter700.woff2';
|
|
7
14
|
|
|
8
15
|
export const presetWebFontsAlephAlpha = (): Preset => ({
|
|
9
16
|
name: '@aleph-alpha/ds-fonts',
|
|
10
17
|
theme: {
|
|
11
18
|
fontFamily: {
|
|
12
19
|
sans: 'var(--custom-font-family, Raleway), sans-serif',
|
|
20
|
+
montserrat: 'Montserrat, sans-serif',
|
|
21
|
+
inter: 'Inter, sans-serif',
|
|
22
|
+
raleway: 'Raleway, sans-serif',
|
|
13
23
|
},
|
|
14
24
|
},
|
|
15
25
|
preflights: [
|
|
16
26
|
{
|
|
17
27
|
getCSS() {
|
|
18
28
|
return `
|
|
29
|
+
/* Raleway fonts (legacy support) */
|
|
19
30
|
@font-face {
|
|
20
31
|
font-display: swap;
|
|
21
32
|
font-family: 'Raleway';
|
|
@@ -23,7 +34,6 @@ export const presetWebFontsAlephAlpha = (): Preset => ({
|
|
|
23
34
|
font-weight: 500;
|
|
24
35
|
src: url('${raleway500}') format('woff2');
|
|
25
36
|
}
|
|
26
|
-
/* raleway-600 - latin */
|
|
27
37
|
@font-face {
|
|
28
38
|
font-display: swap;
|
|
29
39
|
font-family: 'Raleway';
|
|
@@ -31,7 +41,6 @@ export const presetWebFontsAlephAlpha = (): Preset => ({
|
|
|
31
41
|
font-weight: 600;
|
|
32
42
|
src: url('${raleway600}') format('woff2');
|
|
33
43
|
}
|
|
34
|
-
/* raleway-700 - latin */
|
|
35
44
|
@font-face {
|
|
36
45
|
font-display: swap;
|
|
37
46
|
font-family: 'Raleway';
|
|
@@ -39,6 +48,8 @@ export const presetWebFontsAlephAlpha = (): Preset => ({
|
|
|
39
48
|
font-weight: 700;
|
|
40
49
|
src: url('${raleway700}') format('woff2');
|
|
41
50
|
}
|
|
51
|
+
|
|
52
|
+
/* Roboto fonts (legacy support) */
|
|
42
53
|
@font-face {
|
|
43
54
|
font-display: swap;
|
|
44
55
|
font-family: 'Roboto';
|
|
@@ -60,6 +71,59 @@ export const presetWebFontsAlephAlpha = (): Preset => ({
|
|
|
60
71
|
font-weight: 700;
|
|
61
72
|
src: url('${roboto700}') format('woff');
|
|
62
73
|
}
|
|
74
|
+
|
|
75
|
+
/* Montserrat fonts (new design system) */
|
|
76
|
+
@font-face {
|
|
77
|
+
font-display: swap;
|
|
78
|
+
font-family: 'Montserrat';
|
|
79
|
+
font-style: normal;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
src: url('${montserrat500}') format('woff2');
|
|
82
|
+
}
|
|
83
|
+
@font-face {
|
|
84
|
+
font-display: swap;
|
|
85
|
+
font-family: 'Montserrat';
|
|
86
|
+
font-style: normal;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
src: url('${montserrat600}') format('woff2');
|
|
89
|
+
}
|
|
90
|
+
@font-face {
|
|
91
|
+
font-display: swap;
|
|
92
|
+
font-family: 'Montserrat';
|
|
93
|
+
font-style: normal;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
src: url('${montserrat700}') format('woff2');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Inter fonts (new design system) */
|
|
99
|
+
@font-face {
|
|
100
|
+
font-display: swap;
|
|
101
|
+
font-family: 'Inter';
|
|
102
|
+
font-style: normal;
|
|
103
|
+
font-weight: 400;
|
|
104
|
+
src: url('${inter400}') format('woff2');
|
|
105
|
+
}
|
|
106
|
+
@font-face {
|
|
107
|
+
font-display: swap;
|
|
108
|
+
font-family: 'Inter';
|
|
109
|
+
font-style: normal;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
src: url('${inter500}') format('woff2');
|
|
112
|
+
}
|
|
113
|
+
@font-face {
|
|
114
|
+
font-display: swap;
|
|
115
|
+
font-family: 'Inter';
|
|
116
|
+
font-style: normal;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
src: url('${inter600}') format('woff2');
|
|
119
|
+
}
|
|
120
|
+
@font-face {
|
|
121
|
+
font-display: swap;
|
|
122
|
+
font-family: 'Inter';
|
|
123
|
+
font-style: normal;
|
|
124
|
+
font-weight: 700;
|
|
125
|
+
src: url('${inter700}') format('woff2');
|
|
126
|
+
}
|
|
63
127
|
`;
|
|
64
128
|
},
|
|
65
129
|
},
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
function convertWoff2ToTs(inputFile, outputFile) {
|
|
7
|
+
try {
|
|
8
|
+
// Read the woff2 file
|
|
9
|
+
const woff2Buffer = fs.readFileSync(inputFile);
|
|
10
|
+
|
|
11
|
+
// Convert to base64
|
|
12
|
+
const base64 = woff2Buffer.toString('base64');
|
|
13
|
+
|
|
14
|
+
// Extract the font name without extension for the const name
|
|
15
|
+
const fontName = path.basename(outputFile, '.ts').replace('.woff2', '');
|
|
16
|
+
|
|
17
|
+
// Create the TypeScript content
|
|
18
|
+
const tsContent = `export const ${fontName} =
|
|
19
|
+
'data:@file/octet-stream;base64,${base64}';`;
|
|
20
|
+
|
|
21
|
+
// Write the TypeScript file
|
|
22
|
+
fs.writeFileSync(outputFile, tsContent);
|
|
23
|
+
|
|
24
|
+
console.log(`✅ Converted ${inputFile} to ${outputFile}`);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(`❌ Error converting ${inputFile}:`, error.message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Get command line arguments
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
|
|
33
|
+
if (args.length < 2) {
|
|
34
|
+
console.log('Usage: node convert-fonts.js <input.woff2> <output.ts>');
|
|
35
|
+
console.log('Example: node convert-fonts.js montserrat600.woff2 montserrat600.woff2.ts');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const inputFile = args[0];
|
|
40
|
+
const outputFile = args[1];
|
|
41
|
+
|
|
42
|
+
// Check if input file exists
|
|
43
|
+
if (!fs.existsSync(inputFile)) {
|
|
44
|
+
console.error(`❌ Input file ${inputFile} does not exist`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
convertWoff2ToTs(inputFile, outputFile);
|