@frontfactory/vitepress-theme 1.3.2 → 1.4.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/dist/style.css CHANGED
@@ -243,6 +243,18 @@
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-sticky=false] .VPNav {
247
+ position: relative;
248
+ top: 0;
249
+ }
250
+ .ff-theme[data-nav-sticky=false] .VPContent {
251
+ margin-top: 0;
252
+ }
253
+ @media (min-width: 960px) {
254
+ .ff-theme[data-nav-sticky=false] .VPContent {
255
+ padding-top: 0;
256
+ }
257
+ }
246
258
  .ff-theme[data-nav-order=menu-first] .content-body .menu {
247
259
  order: 1;
248
260
  flex-grow: 0;
@@ -1026,6 +1038,9 @@
1026
1038
  border-bottom: var(--ff-rule-width) solid var(--ff-color-rule);
1027
1039
  overflow: hidden;
1028
1040
  }
1041
+ .ff-theme[data-nav-sticky=false] .ff-hero {
1042
+ --ff-hero-offset: 0px;
1043
+ }
1029
1044
  .ff-theme .VPNavBar.home.top {
1030
1045
  border-bottom-color: transparent;
1031
1046
  }
@@ -1330,7 +1345,7 @@
1330
1345
  border-color: var(--ff-color-ink);
1331
1346
  }
1332
1347
  .ff-theme .VPFeatures {
1333
- padding: 4rem 1.5rem 5rem;
1348
+ padding: 2.5rem 1.5rem 3rem;
1334
1349
  }
1335
1350
  .ff-theme .VPFeatures .container {
1336
1351
  max-width: var(--ff-layout-wide);
@@ -1413,7 +1428,7 @@
1413
1428
  }
