@webstudio-is/fonts 0.87.1 → 0.88.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/lib/cjs/font-data.js +2 -3
- package/lib/cjs/font-weights.js +9 -18
- package/lib/font-data.js +2 -3
- package/lib/font-weights.js +9 -18
- package/lib/types/font-weights.d.ts +9 -19
- package/package.json +2 -2
- package/src/font-data.ts +2 -3
- package/src/font-weights.ts +9 -21
package/lib/cjs/font-data.js
CHANGED
|
@@ -38,9 +38,8 @@ const parseSubfamily = (subfamily) => {
|
|
|
38
38
|
}
|
|
39
39
|
let weight = "400";
|
|
40
40
|
for (weight in import_font_weights.fontWeights) {
|
|
41
|
-
const {
|
|
42
|
-
|
|
43
|
-
if (subfamilyLow.includes(name) || subfamilyLow.includes(alt)) {
|
|
41
|
+
const { names } = import_font_weights.fontWeights[weight];
|
|
42
|
+
if (names.some((name) => subfamilyLow.includes(name))) {
|
|
44
43
|
break;
|
|
45
44
|
}
|
|
46
45
|
}
|
package/lib/cjs/font-weights.js
CHANGED
|
@@ -24,47 +24,38 @@ module.exports = __toCommonJS(font_weights_exports);
|
|
|
24
24
|
const fontWeights = {
|
|
25
25
|
"100": {
|
|
26
26
|
label: "Thin",
|
|
27
|
-
|
|
28
|
-
alt: "hairline"
|
|
27
|
+
names: ["thin", "hairline"]
|
|
29
28
|
},
|
|
30
29
|
"200": {
|
|
31
30
|
label: "Extra Light",
|
|
32
|
-
|
|
33
|
-
alt: "ultra light"
|
|
31
|
+
names: ["extra light", "extralight", "ultra light", "ultralight"]
|
|
34
32
|
},
|
|
35
33
|
"300": {
|
|
36
34
|
label: "Light",
|
|
37
|
-
|
|
38
|
-
alt: "light"
|
|
35
|
+
names: ["light"]
|
|
39
36
|
},
|
|
40
37
|
"400": {
|
|
41
38
|
label: "Normal",
|
|
42
|
-
|
|
43
|
-
alt: "normal"
|
|
39
|
+
names: ["normal", "regular"]
|
|
44
40
|
},
|
|
45
41
|
"500": {
|
|
46
42
|
label: "Medium",
|
|
47
|
-
|
|
48
|
-
alt: "medium"
|
|
43
|
+
names: ["medium"]
|
|
49
44
|
},
|
|
50
45
|
"600": {
|
|
51
46
|
label: "Semi Bold",
|
|
52
|
-
|
|
53
|
-
alt: "demi bold"
|
|
47
|
+
names: ["semi bold", "semibold", "demi bold", "demibold"]
|
|
54
48
|
},
|
|
55
49
|
"700": {
|
|
56
50
|
label: "Bold",
|
|
57
|
-
|
|
58
|
-
alt: "bold"
|
|
51
|
+
names: ["bold", "bold"]
|
|
59
52
|
},
|
|
60
53
|
"800": {
|
|
61
54
|
label: "Extra Bold",
|
|
62
|
-
|
|
63
|
-
alt: "ultra bold"
|
|
55
|
+
names: ["extra bold", "extrabold", "ultra bold", "ultrabold"]
|
|
64
56
|
},
|
|
65
57
|
"900": {
|
|
66
58
|
label: "Black",
|
|
67
|
-
|
|
68
|
-
alt: "heavy"
|
|
59
|
+
names: ["black", "heavy"]
|
|
69
60
|
}
|
|
70
61
|
};
|
package/lib/font-data.js
CHANGED
|
@@ -12,9 +12,8 @@ const parseSubfamily = (subfamily) => {
|
|
|
12
12
|
}
|
|
13
13
|
let weight = "400";
|
|
14
14
|
for (weight in fontWeights) {
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
if (subfamilyLow.includes(name) || subfamilyLow.includes(alt)) {
|
|
15
|
+
const { names } = fontWeights[weight];
|
|
16
|
+
if (names.some((name) => subfamilyLow.includes(name))) {
|
|
18
17
|
break;
|
|
19
18
|
}
|
|
20
19
|
}
|
package/lib/font-weights.js
CHANGED
|
@@ -1,48 +1,39 @@
|
|
|
1
1
|
const fontWeights = {
|
|
2
2
|
"100": {
|
|
3
3
|
label: "Thin",
|
|
4
|
-
|
|
5
|
-
alt: "hairline"
|
|
4
|
+
names: ["thin", "hairline"]
|
|
6
5
|
},
|
|
7
6
|
"200": {
|
|
8
7
|
label: "Extra Light",
|
|
9
|
-
|
|
10
|
-
alt: "ultra light"
|
|
8
|
+
names: ["extra light", "extralight", "ultra light", "ultralight"]
|
|
11
9
|
},
|
|
12
10
|
"300": {
|
|
13
11
|
label: "Light",
|
|
14
|
-
|
|
15
|
-
alt: "light"
|
|
12
|
+
names: ["light"]
|
|
16
13
|
},
|
|
17
14
|
"400": {
|
|
18
15
|
label: "Normal",
|
|
19
|
-
|
|
20
|
-
alt: "normal"
|
|
16
|
+
names: ["normal", "regular"]
|
|
21
17
|
},
|
|
22
18
|
"500": {
|
|
23
19
|
label: "Medium",
|
|
24
|
-
|
|
25
|
-
alt: "medium"
|
|
20
|
+
names: ["medium"]
|
|
26
21
|
},
|
|
27
22
|
"600": {
|
|
28
23
|
label: "Semi Bold",
|
|
29
|
-
|
|
30
|
-
alt: "demi bold"
|
|
24
|
+
names: ["semi bold", "semibold", "demi bold", "demibold"]
|
|
31
25
|
},
|
|
32
26
|
"700": {
|
|
33
27
|
label: "Bold",
|
|
34
|
-
|
|
35
|
-
alt: "bold"
|
|
28
|
+
names: ["bold", "bold"]
|
|
36
29
|
},
|
|
37
30
|
"800": {
|
|
38
31
|
label: "Extra Bold",
|
|
39
|
-
|
|
40
|
-
alt: "ultra bold"
|
|
32
|
+
names: ["extra bold", "extrabold", "ultra bold", "ultrabold"]
|
|
41
33
|
},
|
|
42
34
|
"900": {
|
|
43
35
|
label: "Black",
|
|
44
|
-
|
|
45
|
-
alt: "heavy"
|
|
36
|
+
names: ["black", "heavy"]
|
|
46
37
|
}
|
|
47
38
|
};
|
|
48
39
|
export {
|
|
@@ -1,49 +1,39 @@
|
|
|
1
1
|
export declare const fontWeights: {
|
|
2
2
|
readonly "100": {
|
|
3
3
|
readonly label: "Thin";
|
|
4
|
-
readonly
|
|
5
|
-
readonly alt: "hairline";
|
|
4
|
+
readonly names: readonly ["thin", "hairline"];
|
|
6
5
|
};
|
|
7
6
|
readonly "200": {
|
|
8
7
|
readonly label: "Extra Light";
|
|
9
|
-
readonly
|
|
10
|
-
readonly alt: "ultra light";
|
|
8
|
+
readonly names: readonly ["extra light", "extralight", "ultra light", "ultralight"];
|
|
11
9
|
};
|
|
12
10
|
readonly "300": {
|
|
13
11
|
readonly label: "Light";
|
|
14
|
-
readonly
|
|
15
|
-
readonly alt: "light";
|
|
12
|
+
readonly names: readonly ["light"];
|
|
16
13
|
};
|
|
17
14
|
readonly "400": {
|
|
18
15
|
readonly label: "Normal";
|
|
19
|
-
readonly
|
|
20
|
-
readonly alt: "normal";
|
|
16
|
+
readonly names: readonly ["normal", "regular"];
|
|
21
17
|
};
|
|
22
18
|
readonly "500": {
|
|
23
19
|
readonly label: "Medium";
|
|
24
|
-
readonly
|
|
25
|
-
readonly alt: "medium";
|
|
20
|
+
readonly names: readonly ["medium"];
|
|
26
21
|
};
|
|
27
22
|
readonly "600": {
|
|
28
23
|
readonly label: "Semi Bold";
|
|
29
|
-
readonly
|
|
30
|
-
readonly alt: "demi bold";
|
|
24
|
+
readonly names: readonly ["semi bold", "semibold", "demi bold", "demibold"];
|
|
31
25
|
};
|
|
32
26
|
readonly "700": {
|
|
33
27
|
readonly label: "Bold";
|
|
34
|
-
readonly
|
|
35
|
-
readonly alt: "bold";
|
|
28
|
+
readonly names: readonly ["bold", "bold"];
|
|
36
29
|
};
|
|
37
30
|
readonly "800": {
|
|
38
31
|
readonly label: "Extra Bold";
|
|
39
|
-
readonly
|
|
40
|
-
readonly alt: "ultra bold";
|
|
32
|
+
readonly names: readonly ["extra bold", "extrabold", "ultra bold", "ultrabold"];
|
|
41
33
|
};
|
|
42
34
|
readonly "900": {
|
|
43
35
|
readonly label: "Black";
|
|
44
|
-
readonly
|
|
45
|
-
readonly alt: "heavy";
|
|
36
|
+
readonly names: readonly ["black", "heavy"];
|
|
46
37
|
};
|
|
47
38
|
};
|
|
48
39
|
export type FontWeight = keyof typeof fontWeights;
|
|
49
|
-
export type FontWeightKeyword = (typeof fontWeights)[FontWeight]["name"] | (typeof fontWeights)[FontWeight]["alt"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/fonts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Fonts utils",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"jest": "^29.6.2",
|
|
15
15
|
"typescript": "5.1.6",
|
|
16
16
|
"zod": "^3.21.4",
|
|
17
|
-
"@webstudio-is/design-system": "^0.
|
|
17
|
+
"@webstudio-is/design-system": "^0.88.0",
|
|
18
18
|
"@webstudio-is/jest-config": "^1.0.7",
|
|
19
19
|
"@webstudio-is/scripts": "^0.0.0",
|
|
20
20
|
"@webstudio-is/tsconfig": "^1.0.7"
|
package/src/font-data.ts
CHANGED
|
@@ -25,9 +25,8 @@ export const parseSubfamily = (subfamily: string) => {
|
|
|
25
25
|
}
|
|
26
26
|
let weight: FontWeight = "400";
|
|
27
27
|
for (weight in fontWeights) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
if (subfamilyLow.includes(name) || subfamilyLow.includes(alt)) {
|
|
28
|
+
const { names } = fontWeights[weight];
|
|
29
|
+
if (names.some((name) => subfamilyLow.includes(name))) {
|
|
31
30
|
break;
|
|
32
31
|
}
|
|
33
32
|
}
|
package/src/font-weights.ts
CHANGED
|
@@ -1,52 +1,40 @@
|
|
|
1
1
|
export const fontWeights = {
|
|
2
2
|
"100": {
|
|
3
3
|
label: "Thin",
|
|
4
|
-
|
|
5
|
-
alt: "hairline",
|
|
4
|
+
names: ["thin", "hairline"],
|
|
6
5
|
},
|
|
7
6
|
"200": {
|
|
8
7
|
label: "Extra Light",
|
|
9
|
-
|
|
10
|
-
alt: "ultra light",
|
|
8
|
+
names: ["extra light", "extralight", "ultra light", "ultralight"],
|
|
11
9
|
},
|
|
12
10
|
"300": {
|
|
13
11
|
label: "Light",
|
|
14
|
-
|
|
15
|
-
alt: "light",
|
|
12
|
+
names: ["light"],
|
|
16
13
|
},
|
|
17
14
|
"400": {
|
|
18
15
|
label: "Normal",
|
|
19
|
-
|
|
20
|
-
alt: "normal",
|
|
16
|
+
names: ["normal", "regular"],
|
|
21
17
|
},
|
|
22
18
|
"500": {
|
|
23
19
|
label: "Medium",
|
|
24
|
-
|
|
25
|
-
alt: "medium",
|
|
20
|
+
names: ["medium"],
|
|
26
21
|
},
|
|
27
22
|
"600": {
|
|
28
23
|
label: "Semi Bold",
|
|
29
|
-
|
|
30
|
-
alt: "demi bold",
|
|
24
|
+
names: ["semi bold", "semibold", "demi bold", "demibold"],
|
|
31
25
|
},
|
|
32
26
|
"700": {
|
|
33
27
|
label: "Bold",
|
|
34
|
-
|
|
35
|
-
alt: "bold",
|
|
28
|
+
names: ["bold", "bold"],
|
|
36
29
|
},
|
|
37
30
|
"800": {
|
|
38
31
|
label: "Extra Bold",
|
|
39
|
-
|
|
40
|
-
alt: "ultra bold",
|
|
32
|
+
names: ["extra bold", "extrabold", "ultra bold", "ultrabold"],
|
|
41
33
|
},
|
|
42
34
|
"900": {
|
|
43
35
|
label: "Black",
|
|
44
|
-
|
|
45
|
-
alt: "heavy",
|
|
36
|
+
names: ["black", "heavy"],
|
|
46
37
|
},
|
|
47
38
|
} as const;
|
|
48
39
|
|
|
49
40
|
export type FontWeight = keyof typeof fontWeights;
|
|
50
|
-
export type FontWeightKeyword =
|
|
51
|
-
| (typeof fontWeights)[FontWeight]["name"]
|
|
52
|
-
| (typeof fontWeights)[FontWeight]["alt"];
|