@frontfactory/vitepress-theme 1.0.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.
@@ -0,0 +1,429 @@
1
+ // ============================================================================================= //
2
+ // HOME //
3
+ // ============================================================================================= //
4
+
5
+ @use "theme" as mg;
6
+
7
+ .ff-theme {
8
+ // ----------------------------------------------------------------------------------------- //
9
+ // Hero
10
+ //
11
+ // A statement on the left, and a second column that carries something real: the project image
12
+ // when there is one, the starting point otherwise. Under it, a colophon strip.
13
+ // ----------------------------------------------------------------------------------------- //
14
+
15
+ .VPHome {
16
+ margin-bottom: 0;
17
+ }
18
+
19
+ // The hero runs up behind the navigation, which goes transparent at the top of a home page, so
20
+ // the light is continuous instead of stopping on a band under the bar. Both offsets have to be
21
+ // compensated, not just the bar: with a banner above it, the layout reserves room for the two.
22
+
23
+ .ff-hero {
24
+ --ff-hero-offset: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));
25
+
26
+ position: relative;
27
+ margin-top: calc(var(--ff-hero-offset) * -1);
28
+ padding: calc(var(--ff-hero-offset) + 4rem) 1.5rem 3.5rem;
29
+ border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
30
+ overflow: hidden;
31
+ }
32
+
33
+ // The surface already goes transparent here through --vp-nav-home-bg-color; the rule this
34
+ // theme draws itself does not.
35
+
36
+ .VPNavBar.home.top {
37
+ border-bottom-color: transparent;
38
+ }
39
+
40
+ // Two washes of light, one accent and one neutral, so the page has a direction.
41
+
42
+ .ff-hero-glow {
43
+ position: absolute;
44
+ top: -50%;
45
+ left: -6%;
46
+ display: block;
47
+ width: min(72rem, 150%);
48
+ aspect-ratio: 1;
49
+
50
+ // closest-side keeps the wash from meeting the edge of its own box, which would show as a
51
+ // seam once the hero clips it.
52
+ background: radial-gradient(
53
+ circle closest-side at 45% 45%,
54
+ #{mg.ref("color-accent-glow")},
55
+ transparent
56
+ );
57
+ pointer-events: none;
58
+ }
59
+
60
+ .ff-hero-glow-far {
61
+ top: -20%;
62
+ right: -20%;
63
+ left: auto;
64
+ width: min(50rem, 100%);
65
+ background: radial-gradient(
66
+ circle closest-side at 50% 50%,
67
+ #{mg.ref("color-accent-soft")},
68
+ transparent
69
+ );
70
+ }
71
+
72
+ .ff-hero-container {
73
+ position: relative;
74
+ display: grid;
75
+ gap: 3rem;
76
+ max-width: #{mg.ref("layout-wide")};
77
+ margin: 0 auto;
78
+ }
79
+
80
+ .ff-hero-kicker {
81
+ margin: 0 0 1.5rem;
82
+ color: #{mg.ref("color-ink-muted")};
83
+ }
84
+
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
+ // The headline is the one place the theme changes voice: the mono it uses everywhere else for
93
+ // machine text, here at display size. max-width is in ch, so against a monospaced face it is
94
+ // an exact character count — the headline breaks on a measure, not on a guess.
95
+
96
+ .ff-hero-title {
97
+ max-width: 20ch;
98
+ margin: 0;
99
+ font-family: #{mg.ref("font-title")};
100
+ font-size: #{mg.ref("size-hero")};
101
+ font-weight: 600;
102
+ // 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;
106
+ text-transform: uppercase;
107
+ color: #{mg.ref("color-ink")};
108
+ text-wrap: balance;
109
+
110
+ // Drops the optical-size axis .ff-display sets for Inter.
111
+ font-variation-settings: normal;
112
+ }
113
+
114
+ .ff-hero-tagline {
115
+ max-width: 42ch;
116
+ margin: 1.75rem 0 0;
117
+ font-size: #{mg.ref("size-body")};
118
+ line-height: 1.55;
119
+ color: #{mg.ref("color-ink-muted")};
120
+ text-wrap: pretty;
121
+ }
122
+
123
+ .ff-hero-actions {
124
+ display: flex;
125
+ flex-wrap: wrap;
126
+ gap: 0.75rem;
127
+ margin-top: 2.5rem;
128
+ }
129
+
130
+ // ----------------------------------------------------------------------------------------- //
131
+ // Starting point panel
132
+ // ----------------------------------------------------------------------------------------- //
133
+
134
+ .ff-hero-panel {
135
+ align-self: center;
136
+ padding: 1.75rem;
137
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
138
+ border-radius: #{mg.ref("radius-md")};
139
+ background: #{mg.ref("color-surface")};
140
+ box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 5%);
141
+ }
142
+
143
+ .ff-hero-panel-label {
144
+ margin: 0 0 1rem;
145
+ }
146
+
147
+ .ff-hero-panel .ff-hero-actions {
148
+ margin-top: 1.25rem;
149
+ }
150
+
151
+ .ff-hero-panel .ff-btn {
152
+ flex: 1 1 8rem;
153
+ justify-content: center;
154
+ }
155
+
156
+ .ff-hero-command {
157
+ display: flex;
158
+ align-items: center;
159
+ justify-content: space-between;
160
+ gap: 1rem;
161
+ padding: 0.625rem 0.625rem 0.625rem 0.875rem;
162
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
163
+ border-radius: #{mg.ref("radius-sm")};
164
+ background: #{mg.ref("color-paper")};
165
+ }
166
+
167
+ .ff-hero-command code {
168
+ font-family: #{mg.ref("font-mono")};
169
+ font-size: 0.8125rem;
170
+ color: #{mg.ref("color-ink")};
171
+ overflow-x: auto;
172
+ }
173
+
174
+ .ff-hero-prompt {
175
+ margin-right: 0.5rem;
176
+ color: #{mg.ref("color-accent")};
177
+ }
178
+
179
+ .ff-hero-copy {
180
+ flex-shrink: 0;
181
+ padding: 0.25rem 0.5rem;
182
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
183
+ border-radius: #{mg.ref("radius-sm")};
184
+ background: transparent;
185
+ cursor: pointer;
186
+ transition: border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
187
+ }
188
+
189
+ .ff-hero-copy:hover {
190
+ border-color: #{mg.ref("color-rule-strong")};
191
+ color: #{mg.ref("color-ink")};
192
+ }
193
+
194
+ .ff-hero-image {
195
+ display: flex;
196
+ align-items: center;
197
+ justify-content: center;
198
+ }
199
+
200
+ .ff-hero-image img {
201
+ max-width: 22rem;
202
+ height: auto;
203
+ }
204
+
205
+ // ----------------------------------------------------------------------------------------- //
206
+ // Colophon
207
+ // ----------------------------------------------------------------------------------------- //
208
+
209
+ .ff-hero-meta {
210
+ position: relative;
211
+ display: grid;
212
+ grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
213
+ gap: 1.5rem;
214
+ max-width: #{mg.ref("layout-wide")};
215
+ margin: 4rem auto 0;
216
+ padding-top: 1.75rem;
217
+ border-top: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
218
+ }
219
+
220
+ .ff-hero-meta-item {
221
+ padding-left: 1.5rem;
222
+ border-left: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
223
+ }
224
+
225
+ .ff-hero-meta-item:first-child {
226
+ padding-left: 0;
227
+ border-left: 0;
228
+ }
229
+
230
+ .ff-hero-meta dt {
231
+ margin-bottom: 0.625rem;
232
+ }
233
+
234
+ .ff-hero-meta dd {
235
+ margin: 0;
236
+ font-family: #{mg.ref("font-display")};
237
+ font-size: 1.125rem;
238
+ font-weight: 600;
239
+ letter-spacing: -0.01em;
240
+ color: #{mg.ref("color-ink")};
241
+ }
242
+
243
+ @media (min-width: 640px) {
244
+ .ff-hero {
245
+ padding: calc(var(--ff-hero-offset) + 5rem) 3rem 4rem;
246
+ }
247
+ }
248
+
249
+ @media (min-width: 960px) {
250
+ .ff-hero {
251
+ padding: calc(var(--ff-hero-offset) + 5.5rem) 4rem 4.5rem;
252
+ }
253
+
254
+ .ff-hero-container {
255
+ gap: 4.5rem;
256
+ }
257
+
258
+ .ff-hero.has-image .ff-hero-container,
259
+ .ff-hero.has-panel .ff-hero-container {
260
+ grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
261
+ align-items: center;
262
+ }
263
+ }
264
+
265
+ // ----------------------------------------------------------------------------------------- //
266
+ // Buttons
267
+ // ----------------------------------------------------------------------------------------- //
268
+
269
+ .ff-btn {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ height: 2.875rem;
273
+ padding: 0 1.375rem;
274
+ border: #{mg.ref("rule-width")} solid transparent;
275
+ border-radius: #{mg.ref("radius-sm")};
276
+ font-size: 0.875rem;
277
+ font-weight: 550;
278
+ white-space: nowrap;
279
+ }
280
+
281
+ .ff-btn-brand {
282
+ border-color: #{mg.ref("color-accent")};
283
+ background: #{mg.ref("color-accent")};
284
+ color: #{mg.ref("color-accent-contrast")};
285
+ }
286
+
287
+ .ff-btn-brand:hover {
288
+ border-color: #{mg.ref("color-accent-hover")};
289
+ background: #{mg.ref("color-accent-hover")};
290
+ }
291
+
292
+ .ff-btn-alt {
293
+ border-color: #{mg.ref("color-rule-strong")};
294
+ color: #{mg.ref("color-ink")};
295
+ }
296
+
297
+ .ff-btn-alt:hover {
298
+ border-color: #{mg.ref("color-ink")};
299
+ }
300
+
301
+ // ----------------------------------------------------------------------------------------- //
302
+ // Feature grid
303
+ //
304
+ // Columns separated by hairlines rather than a boxed table, each numbered by a large ghost
305
+ // numeral in the corner.
306
+ // ----------------------------------------------------------------------------------------- //
307
+
308
+ .VPFeatures {
309
+ padding: 4rem 1.5rem 5rem;
310
+ }
311
+
312
+ .VPFeatures .container {
313
+ max-width: #{mg.ref("layout-wide")};
314
+ }
315
+
316
+ .VPFeatures .items {
317
+ display: grid;
318
+ grid-template-columns: minmax(0, 1fr);
319
+ gap: #{mg.ref("rule-width")};
320
+ margin: 0;
321
+ background: #{mg.ref("color-rule")};
322
+ counter-reset: ff-feature;
323
+ }
324
+
325
+ .VPFeatures .items > .item,
326
+ .VPFeatures .items > .item[class*="grid-"] {
327
+ width: auto;
328
+ padding: 0;
329
+ counter-increment: ff-feature;
330
+ }
331
+
332
+ .ff-feature {
333
+ position: relative;
334
+ display: flex;
335
+ flex-direction: column;
336
+ height: 100%;
337
+ padding: 2.25rem 2rem 2.5rem;
338
+ background: #{mg.ref("color-paper")};
339
+
340
+ // Own stacking context, so the hover wash can sit between the background and the text.
341
+ isolation: isolate;
342
+ }
343
+
344
+ .ff-feature-index::before {
345
+ content: counter(ff-feature, decimal-leading-zero);
346
+ position: absolute;
347
+ top: 1.5rem;
348
+ right: 1.75rem;
349
+ font-family: #{mg.ref("font-mono")};
350
+ font-size: 2rem;
351
+ font-weight: 500;
352
+ line-height: 1;
353
+ letter-spacing: -0.02em;
354
+ color: #{mg.ref("color-rule-strong")};
355
+ transition: color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
356
+ }
357
+
358
+ a.ff-feature:hover .ff-feature-index::before {
359
+ color: #{mg.ref("color-accent")};
360
+ }
361
+
362
+ .ff-feature-icon {
363
+ font-size: 1.5rem;
364
+ line-height: 1;
365
+ color: #{mg.ref("color-accent")};
366
+ }
367
+
368
+ .ff-feature-icon svg {
369
+ width: 1.625rem;
370
+ height: 1.625rem;
371
+ }
372
+
373
+ .ff-feature-title {
374
+ margin: 2.25rem 0 0;
375
+ font-family: #{mg.ref("font-display")};
376
+ font-size: 1.1875rem;
377
+ font-weight: 620;
378
+ letter-spacing: -0.015em;
379
+ color: #{mg.ref("color-ink")};
380
+ }
381
+
382
+ .ff-feature-icon + .ff-feature-title {
383
+ margin-top: 1.5rem;
384
+ }
385
+
386
+ .ff-feature-details {
387
+ flex-grow: 1;
388
+ margin: 0.75rem 0 0;
389
+ padding: 0;
390
+ font-size: 0.9375rem;
391
+ line-height: 1.7;
392
+ color: #{mg.ref("color-ink-muted")};
393
+ }
394
+
395
+ ul.ff-feature-details {
396
+ padding-left: 1rem;
397
+ list-style: disc;
398
+ }
399
+
400
+ .ff-feature-link {
401
+ margin-top: 1.75rem;
402
+ color: #{mg.ref("color-accent")};
403
+ }
404
+
405
+ @media (min-width: 640px) {
406
+ .VPFeatures {
407
+ padding: 5rem 3rem 6rem;
408
+ }
409
+
410
+ .VPFeatures .items {
411
+ grid-template-columns: repeat(2, minmax(0, 1fr));
412
+ }
413
+ }
414
+
415
+ @media (min-width: 960px) {
416
+ .VPFeatures {
417
+ padding: 6rem 4rem 7rem;
418
+ }
419
+
420
+ .VPFeatures .items:has(.grid-3) {
421
+ grid-template-columns: repeat(3, minmax(0, 1fr));
422
+ }
423
+
424
+ .VPFeatures .items:has(.grid-4),
425
+ .VPFeatures .items:has(.grid-6) {
426
+ grid-template-columns: repeat(4, minmax(0, 1fr));
427
+ }
428
+ }
429
+ }
@@ -0,0 +1,231 @@
1
+ // ============================================================================================= //
2
+ // LIGHT AND MOTION //
3
+ // ============================================================================================= //
4
+
5
+ @use "theme" as mg;
6
+
7
+ // The layer that keeps the theme from reading like a printed page under glass: a slow wash of the
8
+ // accent behind the hero, entrance moves, and hover states that answer back. Everything here is an
9
+ // enhancement — remove this partial and the theme still works.
10
+
11
+ @keyframes ff-rise {
12
+ from {
13
+ opacity: 0;
14
+ transform: translateY(0.875rem);
15
+ }
16
+
17
+ to {
18
+ opacity: 1;
19
+ transform: none;
20
+ }
21
+ }
22
+
23
+ @keyframes ff-drift {
24
+ from {
25
+ transform: translate3d(-4%, -3%, 0) scale(1);
26
+ }
27
+
28
+ to {
29
+ transform: translate3d(6%, 4%, 0) scale(1.12);
30
+ }
31
+ }
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
+ @media (prefers-reduced-motion: no-preference) {
47
+ .ff-theme {
48
+ // ------------------------------------------------------------------------------------- //
49
+ // The hero lights up and settles
50
+ // ------------------------------------------------------------------------------------- //
51
+
52
+ .ff-hero-glow {
53
+ animation: ff-drift 26s #{mg.ref("motion-ease")} infinite alternate;
54
+ }
55
+
56
+ .ff-hero-mark {
57
+ animation: ff-beacon 3.2s ease-in-out infinite;
58
+ }
59
+
60
+ .ff-hero-kicker,
61
+ .ff-hero-title,
62
+ .ff-hero-tagline,
63
+ .ff-hero-main .ff-hero-actions,
64
+ .ff-hero-panel,
65
+ .ff-hero-meta,
66
+ .ff-hero-image {
67
+ animation: ff-rise 0.65s #{mg.ref("motion-ease")} both;
68
+ }
69
+
70
+ .ff-hero-title {
71
+ animation-delay: 0.06s;
72
+ }
73
+
74
+ .ff-hero-tagline {
75
+ animation-delay: 0.12s;
76
+ }
77
+
78
+ .ff-hero-main .ff-hero-actions {
79
+ animation-delay: 0.18s;
80
+ }
81
+
82
+ .ff-hero-panel {
83
+ animation-delay: 0.2s;
84
+ animation-duration: 0.8s;
85
+ }
86
+
87
+ .ff-hero-meta {
88
+ animation-delay: 0.3s;
89
+ }
90
+
91
+ .ff-hero-image {
92
+ animation-delay: 0.14s;
93
+ animation-duration: 0.9s;
94
+ }
95
+
96
+ // Nothing else animates on arrival. Revealing cells and cards on scroll was tried and
97
+ // dropped: it left the content invisible until the reader scrolled, it only ever worked in
98
+ // Chromium, and a page too short to scroll never showed it at all.
99
+ }
100
+ }
101
+
102
+ // --------------------------------------------------------------------------------------------- //
103
+ // Hover states
104
+ //
105
+ // Nothing moves under the cursor: hover changes colour, fill and light, never position. Kept
106
+ // outside the reduced-motion guard, since none of it is ambient movement.
107
+ // --------------------------------------------------------------------------------------------- //
108
+
109
+ .ff-theme {
110
+ .ff-btn,
111
+ .VPButton {
112
+ transition:
113
+ background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
114
+ border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
115
+ box-shadow #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
116
+ color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
117
+ }
118
+
119
+ .ff-btn-brand:hover,
120
+ .VPButton.brand:hover {
121
+ box-shadow: 0 0.5rem 1.5rem #{mg.ref("color-accent-glow")};
122
+ }
123
+
124
+ // Navigation: the underline grows from the left rather than blinking on.
125
+
126
+ .VPNavBarMenuLink {
127
+ position: relative;
128
+ }
129
+
130
+ .VPNavBarMenuLink::after {
131
+ content: "";
132
+ position: absolute;
133
+ right: 0.75rem;
134
+ bottom: 1rem;
135
+ left: 0.75rem;
136
+ height: 2px;
137
+ background: #{mg.ref("color-accent")};
138
+ transform: scaleX(0);
139
+ transform-origin: left;
140
+ transition: transform #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
141
+ }
142
+
143
+ .VPNavBarMenuLink:hover::after,
144
+ .VPNavBarMenuLink.active::after {
145
+ transform: scaleX(1);
146
+ }
147
+
148
+ .VPNavBarMenuLink.active {
149
+ text-decoration: none;
150
+ }
151
+
152
+ // Feature cells and cards catch the light.
153
+ //
154
+ // A gradient cannot be transitioned from a flat background, so the wash is a layer of its own
155
+ // that fades in behind the text.
156
+
157
+ .ff-feature::after {
158
+ content: "";
159
+ position: absolute;
160
+ z-index: -1;
161
+ inset: 0;
162
+ background: linear-gradient(
163
+ 160deg,
164
+ #{mg.ref("color-accent-soft")},
165
+ transparent 60%
166
+ );
167
+ opacity: 0;
168
+ transition: opacity #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")};
169
+ }
170
+
171
+ a.ff-feature:hover::after {
172
+ opacity: 1;
173
+ }
174
+
175
+ .ff-feature-index::before {
176
+ transition: color #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")};
177
+ }
178
+
179
+ .vp-doc .ff-card {
180
+ transition:
181
+ border-color #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")},
182
+ box-shadow #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")};
183
+ }
184
+
185
+ .vp-doc a.ff-card:hover {
186
+ box-shadow: 0 0.75rem 1.75rem #{mg.ref("color-accent-glow")};
187
+ }
188
+
189
+ // Code blocks warm up when they are being read.
190
+
191
+ .vp-doc div[class*="language-"] {
192
+ transition: border-color #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")};
193
+ }
194
+
195
+ .vp-doc div[class*="language-"]:hover {
196
+ border-color: #{mg.ref("color-rule-strong")};
197
+ }
198
+
199
+ .ff-to-top:hover {
200
+ border-color: #{mg.ref("color-accent")};
201
+ color: #{mg.ref("color-accent")};
202
+ }
203
+
204
+ // Small controls: everything that reacts, reacts on the same curve.
205
+
206
+ .ff-hero-copy,
207
+ .ff-banner-close,
208
+ .ff-to-top,
209
+ .VPNavBarSearchButton,
210
+ .vp-doc [class*="language-"] > button.copy,
211
+ .VPDocFooter .pager-link .title,
212
+ .ff-footer-column a,
213
+ .VPDocAsideOutline .outline-link,
214
+ .VPSidebarItem .link .text {
215
+ transition:
216
+ background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
217
+ border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
218
+ color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
219
+ opacity #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
220
+ }
221
+
222
+ // The back-to-top button keeps its own entrance on top of that.
223
+
224
+ .ff-to-top {
225
+ transition:
226
+ border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
227
+ color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
228
+ opacity #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")},
229
+ transform #{mg.ref("motion-duration-slow")} #{mg.ref("motion-ease")};
230
+ }
231
+ }