Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-shrimps-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Improves JSDoc for fonts api
28 changes: 14 additions & 14 deletions packages/astro/src/assets/fonts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export interface FontProvider<

export interface FamilyProperties {
/**
* @default `"swap"`
*
* 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.
*
* @default "swap"
*/
display?: Display | undefined;
/**
Expand Down Expand Up @@ -132,8 +132,6 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
*/
provider: TFontProvider;
/**
* @default `[400]`
*
* 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
* included by default to prevent unnecessary downloads. You will need to include this property to access any other font weights.
*
Expand All @@ -142,29 +140,29 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
* ```js
* weight: "100 900"
* ```
*
* @default [400]
*/
weights?: [Weight, ...Array<Weight>] | undefined;
/**
* @default `["normal", "italic"]`
*
* An array of [font styles](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style).
*
* @default ["normal", "italic"]
*/
styles?: [Style, ...Array<Style>] | undefined;
/**
* @default `["latin"]`
*
* Defines a list of [font subsets](https://knaap.dev/posts/font-subsetting/).
*
* @default ["latin"]
*/
subsets?: [string, ...Array<string>] | undefined;
/**
* @default `["woff2"]`
*
* An array of [font formats](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_formats).
*
* @default ["woff2"]
*/
formats?: [FontType, ...Array<FontType>] | undefined;
/**
* @default `["sans-serif"]`
*
* 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:
*
* ```js
Expand All @@ -179,12 +177,14 @@ export type FontFamily<TFontProvider extends FontProvider = FontProvider> = Fami
*
* 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
* generate [optimized fallbacks](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
*
* @default ["sans-serif"]
*/
fallbacks?: Array<string> | undefined;
/**
* @default `true`
*
* 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.
*
* @default true
*/
optimizedFallbacks?: boolean | undefined;
};
Expand Down
Loading