@stacksjs/bunpress 0.1.4 → 0.1.5

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.
@@ -1,10 +1,65 @@
1
- <div class="VPHomeHero" style="position: relative; padding: 32px 24px 0;">
2
- <div style="max-width: 1152px; margin: 0 auto; padding: 48px 0 64px;">
3
- <div class="VPHomeHeroInfo" style="max-width: 592px;">
1
+ <div class="VPHomeHero">
2
+ <div class="hero-container">
3
+ <div class="hero-content">
4
4
  {!! name !!}
5
5
  {!! text !!}
6
6
  {!! tagline !!}
7
7
  {!! actions !!}
8
8
  </div>
9
+ {!! image !!}
9
10
  </div>
10
11
  </div>
12
+
13
+ <style>
14
+ .VPHomeHero {
15
+ position: relative;
16
+ padding: 64px 24px 48px;
17
+ }
18
+
19
+ .hero-container {
20
+ max-width: 1152px;
21
+ margin: 0 auto;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ text-align: center;
26
+ }
27
+
28
+ .hero-content {
29
+ max-width: 640px;
30
+ }
31
+
32
+ .hero-image {
33
+ margin-top: 32px;
34
+ }
35
+
36
+ .hero-image img {
37
+ max-width: 200px;
38
+ height: auto;
39
+ }
40
+
41
+ @media (min-width: 960px) {
42
+ .VPHomeHero {
43
+ padding: 80px 64px 56px;
44
+ }
45
+
46
+ .hero-container {
47
+ flex-direction: row;
48
+ text-align: left;
49
+ gap: 64px;
50
+ }
51
+
52
+ .hero-content {
53
+ flex: 1;
54
+ }
55
+
56
+ .hero-image {
57
+ margin-top: 0;
58
+ flex-shrink: 0;
59
+ }
60
+
61
+ .hero-image img {
62
+ max-width: 280px;
63
+ }
64
+ }
65
+ </style>
@@ -14,25 +14,29 @@
14
14
  <body>
15
15
  <div class="Layout">
16
16
  <!-- VPNav - Header -->
17
- <header class="VPNav" style="position: fixed; top: 0; left: 0; right: 0; height: var(--bp-nav-height, 64px); background-color: var(--bp-nav-bg-color, var(--bp-c-bg)); border-bottom: 1px solid var(--bp-c-divider); z-index: var(--bp-z-index-nav, 30);">
18
- <div style="max-width: var(--bp-layout-max-width, 1440px); margin: 0 auto; width: 100%; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 24px;">
19
- <!-- Left side: Logo/Title + Search -->
20
- <div style="display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0;">
21
- <a href="/" class="VPNavBarTitle" style="font-size: 16px; font-weight: 600; color: var(--bp-c-text-1); white-space: nowrap; text-decoration: none;">{{ title }}</a>
22
- <div class="VPNavBarSearch" style="position: relative; display: flex; align-items: center; max-width: 260px; width: 100%;">
23
- <svg style="position: absolute; left: 12px; width: 16px; height: 16px; color: var(--bp-c-text-3);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
17
+ <header class="VPNav">
18
+ <div class="VPNavBar">
19
+ <div class="VPNavBarStart">
20
+ <button class="VPNavBarHamburger" type="button" aria-label="Toggle navigation" onclick="toggleSidebar()">
21
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
22
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
23
+ </svg>
24
+ </button>
25
+ <a href="/" class="VPNavBarTitle">{{ title }}</a>
26
+ <div class="VPNavBarSearch">
27
+ <svg class="VPNavBarSearch-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
24
28
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
25
29
  </svg>
26
- <input type="text" placeholder="Search" style="width: 100%; height: 32px; padding-left: 36px; padding-right: 48px; font-size: 13px; background-color: var(--bp-c-bg-alt); border: 1px solid var(--bp-c-divider); border-radius: 4px; color: var(--bp-c-text-1); outline: none; transition: border-color 0.25s, background-color 0.25s;" />
27
- <kbd style="position: absolute; right: 8px; padding: 2px 6px; font-size: 11px; font-weight: 600; color: var(--bp-c-text-3); background-color: var(--bp-c-bg); border: 1px solid var(--bp-c-divider); border-radius: 4px;">⌘ K</kbd>
30
+ <input type="text" class="VPNavBarSearch-input" placeholder="Search" />
31
+ <kbd class="VPNavBarSearch-kbd">⌘ K</kbd>
28
32
  </div>
29
33
  </div>
30
34
 
31
- <!-- Right side: Navigation + Icons -->
32
- <div style="display: flex; align-items: center; gap: 24px;">
33
- {!! nav !!}
34
- <div class="VPSocialLinks" style="display: flex; align-items: center; gap: 12px; padding-left: 24px; border-left: 1px solid var(--bp-c-divider);">
35
- <!-- Theme Toggle -->
35
+ <div class="VPNavBarEnd">
36
+ <div class="VPNavBarMenu">
37
+ {!! nav !!}
38
+ </div>
39
+ <div class="VPSocialLinks">
36
40
  <button class="theme-toggle" onclick="toggleTheme()" aria-label="Toggle dark mode" title="Toggle dark mode">
