Skip to content

Commit cfccafa

Browse files
authored
fix: improve jsdoc for fonts api (#17980)
1 parent 9838049 commit cfccafa

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

‎.changeset/strong-shrimps-end.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Improves JSDoc for fonts api

‎packages/astro/src/assets/fonts/types.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export interface FontProvider<
5959

6060
export interface FamilyProperties {
6161
/**
62-
* @default `"swap"`
63-
*
6462
* Defines [how a font displays](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display) based on when it is downloaded and ready for use.
63+
*
64+
* @default "swap"
6565
*/
6666
display?: Display | undefined;
6767
/**
@@ -132,8 +132,6 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
132132
*/
133133
provider: TFontProvider;
134134
/**
135-
* @default `[400]`
136-
*
137135
* An array of [font weights](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). If no value is specified in your configuration, only weight `400` is
138136
* included by default to prevent unnecessary downloads. You will need to include this property to access any other font weights.
139137
*
@@ -142,29 +140,29 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
142140
* ```js
143141
* weight: "100 900"
144142
* ```
143+
*
144+
* @default [400]
145145
*/
146146
weights?: [Weight, ...Array<Weight>] | undefined;
147147
/**
148-
* @default `["normal", "italic"]`
149-
*
150148
* An array of [font styles](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style).
149+
*
150+
* @default ["normal", "italic"]
151151
*/
152152
styles?: [Style, ...Array<Style>] | undefined;
153153
/**
154-
* @default `["latin"]`
155-
*
156154
* Defines a list of [font subsets](https://knaap.dev/posts/font-subsetting/).
155+
*
156+
* @default ["latin"]
157157
*/
158158
subsets?: [string, ...Array<string>] | undefined;
159159
/**
160-
* @default `["woff2"]`
161-
*
162160
* An array of [font formats](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_formats).
161+
*
162+
* @default ["woff2"]
163163
*/
164164
formats?: [FontType, ...Array<FontType>] | undefined;
165165
/**
166-
* @default `["sans-serif"]`
167-
*
168166
* An array of fonts to use when your chosen font is unavailable, or loading. Fallback fonts will be chosen in the order listed. The first available font will be used:
169167
*
170168
* ```js
@@ -179,12 +177,14 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
179177
*
180178
* If the last font in the `fallbacks` array is a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name), Astro will attempt to
181179
* generate [optimized fallbacks](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
180+
*
181+
* @default ["sans-serif"]
182182
*/
183183
fallbacks?: Array<string> | undefined;
184184
/**
185-
* @default `true`
186-
*
187185
* Whether or not to enable Astro's default optimization when generating fallback fonts. You may disable this default optimization to have full control over how `fallbacks` are generated.
186+
*
187+
* @default true
188188
*/
189189
optimizedFallbacks?: boolean | undefined;
190190
};

0 commit comments

Comments
 (0)