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.
- package/README.md +12 -8
- package/dist/chunk-9UNmgxP_.js +1 -0
- package/dist/constants.js +1 -1
- package/dist/declarations-D084A7_6.d.ts +39 -0
- package/dist/fontkit.d.ts +2 -2
- package/dist/fontkit.js +3 -1
- package/dist/format-available-values.js +1 -1
- package/dist/get-fallback-font-override-metrics-u23t231H.js +1 -0
- package/dist/google/fetch-css-from-google-fonts.js +1 -2
- package/dist/google/fetch-font-file.js +1 -1
- package/dist/google/fetch-resource.js +1 -1
- package/dist/google/find-font-files-in-css.js +2 -1
- package/dist/google/get-fallback-font-override-metrics.js +1 -1
- package/dist/google/get-font-axes.js +1 -3
- package/dist/google/get-google-fonts-url.js +1 -1
- package/dist/google/get-proxy-agent.js +13 -4
- package/dist/google/google-fonts-metadata.js +1 -1
- package/dist/google/index.js +1 -1
- package/dist/google/loader.d.ts +4 -38
- package/dist/google/loader.js +8 -9
- package/dist/google/retry.js +1 -3
- package/dist/google/sort-fonts-variant-values.js +1 -1
- package/dist/google/validate-google-font-function-call.js +1 -9
- package/dist/google-fonts-metadata-uXngxjL5.js +1 -0
- package/dist/index.d.ts +2 -38
- package/dist/index.js +1 -1
- package/dist/local/get-fallback-metrics-from-font-file.js +1 -1
- package/dist/local/index.js +1 -1
- package/dist/local/loader.d.ts +4 -38
- package/dist/local/loader.js +3 -5
- package/dist/local/pick-font-file-for-fallback-generation.js +1 -2
- package/dist/local/validate-local-font-function-call.js +1 -2
- package/dist/next-font-error.js +1 -1
- package/dist/types.js +1 -1
- package/dist/utils-Vxow00oE.js +1 -0
- package/google/index.d.ts +1 -1
- package/google/index.js +2 -2
- package/google/loader.d.ts +1 -1
- package/google/loader.js +1 -1
- package/local/index.d.ts +1 -1
- package/local/index.js +2 -2
- package/local/loader.d.ts +1 -1
- package/local/loader.js +1 -1
- package/manifest/index.d.ts +17 -15
- package/manifest/index.js +3 -1
- package/package.json +27 -28
- package/LICENSE +0 -11
- package/dist/cc-D_YwSRId.js +0 -1
- package/dist/constants.d.ts +0 -3
- package/dist/format-available-values.d.ts +0 -7
- package/dist/google/cc-BnfmUjCg.mjs +0 -1
- package/dist/google/fetch-css-from-google-fonts.d.ts +0 -10
- package/dist/google/fetch-font-file.d.ts +0 -7
- package/dist/google/fetch-resource.d.ts +0 -8
- package/dist/google/find-font-files-in-css.d.ts +0 -11
- package/dist/google/get-fallback-font-override-metrics.d.ts +0 -16
- package/dist/google/get-font-axes.d.ts +0 -10
- package/dist/google/get-google-fonts-url.d.ts +0 -10
- package/dist/google/get-proxy-agent.d.ts +0 -8
- package/dist/google/google-fonts-metadata.d.ts +0 -16
- package/dist/google/index.d.ts +0 -18414
- package/dist/google/retry.d.ts +0 -5
- package/dist/google/sort-fonts-variant-values.d.ts +0 -7
- package/dist/google/validate-google-font-function-call.d.ts +0 -18
- package/dist/local/fontkit-DX1wsFnK.js +0 -1
- package/dist/local/get-fallback-metrics-from-font-file.d.ts +0 -21
- package/dist/local/index.d.ts +0 -23
- package/dist/local/pick-font-file-for-fallback-generation.d.ts +0 -15
- package/dist/local/validate-local-font-function-call.d.ts +0 -26
- package/dist/next-font-error.d.ts +0 -6
- 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 };
|
package/dist/local/index.d.ts
DELETED
|
@@ -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 };
|
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 };
|