@stacksjs/bunpress 0.1.0 → 0.1.1

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 (50) hide show
  1. package/CHANGELOG.md +296 -0
  2. package/README.md +113 -26
  3. package/dist/bin/cli.js +2 -104
  4. package/dist/chunk-16hpnayn.js +505 -0
  5. package/dist/chunk-njjmvdjd.js +8 -0
  6. package/dist/chunk-nt1zw6bf.js +9632 -0
  7. package/dist/chunk-zabbw4a8.js +2 -0
  8. package/dist/config.d.ts +3 -5
  9. package/dist/robots.d.ts +5 -0
  10. package/dist/rss.d.ts +16 -0
  11. package/dist/serve.d.ts +8 -0
  12. package/dist/sitemap.d.ts +5 -0
  13. package/dist/src/index.js +1 -1
  14. package/dist/templates/blocks/alerts/caution.stx +9 -0
  15. package/dist/templates/blocks/alerts/important.stx +9 -0
  16. package/dist/templates/blocks/alerts/note.stx +9 -0
  17. package/dist/templates/blocks/alerts/tip.stx +9 -0
  18. package/dist/templates/blocks/alerts/warning.stx +9 -0
  19. package/dist/templates/blocks/containers/danger.stx +6 -0
  20. package/dist/templates/blocks/containers/details.stx +6 -0
  21. package/dist/templates/blocks/containers/info.stx +6 -0
  22. package/dist/templates/blocks/containers/raw.stx +3 -0
  23. package/dist/templates/blocks/containers/tip.stx +6 -0
  24. package/dist/templates/blocks/containers/warning.stx +6 -0
  25. package/dist/templates/blocks/inline/code.stx +1 -0
  26. package/dist/templates/blocks/inline/del.stx +1 -0
  27. package/dist/templates/blocks/inline/em.stx +1 -0
  28. package/dist/templates/blocks/inline/mark.stx +1 -0
  29. package/dist/templates/blocks/inline/strong.stx +1 -0
  30. package/dist/templates/blocks/inline/sub.stx +1 -0
  31. package/dist/templates/blocks/inline/sup.stx +1 -0
  32. package/dist/templates/features.stx +20 -0
  33. package/dist/templates/hero.stx +10 -0
  34. package/dist/templates/layout-doc.stx +157 -0
  35. package/dist/templates/layout-home.stx +23 -0
  36. package/dist/templates/page-toc.stx +267 -0
  37. package/dist/templates/sidebar-section.stx +42 -0
  38. package/dist/templates/sidebar.stx +54 -0
  39. package/dist/themes/bun/index.d.ts +34 -0
  40. package/dist/themes/index.d.ts +24 -0
  41. package/dist/themes/vitepress/base.css +549 -0
  42. package/dist/themes/vitepress/code-group.css +121 -0
  43. package/dist/themes/vitepress/custom-block.css +330 -0
  44. package/dist/themes/vitepress/index.d.ts +29 -0
  45. package/dist/themes/vitepress/index.ts +1963 -0
  46. package/dist/themes/vitepress/vars.css +436 -0
  47. package/dist/types.d.ts +85 -2
  48. package/package.json +30 -18
  49. package/dist/chunk-he6c5f4e.js +0 -1354
  50. package/dist/plugin.d.ts +0 -0