37
41
  <svg class="sun-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
38
42
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path>
@@ -41,8 +45,8 @@
41
45
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path>
42
46
  </svg>
43
47
  </button>
44
- <a href="https://github.com/stacksjs/bunpress" target="_blank" style="color: var(--bp-c-text-2); transition: color 0.25s;" onmouseover="this.style.color='var(--bp-c-text-1)'" onmouseout="this.style.color='var(--bp-c-text-2)'">
45
- <svg style="width: 20px; height: 20px;" fill="currentColor" viewBox="0 0 24 24">
48
+ <a href="https://github.com/stacksjs/bunpress" target="_blank" rel="noopener external" aria-label="GitHub">
49
+ <svg fill="currentColor" viewBox="0 0 24 24">
46
50
  <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
47
51
  </svg>
48
52
  </a>
@@ -55,9 +59,9 @@
55
59
  {!! sidebar !!}
56
60
 
57
61
  <!-- VPContent - Main content area -->
58
- <main class="VPContent" style="position: fixed; top: var(--bp-nav-height, 64px); bottom: 0; overflow-y: auto; left: max(var(--bp-sidebar-width, 272px), calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + var(--bp-sidebar-width, 272px))); right: max(0px, calc((100vw - var(--bp-layout-max-width, 1440px)) / 2));">
59
- <div class="VPDoc" style="padding: 32px 24px; padding-right: 32px;">
60
- <div class="VPDocContent" style="max-width: 768px; margin: 0;">
62
+ <main class="VPContent VPContent--doc">
63
+ <div class="VPDoc">
64
+ <div class="VPDocContent">
61
65
  <article class="bp-doc">
62
66
  {!! content !!}
63
67
  </article>
@@ -151,7 +155,5 @@
151
155
  <!-- VPDocAside - TOC -->
152
156
  {!! pageTOC !!}
153
157
  </div>
154
-
155
- {!! scripts !!}
156
158
  </body>
157
159
  </html>
@@ -17,7 +17,5 @@
17
17
  {!! content !!}
18
18
  </main>
19
19
  </div>
20
-
21
- {!! scripts !!}
22
20
  </body>
23
21
  </html>
@@ -14,27 +14,27 @@
14
14
  <body>
15
15
  <div class="Layout">
16
16
  <!-- VPNav - Header -->
17
- <header class="VPNav" style="position: fixed; top: 0; left: 0; right: 0; height: var(--bp-nav-height, 64px); background-color: var(--bp-nav-bg-color, var(--bp-c-bg)); border-bottom: 1px solid var(--bp-c-divider); z-index: var(--bp-z-index-nav, 30);">
18
- <div style="max-width: var(--bp-layout-max-width, 1440px); margin: 0 auto; width: 100%; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 24px;">
19
- <div style="display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0;">
20
- <a href="/" class="VPNavBarTitle" style="font-size: 16px; font-weight: 600; color: var(--bp-c-text-1); white-space: nowrap; text-decoration: none;">{{ title }}</a>
17
+ <header class="VPNav">
18
+ <div class="VPNavBar">
19
+ <div class="VPNavBarStart">
20
+ <a href="/" class="VPNavBarTitle">{{ title }}</a>
21
21
  </div>
22
- <div style="display: flex; align-items: center; gap: 24px;">
23
- {!! nav !!}
22
+ <div class="VPNavBarEnd">
23
+ <div class="VPNavBarMenu">
24
+ {!! nav !!}
25
+ </div>
24
26
  </div>
25
27
  </div>
26
28
  </header>
27
29
 
28
30
  <!-- VPContent - Full-width content without sidebar -->
29
- <main class="VPContent" style="padding-top: var(--bp-nav-height, 64px);">
30
- <div class="VPPage" style="padding: 48px 24px; max-width: 768px; margin: 0 auto;">
31
+ <main class="VPContent VPContent--page">
32
+ <div class="VPPage">
31
33
  <article class="bp-doc">
32
34
  {!! content !!}
33
35
  </article>
34
36
  </div>
35
37
  </main>
36
38
  </div>
37
-
38
- {!! scripts !!}
39
39
  </body>
40
40
  </html>
@@ -234,6 +234,11 @@ function initPageTOC() {
234
234
  });
235
235
 
236
236
  // Listen to scroll events on the actual scrolling container
237
+ // Remove any prior listener first so SPA navigation doesn't stack duplicates
238
+ if (scrollContainer.__bpTocScroll) {
239
+ scrollContainer.removeEventListener('scroll', scrollContainer.__bpTocScroll);
240
+ }
241
+ scrollContainer.__bpTocScroll = onScroll;
237
242
  scrollContainer.addEventListener('scroll', onScroll);
238
243
 
239
244
  // Handle URL hash on page load
