@frontfactory/vitepress-theme 1.0.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 CHANGED
@@ -81,6 +81,7 @@ follows.
81
81
  | `--ff-layout-wide` | Home and container width |
82
82
  | `--ff-radius-sm` / `-md` | Corner radii |
83
83
  | `--ff-rule-width` / `--ff-rule-accent-width` | Rule weights |
84
+ | `--ff-hero-glow-opacity` | Hero light washes, `0` (off) by default |
84
85
 
85
86
  `dist/style.css` lists them all, grouped, at the top of the file.
86
87
 
@@ -96,9 +97,17 @@ themeConfig: {
96
97
  id: 'v5',
97
98
  text: 'Version 5 is out.',
98
99
  link: '/whats-new',
99
- 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: 'πŸŽ‰'
100
104
  },
101
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
+
102
111
  // Kicker printed above every page title. Set to false to drop it.
103
112
  meta: {
104
113
  section: true, // section name, read from the sidebar
@@ -112,6 +121,9 @@ themeConfig: {
112
121
  { title: 'Docs', items: [{ text: 'Guide', link: '/guide/' }] }
113
122
  ],
114
123
 
124
+ // Column of `themeConfig.socialLinks` icons, pinned to the right of those columns.
125
+ footerSocial: true,
126
+
115
127
  backToTop: true
116
128
  }
117
129
  }
@@ -143,7 +155,8 @@ locales: {
143
155
  heroCopy: 'Copier',
144
156
  heroCopied: 'CopiΓ©',
145
157
  heroCopyLabel: 'Copier {0}',
146
- backToTop: 'Haut'
158
+ backToTop: 'Haut',
159
+ footerSocial: 'Nous suivre'
147
160
  }
148
161
  }
149
162
  }
