You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows experimental Font providers to specify family options
6
+
7
+
Previously, an Astro `FontProvider` could only accept options at the provider level when called. That could result in weird data structures for family-specific options.
8
+
9
+
Astro `FontProvider`s can now declare family-specific options, by specifying a generic:
10
+
11
+
```diff
12
+
// font-provider.ts
13
+
import type { FontProvider } from "astro";
14
+
import { retrieveFonts, type Fonts } from "./utils.js",
15
+
16
+
interface Config {
17
+
token: string;
18
+
}
19
+
20
+
+interface FamilyOptions {
21
+
+ minimal?: boolean;
22
+
+}
23
+
24
+
-export function registryFontProvider(config: Config): FontProvider {
25
+
+export function registryFontProvider(config: Config): FontProvider<FamilyOptions> {
* The source of your font files. You can use a built-in provider or write your own custom provider.
175
-
*/
176
-
provider: FontProvider;
177
-
/**
178
-
* @default `[400]`
179
-
*
180
-
* An array of [font weights](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). If the associated font is a [variable font](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_fonts/Variable_fonts_guide), you can specify a range of weights:
181
-
*
182
-
* ```js
183
-
* weight: "100 900"
184
-
* ```
185
-
*/
186
-
weights?: [Weight, ...Array<Weight>]|undefined;
187
-
/**
188
-
* @default `["normal", "italic"]`
189
-
*
190
-
* An array of [font styles](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style).
191
-
*/
192
-
styles?: [Style, ...Array<Style>]|undefined;
193
-
/**
194
-
* @default `["latin"]`
195
-
*
196
-
* An array of [font subsets](https://knaap.dev/posts/font-subsetting/):
197
-
*/
198
-
subsets?: [string, ...Array<string>]|undefined;
199
-
/**
200
-
* @default `["woff2"]`
201
-
*
202
-
* An array of [font formats](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_formats).
* The source of your font files. You can use a built-in provider or write your own custom provider.
208
+
*/
209
+
provider: TFontProvider;
210
+
/**
211
+
* @default `[400]`
212
+
*
213
+
* An array of [font weights](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). If the associated font is a [variable font](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_fonts/Variable_fonts_guide), you can specify a range of weights:
214
+
*
215
+
* ```js
216
+
* weight: "100 900"
217
+
* ```
218
+
*/
219
+
weights?: [Weight, ...Array<Weight>]|undefined;
220
+
/**
221
+
* @default `["normal", "italic"]`
222
+
*
223
+
* An array of [font styles](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style).
224
+
*/
225
+
styles?: [Style, ...Array<Style>]|undefined;
226
+
/**
227
+
* @default `["latin"]`
228
+
*
229
+
* An array of [font subsets](https://knaap.dev/posts/font-subsetting/):
230
+
*/
231
+
subsets?: [string, ...Array<string>]|undefined;
232
+
/**
233
+
* @default `["woff2"]`
234
+
*
235
+
* An array of [font formats](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_formats).
0 commit comments