@frontfactory/vitepress-theme 1.4.2 → 1.5.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/README.md +12 -1
- package/config.d.ts +4 -4
- package/config.js +41 -18
- package/dist/style.css +1 -1919
- package/package.json +16 -7
- package/src/components/FfBackToTop.vue +37 -30
- package/src/components/FfBanner.vue +64 -50
- package/src/components/FfDocMeta.vue +107 -55
- package/src/components/FfFeature.vue +58 -26
- package/src/components/FfFooter.vue +97 -51
- package/src/components/FfHero.vue +168 -109
- package/src/components/FfHeroCommand.vue +66 -47
- package/src/components/FfHomeSponsors.vue +56 -0
- package/src/composables/options.ts +26 -15
- package/src/content/Api.vue +30 -13
- package/src/content/Card.vue +22 -16
- package/src/content/CardGrid.vue +9 -4
- package/src/content/Kbd.vue +1 -1
- package/src/content/Steps.vue +3 -3
- package/src/index.ts +25 -23
- package/src/internal.ts +5 -4
- package/src/layout/FfLayout.vue +45 -34
- package/src/styles/_blocks.scss +1 -0
- package/src/styles/_code.scss +1 -0
- package/src/styles/_content.scss +8 -2
- package/src/styles/_doc.scss +7 -6
- package/src/styles/_home.scss +166 -10
- package/src/styles/_motion.scss +1 -0
- package/src/styles/_nav.scss +5 -3
- package/src/styles/_sidebar.scss +1 -0
- package/src/styles/_tokens.scss +15 -26
- package/src/types.ts +6 -2
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @frontfactory/vitepress-theme
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
|
|
4
|
+
[](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
|
|
5
|
+
[](https://www.npmjs.com/package/@frontfactory/vitepress-theme)
|
|
6
|
+
|
|
3
7
|
Editorial VitePress theme — hairline rules, numbered sections and monospaced metadata. One accent
|
|
4
8
|
token to make it yours.
|
|
5
9
|
|
|
@@ -12,7 +16,7 @@ every markdown feature keep working, while the whole surface is redrawn.
|
|
|
12
16
|
npm install @frontfactory/vitepress-theme
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
Requires Node
|
|
19
|
+
Requires Node 24+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
|
|
16
20
|
shipped compiled, so Sass is not needed downstream.
|
|
17
21
|
|
|
18
22
|
## Use
|
|
@@ -132,6 +136,13 @@ themeConfig: {
|
|
|
132
136
|
Per page, `docMeta: false` in the frontmatter drops the kicker, and `section: Guide` overrides the
|
|
133
137
|
section name.
|
|
134
138
|
|
|
139
|
+
Banner text, hero title/tagline/quote, feature title/details, footer message/copyright and card icon
|
|
140
|
+
all render as HTML (`v-html`), not escaped text — a `<strong>` or a hand-written `<a>` in any of them
|
|
141
|
+
shows up as markup. The trust boundary is the config file itself: these strings are meant to come
|
|
142
|
+
from whoever writes `themeConfig.ff` in the VitePress config, not from a reader, a comment, or a CMS
|
|
143
|
+
field someone else can edit. If a site ever pipes such input into these fields, sanitize it before it
|
|
144
|
+
reaches the config — the theme does not.
|
|
145
|
+
|
|
135
146
|
## Translating
|
|
136
147
|
|
|
137
148
|
Every string the theme adds sits in `themeConfig.ff.labels`, so it is translated the same way as any
|
package/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UserConfig } from 'vitepress'
|
|
2
|
-
import type { ThemeConfig } from './src/types'
|
|
1
|
+
import type { UserConfig } from 'vitepress';
|
|
2
|
+
import type { ThemeConfig } from './src/types';
|
|
3
3
|
|
|
4
|
-
declare const config: UserConfig<ThemeConfig
|
|
4
|
+
declare const config: UserConfig<ThemeConfig>;
|
|
5
5
|
|
|
6
|
-
export default config
|
|
6
|
+
export default config;
|
package/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolve } from 'node:path'
|
|
2
|
-
import { searchForWorkspaceRoot } from 'vite'
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { searchForWorkspaceRoot } from 'vite';
|
|
3
3
|
|
|
4
|
-
const dir = import.meta.dirname
|
|
5
|
-
const pkg = '@frontfactory/vitepress-theme'
|
|
4
|
+
const dir = import.meta.dirname;
|
|
5
|
+
const pkg = '@frontfactory/vitepress-theme';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default theme components this theme replaces wholesale. VitePress resolves them by path, so the
|
|
@@ -11,13 +11,17 @@ const pkg = '@frontfactory/vitepress-theme'
|
|
|
11
11
|
const overrides = {
|
|
12
12
|
VPHero: 'src/components/FfHero.vue',
|
|
13
13
|
VPFeature: 'src/components/FfFeature.vue',
|
|
14
|
-
VPFooter: 'src/components/FfFooter.vue'
|
|
15
|
-
|
|
14
|
+
VPFooter: 'src/components/FfFooter.vue',
|
|
15
|
+
VPHomeSponsors: 'src/components/FfHomeSponsors.vue'
|
|
16
|
+
};
|
|
16
17
|
|
|
17
|
-
const alias = Object.entries(overrides).map(([
|
|
18
|
+
const alias = Object.entries(overrides).map(([
|
|
19
|
+
name,
|
|
20
|
+
file
|
|
21
|
+
]) => ({
|
|
18
22
|
find: new RegExp(`^.*\\/${name}\\.vue$`),
|
|
19
23
|
replacement: resolve(dir, file)
|
|
20
|
-
}))
|
|
24
|
+
}));
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Base config for `extends`, per
|
|
@@ -36,25 +40,44 @@ const alias = Object.entries(overrides).map(([name, file]) => ({
|
|
|
36
40
|
*/
|
|
37
41
|
const config = {
|
|
38
42
|
vite: {
|
|
39
|
-
resolve: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
resolve: {
|
|
44
|
+
alias
|
|
45
|
+
},
|
|
46
|
+
optimizeDeps: {
|
|
47
|
+
exclude: [
|
|
48
|
+
pkg
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
ssr: {
|
|
52
|
+
noExternal: [
|
|
53
|
+
pkg
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
server: {
|
|
57
|
+
fs: {
|
|
58
|
+
allow: [
|
|
59
|
+
dir,
|
|
60
|
+
searchForWorkspaceRoot(process.cwd())
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
43
64
|
},
|
|
44
65
|
transformHead({ siteData }) {
|
|
45
|
-
const id = siteData.themeConfig?.ff?.banner?.id
|
|
66
|
+
const id = siteData.themeConfig?.ff?.banner?.id;
|
|
46
67
|
|
|
47
|
-
if (!id)
|
|
68
|
+
if (!id) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
48
71
|
|
|
49
72
|
return [
|
|
50
73
|
[
|
|
51
74
|
'script',
|
|
52
75
|
{},
|
|
53
76
|
`try{if(localStorage.getItem('ff-banner-${id}'))` +
|
|
54
|
-
|
|
77
|
+
'document.documentElement.classList.add(\'ff-banner-dismissed\')}catch(e){}'
|
|
55
78
|
]
|
|
56
|
-
]
|
|
79
|
+
];
|
|
57
80
|
}
|
|
58
|
-
}
|
|
81
|
+
};
|
|
59
82
|
|
|
60
|
-
export default config
|
|
83
|
+
export default config;
|