@movk/nuxt-docs 1.17.0 → 1.17.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/nuxt.config.ts +1 -1
- package/package.json +2 -1
- package/providers/alibaba-puhuiti.ts +36 -0
package/nuxt.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.17.
|
|
4
|
+
"version": "1.17.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"modules",
|
|
34
34
|
"nuxt.config.ts",
|
|
35
35
|
"nuxt.schema.ts",
|
|
36
|
+
"providers",
|
|
36
37
|
"server",
|
|
37
38
|
"utils",
|
|
38
39
|
"pnpm-workspace.yaml",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineFontProvider } from 'unifont'
|
|
2
|
+
import type { FontFaceData } from 'unifont'
|
|
3
|
+
|
|
4
|
+
const WEIGHT_MAP: Record<string, string> = {
|
|
5
|
+
100: 'Thin',
|
|
6
|
+
300: 'Light',
|
|
7
|
+
400: 'Regular',
|
|
8
|
+
500: 'Medium',
|
|
9
|
+
600: 'SemiBold',
|
|
10
|
+
700: 'Bold',
|
|
11
|
+
800: 'ExtraBold',
|
|
12
|
+
900: 'Heavy',
|
|
13
|
+
950: 'Black'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FONT_FAMILY = 'Alibaba PuHuiTi'
|
|
17
|
+
|
|
18
|
+
export function createAlibabaPuHuiTiProvider(cdnBase: string) {
|
|
19
|
+
return defineFontProvider('alibaba-puhuiti', () => ({
|
|
20
|
+
async resolveFont(fontFamily, options) {
|
|
21
|
+
if (fontFamily !== FONT_FAMILY) return undefined
|
|
22
|
+
|
|
23
|
+
const weights = options.weights?.length
|
|
24
|
+
? options.weights.filter(w => WEIGHT_MAP[w])
|
|
25
|
+
: Object.keys(WEIGHT_MAP)
|
|
26
|
+
|
|
27
|
+
const fonts: FontFaceData[] = weights.map(weight => ({
|
|
28
|
+
src: [{ url: `${cdnBase}/AlibabaPuHuiTi-${WEIGHT_MAP[weight]}.woff2`, format: 'woff2' }],
|
|
29
|
+
weight,
|
|
30
|
+
style: 'normal'
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
return { fonts }
|
|
34
|
+
}
|
|
35
|
+
}))
|
|
36
|
+
}
|