@frontfactory/vitepress-theme 1.8.0 → 1.10.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +11 -391
  3. package/config.d.ts +4 -3
  4. package/config.js +58 -40
  5. package/dist/style.css +1 -1
  6. package/node/banner.d.ts +3 -0
  7. package/node/banner.js +14 -0
  8. package/node/blog.d.ts +11 -0
  9. package/node/blog.js +63 -0
  10. package/node/llms.js +4 -3
  11. package/node/og.js +5 -6
  12. package/node/options.d.ts +1 -0
  13. package/node/options.js +17 -0
  14. package/node/page-actions.d.ts +12 -0
  15. package/node/page-actions.js +34 -0
  16. package/node/pages.js +34 -14
  17. package/node/rss.js +13 -21
  18. package/package.json +1 -1
  19. package/src/blog/posts.data.ts +7 -4
  20. package/src/components/FfBackToTop.vue +6 -36
  21. package/src/components/FfBanner.vue +3 -2
  22. package/src/components/FfCopyStatus.vue +6 -14
  23. package/src/components/FfDocMeta.vue +299 -24
  24. package/src/components/FfFeedback.vue +4 -9
  25. package/src/components/FfHero.vue +14 -33
  26. package/src/components/FfHeroActions.vue +44 -0
  27. package/src/components/FfHeroCommand.vue +3 -2
  28. package/src/components/FfPost.vue +6 -4
  29. package/src/components/FfProgress.vue +6 -40
  30. package/src/composables/blog.ts +8 -11
  31. package/src/composables/copy.ts +29 -0
  32. package/src/composables/frame.ts +50 -0
  33. package/src/composables/options.ts +9 -1
  34. package/src/composables/tabs.ts +2 -35
  35. package/src/composables/transient.ts +27 -0
  36. package/src/content/Tabs.vue +27 -6
  37. package/src/internal.ts +1 -0
  38. package/src/layout/FfLayout.vue +3 -3
  39. package/src/styles/_base.scss +5 -9
  40. package/src/styles/_blocks.scss +4 -7
  41. package/src/styles/_blog.scss +4 -5
  42. package/src/styles/_code.scss +12 -20
  43. package/src/styles/_content.scss +153 -63
  44. package/src/styles/_doc.scss +26 -25
  45. package/src/styles/_home.scss +31 -61
  46. package/src/styles/_mixins.scss +87 -0
  47. package/src/styles/_motion.scss +12 -10
  48. package/src/styles/_nav.scss +12 -19
  49. package/src/styles/_sidebar.scss +5 -8
  50. package/src/styles/_tokens.scss +19 -4
  51. package/src/types.ts +31 -4
  52. package/types/components/FfHeroActions.vue.d.ts +19 -0
  53. package/types/composables/blog.d.ts +3 -4
  54. package/types/composables/copy.d.ts +6 -0
  55. package/types/composables/frame.d.ts +6 -0
  56. package/types/composables/tabs.d.ts +0 -5
  57. package/types/composables/transient.d.ts +6 -0
  58. package/types/internal.d.ts +1 -0
  59. package/types/types.d.ts +29 -4
@@ -2,6 +2,7 @@
2
2
  // CODE //
3
3
  // ============================================================================================= //
4
4
 
5
+ @use "mixins";
5
6
  @use "theme" as mg;
6
7
 
7
8
  .ff-theme {
@@ -31,12 +32,9 @@
31
32
  left: 0;
32
33
  height: 2.5rem;
33
34
  padding: 0 1rem;
34
- font-family: #{mg.ref("font-mono")};
35
- font-size: #{mg.ref("size-label")};
36
- font-weight: 500;
37
- text-transform: uppercase;
38
- letter-spacing: #{mg.ref("tracking-label")};
39
- color: #{mg.ref("color-ink-faint")};
35
+
36
+ @include mixins.label;
37
+
40
38
  opacity: 1;
41
39
  }
42
40
 
