@frontfactory/vitepress-theme 1.1.0 β†’ 1.3.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
@@ -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,31 @@ 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. It is used only when the page has no `hero.image` and nothing filled the `home-hero-image`
189
- slot β€” an image still takes that column. `hero.meta` prints a colophon strip under the hero. Both
190
- are typed by the exported `HeroExtras` interface.
201
+ actions, sized to the panel's own fixed box. The box and its "Install" heading only print when there
202
+ are actions to go with the command β€” with none, it's the bare command line, borderless outside its
203
+ own. Add `hero.image` (standard VitePress frontmatter, any `<img>` source including a gif) or fill
204
+ the `home-hero-image` slot, and that image claims the second column instead, split 50/50 with the
205
+ text rather than the panel's narrower share β€” the panel drops under the text on the left rather than
206
+ disappearing, always bare there since the actions already sit under the text either way. `hero.quote`
207
+ prints a short line under the tagline,
208
+ ruled and set in italics the same way a markdown blockquote is β€” inline HTML works, so a term inside
209
+ it can carry its own `<strong>`. `hero.meta` prints a colophon strip under the hero. `hero.command`,
210
+ `hero.quote` and `hero.meta` are all typed by the exported `HeroExtras` interface.
211
+
212
+ `hero.command` also takes an array of `{ label, value }` tabs instead of a single string β€” one
213
+ command per package manager, say β€” printing a tab strip above the line, styled like the theme's own
214
+ `::: code-group` tabs. The copy button always follows whichever tab is active:
215
+
216
+ ```yaml
217
+ hero:
218
+ command:
219
+ - label: npm
220
+ value: npm install my-project
221
+ - label: pnpm
222
+ value: pnpm add my-project
223
+ - label: bun
224
+ value: bun add my-project
225
+ ```
191
226
 
