@stacksjs/bunpress 0.1.21 → 0.2.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 (54) hide show
  1. package/dist/bin/cli.d.ts +3 -0
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/{chunk-kxr6zf7e.js → chunk-2ns9va8d.js} +1315 -464
  4. package/dist/{chunk-qdmkac4z.js → chunk-av14gbps.js} +10 -11
  5. package/dist/{chunk-m0g9vk1e.js → chunk-avg4ftb9.js} +159 -194
  6. package/dist/chunk-fyb5bzsp.js +10 -0
  7. package/dist/chunk-n0ebp7d8.js +38 -0
  8. package/dist/{chunk-qrp18ybj.js → chunk-trhgd2dy.js} +1 -1
  9. package/dist/chunk-w615shtf.js +2 -0
  10. package/dist/chunk-x5m3c6jd.js +469 -0
  11. package/dist/src/build-manifest.d.ts +22 -0
  12. package/dist/src/config.d.ts +12 -0
  13. package/dist/src/data-loader.d.ts +6 -3
  14. package/dist/src/highlighter.d.ts +2 -1
  15. package/dist/src/i18n.d.ts +67 -0
  16. package/dist/src/index.d.ts +2 -0
  17. package/dist/src/index.js +1 -1
  18. package/dist/src/page-meta.d.ts +19 -0
  19. package/dist/src/search-index.d.ts +61 -0
  20. package/dist/src/serve.d.ts +20 -5
  21. package/dist/src/toc.d.ts +6 -2
  22. package/dist/src/types.d.ts +80 -8
  23. package/dist/templates/blocks/alerts/caution.stx +2 -2
  24. package/dist/templates/blocks/alerts/important.stx +2 -2
  25. package/dist/templates/blocks/alerts/note.stx +2 -2
  26. package/dist/templates/blocks/alerts/tip.stx +2 -2
  27. package/dist/templates/blocks/alerts/warning.stx +2 -2
  28. package/dist/templates/blocks/containers/danger.stx +2 -2
  29. package/dist/templates/blocks/containers/details.stx +2 -2
  30. package/dist/templates/blocks/containers/info.stx +2 -2
  31. package/dist/templates/blocks/containers/raw.stx +1 -1
  32. package/dist/templates/blocks/containers/tip.stx +2 -2
  33. package/dist/templates/blocks/containers/warning.stx +2 -2
  34. package/dist/templates/copy-page.stx +81 -0
  35. package/dist/templates/doc-footer.stx +51 -0
  36. package/dist/templates/footer.stx +45 -0
  37. package/dist/templates/hero.stx +9 -2
  38. package/dist/templates/layout-doc.stx +8 -125
  39. package/dist/templates/layout-home.stx +7 -14
  40. package/dist/templates/layout-page.stx +7 -14
  41. package/dist/templates/locale-switcher.stx +115 -0
  42. package/dist/templates/navbar.stx +49 -0
  43. package/dist/templates/page-outline.stx +149 -0
  44. package/dist/templates/page-toc.stx +1 -1
  45. package/dist/templates/search-algolia.stx +85 -0
  46. package/dist/templates/search.stx +661 -0
  47. package/dist/templates/sidebar-section.stx +44 -11
  48. package/dist/templates/sidebar.stx +11 -2
  49. package/dist/themes/vitepress/index.ts +558 -165
  50. package/package.json +16 -7
  51. package/dist/chunk-9cm3e4r4.js +0 -688
  52. package/dist/chunk-mjhqecp5.js +0 -467
  53. package/dist/chunk-wmvgjzgh.js +0 -3
  54. package/dist/chunk-zmxtnx2v.js +0 -8
@@ -11,9 +11,16 @@
11
11
  </div>
12
12
 
13
13
  <style>
14
+ /* Spacing only — clearing the fixed nav is .BPHome's job. */
14
15
  .BPHomeHero {
15
16
  position: relative;
16
- padding: 76px 24px 56px;
17
+ padding: 24px 20px 40px;
18
+ }
19
+
20
+ @media (min-width: 640px) {
21
+ .BPHomeHero {
22
+ padding: 40px 24px 56px;
23
+ }
17
24
  }