@@ -161,6 +174,7 @@ locales: {
161
174
  | `heroCopied` | `Copied` |
162
175
  | `heroCopyLabel` | `Copy {0}` |
163
176
  | `backToTop` | `Top` |
177
+ | `footerSocial` | `Follow` |
164
178
 
165
179
  The banner's own `text` and `linkText` are content, not labels, so they stay under `ff.banner`. The
166
180
  back-to-top tooltip reuses the default theme's `returnToTopLabel`, and the last-updated stamp is
@@ -171,10 +185,27 @@ formatted with `Intl.RelativeTimeFormat` in the page's own `lang`.
171
185
  Standard VitePress home frontmatter, read with an editorial hierarchy: `hero.name` becomes the
172
186
  kicker, `hero.text` the headline. Two additions fill the page out.
173
187
 
188
+ The hero can also carry two soft washes of light, one accent and one neutral, behind the headline.
189
+ They are off by default β€” a site turns them on by raising `--ff-hero-glow-opacity`, which drives
190
+ both at once and takes any value between `0` and `1`:
191
+
192
+ ```css
193
+ :root {
194
+ --ff-hero-glow-opacity: 1;
195
+ }
196
+ ```
197
+
198
+ Their colours come from `--ff-color-accent-glow` and `--ff-color-accent-soft`, per scheme.
199
+
174
200
  `hero.command` puts an install panel in the second column of the hero, carrying the command and the
175
- actions. It is used only when the page has no `hero.image` and nothing filled the `home-hero-image`
176
- slot β€” an image still takes that column. `hero.meta` prints a colophon strip under the hero. Both
177
- are typed by the exported `HeroExtras` interface.
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.
178
209
 
179
210
  ```yaml
180
211
  ---
@@ -185,6 +216,7 @@ hero:
185
216
  text: A headline that carries the page.
186
217
  tagline: One or two sentences of standfirst.
187
218
  command: npm install my-project
219
+ quote: <strong>My project</strong> β€” what the name means, in one line.
188
220
  meta:
189
221
  - label: Licence
190
222
  value: MIT
package/dist/style.css CHANGED
@@ -15,7 +15,7 @@
15
15
  --ff-size-h1: clamp(1.625rem, 1.3rem + 1.3vw, 2rem);
16
16
  --ff-size-h2: 1.5rem;
17
17
  --ff-size-h3: 1.1875rem;
18
- --ff-size-hero: clamp(1.75rem, 1.125rem + 2.5vw, 3rem);
18
+ --ff-size-hero: clamp(1.5rem, 1.05rem + 1.8vw, 2.375rem);
19
19
  --ff-leading-body: 1.75;
20
20
  --ff-leading-tight: 1.15;
21
21
  --ff-radius-sm: 5px;
@@ -26,6 +26,7 @@
26
26
  --ff-motion-duration-slow: 420ms;
27
27
  --ff-motion-ease: cubic-bezier(0.2, 0.6, 0.2, 1);
28
28
  --ff-banner-height: 2.6875rem;
29
+ --ff-hero-glow-opacity: 0;
29
30
  --ff-layout-content: 44rem;
30
31
  --ff-layout-wide: 76rem;
31
32
  --ff-color-paper: #fbfaf8;
@@ -242,6 +243,31 @@
242
243
  .ff-theme .VPNavBar {
243
244
  border-bottom: var(--ff-rule-width) solid var(--ff-color-rule);
244
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
+ }
245
271
  .ff-theme .VPNavBar.has-sidebar .curtain,
246
272
  .ff-theme .VPNavBar .divider {
247
273
  display: none;
@@ -843,6 +869,18 @@
843
869
  font-family: var(--ff-font-mono);
844
870
  color: var(--ff-color-ink-faint);
845
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
+ }
846
884
  .ff-theme .vp-doc .vp-code-group {
847
885
  margin: 1.75rem 0;
848
886
  border: var(--ff-rule-width) solid var(--ff-color-rule);
@@ -999,6 +1037,7 @@
999
1037
  width: min(72rem, 150%);
1000
1038
  aspect-ratio: 1;
1001
1039
  background: radial-gradient(circle closest-side at 45% 45%, var(--ff-color-accent-glow), transparent);
1040
+ opacity: var(--ff-hero-glow-opacity);
1002
1041
  pointer-events: none;
1003
1042
  }
1004
1043
  .ff-theme .ff-hero-glow-far {
@@ -1019,19 +1058,14 @@
1019
1058
  margin: 0 0 1.5rem;
1020
1059
  color: var(--ff-color-ink-muted);
1021
1060
  }
1022
- .ff-theme .ff-hero-mark {
1023
- width: 0.5rem;
1024
- height: 0.5rem;
1025
- border-radius: 2px;
1026
- background: var(--ff-color-accent);
1027
- }
1028
1061
  .ff-theme .ff-hero-title {
1029
1062
  max-width: 20ch;
1030
1063
  margin: 0;
1031
1064
  font-family: var(--ff-font-title);
1032
1065
  font-size: var(--ff-size-hero);
1033
1066
  font-weight: 600;
1034
- letter-spacing: 0.01em;
1067
+ letter-spacing: 0;
1068
+ word-spacing: -0.3em;
1035
1069
  text-transform: uppercase;
1036
1070
  color: var(--ff-color-ink);
1037
1071
  text-wrap: balance;
@@ -1045,6 +1079,21 @@
1045
1079
  color: var(--ff-color-ink-muted);
1046
1080
  text-wrap: pretty;
1047
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
+ }
1048
1097
  .ff-theme .ff-hero-actions {
1049
1098
  display: flex;
1050
1099
  flex-wrap: wrap;
@@ -1062,6 +1111,10 @@
1062
1111
  .ff-theme .ff-hero-panel-label {
1063
1112
  margin: 0 0 1rem;
1064
1113
  }
1114
+ .ff-theme .ff-hero-panel-inline {
1115
+ max-width: 28rem;
1116
+ margin-top: 2.5rem;
1117
+ }
1065
1118
  .ff-theme .ff-hero-panel .ff-hero-actions {
1066
1119
  margin-top: 1.25rem;
1067
1120
  }
@@ -1106,11 +1159,17 @@
1106
1159
  display: flex;
1107
1160
  align-items: center;
1108
1161
  justify-content: center;
1162
+ max-width: 28rem;
1109
1163
  }
1110
1164
  .ff-theme .ff-hero-image img {
1111
- max-width: 22rem;
1165
+ width: 100%;
1112
1166
  height: auto;
1113
1167
  }
1168
+ @media (min-width: 960px) {
1169
+ .ff-theme .ff-hero-image {
1170
+ max-width: none;
1171
+ }
1172
+ }
1114
1173
  .ff-theme .ff-hero-meta {
1115
1174
  position: relative;
1116
1175
  display: grid;
@@ -1152,11 +1211,14 @@
1152
1211
  .ff-theme .ff-hero-container {
1153
1212
  gap: 4.5rem;
1154
1213
  }
1155
- .ff-theme .ff-hero.has-image .ff-hero-container,
1156
1214
  .ff-theme .ff-hero.has-panel .ff-hero-container {
1157
1215
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
1158
1216
  align-items: center;
1159
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
+ }
1160
1222
  }
1161
1223
  .ff-theme .ff-btn {
1162
1224
  display: inline-flex;
@@ -1310,6 +1372,45 @@
1310
1372
  background: var(--ff-color-ink);
1311
1373
  color: var(--ff-color-paper);
1312
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
+ }
1313
1414
  .ff-theme .ff-banner-body {
1314
1415
  display: flex;
1315
1416
  align-items: center;
@@ -1392,11 +1493,29 @@
1392
1493
  max-width: var(--ff-layout-wide);
1393
1494
  margin: 0 auto;
1394
1495
  }
1496
+ .ff-theme .ff-footer-top {
1497
+ display: flex;
1498
+ flex-wrap: wrap;
1499
+ justify-content: space-between;
1500
+ gap: 2rem;
1501
+ }
1395
1502
  .ff-theme .ff-footer-columns {
1503
+ flex: 1 1 auto;
1396
1504
  display: grid;
1397
1505
  grid-template-columns: repeat(auto-fill, minmax(9rem, 12rem));
1398
1506
  gap: 2rem;
1399
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
+ }
1400
1519
  .ff-theme .ff-footer-column ul {
1401
1520
  margin: 1rem 0 0;
1402
1521
  padding: 0;
@@ -1432,6 +1551,9 @@
1432
1551
  .ff-theme .ff-footer {
1433
1552
  padding: 4rem 3rem 2.5rem;
1434
1553
  }
1554
+ .ff-theme .ff-footer-social {
1555
+ margin-left: auto;
1556
+ }
1435
1557
  }
1436
1558
  .ff-theme .vp-doc .ff-card-grid {
1437
1559
  display: grid;
@@ -1585,23 +1707,10 @@
1585
1707
  transform: translate3d(6%, 4%, 0) scale(1.12);
1586
1708
  }
1587
1709
  }
1588
- @keyframes ff-beacon {
1589
- 0%, 100% {
1590
- opacity: 1;
1591
- box-shadow: 0 0 0 0 var(--ff-color-accent-glow);
1592
- }
1593
- 50% {
1594
- opacity: 0.72;
1595
- box-shadow: 0 0 0 0.375rem transparent;
1596
- }
1597
- }
1598
1710
  @media (prefers-reduced-motion: no-preference) {
1599
1711
  .ff-theme .ff-hero-glow {
1600
1712
  animation: ff-drift 26s var(--ff-motion-ease) infinite alternate;
1601
1713
  }
1602
- .ff-theme .ff-hero-mark {
1603
- animation: ff-beacon 3.2s ease-in-out infinite;
1604
- }
1605
1714
  .ff-theme .ff-hero-kicker,
1606
1715
  .ff-theme .ff-hero-title,
1607
1716
  .ff-theme .ff-hero-tagline,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontfactory/vitepress-theme",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Editorial VitePress theme β€” hairline rules, numbered sections and monospaced metadata.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -49,12 +49,19 @@ onUnmounted(() => {
49
49
  </script>
50
50
 
51
51
  <template>
52
- <div v-if="banner" ref="el" class="ff-banner">
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
- () => (theme.value.footer || columns.value.length) && frontmatter.value.footer !== false
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-columns">
21
- <div v-for="column in columns" :key="column.title" class="ff-footer-column">
22
- <p class="ff-label">{{ column.title }}</p>
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 column.items" :key="item.link">
26
- <VPLink :href="item.link" :rel="item.rel" :target="item.target">
27
- {{ item.text }}
28
- </VPLink>
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
- // Two additions to the standard home frontmatter, both optional:
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() {
@@ -87,14 +95,13 @@ async function copy() {
87
95
  <slot name="home-hero-info-before" />
88
96
 
89
97
  <slot name="home-hero-info">
90
- <p v-if="name" class="ff-hero-kicker ff-label">
91
- <span class="ff-hero-mark" aria-hidden="true" />
92
- <span v-html="name" />
93
- </p>
98
+ <p v-if="name" class="ff-hero-kicker ff-label" v-html="name" />
94
99
 
95
100
  <h1 v-if="text" class="ff-hero-title ff-display" v-html="text" />
96
101
 
97
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" />
98
105
  </slot>
99
106
 
100
107
  <slot name="home-hero-info-after" />
@@ -116,6 +123,26 @@ async function copy() {
116
123
  </div>
117
124
 
118
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>
119
146
  </div>
120
147
 
121
148
  <div v-if="hasImage()" class="ff-hero-image">
@@ -21,7 +21,8 @@ export const defaultLabels: Required<ThemeLabels> = {
21
21
  heroCopy: 'Copy',
22
22
  heroCopied: 'Copied',
23
23
  heroCopyLabel: 'Copy {0}',
24
- backToTop: 'Top'
24
+ backToTop: 'Top',
25
+ footerSocial: 'Follow'
25
26
  }
26
27
 
27
28
  /**
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'
@@ -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 />
@@ -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
  // ----------------------------------------------------------------------------------------- //
@@ -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
  // ----------------------------------------------------------------------------------------- //
@@ -37,7 +37,8 @@
37
37
  border-bottom-color: transparent;
38
38
  }
39
39
 
40
- // Two washes of light, one accent and one neutral, so the page has a direction.
40
+ // Two washes of light, one accent and one neutral, so the page has a direction. Off unless the
41
+ // site asks for them: --ff-hero-glow-opacity carries the whole effect, both washes at once.
41
42
 
42
43
  .ff-hero-glow {
43
44
  position: absolute;
@@ -54,6 +55,7 @@
54
55
  #{mg.ref("color-accent-glow")},
55
56
  transparent
56
57
  );
58
+ opacity: #{mg.ref("hero-glow-opacity")};
57
59
  pointer-events: none;
58
60
  }
59
61
 
@@ -82,13 +84,6 @@
82
84
  color: #{mg.ref("color-ink-muted")};
83
85
  }
84
86
 
85
- .ff-hero-mark {
86
- width: 0.5rem;
87
- height: 0.5rem;
88
- border-radius: 2px;
89
- background: #{mg.ref("color-accent")};
90
- }
91
-
92
87
  // The headline is the one place the theme changes voice: the mono it uses everywhere else for
93
88
  // machine text, here at display size. max-width is in ch, so against a monospaced face it is
94
89
  // an exact character count β€” the headline breaks on a measure, not on a guess.
@@ -100,9 +95,11 @@
100
95
  font-size: #{mg.ref("size-hero")};
101
96
  font-weight: 600;
102
97
  // Capitals on a monospaced face put every glyph on the same square cell β€” the blockiest
103
- // the headline can get without shipping a webfont. Uppercase needs the tracking back:
104
- // the negative fit that suits lowercase closes capitals up.
105
- letter-spacing: 0.01em;
98
+ // the headline can get without shipping a webfont. A monospaced face already sets its own
99
+ // cell width, so at this size the capitals need no tracking added on top. The word gap is
100
+ // one of those full cells, which reads as a hole at display size: pull it back a third.
101
+ letter-spacing: 0;
102
+ word-spacing: -0.3em;
106
103
  text-transform: uppercase;
107
104
  color: #{mg.ref("color-ink")};
108
105
  text-wrap: balance;
@@ -120,6 +117,26 @@
120
117
  text-wrap: pretty;
121
118
  }
122
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
+
123
140
  .ff-hero-actions {
124
141
  display: flex;
125
142
  flex-wrap: wrap;
@@ -144,6 +161,14 @@
144
161
  margin: 0 0 1rem;
145
162
  }
146
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
+
147
172
  .ff-hero-panel .ff-hero-actions {
148
173
  margin-top: 1.25rem;
149
174
  }
@@ -195,13 +220,23 @@
195
220
  display: flex;
196
221
  align-items: center;
197
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;
198
227
  }
199
228
 
200
229
  .ff-hero-image img {
201
- max-width: 22rem;
230
+ width: 100%;
202
231
  height: auto;
203
232
  }
204
233
 
234
+ @media (min-width: 960px) {
235
+ .ff-hero-image {
236
+ max-width: none;
237
+ }
238
+ }
239
+
205
240
  // ----------------------------------------------------------------------------------------- //
206
241
  // Colophon
207
242
  // ----------------------------------------------------------------------------------------- //
@@ -255,11 +290,19 @@
255
290
  gap: 4.5rem;
256
291
  }
257
292
 
258
- .ff-hero.has-image .ff-hero-container,
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
+
259
297
  .ff-hero.has-panel .ff-hero-container {
260
298
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
261
299
  align-items: center;
262
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
+ }
263
306
  }
264
307
 
265
308
  // ----------------------------------------------------------------------------------------- //
@@ -30,19 +30,6 @@
30
30
  }
31
31
  }
32
32
 
33
- @keyframes ff-beacon {
34
- 0%,
35
- 100% {
36
- opacity: 1;
37
- box-shadow: 0 0 0 0 #{mg.ref("color-accent-glow")};
38
- }
39
-
40
- 50% {
41
- opacity: 0.72;
42
- box-shadow: 0 0 0 0.375rem transparent;
43
- }
44
- }
45
-
46
33
  @media (prefers-reduced-motion: no-preference) {
47
34
  .ff-theme {
48
35
  // ------------------------------------------------------------------------------------- //
@@ -53,10 +40,6 @@
53
40
  animation: ff-drift 26s #{mg.ref("motion-ease")} infinite alternate;
54
41
  }
55
42
 
56
- .ff-hero-mark {
57
- animation: ff-beacon 3.2s ease-in-out infinite;
58
- }
59
-
60
43
  .ff-hero-kicker,
61
44
  .ff-hero-title,
62
45
  .ff-hero-tagline,
@@ -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;
@@ -34,7 +34,7 @@ $scales: (
34
34
  "h1": clamp(1.625rem, 1.3rem + 1.3vw, 2rem),
35
35
  "h2": 1.5rem,
36
36
  "h3": 1.1875rem,
37
- "hero": clamp(1.75rem, 1.125rem + 2.5vw, 3rem)
37
+ "hero": clamp(1.5rem, 1.05rem + 1.8vw, 2.375rem)
38
38
  ),
39
39
  "leading": (
40
40
  "body": 1.75,
@@ -56,6 +56,13 @@ $scales: (
56
56
  "banner": (
57
57
  "height": 2.6875rem
58
58
  ),
59
+
60
+ // The two washes of light behind the hero. Off by default: they are a house style, not a
61
+ // structural part of the layout, and they read as noise under a headline that is already
62
+ // carried by its type. A site opts in by setting this to 1, or to anything in between.
63
+ "hero": (
64
+ "glow-opacity": 0
65
+ ),
59
66
  "layout": (
60
67
  "content": 44rem,
61
68
  "wide": 76rem
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
- /** Install line, printed in a panel beside the headline when the hero carries no image. */
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
  }