@unocss/preset-web-fonts 0.53.3 → 0.53.4

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
@@ -4,6 +4,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const core = require('@unocss/core');
6
6
 
7
+ function createBunnyFontsProvider(name, host) {
8
+ return {
9
+ name,
10
+ getImportUrl(fonts) {
11
+ const fontFamilies = fonts.map((font) => {
12
+ const { name: name2, weights, italic } = font;
13
+ const formattedName = name2.toLowerCase().replace(/\s/g, "-");
14
+ if (!weights?.length) {
15
+ return `${formattedName}${italic ? ":i" : ""}`;
16
+ }
17
+ let weightsAsString = weights.sort().map((weight) => weight.toString());
18
+ const weightsHaveItalic = weightsAsString.some((weight) => weight.endsWith("i"));
19
+ if (!weightsHaveItalic && italic)
20
+ weightsAsString = weightsAsString.map((weight) => weight += "i");
21
+ return `${formattedName}:${weightsAsString.join(",")}`;
22
+ });
23
+ return `${host}/css?family=${fontFamilies.join("|")}`;
24
+ }
25
+ };
26
+ }
27
+ const BunnyFontsProvider = createBunnyFontsProvider(
28
+ "bunny",
29
+ "https://fonts.bunny.net"
30
+ );
31
+
7
32
  function createGoogleCompatibleProvider(name, host) {
8
33
  return {
9
34
  name,
@@ -26,8 +51,6 @@ function createGoogleCompatibleProvider(name, host) {
26
51
  }
27
52
  const GoogleFontsProvider = createGoogleCompatibleProvider("google", "https://fonts.googleapis.com");
28
53
 
29
- const BunnyFontsProvider = createGoogleCompatibleProvider("bunny", "https://fonts.bunny.net");
30
-
31
54
  const FontshareProvider = createFontshareProvider("fontshare", "https://api.fontshare.com");
32
55
  function createFontshareProvider(name, host) {
33
56
  return {
package/dist/index.mjs CHANGED
@@ -1,5 +1,30 @@
1
1
  import { toArray } from '@unocss/core';
2
2
 
3
+ function createBunnyFontsProvider(name, host) {
4
+ return {
5
+ name,
6
+ getImportUrl(fonts) {
7
+ const fontFamilies = fonts.map((font) => {
8
+ const { name: name2, weights, italic } = font;
9
+ const formattedName = name2.toLowerCase().replace(/\s/g, "-");
10
+ if (!weights?.length) {
11
+ return `${formattedName}${italic ? ":i" : ""}`;
12
+ }
13
+ let weightsAsString = weights.sort().map((weight) => weight.toString());
14
+ const weightsHaveItalic = weightsAsString.some((weight) => weight.endsWith("i"));
15
+ if (!weightsHaveItalic && italic)
16
+ weightsAsString = weightsAsString.map((weight) => weight += "i");
17
+ return `${formattedName}:${weightsAsString.join(",")}`;
18
+ });
19
+ return `${host}/css?family=${fontFamilies.join("|")}`;
20
+ }
21
+ };
22
+ }
23
+ const BunnyFontsProvider = createBunnyFontsProvider(
24
+ "bunny",
25
+ "https://fonts.bunny.net"
26
+ );
27
+
3
28
  function createGoogleCompatibleProvider(name, host) {
4
29
  return {
5
30
  name,
@@ -22,8 +47,6 @@ function createGoogleCompatibleProvider(name, host) {
22
47
  }
23
48
  const GoogleFontsProvider = createGoogleCompatibleProvider("google", "https://fonts.googleapis.com");
24
49
 
25
- const BunnyFontsProvider = createGoogleCompatibleProvider("bunny", "https://fonts.bunny.net");
26
-
27
50
  const FontshareProvider = createFontshareProvider("fontshare", "https://api.fontshare.com");
28
51
  function createFontshareProvider(name, host) {
29
52
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-web-fonts",
3
- "version": "0.53.3",
3
+ "version": "0.53.4",
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.53.3"
41
+ "@unocss/core": "0.53.4"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",