18
25
 
19
26
  .hero-container {
@@ -40,7 +47,7 @@
40
47
 
41
48
  @media (min-width: 960px) {
42
49
  .BPHomeHero {
43
- padding: 96px 64px 72px;
50
+ padding: 56px 64px 72px;
44
51
  }
45
52
 
46
53
  .hero-container {
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
2
+ <html lang="{{ lang }}" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>{{ title }}</title>
6
+ <title>{{ documentTitle }}</title>
7
7
  <meta name="description" content="{{ description }}">
8
8
  {!! meta !!}
9
9
  <style>
@@ -14,46 +14,7 @@
14
14
  <body>
15
15
  <div class="Layout">
16
16
  <!-- BPNav - Header -->
17
- <header class="BPNav">
18
- <div class="BPNavBar">
19
- <div class="BPNavBarStart">
20
- <button class="BPNavBarHamburger" 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="BPNavBarTitle">{{ title }}</a>
26
- <div class="BPNavBarSearch">
27
- <svg class="BPNavBarSearch-icon" fill="none" stroke="currentColor" viewBox="0 0 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>
29
- </svg>
30
- <input type="text" class="BPNavBarSearch-input" placeholder="Search" />
31
- <kbd class="BPNavBarSearch-kbd">⌘ K</kbd>
32
- </div>
33
- </div>
34
-
35
- <div class="BPNavBarEnd">
36
- <div class="BPNavBarMenu">
37
- {!! nav !!}
38
- </div>
39
- <div class="BPSocialLinks">
40
- <button class="theme-toggle" onclick="toggleTheme()" aria-label="Toggle dark mode" title="Toggle dark mode">
41
- <svg class="sun-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
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>
43
- </svg>
44
- <svg class="moon-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
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>
46
- </svg>
47
- </button>
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">
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"/>
51
- </svg>
52
- </a>
53
- </div>
54
- </div>
55
- </div>
56
- </header>
17
+ {!! navbar !!}
57
18
 
58
19
  <!-- BPSidebar -->
59
20
  {!! sidebar !!}
@@ -65,95 +26,17 @@
65
26
  <article class="bp-doc">
66
27
  {!! content !!}
67
28
  </article>
29
+ {!! docFooter !!}
30
+ {!! footer !!}
68
31
  </div>
69
32
  </div>
70
33
  </main>
71
34
 
72
- <!-- Copy Page Dropdown (positioned via JS next to H1) -->
73
- <div class="copy-page-dropdown" id="copy-page-dropdown">
74
- <div class="copy-page-button-group">
75
- <button class="copy-page-button copy-page-main" onclick="copyPageDirect(event)" aria-label="Copy page as markdown">
76
- <svg class="copy-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
77
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
78
- </svg>
79
- <svg class="check-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="display: none;">
80
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
81
- </svg>
82
- <span class="button-text">Copy page</span>
83
- </button>
84
- <button class="copy-page-button copy-page-toggle" onclick="toggleCopyPageDropdown(event)" aria-label="More copy options">
85
- <svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24">
86
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
87
- </svg>
88
- </button>
89
- </div>
90
- <div class="copy-page-menu">
91
- <!-- Copy page as Markdown -->
92
- <div class="copy-page-menu-item" onclick="copyPageAsMarkdown(event)">
93
- <div class="icon">
94
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
95
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
96
- </svg>
97
- </div>
98
- <div class="content">
99
- <div class="title">Copy page</div>
100
- <div class="description">Copy page as Markdown for LLMs</div>
101
- </div>
102
- </div>
103
- <!-- View as Markdown -->
104
- <div class="copy-page-menu-item" onclick="viewAsMarkdown(event)">
105
- <div class="icon">
106
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
107
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
108
- </svg>
109
- </div>
110
- <div class="content">
111
- <div class="title">View as Markdown <svg class="external-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg></div>
112
- <div class="description">View this page as plain text</div>
113
- </div>
114
- </div>
115
- <div class="copy-page-menu-divider"></div>
116
- <!-- Open in ChatGPT -->
117
- <a class="copy-page-menu-item" onclick="openInChatGPT(event)" href="#">
118
- <div class="icon">
119
- <svg viewBox="0 0 24 24" fill="currentColor">
120
- <path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.8956zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"/>
121
- </svg>
122
- </div>
123
- <div class="content">
124
- <div class="title">Open in ChatGPT <svg class="external-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg></div>
125
- <div class="description">Copy content and open ChatGPT</div>
126
- </div>
127
- </a>
128
- <!-- Open in Claude -->
129
- <a class="copy-page-menu-item" onclick="openInClaude(event)" href="#">
130
- <div class="icon">
131
- <svg viewBox="0 0 24 24" fill="currentColor">
132
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
133
- </svg>
134
- </div>
135
- <div class="content">
136
- <div class="title">Open in Claude <svg class="external-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg></div>
137
- <div class="description">Copy content and open Claude</div>
138
- </div>
139
- </a>
140
- <!-- Open in Perplexity -->
141
- <a class="copy-page-menu-item" onclick="openInPerplexity(event)" href="#">
142
- <div class="icon">
143
- <svg viewBox="0 0 24 24" fill="currentColor">
144
- <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
145
- </svg>
146
- </div>
147
- <div class="content">
148
- <div class="title">Open in Perplexity <svg class="external-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg></div>
149
- <div class="description">Search with Perplexity AI</div>
150
- </div>
151
- </a>
152
- </div>
153
- </div>
154
-
155
35
  <!-- BPDocAside - TOC -->
156
36
  {!! pageTOC !!}
157
37
  </div>
38
+
39
+ <!-- Search overlay -->
40
+ {!! search !!}
158
41
  </body>
159
42
  </html>
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
2
+ <html lang="{{ lang }}" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>{{ title }}</title>
6
+ <title>{{ documentTitle }}</title>
7
7
  <meta name="description" content="{{ description }}">
8
8
  {!! meta !!}
9
9
  <style>
@@ -14,22 +14,15 @@
14
14
  <body>
15
15
  <div class="Layout">
16
16
  <!-- BPNav - Header -->
17
- <header class="BPNav">
18
- <div class="BPNavBar">
19
- <div class="BPNavBarStart">
20
- <a href="/" class="BPNavBarTitle">{{ title }}</a>
21
- </div>
22
- <div class="BPNavBarEnd">
23
- <div class="BPNavBarMenu">
24
- {!! nav !!}
25
- </div>
26
- </div>
27
- </div>
28
- </header>
17
+ {!! navbar !!}
29
18
 
30
19
  <main class="BPHome">
31
20
  {!! content !!}
21
+ {!! footer !!}
32
22
  </main>
33
23
  </div>
24
+
25
+ <!-- Search overlay -->
26
+ {!! search !!}
34
27
  </body>
35
28
  </html>
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
2
+ <html lang="{{ lang }}" class="{{ htmlClass }}" data-theme-mode="{{ themeMode }}">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>{{ title }}</title>
6
+ <title>{{ documentTitle }}</title>
7
7
  <meta name="description" content="{{ description }}">
8
8
  {!! meta !!}
9
9
  <style>
@@ -14,18 +14,7 @@
14
14
  <body>
15
15
  <div class="Layout">
16
16
  <!-- BPNav - Header -->
17
- <header class="BPNav">
18
- <div class="BPNavBar">
19
- <div class="BPNavBarStart">
20
- <a href="/" class="BPNavBarTitle">{{ title }}</a>
21
- </div>
22
- <div class="BPNavBarEnd">
23
- <div class="BPNavBarMenu">
24
- {!! nav !!}
25
- </div>
26
- </div>
27
- </div>
28
- </header>
17
+ {!! navbar !!}
29
18
 
30
19
  <!-- BPContent - Full-width content without sidebar -->
31
20
  <main class="BPContent BPContent--page">
@@ -33,8 +22,12 @@
33
22
  <article class="bp-doc">
34
23
  {!! content !!}
35
24
  </article>
25
+ {!! footer !!}
36
26
  </div>
37
27
  </main>
38
28
  </div>
29
+
30
+ <!-- Search overlay -->
31
+ {!! search !!}
39
32
  </body>
40
33
  </html>
@@ -0,0 +1,115 @@
1
+ <div class="BPLocaleSwitcher">
2
+ <button class="BPLocaleSwitcher-button" type="button" aria-haspopup="true" aria-expanded="false" aria-label="{{ label }}">
3
+ <svg class="BPLocaleSwitcher-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
4
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12h18M12 3a15 15 0 010 18M12 3a15 15 0 000 18M3 12a9 9 0 1118 0 9 9 0 01-18 0z"></path>
5
+ </svg>
6
+ <span class="BPLocaleSwitcher-current">{{ current }}</span>
7
+ </button>
8
+ <ul class="BPLocaleSwitcher-menu">
9
+ {!! options !!}
10
+ </ul>
11
+ </div>
12
+
13
+ <style>
14
+ .BPLocaleSwitcher {
15
+ position: relative;
16
+ }
17
+
18
+ .BPLocaleSwitcher-button {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: 6px;
22
+ height: 32px;
23
+ padding: 0 8px;
24
+ font-family: inherit;
25
+ font-size: 13px;
26
+ font-weight: 500;
27
+ color: var(--bp-c-text-2);
28
+ background: transparent;
29
+ border: 1px solid transparent;
30
+ border-radius: 6px;
31
+ cursor: pointer;
32
+ transition: color 0.25s, background-color 0.25s;
33
+ }
34
+
35
+ .BPLocaleSwitcher-button:hover {
36
+ color: var(--bp-c-text-1);
37
+ background-color: var(--bp-c-bg-soft);
38
+ }
39
+
40
+ .BPLocaleSwitcher-button:focus-visible {
41
+ outline: 2px solid var(--bp-c-brand-1);
42
+ outline-offset: 2px;
43
+ }
44
+
45
+ .BPLocaleSwitcher-icon {
46
+ width: 16px;
47
+ height: 16px;
48
+ flex-shrink: 0;
49
+ }
50
+
51
+ .BPLocaleSwitcher-menu {
52
+ display: none;
53
+ position: absolute;
54
+ top: 100%;
55
+ right: 0;
56
+ margin: 6px 0 0;
57
+ padding: 6px 0;
58
+ min-width: 150px;
59
+ list-style: none;
60
+ background: var(--bp-c-bg);
61
+ border: 1px solid var(--bp-c-divider);
62
+ border-radius: 8px;
63
+ box-shadow: var(--bp-shadow-3, 0 12px 32px rgba(0, 0, 0, 0.1));
64
+ z-index: 40;
65
+ }
66
+
67
+ /* Hover opens it for pointers; :focus-within does the same for keyboards,
68
+ so the menu is reachable by Tab without any JavaScript. */
69
+ .BPLocaleSwitcher:hover .BPLocaleSwitcher-menu,
70
+ .BPLocaleSwitcher:focus-within .BPLocaleSwitcher-menu {
71
+ display: block;
72
+ }
73
+
74
+ .BPLocaleSwitcher-menu a {
75
+ display: block;
76
+ padding: 6px 14px;
77
+ font-size: 13px;
78
+ color: var(--bp-c-text-1);
79
+ text-decoration: none;
80
+ transition: color 0.25s, background-color 0.25s;
81
+ }
82
+
83
+ .BPLocaleSwitcher-menu a:hover {
84
+ color: var(--bp-c-brand-1);
85
+ background-color: var(--bp-c-bg-soft);
86
+ }
87
+
88
+ .BPLocaleSwitcher-menu a[aria-current='true'] {
89
+ color: var(--bp-c-brand-1);
90
+ font-weight: 600;
91
+ }
92
+
93
+ /* On phones the code alone is enough — the flag-sized icon plus a two-letter
94
+ code fits where a full language name would not. */
95
+ @media (max-width: 959px) {
96
+ .BPLocaleSwitcher-current {
97
+ display: none;
98
+ }
99
+
100
+ .BPLocaleSwitcher-button {
101
+ padding: 0 6px;
102
+ }
103
+ }
104
+ </style>
105
+
106
+ <script>
107
+ // A manual switch is a deliberate choice, so record it — the detection script
108
+ // must never override it on a later visit.
109
+ document.addEventListener('click', function (e) {
110
+ var link = e.target.closest('.BPLocaleSwitcher-menu a[data-locale]');
111
+ if (!link) return;
112
+ try { localStorage.setItem('bunpress-locale', link.getAttribute('data-locale')); }
113
+ catch (_) { /* storage unavailable; the navigation still happens */ }
114
+ });
115
+ </script>
@@ -0,0 +1,49 @@
1
+ <header class="BPNav">
2
+ <div class="BPNavBar">
3
+ <div class="BPNavBarStart">
4
+ {!! hamburger !!}
5
+ <a href="/" class="BPNavBarTitle">{!! logo !!}<span class="BPNavBarTitle-text">{{ title }}</span></a>
6
+ {!! searchTrigger !!}
7
+ </div>
8
+
9
+ <div class="BPNavBarEnd">
10
+ <div class="BPNavBarMenu">
11
+ {!! nav !!}
12
+ </div>
13
+ <div class="BPSocialLinks">
14
+ <button class="theme-toggle" type="button" onclick="toggleTheme()" aria-label="Toggle dark mode" title="Toggle dark mode">
15
+ <svg class="sun-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
16
+ <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>
17
+ </svg>
18
+ <svg class="moon-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
19
+ <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>
20
+ </svg>
21
+ </button>
22
+ {!! localeSwitcher !!}
23
+ {!! socialLinks !!}
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </header>
28
+
29
+ <style>
30
+ /* The brand is a logo, a wordmark, or both. */
31
+ .BPNavBarTitle {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 8px;
35
+ }
36
+
37
+ .BPNavBarTitle-logo {
38
+ height: 24px;
39
+ width: auto;
40
+ flex-shrink: 0;
41
+ }
42
+
43
+ .BPNavBarTitle-text {
44
+ min-width: 0;
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ white-space: nowrap;
48
+ }
49
+ </style>
@@ -0,0 +1,149 @@
1
+ <details class="bp-local-outline">
2
+ <summary class="bp-local-outline-summary">
3
+ <svg class="bp-local-outline-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
4
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h10"></path>
5
+ </svg>
6
+ <span class="bp-local-outline-label">{{ title }}</span>
7
+ <span class="bp-local-outline-count">{{ count }}</span>
8
+ <svg class="bp-local-outline-chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
9
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
10
+ </svg>
11
+ </summary>
12
+ <nav class="bp-local-outline-items" aria-label="{{ title }}">
13
+ {!! items !!}
14
+ </nav>
15
+ </details>
16
+
17
+ <style>
18
+ /* In-content page outline. Fills the range where the fixed .BPDocAside has no
19
+ room to render — see the 1280px rule at the bottom of this block. Built on
20
+ <details> so it collapses, is keyboard operable and survives without JS. */
21
+ .bp-local-outline {
22
+ margin: 0 0 32px;
23
+ border: 1px solid var(--bp-c-divider);
24
+ border-radius: 8px;
25
+ background-color: var(--bp-c-bg-soft);
26
+ overflow: hidden;
27
+ }
28
+
29
+ .bp-local-outline-summary {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 8px;
33
+ padding: 10px 14px;
34
+ font-size: 13px;
35
+ font-weight: 600;
36
+ color: var(--bp-c-text-1);
37
+ cursor: pointer;
38
+ user-select: none;
39
+ list-style: none;
40
+ transition: color 0.25s;
41
+ }
42
+
43
+ /* Suppress the native disclosure triangle in both engines — the chevron on
44
+ the right is the affordance. */
45
+ .bp-local-outline-summary::-webkit-details-marker {
46
+ display: none;
47
+ }
48
+
49
+ .bp-local-outline-summary::marker {
50
+ content: '';
51
+ }
52
+
53
+ .bp-local-outline-summary:hover {
54
+ color: var(--bp-c-brand-1);
55
+ }
56
+
57
+ .bp-local-outline-summary:focus-visible {
58
+ outline: 2px solid var(--bp-c-brand-1);
59
+ outline-offset: -2px;
60
+ }
61
+
62
+ .bp-local-outline-icon {
63
+ width: 16px;
64
+ height: 16px;
65
+ flex-shrink: 0;
66
+ color: var(--bp-c-text-3);
67
+ }
68
+
69
+ .bp-local-outline-label {
70
+ flex: 1;
71
+ min-width: 0;
72
+ }
73
+
74
+ .bp-local-outline-count {
75
+ font-size: 12px;
76
+ font-weight: 500;
77
+ color: var(--bp-c-text-3);
78
+ font-variant-numeric: tabular-nums;
79
+ }
80
+
81
+ .bp-local-outline-chevron {
82
+ width: 14px;
83
+ height: 14px;
84
+ flex-shrink: 0;
85
+ color: var(--bp-c-text-3);
86
+ transition: transform 0.2s ease;
87
+ }
88
+
89
+ .bp-local-outline[open] .bp-local-outline-chevron {
90
+ transform: rotate(180deg);
91
+ }
92
+
93
+ .bp-local-outline-items {
94
+ display: flex;
95
+ flex-direction: column;
96
+ padding: 4px 0 10px;
97
+ border-top: 1px solid var(--bp-c-divider);
98
+ /* A long page must not turn the outline into a wall of links. */
99
+ max-height: 60vh;
100
+ overflow-y: auto;
101
+ overscroll-behavior: contain;
102
+ }
103
+
104
+ .bp-local-outline-items a {
105
+ padding: 6px 14px 6px 16px;
106
+ font-size: 13px;
107
+ line-height: 1.5;
108
+ font-weight: 400;
109
+ color: var(--bp-c-text-2);
110
+ text-decoration: none;
111
+ border-left: 2px solid transparent;
112
+ transition: color 0.25s, background-color 0.25s;
113
+ }
114
+
115
+ .bp-local-outline-items a:hover {
116
+ color: var(--bp-c-brand-1);
117
+ background-color: var(--bp-c-default-soft, var(--bp-c-gray-soft));
118
+ }
119
+
120
+ .bp-local-outline-items a:focus-visible {
121
+ outline: 2px solid var(--bp-c-brand-1);
122
+ outline-offset: -2px;
123
+ }
124
+
125
+ /* Nesting mirrors the aside's indent scale. */
126
+ .bp-local-outline-items a.level-3 {
127
+ padding-left: 32px;
128
+ }
129
+
130
+ .bp-local-outline-items a.level-4 {
131
+ padding-left: 48px;
132
+ }
133
+
134
+ .bp-local-outline-items a.level-5 {
135
+ padding-left: 64px;
136
+ }
137
+
138
+ .bp-local-outline-items a.level-6 {
139
+ padding-left: 80px;
140
+ }
141
+
142
+ /* From 1280px the fixed aside takes over, so the inline copy would be a
143
+ duplicate. Keep this breakpoint in sync with .BPDocAside in page-toc.stx. */
144
+ @media (min-width: 1280px) {
145
+ .bp-local-outline {
146
+ display: none;
147
+ }
148
+ }
149
+ </style>
@@ -1,6 +1,6 @@
1
1
  <aside class="BPDocAside">
2
2
  <div class="BPDocAsideOutline">
3
- <p class="outline-title">On this page</p>
3
+ <p class="outline-title">{{ title }}</p>
4
4
  <nav class="page-toc">
5
5
  <div class="outline-marker"></div>
6
6
  {!! items !!}