@webstudio-is/fonts 0.189.0 → 0.191.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 +3 -5
- package/lib/index.js +0 -396
- package/lib/types/constants.d.ts +0 -10
- package/lib/types/font-weights.d.ts +0 -40
- package/lib/types/get-font-faces.d.ts +0 -17
- package/lib/types/get-font-faces.test.d.ts +0 -1
- package/lib/types/index.d.ts +0 -4
- package/lib/types/schema.d.ts +0 -83
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/fonts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.191.4",
|
|
4
4
|
"description": "Fonts utils",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"
|
|
10
|
-
"typescript": "5.6.3",
|
|
9
|
+
"vitest": "^2.1.8",
|
|
11
10
|
"zod": "^3.22.4",
|
|
12
|
-
"@webstudio-is/jest-config": "1.0.7",
|
|
13
11
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
14
12
|
},
|
|
15
13
|
"peerDependencies": {
|
|
@@ -29,7 +27,7 @@
|
|
|
29
27
|
"sideEffects": false,
|
|
30
28
|
"scripts": {
|
|
31
29
|
"typecheck": "tsc",
|
|
32
|
-
"test": "
|
|
30
|
+
"test": "vitest run",
|
|
33
31
|
"build": "rm -rf lib && esbuild src/index.ts --outdir=lib --bundle --format=esm --packages=external",
|
|
34
32
|
"dts": "tsc --project tsconfig.dts.json"
|
|
35
33
|
}
|
package/lib/index.js
DELETED
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
// src/constants.ts
|
|
2
|
-
var SYSTEM_FONTS = /* @__PURE__ */ new Map([
|
|
3
|
-
[
|
|
4
|
-
"System UI",
|
|
5
|
-
{
|
|
6
|
-
stack: ["system-ui", "sans-serif"],
|
|
7
|
-
description: "System UI fonts are those native to the operating system interface. They are highly legible and easy to read at small sizes, contains many font weights, and is ideal for UI elements."
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
// Modern font stacks
|
|
11
|
-
// https://github.com/system-fonts/modern-font-stacks
|
|
12
|
-
[
|
|
13
|
-
"Transitional",
|
|
14
|
-
{
|
|
15
|
-
stack: ["Charter", "Bitstream Charter", "Sitka Text", "Cambria", "serif"],
|
|
16
|
-
description: "Transitional typefaces are a mix between Old Style and Modern typefaces that was developed during The Enlightenment. One of the most famous examples of a Transitional typeface is Times New Roman, which was developed for the Times of London newspaper."
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
"Old Style",
|
|
21
|
-
{
|
|
22
|
-
stack: [
|
|
23
|
-
"Iowan Old Style",
|
|
24
|
-
"Palatino Linotype",
|
|
25
|
-
"URW Palladio L",
|
|
26
|
-
"P052",
|
|
27
|
-
"serif"
|
|
28
|
-
],
|
|
29
|
-
description: "Old Style typefaces are characterized by diagonal stress, low contrast between thick and thin strokes, and rounded serifs, and were developed in the Renaissance period. One of the most famous examples of an Old Style typeface is Garamond."
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
"Humanist",
|
|
34
|
-
{
|
|
35
|
-
stack: [
|
|
36
|
-
"Seravek",
|
|
37
|
-
"Gill Sans Nova",
|
|
38
|
-
"Ubuntu",
|
|
39
|
-
"Calibri",
|
|
40
|
-
"DejaVu Sans",
|
|
41
|
-
"source-sans-pro",
|
|
42
|
-
"sans-serif"
|
|
43
|
-
],
|
|
44
|
-
description: "Humanist typefaces are characterized by their organic, calligraphic forms and low contrast between thick and thin strokes. These typefaces are inspired by the handwriting of the Renaissance period and are often considered to be more legible and easier to read than other sans-serif typefaces."
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
[
|
|
48
|
-
"Geometric Humanist",
|
|
49
|
-
{
|
|
50
|
-
stack: [
|
|
51
|
-
"Avenir",
|
|
52
|
-
"Montserrat",
|
|
53
|
-
"Corbel",
|
|
54
|
-
"URW Gothic",
|
|
55
|
-
"source-sans-pro",
|
|
56
|
-
"sans-serif"
|
|
57
|
-
],
|
|
58
|
-
description: "Geometric Humanist typefaces are characterized by their clean, geometric forms and uniform stroke widths. These typefaces are often considered to be modern and sleek in appearance, and are often used for headlines and other display purposes. Futura is a famous example of this classification."
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
"Classical Humanist",
|
|
63
|
-
{
|
|
64
|
-
stack: [
|
|
65
|
-
"Optima",
|
|
66
|
-
"Candara",
|
|
67
|
-
"Noto Sans",
|
|
68
|
-
"source-sans-pro",
|
|
69
|
-
"sans-serif"
|
|
70
|
-
],
|
|
71
|
-
description: "Classical Humanist typefaces are characterized by how the strokes subtly widen as they reach the stroke terminals without ending in a serif. These typefaces are inspired by classical Roman capitals and the stone-carving on Renaissance-period tombstones."
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
[
|
|
75
|
-
"Neo-Grotesque",
|
|
76
|
-
{
|
|
77
|
-
stack: [
|
|
78
|
-
"Inter",
|
|
79
|
-
"Roboto",
|
|
80
|
-
"Helvetica Neue",
|
|
81
|
-
"Arial Nova",
|
|
82
|
-
"Nimbus Sans",
|
|
83
|
-
"Arial",
|
|
84
|
-
"sans-serif"
|
|
85
|
-
],
|
|
86
|
-
description: "Neo-Grotesque typefaces are a style of sans-serif that was developed in the late 19th and early 20th centuries and is characterized by its clean, geometric forms and uniform stroke widths. One of the most famous examples of a Neo-Grotesque typeface is Helvetica."
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
"Monospace Slab Serif",
|
|
91
|
-
{
|
|
92
|
-
stack: ["Nimbus Mono PS", "Courier New", "monospace"],
|
|
93
|
-
description: "Monospace Slab Serif typefaces are characterized by their fixed-width letters, which have the same width regardless of their shape, and its simple, geometric forms. Used to emulate typewriter output for reports, tabular work and technical documentation."
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
[
|
|
97
|
-
"Monospace Code",
|
|
98
|
-
{
|
|
99
|
-
stack: [
|
|
100
|
-
"ui-monospace",
|
|
101
|
-
"Cascadia Code",
|
|
102
|
-
"Source Code Pro",
|
|
103
|
-
"Menlo",
|
|
104
|
-
"Consolas",
|
|
105
|
-
"DejaVu Sans Mono",
|
|
106
|
-
"monospace"
|
|
107
|
-
],
|
|
108
|
-
description: "Monospace Code typefaces are specifically designed for use in programming and other technical applications. These typefaces are characterized by their monospaced design, which means that all letters and characters have the same width, and their clear, legible forms."
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"Industrial",
|
|
113
|
-
{
|
|
114
|
-
stack: [
|
|
115
|
-
"Bahnschrift",
|
|
116
|
-
"DIN Alternate",
|
|
117
|
-
"Franklin Gothic Medium",
|
|
118
|
-
"Nimbus Sans Narrow",
|
|
119
|
-
"sans-serif-condensed",
|
|
120
|
-
"sans-serif"
|
|
121
|
-
],
|
|
122
|
-
description: "Industrial typefaces originated in the late 19th century and was heavily influenced by the advancements in technology and industry during that time. Industrial typefaces are characterized by their bold, sans-serif letterforms, simple and straightforward appearance, and the use of straight lines and geometric shapes."
|
|
123
|
-
}
|
|
124
|
-
],
|
|
125
|
-
[
|
|
126
|
-
"Rounded Sans",
|
|
127
|
-
{
|
|
128
|
-
stack: [
|
|
129
|
-
"ui-rounded",
|
|
130
|
-
"Hiragino Maru Gothic ProN",
|
|
131
|
-
"Quicksand",
|
|
132
|
-
"Comfortaa",
|
|
133
|
-
"Manjari",
|
|
134
|
-
"Arial Rounded MT",
|
|
135
|
-
"Arial Rounded MT Bold",
|
|
136
|
-
"Calibri",
|
|
137
|
-
"source-sans-pro",
|
|
138
|
-
"sans-serif"
|
|
139
|
-
],
|
|
140
|
-
description: "Rounded typefaces are characterized by the rounded curved letterforms and give a softer, friendlier appearance. The rounded edges give the typeface a more organic and playful feel, making it suitable for use in informal or child-friendly designs. The rounded sans-serif style has been popular since the 1950s, and it continues to be widely used in advertising, branding, and other forms of graphic design."
|
|
141
|
-
}
|
|
142
|
-
],
|
|
143
|
-
[
|
|
144
|
-
"Slab Serif",
|
|
145
|
-
{
|
|
146
|
-
stack: [
|
|
147
|
-
"Rockwell",
|
|
148
|
-
"Rockwell Nova",
|
|
149
|
-
"Roboto Slab",
|
|
150
|
-
"DejaVu Serif",
|
|
151
|
-
"Sitka Small",
|
|
152
|
-
"serif"
|
|
153
|
-
],
|
|
154
|
-
description: "Slab Serif typefaces are characterized by the presence of thick, block-like serifs on the ends of each letterform. These serifs are usually unbracketed, meaning they do not have any curved or tapered transitions to the main stroke of the letter."
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
[
|
|
158
|
-
"Antique",
|
|
159
|
-
{
|
|
160
|
-
stack: [
|
|
161
|
-
"Superclarendon",
|
|
162
|
-
"Bookman Old Style",
|
|
163
|
-
"URW Bookman",
|
|
164
|
-
"URW Bookman L",
|
|
165
|
-
"Georgia Pro",
|
|
166
|
-
"Georgia",
|
|
167
|
-
"serif"
|
|
168
|
-
],
|
|
169
|
-
description: "Antique typefaces, also known as Egyptians, are a subset of serif typefaces that were popular in the 19th century. They are characterized by their block-like serifs and thick uniform stroke weight."
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
"Didone",
|
|
174
|
-
{
|
|
175
|
-
stack: [
|
|
176
|
-
"Didot",
|
|
177
|
-
"Bodoni MT",
|
|
178
|
-
"Noto Serif Display",
|
|
179
|
-
"URW Palladio L",
|
|
180
|
-
"P052",
|
|
181
|
-
"Sylfaen",
|
|
182
|
-
"serif"
|
|
183
|
-
],
|
|
184
|
-
description: "Didone typefaces, also known as Modern typefaces, are characterized by the high contrast between thick and thin strokes, vertical stress, and hairline serifs with no bracketing. The Didone style emerged in the late 18th century and gained popularity during the 19th century."
|
|
185
|
-
}
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
"Handwritten",
|
|
189
|
-
{
|
|
190
|
-
stack: [
|
|
191
|
-
"Segoe Print",
|
|
192
|
-
"Bradley Hand",
|
|
193
|
-
"Chilanka",
|
|
194
|
-
"TSCu_Comic",
|
|
195
|
-
"casual",
|
|
196
|
-
"cursive"
|
|
197
|
-
],
|
|
198
|
-
description: "Handwritten typefaces are designed to mimic the look and feel of handwriting. Despite the vast array of handwriting styles, this font stack tend to adopt a more informal and everyday style of handwriting."
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
[
|
|
202
|
-
"Arial",
|
|
203
|
-
{
|
|
204
|
-
stack: ["Arial", "Roboto", "sans-serif"],
|
|
205
|
-
description: "A clean, sans-serif font designed for legibility and versatility. Ideal for modern, minimalistic designs or digital content that requires simplicity."
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
[
|
|
209
|
-
"Times New Roman",
|
|
210
|
-
{
|
|
211
|
-
stack: ["Times New Roman", "sans"],
|
|
212
|
-
description: "A classic serif font known for its formal, professional appearance. Best suited for traditional documents, reports, and academic writing."
|
|
213
|
-
}
|
|
214
|
-
],
|
|
215
|
-
[
|
|
216
|
-
"Courier New",
|
|
217
|
-
{
|
|
218
|
-
stack: ["Courier New", "monospace"],
|
|
219
|
-
description: "A monospaced serif font with uniform spacing, mimicking typewriter text. Perfect for coding, technical documents, or retro-styled designs."
|
|
220
|
-
}
|
|
221
|
-
],
|
|
222
|
-
// Chineese fonts
|
|
223
|
-
[
|
|
224
|
-
"SimSun",
|
|
225
|
-
{
|
|
226
|
-
stack: ["SimSun", "Songti SC, sans-serif"],
|
|
227
|
-
description: "A traditional serif font designed for Chinese characters, offering clear and readable text. Ideal for formal Chinese documents or multilingual content requiring both Chinese and Latin text."
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
[
|
|
231
|
-
"PingFang SC",
|
|
232
|
-
{
|
|
233
|
-
stack: ["PingFang SC", "Microsoft Ya Hei", "sans-serif"],
|
|
234
|
-
description: "A modern sans-serif font designed for simplified Chinese characters. Sleek and clean, it\u2019s best for digital content and interfaces where modern, streamlined design is needed."
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
]);
|
|
238
|
-
var DEFAULT_FONT_FALLBACK = "sans-serif";
|
|
239
|
-
var FONT_FORMATS = /* @__PURE__ */ new Map([
|
|
240
|
-
["woff", "woff"],
|
|
241
|
-
["woff2", "woff2"],
|
|
242
|
-
["ttf", "truetype"]
|
|
243
|
-
]);
|
|
244
|
-
var FONT_MIME_TYPES = Array.from(FONT_FORMATS.keys()).map((format) => `.${format}`).join(", ");
|
|
245
|
-
var FONT_STYLES = ["normal", "italic", "oblique"];
|
|
246
|
-
|
|
247
|
-
// src/get-font-faces.ts
|
|
248
|
-
var sanitizeCssUrl = (str) => JSON.stringify(str);
|
|
249
|
-
var formatFace = (asset, format, url) => {
|
|
250
|
-
if ("variationAxes" in asset.meta) {
|
|
251
|
-
const { wght, wdth } = asset.meta?.variationAxes ?? {};
|
|
252
|
-
return {
|
|
253
|
-
fontFamily: asset.meta.family,
|
|
254
|
-
fontStyle: "normal",
|
|
255
|
-
fontDisplay: "swap",
|
|
256
|
-
src: `url(${sanitizeCssUrl(url)}) format("${format}")`,
|
|
257
|
-
fontStretch: wdth ? `${wdth.min}% ${wdth.max}%` : void 0,
|
|
258
|
-
fontWeight: wght ? `${wght.min} ${wght.max}` : void 0
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
return {
|
|
262
|
-
fontFamily: asset.meta.family,
|
|
263
|
-
fontStyle: asset.meta.style,
|
|
264
|
-
fontWeight: asset.meta.weight,
|
|
265
|
-
fontDisplay: "swap",
|
|
266
|
-
src: `url(${sanitizeCssUrl(url)}) format("${format}")`
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
var getKey = (asset) => {
|
|
270
|
-
if ("variationAxes" in asset.meta) {
|
|
271
|
-
return asset.meta.family + Object.values(asset.meta.variationAxes).join("");
|
|
272
|
-
}
|
|
273
|
-
return asset.meta.family + asset.meta.style + asset.meta.weight;
|
|
274
|
-
};
|
|
275
|
-
var getFontFaces = (assets, options) => {
|
|
276
|
-
const { assetBaseUrl } = options;
|
|
277
|
-
const faces = /* @__PURE__ */ new Map();
|
|
278
|
-
for (const asset of assets) {
|
|
279
|
-
const url = `${assetBaseUrl}${asset.name}`;
|
|
280
|
-
const assetKey = getKey(asset);
|
|
281
|
-
const face = faces.get(assetKey);
|
|
282
|
-
const format = FONT_FORMATS.get(asset.format);
|
|
283
|
-
if (format === void 0) {
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
if (face === void 0) {
|
|
287
|
-
const face2 = formatFace(asset, format, url);
|
|
288
|
-
faces.set(assetKey, face2);
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
face.src += `, url(${sanitizeCssUrl(url)}) format("${format}")`;
|
|
292
|
-
}
|
|
293
|
-
return Array.from(faces.values());
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// src/schema.ts
|
|
297
|
-
import { z } from "zod";
|
|
298
|
-
var FontFormat = z.union([
|
|
299
|
-
z.literal("ttf"),
|
|
300
|
-
z.literal("woff"),
|
|
301
|
-
z.literal("woff2")
|
|
302
|
-
]);
|
|
303
|
-
var AxisName = z.enum([
|
|
304
|
-
"wght",
|
|
305
|
-
"wdth",
|
|
306
|
-
"slnt",
|
|
307
|
-
"opsz",
|
|
308
|
-
"ital",
|
|
309
|
-
"GRAD",
|
|
310
|
-
"XTRA",
|
|
311
|
-
"XOPQ",
|
|
312
|
-
"YOPQ",
|
|
313
|
-
"YTLC",
|
|
314
|
-
"YTUC",
|
|
315
|
-
"YTAS",
|
|
316
|
-
"YTDE",
|
|
317
|
-
"YTFI"
|
|
318
|
-
]);
|
|
319
|
-
var VariationAxes = z.record(
|
|
320
|
-
AxisName,
|
|
321
|
-
z.object({
|
|
322
|
-
name: z.string(),
|
|
323
|
-
min: z.number(),
|
|
324
|
-
default: z.number(),
|
|
325
|
-
max: z.number()
|
|
326
|
-
})
|
|
327
|
-
);
|
|
328
|
-
var FontMetaStatic = z.object({
|
|
329
|
-
family: z.string(),
|
|
330
|
-
style: z.enum(FONT_STYLES),
|
|
331
|
-
weight: z.number()
|
|
332
|
-
});
|
|
333
|
-
var FontMetaVariable = z.object({
|
|
334
|
-
family: z.string(),
|
|
335
|
-
variationAxes: VariationAxes
|
|
336
|
-
});
|
|
337
|
-
var FontMeta = z.union([FontMetaStatic, FontMetaVariable]);
|
|
338
|
-
|
|
339
|
-
// src/font-weights.ts
|
|
340
|
-
var fontWeights = {
|
|
341
|
-
"100": {
|
|
342
|
-
label: "Thin",
|
|
343
|
-
names: ["thin", "hairline"]
|
|
344
|
-
},
|
|
345
|
-
"200": {
|
|
346
|
-
label: "Extra Light",
|
|
347
|
-
names: ["extra light", "extralight", "ultra light", "ultralight"]
|
|
348
|
-
},
|
|
349
|
-
"300": {
|
|
350
|
-
label: "Light",
|
|
351
|
-
names: ["light"]
|
|
352
|
-
},
|
|
353
|
-
"400": {
|
|
354
|
-
label: "Normal",
|
|
355
|
-
names: ["normal", "regular"]
|
|
356
|
-
},
|
|
357
|
-
"500": {
|
|
358
|
-
label: "Medium",
|
|
359
|
-
names: ["medium"]
|
|
360
|
-
},
|
|
361
|
-
"600": {
|
|
362
|
-
label: "Semi Bold",
|
|
363
|
-
names: ["semi bold", "semibold", "demi bold", "demibold"]
|
|
364
|
-
},
|
|
365
|
-
"700": {
|
|
366
|
-
label: "Bold",
|
|
367
|
-
names: ["bold", "bold"]
|
|
368
|
-
},
|
|
369
|
-
"800": {
|
|
370
|
-
label: "Extra Bold",
|
|
371
|
-
names: ["extra bold", "extrabold", "ultra bold", "ultrabold"]
|
|
372
|
-
},
|
|
373
|
-
"900": {
|
|
374
|
-
label: "Black",
|
|
375
|
-
names: ["black", "heavy"]
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
var fontWeightNames = new Map(
|
|
379
|
-
Object.keys(fontWeights).map((weight) => {
|
|
380
|
-
const weightData = fontWeights[weight];
|
|
381
|
-
return weightData.names.map((name) => [name, weight]);
|
|
382
|
-
}).flat()
|
|
383
|
-
);
|
|
384
|
-
export {
|
|
385
|
-
DEFAULT_FONT_FALLBACK,
|
|
386
|
-
FONT_FORMATS,
|
|
387
|
-
FONT_MIME_TYPES,
|
|
388
|
-
FONT_STYLES,
|
|
389
|
-
FontFormat,
|
|
390
|
-
FontMeta,
|
|
391
|
-
FontMetaStatic,
|
|
392
|
-
SYSTEM_FONTS,
|
|
393
|
-
fontWeightNames,
|
|
394
|
-
fontWeights,
|
|
395
|
-
getFontFaces
|
|
396
|
-
};
|
package/lib/types/constants.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { FontFormat } from "./schema";
|
|
2
|
-
export declare const SYSTEM_FONTS: Map<string, {
|
|
3
|
-
stack: string[];
|
|
4
|
-
description: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const DEFAULT_FONT_FALLBACK = "sans-serif";
|
|
7
|
-
export declare const FONT_FORMATS: Map<FontFormat, string>;
|
|
8
|
-
export declare const FONT_MIME_TYPES: string;
|
|
9
|
-
export declare const FONT_STYLES: readonly ["normal", "italic", "oblique"];
|
|
10
|
-
export type FontStyle = (typeof FONT_STYLES)[number];
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare const fontWeights: {
|
|
2
|
-
readonly "100": {
|
|
3
|
-
readonly label: "Thin";
|
|
4
|
-
readonly names: readonly ["thin", "hairline"];
|
|
5
|
-
};
|
|
6
|
-
readonly "200": {
|
|
7
|
-
readonly label: "Extra Light";
|
|
8
|
-
readonly names: readonly ["extra light", "extralight", "ultra light", "ultralight"];
|
|
9
|
-
};
|
|
10
|
-
readonly "300": {
|
|
11
|
-
readonly label: "Light";
|
|
12
|
-
readonly names: readonly ["light"];
|
|
13
|
-
};
|
|
14
|
-
readonly "400": {
|
|
15
|
-
readonly label: "Normal";
|
|
16
|
-
readonly names: readonly ["normal", "regular"];
|
|
17
|
-
};
|
|
18
|
-
readonly "500": {
|
|
19
|
-
readonly label: "Medium";
|
|
20
|
-
readonly names: readonly ["medium"];
|
|
21
|
-
};
|
|
22
|
-
readonly "600": {
|
|
23
|
-
readonly label: "Semi Bold";
|
|
24
|
-
readonly names: readonly ["semi bold", "semibold", "demi bold", "demibold"];
|
|
25
|
-
};
|
|
26
|
-
readonly "700": {
|
|
27
|
-
readonly label: "Bold";
|
|
28
|
-
readonly names: readonly ["bold", "bold"];
|
|
29
|
-
};
|
|
30
|
-
readonly "800": {
|
|
31
|
-
readonly label: "Extra Bold";
|
|
32
|
-
readonly names: readonly ["extra bold", "extrabold", "ultra bold", "ultrabold"];
|
|
33
|
-
};
|
|
34
|
-
readonly "900": {
|
|
35
|
-
readonly label: "Black";
|
|
36
|
-
readonly names: readonly ["black", "heavy"];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export declare const fontWeightNames: Map<string, "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900">;
|
|
40
|
-
export type FontWeight = keyof typeof fontWeights;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FontMeta, FontFormat, FontMetaStatic } from "./schema";
|
|
2
|
-
export type PartialFontAsset = {
|
|
3
|
-
format: FontFormat;
|
|
4
|
-
meta: FontMeta;
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
export type FontFace = {
|
|
8
|
-
fontFamily: string;
|
|
9
|
-
fontDisplay: "swap" | "auto" | "block" | "fallback" | "optional";
|
|
10
|
-
src: string;
|
|
11
|
-
fontStyle?: FontMetaStatic["style"];
|
|
12
|
-
fontWeight?: number | string;
|
|
13
|
-
fontStretch?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const getFontFaces: (assets: Array<PartialFontAsset>, options: {
|
|
16
|
-
assetBaseUrl: string;
|
|
17
|
-
}) => Array<FontFace>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/index.d.ts
DELETED
package/lib/types/schema.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const FontFormat: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">]>;
|
|
3
|
-
export type FontFormat = z.infer<typeof FontFormat>;
|
|
4
|
-
declare const VariationAxes: z.ZodRecord<z.ZodEnum<["wght", "wdth", "slnt", "opsz", "ital", "GRAD", "XTRA", "XOPQ", "YOPQ", "YTLC", "YTUC", "YTAS", "YTDE", "YTFI"]>, z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
min: z.ZodNumber;
|
|
7
|
-
default: z.ZodNumber;
|
|
8
|
-
max: z.ZodNumber;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name: string;
|
|
11
|
-
min: number;
|
|
12
|
-
default: number;
|
|
13
|
-
max: number;
|
|
14
|
-
}, {
|
|
15
|
-
name: string;
|
|
16
|
-
min: number;
|
|
17
|
-
default: number;
|
|
18
|
-
max: number;
|
|
19
|
-
}>>;
|
|
20
|
-
export type VariationAxes = z.infer<typeof VariationAxes>;
|
|
21
|
-
export declare const FontMetaStatic: z.ZodObject<{
|
|
22
|
-
family: z.ZodString;
|
|
23
|
-
style: z.ZodEnum<["normal", "italic", "oblique"]>;
|
|
24
|
-
weight: z.ZodNumber;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
family: string;
|
|
27
|
-
style: "normal" | "italic" | "oblique";
|
|
28
|
-
weight: number;
|
|
29
|
-
}, {
|
|
30
|
-
family: string;
|
|
31
|
-
style: "normal" | "italic" | "oblique";
|
|
32
|
-
weight: number;
|
|
33
|
-
}>;
|
|
34
|
-
export type FontMetaStatic = z.infer<typeof FontMetaStatic>;
|
|
35
|
-
export declare const FontMeta: z.ZodUnion<[z.ZodObject<{
|
|
36
|
-
family: z.ZodString;
|
|
37
|
-
style: z.ZodEnum<["normal", "italic", "oblique"]>;
|
|
38
|
-
weight: z.ZodNumber;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
family: string;
|
|
41
|
-
style: "normal" | "italic" | "oblique";
|
|
42
|
-
weight: number;
|
|
43
|
-
}, {
|
|
44
|
-
family: string;
|
|
45
|
-
style: "normal" | "italic" | "oblique";
|
|
46
|
-
weight: number;
|
|
47
|
-
}>, z.ZodObject<{
|
|
48
|
-
family: z.ZodString;
|
|
49
|
-
variationAxes: z.ZodRecord<z.ZodEnum<["wght", "wdth", "slnt", "opsz", "ital", "GRAD", "XTRA", "XOPQ", "YOPQ", "YTLC", "YTUC", "YTAS", "YTDE", "YTFI"]>, z.ZodObject<{
|
|
50
|
-
name: z.ZodString;
|
|
51
|
-
min: z.ZodNumber;
|
|
52
|
-
default: z.ZodNumber;
|
|
53
|
-
max: z.ZodNumber;
|
|
54
|
-
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
name: string;
|
|
56
|
-
min: number;
|
|
57
|
-
default: number;
|
|
58
|
-
max: number;
|
|
59
|
-
}, {
|
|
60
|
-
name: string;
|
|
61
|
-
min: number;
|
|
62
|
-
default: number;
|
|
63
|
-
max: number;
|
|
64
|
-
}>>;
|
|
65
|
-
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
family: string;
|
|
67
|
-
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
68
|
-
name: string;
|
|
69
|
-
min: number;
|
|
70
|
-
default: number;
|
|
71
|
-
max: number;
|
|
72
|
-
}>>;
|
|
73
|
-
}, {
|
|
74
|
-
family: string;
|
|
75
|
-
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
76
|
-
name: string;
|
|
77
|
-
min: number;
|
|
78
|
-
default: number;
|
|
79
|
-
max: number;
|
|
80
|
-
}>>;
|
|
81
|
-
}>]>;
|
|
82
|
-
export type FontMeta = z.infer<typeof FontMeta>;
|
|
83
|
-
export {};
|