@frontfactory/vitepress-theme 1.5.0 → 1.5.2
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 +18 -1
- package/config.d.ts +4 -4
- package/config.js +39 -17
- package/dist/style.css +1 -2011
- package/package.json +15 -6
- 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 +30 -14
- package/src/composables/options.ts +23 -14
- 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 -5
- 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 +13 -8
- 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 +2 -2
package/README.md
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
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
|
|
|
6
10
|
It extends the VitePress default theme rather than forking it: search, i18n, mobile navigation and
|
|
7
11
|
every markdown feature keep working, while the whole surface is redrawn.
|
|
8
12
|
|
|
13
|
+
## Playground
|
|
14
|
+
|
|
15
|
+
Try it live on StackBlitz — no installation required:
|
|
16
|
+
|
|
17
|
+
[](https://stackblitz.com/~/github.com/front-factory/vitepress-theme?startScript=dev:playground)
|
|
18
|
+
|
|
9
19
|
## Install
|
|
10
20
|
|
|
11
21
|
```bash
|
|
12
22
|
npm install @frontfactory/vitepress-theme
|
|
13
23
|
```
|
|
14
24
|
|
|
15
|
-
Requires Node
|
|
25
|
+
Requires Node 24+, `vitepress` 2 and `vue` 3.5 in the host project. Nothing else — the stylesheet is
|
|
16
26
|
shipped compiled, so Sass is not needed downstream.
|
|
17
27
|
|
|
18
28
|
## Use
|
|
@@ -132,6 +142,13 @@ themeConfig: {
|
|
|
132
142
|
Per page, `docMeta: false` in the frontmatter drops the kicker, and `section: Guide` overrides the
|
|
133
143
|
section name.
|
|
134
144
|
|
|
145
|
+
Banner text, hero title/tagline/quote, feature title/details, footer message/copyright and card icon
|
|
146
|
+
all render as HTML (`v-html`), not escaped text — a `<strong>` or a hand-written `<a>` in any of them
|
|
147
|
+
shows up as markup. The trust boundary is the config file itself: these strings are meant to come
|
|
148
|
+
from whoever writes `themeConfig.ff` in the VitePress config, not from a reader, a comment, or a CMS
|
|
149
|
+
field someone else can edit. If a site ever pipes such input into these fields, sanitize it before it
|
|
150
|
+
reaches the config — the theme does not.
|
|
151
|
+
|
|
135
152
|
## Translating
|
|
136
153
|
|
|
137
154
|
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
|
|
@@ -13,12 +13,15 @@ const overrides = {
|
|
|
13
13
|
VPFeature: 'src/components/FfFeature.vue',
|
|
14
14
|
VPFooter: 'src/components/FfFooter.vue',
|
|
15
15
|
VPHomeSponsors: 'src/components/FfHomeSponsors.vue'
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
|
|
18
|
-
const alias = Object.entries(overrides).map(([
|
|
18
|
+
const alias = Object.entries(overrides).map(([
|
|
19
|
+
name,
|
|
20
|
+
file
|
|
21
|
+
]) => ({
|
|
19
22
|
find: new RegExp(`^.*\\/${name}\\.vue$`),
|
|
20
23
|
replacement: resolve(dir, file)
|
|
21
|
-
}))
|
|
24
|
+
}));
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Base config for `extends`, per
|
|
@@ -37,25 +40,44 @@ const alias = Object.entries(overrides).map(([name, file]) => ({
|
|
|
37
40
|
*/
|
|
38
41
|
const config = {
|
|
39
42
|
vite: {
|
|
40
|
-
resolve: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
}
|
|
44
64
|
},
|
|
45
65
|
transformHead({ siteData }) {
|
|
46
|
-
const id = siteData.themeConfig?.ff?.banner?.id
|
|
66
|
+
const id = siteData.themeConfig?.ff?.banner?.id;
|
|
47
67
|
|
|
48
|
-
if (!id)
|
|
68
|
+
if (!id) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
49
71
|
|
|
50
72
|
return [
|
|
51
73
|
[
|
|
52
74
|
'script',
|
|
53
75
|
{},
|
|
54
76
|
`try{if(localStorage.getItem('ff-banner-${id}'))` +
|
|
55
|
-
|
|
77
|
+
'document.documentElement.classList.add(\'ff-banner-dismissed\')}catch(e){}'
|
|
56
78
|
]
|
|
57
|
-
]
|
|
79
|
+
];
|
|
58
80
|
}
|
|
59
|
-
}
|
|
81
|
+
};
|
|
60
82
|
|
|
61
|
-
export default config
|
|
83
|
+
export default config;
|