@webstudio-is/fonts 0.1.1 → 0.3.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/constants.cjs +40 -0
- package/lib/cjs/font-data.cjs +70 -0
- package/lib/cjs/font-weights.cjs +70 -0
- package/lib/cjs/get-font-faces.cjs +51 -0
- package/lib/cjs/index.cjs +21 -0
- package/lib/cjs/index.server.cjs +24 -0
- package/lib/cjs/schema.cjs +37 -0
- package/lib/constants.js +18 -17
- package/lib/font-data.js +42 -48
- package/lib/font-weights.js +49 -49
- package/lib/get-font-faces.js +25 -28
- package/lib/index.js +4 -20
- package/lib/index.server.js +3 -19
- package/lib/schema.js +16 -9
- package/package.json +20 -19
- package/src/__snapshots__/get-font-faces.test.ts.snap +51 -0
- package/src/constants.ts +21 -0
- package/src/font-data.test.ts +69 -0
- package/src/font-data.ts +74 -0
- package/src/font-weights.ts +52 -0
- package/src/get-font-faces.test.ts +75 -0
- package/src/get-font-faces.ts +53 -0
- package/src/index.server.ts +1 -0
- package/{lib/index.d.ts → src/index.ts} +1 -2
- package/src/schema.ts +17 -0
- package/lib/constants.d.ts +0 -6
- package/lib/constants.d.ts.map +0 -1
- package/lib/font-data.d.ts +0 -23
- package/lib/font-data.d.ts.map +0 -1
- package/lib/font-data.test.d.ts +0 -2
- package/lib/font-data.test.d.ts.map +0 -1
- package/lib/font-data.test.js +0 -67
- package/lib/font-weights.d.ts +0 -50
- package/lib/font-weights.d.ts.map +0 -1
- package/lib/get-font-faces.d.ts +0 -16
- package/lib/get-font-faces.d.ts.map +0 -1
- package/lib/get-font-faces.test.d.ts +0 -2
- package/lib/get-font-faces.test.d.ts.map +0 -1
- package/lib/get-font-faces.test.js +0 -74
- package/lib/index.d.ts.map +0 -1
- package/lib/index.server.d.ts +0 -3
- package/lib/index.server.d.ts.map +0 -1
- package/lib/schema.d.ts +0 -16
- package/lib/schema.d.ts.map +0 -1
- package/lib/types.d.ts +0 -2
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -2
package/lib/font-weights.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export declare const fontWeights: {
|
|
2
|
-
readonly "100": {
|
|
3
|
-
readonly label: "Thin";
|
|
4
|
-
readonly name: "thin";
|
|
5
|
-
readonly alt: "hairline";
|
|
6
|
-
};
|
|
7
|
-
readonly "200": {
|
|
8
|
-
readonly label: "Extra Light";
|
|
9
|
-
readonly name: "extra light";
|
|
10
|
-
readonly alt: "ultra light";
|
|
11
|
-
};
|
|
12
|
-
readonly "300": {
|
|
13
|
-
readonly label: "Light";
|
|
14
|
-
readonly name: "light";
|
|
15
|
-
readonly alt: "light";
|
|
16
|
-
};
|
|
17
|
-
readonly "400": {
|
|
18
|
-
readonly label: "Normal";
|
|
19
|
-
readonly name: "normal";
|
|
20
|
-
readonly alt: "normal";
|
|
21
|
-
};
|
|
22
|
-
readonly "500": {
|
|
23
|
-
readonly label: "Medium";
|
|
24
|
-
readonly name: "medium";
|
|
25
|
-
readonly alt: "medium";
|
|
26
|
-
};
|
|
27
|
-
readonly "600": {
|
|
28
|
-
readonly label: "Semi Bold";
|
|
29
|
-
readonly name: "semi bold";
|
|
30
|
-
readonly alt: "demi bold";
|
|
31
|
-
};
|
|
32
|
-
readonly "700": {
|
|
33
|
-
readonly label: "Bold";
|
|
34
|
-
readonly name: "bold";
|
|
35
|
-
readonly alt: "bold";
|
|
36
|
-
};
|
|
37
|
-
readonly "800": {
|
|
38
|
-
readonly label: "Extra Bold";
|
|
39
|
-
readonly name: "extra bold";
|
|
40
|
-
readonly alt: "ultra bold";
|
|
41
|
-
};
|
|
42
|
-
readonly "900": {
|
|
43
|
-
readonly label: "Black";
|
|
44
|
-
readonly name: "black";
|
|
45
|
-
readonly alt: "heavy";
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export declare type FontWeight = keyof typeof fontWeights;
|
|
49
|
-
export declare type FontWeightKeyword = typeof fontWeights[FontWeight]["name"] | typeof fontWeights[FontWeight]["alt"];
|
|
50
|
-
//# sourceMappingURL=font-weights.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"font-weights.d.ts","sourceRoot":"","sources":["../src/font-weights.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Cd,CAAC;AAEX,oBAAY,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAClD,oBAAY,iBAAiB,GACzB,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GACtC,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC"}
|
package/lib/get-font-faces.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FontMeta } from "./schema";
|
|
2
|
-
import type { FontFormat } from "./types";
|
|
3
|
-
export declare type PartialFontAsset = {
|
|
4
|
-
format: FontFormat;
|
|
5
|
-
meta: FontMeta;
|
|
6
|
-
path: string;
|
|
7
|
-
};
|
|
8
|
-
export declare type FontFace = {
|
|
9
|
-
fontFamily: string;
|
|
10
|
-
fontStyle: FontMeta["style"];
|
|
11
|
-
fontWeight: number;
|
|
12
|
-
fontDisplay: "swap" | "auto" | "block" | "fallback" | "optional";
|
|
13
|
-
src: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const getFontFaces: (assets: Array<PartialFontAsset>) => Array<FontFace>;
|
|
16
|
-
//# sourceMappingURL=get-font-faces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-font-faces.d.ts","sourceRoot":"","sources":["../src/get-font-faces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;IACjE,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAeF,eAAO,MAAM,YAAY,WACf,MAAM,gBAAgB,CAAC,KAC9B,MAAM,QAAQ,CAoBhB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-font-faces.test.d.ts","sourceRoot":"","sources":["../src/get-font-faces.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const get_font_faces_1 = require("./get-font-faces");
|
|
4
|
-
describe("getFontFaces()", () => {
|
|
5
|
-
test("different formats", () => {
|
|
6
|
-
const assets = [
|
|
7
|
-
{
|
|
8
|
-
format: "woff",
|
|
9
|
-
meta: {
|
|
10
|
-
family: "Roboto",
|
|
11
|
-
style: "normal",
|
|
12
|
-
weight: 400,
|
|
13
|
-
},
|
|
14
|
-
path: "/fonts/roboto.woff",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
format: "ttf",
|
|
18
|
-
meta: {
|
|
19
|
-
family: "Roboto",
|
|
20
|
-
style: "normal",
|
|
21
|
-
weight: 400,
|
|
22
|
-
},
|
|
23
|
-
path: "/fonts/roboto.ttf",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
expect((0, get_font_faces_1.getFontFaces)(assets)).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
test("different style", () => {
|
|
29
|
-
const assets = [
|
|
30
|
-
{
|
|
31
|
-
format: "ttf",
|
|
32
|
-
meta: {
|
|
33
|
-
family: "Roboto",
|
|
34
|
-
style: "normal",
|
|
35
|
-
weight: 400,
|
|
36
|
-
},
|
|
37
|
-
path: "/fonts/roboto.ttf",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
format: "ttf",
|
|
41
|
-
meta: {
|
|
42
|
-
family: "Roboto",
|
|
43
|
-
style: "italic",
|
|
44
|
-
weight: 400,
|
|
45
|
-
},
|
|
46
|
-
path: "/fonts/roboto-italic.ttf",
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
expect((0, get_font_faces_1.getFontFaces)(assets)).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
test("different weight", () => {
|
|
52
|
-
const assets = [
|
|
53
|
-
{
|
|
54
|
-
format: "ttf",
|
|
55
|
-
meta: {
|
|
56
|
-
family: "Roboto",
|
|
57
|
-
style: "normal",
|
|
58
|
-
weight: 400,
|
|
59
|
-
},
|
|
60
|
-
path: "/fonts/roboto.ttf",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
format: "ttf",
|
|
64
|
-
meta: {
|
|
65
|
-
family: "Roboto",
|
|
66
|
-
style: "normal",
|
|
67
|
-
weight: 500,
|
|
68
|
-
},
|
|
69
|
-
path: "/fonts/roboto-bold.ttf",
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
expect((0, get_font_faces_1.getFontFaces)(assets)).toMatchSnapshot();
|
|
73
|
-
});
|
|
74
|
-
});
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
package/lib/index.server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,cAAc,UAAU,CAAC"}
|
package/lib/schema.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const FontMeta: z.ZodObject<{
|
|
3
|
-
family: z.ZodString;
|
|
4
|
-
style: z.ZodEnum<["normal", "italic", "oblique"]>;
|
|
5
|
-
weight: z.ZodNumber;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
family: string;
|
|
8
|
-
style: "normal" | "italic" | "oblique";
|
|
9
|
-
weight: number;
|
|
10
|
-
}, {
|
|
11
|
-
family: string;
|
|
12
|
-
style: "normal" | "italic" | "oblique";
|
|
13
|
-
weight: number;
|
|
14
|
-
}>;
|
|
15
|
-
export declare type FontMeta = z.infer<typeof FontMeta>;
|
|
16
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/lib/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;EAInB,CAAC;AACH,oBAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
package/lib/types.d.ts
DELETED
package/lib/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC"}
|
package/lib/types.js
DELETED