boltdocs 1.10.2 → 1.11.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 (225) hide show
  1. package/package.json +29 -7
  2. package/src/client/app/config-context.tsx +18 -0
  3. package/src/client/app/docs-layout.tsx +14 -0
  4. package/src/client/app/index.tsx +132 -260
  5. package/src/client/app/mdx-component.tsx +52 -0
  6. package/src/client/app/mdx-components-context.tsx +23 -0
  7. package/src/client/app/mdx-page.tsx +20 -0
  8. package/src/client/app/preload.tsx +38 -30
  9. package/src/client/app/router.tsx +30 -0
  10. package/src/client/app/scroll-handler.tsx +40 -0
  11. package/src/client/app/theme-context.tsx +75 -0
  12. package/src/client/components/default-layout.tsx +80 -0
  13. package/src/client/components/docs-layout.tsx +105 -0
  14. package/src/client/components/icons-dev.tsx +74 -0
  15. package/src/client/components/mdx/admonition.tsx +107 -0
  16. package/src/client/components/mdx/badge.tsx +41 -0
  17. package/src/client/components/mdx/button.tsx +35 -0
  18. package/src/client/components/mdx/card.tsx +124 -0
  19. package/src/client/components/mdx/code-block.tsx +119 -0
  20. package/src/client/components/mdx/component-preview.tsx +47 -0
  21. package/src/client/components/mdx/component-props.tsx +83 -0
  22. package/src/client/components/mdx/field.tsx +66 -0
  23. package/src/client/components/mdx/file-tree.tsx +287 -0
  24. package/src/client/components/mdx/hooks/use-code-block.ts +56 -0
  25. package/src/client/components/mdx/hooks/use-component-preview.ts +16 -0
  26. package/src/client/components/mdx/hooks/useTable.ts +74 -0
  27. package/src/client/components/mdx/hooks/useTabs.ts +68 -0
  28. package/src/client/components/mdx/image.tsx +23 -0
  29. package/src/client/components/mdx/index.ts +53 -0
  30. package/src/client/components/mdx/link.tsx +38 -0
  31. package/src/client/components/mdx/list.tsx +192 -0
  32. package/src/client/components/mdx/table.tsx +156 -0
  33. package/src/client/components/mdx/tabs.tsx +135 -0
  34. package/src/client/components/mdx/video.tsx +68 -0
  35. package/src/client/components/primitives/breadcrumbs.tsx +79 -0
  36. package/src/client/components/primitives/button-group.tsx +54 -0
  37. package/src/client/components/primitives/button.tsx +145 -0
  38. package/src/client/components/primitives/helpers/observer.ts +120 -0
  39. package/src/client/components/primitives/index.ts +17 -0
  40. package/src/client/components/primitives/link.tsx +122 -0
  41. package/src/client/components/primitives/menu.tsx +159 -0
  42. package/src/client/components/primitives/navbar.tsx +359 -0
  43. package/src/client/components/primitives/navigation-menu.tsx +116 -0
  44. package/src/client/components/primitives/on-this-page.tsx +461 -0
  45. package/src/client/components/primitives/page-nav.tsx +87 -0
  46. package/src/client/components/primitives/popover.tsx +47 -0
  47. package/src/client/components/primitives/search-dialog.tsx +183 -0
  48. package/src/client/components/primitives/sidebar.tsx +154 -0
  49. package/src/client/components/primitives/tabs.tsx +90 -0
  50. package/src/client/components/primitives/tooltip.tsx +83 -0
  51. package/src/client/components/primitives/types.ts +11 -0
  52. package/src/client/components/ui-base/breadcrumbs.tsx +42 -0
  53. package/src/client/components/ui-base/copy-markdown.tsx +112 -0
  54. package/src/client/components/ui-base/error-boundary.tsx +52 -0
  55. package/src/client/components/ui-base/github-stars.tsx +27 -0
  56. package/src/client/components/ui-base/head.tsx +69 -0
  57. package/src/client/components/ui-base/loading.tsx +87 -0
  58. package/src/client/components/ui-base/navbar.tsx +138 -0
  59. package/src/client/components/ui-base/not-found.tsx +24 -0
  60. package/src/client/components/ui-base/on-this-page.tsx +152 -0
  61. package/src/client/components/ui-base/page-nav.tsx +39 -0
  62. package/src/client/components/ui-base/powered-by.tsx +19 -0
  63. package/src/client/components/ui-base/progress-bar.tsx +67 -0
  64. package/src/client/components/ui-base/search-dialog.tsx +82 -0
  65. package/src/client/components/ui-base/sidebar.tsx +104 -0
  66. package/src/client/components/ui-base/tabs.tsx +65 -0
  67. package/src/client/components/ui-base/theme-toggle.tsx +32 -0
  68. package/src/client/hooks/index.ts +12 -0
  69. package/src/client/hooks/use-breadcrumbs.ts +22 -0
  70. package/src/client/hooks/use-i18n.ts +84 -0
  71. package/src/client/hooks/use-localized-to.ts +95 -0
  72. package/src/client/hooks/use-location.ts +5 -0
  73. package/src/client/hooks/use-navbar.ts +60 -0
  74. package/src/client/hooks/use-onthispage.ts +23 -0
  75. package/src/client/hooks/use-page-nav.ts +22 -0
  76. package/src/client/hooks/use-routes.ts +72 -0
  77. package/src/client/hooks/use-search.ts +71 -0
  78. package/src/client/hooks/use-sidebar.ts +49 -0
  79. package/src/client/hooks/use-tabs.ts +43 -0
  80. package/src/client/hooks/use-version.ts +78 -0
  81. package/src/client/index.ts +55 -17
  82. package/src/client/integrations/codesandbox.ts +179 -0
  83. package/src/client/ssr.tsx +27 -16
  84. package/src/client/theme/neutral.css +360 -0
  85. package/src/client/types.ts +131 -27
  86. package/src/client/utils/cn.ts +6 -0
  87. package/src/client/utils/copy-clipboard.ts +22 -0
  88. package/src/client/utils/get-base-file-path.ts +21 -0
  89. package/src/client/utils/github.ts +121 -0
  90. package/src/client/utils/use-on-change.ts +15 -0
  91. package/src/client/virtual.d.ts +24 -0
  92. package/src/node/cache.ts +156 -156
  93. package/src/node/config.ts +159 -103
  94. package/src/node/index.ts +13 -13
  95. package/src/node/mdx.ts +213 -61
  96. package/src/node/plugin/entry.ts +29 -18
  97. package/src/node/plugin/html.ts +11 -11
  98. package/src/node/plugin/index.ts +161 -83
  99. package/src/node/plugin/types.ts +2 -4
  100. package/src/node/routes/cache.ts +6 -6
  101. package/src/node/routes/index.ts +206 -113
  102. package/src/node/routes/parser.ts +106 -81
  103. package/src/node/routes/sorter.ts +15 -15
  104. package/src/node/routes/types.ts +24 -24
  105. package/src/node/ssg/index.ts +46 -46
  106. package/src/node/ssg/meta.ts +4 -4
  107. package/src/node/ssg/options.ts +5 -5
  108. package/src/node/ssg/sitemap.ts +14 -14
  109. package/src/node/utils.ts +31 -31
  110. package/tsconfig.json +25 -20
  111. package/tsup.config.ts +23 -14
  112. package/dist/PackageManagerTabs-NVT7G625.mjs +0 -99
  113. package/dist/SearchDialog-AGVF6JBO.mjs +0 -194
  114. package/dist/SearchDialog-YPDOM7Q6.css +0 -2847
  115. package/dist/Video-KNTY5BNO.mjs +0 -6
  116. package/dist/cache-KNL5B4EE.mjs +0 -12
  117. package/dist/chunk-7SFUJWTB.mjs +0 -211
  118. package/dist/chunk-FFBNU6IJ.mjs +0 -386
  119. package/dist/chunk-FMTOYQLO.mjs +0 -37
  120. package/dist/chunk-TKLQWU7H.mjs +0 -1920
  121. package/dist/chunk-Z7JHYNAS.mjs +0 -57
  122. package/dist/client/index.css +0 -2847
  123. package/dist/client/index.d.mts +0 -372
  124. package/dist/client/index.d.ts +0 -372
  125. package/dist/client/index.js +0 -3630
  126. package/dist/client/index.mjs +0 -697
  127. package/dist/client/ssr.css +0 -2847
  128. package/dist/client/ssr.d.mts +0 -27
  129. package/dist/client/ssr.d.ts +0 -27
  130. package/dist/client/ssr.js +0 -2928
  131. package/dist/client/ssr.mjs +0 -33
  132. package/dist/config-BsFQ-ErD.d.mts +0 -159
  133. package/dist/config-BsFQ-ErD.d.ts +0 -159
  134. package/dist/node/index.d.mts +0 -91
  135. package/dist/node/index.d.ts +0 -91
  136. package/dist/node/index.js +0 -1187
  137. package/dist/node/index.mjs +0 -762
  138. package/dist/types-Dj-bfnC3.d.mts +0 -74
  139. package/dist/types-Dj-bfnC3.d.ts +0 -74
  140. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +0 -61
  141. package/src/client/theme/components/CodeBlock/index.ts +0 -1
  142. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +0 -131
  143. package/src/client/theme/components/PackageManagerTabs/index.ts +0 -1
  144. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +0 -64
  145. package/src/client/theme/components/Playground/Playground.tsx +0 -180
  146. package/src/client/theme/components/Playground/index.ts +0 -1
  147. package/src/client/theme/components/Playground/playground.css +0 -238
  148. package/src/client/theme/components/Video/Video.tsx +0 -84
  149. package/src/client/theme/components/Video/index.ts +0 -1
  150. package/src/client/theme/components/Video/video.css +0 -41
  151. package/src/client/theme/components/mdx/Admonition.tsx +0 -80
  152. package/src/client/theme/components/mdx/Badge.tsx +0 -31
  153. package/src/client/theme/components/mdx/Button.tsx +0 -50
  154. package/src/client/theme/components/mdx/Card.tsx +0 -80
  155. package/src/client/theme/components/mdx/Field.tsx +0 -60
  156. package/src/client/theme/components/mdx/FileTree.tsx +0 -229
  157. package/src/client/theme/components/mdx/List.tsx +0 -57
  158. package/src/client/theme/components/mdx/Table.tsx +0 -151
  159. package/src/client/theme/components/mdx/Tabs.tsx +0 -123
  160. package/src/client/theme/components/mdx/index.ts +0 -27
  161. package/src/client/theme/components/mdx/mdx-components.css +0 -764
  162. package/src/client/theme/icons/bun.tsx +0 -62
  163. package/src/client/theme/icons/deno.tsx +0 -20
  164. package/src/client/theme/icons/discord.tsx +0 -12
  165. package/src/client/theme/icons/github.tsx +0 -15
  166. package/src/client/theme/icons/npm.tsx +0 -13
  167. package/src/client/theme/icons/pnpm.tsx +0 -72
  168. package/src/client/theme/icons/twitter.tsx +0 -12
  169. package/src/client/theme/styles/markdown.css +0 -394
  170. package/src/client/theme/styles/variables.css +0 -175
  171. package/src/client/theme/styles.css +0 -39
  172. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +0 -68
  173. package/src/client/theme/ui/Breadcrumbs/index.ts +0 -1
  174. package/src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx +0 -82
  175. package/src/client/theme/ui/CopyMarkdown/copy-markdown.css +0 -112
  176. package/src/client/theme/ui/CopyMarkdown/index.ts +0 -1
  177. package/src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx +0 -50
  178. package/src/client/theme/ui/ErrorBoundary/error-boundary.css +0 -55
  179. package/src/client/theme/ui/ErrorBoundary/index.ts +0 -1
  180. package/src/client/theme/ui/Footer/footer.css +0 -32
  181. package/src/client/theme/ui/Head/Head.tsx +0 -69
  182. package/src/client/theme/ui/Head/index.ts +0 -1
  183. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +0 -125
  184. package/src/client/theme/ui/LanguageSwitcher/index.ts +0 -1
  185. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +0 -98
  186. package/src/client/theme/ui/Layout/Layout.tsx +0 -203
  187. package/src/client/theme/ui/Layout/base.css +0 -106
  188. package/src/client/theme/ui/Layout/index.ts +0 -2
  189. package/src/client/theme/ui/Layout/pagination.css +0 -72
  190. package/src/client/theme/ui/Layout/responsive.css +0 -47
  191. package/src/client/theme/ui/Link/Link.tsx +0 -392
  192. package/src/client/theme/ui/Link/LinkPreview.tsx +0 -59
  193. package/src/client/theme/ui/Link/index.ts +0 -2
  194. package/src/client/theme/ui/Link/link-preview.css +0 -48
  195. package/src/client/theme/ui/Loading/Loading.tsx +0 -10
  196. package/src/client/theme/ui/Loading/index.ts +0 -1
  197. package/src/client/theme/ui/Loading/loading.css +0 -30
  198. package/src/client/theme/ui/Navbar/GithubStars.tsx +0 -27
  199. package/src/client/theme/ui/Navbar/Navbar.tsx +0 -193
  200. package/src/client/theme/ui/Navbar/Tabs.tsx +0 -99
  201. package/src/client/theme/ui/Navbar/index.ts +0 -2
  202. package/src/client/theme/ui/Navbar/navbar.css +0 -347
  203. package/src/client/theme/ui/NotFound/NotFound.tsx +0 -19
  204. package/src/client/theme/ui/NotFound/index.ts +0 -1
  205. package/src/client/theme/ui/NotFound/not-found.css +0 -64
  206. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +0 -244
  207. package/src/client/theme/ui/OnThisPage/index.ts +0 -1
  208. package/src/client/theme/ui/OnThisPage/toc.css +0 -152
  209. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +0 -18
  210. package/src/client/theme/ui/PoweredBy/index.ts +0 -1
  211. package/src/client/theme/ui/PoweredBy/powered-by.css +0 -76
  212. package/src/client/theme/ui/ProgressBar/ProgressBar.css +0 -17
  213. package/src/client/theme/ui/ProgressBar/ProgressBar.tsx +0 -51
  214. package/src/client/theme/ui/ProgressBar/index.ts +0 -1
  215. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +0 -209
  216. package/src/client/theme/ui/SearchDialog/index.ts +0 -1
  217. package/src/client/theme/ui/SearchDialog/search.css +0 -152
  218. package/src/client/theme/ui/Sidebar/Sidebar.tsx +0 -244
  219. package/src/client/theme/ui/Sidebar/index.ts +0 -1
  220. package/src/client/theme/ui/Sidebar/sidebar.css +0 -230
  221. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +0 -69
  222. package/src/client/theme/ui/ThemeToggle/index.ts +0 -1
  223. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +0 -136
  224. package/src/client/theme/ui/VersionSwitcher/index.ts +0 -1
  225. package/src/client/utils.ts +0 -49