@@ -48,11 +46,8 @@
48
46
  .vp-doc [class*="language-"] > button.copy {
49
47
  top: 0.4375rem;
50
48
  right: 0.625rem;
51
- width: 1.75rem;
52
- height: 1.75rem;
53
- border-radius: #{mg.ref("radius-sm")};
54
- background-color: transparent;
55
- background-size: 0.875rem;
49
+
50
+ @include mixins.copy-button;
56
51
 
57
52
  // Fully opaque at rest: dimmed, the grey icon falls under the 3:1 non-text contrast minimum.
58
53
  opacity: 1;
@@ -60,14 +55,15 @@
60
55
 
61
56
  .vp-doc [class*="language-"] > button.copy.copied,
62
57
  .vp-doc [class*="language-"] > button.copy:hover.copied {
63
- border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
58
+ @include mixins.copy-button-copied;
64
59
  }
65
60
 
66
61
  .vp-doc [class*="language-"] > button.copy.copied::before,
67
62
  .vp-doc [class*="language-"] > button.copy:hover.copied::before {
68
63
  top: 0;
69
- height: 1.75rem;
70
- border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
64
+
65
+ @include mixins.copied-flag;
66
+
71
67
  background: #{mg.ref("color-surface")};
72
68
  font-family: #{mg.ref("font-mono")};
73
69
  font-size: #{mg.ref("size-label")};
@@ -139,12 +135,8 @@
139
135
  .vp-doc .vp-code-group .tabs label {
140
136
  padding: 0 0.75rem;
141
137
  line-height: 2.5rem;
142
- font-family: #{mg.ref("font-mono")};
143
- font-size: #{mg.ref("size-label")};
144
- font-weight: 500;
145
- text-transform: uppercase;
146
- letter-spacing: #{mg.ref("tracking-label")};
147
- color: #{mg.ref("color-ink-faint")};
138
+
139
+ @include mixins.label;
148
140
  }
149
141
 
150
142
  .vp-doc .vp-code-group input:checked + label {
@@ -3,6 +3,7 @@
3
3
  // ============================================================================================= //
4
4
 
5
5
  @use "breakpoints" as bp;
6
+ @use "mixins";
6
7
  @use "theme" as mg;
7
8
 
8
9
  // The dismissal class is set on <html>, outside the themed root. It carries the themed root in the
@@ -41,8 +42,6 @@
41
42
  gap: 1rem;
42
43
  min-height: #{mg.ref("banner-height")};
43
44
  padding: 0.625rem 3rem;
44
- background: #{mg.ref("color-ink")};
45
- color: #{mg.ref("color-paper")};
46
45
  }
47
46
 
48
47
  // `ff.navSticky: false` un-fixes the bar it sits above, so the banner follows it into normal
@@ -122,7 +121,7 @@
122
121
  display: flex;
123
122
  align-items: center;
124
123
  gap: 0.75rem;
125
- font-size: 0.8125rem;
124
+ font-size: #{mg.ref("size-small")};
126
125
  color: inherit;
127
126
  }
128
127
 
@@ -178,38 +177,165 @@
178
177
  // Pushed to the end of the row and framed like the hero copy button, so it reads as a control
179
178
  // rather than one more piece of metadata.
180
179
 
181
- .ff-doc-meta-copy {
180
+ .ff-doc-meta-actions {
181
+ position: relative;
182
+ margin-left: auto;
183
+ }
184
+
185
+ // One pill: the main button and the chevron share the frame, split by a thin divider.
186
+
187
+ .ff-doc-meta-split {
188
+ display: inline-flex;
189
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
190
+ border-radius: #{mg.ref("radius-sm")};
191
+ transition: border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
192
+ }
193
+
194
+ .ff-doc-meta-split:hover,
195
+ .ff-doc-meta-split.copied {
196
+ border-color: #{mg.ref("color-rule-strong")};
197
+ }
198
+
199
+ .ff-doc-meta-main,
200
+ .ff-doc-meta-toggle {
182
201
  display: inline-flex;
183
202
  align-items: center;
184
203
  gap: 0.5em;
185
- margin-left: auto;
186
204
  padding: 0.375rem 0.625rem;
187
- border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
188
- border-radius: #{mg.ref("radius-sm")};
205
+ border: 0;
189
206
  background: transparent;
190
207
  font: inherit;
191
208
  letter-spacing: inherit;
192
209
  text-transform: inherit;
193
210
  color: inherit;
194
211
  cursor: pointer;
212
+ transition:
213
+ background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
214
+ color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
195
215
  }
196
216
 
197
- .ff-doc-meta-copy::before {
198
- content: "";
199
- width: 0.875rem;
200
- height: 0.875rem;
201
- background: var(--vp-icon-copy) 50% / contain no-repeat;
217
+ .ff-doc-meta-main {
218
+ border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
202
219
  }
203
220
 
204
- .ff-doc-meta-copy:hover,
205
- .ff-doc-meta-copy.copied {
206
- border-color: #{mg.ref("color-rule-strong")};
221
+ .ff-doc-meta-toggle {
222
+ border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
223
+ }
224
+
225
+ .ff-doc-meta-main + .ff-doc-meta-toggle {
226
+ padding-inline: 0.5rem;
227
+ border-left: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
228
+ }
229
+
230
+ .ff-doc-meta-main:hover,
231
+ .ff-doc-meta-toggle:hover,
232
+ .ff-doc-meta-toggle.open,
233
+ .ff-doc-meta-split.copied .ff-doc-meta-main {
207
234
  background-color: #{mg.ref("color-surface-alt")};
208
235
  color: #{mg.ref("color-ink")};
209
236
  }
210
237
 
211
- .ff-doc-meta-copy.copied::before {
212
- background-image: var(--vp-icon-copied);
238
+ .ff-doc-meta-main:focus-visible,
239
+ .ff-doc-meta-toggle:focus-visible,
240
+ .ff-doc-meta-menu > :focus-visible {
241
+ outline: 2px solid var(--vp-c-brand-1);
242
+ outline-offset: -2px;
243
+ }
244
+
245
+ .ff-doc-meta-icon {
246
+ flex: none;
247
+ width: 1rem;
248
+ height: 1rem;
249
+ fill: none;
250
+ stroke: currentcolor;
251
+ stroke-width: 2;
252
+ stroke-linecap: round;
253
+ stroke-linejoin: round;
254
+ }
255
+
256
+ .ff-doc-meta-icon.brand {
257
+ fill: currentcolor;
258
+ stroke: none;
259
+ }
260
+
261
+ .ff-doc-meta-chevron {
262
+ transition: transform #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
263
+ }
264
+
265
+ .ff-doc-meta-toggle.open .ff-doc-meta-chevron {
266
+ transform: rotate(180deg);
267
+ }
268
+
269
+ // Under the trigger and right-aligned with it, so it stays on screen: the pill sits at the end
270
+ // of the row.
271
+
272
+ .ff-doc-meta-menu {
273
+ position: absolute;
274
+ top: 100%;
275
+ right: 0;
276
+ z-index: #{mg.ref("z-float")};
277
+ display: flex;
278
+ flex-direction: column;
279
+ min-width: 14rem;
280
+ max-width: calc(100vw - 2rem);
281
+ margin-top: 0.375rem;
282
+ padding: 0.375rem;
283
+ border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
284
+ border-radius: #{mg.ref("radius-md")};
285
+ background: var(--vp-c-bg-elv);
286
+ box-shadow: var(--vp-shadow-3);
287
+ white-space: nowrap;
288
+ }
289
+
290
+ .ff-doc-meta-menu > button,
291
+ .ff-doc-meta-menu > a {
292
+ display: flex;
293
+ align-items: center;
294
+ gap: 0.625rem;
295
+ padding: 0.5rem 0.625rem;
296
+ border: 0;
297
+ border-radius: #{mg.ref("radius-sm")};
298
+ background: transparent;
299
+ font: inherit;
300
+ letter-spacing: inherit;
301
+ text-transform: inherit;
302
+ text-align: left;
303
+ text-decoration: none;
304
+ color: inherit;
305
+ cursor: pointer;
306
+ }
307
+
308
+ .ff-doc-meta-menu > button:hover,
309
+ .ff-doc-meta-menu > a:hover,
310
+ .ff-doc-meta-menu > :focus-visible {
311
+ background-color: #{mg.ref("color-surface-alt")};
312
+ color: #{mg.ref("color-ink")};
313
+ }
314
+
315
+ .ff-doc-meta-menu-text {
316
+ display: flex;
317
+ flex: 1;
318
+ flex-direction: column;
319
+ gap: 0.125rem;
320
+ }
321
+
322
+ .ff-doc-meta-menu small {
323
+ font-size: 0.85em;
324
+ color: #{mg.ref("color-ink-muted")};
325
+ }
326
+
327
+ .ff-doc-meta-external {
328
+ width: 0.875rem;
329
+ height: 0.875rem;
330
+ color: #{mg.ref("color-ink-muted")};
331
+ }
332
+
333
+ .ff-doc-meta-menu hr {
334
+ width: 100%;
335
+ height: 0;
336
+ margin: 0.375rem 0;
337
+ border: 0;
338
+ border-top: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
213
339
  }
214
340
 
215
341
  // ----------------------------------------------------------------------------------------- //
@@ -220,7 +346,7 @@
220
346
  position: fixed;
221
347
  right: 1.5rem;
222
348
  bottom: 1.5rem;
223
- z-index: 20;
349
+ z-index: #{mg.ref("z-float")};
224
350
  gap: 0.375rem;
225
351
  padding: 0.625rem 0.75rem;
226
352
  border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
@@ -250,7 +376,7 @@
250
376
  right: 0;
251
377
  left: 0;
252
378
  z-index: calc(var(--vp-z-index-layout-top) + 1);
253
- height: 2px;
379
+ height: #{mg.ref("rule-accent-width")};
254
380
  background: #{mg.ref("color-accent")};
255
381
  transform-origin: left;
256
382
  pointer-events: none;
@@ -353,9 +479,8 @@
353
479
  }
354
480
 
355
481
  .ff-footer-column a {
356
- font-size: 0.875rem;
482
+ font-size: #{mg.ref("size-ui")};
357
483
  color: #{mg.ref("color-ink-muted")};
358
- transition: color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
359
484
  }
360
485
 
361
486
  .ff-footer-column a:hover {
@@ -429,16 +554,16 @@
429
554
  .vp-doc .ff-card-title {
430
555
  margin: 0;
431
556
  font-family: #{mg.ref("font-display")};
432
- font-size: 1rem;
557
+ font-size: #{mg.ref("size-body")};
433
558
  font-weight: 620;
434
- letter-spacing: -0.01em;
559
+ letter-spacing: #{mg.ref("tracking-tight")};
435
560
  color: #{mg.ref("color-ink")};
436
561
  }
437
562
 
438
563
  .vp-doc .ff-card-body,
439
564
  .vp-doc .ff-card-body p {
440
565
  margin: 0.5rem 0 0;
441
- font-size: 0.9375rem;
566
+ font-size: #{mg.ref("size-ui-lg")};
442
567
  line-height: 1.6;
443
568
  color: #{mg.ref("color-ink-muted")};
444
569
  }
@@ -536,7 +661,7 @@
536
661
  }
537
662
 
538
663
  .vp-doc .ff-api-signature code {
539
- font-size: 0.8125rem;
664
+ font-size: #{mg.ref("size-small")};
540
665
  color: #{mg.ref("color-ink-muted")};
541
666
  }
542
667
 
@@ -556,7 +681,7 @@
556
681
  border-radius: #{mg.ref("radius-sm")};
557
682
  background: #{mg.ref("color-surface")};
558
683
  font-family: #{mg.ref("font-mono")};
559
- font-size: 0.75rem;
684
+ font-size: #{mg.ref("size-meta")};
560
685
  line-height: 1.4;
561
686
  text-align: center;
562
687
  color: #{mg.ref("color-ink-muted")};
@@ -578,42 +703,7 @@
578
703
  }
579
704
 
580
705
  .vp-doc .ff-tabs-tab {
581
- position: relative;
582
- padding: 0 0.75rem 0.625rem;
583
- border: 0;
584
- background: transparent;
585
- font-family: #{mg.ref("font-mono")};
586
- font-size: #{mg.ref("size-label")};
587
- font-weight: 500;
588
- text-transform: uppercase;
589
- letter-spacing: #{mg.ref("tracking-label")};
590
- color: #{mg.ref("color-ink-faint")};
591
- cursor: pointer;
592
- transition: color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
593
- }
594
-
595
- .vp-doc .ff-tabs-tab:first-child {
596
- padding-left: 0;
597
- }
598
-
599
- .vp-doc .ff-tabs-tab::after {
600
- position: absolute;
601
- right: 0;
602
- bottom: calc(#{mg.ref("rule-accent-width")} * -1);
603
- left: 0;
604
- height: #{mg.ref("rule-accent-width")};
605
- background: transparent;
606
- content: "";
607
- transition: background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
608
- }
609
-
610
- .vp-doc .ff-tabs-tab:hover,
611
- .vp-doc .ff-tabs-tab.active {
612
- color: #{mg.ref("color-ink")};
613
- }
614
-
615
- .vp-doc .ff-tabs-tab.active::after {
616
- background: #{mg.ref("color-accent")};
706
+ @include mixins.tab;
617
707
  }
618
708
 
619
709
  // The first and last blocks of a panel carry their own margins, which would double up with
@@ -634,7 +724,7 @@
634
724
  .vp-doc .ff-filetree {
635
725
  margin: 1.75rem 0;
636
726
  font-family: #{mg.ref("font-mono")};
637
- font-size: 0.875rem;
727
+ font-size: #{mg.ref("size-ui")};
638
728
  }
639
729
 
640
730
  .vp-doc .ff-filetree ul {
@@ -3,6 +3,7 @@
3
3
  // ============================================================================================= //
4
4
 
5
5
  @use "breakpoints" as bp;
6
+ @use "mixins";
6
7
  @use "theme" as mg;
7
8
 
8
9
  // The frame: the band every page lives in.
@@ -96,10 +97,8 @@
96
97
 
97
98
  .vp-doc h1 {
98
99
  margin: 0 0 1.25rem;
99
- font-size: #{mg.ref("size-h1")};
100
- font-weight: 620;
101
- line-height: #{mg.ref("leading-tight")};
102
- letter-spacing: -0.03em;
100
+
101
+ @include mixins.page-title;
103
102
  }
104
103
 
105
104
  .vp-doc h2 {
@@ -129,12 +128,12 @@
129
128
  margin: 2.5rem 0 0.75rem;
130
129
  font-size: #{mg.ref("size-h3")};
131
130
  font-weight: 600;
132
- letter-spacing: -0.015em;
131
+ letter-spacing: #{mg.ref("tracking-subheading")};
133
132
  }
134
133
 
135
134
  .vp-doc h4 {
136
135
  margin: 2rem 0 0.5rem;
137
- font-size: 1rem;
136
+ font-size: #{mg.ref("size-body")};
138
137
  font-weight: 600;
139
138
  }
140
139
 
@@ -158,7 +157,7 @@
158
157
  .vp-doc h2:hover .header-anchor,
159
158
  .vp-doc h3:hover .header-anchor,
160
159
  .vp-doc h4:hover .header-anchor,
161
- .vp-doc .header-anchor:focus {
160
+ .vp-doc .header-anchor:focus-visible {
162
161
  opacity: 1;
163
162
  }
164
163
 
@@ -210,7 +209,7 @@
210
209
  }
211
210
 
212
211
  .vp-doc blockquote > p {
213
- font-size: 1rem;
212
+ font-size: #{mg.ref("size-body")};
214
213
  font-style: italic;
215
214
  color: #{mg.ref("color-ink-muted")};
216
215
  }
@@ -268,20 +267,16 @@
268
267
  border: 0;
269
268
  border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule-strong")};
270
269
  background: transparent;
271
- font-family: #{mg.ref("font-mono")};
272
- font-size: #{mg.ref("size-label")};
273
- font-weight: 500;
274
270
  text-align: left;
275
- text-transform: uppercase;
276
- letter-spacing: #{mg.ref("tracking-label")};
277
- color: #{mg.ref("color-ink-faint")};
271
+
272
+ @include mixins.label;
278
273
  }
279
274
 
280
275
  .vp-doc td {
281
276
  padding: 0.75rem 0.875rem 0.75rem 0;
282
277
  border: 0;
283
278
  border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
284
- font-size: 0.9375rem;
279
+ font-size: #{mg.ref("size-ui-lg")};
285
280
  line-height: 1.6;
286
281
  vertical-align: top;
287
282
  }
@@ -308,11 +303,16 @@
308
303
  border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
309
304
  }
310
305
 
306
+ // The stamp's own `<p class="VPLastUpdated">` sets its font and line height, so the rule has to
307
+ // target it rather than its wrapper; the `<time>` inherits. Both items share one line height
308
+ // so the row centres them on the same baseline.
309
+
311
310
  .VPDocFooter .edit-link-button,
312
- .VPDocFooter .last-updated {
311
+ .VPDocFooter .last-updated .VPLastUpdated {
313
312
  font-family: #{mg.ref("font-mono")};
314
313
  font-size: #{mg.ref("size-meta")};
315
314
  font-weight: 400;
315
+ line-height: #{mg.ref("leading-body")};
316
316
  color: #{mg.ref("color-ink-faint")};
317
317
  }
318
318
 
@@ -320,6 +320,12 @@
320
320
  color: #{mg.ref("color-accent")};
321
321
  }
322
322
 
323
+ // Vue condenses the whitespace between the label and the `<time>`, so the gap is drawn here.
324
+
325
+ .VPDocFooter .last-updated .VPLastUpdated time {
326
+ margin-inline-start: 1ch;
327
+ }
328
+
323
329
  .VPDocFooter .prev-next {
324
330
  margin-top: 0;
325
331
  padding-top: 0;
@@ -344,19 +350,14 @@
344
350
  }
345
351
 
346
352
  .VPDocFooter .pager-link .desc {
347
- font-family: #{mg.ref("font-mono")};
348
- font-size: #{mg.ref("size-label")};
349
- font-weight: 500;
350
- text-transform: uppercase;
351
- letter-spacing: #{mg.ref("tracking-label")};
352
- color: #{mg.ref("color-ink-faint")};
353
+ @include mixins.label;
353
354
  }
354
355
 
355
356
  .VPDocFooter .pager-link .title {
356
357
  font-family: #{mg.ref("font-display")};
357
358
  font-size: 1.0625rem;
358
359
  font-weight: 600;
359
- letter-spacing: -0.015em;
360
+ letter-spacing: #{mg.ref("tracking-subheading")};
360
361
  color: #{mg.ref("color-ink")};
361
362
  }
362
363
 
@@ -402,7 +403,7 @@
402
403
  .VPDocAsideOutline .outline-link {
403
404
  display: block;
404
405
  padding: 0.25rem 0;
405
- font-size: 0.875rem;
406
+ font-size: #{mg.ref("size-ui")};
406
407
  font-weight: 450;
407
408
  line-height: 1.5;
408
409
  color: #{mg.ref("color-ink-muted")};
@@ -425,6 +426,6 @@
425
426
  }
426
427
 
427
428
  .VPDocAsideOutline .VPDocOutlineItem.nested .outline-link {
428
- font-size: 0.8125rem;
429
+ font-size: #{mg.ref("size-small")};
429
430
  }
430
431
  }