@driftime/sanity-plugin-font 0.0.0-stage → 0.1.1

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.
Files changed (47) hide show
  1. package/README.md +492 -2
  2. package/dist/catalog-BVw1r_SG.js +183 -0
  3. package/dist/catalog-BVw1r_SG.js.map +1 -0
  4. package/dist/catalog-KAqAIjzw.js +96 -0
  5. package/dist/catalog-KAqAIjzw.js.map +1 -0
  6. package/dist/catalog.d.ts +29 -0
  7. package/dist/catalog.d.ts.map +1 -0
  8. package/dist/catalog.js +10 -0
  9. package/dist/catalog.js.map +1 -0
  10. package/dist/family-BAGnEjZg.js +36 -0
  11. package/dist/family-BAGnEjZg.js.map +1 -0
  12. package/dist/font-styles.d.ts +21 -0
  13. package/dist/font-styles.d.ts.map +1 -0
  14. package/dist/font-styles.js +43 -0
  15. package/dist/font-styles.js.map +1 -0
  16. package/dist/index.d.ts +76 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +2364 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/names.d.ts +8 -0
  21. package/dist/names.d.ts.map +1 -0
  22. package/dist/names.js +0 -0
  23. package/dist/next-loader.d.ts +19 -0
  24. package/dist/next-loader.d.ts.map +1 -0
  25. package/dist/next-loader.js +28 -0
  26. package/dist/next-loader.js.map +1 -0
  27. package/dist/next.d.ts +42 -0
  28. package/dist/next.d.ts.map +1 -0
  29. package/dist/next.js +48 -0
  30. package/dist/next.js.map +1 -0
  31. package/dist/render.d.ts +12 -0
  32. package/dist/render.d.ts.map +1 -0
  33. package/dist/render.js +183 -0
  34. package/dist/render.js.map +1 -0
  35. package/dist/resolve-Bkp0dEmr.d.ts +81 -0
  36. package/dist/resolve-Bkp0dEmr.d.ts.map +1 -0
  37. package/dist/types-DZl90ROd.d.ts +106 -0
  38. package/dist/types-DZl90ROd.d.ts.map +1 -0
  39. package/dist/types-DheP5tax.js +27 -0
  40. package/dist/types-DheP5tax.js.map +1 -0
  41. package/dist/utils-BV38iODp.js +29 -0
  42. package/dist/utils-BV38iODp.js.map +1 -0
  43. package/dist/vite.d.ts +61 -0
  44. package/dist/vite.d.ts.map +1 -0
  45. package/dist/vite.js +53 -0
  46. package/dist/vite.js.map +1 -0
  47. package/package.json +120 -4