@@ -1,27 +1,60 @@
1
- <div class="VPSidebarItem sidebar-section" style="margin-bottom: 16px;">
2
- <button
3
- style="width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 8px 24px; font-size: 14px; font-weight: 600; color: var(--bp-c-text-1); background: transparent; border: none; cursor: pointer; transition: color 0.25s;"
4
- onclick="toggleSection(this.parentElement)"
5
- onmouseover="this.style.color='var(--bp-c-brand-1)'"
6
- onmouseout="this.style.color='var(--bp-c-text-1)'"
7
- >
1
+ <div class="VPSidebarItem sidebar-section">
2
+ <button class="sidebar-section-toggle" onclick="toggleSection(this.parentElement)" type="button">
8
3
  <span>{{ title }}</span>
9
- <svg class="chevron" style="width: 16px; height: 16px; transition: transform 0.2s ease-in-out;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
4
+ <svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24">
10
5
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
11
6
  </svg>
12
7
  </button>
13
8
  <div class="sidebar-items-wrapper">
14
- <ul class="sidebar-items" style="list-style: none; margin: 4px 0 0 0; padding: 0;">
9
+ <ul class="sidebar-items">
15
10
  {!! items !!}
16
11
  </ul>
17
12
  </div>
18
13
  </div>
19
14
 
20
15
  <style>
16
+ .sidebar-section {
17
+ margin-bottom: 16px;
18
+ }
19
+
20
+ .sidebar-section-toggle {
21
+ width: 100%;
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: space-between;
25
+ padding: 8px 24px;
26
+ font-size: 14px;
27
+ font-weight: 600;
28
+ color: var(--bp-c-text-1);
29
+ background: transparent;
30
+ border: none;
31
+ cursor: pointer;
32
+ transition: color 0.25s;
33
+ font-family: inherit;
34
+ text-align: left;
35
+ }
36
+
37
+ .sidebar-section-toggle:hover {
38
+ color: var(--bp-c-brand-1);
39
+ }
40
+
41
+ .sidebar-section-toggle .chevron {
42
+ width: 16px;
43
+ height: 16px;
44
+ transition: transform 0.2s ease-in-out;
45
+ flex-shrink: 0;
46
+ }
47
+
48
+ .sidebar-items {
49
+ list-style: none;
50
+ margin: 4px 0 0 0;
51
+ padding: 0;
52
+ }
53
+
21
54
  .sidebar-items-wrapper {
22
55
  overflow: hidden;
23
56
  transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
24
- max-height: 500px;
57
+ max-height: 1000px;
25
58
  opacity: 1;
26
59
  }
27
60
 
@@ -30,9 +63,32 @@
30
63
  opacity: 0;
31
64
  }
32
65
 
33
- .sidebar-section.collapsed .chevron {
66
+ .sidebar-section.collapsed .sidebar-section-toggle .chevron {
34
67
  transform: rotate(-90deg);
35
68
  }
69
+
70
+ .VPSidebarItem-link {
71
+ display: block;
72
+ padding: 6px 24px;
73
+ color: var(--bp-c-text-2);
74
+ text-decoration: none;
75
+ font-size: 14px;
76
+ line-height: 1.5;
77
+ transition: color 0.25s;
78
+ border-left: 2px solid transparent;
79
+ margin-left: 0;
80
+ }
81
+
82
+ .VPSidebarItem-link:hover {
83
+ color: var(--bp-c-brand-1);
84
+ }
85
+
86
+ .VPSidebarItem-link.is-active {
87
+ color: var(--bp-c-brand-1);
88
+ font-weight: 600;
89
+ border-left-color: var(--bp-c-brand-1);
90
+ padding-left: 22px;
91
+ }
36
92
  </style>
37
93
 
38
94
  <script>
@@ -1,9 +1,31 @@
1
+ <div class="VPSidebar-backdrop" onclick="toggleSidebar(false)"></div>
1
2
  <nav class="VPSidebar">
2
3
  <div class="sidebar-content">
3
4
  {!! sections !!}
4
5
  </div>
5
6
  </nav>
6
7
 
8
+ <script>
9
+ function toggleSidebar(forceState) {
10
+ var sb = document.querySelector('.VPSidebar');
11
+ var bd = document.querySelector('.VPSidebar-backdrop');
12
+ if (!sb) return;
13
+ var nextOpen = typeof forceState === 'boolean' ? forceState : !sb.classList.contains('is-open');
14
+ sb.classList.toggle('is-open', nextOpen);
15
+ if (bd) bd.classList.toggle('is-open', nextOpen);
16
+ document.body.style.overflow = nextOpen ? 'hidden' : '';
17
+ }
18
+ if (!window.__bpSidebarBound) {
19
+ window.__bpSidebarBound = true;
20
+ // Close drawer when the user clicks a sidebar link on mobile
21
+ document.addEventListener('click', function(e) {
22
+ if (window.matchMedia('(min-width: 960px)').matches) return;
23
+ var a = e.target.closest('.VPSidebar a');
24
+ if (a) toggleSidebar(false);
25
+ });
26
+ }
27
+ </script>
28
+
7
29
  <style>
8
30
  .VPSidebar {
9
31
  position: fixed;