1414
1429
  @media (min-width: 640px) {
1415
1430
  .ff-theme .VPFeatures {
1416
- padding: 5rem 3rem 6rem;
1431
+ padding: 3rem 3rem 3.5rem;
1417
1432
  }
1418
1433
  .ff-theme .VPFeatures .items {
1419
1434
  grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -1421,7 +1436,7 @@
1421
1436
  }
1422
1437
  @media (min-width: 960px) {
1423
1438
  .ff-theme .VPFeatures {
1424
- padding: 6rem 4rem 7rem;
1439
+ padding: 3.5rem 4rem 4rem;
1425
1440
  }
1426
1441
  .ff-theme .VPFeatures .items:has(.grid-3) {
1427
1442
  grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -1455,6 +1470,9 @@
1455
1470
  background: var(--ff-color-ink);
1456
1471
  color: var(--ff-color-paper);
1457
1472
  }
1473
+ .ff-theme[data-nav-sticky=false] .ff-banner {
1474
+ position: relative;
1475
+ }
1458
1476
  .ff-theme .ff-banner[data-variant=ink] {
1459
1477
  --ff-banner-from: var(--ff-color-ink);
1460
1478
  --ff-banner-to: var(--ff-color-ink-muted);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontfactory/vitepress-theme",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Editorial VitePress theme — hairline rules, numbered sections and monospaced metadata.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -18,7 +18,11 @@ const forwarded = computed(() => Object.keys(slots).filter((name) => !owned.incl
18
18
  </script>
19
19
 
20
20
  <template>
21
- <div class="ff-theme" :data-nav-order="options.navOrder ?? 'search-first'">
21
+ <div
22
+ class="ff-theme"
23
+ :data-nav-order="options.navOrder ?? 'search-first'"
24
+ :data-nav-sticky="options.navSticky === false ? 'false' : 'true'"
25
+ >
22
26
  <Layout>
23
27
  <template #layout-top>
24
28
  <FfBanner />
@@ -43,6 +43,13 @@
43
43
  color: #{mg.ref("color-paper")};
44
44
  }
45
45
 
46
+ // `ff.navSticky: false` un-fixes the bar it sits above, so the banner follows it into normal
47
+ // flow instead of staying pinned on its own.
48
+
49
+ &[data-nav-sticky="false"] .ff-banner {
50
+ position: relative;
51
+ }
52
+
46
53
  // Each variant sets the two custom properties the flat and gradient backgrounds below read
47
54
  // from. Ink stays the theme's original bar; the others borrow the same status colours the
48
55
  // rest of the theme already uses for tips, success and warning states.
@@ -30,6 +30,13 @@
30
30
  overflow: hidden;
31
31
  }
32
32
 
33
+ // With `ff.navSticky: false` the bar sits in normal flow instead of floating over the hero, so
34
+ // the layout already reserves its height above — the hero has nothing left to compensate for.
35
+
36
+ &[data-nav-sticky="false"] .ff-hero {
37
+ --ff-hero-offset: 0px;
38
+ }
39
+
33
40
  // The surface already goes transparent here through --vp-nav-home-bg-color; the rule this
34
41
  // theme draws itself does not.
35
42
 
@@ -462,7 +469,7 @@
462
469
  // ----------------------------------------------------------------------------------------- //
463
470
 
464
471
  .VPFeatures {
465
- padding: 4rem 1.5rem 5rem;
472
+ padding: 2.5rem 1.5rem 3rem;
466
473
  }
467
474
 
468
475
  .VPFeatures .container {
@@ -567,7 +574,7 @@
567
574
 
568
575
  @media (min-width: 640px) {
569
576
  .VPFeatures {
570
- padding: 5rem 3rem 6rem;
577
+ padding: 3rem 3rem 3.5rem;
571
578
  }
572
579
 
573
580
  .VPFeatures .items {
@@ -577,7 +584,7 @@
577
584
 
578
585
  @media (min-width: 960px) {
579
586
  .VPFeatures {
580
- padding: 6rem 4rem 7rem;
587
+ padding: 3.5rem 4rem 4rem;
581
588
  }
582
589
 
583
590
  .VPFeatures .items:has(.grid-3) {
@@ -17,6 +17,31 @@
17
17
  border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
18
18
  }
19
19
 
20
+ // `ff.navSticky: false` scrolls the bar away with the page instead of pinning it. The default
21
+ // theme only fixes it from 960px up (.VPNav, scoped, wins below that already), so this only
22
+ // has to undo that one media query. It also unconditionally offsets the bar by the banner's
23
+ // height with `top`, to clear the banner sitting fixed above it — with the banner back in flow
24
+ // too, that offset just pushes the bar down a second time, so it goes as well.
25
+
26
+ &[data-nav-sticky="false"] .VPNav {
27
+ position: relative;
28
+ top: 0;
29
+ }
30
+
31
+ // The default theme reserves the fixed bar's height above the content (and the banner's above
32
+ // that) so nothing sits underneath them. Once both are back in normal flow that reservation is
33
+ // dead space stacked on top of the room they already take — drop it.
34
+
35
+ &[data-nav-sticky="false"] .VPContent {
36
+ margin-top: 0;
37
+ }
38
+
39
+ @media (min-width: 960px) {
40
+ &[data-nav-sticky="false"] .VPContent {
41
+ padding-top: 0;
42
+ }
43
+ }
44
+
20
45
  // The default theme's markup always renders search before the menu links inside
21
46
  // .content-body, a plain flex row with no slot between the two, and pins the pair with a push
22
47
  // rather than plain order: .menu carries flex-grow so it eats the row's free space and
package/src/types.ts CHANGED
@@ -120,6 +120,11 @@ export interface ThemeOptions {
120
120
  backToTop?: boolean
121
121
  /** Order of the search box and the nav menu links in the top bar. Defaults to `search-first`. */
122
122
  navOrder?: 'search-first' | 'menu-first'
123
+ /**
124
+ * Pins the navigation bar to the top of the viewport while scrolling. Defaults to `true`; set
125
+ * to `false` to have it scroll away with the page instead.
126
+ */
127
+ navSticky?: boolean
123
128
  /** Overrides for the strings this theme adds. Declare them per locale to translate them. */
124
129
  labels?: ThemeLabels
125
130
  }