@frontfactory/vitepress-theme 1.1.0 β 1.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/README.md +24 -5
- package/dist/style.css +127 -2
- package/package.json +1 -1
- package/src/components/FfBanner.vue +8 -1
- package/src/components/FfFooter.vue +51 -10
- package/src/components/FfHero.vue +31 -1
- package/src/composables/options.ts +2 -1
- package/src/internal.ts +1 -0
- package/src/layout/FfLayout.vue +3 -1
- package/src/styles/_code.scss +26 -0
- package/src/styles/_content.scss +88 -0
- package/src/styles/_home.scss +48 -2
- package/src/styles/_nav.scss +46 -0
- package/src/types.ts +28 -1
package/README.md
CHANGED
|
@@ -97,9 +97,17 @@ themeConfig: {
|
|
|
97
97
|
id: 'v5',
|
|
98
98
|
text: 'Version 5 is out.',
|
|
99
99
|
link: '/whats-new',
|
|
100
|
-
linkText: 'Read the notes'
|
|
100
|
+
linkText: 'Read the notes',
|
|
101
|
+
variant: 'accent', // 'ink' (default) | 'accent' | 'success' | 'warning' | 'danger' | 'rainbow'
|
|
102
|
+
gradient: true, // fade toward the variant's second shade; ignored by rainbow, always a gradient
|
|
103
|
+
icon: 'π'
|
|
101
104
|
},
|
|
102
105
|
|
|
106
|
+
// Order of the search box and the nav menu links in the top bar. 'search-first' is the
|
|
107
|
+
// default theme's own order; 'menu-first' pins the menu against the title instead. No
|
|
108
|
+
// effect on the mobile bar, which always falls back to the hamburger.
|
|
109
|
+
navOrder: 'search-first',
|
|
110
|
+
|
|
103
111
|
// Kicker printed above every page title. Set to false to drop it.
|
|
104
112
|
meta: {
|
|
105
113
|
section: true, // section name, read from the sidebar
|
|
@@ -113,6 +121,9 @@ themeConfig: {
|
|
|
113
121
|
{ title: 'Docs', items: [{ text: 'Guide', link: '/guide/' }] }
|
|
114
122
|
],
|
|
115
123
|
|
|
124
|
+
// Column of `themeConfig.socialLinks` icons, pinned to the right of those columns.
|
|
125
|
+
footerSocial: true,
|
|
126
|
+
|
|
116
127
|
backToTop: true
|
|
117
128
|
}
|
|
118
129
|
}
|
|
@@ -144,7 +155,8 @@ locales: {
|
|
|
144
155
|
heroCopy: 'Copier',
|
|
145
156
|
heroCopied: 'CopiΓ©',
|
|
146
157
|
heroCopyLabel: 'Copier {0}',
|
|
147
|
-
backToTop: 'Haut'
|
|
158
|
+
backToTop: 'Haut',
|
|
159
|
+
footerSocial: 'Nous suivre'
|
|
148
160
|
}
|
|
149
161
|
}
|
|
150
162
|
}
|
|
@@ -162,6 +174,7 @@ locales: {
|
|
|
162
174
|
| `heroCopied` | `Copied` |
|
|
163
175
|
| `heroCopyLabel` | `Copy {0}` |
|
|
164
176
|
| `backToTop` | `Top` |
|
|
177
|
+
| `footerSocial` | `Follow` |
|
|
165
178
|
|
|
166
179
|
The banner's own `text` and `linkText` are content, not labels, so they stay under `ff.banner`. The
|
|
167
180
|
back-to-top tooltip reuses the default theme's `returnToTopLabel`, and the last-updated stamp is
|
|
@@ -185,9 +198,14 @@ both at once and takes any value between `0` and `1`:
|
|
|
185
198
|
Their colours come from `--ff-color-accent-glow` and `--ff-color-accent-soft`, per scheme.
|
|
186
199
|
|
|
187
200
|
`hero.command` puts an install panel in the second column of the hero, carrying the command and the
|
|
188
|
-
actions
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
actions, sized to the panel's own fixed box. Add `hero.image` (standard VitePress frontmatter, any
|
|
202
|
+
`<img>` source including a gif) or fill the `home-hero-image` slot, and that image claims the second
|
|
203
|
+
column instead, split 50/50 with the text rather than the panel's narrower share β the panel drops
|
|
204
|
+
under the text on the left rather than disappearing, still carrying the command but not the actions,
|
|
205
|
+
which already sit under the text either way. `hero.quote` prints a short line under the tagline,
|
|
206
|
+
ruled and set in italics the same way a markdown blockquote is β inline HTML works, so a term inside
|
|
207
|
+
it can carry its own `<strong>`. `hero.meta` prints a colophon strip under the hero. `hero.command`,
|
|
208
|
+
`hero.quote` and `hero.meta` are all typed by the exported `HeroExtras` interface.
|
|
191
209
|
|
|
192
210
|
```yaml
|
|
193
211
|
---
|
|
@@ -198,6 +216,7 @@ hero:
|
|
|
198
216
|
text: A headline that carries the page.
|
|
199
217
|
tagline: One or two sentences of standfirst.
|
|
200
218
|
command: npm install my-project
|
|
219
|
+
quote: <strong>My project</strong> β what the name means, in one line.
|
|
201
220
|
meta:
|
|
202
221
|
- label: Licence
|
|
203
222
|
value: MIT
|
package/dist/style.css
CHANGED
|
@@ -243,6 +243,31 @@
|
|
|
243
243
|
.ff-theme .VPNavBar {
|
|
244
244
|
border-bottom: var(--ff-rule-width) solid var(--ff-color-rule);
|
|
245
245
|
}
|
|
246
|
+
.ff-theme[data-nav-order=menu-first] .content-body .menu {
|
|
247
|
+
order: 1;
|
|
248
|
+
flex-grow: 0;
|
|
249
|
+
margin-left: 1.5rem;
|
|
250
|
+
margin-right: auto;
|
|
251
|
+
}
|
|
252
|
+
.ff-theme[data-nav-order=menu-first] .content-body .search {
|
|
253
|
+
order: 2;
|
|
254
|
+
margin-right: 0;
|
|
255
|
+
}
|
|
256
|
+
.ff-theme[data-nav-order=menu-first] .content-body .translations {
|
|
257
|
+
order: 3;
|
|
258
|
+
}
|
|
259
|
+
.ff-theme[data-nav-order=menu-first] .content-body .appearance {
|
|
260
|
+
order: 4;
|
|
261
|
+
}
|
|
262
|
+
.ff-theme[data-nav-order=menu-first] .content-body .social-links {
|
|
263
|
+
order: 5;
|
|
264
|
+
}
|
|
265
|
+
.ff-theme[data-nav-order=menu-first] .content-body .extra {
|
|
266
|
+
order: 6;
|
|
267
|
+
}
|
|
268
|
+
.ff-theme[data-nav-order=menu-first] .content-body .hamburger {
|
|
269
|
+
order: 7;
|
|
270
|
+
}
|
|
246
271
|
.ff-theme .VPNavBar.has-sidebar .curtain,
|
|
247
272
|
.ff-theme .VPNavBar .divider {
|
|
248
273
|
display: none;
|
|
@@ -844,6 +869,18 @@
|
|
|
844
869
|
font-family: var(--ff-font-mono);
|
|
845
870
|
color: var(--ff-color-ink-faint);
|
|
846
871
|
}
|
|
872
|
+
.ff-theme .vp-doc [class*=language-] code .highlighted.error {
|
|
873
|
+
box-shadow: inset var(--ff-rule-accent-width) 0 0 0 var(--ff-color-danger);
|
|
874
|
+
}
|
|
875
|
+
.ff-theme .vp-doc [class*=language-] code .highlighted.warning {
|
|
876
|
+
box-shadow: inset var(--ff-rule-accent-width) 0 0 0 var(--ff-color-warning);
|
|
877
|
+
}
|
|
878
|
+
.ff-theme .vp-doc [class*=language-] code .diff.add {
|
|
879
|
+
box-shadow: inset var(--ff-rule-accent-width) 0 0 0 var(--ff-color-success);
|
|
880
|
+
}
|
|
881
|
+
.ff-theme .vp-doc [class*=language-] code .diff.remove {
|
|
882
|
+
box-shadow: inset var(--ff-rule-accent-width) 0 0 0 var(--ff-color-danger);
|
|
883
|
+
}
|
|
847
884
|
.ff-theme .vp-doc .vp-code-group {
|
|
848
885
|
margin: 1.75rem 0;
|
|
849
886
|
border: var(--ff-rule-width) solid var(--ff-color-rule);
|
|
@@ -1042,6 +1079,21 @@
|
|
|
1042
1079
|
color: var(--ff-color-ink-muted);
|
|
1043
1080
|
text-wrap: pretty;
|
|
1044
1081
|
}
|
|
1082
|
+
.ff-theme .ff-hero-quote {
|
|
1083
|
+
max-width: 38ch;
|
|
1084
|
+
margin: 1.75rem 0 0;
|
|
1085
|
+
padding-left: 1.25rem;
|
|
1086
|
+
border-left: var(--ff-rule-accent-width) solid var(--ff-color-rule-strong);
|
|
1087
|
+
font-size: var(--ff-size-body);
|
|
1088
|
+
font-style: italic;
|
|
1089
|
+
line-height: 1.55;
|
|
1090
|
+
color: var(--ff-color-ink-muted);
|
|
1091
|
+
}
|
|
1092
|
+
.ff-theme .ff-hero-quote strong {
|
|
1093
|
+
font-style: normal;
|
|
1094
|
+
font-weight: 620;
|
|
1095
|
+
color: var(--ff-color-ink);
|
|
1096
|
+
}
|
|
1045
1097
|
.ff-theme .ff-hero-actions {
|
|
1046
1098
|
display: flex;
|
|
1047
1099
|
flex-wrap: wrap;
|
|
@@ -1059,6 +1111,10 @@
|
|
|
1059
1111
|
.ff-theme .ff-hero-panel-label {
|
|
1060
1112
|
margin: 0 0 1rem;
|
|
1061
1113
|
}
|
|
1114
|
+
.ff-theme .ff-hero-panel-inline {
|
|
1115
|
+
max-width: 28rem;
|
|
1116
|
+
margin-top: 2.5rem;
|
|
1117
|
+
}
|
|
1062
1118
|
.ff-theme .ff-hero-panel .ff-hero-actions {
|
|
1063
1119
|
margin-top: 1.25rem;
|
|
1064
1120
|
}
|
|
@@ -1103,11 +1159,17 @@
|
|
|
1103
1159
|
display: flex;
|
|
1104
1160
|
align-items: center;
|
|
1105
1161
|
justify-content: center;
|
|
1162
|
+
max-width: 28rem;
|
|
1106
1163
|
}
|
|
1107
1164
|
.ff-theme .ff-hero-image img {
|
|
1108
|
-
|
|
1165
|
+
width: 100%;
|
|
1109
1166
|
height: auto;
|
|
1110
1167
|
}
|
|
1168
|
+
@media (min-width: 960px) {
|
|
1169
|
+
.ff-theme .ff-hero-image {
|
|
1170
|
+
max-width: none;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1111
1173
|
.ff-theme .ff-hero-meta {
|
|
1112
1174
|
position: relative;
|
|
1113
1175
|
display: grid;
|
|
@@ -1149,11 +1211,14 @@
|
|
|
1149
1211
|
.ff-theme .ff-hero-container {
|
|
1150
1212
|
gap: 4.5rem;
|
|
1151
1213
|
}
|
|
1152
|
-
.ff-theme .ff-hero.has-image .ff-hero-container,
|
|
1153
1214
|
.ff-theme .ff-hero.has-panel .ff-hero-container {
|
|
1154
1215
|
grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
|
|
1155
1216
|
align-items: center;
|
|
1156
1217
|
}
|
|
1218
|
+
.ff-theme .ff-hero.has-image .ff-hero-container {
|
|
1219
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
1220
|
+
align-items: center;
|
|
1221
|
+
}
|
|
1157
1222
|
}
|
|
1158
1223
|
.ff-theme .ff-btn {
|
|
1159
1224
|
display: inline-flex;
|
|
@@ -1307,6 +1372,45 @@
|
|
|
1307
1372
|
background: var(--ff-color-ink);
|
|
1308
1373
|
color: var(--ff-color-paper);
|
|
1309
1374
|
}
|
|
1375
|
+
.ff-theme .ff-banner[data-variant=ink] {
|
|
1376
|
+
--ff-banner-from: var(--ff-color-ink);
|
|
1377
|
+
--ff-banner-to: var(--ff-color-ink-muted);
|
|
1378
|
+
color: var(--ff-color-paper);
|
|
1379
|
+
}
|
|
1380
|
+
.ff-theme .ff-banner[data-variant=accent] {
|
|
1381
|
+
--ff-banner-from: var(--ff-color-accent);
|
|
1382
|
+
--ff-banner-to: var(--ff-color-accent-hover);
|
|
1383
|
+
color: var(--ff-color-accent-contrast);
|
|
1384
|
+
}
|
|
1385
|
+
.ff-theme .ff-banner[data-variant=success] {
|
|
1386
|
+
--ff-banner-from: var(--ff-color-success);
|
|
1387
|
+
--ff-banner-to: var(--ff-color-ink);
|
|
1388
|
+
color: var(--ff-color-paper);
|
|
1389
|
+
}
|
|
1390
|
+
.ff-theme .ff-banner[data-variant=warning] {
|
|
1391
|
+
--ff-banner-from: var(--ff-color-warning);
|
|
1392
|
+
--ff-banner-to: var(--ff-color-ink);
|
|
1393
|
+
color: var(--ff-color-paper);
|
|
1394
|
+
}
|
|
1395
|
+
.ff-theme .ff-banner[data-variant=danger] {
|
|
1396
|
+
--ff-banner-from: var(--ff-color-danger);
|
|
1397
|
+
--ff-banner-to: var(--ff-color-ink);
|
|
1398
|
+
color: var(--ff-color-paper);
|
|
1399
|
+
}
|
|
1400
|
+
.ff-theme .ff-banner:not([data-gradient]) {
|
|
1401
|
+
background: var(--ff-banner-from);
|
|
1402
|
+
}
|
|
1403
|
+
.ff-theme .ff-banner[data-gradient] {
|
|
1404
|
+
background: linear-gradient(100deg, var(--ff-banner-from), var(--ff-banner-to));
|
|
1405
|
+
}
|
|
1406
|
+
.ff-theme .ff-banner[data-variant=rainbow] {
|
|
1407
|
+
background: linear-gradient(100deg, var(--ff-color-accent), var(--ff-color-danger), var(--ff-color-warning), var(--ff-color-success));
|
|
1408
|
+
color: var(--ff-color-accent-contrast);
|
|
1409
|
+
}
|
|
1410
|
+
.ff-theme .ff-banner-icon {
|
|
1411
|
+
font-size: 1rem;
|
|
1412
|
+
line-height: 1;
|
|
1413
|
+
}
|
|
1310
1414
|
.ff-theme .ff-banner-body {
|
|
1311
1415
|
display: flex;
|
|
1312
1416
|
align-items: center;
|
|
@@ -1389,11 +1493,29 @@
|
|
|
1389
1493
|
max-width: var(--ff-layout-wide);
|
|
1390
1494
|
margin: 0 auto;
|
|
1391
1495
|
}
|
|
1496
|
+
.ff-theme .ff-footer-top {
|
|
1497
|
+
display: flex;
|
|
1498
|
+
flex-wrap: wrap;
|
|
1499
|
+
justify-content: space-between;
|
|
1500
|
+
gap: 2rem;
|
|
1501
|
+
}
|
|
1392
1502
|
.ff-theme .ff-footer-columns {
|
|
1503
|
+
flex: 1 1 auto;
|
|
1393
1504
|
display: grid;
|
|
1394
1505
|
grid-template-columns: repeat(auto-fill, minmax(9rem, 12rem));
|
|
1395
1506
|
gap: 2rem;
|
|
1396
1507
|
}
|
|
1508
|
+
.ff-theme .ff-footer-social a {
|
|
1509
|
+
display: inline-flex;
|
|
1510
|
+
align-items: center;
|
|
1511
|
+
gap: 0.5rem;
|
|
1512
|
+
text-transform: capitalize;
|
|
1513
|
+
}
|
|
1514
|
+
.ff-theme .ff-footer-social a > span:first-child {
|
|
1515
|
+
flex: none;
|
|
1516
|
+
font-size: 1.05em;
|
|
1517
|
+
opacity: 0.8;
|
|
1518
|
+
}
|
|
1397
1519
|
.ff-theme .ff-footer-column ul {
|
|
1398
1520
|
margin: 1rem 0 0;
|
|
1399
1521
|
padding: 0;
|
|
@@ -1429,6 +1551,9 @@
|
|
|
1429
1551
|
.ff-theme .ff-footer {
|
|
1430
1552
|
padding: 4rem 3rem 2.5rem;
|
|
1431
1553
|
}
|
|
1554
|
+
.ff-theme .ff-footer-social {
|
|
1555
|
+
margin-left: auto;
|
|
1556
|
+
}
|
|
1432
1557
|
}
|
|
1433
1558
|
.ff-theme .vp-doc .ff-card-grid {
|
|
1434
1559
|
display: grid;
|
package/package.json
CHANGED
|
@@ -49,12 +49,19 @@ onUnmounted(() => {
|
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<template>
|
|
52
|
-
<div
|
|
52
|
+
<div
|
|
53
|
+
v-if="banner"
|
|
54
|
+
ref="el"
|
|
55
|
+
class="ff-banner"
|
|
56
|
+
:data-variant="banner.variant ?? 'ink'"
|
|
57
|
+
:data-gradient="banner.gradient || undefined"
|
|
58
|
+
>
|
|
53
59
|
<component
|
|
54
60
|
:is="banner.link ? 'a' : 'div'"
|
|
55
61
|
class="ff-banner-body"
|
|
56
62
|
:href="banner.link"
|
|
57
63
|
>
|
|
64
|
+
<span v-if="banner.icon" class="ff-banner-icon" aria-hidden="true">{{ banner.icon }}</span>
|
|
58
65
|
<span class="ff-banner-text" v-html="banner.text" />
|
|
59
66
|
<span v-if="banner.link" class="ff-banner-cta">
|
|
60
67
|
{{ banner.linkText ?? 'Read more' }}
|
|
@@ -1,31 +1,72 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { useData } from 'vitepress'
|
|
4
|
-
import { useLayout, VPLink } from '../internal'
|
|
5
|
-
import { useThemeOptions } from '../composables/options'
|
|
4
|
+
import { useLayout, VPIcon, VPLink } from '../internal'
|
|
5
|
+
import { useLabels, useThemeOptions } from '../composables/options'
|
|
6
|
+
import type { DefaultTheme } from '../types'
|
|
6
7
|
|
|
7
8
|
const { theme, frontmatter } = useData()
|
|
8
9
|
const { hasSidebar } = useLayout()
|
|
9
10
|
const options = useThemeOptions()
|
|
11
|
+
const labels = useLabels()
|
|
10
12
|
|
|
11
13
|
const columns = computed(() => options.value.footerColumns ?? [])
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `themeConfig.socialLinks`, printed as a normal footer column: one row per network, its logo
|
|
17
|
+
* beside a readable name. The name is the entry's `ariaLabel`, or the icon slug it defaults to.
|
|
18
|
+
*/
|
|
19
|
+
const social = computed(() => {
|
|
20
|
+
if (options.value.footerSocial === false) return []
|
|
21
|
+
|
|
22
|
+
return ((theme.value.socialLinks ?? []) as DefaultTheme.SocialLink[]).map((link) => ({
|
|
23
|
+
...link,
|
|
24
|
+
icon:
|
|
25
|
+
typeof link.icon === 'string' && !link.icon.includes(':')
|
|
26
|
+
? `simple-icons:${link.icon}`
|
|
27
|
+
: link.icon,
|
|
28
|
+
text: link.ariaLabel ?? (typeof link.icon === 'string' ? link.icon : '')
|
|
29
|
+
}))
|
|
30
|
+
})
|
|
31
|
+
|
|
12
32
|
const visible = computed(
|
|
13
|
-
() =>
|
|
33
|
+
() =>
|
|
34
|
+
(theme.value.footer || columns.value.length || social.value.length) &&
|
|
35
|
+
frontmatter.value.footer !== false
|
|
14
36
|
)
|
|
15
37
|
</script>
|
|
16
38
|
|
|
17
39
|
<template>
|
|
18
40
|
<footer v-if="visible" class="VPFooter ff-footer" :class="{ 'has-sidebar': hasSidebar }">
|
|
19
41
|
<div class="ff-footer-container">
|
|
20
|
-
<div v-if="columns.length" class="ff-footer-
|
|
21
|
-
<div v-
|
|
22
|
-
<
|
|
42
|
+
<div v-if="columns.length || social.length" class="ff-footer-top">
|
|
43
|
+
<div v-if="columns.length" class="ff-footer-columns">
|
|
44
|
+
<div v-for="column in columns" :key="column.title" class="ff-footer-column">
|
|
45
|
+
<p class="ff-label">{{ column.title }}</p>
|
|
46
|
+
|
|
47
|
+
<ul>
|
|
48
|
+
<li v-for="item in column.items" :key="item.link">
|
|
49
|
+
<VPLink :href="item.link" :rel="item.rel" :target="item.target">
|
|
50
|
+
{{ item.text }}
|
|
51
|
+
</VPLink>
|
|
52
|
+
</li>
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div v-if="social.length" class="ff-footer-column ff-footer-social">
|
|
58
|
+
<p class="ff-label">{{ labels.footerSocial }}</p>
|
|
23
59
|
|
|
24
60
|
<ul>
|
|
25
|
-
<li v-for="item in
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
61
|
+
<li v-for="item in social" :key="item.link">
|
|
62
|
+
<a
|
|
63
|
+
:href="item.link"
|
|
64
|
+
:target="item.target ?? '_blank'"
|
|
65
|
+
rel="me noopener"
|
|
66
|
+
>
|
|
67
|
+
<VPIcon :icon="item.icon" />
|
|
68
|
+
<span>{{ item.text }}</span>
|
|
69
|
+
</a>
|
|
29
70
|
</li>
|
|
30
71
|
</ul>
|
|
31
72
|
</div>
|
|
@@ -26,12 +26,14 @@ const { frontmatter } = useData()
|
|
|
26
26
|
const labels = useLabels()
|
|
27
27
|
const slots = useSlots()
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// Three additions to the standard home frontmatter, all optional:
|
|
30
30
|
//
|
|
31
31
|
// hero.command the install line, printed in a panel beside the headline
|
|
32
|
+
// hero.quote a short line under the tagline, ruled like a markdown blockquote
|
|
32
33
|
// hero.meta a colophon strip under the hero: [{ label, value }, β¦]
|
|
33
34
|
const hero = computed<HeroExtras>(() => frontmatter.value.hero ?? {})
|
|
34
35
|
const command = computed<string | undefined>(() => hero.value.command)
|
|
36
|
+
const quote = computed<string | undefined>(() => hero.value.quote)
|
|
35
37
|
const meta = computed<HeroMetaItem[]>(() => hero.value.meta ?? [])
|
|
36
38
|
|
|
37
39
|
/**
|
|
@@ -63,6 +65,12 @@ function hasPanel() {
|
|
|
63
65
|
return !hasImage() && !!command.value
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
// An image claims the second column, so the install panel has nowhere to sit beside the text β
|
|
69
|
+
// it drops under it instead rather than disappearing.
|
|
70
|
+
function hasInlineCommand() {
|
|
71
|
+
return hasImage() && !!command.value
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
const copied = ref(false)
|
|
67
75
|
|
|
68
76
|
async function copy() {
|
|
@@ -92,6 +100,8 @@ async function copy() {
|
|
|
92
100
|
<h1 v-if="text" class="ff-hero-title ff-display" v-html="text" />
|
|
93
101
|
|
|
94
102
|
<p v-if="tagline" class="ff-hero-tagline" v-html="tagline" />
|
|
103
|
+
|
|
104
|
+
<blockquote v-if="quote" class="ff-hero-quote" v-html="quote" />
|
|
95
105
|
</slot>
|
|
96
106
|
|
|
97
107
|
<slot name="home-hero-info-after" />
|
|
@@ -113,6 +123,26 @@ async function copy() {
|
|
|
113
123
|
</div>
|
|
114
124
|
|
|
115
125
|
<slot name="home-hero-actions-after" />
|
|
126
|
+
|
|
127
|
+
<div v-if="hasInlineCommand()" class="ff-hero-panel ff-hero-panel-inline">
|
|
128
|
+
<p class="ff-hero-panel-label ff-label">{{ labels.heroInstall }}</p>
|
|
129
|
+
|
|
130
|
+
<div class="ff-hero-command">
|
|
131
|
+
<code>
|
|
132
|
+
<span class="ff-hero-prompt" aria-hidden="true">$</span>
|
|
133
|
+
{{ command }}
|
|
134
|
+
</code>
|
|
135
|
+
|
|
136
|
+
<button
|
|
137
|
+
type="button"
|
|
138
|
+
class="ff-hero-copy ff-label"
|
|
139
|
+
:aria-label="format(labels.heroCopyLabel, command ?? '')"
|
|
140
|
+
@click="copy"
|
|
141
|
+
>
|
|
142
|
+
{{ copied ? labels.heroCopied : labels.heroCopy }}
|
|
143
|
+
</button>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
116
146
|
</div>
|
|
117
147
|
|
|
118
148
|
<div v-if="hasImage()" class="ff-hero-image">
|
package/src/internal.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// alias would otherwise import the theme index that imports them back. Nothing here reaches for an
|
|
6
6
|
// API the default theme does not export.
|
|
7
7
|
|
|
8
|
+
export { default as VPIcon } from 'vitepress/dist/client/theme-default/components/VPIcon.vue'
|
|
8
9
|
export { default as VPImage } from 'vitepress/dist/client/theme-default/components/VPImage.vue'
|
|
9
10
|
export { default as VPLink } from 'vitepress/dist/client/theme-default/components/VPLink.vue'
|
|
10
11
|
export { useLayout } from 'vitepress/dist/client/theme-default/composables/layout.js'
|
package/src/layout/FfLayout.vue
CHANGED
|
@@ -4,8 +4,10 @@ import DefaultTheme from 'vitepress/theme'
|
|
|
4
4
|
import FfBackToTop from '../components/FfBackToTop.vue'
|
|
5
5
|
import FfBanner from '../components/FfBanner.vue'
|
|
6
6
|
import FfDocMeta from '../components/FfDocMeta.vue'
|
|
7
|
+
import { useThemeOptions } from '../composables/options'
|
|
7
8
|
|
|
8
9
|
const { Layout } = DefaultTheme
|
|
10
|
+
const options = useThemeOptions()
|
|
9
11
|
|
|
10
12
|
// Three slots carry the additions of this theme; every other slot the site passes in is forwarded
|
|
11
13
|
// untouched, so the whole default slot surface keeps working.
|
|
@@ -16,7 +18,7 @@ const forwarded = computed(() => Object.keys(slots).filter((name) => !owned.incl
|
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
20
|
<template>
|
|
19
|
-
<div class="ff-theme">
|
|
21
|
+
<div class="ff-theme" :data-nav-order="options.navOrder ?? 'search-first'">
|
|
20
22
|
<Layout>
|
|
21
23
|
<template #layout-top>
|
|
22
24
|
<FfBanner />
|
package/src/styles/_code.scss
CHANGED
|
@@ -88,6 +88,32 @@
|
|
|
88
88
|
color: #{mg.ref("color-ink-faint")};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
// ----------------------------------------------------------------------------------------- //
|
|
92
|
+
// Line annotations: error, warning and diff
|
|
93
|
+
// ----------------------------------------------------------------------------------------- //
|
|
94
|
+
|
|
95
|
+
// The default theme tells these apart with a coloured fill, from the same --vp-c-*-soft
|
|
96
|
+
// tokens the custom blocks use β and _tokens.scss sets every one of those to transparent, so
|
|
97
|
+
// a line marked [!code error] or [!code ++] paints no differently from a plain one. A rule on
|
|
98
|
+
// the left is the margin-note language every other flagged block in this theme already
|
|
99
|
+
// speaks, so the line still reads without reintroducing a fill.
|
|
100
|
+
|
|
101
|
+
.vp-doc [class*="language-"] code .highlighted.error {
|
|
102
|
+
box-shadow: inset #{mg.ref("rule-accent-width")} 0 0 0 #{mg.ref("color-danger")};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.vp-doc [class*="language-"] code .highlighted.warning {
|
|
106
|
+
box-shadow: inset #{mg.ref("rule-accent-width")} 0 0 0 #{mg.ref("color-warning")};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.vp-doc [class*="language-"] code .diff.add {
|
|
110
|
+
box-shadow: inset #{mg.ref("rule-accent-width")} 0 0 0 #{mg.ref("color-success")};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.vp-doc [class*="language-"] code .diff.remove {
|
|
114
|
+
box-shadow: inset #{mg.ref("rule-accent-width")} 0 0 0 #{mg.ref("color-danger")};
|
|
115
|
+
}
|
|
116
|
+
|
|
91
117
|
// ----------------------------------------------------------------------------------------- //
|
|
92
118
|
// Code groups: the tabs replace the header strip
|
|
93
119
|
// ----------------------------------------------------------------------------------------- //
|
package/src/styles/_content.scss
CHANGED
|
@@ -43,6 +43,67 @@
|
|
|
43
43
|
color: #{mg.ref("color-paper")};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// Each variant sets the two custom properties the flat and gradient backgrounds below read
|
|
47
|
+
// from. Ink stays the theme's original bar; the others borrow the same status colours the
|
|
48
|
+
// rest of the theme already uses for tips, success and warning states.
|
|
49
|
+
.ff-banner[data-variant="ink"] {
|
|
50
|
+
--ff-banner-from: #{mg.ref("color-ink")};
|
|
51
|
+
--ff-banner-to: #{mg.ref("color-ink-muted")};
|
|
52
|
+
color: #{mg.ref("color-paper")};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ff-banner[data-variant="accent"] {
|
|
56
|
+
--ff-banner-from: #{mg.ref("color-accent")};
|
|
57
|
+
--ff-banner-to: #{mg.ref("color-accent-hover")};
|
|
58
|
+
color: #{mg.ref("color-accent-contrast")};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ff-banner[data-variant="success"] {
|
|
62
|
+
--ff-banner-from: #{mg.ref("color-success")};
|
|
63
|
+
--ff-banner-to: #{mg.ref("color-ink")};
|
|
64
|
+
color: #{mg.ref("color-paper")};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ff-banner[data-variant="warning"] {
|
|
68
|
+
--ff-banner-from: #{mg.ref("color-warning")};
|
|
69
|
+
--ff-banner-to: #{mg.ref("color-ink")};
|
|
70
|
+
color: #{mg.ref("color-paper")};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ff-banner[data-variant="danger"] {
|
|
74
|
+
--ff-banner-from: #{mg.ref("color-danger")};
|
|
75
|
+
--ff-banner-to: #{mg.ref("color-ink")};
|
|
76
|
+
color: #{mg.ref("color-paper")};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ff-banner:not([data-gradient]) {
|
|
80
|
+
background: var(--ff-banner-from);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ff-banner[data-gradient] {
|
|
84
|
+
background: linear-gradient(100deg, var(--ff-banner-from), var(--ff-banner-to));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The one variant that is gradient or nothing β a flat "rainbow" bar makes no sense, so this
|
|
88
|
+
// ignores the gradient flag. It strings together the theme's own status hues rather than
|
|
89
|
+
// introducing new colour, and reuses the accent's contrast pick since every one of those hues
|
|
90
|
+
// follows the same light/dark pattern: saturated and dark on paper, pale and light on ink.
|
|
91
|
+
.ff-banner[data-variant="rainbow"] {
|
|
92
|
+
background: linear-gradient(
|
|
93
|
+
100deg,
|
|
94
|
+
#{mg.ref("color-accent")},
|
|
95
|
+
#{mg.ref("color-danger")},
|
|
96
|
+
#{mg.ref("color-warning")},
|
|
97
|
+
#{mg.ref("color-success")}
|
|
98
|
+
);
|
|
99
|
+
color: #{mg.ref("color-accent-contrast")};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ff-banner-icon {
|
|
103
|
+
font-size: 1rem;
|
|
104
|
+
line-height: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
46
107
|
.ff-banner-body {
|
|
47
108
|
display: flex;
|
|
48
109
|
align-items: center;
|
|
@@ -151,12 +212,33 @@
|
|
|
151
212
|
margin: 0 auto;
|
|
152
213
|
}
|
|
153
214
|
|
|
215
|
+
.ff-footer-top {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-wrap: wrap;
|
|
218
|
+
justify-content: space-between;
|
|
219
|
+
gap: 2rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
154
222
|
.ff-footer-columns {
|
|
223
|
+
flex: 1 1 auto;
|
|
155
224
|
display: grid;
|
|
156
225
|
grid-template-columns: repeat(auto-fill, minmax(9rem, 12rem));
|
|
157
226
|
gap: 2rem;
|
|
158
227
|
}
|
|
159
228
|
|
|
229
|
+
.ff-footer-social a {
|
|
230
|
+
display: inline-flex;
|
|
231
|
+
align-items: center;
|
|
232
|
+
gap: 0.5rem;
|
|
233
|
+
text-transform: capitalize;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.ff-footer-social a > span:first-child {
|
|
237
|
+
flex: none;
|
|
238
|
+
font-size: 1.05em;
|
|
239
|
+
opacity: 0.8;
|
|
240
|
+
}
|
|
241
|
+
|
|
160
242
|
.ff-footer-column ul {
|
|
161
243
|
margin: 1rem 0 0;
|
|
162
244
|
padding: 0;
|
|
@@ -198,6 +280,12 @@
|
|
|
198
280
|
.ff-footer {
|
|
199
281
|
padding: 4rem 3rem 2.5rem;
|
|
200
282
|
}
|
|
283
|
+
|
|
284
|
+
// Pinned to the right edge, whatever the number of link columns beside it. Its own rows
|
|
285
|
+
// stay left-aligned, so the logos line up the way they do in a link column.
|
|
286
|
+
.ff-footer-social {
|
|
287
|
+
margin-left: auto;
|
|
288
|
+
}
|
|
201
289
|
}
|
|
202
290
|
|
|
203
291
|
// ----------------------------------------------------------------------------------------- //
|
package/src/styles/_home.scss
CHANGED
|
@@ -117,6 +117,26 @@
|
|
|
117
117
|
text-wrap: pretty;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
// Same rule-and-italic treatment a markdown blockquote gets in the doc column, so a term
|
|
121
|
+
// defined here reads as the same kind of aside wherever it turns up on the site.
|
|
122
|
+
|
|
123
|
+
.ff-hero-quote {
|
|
124
|
+
max-width: 38ch;
|
|
125
|
+
margin: 1.75rem 0 0;
|
|
126
|
+
padding-left: 1.25rem;
|
|
127
|
+
border-left: #{mg.ref("rule-accent-width")} solid #{mg.ref("color-rule-strong")};
|
|
128
|
+
font-size: #{mg.ref("size-body")};
|
|
129
|
+
font-style: italic;
|
|
130
|
+
line-height: 1.55;
|
|
131
|
+
color: #{mg.ref("color-ink-muted")};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ff-hero-quote strong {
|
|
135
|
+
font-style: normal;
|
|
136
|
+
font-weight: 620;
|
|
137
|
+
color: #{mg.ref("color-ink")};
|
|
138
|
+
}
|
|
139
|
+
|
|
120
140
|
.ff-hero-actions {
|
|
121
141
|
display: flex;
|
|
122
142
|
flex-wrap: wrap;
|
|
@@ -141,6 +161,14 @@
|
|
|
141
161
|
margin: 0 0 1rem;
|
|
142
162
|
}
|
|
143
163
|
|
|
164
|
+
// Same panel, dropped under the text instead of beside it β an image already claims the
|
|
165
|
+
// second column, so this is what the install line falls back to rather than disappearing.
|
|
166
|
+
|
|
167
|
+
.ff-hero-panel-inline {
|
|
168
|
+
max-width: 28rem;
|
|
169
|
+
margin-top: 2.5rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
144
172
|
.ff-hero-panel .ff-hero-actions {
|
|
145
173
|
margin-top: 1.25rem;
|
|
146
174
|
}
|
|
@@ -192,13 +220,23 @@
|
|
|
192
220
|
display: flex;
|
|
193
221
|
align-items: center;
|
|
194
222
|
justify-content: center;
|
|
223
|
+
// Caps it against the viewport rather than the column: at narrow widths the column itself
|
|
224
|
+
// is the limit; past 960px the column is half the hero, wide enough that this is the one
|
|
225
|
+
// that bites, so the image can run as large as the site's own picture allows.
|
|
226
|
+
max-width: 28rem;
|
|
195
227
|
}
|
|
196
228
|
|
|
197
229
|
.ff-hero-image img {
|
|
198
|
-
|
|
230
|
+
width: 100%;
|
|
199
231
|
height: auto;
|
|
200
232
|
}
|
|
201
233
|
|
|
234
|
+
@media (min-width: 960px) {
|
|
235
|
+
.ff-hero-image {
|
|
236
|
+
max-width: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
202
240
|
// ----------------------------------------------------------------------------------------- //
|
|
203
241
|
// Colophon
|
|
204
242
|
// ----------------------------------------------------------------------------------------- //
|
|
@@ -252,11 +290,19 @@
|
|
|
252
290
|
gap: 4.5rem;
|
|
253
291
|
}
|
|
254
292
|
|
|
255
|
-
|
|
293
|
+
// The panel is a fixed-size box regardless of how wide its column runs, so it gets the
|
|
294
|
+
// narrower one. An image is content, not chrome β it can be as large as the site wants,
|
|
295
|
+
// so its column gets an even split instead of ceding room to the text side.
|
|
296
|
+
|
|
256
297
|
.ff-hero.has-panel .ff-hero-container {
|
|
257
298
|
grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
|
|
258
299
|
align-items: center;
|
|
259
300
|
}
|
|
301
|
+
|
|
302
|
+
.ff-hero.has-image .ff-hero-container {
|
|
303
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
304
|
+
align-items: center;
|
|
305
|
+
}
|
|
260
306
|
}
|
|
261
307
|
|
|
262
308
|
// ----------------------------------------------------------------------------------------- //
|
package/src/styles/_nav.scss
CHANGED
|
@@ -17,6 +17,52 @@
|
|
|
17
17
|
border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// The default theme's markup always renders search before the menu links inside
|
|
21
|
+
// .content-body, a plain flex row with no slot between the two, and pins the pair with a push
|
|
22
|
+
// rather than plain order: .menu carries flex-grow so it eats the row's free space and
|
|
23
|
+
// right-justifies itself against whatever follows, which is what reads as "menu on the
|
|
24
|
+
// right" β reordering alone leaves that push in place and the menu stays glued to the same
|
|
25
|
+
// spot. `ff.navOrder: 'menu-first'` swaps both which element grows and which one leads, so the
|
|
26
|
+
// menu hugs the title the way search does by default, and every other sibling (locale
|
|
27
|
+
// switcher, appearance toggle, social links, the "extra" slot, the hamburger) gets an
|
|
28
|
+
// explicit order too so it keeps its place instead of tying at the default `order: 0`.
|
|
29
|
+
|
|
30
|
+
&[data-nav-order="menu-first"] .content-body {
|
|
31
|
+
.menu {
|
|
32
|
+
order: 1;
|
|
33
|
+
flex-grow: 0;
|
|
34
|
+
// Search owes its own breathing room from the title to its box's border and padding;
|
|
35
|
+
// plain text links have neither, so without this they sit right against the title.
|
|
36
|
+
margin-left: 1.5rem;
|
|
37
|
+
margin-right: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.search {
|
|
41
|
+
order: 2;
|
|
42
|
+
margin-right: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.translations {
|
|
46
|
+
order: 3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.appearance {
|
|
50
|
+
order: 4;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.social-links {
|
|
54
|
+
order: 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.extra {
|
|
58
|
+
order: 6;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hamburger {
|
|
62
|
+
order: 7;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
20
66
|
.VPNavBar.has-sidebar .curtain,
|
|
21
67
|
.VPNavBar .divider {
|
|
22
68
|
display: none;
|
package/src/types.ts
CHANGED
|
@@ -9,6 +9,15 @@ export interface BannerConfig {
|
|
|
9
9
|
link?: string
|
|
10
10
|
/** Label of the trailing call to action. Defaults to `Read more`. */
|
|
11
11
|
linkText?: string
|
|
12
|
+
/**
|
|
13
|
+
* Colour the banner is built from. Defaults to `ink`, the theme's original flat bar.
|
|
14
|
+
* `rainbow` strings the status hues together and is always a gradient.
|
|
15
|
+
*/
|
|
16
|
+
variant?: 'ink' | 'accent' | 'success' | 'warning' | 'danger' | 'rainbow'
|
|
17
|
+
/** Paint the background as a gradient toward the variant's colour instead of flat. Ignored by `rainbow`, which is always a gradient. */
|
|
18
|
+
gradient?: boolean
|
|
19
|
+
/** Icon or emoji printed before the text, e.g. `'π'`. */
|
|
20
|
+
icon?: string
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
export interface FooterLink {
|
|
@@ -57,6 +66,8 @@ export interface ThemeLabels {
|
|
|
57
66
|
heroCopyLabel?: string
|
|
58
67
|
/** Visible text of the back-to-top control. Defaults to `Top`. */
|
|
59
68
|
backToTop?: string
|
|
69
|
+
/** Heading of the footer social column. Defaults to `Follow`. */
|
|
70
|
+
footerSocial?: string
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
/** One entry of the colophon strip printed under the hero. */
|
|
@@ -70,8 +81,17 @@ export interface HeroMetaItem {
|
|
|
70
81
|
* optional; everything else on `hero` stays the default theme's.
|
|
71
82
|
*/
|
|
72
83
|
export interface HeroExtras {
|
|
73
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Install line, printed in a panel. Beside the headline when the hero carries no image;
|
|
86
|
+
* under it, carrying the command only, when an image claims that column instead.
|
|
87
|
+
*/
|
|
74
88
|
command?: string
|
|
89
|
+
/**
|
|
90
|
+
* A short line under the tagline, set off with the same rule-and-italic treatment as a
|
|
91
|
+
* markdown blockquote. Inline HTML is allowed, so a term inside it can be marked up, e.g.
|
|
92
|
+
* `<strong>Charpente</strong> /ΚaΚ.pΙΜt/ β French forβ¦`.
|
|
93
|
+
*/
|
|
94
|
+
quote?: string
|
|
75
95
|
/** Colophon strip under the hero. */
|
|
76
96
|
meta?: HeroMetaItem[]
|
|
77
97
|
}
|
|
@@ -83,8 +103,15 @@ export interface ThemeOptions {
|
|
|
83
103
|
meta?: MetaConfig | false
|
|
84
104
|
/** Link columns added to the site footer. */
|
|
85
105
|
footerColumns?: FooterColumn[]
|
|
106
|
+
/**
|
|
107
|
+
* Column of `themeConfig.socialLinks` icons, pinned to the right of the footer columns.
|
|
108
|
+
* Defaults to `true`, and shows nothing when the site declares no social link.
|
|
109
|
+
*/
|
|
110
|
+
footerSocial?: boolean
|
|
86
111
|
/** Floating back-to-top control. Defaults to `true`. */
|
|
87
112
|
backToTop?: boolean
|
|
113
|
+
/** Order of the search box and the nav menu links in the top bar. Defaults to `search-first`. */
|
|
114
|
+
navOrder?: 'search-first' | 'menu-first'
|
|
88
115
|
/** Overrides for the strings this theme adds. Declare them per locale to translate them. */
|
|
89
116
|
labels?: ThemeLabels
|
|
90
117
|
}
|