boltdocs 1.0.4 → 1.3.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 (121) hide show
  1. package/dist/{SearchDialog-R36WKAQ7.mjs → SearchDialog-5EDRACEG.mjs} +1 -1
  2. package/dist/{SearchDialog-PYF3QMYG.css → SearchDialog-X57WPTNN.css} +54 -126
  3. package/dist/cache-EHR7SXRU.mjs +12 -0
  4. package/dist/chunk-GSYECEZY.mjs +381 -0
  5. package/dist/{chunk-TWSRXUFF.mjs → chunk-NS7WHDYA.mjs} +229 -418
  6. package/dist/client/index.css +54 -126
  7. package/dist/client/index.d.mts +5 -4
  8. package/dist/client/index.d.ts +5 -4
  9. package/dist/client/index.js +555 -580
  10. package/dist/client/index.mjs +304 -16
  11. package/dist/client/ssr.css +54 -126
  12. package/dist/client/ssr.js +257 -580
  13. package/dist/client/ssr.mjs +1 -1
  14. package/dist/{config-D2XmHJYe.d.mts → config-BD5ZHz15.d.mts} +7 -0
  15. package/dist/{config-D2XmHJYe.d.ts → config-BD5ZHz15.d.ts} +7 -0
  16. package/dist/node/index.d.mts +2 -2
  17. package/dist/node/index.d.ts +2 -2
  18. package/dist/node/index.js +477 -123
  19. package/dist/node/index.mjs +114 -142
  20. package/package.json +2 -2
  21. package/src/client/app/index.tsx +344 -373
  22. package/src/client/app/preload.tsx +56 -56
  23. package/src/client/index.ts +40 -40
  24. package/src/client/ssr.tsx +51 -51
  25. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -76
  26. package/src/client/theme/components/CodeBlock/index.ts +1 -1
  27. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -154
  28. package/src/client/theme/components/PackageManagerTabs/index.ts +1 -1
  29. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -64
  30. package/src/client/theme/components/Playground/Playground.tsx +124 -124
  31. package/src/client/theme/components/Playground/index.ts +1 -1
  32. package/src/client/theme/components/Playground/playground.css +168 -168
  33. package/src/client/theme/components/Video/Video.tsx +84 -84
  34. package/src/client/theme/components/Video/index.ts +1 -1
  35. package/src/client/theme/components/Video/video.css +41 -41
  36. package/src/client/theme/components/mdx/Admonition.tsx +80 -80
  37. package/src/client/theme/components/mdx/Badge.tsx +31 -31
  38. package/src/client/theme/components/mdx/Button.tsx +50 -50
  39. package/src/client/theme/components/mdx/Card.tsx +80 -80
  40. package/src/client/theme/components/mdx/List.tsx +57 -57
  41. package/src/client/theme/components/mdx/Tabs.tsx +94 -94
  42. package/src/client/theme/components/mdx/index.ts +18 -18
  43. package/src/client/theme/components/mdx/mdx-components.css +424 -405
  44. package/src/client/theme/icons/bun.tsx +62 -62
  45. package/src/client/theme/icons/deno.tsx +20 -20
  46. package/src/client/theme/icons/discord.tsx +12 -12
  47. package/src/client/theme/icons/github.tsx +15 -15
  48. package/src/client/theme/icons/npm.tsx +13 -13
  49. package/src/client/theme/icons/pnpm.tsx +72 -72
  50. package/src/client/theme/icons/twitter.tsx +12 -12
  51. package/src/client/theme/styles/markdown.css +343 -343
  52. package/src/client/theme/styles/variables.css +162 -162
  53. package/src/client/theme/styles.css +37 -38
  54. package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -10
  55. package/src/client/theme/ui/BackgroundGradient/index.ts +1 -1
  56. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -68
  57. package/src/client/theme/ui/Breadcrumbs/index.ts +1 -1
  58. package/src/client/theme/ui/Footer/footer.css +32 -32
  59. package/src/client/theme/ui/Head/Head.tsx +69 -69
  60. package/src/client/theme/ui/Head/index.ts +1 -1
  61. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -125
  62. package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -1
  63. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -98
  64. package/src/client/theme/ui/Layout/Layout.tsx +202 -213
  65. package/src/client/theme/ui/Layout/base.css +76 -76
  66. package/src/client/theme/ui/Layout/index.ts +2 -2
  67. package/src/client/theme/ui/Layout/pagination.css +72 -72
  68. package/src/client/theme/ui/Layout/responsive.css +36 -40
  69. package/src/client/theme/ui/Link/Link.tsx +254 -202
  70. package/src/client/theme/ui/Link/index.ts +2 -2
  71. package/src/client/theme/ui/Loading/Loading.tsx +10 -10
  72. package/src/client/theme/ui/Loading/index.ts +1 -1
  73. package/src/client/theme/ui/Loading/loading.css +30 -30
  74. package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -27
  75. package/src/client/theme/ui/Navbar/Navbar.tsx +145 -145
  76. package/src/client/theme/ui/Navbar/index.ts +2 -2
  77. package/src/client/theme/ui/Navbar/navbar.css +233 -233
  78. package/src/client/theme/ui/NotFound/NotFound.tsx +19 -20
  79. package/src/client/theme/ui/NotFound/index.ts +1 -1
  80. package/src/client/theme/ui/NotFound/not-found.css +64 -64
  81. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +235 -192
  82. package/src/client/theme/ui/OnThisPage/index.ts +1 -1
  83. package/src/client/theme/ui/OnThisPage/toc.css +132 -132
  84. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -18
  85. package/src/client/theme/ui/PoweredBy/index.ts +1 -1
  86. package/src/client/theme/ui/PoweredBy/powered-by.css +76 -76
  87. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -199
  88. package/src/client/theme/ui/SearchDialog/index.ts +1 -1
  89. package/src/client/theme/ui/SearchDialog/search.css +152 -152
  90. package/src/client/theme/ui/Sidebar/Sidebar.tsx +204 -200
  91. package/src/client/theme/ui/Sidebar/index.ts +1 -1
  92. package/src/client/theme/ui/Sidebar/sidebar.css +236 -269
  93. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -69
  94. package/src/client/theme/ui/ThemeToggle/index.ts +1 -1
  95. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -136
  96. package/src/client/theme/ui/VersionSwitcher/index.ts +1 -1
  97. package/src/client/types.ts +50 -50
  98. package/src/client/utils.ts +26 -26
  99. package/src/node/cache.ts +408 -94
  100. package/src/node/config.ts +192 -185
  101. package/src/node/index.ts +21 -21
  102. package/src/node/mdx.ts +120 -41
  103. package/src/node/plugin/entry.ts +58 -58
  104. package/src/node/plugin/html.ts +55 -55
  105. package/src/node/plugin/index.ts +193 -190
  106. package/src/node/plugin/types.ts +11 -11
  107. package/src/node/routes/cache.ts +28 -24
  108. package/src/node/routes/index.ts +167 -152
  109. package/src/node/routes/parser.ts +153 -127
  110. package/src/node/routes/sorter.ts +42 -42
  111. package/src/node/routes/types.ts +49 -49
  112. package/src/node/ssg/index.ts +114 -110
  113. package/src/node/ssg/meta.ts +34 -34
  114. package/src/node/ssg/options.ts +13 -13
  115. package/src/node/ssg/sitemap.ts +54 -54
  116. package/src/node/utils.ts +134 -134
  117. package/tsconfig.json +20 -20
  118. package/tsup.config.ts +22 -22
  119. package/dist/Playground-B2FA34BC.mjs +0 -6
  120. package/dist/chunk-WPT4MWTQ.mjs +0 -89
  121. package/src/client/theme/styles/home.css +0 -60