@@ -1,238 +0,0 @@
1
- /* ═══════════════════════════════════════════════════════════
2
- PLAYGROUND (SPLIT UI)
3
- ═══════════════════════════════════════════════════════════ */
4
- .boltdocs-playground {
5
- display: flex;
6
- flex-direction: column;
7
- margin: 2rem 0;
8
- border-radius: var(--ld-radius-lg);
9
- border: 1px solid var(--ld-border-subtle);
10
- background: var(--ld-code-bg);
11
- overflow: hidden;
12
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
13
- backdrop-filter: blur(10px);
14
- }
15
-
16
- .playground-split-container {
17
- display: flex;
18
- flex-direction: column;
19
- width: 100%;
20
- }
21
-
22
- .playground-panel {
23
- display: flex;
24
- flex-direction: column;
25
- flex: 1;
26
- min-width: 0;
27
- }
28
-
29
- .playground-editor-panel {
30
- border-top: 1px solid var(--ld-border-subtle);
31
- background: var(--ld-code-bg);
32
- position: relative;
33
- }
34
-
35
- .boltdocs-playground.is-truncated .playground-editor {
36
- max-height: 250px;
37
- overflow: hidden;
38
- }
39
-
40
- .boltdocs-playground[data-readonly="true"]:not(.is-truncated) .playground-editor {
41
- max-height: 600px; /* Limit height even if not truncated manually */
42
- }
43
-
44
- .playground-expand-wrapper {
45
- position: absolute;
46
- bottom: 0;
47
- left: 0;
48
- right: 0;
49
- height: 80px;
50
- background: linear-gradient(to top, var(--ld-code-bg) 20%, transparent);
51
- display: flex;
52
- align-items: flex-end;
53
- justify-content: center;
54
- padding-bottom: 1rem;
55
- z-index: 10;
56
- }
57
-
58
- .playground-expand-btn {
59
- background-color: var(--ld-surface);
60
- border: 1px solid var(--ld-border-subtle);
61
- border-radius: 20px;
62
- color: var(--ld-text-main);
63
- padding: 0.5rem 1.25rem;
64
- font-size: 0.8125rem;
65
- font-weight: 500;
66
- cursor: pointer;
67
- transition: all 0.2s ease;
68
- backdrop-filter: blur(8px);
69
- -webkit-backdrop-filter: blur(8px);
70
- }
71
-
72
- .playground-expand-btn:hover {
73
- background-color: var(--ld-border-subtle);
74
- transform: translateY(-1px);
75
- }
76
-
77
- /* When expanded, maybe show the button at the bottom without overlay */
78
- .boltdocs-playground:not(.is-truncated) .playground-expand-wrapper {
79
- position: relative;
80
- height: auto;
81
- background: none;
82
- display: flex;
83
- justify-content: center;
84
- padding: 1rem 0;
85
- border-top: 1px solid var(--ld-border-subtle);
86
- }
87
-
88
- .playground-preview-panel {
89
- background: var(--ld-bg-mute);
90
- position: relative;
91
- }
92
-
93
- /* Header */
94
- .playground-panel-header {
95
- display: flex;
96
- align-items: center;
97
- justify-content: space-between;
98
- padding: 0.5rem 1rem;
99
- border-bottom: 1px solid var(--ld-border-subtle);
100
- background: rgba(0, 0, 0, 0.1);
101
- }
102
-
103
- .playground-panel-title {
104
- display: flex;
105
- align-items: center;
106
- gap: 0.5rem;
107
- font-size: 0.75rem;
108
- font-weight: 600;
109
- color: var(--ld-text-muted);
110
- text-transform: uppercase;
111
- letter-spacing: 0.05em;
112
- }
113
-
114
- /* Copy Button */
115
- .playground-copy-btn {
116
- background: transparent;
117
- border: none;
118
- color: var(--ld-text-muted);
119
- cursor: pointer;
120
- padding: 0.25rem;
121
- border-radius: var(--ld-radius-sm);
122
- display: flex;
123
- align-items: center;
124
- justify-content: center;
125
- transition: all 0.2s;
126
- }
127
-
128
- .playground-copy-btn:hover {
129
- background: rgba(255, 255, 255, 0.1);
130
- color: var(--ld-text-main);
131
- }
132
-
133
- /* Content Area */
134
- .playground-panel-content {
135
- flex: 1;
136
- overflow: auto;
137
- position: relative;
138
- display: flex;
139
- flex-direction: column;
140
- }
141
-
142
- /* Editor Specifics */
143
- .playground-editor {
144
- background: transparent;
145
- }
146
-
147
- .playground-editor > div {
148
- font-family: var(--ld-font-mono) !important;
149
- font-size: 0.85rem !important;
150
- line-height: 1.5 !important;
151
- min-height: 100%;
152
- }
153
-
154
- .playground-editor pre {
155
- padding: 1.5rem !important;
156
- margin: 0 !important;
157
- background: transparent !important;
158
- }
159
-
160
- .playground-editor textarea {
161
- outline: none !important;
162
- padding: 1.5rem !important;
163
- }
164
-
165
- /* Prevent editing styles if read-only */
166
- .boltdocs-playground[data-readonly="true"] .playground-editor textarea {
167
- cursor: default !important;
168
- }
169
-
170
- /* Preview Specifics */
171
- .playground-preview {
172
- padding: 2.5rem;
173
- display: flex;
174
- align-items: center;
175
- justify-content: center;
176
- background-color: #000; /* Dark background as in the image */
177
- background-image: radial-gradient(
178
- rgba(255, 255, 255, 0.05) 1.5px,
179
- transparent 1.5px
180
- );
181
- background-size: 24px 24px;
182
- color: var(--ld-text-main);
183
- min-height: 300px;
184
- }
185
-
186
- /* Error Specifics */
187
- .playground-error {
188
- margin: 0;
189
- padding: 1rem;
190
- background: #7f1d1d;
191
- color: #fca5a5;
192
- font-size: 0.8rem;
193
- font-family: var(--ld-font-mono);
194
- white-space: pre-wrap;
195
- border-top: 1px solid #991b1b;
196
- z-index: 10;
197
- }
198
-
199
- /* Loading Skeleton */
200
- .playground-skeleton {
201
- height: 350px;
202
- background: var(--ld-bg-mute);
203
- border-radius: var(--ld-radius-lg);
204
- animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
205
- margin: 2rem 0;
206
- border: 1px solid var(--ld-border-subtle);
207
- }
208
- /* Copy Button - Inner */
209
- .playground-copy-btn-inner {
210
- position: absolute;
211
- top: 1rem;
212
- right: 1.5rem;
213
- z-index: 20;
214
- display: flex;
215
- align-items: center;
216
- justify-content: center;
217
- width: 32px;
218
- height: 32px;
219
- border-radius: 6px;
220
- border: 1px solid var(--ld-border-subtle);
221
- background: var(--ld-surface);
222
- color: var(--ld-text-dim);
223
- cursor: pointer;
224
- transition: all 0.2s ease;
225
- backdrop-filter: blur(8px);
226
- -webkit-backdrop-filter: blur(8px);
227
- }
228
-
229
- .playground-copy-btn-inner:hover {
230
- background: var(--ld-border-subtle);
231
- color: var(--ld-text-main);
232
- transform: translateY(-1px);
233
- }
234
-
235
- /* Obsolete Static Code Integration - Cleaning up since we use LiveEditor now */
236
- .playground-static-code {
237
- display: none;
238
- }
@@ -1,84 +0,0 @@
1
- import React, { useRef, useState, useEffect } from "react";
2
-
3
- interface VideoProps {
4
- /** Video source URL */
5
- src?: string;
6
- /** Poster/thumbnail image URL */
7
- poster?: string;
8
- /** Alt text for accessibility */
9
- alt?: string;
10
- /** Show native video controls (default: true) */
11
- controls?: boolean;
12
- /** Preload strategy (default: 'none') */
13
- preload?: string;
14
- /** Children (e.g. <source> elements) */
15
- children?: React.ReactNode;
16
- /** Allow any additional HTML video attributes */
17
- [key: string]: any;
18
- }
19
-
20
- /**
21
- * Optimized video component with lazy loading via IntersectionObserver.
22
- * The `<video>` element is only rendered once it enters the viewport,
23
- * preventing unnecessary network downloads on initial page load.
24
- *
25
- * Usage in MDX:
26
- * ```mdx
27
- * <video src="/demo.mp4" poster="/demo-thumb.jpg" />
28
- * ```
29
- */
30
- export function Video({
31
- src,
32
- poster,
33
- alt,
34
- children,
35
- controls,
36
- preload = "metadata",
37
- ...rest
38
- }: VideoProps) {
39
- const containerRef = useRef<HTMLDivElement>(null);
40
- const [isVisible, setIsVisible] = useState(false);
41
-
42
- useEffect(() => {
43
- const el = containerRef.current;
44
- if (!el) return;
45
-
46
- const observer = new IntersectionObserver(
47
- ([entry]) => {
48
- if (entry.isIntersecting) {
49
- setIsVisible(true);
50
- observer.disconnect();
51
- }
52
- },
53
- { rootMargin: "200px" },
54
- );
55
-
56
- observer.observe(el);
57
- return () => observer.disconnect();
58
- }, []);
59
-
60
- return (
61
- <div ref={containerRef} className="boltdocs-video-wrapper">
62
- {isVisible ? (
63
- <video
64
- className="boltdocs-video"
65
- src={src}
66
- poster={poster}
67
- controls={true}
68
- preload={preload}
69
- playsInline
70
- {...rest}
71
- >
72
- {children}
73
- Your browser does not support the video tag.
74
- </video>
75
- ) : (
76
- <div
77
- className="boltdocs-video-placeholder"
78
- role="img"
79
- aria-label={alt || "Video"}
80
- />
81
- )}
82
- </div>
83
- );
84
- }
@@ -1 +0,0 @@
1
- export { Video } from "./Video";
@@ -1,41 +0,0 @@
1
- /* ─── Video ──────────────────────────────────────────────── */
2
- .boltdocs-video-wrapper {
3
- margin: 1.5rem 0;
4
- max-width: 100%;
5
- width: 100%;
6
- box-sizing: border-box;
7
- border-radius: var(--ld-radius-md);
8
- overflow: hidden;
9
- border: 1px solid var(--ld-border-subtle);
10
- background-color: var(--ld-surface);
11
- }
12
-
13
- .boltdocs-video {
14
- display: block;
15
- width: 100%;
16
- max-width: 100%;
17
- height: auto;
18
- border-radius: 0;
19
- animation: ld-video-fade-in 0.4s ease-out;
20
- }
21
-
22
- .boltdocs-video-placeholder {
23
- width: 100%;
24
- aspect-ratio: 16 / 9;
25
- background-color: var(--ld-surface);
26
- }
27
-
28
- /* Ensure video doesn't overflow boltdocs-page container */
29
- .boltdocs-page video {
30
- max-width: 100%;
31
- height: auto;
32
- }
33
-
34
- @keyframes ld-video-fade-in {
35
- from {
36
- opacity: 0;
37
- }
38
- to {
39
- opacity: 1;
40
- }
41
- }
@@ -1,80 +0,0 @@
1
- import React from "react";
2
- import {
3
- Info,
4
- Lightbulb,
5
- AlertTriangle,
6
- ShieldAlert,
7
- Bookmark,
8
- } from "lucide-react";
9
-
10
- const ICON_MAP: Record<string, React.ReactNode> = {
11
- note: <Bookmark size={18} />,
12
- tip: <Lightbulb size={18} />,
13
- info: <Info size={18} />,
14
- warning: <AlertTriangle size={18} />,
15
- danger: <ShieldAlert size={18} />,
16
- };
17
-
18
- const LABEL_MAP: Record<string, string> = {
19
- note: "Note",
20
- tip: "Tip",
21
- info: "Info",
22
- warning: "Warning",
23
- danger: "Danger",
24
- };
25
-
26
- export interface AdmonitionProps extends React.HTMLAttributes<HTMLDivElement> {
27
- /** Admonition type — controls color and icon */
28
- type?: "note" | "tip" | "info" | "warning" | "danger";
29
- /** Override the default title */
30
- title?: string;
31
- children: React.ReactNode;
32
- }
33
-
34
- /**
35
- * Callout / admonition box for notes, warnings, etc.
36
- *
37
- * ```mdx
38
- * <Admonition type="warning" title="Breaking Change">
39
- * This API has changed in v2.
40
- * </Admonition>
41
- * ```
42
- */
43
- export function Admonition({
44
- type = "note",
45
- title,
46
- children,
47
- className = "",
48
- ...rest
49
- }: AdmonitionProps) {
50
- return (
51
- <div
52
- className={`ld-admonition ld-admonition--${type} ${className}`.trim()}
53
- role={type === "warning" || type === "danger" ? "alert" : "note"}
54
- {...rest}
55
- >
56
- <div className="ld-admonition__header">
57
- <span className="ld-admonition__icon">{ICON_MAP[type]}</span>
58
- <span className="ld-admonition__title">{title || LABEL_MAP[type]}</span>
59
- </div>
60
- <div className="ld-admonition__body">{children}</div>
61
- </div>
62
- );
63
- }
64
-
65
- /* ─── Convenience aliases ─────────────────────────────────── */
66
- export const Note = (props: Omit<AdmonitionProps, "type">) => (
67
- <Admonition type="note" {...props} />
68
- );
69
- export const Tip = (props: Omit<AdmonitionProps, "type">) => (
70
- <Admonition type="tip" {...props} />
71
- );
72
- export const Warning = (props: Omit<AdmonitionProps, "type">) => (
73
- <Admonition type="warning" {...props} />
74
- );
75
- export const Danger = (props: Omit<AdmonitionProps, "type">) => (
76
- <Admonition type="danger" {...props} />
77
- );
78
- export const InfoBox = (props: Omit<AdmonitionProps, "type">) => (
79
- <Admonition type="info" {...props} />
80
- );
@@ -1,31 +0,0 @@
1
- import React from "react";
2
-
3
- export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
4
- /** Color variant */
5
- variant?: "default" | "primary" | "success" | "warning" | "danger" | "info";
6
- children: React.ReactNode;
7
- }
8
-
9
- /**
10
- * Inline badge / pill for labels, statuses, or tags.
11
- *
12
- * ```mdx
13
- * <Badge variant="success">Stable</Badge>
14
- * <Badge variant="warning">Beta</Badge>
15
- * ```
16
- */
17
- export function Badge({
18
- variant = "default",
19
- children,
20
- className = "",
21
- ...rest
22
- }: BadgeProps) {
23
- return (
24
- <span
25
- className={`ld-badge ld-badge--${variant} ${className}`.trim()}
26
- {...rest}
27
- >
28
- {children}
29
- </span>
30
- );
31
- }
@@ -1,50 +0,0 @@
1
- import React from "react";
2
-
3
- export type ButtonProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &
4
- React.ButtonHTMLAttributes<HTMLButtonElement> & {
5
- /** Visual variant */
6
- variant?: "primary" | "secondary" | "outline" | "ghost";
7
- /** Size */
8
- size?: "sm" | "md" | "lg";
9
- /** If provided, renders as a link */
10
- href?: string;
11
- children: React.ReactNode;
12
- };
13
-
14
- /**
15
- * A versatile button/link component for use in MDX pages and the home page.
16
- *
17
- * ```mdx
18
- * <Button variant="primary" href="/docs/getting-started">Get Started →</Button>
19
- * <Button variant="secondary" href="https://github.com">GitHub</Button>
20
- * ```
21
- */
22
- export function Button({
23
- variant = "primary",
24
- size = "md",
25
- href,
26
- children,
27
- className = "",
28
- ...rest
29
- }: ButtonProps) {
30
- const cls = `ld-btn ld-btn--${variant} ld-btn--${size} ${className}`.trim();
31
-
32
- if (href) {
33
- return (
34
- <a
35
- href={href}
36
- style={{ textDecoration: "none" }}
37
- className={cls}
38
- {...(rest as any)}
39
- >
40
- {children}
41
- </a>
42
- );
43
- }
44
-
45
- return (
46
- <button className={cls} {...(rest as any)}>
47
- {children}
48
- </button>
49
- );
50
- }
@@ -1,80 +0,0 @@
1
- import React from "react";
2
-
3
- /* ─── Cards (grid container) ─────────────────────────────── */
4
- export interface CardsProps extends React.HTMLAttributes<HTMLDivElement> {
5
- /** Number of columns (defaults to 3) */
6
- cols?: 1 | 2 | 3 | 4;
7
- children: React.ReactNode;
8
- }
9
-
10
- /**
11
- * Grid wrapper for `<Card>` components.
12
- *
13
- * ```mdx
14
- * <Cards cols={3}>
15
- * <Card title="Fast" icon="⚡">Instant HMR.</Card>
16
- * <Card title="Simple" icon="📁">File-system routing.</Card>
17
- * </Cards>
18
- * ```
19
- */
20
- export function Cards({
21
- cols = 3,
22
- children,
23
- className = "",
24
- ...rest
25
- }: CardsProps) {
26
- return (
27
- <div className={`ld-cards ld-cards--${cols} ${className}`.trim()} {...rest}>
28
- {children}
29
- </div>
30
- );
31
- }
32
-
33
- /* ─── Card ─────────────────────────────────────────────────── */
34
- export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
35
- /** Card heading */
36
- title?: string;
37
- /** Emoji or icon string displayed above the title */
38
- icon?: React.ReactNode;
39
- /** If provided, the entire card becomes a link */
40
- href?: string;
41
- children?: React.ReactNode;
42
- }
43
-
44
- /**
45
- * Individual feature/info card.
46
- */
47
- export function Card({
48
- title,
49
- icon,
50
- href,
51
- children,
52
- className = "",
53
- ...rest
54
- }: CardProps) {
55
- const inner = (
56
- <>
57
- {icon && <span className="ld-card__icon">{icon}</span>}
58
- {title && <h3 className="ld-card__title">{title}</h3>}
59
- {children && <div className="ld-card__body">{children}</div>}
60
- </>
61
- );
62
-
63
- if (href) {
64
- return (
65
- <a
66
- href={href}
67
- className={`ld-card ld-card--link ${className}`.trim()}
68
- {...(rest as any)}
69
- >
70
- {inner}
71
- </a>
72
- );
73
- }
74
-
75
- return (
76
- <div className={`ld-card ${className}`.trim()} {...rest}>
77
- {inner}
78
- </div>
79
- );
80
- }
@@ -1,60 +0,0 @@
1
- import React from "react";
2
-
3
- export interface FieldProps {
4
- /** The name of the property or field */
5
- name: string;
6
- /** The data type of the field (e.g., "string", "number", "boolean") */
7
- type?: string;
8
- /** The default value if not provided */
9
- defaultValue?: string;
10
- /** Whether the field is required */
11
- required?: boolean;
12
- /** Description or additional content */
13
- children: React.ReactNode;
14
- /** Optional anchor ID for linking */
15
- id?: string;
16
- /** Optional extra class name */
17
- className?: string;
18
- }
19
-
20
- /**
21
- * A highly aesthetic and readable component for documenting API fields/properties.
22
- */
23
- export function Field({
24
- name,
25
- type,
26
- defaultValue,
27
- required = false,
28
- children,
29
- id,
30
- className = "",
31
- }: FieldProps) {
32
- return (
33
- <div className={`ld-field ${className}`.trim()} id={id}>
34
- <div className="ld-field__header">
35
- <div className="ld-field__signature">
36
- <code className="ld-field__name">{name}</code>
37
- {type && (
38
- <span className="ld-field__type-badge">
39
- {type}
40
- </span>
41
- )}
42
- {required && (
43
- <span className="ld-field__required-badge">required</span>
44
- )}
45
- </div>
46
-
47
- {defaultValue && (
48
- <div className="ld-field__default">
49
- <span className="ld-field__default-label">Default:</span>
50
- <code className="ld-field__default-value">{defaultValue}</code>
51
- </div>
52
- )}
53
- </div>
54
-
55
- <div className="ld-field__content">
56
- {children}
57
- </div>
58
- </div>
59
- );
60
- }