@frontfactory/vitepress-theme 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/dist/style.css +92 -9
- package/package.json +1 -1
- package/src/components/FfHero.vue +26 -57
- package/src/components/FfHeroCommand.vue +81 -0
- package/src/index.ts +1 -0
- package/src/styles/_home.scss +129 -9
- package/src/types.ts +10 -2
package/README.md
CHANGED
|
@@ -198,15 +198,32 @@ both at once and takes any value between `0` and `1`:
|
|
|
198
198
|
Their colours come from `--ff-color-accent-glow` and `--ff-color-accent-soft`, per scheme.
|
|
199
199
|
|
|
200
200
|
`hero.command` puts an install panel in the second column of the hero, carrying the command and the
|
|
201
|
-
actions, sized to the panel's own fixed box.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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,
|
|
206
208
|
ruled and set in italics the same way a markdown blockquote is — inline HTML works, so a term inside
|
|
207
209
|
it can carry its own `<strong>`. `hero.meta` prints a colophon strip under the hero. `hero.command`,
|
|
208
210
|
`hero.quote` and `hero.meta` are all typed by the exported `HeroExtras` interface.
|
|
209
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
|
+
```
|
|
226
|
+
|
|
210
227
|
```yaml
|
|
211
228
|
---
|
|
212
229
|
layout: home
|
package/dist/style.css
CHANGED
|
@@ -1022,7 +1022,7 @@
|
|
|
1022
1022
|
--ff-hero-offset: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));
|
|
1023
1023
|
position: relative;
|
|
1024
1024
|
margin-top: calc(var(--ff-hero-offset) * -1);
|
|
1025
|
-
padding:
|
|
1025
|
+
padding: var(--ff-hero-offset) 1.5rem 3.5rem;
|
|
1026
1026
|
border-bottom: var(--ff-rule-width) solid var(--ff-color-rule);
|
|
1027
1027
|
overflow: hidden;
|
|
1028
1028
|
}
|
|
@@ -1111,10 +1111,59 @@
|
|
|
1111
1111
|
.ff-theme .ff-hero-panel-label {
|
|
1112
1112
|
margin: 0 0 1rem;
|
|
1113
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
|
+
}
|
|
1114
1156
|
.ff-theme .ff-hero-panel-inline {
|
|
1115
1157
|
max-width: 28rem;
|
|
1116
1158
|
margin-top: 2.5rem;
|
|
1117
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
|
+
}
|
|
1118
1167
|
.ff-theme .ff-hero-panel .ff-hero-actions {
|
|
1119
1168
|
margin-top: 1.25rem;
|
|
1120
1169
|
}
|
|
@@ -1142,18 +1191,51 @@
|
|
|
1142
1191
|
margin-right: 0.5rem;
|
|
1143
1192
|
color: var(--ff-color-accent);
|
|
1144
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
|
+
}
|
|
1145
1216
|
.ff-theme .ff-hero-copy {
|
|
1146
1217
|
flex-shrink: 0;
|
|
1147
|
-
|
|
1218
|
+
width: 1.75rem;
|
|
1219
|
+
height: 1.75rem;
|
|
1148
1220
|
border: var(--ff-rule-width) solid var(--ff-color-rule);
|
|
1149
1221
|
border-radius: var(--ff-radius-sm);
|
|
1150
|
-
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;
|
|
1151
1227
|
cursor: pointer;
|
|
1152
|
-
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);
|
|
1153
1229
|
}
|
|
1154
1230
|
.ff-theme .ff-hero-copy:hover {
|
|
1155
1231
|
border-color: var(--ff-color-rule-strong);
|
|
1156
|
-
color: var(--ff-color-
|
|
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);
|
|
1157
1239
|
}
|
|
1158
1240
|
.ff-theme .ff-hero-image {
|
|
1159
1241
|
display: flex;
|
|
@@ -1201,12 +1283,12 @@
|
|
|
1201
1283
|
}
|
|
1202
1284
|
@media (min-width: 640px) {
|
|
1203
1285
|
.ff-theme .ff-hero {
|
|
1204
|
-
padding:
|
|
1286
|
+
padding: var(--ff-hero-offset) 3rem 4rem;
|
|
1205
1287
|
}
|
|
1206
1288
|
}
|
|
1207
1289
|
@media (min-width: 960px) {
|
|
1208
1290
|
.ff-theme .ff-hero {
|
|
1209
|
-
padding:
|
|
1291
|
+
padding: var(--ff-hero-offset) 4rem 4.5rem;
|
|
1210
1292
|
}
|
|
1211
1293
|
.ff-theme .ff-hero-container {
|
|
1212
1294
|
gap: 4.5rem;
|
|
@@ -1256,9 +1338,9 @@
|
|
|
1256
1338
|
.ff-theme .VPFeatures .items {
|
|
1257
1339
|
display: grid;
|
|
1258
1340
|
grid-template-columns: minmax(0, 1fr);
|
|
1259
|
-
gap:
|
|
1341
|
+
gap: 0;
|
|
1260
1342
|
margin: 0;
|
|
1261
|
-
|
|
1343
|
+
overflow: hidden;
|
|
1262
1344
|
counter-reset: ff-feature;
|
|
1263
1345
|
}
|
|
1264
1346
|
.ff-theme .VPFeatures .items > .item,
|
|
@@ -1274,6 +1356,7 @@
|
|
|
1274
1356
|
height: 100%;
|
|
1275
1357
|
padding: 2.25rem 2rem 2.5rem;
|
|
1276
1358
|
background: var(--ff-color-paper);
|
|
1359
|
+
box-shadow: calc(-1 * var(--ff-rule-width)) 0 0 0 var(--ff-color-rule), 0 calc(-1 * var(--ff-rule-width)) 0 0 var(--ff-color-rule);
|
|
1277
1360
|
isolation: isolate;
|
|
1278
1361
|
}
|
|
1279
1362
|
.ff-theme .ff-feature-index::before {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Comment, computed, Fragment,
|
|
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
|
|
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,16 +23,18 @@ const props = defineProps<{
|
|
|
23
23
|
}>()
|
|
24
24
|
|
|
25
25
|
const { frontmatter } = useData()
|
|
26
|
-
const labels = useLabels()
|
|
27
26
|
const slots = useSlots()
|
|
28
27
|
|
|
29
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
|
|
32
|
-
// hero.quote a short line
|
|
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)
|
|
33
33
|
// hero.meta a colophon strip under the hero: [{ label, value }, …]
|
|
34
34
|
const hero = computed<HeroExtras>(() => frontmatter.value.hero ?? {})
|
|
35
|
-
const command = computed<
|
|
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)
|
|
36
38
|
const quote = computed<string | undefined>(() => hero.value.quote)
|
|
37
39
|
const meta = computed<HeroMetaItem[]>(() => hero.value.meta ?? [])
|
|
38
40
|
|
|
@@ -62,23 +64,13 @@ function hasImage() {
|
|
|
62
64
|
// The second column carries the image when there is one, and the starting point otherwise. The
|
|
63
65
|
// actions only move over there when they have a panel to sit in.
|
|
64
66
|
function hasPanel() {
|
|
65
|
-
return !hasImage() &&
|
|
67
|
+
return !hasImage() && hasCommand.value
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
// An image claims the second column, so the install panel has nowhere to sit beside the text —
|
|
69
71
|
// it drops under it instead rather than disappearing.
|
|
70
72
|
function hasInlineCommand() {
|
|
71
|
-
return hasImage() &&
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const copied = ref(false)
|
|
75
|
-
|
|
76
|
-
async function copy() {
|
|
77
|
-
if (!command.value) return
|
|
78
|
-
|
|
79
|
-
await navigator.clipboard.writeText(command.value)
|
|
80
|
-
copied.value = true
|
|
81
|
-
setTimeout(() => (copied.value = false), 2000)
|
|
73
|
+
return hasImage() && hasCommand.value
|
|
82
74
|
}
|
|
83
75
|
</script>
|
|
84
76
|
|
|
@@ -101,12 +93,12 @@ async function copy() {
|
|
|
101
93
|
|
|
102
94
|
<p v-if="tagline" class="ff-hero-tagline" v-html="tagline" />
|
|
103
95
|
|
|
104
|
-
<blockquote v-if="quote" class="ff-hero-quote" v-html="quote" />
|
|
96
|
+
<blockquote v-if="quote && !hasInlineCommand()" class="ff-hero-quote" v-html="quote" />
|
|
105
97
|
</slot>
|
|
106
98
|
|
|
107
99
|
<slot name="home-hero-info-after" />
|
|
108
100
|
|
|
109
|
-
<div v-if="
|
|
101
|
+
<div v-if="hasActions && !hasPanel()" class="ff-hero-actions">
|
|
110
102
|
<slot name="home-hero-actions-before-actions" />
|
|
111
103
|
|
|
112
104
|
<a
|
|
@@ -124,25 +116,14 @@ async function copy() {
|
|
|
124
116
|
|
|
125
117
|
<slot name="home-hero-actions-after" />
|
|
126
118
|
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
+
<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" />
|
|
146
127
|
</div>
|
|
147
128
|
|
|
148
129
|
<div v-if="hasImage()" class="ff-hero-image">
|
|
@@ -151,26 +132,14 @@ async function copy() {
|
|
|
151
132
|
</slot>
|
|
152
133
|
</div>
|
|
153
134
|
|
|
154
|
-
<aside
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{{ command }}
|
|
161
|
-
</code>
|
|
162
|
-
|
|
163
|
-
<button
|
|
164
|
-
type="button"
|
|
165
|
-
class="ff-hero-copy ff-label"
|
|
166
|
-
:aria-label="format(labels.heroCopyLabel, command ?? '')"
|
|
167
|
-
@click="copy"
|
|
168
|
-
>
|
|
169
|
-
{{ copied ? labels.heroCopied : labels.heroCopy }}
|
|
170
|
-
</button>
|
|
171
|
-
</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" />
|
|
172
141
|
|
|
173
|
-
<div v-if="
|
|
142
|
+
<div v-if="hasActions" class="ff-hero-actions">
|
|
174
143
|
<slot name="home-hero-actions-before-actions" />
|
|
175
144
|
|
|
176
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>
|
package/src/index.ts
CHANGED
package/src/styles/_home.scss
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
position: relative;
|
|
27
27
|
margin-top: calc(var(--ff-hero-offset) * -1);
|
|
28
|
-
padding:
|
|
28
|
+
padding: var(--ff-hero-offset) 1.5rem 3.5rem;
|
|
29
29
|
border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
}
|
|
@@ -161,6 +161,59 @@
|
|
|
161
161
|
margin: 0 0 1rem;
|
|
162
162
|
}
|
|
163
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
|
+
|
|
164
217
|
// Same panel, dropped under the text instead of beside it — an image already claims the
|
|
165
218
|
// second column, so this is what the install line falls back to rather than disappearing.
|
|
166
219
|
|
|
@@ -169,6 +222,19 @@
|
|
|
169
222
|
margin-top: 2.5rem;
|
|
170
223
|
}
|
|
171
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
|
+
|
|
172
238
|
.ff-hero-panel .ff-hero-actions {
|
|
173
239
|
margin-top: 1.25rem;
|
|
174
240
|
}
|
|
@@ -201,19 +267,66 @@
|
|
|
201
267
|
color: #{mg.ref("color-accent")};
|
|
202
268
|
}
|
|
203
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
|
+
|
|
204
303
|
.ff-hero-copy {
|
|
205
304
|
flex-shrink: 0;
|
|
206
|
-
|
|
305
|
+
width: 1.75rem;
|
|
306
|
+
height: 1.75rem;
|
|
207
307
|
border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
|
|
208
308
|
border-radius: #{mg.ref("radius-sm")};
|
|
209
|
-
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;
|
|
210
314
|
cursor: pointer;
|
|
211
|
-
transition:
|
|
315
|
+
transition:
|
|
316
|
+
border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
|
|
317
|
+
background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
|
|
212
318
|
}
|
|
213
319
|
|
|
214
320
|
.ff-hero-copy:hover {
|
|
215
321
|
border-color: #{mg.ref("color-rule-strong")};
|
|
216
|
-
color: #{mg.ref("color-
|
|
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);
|
|
217
330
|
}
|
|
218
331
|
|
|
219
332
|
.ff-hero-image {
|
|
@@ -277,13 +390,13 @@
|
|
|
277
390
|
|
|
278
391
|
@media (min-width: 640px) {
|
|
279
392
|
.ff-hero {
|
|
280
|
-
padding:
|
|
393
|
+
padding: var(--ff-hero-offset) 3rem 4rem;
|
|
281
394
|
}
|
|
282
395
|
}
|
|
283
396
|
|
|
284
397
|
@media (min-width: 960px) {
|
|
285
398
|
.ff-hero {
|
|
286
|
-
padding:
|
|
399
|
+
padding: var(--ff-hero-offset) 4rem 4.5rem;
|
|
287
400
|
}
|
|
288
401
|
|
|
289
402
|
.ff-hero-container {
|
|
@@ -356,12 +469,16 @@
|
|
|
356
469
|
max-width: #{mg.ref("layout-wide")};
|
|
357
470
|
}
|
|
358
471
|
|
|
472
|
+
// Hairlines are drawn per card (top + left, via box-shadow) rather than painted onto the
|
|
473
|
+
// container behind a gap. A background-filled gap bleeds into any unfilled cell of a ragged
|
|
474
|
+
// last row, showing as a grey block; a shadow only exists where a card does.
|
|
475
|
+
|
|
359
476
|
.VPFeatures .items {
|
|
360
477
|
display: grid;
|
|
361
478
|
grid-template-columns: minmax(0, 1fr);
|
|
362
|
-
gap:
|
|
479
|
+
gap: 0;
|
|
363
480
|
margin: 0;
|
|
364
|
-
|
|
481
|
+
overflow: hidden;
|
|
365
482
|
counter-reset: ff-feature;
|
|
366
483
|
}
|
|
367
484
|
|
|
@@ -379,6 +496,9 @@
|
|
|
379
496
|
height: 100%;
|
|
380
497
|
padding: 2.25rem 2rem 2.5rem;
|
|
381
498
|
background: #{mg.ref("color-paper")};
|
|
499
|
+
box-shadow:
|
|
500
|
+
calc(-1 * #{mg.ref("rule-width")}) 0 0 0 #{mg.ref("color-rule")},
|
|
501
|
+
0 calc(-1 * #{mg.ref("rule-width")}) 0 0 #{mg.ref("color-rule")};
|
|
382
502
|
|
|
383
503
|
// Own stacking context, so the hover wash can sit between the background and the text.
|
|
384
504
|
isolation: isolate;
|
package/src/types.ts
CHANGED
|
@@ -76,6 +76,12 @@ export interface HeroMetaItem {
|
|
|
76
76
|
value: string
|
|
77
77
|
}
|
|
78
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
|
+
|
|
79
85
|
/**
|
|
80
86
|
* The two additions this theme makes to the standard `layout: home` hero frontmatter. Both are
|
|
81
87
|
* optional; everything else on `hero` stays the default theme's.
|
|
@@ -83,9 +89,11 @@ export interface HeroMetaItem {
|
|
|
83
89
|
export interface HeroExtras {
|
|
84
90
|
/**
|
|
85
91
|
* 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.
|
|
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.
|
|
87
95
|
*/
|
|
88
|
-
command?: string
|
|
96
|
+
command?: string | HeroCommandTab[]
|
|
89
97
|
/**
|
|
90
98
|
* A short line under the tagline, set off with the same rule-and-italic treatment as a
|
|
91
99
|
* markdown blockquote. Inline HTML is allowed, so a term inside it can be marked up, e.g.
|