@unocss/preset-web-fonts 0.55.1 → 0.55.2

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/dist/index.cjs CHANGED
@@ -176,5 +176,5 @@ function preset(options = {}) {
176
176
  }
177
177
 
178
178
  exports.createGoogleProvider = createGoogleCompatibleProvider;
179
- exports["default"] = preset;
179
+ exports.default = preset;
180
180
  exports.normalizedFontMeta = normalizedFontMeta;
@@ -0,0 +1,63 @@
1
+ import { Preset } from '@unocss/core';
2
+
3
+ type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'none' | Provider;
4
+ interface WebFontMeta {
5
+ name: string;
6
+ weights?: (string | number)[];
7
+ italic?: boolean;
8
+ /**
9
+ * Override the provider
10
+ * @default <matches root config>
11
+ */
12
+ provider?: WebFontsProviders;
13
+ }
14
+ interface ResolvedWebFontMeta extends Omit<WebFontMeta, 'provider'> {
15
+ provider: Provider;
16
+ }
17
+ interface WebFontsOptions {
18
+ /**
19
+ * Provider service of the web fonts
20
+ * @default 'google'
21
+ */
22
+ provider?: WebFontsProviders;
23
+ /**
24
+ * The fonts
25
+ */
26
+ fonts?: Record<string, WebFontMeta | string | (WebFontMeta | string)[]>;
27
+ /**
28
+ * Extend fonts to the theme object
29
+ * @default true
30
+ */
31
+ extendTheme?: boolean;
32
+ /**
33
+ * Key for the theme object
34
+ *
35
+ * @default 'fontFamily'
36
+ */
37
+ themeKey?: string;
38
+ /**
39
+ * Inline CSS @import()
40
+ *
41
+ * @default true
42
+ */
43
+ inlineImports?: boolean;
44
+ /**
45
+ * Custom fetch function
46
+ *
47
+ * @default undefined
48
+ */
49
+ customFetch?: (url: string) => Promise<any>;
50
+ }
51
+ interface Provider {
52
+ name: WebFontsProviders;
53
+ getPreflight?(fonts: WebFontMeta[]): string;
54
+ getImportUrl?(fonts: WebFontMeta[]): string | undefined;
55
+ getFontName?(font: WebFontMeta): string;
56
+ }
57
+
58
+ declare function createGoogleCompatibleProvider(name: WebFontsProviders, host: string): Provider;
59
+
60
+ declare function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): ResolvedWebFontMeta;
61
+ declare function preset(options?: WebFontsOptions): Preset<any>;
62
+
63
+ export { Provider, ResolvedWebFontMeta, WebFontMeta, WebFontsOptions, WebFontsProviders, createGoogleCompatibleProvider as createGoogleProvider, preset as default, normalizedFontMeta };
@@ -0,0 +1,63 @@
1
+ import { Preset } from '@unocss/core';
2
+
3
+ type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'none' | Provider;
4
+ interface WebFontMeta {
5
+ name: string;
6
+ weights?: (string | number)[];
7
+ italic?: boolean;
8
+ /**
9
+ * Override the provider
10
+ * @default <matches root config>
11
+ */
12
+ provider?: WebFontsProviders;
13
+ }
14
+ interface ResolvedWebFontMeta extends Omit<WebFontMeta, 'provider'> {
15
+ provider: Provider;
16
+ }
17
+ interface WebFontsOptions {
18
+ /**
19
+ * Provider service of the web fonts
20
+ * @default 'google'
21
+ */
22
+ provider?: WebFontsProviders;
23
+ /**
24
+ * The fonts
25
+ */
26
+ fonts?: Record<string, WebFontMeta | string | (WebFontMeta | string)[]>;
27
+ /**
28
+ * Extend fonts to the theme object
29
+ * @default true
30
+ */
31
+ extendTheme?: boolean;
32
+ /**
33
+ * Key for the theme object
34
+ *
35
+ * @default 'fontFamily'
36
+ */
37
+ themeKey?: string;
38
+ /**
39
+ * Inline CSS @import()
40
+ *
41
+ * @default true
42
+ */
43
+ inlineImports?: boolean;
44
+ /**
45
+ * Custom fetch function
46
+ *
47
+ * @default undefined
48
+ */
49
+ customFetch?: (url: string) => Promise<any>;
50
+ }
51
+ interface Provider {
52
+ name: WebFontsProviders;
53
+ getPreflight?(fonts: WebFontMeta[]): string;
54
+ getImportUrl?(fonts: WebFontMeta[]): string | undefined;
55
+ getFontName?(font: WebFontMeta): string;
56
+ }
57
+
58
+ declare function createGoogleCompatibleProvider(name: WebFontsProviders, host: string): Provider;
59
+
60
+ declare function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): ResolvedWebFontMeta;
61
+ declare function preset(options?: WebFontsOptions): Preset<any>;
62
+
63
+ export { Provider, ResolvedWebFontMeta, WebFontMeta, WebFontsOptions, WebFontsProviders, createGoogleCompatibleProvider as createGoogleProvider, preset as default, normalizedFontMeta };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-web-fonts",
3
- "version": "0.55.1",
3
+ "version": "0.55.2",
4
4
  "description": "Web Fonts support for Uno CSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "ofetch": "^1.1.1",
41
- "@unocss/core": "0.55.1"
41
+ "@unocss/core": "0.55.2"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",