next-font 1.2.0 → 1.2.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 (71) hide show
  1. package/README.md +12 -8
  2. package/dist/chunk-9UNmgxP_.js +1 -0
  3. package/dist/constants.js +1 -1
  4. package/dist/declarations-D084A7_6.d.ts +39 -0
  5. package/dist/fontkit.d.ts +2 -2
  6. package/dist/fontkit.js +3 -1
  7. package/dist/format-available-values.js +1 -1
  8. package/dist/get-fallback-font-override-metrics-u23t231H.js +1 -0
  9. package/dist/google/fetch-css-from-google-fonts.js +1 -2
  10. package/dist/google/fetch-font-file.js +1 -1
  11. package/dist/google/fetch-resource.js +1 -1
  12. package/dist/google/find-font-files-in-css.js +2 -1
  13. package/dist/google/get-fallback-font-override-metrics.js +1 -1
  14. package/dist/google/get-font-axes.js +1 -3
  15. package/dist/google/get-google-fonts-url.js +1 -1
  16. package/dist/google/get-proxy-agent.js +13 -4
  17. package/dist/google/google-fonts-metadata.js +1 -1
  18. package/dist/google/index.js +1 -1
  19. package/dist/google/loader.d.ts +4 -38
  20. package/dist/google/loader.js +8 -9
  21. package/dist/google/retry.js +1 -3
  22. package/dist/google/sort-fonts-variant-values.js +1 -1
  23. package/dist/google/validate-google-font-function-call.js +1 -9
  24. package/dist/google-fonts-metadata-uXngxjL5.js +1 -0
  25. package/dist/index.d.ts +2 -38
  26. package/dist/index.js +1 -1
  27. package/dist/local/get-fallback-metrics-from-font-file.js +1 -1
  28. package/dist/local/index.js +1 -1
  29. package/dist/local/loader.d.ts +4 -38
  30. package/dist/local/loader.js +3 -5
  31. package/dist/local/pick-font-file-for-fallback-generation.js +1 -2
  32. package/dist/local/validate-local-font-function-call.js +1 -2
  33. package/dist/next-font-error.js +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/utils-Vxow00oE.js +1 -0
  36. package/google/index.d.ts +1 -1
  37. package/google/index.js +2 -2
  38. package/google/loader.d.ts +1 -1
  39. package/google/loader.js +1 -1
  40. package/local/index.d.ts +1 -1
  41. package/local/index.js +2 -2
  42. package/local/loader.d.ts +1 -1
  43. package/local/loader.js +1 -1
  44. package/manifest/index.d.ts +17 -15
  45. package/manifest/index.js +3 -1
  46. package/package.json +27 -28
  47. package/LICENSE +0 -11
  48. package/dist/cc-D_YwSRId.js +0 -1
  49. package/dist/constants.d.ts +0 -3
  50. package/dist/format-available-values.d.ts +0 -7
  51. package/dist/google/cc-BnfmUjCg.mjs +0 -1
  52. package/dist/google/fetch-css-from-google-fonts.d.ts +0 -10
  53. package/dist/google/fetch-font-file.d.ts +0 -7
  54. package/dist/google/fetch-resource.d.ts +0 -8
  55. package/dist/google/find-font-files-in-css.d.ts +0 -11
  56. package/dist/google/get-fallback-font-override-metrics.d.ts +0 -16
  57. package/dist/google/get-font-axes.d.ts +0 -10
  58. package/dist/google/get-google-fonts-url.d.ts +0 -10
  59. package/dist/google/get-proxy-agent.d.ts +0 -8
  60. package/dist/google/google-fonts-metadata.d.ts +0 -16
  61. package/dist/google/index.d.ts +0 -18414
  62. package/dist/google/retry.d.ts +0 -5
  63. package/dist/google/sort-fonts-variant-values.d.ts +0 -7
  64. package/dist/google/validate-google-font-function-call.d.ts +0 -18
  65. package/dist/local/fontkit-DX1wsFnK.js +0 -1
  66. package/dist/local/get-fallback-metrics-from-font-file.d.ts +0 -21
  67. package/dist/local/index.d.ts +0 -23
  68. package/dist/local/pick-font-file-for-fallback-generation.d.ts +0 -15
  69. package/dist/local/validate-local-font-function-call.d.ts +0 -26
  70. package/dist/next-font-error.d.ts +0 -6
  71. package/dist/types.d.ts +0 -15
