@unocss/preset-web-fonts 66.1.4 → 66.2.0

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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { W as WebFontMeta, a as WebFontsProviders, R as ResolvedWebFontMeta, P as Provider, b as WebFontsOptions } from './shared/preset-web-fonts.TGEYFvVV.mjs';
3
- export { A as Axes, c as WebFontProcessor } from './shared/preset-web-fonts.TGEYFvVV.mjs';
2
+ import { W as WebFontMeta, a as WebFontsProviders, R as ResolvedWebFontMeta, P as Provider, b as WebFontsOptions } from './shared/preset-web-fonts.Du87QQvO.mjs';
3
+ export { A as Axes, c as WebFontProcessor } from './shared/preset-web-fonts.Du87QQvO.mjs';
4
4
 
5
5
  declare function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): ResolvedWebFontMeta;
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { W as WebFontMeta, a as WebFontsProviders, R as ResolvedWebFontMeta, P as Provider, b as WebFontsOptions } from './shared/preset-web-fonts.TGEYFvVV.js';
3
- export { A as Axes, c as WebFontProcessor } from './shared/preset-web-fonts.TGEYFvVV.js';
2
+ import { W as WebFontMeta, a as WebFontsProviders, R as ResolvedWebFontMeta, P as Provider, b as WebFontsOptions } from './shared/preset-web-fonts.Du87QQvO.js';
3
+ export { A as Axes, c as WebFontProcessor } from './shared/preset-web-fonts.Du87QQvO.js';
4
4
 
5
5
  declare function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): ResolvedWebFontMeta;
6
6
 
package/dist/index.mjs CHANGED
@@ -24,6 +24,28 @@ const BunnyFontsProvider = createBunnyFontsProvider(
24
24
  "https://fonts.bunny.net"
25
25
  );
26
26
 
27
+ function createCoolLabsCompatibleProvider(name, host) {
28
+ return {
29
+ name,
30
+ getImportUrl(fonts) {
31
+ const sort = (weights) => {
32
+ const firstW = weights.map((w) => w[0]);
33
+ const lastW = weights.map((w) => w[1]);
34
+ return `${firstW.join(";")};${lastW.join(";")}`;
35
+ };
36
+ const strings = fonts.map((i) => {
37
+ let name2 = i.name.replace(/\s+/g, "+");
38
+ if (i.weights?.length) {
39
+ name2 += i.italic ? `:ital,wght@${sort(i.weights.map((w) => [`0,${w}`, `1,${w}`]))}` : `:wght@${i.weights.join(";")}`;
40
+ }
41
+ return `family=${name2}`;
42
+ }).join("&");
43
+ return `${host}/css2?${strings}&display=swap`;
44
+ }
45
+ };
46
+ }
47
+ const CoolLabsFontsProvider = createCoolLabsCompatibleProvider("coollabs", "https://api.fonts.coollabs.io");
48
+
27
49
  const FontshareProvider = createFontshareProvider("fontshare", "https://api.fontshare.com");
28
50
  function createFontshareProvider(name, host) {
29
51
  return {
@@ -194,6 +216,7 @@ const builtinProviders = {
194
216
  bunny: BunnyFontsProvider,
195
217
  fontshare: FontshareProvider,
196
218
  fontsource: FontSourceProvider,
219
+ coollabs: CoolLabsFontsProvider,
197
220
  none: NoneProvider
198
221
  };
199
222
  function resolveProvider(provider) {
package/dist/local.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as WebFontProcessor } from './shared/preset-web-fonts.TGEYFvVV.mjs';
1
+ import { c as WebFontProcessor } from './shared/preset-web-fonts.Du87QQvO.mjs';
2
2
  import '@unocss/core';
3
3
 
4
4
  interface LocalFontProcessorOptions {
package/dist/local.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as WebFontProcessor } from './shared/preset-web-fonts.TGEYFvVV.js';
1
+ import { c as WebFontProcessor } from './shared/preset-web-fonts.Du87QQvO.js';
2
2
  import '@unocss/core';
3
3
 
4
4
  interface LocalFontProcessorOptions {
@@ -1,6 +1,6 @@
1
1
  import { Awaitable, Arrayable } from '@unocss/core';
2
2
 
3
- type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'fontsource' | 'none' | Provider;
3
+ type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'fontsource' | 'coollabs' | 'none' | Provider;
4
4
  interface WebFontMeta {
5
5
  name: string;
6
6
  weights?: (string | number)[];
@@ -1,6 +1,6 @@
1
1
  import { Awaitable, Arrayable } from '@unocss/core';
2
2
 
3
- type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'fontsource' | 'none' | Provider;
3
+ type WebFontsProviders = 'google' | 'bunny' | 'fontshare' | 'fontsource' | 'coollabs' | 'none' | Provider;
4
4
  interface WebFontMeta {
5
5
  name: string;
6
6
  weights?: (string | number)[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/preset-web-fonts",
3
3
  "type": "module",
4
- "version": "66.1.4",
4
+ "version": "66.2.0",
5
5
  "description": "Web Fonts support for Uno CSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "ofetch": "^1.4.1",
53
- "@unocss/core": "66.1.4"
53
+ "@unocss/core": "66.2.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "unbuild",