@@ -1,202 +1,254 @@
1
- import React from "react";
2
- import {
3
- Link as RouterLink,
4
- NavLink as RouterNavLink,
5
- LinkProps as RouterLinkProps,
6
- NavLinkProps as RouterNavLinkProps,
7
- useLocation,
8
- } from "react-router-dom";
9
- import { usePreload } from "../../../app/preload";
10
- import { useConfig } from "../../../app";
11
-
12
- function useLocalizedTo(to: RouterLinkProps["to"]) {
13
- const location = useLocation();
14
- const config = useConfig();
15
- if (!config || typeof to !== "string") return to;
16
- if (!config.i18n && !config.versions) return to;
17
-
18
- const basePath = "/docs";
19
- if (!to.startsWith(basePath)) return to;
20
-
21
- // 1. Detect current context from location
22
- const curSub = location.pathname.substring(basePath.length);
23
- const curParts = curSub.split("/").filter(Boolean);
24
-
25
- let currentVersion = config.versions?.defaultVersion;
26
- let currentLocale = config.i18n?.defaultLocale;
27
-
28
- let cIdx = 0;
29
- if (
30
- config.versions &&
31
- curParts.length > cIdx &&
32
- config.versions.versions[curParts[cIdx]]
33
- ) {
34
- currentVersion = curParts[cIdx];
35
- cIdx++;
36
- }
37
- if (
38
- config.i18n &&
39
- curParts.length > cIdx &&
40
- config.i18n.locales[curParts[cIdx]]
41
- ) {
42
- currentLocale = curParts[cIdx];
43
- }
44
-
45
- // 2. Parse the target `to` path
46
- const toSub = to.substring(basePath.length);
47
- const toParts = toSub.split("/").filter(Boolean);
48
-
49
- let tIdx = 0;
50
- let hasVersion = false;
51
- let hasLocale = false;
52
-
53
- if (
54
- config.versions &&
55
- toParts.length > tIdx &&
56
- config.versions.versions[toParts[tIdx]]
57
- ) {
58
- hasVersion = true;
59
- tIdx++;
60
- }
61
- if (
62
- config.i18n &&
63
- toParts.length > tIdx &&
64
- config.i18n.locales[toParts[tIdx]]
65
- ) {
66
- hasLocale = true;
67
- tIdx++;
68
- }
69
-
70
- // Extract just the actual route parts
71
- const routeParts = toParts.slice(tIdx);
72
-
73
- // Reconstruct path
74
- const finalParts = [];
75
- if (config.versions) {
76
- if (hasVersion) {
77
- finalParts.push(toParts[0]);
78
- } else if (currentVersion) {
79
- finalParts.push(currentVersion);
80
- }
81
- }
82
- if (config.i18n) {
83
- if (hasLocale) {
84
- finalParts.push(toParts[hasVersion ? 1 : 0]);
85
- } else if (currentLocale) {
86
- finalParts.push(currentLocale);
87
- }
88
- }
89
-
90
- finalParts.push(...routeParts);
91
-
92
- let finalPath = `${basePath}/${finalParts.join("/")}`;
93
- if (finalPath.endsWith("/")) {
94
- finalPath = finalPath.slice(0, -1);
95
- }
96
- return finalPath === basePath ? basePath : finalPath;
97
- }
98
-
99
- export interface LinkProps extends Omit<RouterLinkProps, "prefetch"> {
100
- /** Should prefetch the page on hover? Options: 'hover' | 'none'. Default 'hover' */
101
- boltdocsPrefetch?: "hover" | "none";
102
- }
103
-
104
- export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
105
- (props, ref) => {
106
- const {
107
- boltdocsPrefetch = "hover",
108
- onMouseEnter,
109
- onFocus,
110
- to,
111
- ...rest
112
- } = props;
113
- const localizedTo = useLocalizedTo(to);
114
- const { preload } = usePreload();
115
-
116
- const handleMouseEnter = (e: React.MouseEvent<HTMLAnchorElement>) => {
117
- onMouseEnter?.(e);
118
- if (
119
- boltdocsPrefetch === "hover" &&
120
- typeof localizedTo === "string" &&
121
- localizedTo.startsWith("/")
122
- ) {
123
- preload(localizedTo);
124
- }
125
- };
126
-
127
- const handleFocus = (e: React.FocusEvent<HTMLAnchorElement>) => {
128
- onFocus?.(e);
129
- if (
130
- boltdocsPrefetch === "hover" &&
131
- typeof localizedTo === "string" &&
132
- localizedTo.startsWith("/")
133
- ) {
134
- preload(localizedTo);
135
- }
136
- };
137
-
138
- return (
139
- <RouterLink
140
- ref={ref}
141
- to={localizedTo}
142
- onMouseEnter={handleMouseEnter}
143
- onFocus={handleFocus}
144
- {...rest}
145
- />
146
- );
147
- },
148
- );
149
- Link.displayName = "Link";
150
-
151
- export interface NavLinkProps extends Omit<RouterNavLinkProps, "prefetch"> {
152
- /** Should prefetch the page on hover? Options: 'hover' | 'none'. Default 'hover' */
153
- boltdocsPrefetch?: "hover" | "none";
154
- }
155
-
156
- export const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(
157
- (props, ref) => {
158
- const {
159
- boltdocsPrefetch = "hover",
160
- onMouseEnter,
161
- onFocus,
162
- to,
163
- ...rest
164
- } = props;
165
-
166
- const localizedTo = useLocalizedTo(to);
167
- const { preload } = usePreload();
168
-
169
- const handleMouseEnter = (e: React.MouseEvent<HTMLAnchorElement>) => {
170
- onMouseEnter?.(e);
171
- if (
172
- boltdocsPrefetch === "hover" &&
173
- typeof localizedTo === "string" &&
174
- localizedTo.startsWith("/")
175
- ) {
176
- preload(localizedTo);
177
- }
178
- };
179
-
180
- const handleFocus = (e: React.FocusEvent<HTMLAnchorElement>) => {
181
- onFocus?.(e);
182
- if (
183
- boltdocsPrefetch === "hover" &&
184
- typeof localizedTo === "string" &&
185
- localizedTo.startsWith("/")
186
- ) {
187
- preload(localizedTo);
188
- }
189
- };
190
-
191
- return (
192
- <RouterNavLink
193
- ref={ref}
194
- to={localizedTo}
195
- onMouseEnter={handleMouseEnter}
196
- onFocus={handleFocus}
197
- {...rest}
198
- />
199
- );
200
- },
201
- );
202
- NavLink.displayName = "NavLink";
1
+ import React from "react";
2
+ import {
3
+ Link as RouterLink,
4
+ NavLink as RouterNavLink,
5
+ LinkProps as RouterLinkProps,
6
+ NavLinkProps as RouterNavLinkProps,
7
+ useLocation,
8
+ useNavigate,
9
+ } from "react-router-dom";
10
+ import { usePreload } from "../../../app/preload";
11
+ import { useConfig } from "../../../app";
12
+
13
+ function useLocalizedTo(to: RouterLinkProps["to"]) {
14
+ const location = useLocation();
15
+ const config = useConfig();
16
+ if (!config || typeof to !== "string") return to;
17
+ if (!config.i18n && !config.versions) return to;
18
+
19
+ const basePath = "/docs";
20
+ if (!to.startsWith(basePath)) return to;
21
+
22
+ // 1. Detect current context from location
23
+ const curSub = location.pathname.substring(basePath.length);
24
+ const curParts = curSub.split("/").filter(Boolean);
25
+
26
+ let currentVersion = config.versions?.defaultVersion;
27
+ let currentLocale = config.i18n?.defaultLocale;
28
+
29
+ let cIdx = 0;
30
+ if (
31
+ config.versions &&
32
+ curParts.length > cIdx &&
33
+ config.versions.versions[curParts[cIdx]]
34
+ ) {
35
+ currentVersion = curParts[cIdx];
36
+ cIdx++;
37
+ }
38
+ if (
39
+ config.i18n &&
40
+ curParts.length > cIdx &&
41
+ config.i18n.locales[curParts[cIdx]]
42
+ ) {
43
+ currentLocale = curParts[cIdx];
44
+ }
45
+
46
+ // 2. Parse the target `to` path
47
+ const toSub = to.substring(basePath.length);
48
+ const toParts = toSub.split("/").filter(Boolean);
49
+
50
+ let tIdx = 0;
51
+ let hasVersion = false;
52
+ let hasLocale = false;
53
+
54
+ if (
55
+ config.versions &&
56
+ toParts.length > tIdx &&
57
+ config.versions.versions[toParts[tIdx]]
58
+ ) {
59
+ hasVersion = true;
60
+ tIdx++;
61
+ }
62
+ if (
63
+ config.i18n &&
64
+ toParts.length > tIdx &&
65
+ config.i18n.locales[toParts[tIdx]]
66
+ ) {
67
+ hasLocale = true;
68
+ tIdx++;
69
+ }
70
+
71
+ // Extract just the actual route parts
72
+ const routeParts = toParts.slice(tIdx);
73
+
74
+ // Reconstruct path
75
+ const finalParts = [];
76
+ if (config.versions) {
77
+ if (hasVersion) {
78
+ finalParts.push(toParts[0]);
79
+ } else if (currentVersion) {
80
+ finalParts.push(currentVersion);
81
+ }
82
+ }
83
+ if (config.i18n) {
84
+ if (hasLocale) {
85
+ finalParts.push(toParts[hasVersion ? 1 : 0]);
86
+ } else if (currentLocale) {
87
+ finalParts.push(currentLocale);
88
+ }
89
+ }
90
+
91
+ finalParts.push(...routeParts);
92
+
93
+ let finalPath = `${basePath}/${finalParts.join("/")}`;
94
+ if (finalPath.endsWith("/")) {
95
+ finalPath = finalPath.slice(0, -1);
96
+ }
97
+ return finalPath === basePath ? basePath : finalPath;
98
+ }
99
+
100
+ export interface LinkProps extends Omit<RouterLinkProps, "prefetch"> {
101
+ /** Should prefetch the page on hover? Options: 'hover' | 'none'. Default 'hover' */
102
+ boltdocsPrefetch?: "hover" | "none";
103
+ }
104
+
105
+ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
106
+ (props, ref) => {
107
+ const {
108
+ boltdocsPrefetch = "hover",
109
+ onMouseEnter,
110
+ onFocus,
111
+ onClick,
112
+ to,
113
+ ...rest
114
+ } = props;
115
+ const localizedTo = useLocalizedTo(to);
116
+ const { preload } = usePreload();
117
+ const navigate = useNavigate();
118
+
119
+ const handleMouseEnter = (e: React.MouseEvent<HTMLAnchorElement>) => {
120
+ onMouseEnter?.(e);
121
+ if (
122
+ boltdocsPrefetch === "hover" &&
123
+ typeof localizedTo === "string" &&
124
+ localizedTo.startsWith("/")
125
+ ) {
126
+ preload(localizedTo);
127
+ }
128
+ };
129
+
130
+ const handleFocus = (e: React.FocusEvent<HTMLAnchorElement>) => {
131
+ onFocus?.(e);
132
+ if (
133
+ boltdocsPrefetch === "hover" &&
134
+ typeof localizedTo === "string" &&
135
+ localizedTo.startsWith("/")
136
+ ) {
137
+ preload(localizedTo);
138
+ }
139
+ };
140
+
141
+ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
142
+ // Allow user onClick to handle defaults or custom logic
143
+ onClick?.(e);
144
+
145
+ // If default prevented or not a simple left click, don't handle
146
+ if (
147
+ e.defaultPrevented ||
148
+ e.button !== 0 ||
149
+ e.metaKey ||
150
+ e.ctrlKey ||
151
+ e.shiftKey ||
152
+ e.altKey
153
+ ) {
154
+ return;
155
+ }
156
+
157
+ // Intercept navigation to wrap in startTransition
158
+ if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
159
+ e.preventDefault();
160
+ React.startTransition(() => {
161
+ navigate(localizedTo);
162
+ });
163
+ }
164
+ };
165
+
166
+ return (
167
+ <RouterLink
168
+ ref={ref}
169
+ to={localizedTo}
170
+ onMouseEnter={handleMouseEnter}
171
+ onFocus={handleFocus}
172
+ onClick={handleClick}
173
+ {...rest}
174
+ />
175
+ );
176
+ },
177
+ );
178
+ Link.displayName = "Link";
179
+
180
+ export interface NavLinkProps extends Omit<RouterNavLinkProps, "prefetch"> {
181
+ /** Should prefetch the page on hover? Options: 'hover' | 'none'. Default 'hover' */
182
+ boltdocsPrefetch?: "hover" | "none";
183
+ }
184
+
185
+ export const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(
186
+ (props, ref) => {
187
+ const {
188
+ boltdocsPrefetch = "hover",
189
+ onMouseEnter,
190
+ onFocus,
191
+ onClick,
192
+ to,
193
+ ...rest
194
+ } = props;
195
+
196
+ const localizedTo = useLocalizedTo(to);
197
+ const { preload } = usePreload();
198
+ const navigate = useNavigate();
199
+
200
+ const handleMouseEnter = (e: React.MouseEvent<HTMLAnchorElement>) => {
201
+ onMouseEnter?.(e);
202
+ if (
203
+ boltdocsPrefetch === "hover" &&
204
+ typeof localizedTo === "string" &&
205
+ localizedTo.startsWith("/")
206
+ ) {
207
+ preload(localizedTo);
208
+ }
209
+ };
210
+
211
+ const handleFocus = (e: React.FocusEvent<HTMLAnchorElement>) => {
212
+ onFocus?.(e);
213
+ if (
214
+ boltdocsPrefetch === "hover" &&
215
+ typeof localizedTo === "string" &&
216
+ localizedTo.startsWith("/")
217
+ ) {
218
+ preload(localizedTo);
219
+ }
220
+ };
221
+
222
+ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
223
+ onClick?.(e);
224
+ if (
225
+ e.defaultPrevented ||
226
+ e.button !== 0 ||
227
+ e.metaKey ||
228
+ e.ctrlKey ||
229
+ e.shiftKey ||
230
+ e.altKey
231
+ ) {
232
+ return;
233
+ }
234
+ if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
235
+ e.preventDefault();
236
+ React.startTransition(() => {
237
+ navigate(localizedTo);
238
+ });
239
+ }
240
+ };
241
+
242
+ return (
243
+ <RouterNavLink
244
+ ref={ref}
245
+ to={localizedTo}
246
+ onMouseEnter={handleMouseEnter}
247
+ onFocus={handleFocus}
248
+ onClick={handleClick}
249
+ {...rest}
250
+ />
251
+ );
252
+ },
253
+ );
254
+ NavLink.displayName = "NavLink";
@@ -1,2 +1,2 @@
1
- export { Link, NavLink } from "./Link";
2
- export type { LinkProps, NavLinkProps } from "./Link";
1
+ export { Link, NavLink } from "./Link";
2
+ export type { LinkProps, NavLinkProps } from "./Link";
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
-
3
- export function Loading() {
4
- return (
5
- <div className="boltdocs-loading">
6
- <div className="loading-spinner" />
7
- <p className="loading-text">Loading...</p>
8
- </div>
9
- );
10
- }
1
+ import React from 'react';
2
+
3
+ export function Loading() {
4
+ return (
5
+ <div className="boltdocs-loading">
6
+ <div className="loading-spinner" />
7
+ <p className="loading-text">Loading...</p>
8
+ </div>
9
+ );
10
+ }
@@ -1 +1 @@
1
- export { Loading } from "./Loading";
1
+ export { Loading } from "./Loading";
@@ -1,30 +1,30 @@
1
- /* ─── Loading ─────────────────────────────────────────────── */
2
- .boltdocs-loading {
3
- display: flex;
4
- flex-direction: column;
5
- align-items: center;
6
- justify-content: center;
7
- min-height: 40vh;
8
- gap: 1rem;
9
- }
10
-
11
- .loading-spinner {
12
- width: 2.5rem;
13
- height: 2.5rem;
14
- border: 3px solid var(--ld-border-subtle);
15
- border-top-color: var(--ld-color-primary);
16
- border-radius: 50%;
17
- animation: boltdocs-spin 0.7s linear infinite;
18
- }
19
-
20
- @keyframes boltdocs-spin {
21
- to {
22
- transform: rotate(360deg);
23
- }
24
- }
25
-
26
- .loading-text {
27
- font-size: 0.875rem;
28
- color: var(--ld-text-dim);
29
- margin: 0;
30
- }
1
+ /* ─── Loading ─────────────────────────────────────────────── */
2
+ .boltdocs-loading {
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ justify-content: center;
7
+ min-height: 40vh;
8
+ gap: 1rem;
9
+ }
10
+
11
+ .loading-spinner {
12
+ width: 2.5rem;
13
+ height: 2.5rem;
14
+ border: 3px solid var(--ld-border-subtle);
15
+ border-top-color: var(--ld-color-primary);
16
+ border-radius: 50%;
17
+ animation: boltdocs-spin 0.7s linear infinite;
18
+ }
19
+
20
+ @keyframes boltdocs-spin {
21
+ to {
22
+ transform: rotate(360deg);
23
+ }
24
+ }
25
+
26
+ .loading-text {
27
+ font-size: 0.875rem;
28
+ color: var(--ld-text-dim);
29
+ margin: 0;
30
+ }
@@ -1,27 +1,27 @@
1
- import { useEffect, useState } from "react";
2
- import { GitHub } from "../../icons/github";
3
- import { getStarsRepo } from "../../../utils";
4
-
5
- export function GithubStars({ repo }: { repo: string }) {
6
- const [stars, setStars] = useState<string | null>(null);
7
-
8
- useEffect(() => {
9
- if (repo) {
10
- getStarsRepo(repo)
11
- .then((stars) => setStars(stars))
12
- .catch(() => setStars("0"));
13
- }
14
- }, [repo]);
15
-
16
- return (
17
- <a
18
- href={`https://github.com/${repo}`}
19
- target="_blank"
20
- rel="noopener noreferrer"
21
- className="navbar-github-stars"
22
- >
23
- <GitHub />
24
- {stars && <span>{stars}</span>}
25
- </a>
26
- );
27
- }
1
+ import { useEffect, useState } from "react";
2
+ import { GitHub } from "../../icons/github";
3
+ import { getStarsRepo } from "../../../utils";
4
+
5
+ export function GithubStars({ repo }: { repo: string }) {
6
+ const [stars, setStars] = useState<string | null>(null);
7
+
8
+ useEffect(() => {
9
+ if (repo) {
10
+ getStarsRepo(repo)
11
+ .then((stars) => setStars(stars))
12
+ .catch(() => setStars("0"));
13
+ }
14
+ }, [repo]);
15
+
16
+ return (
17
+ <a
18
+ href={`https://github.com/${repo}`}
19
+ target="_blank"
20
+ rel="noopener noreferrer"
21
+ className="navbar-github-stars"
22
+ >
23
+ <GitHub />
24
+ {stars && <span>{stars}</span>}
25
+ </a>
26
+ );
27
+ }