@unocss/preset-web-fonts 0.50.5 → 0.50.7

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 CHANGED
@@ -2,108 +2,10 @@
2
2
 
3
3
  Web fonts support for [UnoCSS](https://github.com/unocss/unocss).
4
4
 
5
- ## Install
6
5
 
7
- ```bash
8
- npm i -D @unocss/preset-web-fonts
9
- ```
6
+ ## Documentation
10
7
 
11
- ```ts
12
- import presetWebFonts from '@unocss/preset-web-fonts'
13
- import presetUno from '@unocss/preset-uno'
14
-
15
- UnoCSS({
16
- presets: [
17
- presetUno(),
18
- presetWebFonts({
19
- provider: 'google', // default provider
20
- fonts: {
21
- // these will extend the default theme
22
- sans: 'Roboto',
23
- mono: ['Fira Code', 'Fira Mono:400,700'],
24
- // custom ones
25
- lobster: 'Lobster',
26
- lato: [
27
- {
28
- name: 'Lato',
29
- weights: ['400', '700'],
30
- italic: true,
31
- },
32
- {
33
- name: 'sans-serif',
34
- provider: 'none',
35
- },
36
- ],
37
- },
38
- }),
39
- ],
40
- })
41
- ```
42
-
43
- The following CSS will be generated
44
-
45
- ```css
46
- @import url('https://fonts.googleapis.com/css2?family=Roboto&family=Fira+Code&family=Fira+Mono:wght@400;700&family=Lobster&family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap');
47
-
48
- /* layer: default */
49
- .font-lato {
50
- font-family: "Lato", sans-serif;
51
- }
52
- .font-lobster {
53
- font-family: "Lobster";
54
- }
55
- .font-mono {
56
- font-family: "Fira Code", "Fira Mono", ui-monospace, SFMono-Regular, Menlo,
57
- Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
58
- }
59
- .font-sans {
60
- font-family: "Roboto", ui-sans-serif, system-ui, -apple-system,
61
- BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
62
- sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
63
- "Noto Color Emoji";
64
- }
65
- ```
66
-
67
- ## Providers
68
-
69
- Currently supported Providers:
70
-
71
- - `none` - do nothing, treat the font as system font
72
- - `google` - [Google Fonts](https://fonts.google.com/)
73
- - `bunny` - [Privacy-Friendly Google Fonts](https://fonts.bunny.net/)
74
- - `fontshare` - [Quality Font Service by ITF](https://www.fontshare.com/)
75
-
76
- PR welcome to add more providers 🙌
77
-
78
- ### Custom fetch function
79
-
80
- Use your own function to fetch font source.
81
-
82
- ```ts
83
- import presetWebFonts from '@unocss/preset-web-fonts'
84
- import presetUno from '@unocss/preset-uno'
85
- import axios from 'axios'
86
- import ProxyAgent from 'proxy-agent'
87
-
88
- UnoCSS({
89
- presets: [
90
- presetUno(),
91
- presetWebFonts({
92
- // use axios with an https proxy
93
- customFetch: (url: string) => axios.get(url, { httpsAgent: new ProxyAgent('https://localhost:7890') }),
94
- provider: 'google',
95
- fonts: {
96
- sans: 'Roboto',
97
- mono: ['Fira Code', 'Fira Mono:400,700'],
98
- },
99
- }),
100
- ],
101
- })
102
- ```
103
-
104
- ## Configuration
105
-
106
- Refer to the [type definition](https://github.com/unocss/unocss/blob/main/packages/preset-web-fonts/src/types.ts#L4) for all configurations available.
8
+ Please refer to the [documentation](https://unocss.dev/presets/web-fonts).
107
9
 
108
10
  ## License
109
11
 
package/dist/index.cjs CHANGED
@@ -75,7 +75,7 @@ const providers = {
75
75
  fontshare: FontshareProvider,
76
76
  none: NoneProvider
77
77
  };
78
- const preset = (options = {}) => {
78
+ function preset(options = {}) {
79
79
  const {
80
80
  provider: defaultProvider = "google",
81
81
  extendTheme = true,
@@ -143,7 +143,7 @@ const preset = (options = {}) => {
143
143
  };
144
144
  }
145
145
  return preset2;
146
- };
146
+ }
147
147
 
148
148
  exports["default"] = preset;
149
149
  exports.normalizedFontMeta = normalizedFontMeta;
package/dist/index.d.ts CHANGED
@@ -53,6 +53,6 @@ interface Provider {
53
53
  }
54
54
 
55
55
  declare function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): WebFontMeta;
56
- declare const preset: (options?: WebFontsOptions) => Preset<any>;
56
+ declare function preset(options?: WebFontsOptions): Preset<any>;
57
57
 
58
58
  export { Provider, WebFontMeta, WebFontsOptions, WebFontsProviders, preset as default, normalizedFontMeta };
package/dist/index.mjs CHANGED
@@ -71,7 +71,7 @@ const providers = {
71
71
  fontshare: FontshareProvider,
72
72
  none: NoneProvider
73
73
  };
74
- const preset = (options = {}) => {
74
+ function preset(options = {}) {
75
75
  const {
76
76
  provider: defaultProvider = "google",
77
77
  extendTheme = true,
@@ -139,6 +139,6 @@ const preset = (options = {}) => {
139
139
  };
140
140
  }
141
141
  return preset2;
142
- };
142
+ }
143
143
 
144
144
  export { preset as default, normalizedFontMeta };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-web-fonts",
3
- "version": "0.50.5",
3
+ "version": "0.50.7",
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.0.1",
41
- "@unocss/core": "0.50.5"
41
+ "@unocss/core": "0.50.7"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",