192
227
  ```yaml
193
228
  ---
@@ -198,6 +233,7 @@ hero:
198
233
  text: A headline that carries the page.
199
234
  tagline: One or two sentences of standfirst.
200
235
  command: npm install my-project
236
+ quote: <strong>My project</strong> β€” what the name means, in one line.
201
237
  meta:
202
238
  - label: Licence
203
239
  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,59 @@
1059
1111
  .ff-theme .ff-hero-panel-label {
1060
1112
  margin: 0 0 1rem;
1061
1113
  }
1114
+ .ff-theme .ff-hero-command-tabs {
1115
+ display: flex;
1116
+ flex-wrap: wrap;
1117
+ margin-bottom: 0.75rem;
1118
+ border-bottom: var(--ff-rule-width) solid var(--ff-color-rule);
1119
+ }
1120
+ .ff-theme .ff-hero-command-tab {
1121
+ position: relative;
1122
+ padding: 0 0.75rem 0.625rem;
1123
+ border: 0;
1124
+ background: transparent;
1125
+ font-family: var(--ff-font-mono);
1126
+ font-size: var(--ff-size-label);
1127
+ font-weight: 500;
1128
+ text-transform: uppercase;
1129
+ letter-spacing: var(--ff-tracking-label);
1130
+ color: var(--ff-color-ink-faint);
1131
+ cursor: pointer;
1132
+ transition: color var(--ff-motion-duration) var(--ff-motion-ease);
1133
+ }
1134
+ .ff-theme .ff-hero-command-tab:first-child {
1135
+ padding-left: 0;
1136
+ }
1137
+ .ff-theme .ff-hero-command-tab::after {
1138
+ position: absolute;
1139
+ right: 0;
1140
+ bottom: calc(var(--ff-rule-accent-width) * -1);
1141
+ left: 0;
1142
+ height: var(--ff-rule-accent-width);
1143
+ background: transparent;
1144
+ content: "";
1145
+ transition: background-color var(--ff-motion-duration) var(--ff-motion-ease);
1146
+ }
1147
+ .ff-theme .ff-hero-command-tab:hover {
1148
+ color: var(--ff-color-ink);
1149
+ }
1150
+ .ff-theme .ff-hero-command-tab.active {
1151
+ color: var(--ff-color-ink);
1152
+ }
1153
+ .ff-theme .ff-hero-command-tab.active::after {
1154
+ background: var(--ff-color-accent);
1155
+ }
1156
+ .ff-theme .ff-hero-panel-inline {
1157
+ max-width: 28rem;
1158
+ margin-top: 2.5rem;
1159
+ }
1160
+ .ff-theme .ff-hero-panel-bare {
1161
+ padding: 0;
1162
+ border: 0;
1163
+ border-radius: 0;
1164
+ background: transparent;
1165
+ box-shadow: none;
1166
+ }
1062
1167
  .ff-theme .ff-hero-panel .ff-hero-actions {
1063
1168
  margin-top: 1.25rem;
1064
1169
  }
@@ -1086,28 +1191,67 @@
1086
1191
  margin-right: 0.5rem;
1087
1192
  color: var(--ff-color-accent);
1088
1193
  }
1194
+ .ff-theme .ff-hero-copy-group {
1195
+ position: relative;
1196
+ display: flex;
1197
+ align-items: center;
1198
+ flex-shrink: 0;
1199
+ }
1200
+ .ff-theme .ff-hero-copied {
1201
+ position: absolute;
1202
+ top: 0;
1203
+ right: 100%;
1204
+ z-index: 1;
1205
+ display: flex;
1206
+ align-items: center;
1207
+ height: 1.75rem;
1208
+ padding: 0 0.625rem;
1209
+ border: var(--ff-rule-width) solid var(--ff-color-rule-strong);
1210
+ border-right: 0;
1211
+ border-radius: var(--ff-radius-sm) 0 0 var(--ff-radius-sm);
1212
+ background: var(--ff-color-surface-alt);
1213
+ color: var(--ff-color-ink-muted);
1214
+ white-space: nowrap;
1215
+ }
1089
1216
  .ff-theme .ff-hero-copy {
1090
1217
  flex-shrink: 0;
1091
- padding: 0.25rem 0.5rem;
1218
+ width: 1.75rem;
1219
+ height: 1.75rem;
1092
1220
  border: var(--ff-rule-width) solid var(--ff-color-rule);
1093
1221
  border-radius: var(--ff-radius-sm);
1094
- background: transparent;
1222
+ background-color: transparent;
1223
+ background-image: var(--vp-icon-copy);
1224
+ background-position: 50%;
1225
+ background-repeat: no-repeat;
1226
+ background-size: 0.875rem;
1095
1227
  cursor: pointer;
1096
- transition: border-color var(--ff-motion-duration) var(--ff-motion-ease);
1228
+ transition: border-color var(--ff-motion-duration) var(--ff-motion-ease), background-color var(--ff-motion-duration) var(--ff-motion-ease);
1097
1229
  }
1098
1230
  .ff-theme .ff-hero-copy:hover {
1099
1231
  border-color: var(--ff-color-rule-strong);
1100
- color: var(--ff-color-ink);
1232
+ background-color: var(--ff-color-surface-alt);
1233
+ }
1234
+ .ff-theme .ff-hero-copy.copied {
1235
+ border-radius: 0 var(--ff-radius-sm) var(--ff-radius-sm) 0;
1236
+ border-color: var(--ff-color-rule-strong);
1237
+ background-color: var(--ff-color-surface-alt);
1238
+ background-image: var(--vp-icon-copied);
1101
1239
  }
1102
1240
  .ff-theme .ff-hero-image {
1103
1241
  display: flex;
1104
1242
  align-items: center;
1105
1243
  justify-content: center;
1244
+ max-width: 28rem;
1106
1245
  }
1107
1246
  .ff-theme .ff-hero-image img {
1108
- max-width: 22rem;
1247
+ width: 100%;
1109
1248
  height: auto;
1110
1249
  }
1250
+ @media (min-width: 960px) {
1251
+ .ff-theme .ff-hero-image {
1252
+ max-width: none;
1253
+ }
1254
+ }
1111
1255
  .ff-theme .ff-hero-meta {
1112
1256
  position: relative;
1113
1257
  display: grid;
@@ -1149,11 +1293,14 @@
1149
1293
  .ff-theme .ff-hero-container {
1150
1294
  gap: 4.5rem;
1151
1295
  }
1152
- .ff-theme .ff-hero.has-image .ff-hero-container,
1153
1296
  .ff-theme .ff-hero.has-panel .ff-hero-container {
1154
1297
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
1155
1298
  align-items: center;
1156
1299
  }
1300
+ .ff-theme .ff-hero.has-image .ff-hero-container {
1301
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
1302
+ align-items: center;
1303
+ }
1157
1304
  }
1158
1305
  .ff-theme .ff-btn {
1159
1306
  display: inline-flex;
@@ -1307,6 +1454,45 @@
1307
1454
  background: var(--ff-color-ink);
1308
1455
  color: var(--ff-color-paper);
1309
1456
  }
1457
+ .ff-theme .ff-banner[data-variant=ink] {
1458
+ --ff-banner-from: var(--ff-color-ink);
1459
+ --ff-banner-to: var(--ff-color-ink-muted);
1460
+ color: var(--ff-color-paper);
1461
+ }
1462
+ .ff-theme .ff-banner[data-variant=accent] {
1463
+ --ff-banner-from: var(--ff-color-accent);
1464
+ --ff-banner-to: var(--ff-color-accent-hover);
1465
+ color: var(--ff-color-accent-contrast);
1466
+ }
1467
+ .ff-theme .ff-banner[data-variant=success] {
1468
+ --ff-banner-from: var(--ff-color-success);
1469
+ --ff-banner-to: var(--ff-color-ink);
1470
+ color: var(--ff-color-paper);
1471
+ }
1472
+ .ff-theme .ff-banner[data-variant=warning] {
1473
+ --ff-banner-from: var(--ff-color-warning);
1474
+ --ff-banner-to: var(--ff-color-ink);
1475
+ color: var(--ff-color-paper);
1476
+ }
1477
+ .ff-theme .ff-banner[data-variant=danger] {
1478
+ --ff-banner-from: var(--ff-color-danger);
1479
+ --ff-banner-to: var(--ff-color-ink);
1480
+ color: var(--ff-color-paper);
1481
+ }
1482
+ .ff-theme .ff-banner:not([data-gradient]) {
1483
+ background: var(--ff-banner-from);
1484
+ }
1485
+ .ff-theme .ff-banner[data-gradient] {
1486
+ background: linear-gradient(100deg, var(--ff-banner-from), var(--ff-banner-to));
1487
+ }
1488
+ .ff-theme .ff-banner[data-variant=rainbow] {
1489
+ background: linear-gradient(100deg, var(--ff-color-accent), var(--ff-color-danger), var(--ff-color-warning), var(--ff-color-success));
1490
+ color: var(--ff-color-accent-contrast);
1491
+ }
1492
+ .ff-theme .ff-banner-icon {
1493
+ font-size: 1rem;
1494
+ line-height: 1;
1495
+ }
1310
1496
  .ff-theme .ff-banner-body {
1311
1497
  display: flex;
1312
1498
  align-items: center;
@@ -1389,11 +1575,29 @@
1389
1575
  max-width: var(--ff-layout-wide);
1390
1576
  margin: 0 auto;
1391
1577
  }
1578
+ .ff-theme .ff-footer-top {
1579
+ display: flex;
1580
+ flex-wrap: wrap;
1581
+ justify-content: space-between;
1582
+ gap: 2rem;
1583
+ }
1392
1584
  .ff-theme .ff-footer-columns {
1585
+ flex: 1 1 auto;
1393
1586
  display: grid;
1394
1587
  grid-template-columns: repeat(auto-fill, minmax(9rem, 12rem));
1395
1588
  gap: 2rem;
1396
1589
  }
1590
+ .ff-theme .ff-footer-social a {
1591
+ display: inline-flex;
1592
+ align-items: center;
1593
+ gap: 0.5rem;
1594
+ text-transform: capitalize;
1595
+ }
1596
+ .ff-theme .ff-footer-social a > span:first-child {
1597
+ flex: none;
1598
+ font-size: 1.05em;
1599
+ opacity: 0.8;
1600
+ }
1397
1601
  .ff-theme .ff-footer-column ul {
1398
1602
  margin: 1rem 0 0;
1399
1603
  padding: 0;
@@ -1429,6 +1633,9 @@
1429
1633
  .ff-theme .ff-footer {
1430
1634
  padding: 4rem 3rem 2.5rem;
1431
1635
  }
1636
+ .ff-theme .ff-footer-social {
1637
+ margin-left: auto;
1638
+ }
1432
1639
  }
1433
1640
  .ff-theme .vp-doc .ff-card-grid {
1434
1641
  display: grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontfactory/vitepress-theme",
3
- "version": "1.1.0",
3
+ "version": "1.3.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>
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { Comment, computed, Fragment, ref, Text, useSlots, type VNode } from 'vue'
2
+ import { Comment, computed, Fragment, Text, useSlots, type VNode } from 'vue'
3
3
  import { useData } from 'vitepress'
4
4
  import { VPImage } from '../internal'
5
- import { format, useLabels } from '../composables/options'
5
+ import FfHeroCommand from './FfHeroCommand.vue'
6
6
  import type { HeroExtras, HeroMetaItem } from '../types'
7
7
  import type { DefaultTheme } from 'vitepress/theme'
8
8
 
@@ -23,15 +23,19 @@ const props = defineProps<{
23
23
  }>()
24
24
 
25
25
  const { frontmatter } = useData()
26
- const labels = useLabels()
27
26
  const slots = useSlots()
28
27
 
29
- // Two additions to the standard home frontmatter, both optional:
28
+ // Three additions to the standard home frontmatter, all optional:
30
29
  //
31
30
  // hero.command the install line, printed in a panel beside the headline
31
+ // hero.quote a short line ruled like a markdown blockquote β€” under the tagline normally, or
32
+ // under the install line instead once one sits inline beneath it (see hasInlineCommand)
32
33
  // hero.meta a colophon strip under the hero: [{ label, value }, …]
33
34
  const hero = computed<HeroExtras>(() => frontmatter.value.hero ?? {})
34
- const command = computed<string | undefined>(() => hero.value.command)
35
+ const command = computed<HeroExtras['command']>(() => hero.value.command)
36
+ const hasCommand = computed(() => (Array.isArray(command.value) ? command.value.length > 0 : !!command.value))
37
+ const hasActions = computed(() => !!props.actions?.length)
38
+ const quote = computed<string | undefined>(() => hero.value.quote)
35
39
  const meta = computed<HeroMetaItem[]>(() => hero.value.meta ?? [])
36
40
 
37
41
  /**
@@ -60,17 +64,13 @@ function hasImage() {
60
64
  // The second column carries the image when there is one, and the starting point otherwise. The
61
65
  // actions only move over there when they have a panel to sit in.
62
66
  function hasPanel() {
63
- return !hasImage() && !!command.value
67
+ return !hasImage() && hasCommand.value
64
68
  }
65
69
 
66
- const copied = ref(false)
67
-
68
- async function copy() {
69
- if (!command.value) return
70
-
71
- await navigator.clipboard.writeText(command.value)
72
- copied.value = true
73
- setTimeout(() => (copied.value = false), 2000)
70
+ // An image claims the second column, so the install panel has nowhere to sit beside the text β€”
71
+ // it drops under it instead rather than disappearing.
72
+ function hasInlineCommand() {
73
+ return hasImage() && hasCommand.value
74
74
  }
75
75
  </script>
76
76
 
@@ -92,11 +92,13 @@ async function copy() {
92
92
  <h1 v-if="text" class="ff-hero-title ff-display" v-html="text" />
93
93
 
94
94
  <p v-if="tagline" class="ff-hero-tagline" v-html="tagline" />
95
+
96
+ <blockquote v-if="quote && !hasInlineCommand()" class="ff-hero-quote" v-html="quote" />
95
97
  </slot>
96
98
 
97
99
  <slot name="home-hero-info-after" />
98
100
 
99
- <div v-if="actions?.length && !hasPanel()" class="ff-hero-actions">
101
+ <div v-if="hasActions && !hasPanel()" class="ff-hero-actions">
100
102
  <slot name="home-hero-actions-before-actions" />
101
103
 
102
104
  <a
@@ -113,6 +115,15 @@ async function copy() {
113
115
  </div>
114
116
 
115
117
  <slot name="home-hero-actions-after" />
118
+
119
+ <FfHeroCommand
120
+ v-if="hasInlineCommand()"
121
+ :command="command!"
122
+ bare
123
+ class="ff-hero-panel ff-hero-panel-inline ff-hero-panel-bare"
124
+ />
125
+
126
+ <blockquote v-if="quote && hasInlineCommand()" class="ff-hero-quote" v-html="quote" />
116
127
  </div>
117
128
 
118
129
  <div v-if="hasImage()" class="ff-hero-image">
@@ -121,26 +132,14 @@ async function copy() {
121
132
  </slot>
122
133
  </div>
123
134
 
124
- <aside v-else-if="hasPanel()" class="ff-hero-panel">
125
- <p class="ff-hero-panel-label ff-label">{{ labels.heroInstall }}</p>
126
-
127
- <div class="ff-hero-command">
128
- <code>
129
- <span class="ff-hero-prompt" aria-hidden="true">$</span>
130
- {{ command }}
131
- </code>
132
-
133
- <button
134
- type="button"
135
- class="ff-hero-copy ff-label"
136
- :aria-label="format(labels.heroCopyLabel, command ?? '')"
137
- @click="copy"
138
- >
139
- {{ copied ? labels.heroCopied : labels.heroCopy }}
140
- </button>
141
- </div>
135
+ <aside
136
+ v-else-if="hasPanel()"
137
+ class="ff-hero-panel"
138
+ :class="{ 'ff-hero-panel-bare': !hasActions }"
139
+ >
140
+ <FfHeroCommand :command="command!" :bare="!hasActions" />
142
141
 
143
- <div v-if="actions?.length" class="ff-hero-actions">
142
+ <div v-if="hasActions" class="ff-hero-actions">
144
143
  <slot name="home-hero-actions-before-actions" />
145
144
 
146
145
  <a
@@ -0,0 +1,81 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch } from 'vue'
3
+ import { format, useLabels } from '../composables/options'
4
+ import type { HeroCommandTab } from '../types'
5
+
6
+ // Used from both hero panel positions (inline and beside the headline, see FfHero), which are
7
+ // mutually exclusive β€” so the active tab lives here rather than being lifted to the parent.
8
+ const props = defineProps<{
9
+ command: string | HeroCommandTab[]
10
+ /** No actions sit under this command β€” print the bare line, without the "Install" heading. */
11
+ bare?: boolean
12
+ }>()
13
+
14
+ const labels = useLabels()
15
+
16
+ const tabs = computed<HeroCommandTab[] | undefined>(() =>
17
+ Array.isArray(props.command) ? props.command : undefined
18
+ )
19
+
20
+ const activeTab = ref(0)
21
+
22
+ // Client-side navigation can swap the tabs a shorter or longer array without remounting this
23
+ // component (two home pages in the same site), so the index is reset rather than left pointing
24
+ // past the end.
25
+ watch(tabs, () => (activeTab.value = 0))
26
+
27
+ const activeCommand = computed<string>(() =>
28
+ tabs.value ? (tabs.value[activeTab.value]?.value ?? '') : (props.command as string)
29
+ )
30
+
31
+ const copied = ref(false)
32
+
33
+ async function copy() {
34
+ if (!activeCommand.value) return
35
+
36
+ await navigator.clipboard.writeText(activeCommand.value)
37
+ copied.value = true
38
+ setTimeout(() => (copied.value = false), 2000)
39
+ }
40
+ </script>
41
+
42
+ <template>
43
+ <div class="ff-hero-command-panel">
44
+ <p v-if="!bare" class="ff-hero-panel-label ff-label">{{ labels.heroInstall }}</p>
45
+
46
+ <div v-if="tabs" class="ff-hero-command-tabs" role="tablist">
47
+ <button
48
+ v-for="(tab, index) in tabs"
49
+ :key="tab.label"
50
+ type="button"
51
+ role="tab"
52
+ class="ff-hero-command-tab"
53
+ :class="{ active: index === activeTab }"
54
+ :aria-selected="index === activeTab"
55
+ @click="activeTab = index"
56
+ >
57
+ {{ tab.label }}
58
+ </button>
59
+ </div>
60
+
61
+ <div class="ff-hero-command">
62
+ <code>
63
+ <span class="ff-hero-prompt" aria-hidden="true">$</span>
64
+ {{ activeCommand }}
65
+ </code>
66
+
67
+ <span class="ff-hero-copy-group">
68
+ <span v-if="copied" class="ff-hero-copied ff-label">{{ labels.heroCopied }}</span>
69
+
70
+ <button
71
+ type="button"
72
+ class="ff-hero-copy"
73
+ :class="{ copied }"
74
+ :title="format(labels.heroCopyLabel, activeCommand)"
75
+ :aria-label="format(labels.heroCopyLabel, activeCommand)"
76
+ @click="copy"
77
+ />
78
+ </span>
79
+ </div>
80
+ </div>
81
+ </template>
@@ -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/index.ts CHANGED
@@ -43,6 +43,7 @@ export type {
43
43
  BannerConfig,
44
44
  FooterColumn,
45
45
  FooterLink,
46
+ HeroCommandTab,
46
47
  HeroExtras,
47
48
  HeroMetaItem,
48
49
  MetaConfig,
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
  // ----------------------------------------------------------------------------------------- //
@@ -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,80 @@
141
161
  margin: 0 0 1rem;
142
162
  }
143
163
 
164
+ // A multi-command panel (`hero.command` as an array) prints this strip above the line instead
165
+ // of a single one β€” same visual language as the code-group tabs above a fenced block (see
166
+ // _code.scss), so the two don't read as two different controls.
167
+
168
+ .ff-hero-command-tabs {
169
+ display: flex;
170
+ flex-wrap: wrap;
171
+ margin-bottom: 0.75rem;
172
+ border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
173
+ }
174
+
175
+ .ff-hero-command-tab {
176
+ position: relative;
177
+ padding: 0 0.75rem 0.625rem;
178
+ border: 0;
179
+ background: transparent;
180
+ font-family: #{mg.ref("font-mono")};
181
+ font-size: #{mg.ref("size-label")};
182
+ font-weight: 500;
183
+ text-transform: uppercase;
184
+ letter-spacing: #{mg.ref("tracking-label")};
185
+ color: #{mg.ref("color-ink-faint")};
186
+ cursor: pointer;
187
+ transition: color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
188
+ }
189
+
190
+ .ff-hero-command-tab:first-child {
191
+ padding-left: 0;
192
+ }
193
+
194
+ .ff-hero-command-tab::after {
195
+ position: absolute;
196
+ right: 0;
197
+ bottom: calc(#{mg.ref("rule-accent-width")} * -1);
198
+ left: 0;
199
+ height: #{mg.ref("rule-accent-width")};
200
+ background: transparent;
201
+ content: "";
202
+ transition: background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
203
+ }
204
+
205
+ .ff-hero-command-tab:hover {
206
+ color: #{mg.ref("color-ink")};
207
+ }
208
+
209
+ .ff-hero-command-tab.active {
210
+ color: #{mg.ref("color-ink")};
211
+ }
212
+
213
+ .ff-hero-command-tab.active::after {
214
+ background: #{mg.ref("color-accent")};
215
+ }
216
+
217
+ // Same panel, dropped under the text instead of beside it β€” an image already claims the
218
+ // second column, so this is what the install line falls back to rather than disappearing.
219
+
220
+ .ff-hero-panel-inline {
221
+ max-width: 28rem;
222
+ margin-top: 2.5rem;
223
+ }
224
+
225
+ // Nothing to justify the box: no actions sit under the command here (the inline position never
226
+ // carries them; the second-column one only when the site declares none). The command line keeps
227
+ // its own border either way β€” see .ff-hero-command β€” so this still reads as one control, just
228
+ // without the panel framing and the "Install" heading around it.
229
+
230
+ .ff-hero-panel-bare {
231
+ padding: 0;
232
+ border: 0;
233
+ border-radius: 0;
234
+ background: transparent;
235
+ box-shadow: none;
236
+ }
237
+
144
238
  .ff-hero-panel .ff-hero-actions {
145
239
  margin-top: 1.25rem;
146
240
  }
@@ -173,32 +267,89 @@
173
267
  color: #{mg.ref("color-accent")};
174
268
  }
175
269
 
270
+ // Mirrors the copy button on code blocks (see _code.scss): same icon, size and border-radius
271
+ // choreography, so the two don't read as two different controls. It stays fully opaque here
272
+ // rather than fading in on hover β€” this one isn't tucked in the corner of a block, it's the
273
+ // install line's only affordance.
274
+
275
+ .ff-hero-copy-group {
276
+ position: relative;
277
+ display: flex;
278
+ align-items: center;
279
+ flex-shrink: 0;
280
+ }
281
+
282
+ // Absolutely positioned off the group rather than laid out in flow: the label's width tracks
283
+ // the active locale's word for "Copied", and floating it means that never nudges the command
284
+ // line or reflows the panel β€” it just overlaps, flush against the button it belongs to.
285
+
286
+ .ff-hero-copied {
287
+ position: absolute;
288
+ top: 0;
289
+ right: 100%;
290
+ z-index: 1;
291
+ display: flex;
292
+ align-items: center;
293
+ height: 1.75rem;
294
+ padding: 0 0.625rem;
295
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule-strong")};
296
+ border-right: 0;
297
+ border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
298
+ background: #{mg.ref("color-surface-alt")};
299
+ color: #{mg.ref("color-ink-muted")};
300
+ white-space: nowrap;
301
+ }
302
+
176
303
  .ff-hero-copy {
177
304
  flex-shrink: 0;
178
- padding: 0.25rem 0.5rem;
305
+ width: 1.75rem;
306
+ height: 1.75rem;
179
307
  border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
180
308
  border-radius: #{mg.ref("radius-sm")};
181
- background: transparent;
309
+ background-color: transparent;
310
+ background-image: var(--vp-icon-copy);
311
+ background-position: 50%;
312
+ background-repeat: no-repeat;
313
+ background-size: 0.875rem;
182
314
  cursor: pointer;
183
- transition: border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
315
+ transition:
316
+ border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
317
+ background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
184
318
  }
185
319
 
186
320
  .ff-hero-copy:hover {
187
321
  border-color: #{mg.ref("color-rule-strong")};
188
- color: #{mg.ref("color-ink")};
322
+ background-color: #{mg.ref("color-surface-alt")};
323
+ }
324
+
325
+ .ff-hero-copy.copied {
326
+ border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
327
+ border-color: #{mg.ref("color-rule-strong")};
328
+ background-color: #{mg.ref("color-surface-alt")};
329
+ background-image: var(--vp-icon-copied);
189
330
  }
190
331
 
191
332
  .ff-hero-image {
192
333
  display: flex;
193
334
  align-items: center;
194
335
  justify-content: center;
336
+ // Caps it against the viewport rather than the column: at narrow widths the column itself
337
+ // is the limit; past 960px the column is half the hero, wide enough that this is the one
338
+ // that bites, so the image can run as large as the site's own picture allows.
339
+ max-width: 28rem;
195
340
  }
196
341
 
197
342
  .ff-hero-image img {
198
- max-width: 22rem;
343
+ width: 100%;
199
344
  height: auto;
200
345
  }
201
346
 
347
+ @media (min-width: 960px) {
348
+ .ff-hero-image {
349
+ max-width: none;
350
+ }
351
+ }
352
+
202
353
  // ----------------------------------------------------------------------------------------- //
203
354
  // Colophon
204
355
  // ----------------------------------------------------------------------------------------- //
@@ -252,11 +403,19 @@
252
403
  gap: 4.5rem;
253
404
  }
254
405
 
255
- .ff-hero.has-image .ff-hero-container,
406
+ // The panel is a fixed-size box regardless of how wide its column runs, so it gets the
407
+ // narrower one. An image is content, not chrome β€” it can be as large as the site wants,
408
+ // so its column gets an even split instead of ceding room to the text side.
409
+
256
410
  .ff-hero.has-panel .ff-hero-container {
257
411
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
258
412
  align-items: center;
259
413
  }
414
+
415
+ .ff-hero.has-image .ff-hero-container {
416
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
417
+ align-items: center;
418
+ }
260
419
  }
261
420
 
262
421
  // ----------------------------------------------------------------------------------------- //
@@ -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. */
@@ -65,13 +76,30 @@ export interface HeroMetaItem {
65
76
  value: string
66
77
  }
67
78
 
79
+ /** One tab of a multi-command install panel, e.g. npm vs. pnpm vs. bun. */
80
+ export interface HeroCommandTab {
81
+ label: string
82
+ value: string
83
+ }
84
+
68
85
  /**
69
86
  * The two additions this theme makes to the standard `layout: home` hero frontmatter. Both are
70
87
  * optional; everything else on `hero` stays the default theme's.
71
88
  */
72
89
  export interface HeroExtras {
73
- /** Install line, printed in a panel beside the headline when the hero carries no image. */
74
- command?: string
90
+ /**
91
+ * Install line, printed in a panel. Beside the headline when the hero carries no image;
92
+ * under it, carrying the command only, when an image claims that column instead. An array of
93
+ * `{ label, value }` prints a tab strip above the line instead of a single command β€” one tab
94
+ * per package manager, say β€” and the copy button follows whichever tab is active.
95
+ */
96
+ command?: string | HeroCommandTab[]
97
+ /**
98
+ * A short line under the tagline, set off with the same rule-and-italic treatment as a
99
+ * markdown blockquote. Inline HTML is allowed, so a term inside it can be marked up, e.g.
100
+ * `<strong>Charpente</strong> /Κƒaʁ.pΙ‘Μƒt/ β€” French for…`.
101
+ */
102
+ quote?: string
75
103
  /** Colophon strip under the hero. */
76
104
  meta?: HeroMetaItem[]
77
105
  }
@@ -83,8 +111,15 @@ export interface ThemeOptions {
83
111
  meta?: MetaConfig | false
84
112
  /** Link columns added to the site footer. */
85
113
  footerColumns?: FooterColumn[]
114
+ /**
115
+ * Column of `themeConfig.socialLinks` icons, pinned to the right of the footer columns.
116
+ * Defaults to `true`, and shows nothing when the site declares no social link.
117
+ */
118
+ footerSocial?: boolean
86
119
  /** Floating back-to-top control. Defaults to `true`. */
87
120
  backToTop?: boolean
121
+ /** Order of the search box and the nav menu links in the top bar. Defaults to `search-first`. */
122
+ navOrder?: 'search-first' | 'menu-first'
88
123
  /** Overrides for the strings this theme adds. Declare them per locale to translate them. */
89
124
  labels?: ThemeLabels
90
125
  }