@@ -1,21 +0,0 @@
1
- import { Font } from 'fontkit';
2
- import { AdjustFontFallback } from 'next-font';
3
-
4
- /**
5
- * Given a font file and category, calculate the fallback font override values.
6
- * The returned values can be used to generate a CSS @font-face declaration.
7
- *
8
- * For example:
9
- * @font-face {
10
- * font-family: local-font;
11
- * src: local(Arial);
12
- * size-adjust: 90%;
13
- * }
14
- *
15
- * Read more about this technique in these texts by the Google Aurora team:
16
- * https://developer.chrome.com/blog/font-fallbacks/
17
- * https://docs.google.com/document/d/e/2PACX-1vRsazeNirATC7lIj2aErSHpK26hZ6dA9GsQ069GEbq5fyzXEhXbvByoftSfhG82aJXmrQ_sJCPBqcx_/pub
18
- */
19
- declare function getFallbackMetricsFromFontFile(font: Font, category?: string): AdjustFontFallback;
20
-
21
- export { getFallbackMetricsFromFontFile };
@@ -1,23 +0,0 @@
1
- import { CssVariable, Display, NextFont, NextFontWithVariable } from '../types';
2
-
3
- type LocalFont<T extends CssVariable | undefined = undefined> = {
4
- src: string | Array<{
5
- path: string;
6
- weight?: string;
7
- style?: string;
8
- }>;
9
- display?: Display;
10
- weight?: string;
11
- style?: string;
12
- adjustFontFallback?: 'Arial' | 'Times New Roman' | false;
13
- fallback?: string[];
14
- preload?: boolean;
15
- variable?: T;
16
- declarations?: Array<{
17
- prop: string;
18
- value: string;
19
- }>;
20
- };
21
- declare function localFont<T extends CssVariable | undefined = undefined>(options: LocalFont<T>): T extends undefined ? NextFont : NextFontWithVariable;
22
-
23
- export { localFont as default };
@@ -1,15 +0,0 @@
1
- /**
2
- * If multiple font files are provided for a font family, we need to pick one to use for the automatic fallback generation.
3
- * This function returns the font file that is most likely to be used for the bulk of the text on a page.
4
- *
5
- * There are some assumptions here about the text on a page when picking the font file:
6
- * - Most of the text will have normal weight, use the one closest to 400
7
- * - Most of the text will have normal style, prefer normal over italic
8
- * - If two font files have the same distance from normal weight, the thinner one will most likely be the bulk of the text
9
- */
10
- declare function pickFontFileForFallbackGeneration<T extends {
11
- style?: string;
12
- weight?: string;
13
- }>(fontFiles: T[]): T;
14
-
15
- export { pickFontFileForFallbackGeneration };
@@ -1,26 +0,0 @@
1
- type FontOptions = {
2
- src: Array<{
3
- path: string;
4
- weight?: string;
5
- style?: string;
6
- ext: string;
7
- format: string;
8
- }>;
9
- display: string;
10
- weight?: string;
11
- style?: string;
12
- fallback?: string[];
13
- preload: boolean;
14
- variable?: string;
15
- adjustFontFallback?: string | false;
16
- declarations?: Array<{
17
- prop: string;
18
- value: string;
19
- }>;
20
- };
21
- /**
22
- * Validate the data received from next-swc next-transform-font on next/font/local calls
23
- */
24
- declare function validateLocalFontFunctionCall(functionName: string, fontData: any): FontOptions;
25
-
26
- export { validateLocalFontFunctionCall };
@@ -1,6 +0,0 @@
1
- /**
2
- * Throw NextFontError error. Used by the WellKnownErrorsPlugin to format errors thrown by next/font.
3
- */
4
- declare function nextFontError(message: string): never;
5
-
6
- export { nextFontError };
package/dist/types.d.ts DELETED
@@ -1,15 +0,0 @@
1
- type CssVariable = `--${string}`;
2
- type Display = 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
3
- type NextFont = {
4
- className: string;
5
- style: {
6
- fontFamily: string;
7
- fontWeight?: number;
8
- fontStyle?: string;
9
- };
10
- };
11
- type NextFontWithVariable = NextFont & {
12
- variable: string;
13
- };
14
-
15
- export type { CssVariable, Display, NextFont, NextFontWithVariable };