package/README.md CHANGED
@@ -1,3 +1,493 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/icon-dark.svg" />
4
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/icon-light.svg" />
5
+ <img src="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/icon-light.svg" alt="Font plugin logo" width="48" />
6
+ </picture>
7
+ <h1>Font</h1>
8
+ <p><strong>A Sanity Studio plugin by Driftime®</strong></p>
9
+ <p>Fonts for Sanity Studio, from the Google Fonts catalog or a brand's own files.</p>
10
+ <p>
11
+ <a href="https://www.npmjs.com/package/@driftime/sanity-plugin-font"><img src="https://img.shields.io/npm/v/@driftime/sanity-plugin-font?style=flat-square&labelColor=1a1a1a&color=666666" alt="npm version" /></a>
12
+ <a href="https://github.com/driftime/sanity-plugins/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@driftime/sanity-plugin-font?style=flat-square&labelColor=1a1a1a&color=666666" alt="License: MIT" /></a>
13
+ </p>
14
+ </div>
2
15
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
16
+ <br />
17
+
18
+ ## Overview
19
+
20
+ Font brings typography into the content model. Authors can browse the whole Google Fonts catalog, with every family shown in its own typeface, and choose one as they would any other value. When a brand has its own typeface, they upload the files instead, and the plugin reads the weight and style from each one, so there's nothing to fill in by hand.
21
+
22
+ The design still has the final say. A field can require the weights, styles, and languages the site depends on, and only fonts that have all of them are offered, so whatever an author picks, the headings still get a real bold.
23
+
24
+ On the site, a font chosen in Sanity is used much like one from `next/font`, whether it came from Google or an upload, and whether it's set for the whole site, a single page, or one block.
25
+
26
+ <br />
27
+
28
+ <figure>
29
+ <picture>
30
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-picker-dark.png" />
31
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-picker-light.png" />
32
+ <img src="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-picker-light.png" alt="The font picker open in Sanity Studio on the Google Fonts tab, showing a search field, menus for kind and sort order, and a grid of popular families, each set in its own typeface" />
33
+ </picture>
34
+ <p align="center"><sub><em>The font picker, with every Google Fonts family set in its own typeface.</em></sub></p>
35
+ </figure>
36
+
37
+ <br />
38
+
39
+ ## Installation
40
+
41
+ Font is built for Sanity Studio 6.10 and React 19 and declares both as peer dependencies, so the Studio needs to be on those versions already. Node 20.19 or later is required, or 22.12 or later on Node 22.
42
+
43
+ ```bash
44
+ bun add -E @driftime/sanity-plugin-font
45
+ ```
46
+
47
+ <br />
48
+
49
+ ## Studio
50
+
51
+ In the Studio, the plugin registers a `font` type, and a step added to the Studio's build brings in the Google Fonts catalog.
52
+
53
+ <br />
54
+
55
+ ### Adding the Build Step
56
+
57
+ The build step brings Google's list of font families into the Studio as it builds. It's added to the configuration of whichever bundler builds the Studio.
58
+
59
+ <br />
60
+
61
+ #### Standalone Studio
62
+
63
+ A standalone Studio is built with Vite, and `withFonts` extends the `vite` option in its `sanity.cli.ts`.
64
+
65
+ ```typescript
66
+ import { withFonts } from "@driftime/sanity-plugin-font/vite";
67
+ import { defineCliConfig } from "sanity/cli";
68
+
69
+ export default defineCliConfig({
70
+ // ...
71
+ vite: withFonts(),
72
+ });
73
+ ```
74
+
75
+ <br />
76
+
77
+ #### Next.js
78
+
79
+ For a Studio embedded in a Next.js app, `withFonts` wraps the app's configuration in `next.config.ts` and works with both Turbopack and webpack.
80
+
81
+ ```typescript
82
+ import { withFonts } from "@driftime/sanity-plugin-font/next";
83
+ import type { NextConfig } from "next";
84
+
85
+ const config: NextConfig = {
86
+ // ...
87
+ };
88
+
89
+ export default withFonts()(config);
90
+ ```
91
+
92
+ `withFonts` returns an async configuration function rather than an object, so when other plugins also wrap the configuration, it needs to be applied last.
93
+
94
+ <br />
95
+
96
+ #### Other Vite Frameworks
97
+
98
+ A Studio embedded in another Vite-based framework, such as React Router, TanStack Start, or Astro, adds `googleFonts` to that framework's Vite plugins.
99
+
100
+ ```typescript
101
+ import { googleFonts } from "@driftime/sanity-plugin-font/vite";
102
+
103
+ export default defineConfig({
104
+ // ...
105
+ plugins: [
106
+ // ...
107
+ googleFonts(),
108
+ ],
109
+ });
110
+ ```
111
+
112
+ <br />
113
+
114
+ ### Registering the Plugin
115
+
116
+ The plugin works without any configuration, and the options it's given apply to every font field that doesn't set its own.
117
+
118
+ ```typescript
119
+ import { fontPlugin } from "@driftime/sanity-plugin-font";
120
+ import { defineConfig } from "sanity";
121
+
122
+ export default defineConfig({
123
+ // ...
124
+ plugins: [
125
+ // ...
126
+ fontPlugin(),
127
+ ],
128
+ });
129
+ ```
130
+
131
+ | Option | Type | Default | Purpose |
132
+ | ------------ | ---------------------- | ---------------------- | --------------------------------------------------------------------------------------------------- |
133
+ | `sources` | `SanityFontSource[]` | `["google", "upload"]` | Where fonts come from. See [Choosing the Sources](#choosing-the-sources). |
134
+ | `categories` | `SanityFontCategory[]` | every kind | Kinds of typeface a font can be. See [Restricting the Fonts](#restricting-the-fonts). |
135
+ | `families` | `SanityFontFamily[]` | every family | Google families on offer, in the order listed. See [Restricting the Fonts](#restricting-the-fonts). |
136
+ | `weights` | `SanityFontWeight[]` | `[400, 600]` | Weights a font must have. See [Setting the Requirements](#setting-the-requirements). |
137
+ | `styles` | `SanityFontStyle[]` | `["normal"]` | Styles a font must have in every weight. See [Setting the Requirements](#setting-the-requirements). |
138
+ | `subsets` | `string[]` | `["latin"]` | Character sets a Google font must cover. See [Setting the Requirements](#setting-the-requirements). |
139
+ | `preview` | `SanityFontPreview` | `"Aa"` | Text used to preview a chosen font. See [Previewing the Font](#previewing-the-font). |
140
+
141
+ <br />
142
+
143
+ ### Adding a Font Field
144
+
145
+ A field of type `font` is defined like any other, and takes the same options as the plugin. Each option a field sets replaces the plugin's.
146
+
147
+ ```typescript
148
+ defineField({
149
+ name: "headingFont",
150
+ type: "font",
151
+ description: "Typeface for headings.",
152
+ });
153
+ ```
154
+
155
+ The plugin registers types named `font` and `fontFile`, so a Studio that already has a type by either name needs to rename it before installing.
156
+
157
+ <br />
158
+
159
+ ### Setting the Requirements
160
+
161
+ A design is usually set in a handful of weights and styles, and every font an author picks needs to have them. A field lists them, and the picker only offers Google families that have every one, in every character set listed in `subsets`.
162
+
163
+ ```typescript
164
+ defineField({
165
+ name: "bodyFont",
166
+ type: "font",
167
+ description: "Typeface for body text.",
168
+ options: { weights: [400, 700], styles: ["normal", "italic"], subsets: ["latin", "latin-ext"] },
169
+ });
170
+ ```
171
+
172
+ Every weight is required in every style, so this field asks for regular, italic, bold, and bold italic. Subsets take Google's own names, such as `cyrillic` or `greek`. Uploaded fonts are held to the same requirements.
173
+
174
+ <br />
175
+
176
+ ### Restricting the Fonts
177
+
178
+ `categories` limits the kinds of typeface on offer, and `families` names the exact Google families a field offers, in the order they're listed.
179
+
180
+ ```typescript
181
+ defineField({
182
+ name: "headingFont",
183
+ type: "font",
184
+ description: "Typeface for headings.",
185
+ options: { categories: ["serif"], families: ["Playfair Display", "Lora", "Fraunces"] },
186
+ });
187
+ ```
188
+
189
+ Family names are checked against the Google Fonts catalog once the build step has run, so the editor autocompletes them and a misspelling is a type error. A list shared between fields is typed with `SanityFontFamily`.
190
+
191
+ <br />
192
+
193
+ ### Choosing the Sources
194
+
195
+ A field offers Google Fonts and uploads, each in its own tab. Either can be left out, for example for a logo that's always set in the brand's own typeface.
196
+
197
+ ```typescript
198
+ defineField({
199
+ name: "brandFont",
200
+ type: "font",
201
+ description: "Typeface for the logo.",
202
+ options: { sources: ["upload"] },
203
+ });
204
+ ```
205
+
206
+ <br />
207
+
208
+ ### Uploading Fonts
209
+
210
+ An uploaded font is a set of WOFF2 or WOFF files, either one for each weight and style or a single variable font. Authors just add the files, and the plugin works out what each one holds.
211
+
212
+ Uploaded files are served from the Sanity CDN, which only sends fonts to the origins in the project's CORS settings. **Every domain the site runs on needs to be added to the project's CORS origins** at [sanity.io/manage](https://www.sanity.io/manage), or the site shows the fallback instead. Uploaded files are public, like every Sanity asset, so the font's license is worth checking before it's uploaded.
213
+
214
+ <br />
215
+
216
+ <figure>
217
+ <picture>
218
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-upload-dark.png" />
219
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-upload-light.png" />
220
+ <img src="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-upload-light.png" alt="The font picker on the Upload tab, with the family Landour, the category Display, and one uploaded ExtraBold file above a drop zone for more" />
221
+ </picture>
222
+ <p align="center"><sub><em>An uploaded font, with each file's weight and style read from the file itself.</em></sub></p>
223
+ </figure>
224
+
225
+ <br />
226
+
227
+ ### Previewing the Font
228
+
229
+ Once a font is chosen, the field shows "Aa" in each of its weights and styles, and `preview.text` replaces it with the site's own text.
230
+
231
+ ```typescript
232
+ defineField({
233
+ name: "headingFont",
234
+ type: "font",
235
+ description: "Typeface for headings.",
236
+ options: { preview: { text: "Welcome to Acme Inc." } },
237
+ });
238
+ ```
239
+
240
+ <br />
241
+
242
+ <figure>
243
+ <picture>
244
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-field-dark.png" />
245
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-field-light.png" />
246
+ <img src="https://raw.githubusercontent.com/driftime/sanity-plugins/HEAD/packages/font/assets/font-field-light.png" alt="A Body Font field in Sanity Studio set to Spectral, previewing Aa in Regular, Italic, SemiBold, and SemiBold Italic" />
247
+ </picture>
248
+ <p align="center"><sub><em>A chosen font, previewed in each weight and style the field requires.</em></sub></p>
249
+ </figure>
250
+
251
+ <br />
252
+
253
+ ### Document Previews
254
+
255
+ `createFontPreview` shows a chosen font in a document's preview, in place of the icon its type was given in the schema. It's called in `prepare` with the stored value.
256
+
257
+ ```typescript
258
+ import { createFontPreview } from "@driftime/sanity-plugin-font";
259
+
260
+ defineType({
261
+ // ...
262
+ preview: {
263
+ select: { title: "title", font: "headingFont" },
264
+ prepare({ title, font }) {
265
+ return { title, media: createFontPreview(font) };
266
+ },
267
+ },
268
+ });
269
+ ```
270
+
271
+ When no font is stored, it returns `undefined` and the preview keeps the type's icon.
272
+
273
+ <br />
274
+
275
+ ## Site
276
+
277
+ On the site, a font from Sanity is used much like one from `next/font`. `resolveFont` turns a stored font into classes and a style, `FontStyles` adds the rules behind them to the page, and `fontFragment` expands an uploaded font's files in a query. All three come from `@driftime/sanity-plugin-font/render`, which contains no Studio code.
278
+
279
+ <br />
280
+
281
+ ### Querying
282
+
283
+ An uploaded font's files are references to assets, so a query needs to expand them. `fontFragment` does that, and goes in the font field's projection wherever the field is.
284
+
285
+ ```typescript
286
+ import { fontFragment } from "@driftime/sanity-plugin-font/render";
287
+
288
+ const settingsQuery = `*[_type == "settings"][0] {
289
+ headingFont { ${fontFragment} }
290
+ }`;
291
+ ```
292
+
293
+ It leaves a Google font unchanged, so it's safe to use on every font field.
294
+
295
+ <br />
296
+
297
+ ### Resolving Fonts
298
+
299
+ `resolveFont` takes a stored font and returns the same three things a `next/font` font does: a `className` that sets it, a `style` that does the same inline, and, when it's given a CSS variable to define, a `variable` class.
300
+
301
+ ```typescript
302
+ import { resolveFont } from "@driftime/sanity-plugin-font/render";
303
+
304
+ const heading = resolveFont(settings.headingFont, { variable: "--font-heading" });
305
+ ```
306
+
307
+ | Option | Type | Default | Purpose |
308
+ | ---------- | ------------------- | ------------------------ | ---------------------------------------------------------------------------- |
309
+ | `display` | `SanityFontDisplay` | `"swap"` | How the font is shown while it loads, as CSS's `font-display` names it. |
310
+ | `preload` | `boolean` | `true` | Whether the page hints that the font's files should start downloading early. |
311
+ | `fallback` | `string[]` | one for the kind of font | Fonts shown in its place while it loads, such as `["Geist", "sans-serif"]`. |
312
+ | `variable` | `string` | none | The CSS variable the `variable` class defines, such as `--font-heading`. |
313
+
314
+ | Value | Type | Purpose |
315
+ | ----------- | ------------------------ | ---------------------------------------------------------- |
316
+ | `className` | `string` | A class that sets the font. |
317
+ | `style` | `{ fontFamily: string }` | An inline style that sets the font. |
318
+ | `variable` | `string \| undefined` | A class that defines the CSS variable, when one was named. |
319
+
320
+ It returns `undefined` when no font is stored.
321
+
322
+ <br />
323
+
324
+ ### Adding the Styles
325
+
326
+ `next/font` writes its rules at build time, but a font from Sanity isn't known until the page renders, so `FontStyles` adds its rules then. It takes one resolved font or several.
327
+
328
+ ```tsx
329
+ <FontStyles font={heading} />
330
+ <FontStyles font={[heading, body]} />
331
+ ```
332
+
333
+ It can go in a layout, a page, or the component that uses the font, because React 19 moves its links and styles into the document's head. A font added twice is only added once.
334
+
335
+ <br />
336
+
337
+ ### Applying Fonts
338
+
339
+ A resolved font is applied with its classes. The `variable` class defines the variable for the element it's on and everything inside it, so on the root element it covers the whole site, and the site's own CSS can use it with a default for when no font is chosen.
340
+
341
+ ```tsx
342
+ import { FontStyles, resolveFont } from "@driftime/sanity-plugin-font/render";
343
+
344
+ export default async function Layout({ children }: LayoutProps) {
345
+ const settings = await getSettings();
346
+ const heading = resolveFont(settings.headingFont, { variable: "--font-heading" });
347
+
348
+ return (
349
+ <html lang="en" className={heading?.variable}>
350
+ <body>
351
+ <FontStyles font={heading} />
352
+ {children}
353
+ </body>
354
+ </html>
355
+ );
356
+ }
357
+ ```
358
+
359
+ ```css
360
+ h1,
361
+ h2 {
362
+ font-family: var(--font-heading, ui-serif, serif);
363
+ }
364
+ ```
365
+
366
+ A font stored on a page or a block goes on the element that should use it, through its `variable` class or simply its `className`, so it only affects that part of the page.
367
+
368
+ ```tsx
369
+ export function Hero({ font, heading }: HeroProps) {
370
+ const resolved = resolveFont(font);
371
+
372
+ return (
373
+ <section className={resolved?.className}>
374
+ <FontStyles font={resolved} />
375
+ <h1>{heading}</h1>
376
+ </section>
377
+ );
378
+ }
379
+ ```
380
+
381
+ A site that doesn't use React adds the font to its head itself. Each resolved font also carries `stylesheet` and `css` for that, along with `preconnect` and `preload` hints.
382
+
383
+ <br />
384
+
385
+ ## Reference
386
+
387
+ The rest of this document covers the shape of a stored font and everything the package exports.
388
+
389
+ <br />
390
+
391
+ ### Stored Fonts
392
+
393
+ `SanityFont` is the type of a stored font. A Google font holds its family and the weights and styles to load.
394
+
395
+ ```json
396
+ {
397
+ "_type": "font",
398
+ "source": "google",
399
+ "family": "Playfair Display",
400
+ "category": "serif",
401
+ "weights": [400, 700],
402
+ "styles": ["normal", "italic"]
403
+ }
404
+ ```
405
+
406
+ | Field | Type | Purpose |
407
+ | ---------- | -------------------- | -------------------------------------------------------------------------------------- |
408
+ | `_type` | `string` | Always `font`. |
409
+ | `source` | `SanityFontSource` | Where the font comes from: `google` or `upload`. |
410
+ | `family` | `string` | The name the font is used under. |
411
+ | `category` | `SanityFontCategory` | The kind of typeface: `sans-serif`, `serif`, `display`, `handwriting`, or `monospace`. |
412
+ | `weights` | `SanityFontWeight[]` | The weights to load, for a Google font. |
413
+ | `styles` | `SanityFontStyle[]` | The styles to load, for a Google font. |
414
+ | `files` | `SanityFontFile[]` | The files, for an uploaded font. |
415
+
416
+ An uploaded font holds `files` in place of `weights` and `styles`, each with its asset and the weight and style it holds.
417
+
418
+ <br />
419
+
420
+ ### API
421
+
422
+ | Export | Import from | Purpose |
423
+ | ------------------------------ | ------------------------------------- | -------------------------------------------------------- |
424
+ | `fontPlugin(config?)` | `@driftime/sanity-plugin-font` | Registers the `font` type. |
425
+ | `createFontPreview(value)` | `@driftime/sanity-plugin-font` | Builds preview media from a stored font. |
426
+ | `withFonts()` | `@driftime/sanity-plugin-font/vite` | Adds the build step to the `vite` option of a Studio. |
427
+ | `googleFonts()` | `@driftime/sanity-plugin-font/vite` | The build step as a Vite plugin, for a framework's list. |
428
+ | `withFonts()` | `@driftime/sanity-plugin-font/next` | Adds the build step to a Next.js configuration. |
429
+ | `resolveFont(value, options?)` | `@driftime/sanity-plugin-font/render` | Resolves a stored font into classes and a style. |
430
+ | `FontStyles` | `@driftime/sanity-plugin-font/render` | Adds resolved fonts to the page. |
431
+ | `fontFragment` | `@driftime/sanity-plugin-font/render` | GROQ projection that expands an uploaded font's files. |
432
+
433
+ <br />
434
+
435
+ ### Types
436
+
437
+ | Type | Import from | Purpose |
438
+ | ----------------------------- | ------------------------------------- | --------------------------------------------------------------- |
439
+ | `SanityFontConfig` | `@driftime/sanity-plugin-font` | Everything `fontPlugin` accepts. |
440
+ | `SanityFontPreview` | `@driftime/sanity-plugin-font` | Settings for the preview below a font field. |
441
+ | `SanityFontOptions` | `@driftime/sanity-plugin-font` | The `options` a font field accepts. |
442
+ | `SanityFontDefinition` | `@driftime/sanity-plugin-font` | A field or array member of type `font`. |
443
+ | `SanityFontFamily` | `@driftime/sanity-plugin-font` | The name of a Google Fonts family, checked against the catalog. |
444
+ | `SanityFontVitePlugin` | `@driftime/sanity-plugin-font/vite` | What `googleFonts` returns. |
445
+ | `SanityFontNextConfig` | `@driftime/sanity-plugin-font/next` | The parts of a Next.js configuration the build step extends. |
446
+ | `SanityFontWebpackConfig` | `@driftime/sanity-plugin-font/next` | The parts of a webpack configuration the build step extends. |
447
+ | `SanityFontWebpackCustomizer` | `@driftime/sanity-plugin-font/next` | A Next.js `webpack` option the build step runs first. |
448
+ | `SanityFont` | `@driftime/sanity-plugin-font/render` | A stored font, from Google Fonts or uploaded. |
449
+ | `SanityFontFile` | `@driftime/sanity-plugin-font/render` | One uploaded file, with the weight and style it holds. |
450
+ | `SanityFontAsset` | `@driftime/sanity-plugin-font/render` | A file's asset reference, or the asset with its `url`. |
451
+ | `SanityFontSource` | `@driftime/sanity-plugin-font/render` | Where a font comes from: `google` or `upload`. |
452
+ | `SanityFontCategory` | `@driftime/sanity-plugin-font/render` | A kind of typeface. |
453
+ | `SanityFontDisplay` | `@driftime/sanity-plugin-font/render` | How a font is shown while it loads. |
454
+ | `SanityFontWeight` | `@driftime/sanity-plugin-font/render` | A weight from 100 to 900. |
455
+ | `SanityFontStyle` | `@driftime/sanity-plugin-font/render` | A style: `normal` or `italic`. |
456
+ | `SanityResolveFontOptions` | `@driftime/sanity-plugin-font/render` | Everything `resolveFont` accepts besides the stored font. |
457
+ | `SanityResolvedFont` | `@driftime/sanity-plugin-font/render` | What `resolveFont` returns. |
458
+ | `SanityFontPreconnect` | `@driftime/sanity-plugin-font/render` | An origin to connect to early. |
459
+ | `SanityFontPreload` | `@driftime/sanity-plugin-font/render` | A file to preload. |
460
+ | `SanityFontStylesProps` | `@driftime/sanity-plugin-font/render` | Everything `FontStyles` accepts. |
461
+
462
+ <br />
463
+
464
+ ## License
465
+
466
+ MIT © [Driftime®](https://driftime.com). See [LICENSE](https://github.com/driftime/sanity-plugins/blob/main/LICENSE).
467
+
468
+ <br />
469
+
470
+ ## Acknowledgements
471
+
472
+ The plugin ships no fonts. Families chosen from [Google Fonts](https://fonts.google.com) are served by Google under their own open licenses, mostly the SIL Open Font License, and uploaded fonts under whatever license the project holds. WOFF2 files are read with the help of [brotli.js](https://github.com/devongovett/brotli.js), under the MIT License. Icons for the Studio's own controls come from `@sanity/icons`, so they match the rest of the Studio. The plugin's own Studio icon is based on [Lucide](https://lucide.dev), distributed under the [ISC License](https://github.com/lucide-icons/lucide/blob/main/LICENSE), and its logo comes from [Central Icon System](https://iconists.co/central), used under its license.
473
+
474
+ <br />
475
+ <br />
476
+
477
+ <div align="center">
478
+ <p><strong>Built alongside <a href="https://cairn.driftime.com">Cairn</a>, a starting point for responsible web experiences.</strong></p>
479
+ <p>Part of a suite of Sanity Studio plugins by Driftime®</p>
480
+ <p><a href="https://github.com/driftime/sanity-plugins#readme">Sanity Plugins</a> · <a href="https://github.com/driftime/sanity-plugins/tree/main/packages/handbook#readme">Handbook</a> · <a href="https://github.com/driftime/sanity-plugins/tree/main/packages/icon#readme">Icon</a> · <a href="https://github.com/driftime/sanity-plugins/tree/main/packages/color#readme">Color</a> · <a href="https://github.com/driftime/sanity-plugins/tree/main/packages/link#readme">Link</a> · <a href="https://github.com/driftime/sanity-plugins/tree/main/packages/font#readme">Font</a></p>
481
+ </div>
482
+
483
+ <br />
484
+
485
+ <div align="center">
486
+ <a href="https://driftime.com">
487
+ <picture>
488
+ <source media="(prefers-color-scheme: dark)" srcset="https://driftime.com/driftime-github-logo-dark.svg" />
489
+ <source media="(prefers-color-scheme: light)" srcset="https://driftime.com/driftime-github-logo.svg" />
490
+ <img src="https://driftime.com/driftime-github-logo.svg" alt="Driftime® Logo" width="100" />
491
+ </picture>
492
+ </a>
493
+ </div>