@@ -0,0 +1,267 @@
1
+ <aside class="VPDocAside">
2
+ <div class="VPDocAsideOutline">
3
+ <p class="outline-title">On this page</p>
4
+ <nav class="page-toc">
5
+ <div class="outline-marker"></div>
6
+ {{ items }}
7
+ </nav>
8
+ </div>
9
+ </aside>
10
+
11
+ <style>
12
+ .VPDocAside {
13
+ position: fixed;
14
+ top: var(--bp-nav-height, 64px);
15
+ bottom: 0;
16
+ width: 224px;
17
+ overflow-y: auto;
18
+ overflow-x: hidden;
19
+ padding: 32px 16px 32px 16px;
20
+ display: none;
21
+ right: max(32px, calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + 32px));
22
+ background-color: var(--bp-c-bg);
23
+ scrollbar-width: none;
24
+ }
25
+
26
+ .VPDocAside::-webkit-scrollbar {
27
+ display: none;
28
+ }
29
+
30
+ .VPDocAsideOutline {
31
+ font-size: 14px;
32
+ }
33
+
34
+ .outline-title {
35
+ font-weight: 600;
36
+ color: var(--bp-c-text-1);
37
+ margin-bottom: 16px;
38
+ font-size: 13px;
39
+ letter-spacing: 0.4px;
40
+ text-transform: uppercase;
41
+ }
42
+
43
+ /* Show aside on xl screens and adjust main content */
44
+ @media (min-width: 1280px) {
45
+ .VPDocAside {
46
+ display: block !important;
47
+ }
48
+
49
+ .VPContent {
50
+ right: max(256px, calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + 256px)) !important;
51
+ }
52
+ }
53
+
54
+ .page-toc {
55
+ position: relative;
56
+ }
57
+
58
+ /* Animated marker indicator like VitePress */
59
+ .outline-marker {
60
+ position: absolute;
61
+ top: 0;
62
+ left: 0;
63
+ z-index: 0;
64
+ opacity: 0;
65
+ width: 2px;
66
+ border-radius: 2px;
67
+ height: 18px;
68
+ background-color: var(--bp-c-brand-1);
69
+ transition:
70
+ top 0.25s cubic-bezier(0, 1, 0.5, 1),
71
+ opacity 0.25s,
72
+ background-color 0.5s;
73
+ }
74
+
75
+ .page-toc a {
76
+ position: relative;
77
+ display: block;
78
+ padding: 4px 0 4px 16px;
79
+ color: var(--bp-c-text-2);
80
+ text-decoration: none;
81
+ border-left: 1px solid var(--bp-c-divider);
82
+ transition: color 0.25s;
83
+ font-size: 13px;
84
+ line-height: 20px;
85
+ }
86
+
87
+ .page-toc a:hover {
88
+ color: var(--bp-c-text-1);
89
+ }
90
+
91
+ .page-toc a.active {
92
+ color: var(--bp-c-text-1);
93
+ font-weight: 500;
94
+ border-left-color: transparent;
95
+ }
96
+
97
+ .page-toc a.level-3 {
98
+ padding-left: 28px;
99
+ }
100
+
101
+ .page-toc a.level-4 {
102
+ padding-left: 40px;
103
+ }
104
+
105
+ .page-toc a.level-5 {
106
+ padding-left: 52px;
107
+ }
108
+
109
+ .page-toc a.level-6 {
110
+ padding-left: 64px;
111
+ }
112
+ </style>
113
+
114
+ <script>
115
+ // VitePress-style scrollspy with animated marker
116
+ function initPageTOC() {
117
+ const tocContainer = document.querySelector('.page-toc');
118
+ const marker = document.querySelector('.outline-marker');
119
+ const tocLinks = document.querySelectorAll('.page-toc a');
120
+ const headings = Array.from(document.querySelectorAll('h2[id], h3[id], h4[id], h5[id], h6[id]'));
121
+ const scrollContainer = document.querySelector('.VPContent');
122
+
123
+ if (!tocLinks.length || !headings.length || !scrollContainer || !marker) return;
124
+
125
+ // Get scroll offset (nav height)
126
+ function getScrollOffset() {
127
+ return 100; // Account for nav + some padding
128
+ }
129
+
130
+ // Throttle and debounce utility
131
+ function throttleAndDebounce(fn, delay) {
132
+ let timeoutId;
133
+ let called = false;
134
+
135
+ return function() {
136
+ if (timeoutId) clearTimeout(timeoutId);
137
+ if (!called) {
138
+ fn();
139
+ called = true;
140
+ setTimeout(() => { called = false; }, delay);
141
+ } else {
142
+ timeoutId = setTimeout(fn, delay);
143
+ }
144
+ };
145
+ }
146
+
147
+ // Activate a TOC link by hash
148
+ function activateLink(hash) {
149
+ // Remove previous active class
150
+ tocLinks.forEach(link => link.classList.remove('active'));
151
+
152
+ if (hash) {
153
+ // Find and activate new link
154
+ const activeLink = tocContainer.querySelector('a[href="' + decodeURIComponent(hash) + '"]');
155
+
156
+ if (activeLink) {
157
+ activeLink.classList.add('active');
158
+
159
+ // Position the marker at the active link
160
+ const linkRect = activeLink.getBoundingClientRect();
161
+ const containerRect = tocContainer.getBoundingClientRect();
162
+ const top = linkRect.top - containerRect.top;
163
+
164
+ marker.style.top = top + 'px';
165
+ marker.style.opacity = '1';
166
+ } else {
167
+ marker.style.opacity = '0';
168
+ }
169
+ } else {
170
+ marker.style.opacity = '0';
171
+ }
172
+ }
173
+
174
+ // Set active link based on scroll position
175
+ function setActiveLink() {
176
+ const scrollY = scrollContainer.scrollTop;
177
+ const scrollOffset = getScrollOffset();
178
+
179
+ // Get heading positions relative to scroll container
180
+ const headingPositions = headings.map(heading => {
181
+ // Get the element's position relative to the scroll container
182
+ const rect = heading.getBoundingClientRect();
183
+ const containerRect = scrollContainer.getBoundingClientRect();
184
+ const top = rect.top - containerRect.top + scrollY;
185
+
186
+ return {
187
+ id: heading.id,
188
+ top: top
189
+ };
190
+ }).filter(h => !isNaN(h.top)).sort((a, b) => a.top - b.top);
191
+
192
+ // Find the last heading that's above the current scroll position
193
+ let activeId = null;
194
+ for (const { id, top } of headingPositions) {
195
+ if (top > scrollY + scrollOffset + 4) {
196
+ break;
197
+ }
198
+ activeId = id;
199
+ }
200
+
201
+ // If no heading found and we're at the top, use the first one
202
+ if (!activeId && headingPositions.length > 0 && scrollY < headingPositions[0].top) {
203
+ activeId = headingPositions[0].id;
204
+ }
205
+
206
+ // Activate the link
207
+ activateLink(activeId ? '#' + activeId : null);
208
+ }
209
+
210
+ // Throttled scroll handler
211
+ const onScroll = throttleAndDebounce(setActiveLink, 100);
212
+
213
+ // Smooth scroll to anchor
214
+ tocLinks.forEach(link => {
215
+ link.addEventListener('click', (e) => {
216
+ e.preventDefault();
217
+ const targetId = link.getAttribute('href').substring(1);
218
+ const targetElement = document.getElementById(targetId);
219
+ if (targetElement) {
220
+ // Calculate target position
221
+ const containerRect = scrollContainer.getBoundingClientRect();
222
+ const targetRect = targetElement.getBoundingClientRect();
223
+ const scrollTo = targetRect.top - containerRect.top + scrollContainer.scrollTop - 80;
224
+
225
+ scrollContainer.scrollTo({
226
+ top: scrollTo,
227
+ behavior: 'smooth'
228
+ });
229
+
230
+ // Update URL without page reload
231
+ history.pushState(null, '', '#' + targetId);
232
+ }
233
+ });
234
+ });
235
+
236
+ // Listen to scroll events on the actual scrolling container
237
+ scrollContainer.addEventListener('scroll', onScroll);
238
+
239
+ // Handle URL hash on page load
240
+ if (window.location.hash) {
241
+ setTimeout(() => {
242
+ const targetId = window.location.hash.substring(1);
243
+ const targetElement = document.getElementById(targetId);
244
+ if (targetElement) {
245
+ const containerRect = scrollContainer.getBoundingClientRect();
246
+ const targetRect = targetElement.getBoundingClientRect();
247
+ const scrollTo = targetRect.top - containerRect.top + scrollContainer.scrollTop - 80;
248
+
249
+ scrollContainer.scrollTo({
250
+ top: scrollTo,
251
+ behavior: 'smooth'
252
+ });
253
+ }
254
+ }, 100);
255
+ }
256
+
257
+ // Initial update
258
+ requestAnimationFrame(setActiveLink);
259
+ }
260
+
261
+ // Initialize when DOM is ready
262
+ if (document.readyState === 'loading') {
263
+ document.addEventListener('DOMContentLoaded', initPageTOC);
264
+ } else {
265
+ initPageTOC();
266
+ }
267
+ </script>
@@ -0,0 +1,42 @@
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
+ >
8
+ <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">
10
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
11
+ </svg>
12
+ </button>
13
+ <div class="sidebar-items-wrapper">
14
+ <ul class="sidebar-items" style="list-style: none; margin: 4px 0 0 0; padding: 0;">
15
+ {{ items }}
16
+ </ul>
17
+ </div>
18
+ </div>
19
+
20
+ <style>
21
+ .sidebar-items-wrapper {
22
+ overflow: hidden;
23
+ transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
24
+ max-height: 500px;
25
+ opacity: 1;
26
+ }
27
+
28
+ .sidebar-section.collapsed .sidebar-items-wrapper {
29
+ max-height: 0;
30
+ opacity: 0;
31
+ }
32
+
33
+ .sidebar-section.collapsed .chevron {
34
+ transform: rotate(-90deg);
35
+ }
36
+ </style>
37
+
38
+ <script>
39
+ function toggleSection(section) {
40
+ section.classList.toggle('collapsed');
41
+ }
42
+ </script>
@@ -0,0 +1,54 @@
1
+ <nav class="VPSidebar">
2
+ <div class="sidebar-content">
3
+ {{ sections }}
4
+ </div>
5
+ </nav>
6
+
7
+ <style>
8
+ .VPSidebar {
9
+ position: fixed;
10
+ top: var(--bp-nav-height, 64px);
11
+ bottom: 0;
12
+ left: 0;
13
+ width: var(--bp-sidebar-width, 272px);
14
+ background-color: var(--bp-sidebar-bg-color, var(--bp-c-bg-alt));
15
+ border-right: 1px solid var(--bp-c-divider);
16
+ overflow-y: auto;
17
+ overflow-x: hidden;
18
+ padding: 24px 0 24px 0;
19
+ z-index: var(--bp-z-index-sidebar, 25);
20
+ }
21
+
22
+ .sidebar-content {
23
+ width: var(--bp-sidebar-width, 272px);
24
+ margin-left: auto;
25
+ }
26
+
27
+ /* At 960px+ (tablet), position sidebar normally */
28
+ @media (min-width: 960px) {
29
+ .VPSidebar {
30
+ left: 0;
31
+ width: var(--bp-sidebar-width, 272px);
32
+ }
33
+
34
+ .sidebar-content {
35
+ width: 100%;
36
+ margin-left: 0;
37
+ }
38
+ }
39
+
40
+ /* At 1440px+ (ultra-wide), extend sidebar to fill left margin */
41
+ @media (min-width: 1440px) {
42
+ .VPSidebar {
43
+ /* Extend width to include left margin area */
44
+ width: calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + var(--bp-sidebar-width, 272px));
45
+ /* Padding pushes content to the right position */
46
+ padding-left: calc((100vw - var(--bp-layout-max-width, 1440px)) / 2);
47
+ }
48
+
49
+ .sidebar-content {
50
+ width: var(--bp-sidebar-width, 272px);
51
+ margin-left: 0;
52
+ }
53
+ }
54
+ </style>
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Get all Bun theme CSS combined
3
+ */
4
+ export declare function getBunThemeCSS(): string;
5
+ /**
6
+ * Get Bun theme CSS variables only
7
+ */
8
+ export declare function getBunVars(): string;
9
+ /**
10
+ * Get Bun base styles only
11
+ */
12
+ export declare function getBunBase(): string;
13
+ /**
14
+ * Get Bun custom block styles only
15
+ */
16
+ export declare function getBunCustomBlocks(): string;
17
+ /**
18
+ * Get Bun code group styles only
19
+ */
20
+ export declare function getBunCodeGroups(): string;
21
+ /**
22
+ * Get Bun extra styles only
23
+ */
24
+ export declare function getBunExtras(): string;
25
+ export declare interface BunTheme {
26
+ name: string
27
+ getCSS: () => string
28
+ getVars: () => string
29
+ getBase: () => string
30
+ getCustomBlocks: () => string
31
+ getCodeGroups: () => string
32
+ getExtras: () => string
33
+ }
34
+ export default bunTheme;
@@ -0,0 +1,24 @@
1
+ import bunTheme, { getBunThemeCSS } from './bun';
2
+ import vitePressTheme, { getVitePressThemeCSS } from './vitepress';
3
+ /**
4
+ * Get theme CSS by name
5
+ */
6
+ export declare function getThemeCSS(themeName?: ThemeName): string;
7
+ /**
8
+ * Available themes
9
+ */
10
+ export declare const themes: {
11
+ vitepress: unknown;
12
+ bun: unknown
13
+ };
14
+ /**
15
+ * Default theme name
16
+ */
17
+ export declare const defaultTheme: ThemeName;
18
+ export declare interface Theme {
19
+ name: string
20
+ getCSS: () => string
21
+ }
22
+ export type ThemeName = 'vitepress' | 'bun'
23
+ export { getVitePressThemeCSS, vitePressTheme, getBunThemeCSS, bunTheme };
24
+ export default themes;