Repository: withastro/astro
File: packages/astro/src/assets/fonts/config.ts (TypeScript)

Code before:
	 * A [font display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display).
	 */
	display: z.enum(['auto', 'block', 'swap', 'fallback', 'optional']).optional(),
	/**
	 * A [unicode range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range).
	 */
	unicodeRange: z.array(z.string()).nonempty().optional(),
	/**
	 * A [font stretch](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch).
	 */
	stretch: z.string().optional(),
	/**
	 * Font [feature settings](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings).
	 */
	featureSettings: z.string().optional(),
	/**
	 * Font [variation settings](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-variation-settings).
	 */
	variationSettings: z.string().optional(),
});

const fallbacksSchema = z.object({
	/**
	 * @default `["sans-serif"]`
	 *
	 * An array of fonts to use when your chosen font is unavailable, or loading. Fallbacks are applied from left to right:
	 *
	 * ```js
	 * fallbacks: ["CustomFont", "serif"]
	 * ```
	 *
	 * If you don't want any fallbacks, use an empty array:
	 *
	 * ```js
	 * fallbacks: []
	 * ```
	 *
	 * If `optimizedFallbacks` is set to `true`, we look for the last fallback and check if it's a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name). If so, we try to generate an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics.
	 */
	fallbacks: z.array(z.string()).nonempty().optional(),
	/**
	 * @default `true`
	 *
	 * Whether or not to enable optimized fallback generation. Enabling this should only be needed if you want full control over the `fallbacks`.
	 */
	optimizedFallbacks: z.boolean().optional(),
});

export const requiredFamilyAttributesSchema = z.object({
	/**
	 * The font family name, as identified by your font provider.

Review comment (suggestion):
Is "left to right" the way we refer to organizing elements in an array? (Some languages are RTL, for example). Do we more use "beginning/end"?

Thinking of a way to say something like:

> Fallback fonts will be chosen in the order listed. The first available font will be used.

Code after:
	 * A [font display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display).
	 */
	display: z.enum(['auto', 'block', 'swap', 'fallback', 'optional']).optional(),
	/**
	 * A [unicode range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range).
	 */
	unicodeRange: z.array(z.string()).nonempty().optional(),
	/**
	 * A [font stretch](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch).
	 */
	stretch: z.string().optional(),
	/**
	 * Font [feature settings](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings).
	 */
	featureSettings: z.string().optional(),
	/**
	 * Font [variation settings](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-variation-settings).
	 */
	variationSettings: z.string().optional(),
});

const fallbacksSchema = z.object({
	/**
	 * @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
	 * fallbacks: ["CustomFont", "serif"]
	 * ```
	 *
	 * To disable fallback fonts completely, configure an empty array:
	 *
	 * ```js
	 * fallbacks: []
	 * ```
	 *

	 * 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), an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
	 */
	fallbacks: z.array(z.string()).nonempty().optional(),
	/**
	 * @default `true`
	 *
	 * Whether or not to enable optimized fallback generation. You may disable this default optimization to have full control over `fallbacks`.
	 */
	optimizedFallbacks: z.boolean().optional(),
});

export const requiredFamilyAttributesSchema = z.object({
	/**