boltdocs 1.3.0 → 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 (101) hide show
  1. package/dist/node/index.js +21 -6
  2. package/dist/node/index.mjs +21 -6
  3. package/package.json +1 -1
  4. package/src/client/app/index.tsx +344 -344
  5. package/src/client/app/preload.tsx +56 -56
  6. package/src/client/index.ts +40 -40
  7. package/src/client/ssr.tsx +51 -51
  8. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -76
  9. package/src/client/theme/components/CodeBlock/index.ts +1 -1
  10. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -154
  11. package/src/client/theme/components/PackageManagerTabs/index.ts +1 -1
  12. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -64
  13. package/src/client/theme/components/Playground/Playground.tsx +124 -124
  14. package/src/client/theme/components/Playground/index.ts +1 -1
  15. package/src/client/theme/components/Playground/playground.css +168 -168
  16. package/src/client/theme/components/Video/Video.tsx +84 -84
  17. package/src/client/theme/components/Video/index.ts +1 -1
  18. package/src/client/theme/components/Video/video.css +41 -41
  19. package/src/client/theme/components/mdx/Admonition.tsx +80 -80
  20. package/src/client/theme/components/mdx/Badge.tsx +31 -31
  21. package/src/client/theme/components/mdx/Button.tsx +50 -50
  22. package/src/client/theme/components/mdx/Card.tsx +80 -80
  23. package/src/client/theme/components/mdx/List.tsx +57 -57
  24. package/src/client/theme/components/mdx/Tabs.tsx +94 -94
  25. package/src/client/theme/components/mdx/index.ts +18 -18
  26. package/src/client/theme/components/mdx/mdx-components.css +424 -424
  27. package/src/client/theme/icons/bun.tsx +62 -62
  28. package/src/client/theme/icons/deno.tsx +20 -20
  29. package/src/client/theme/icons/discord.tsx +12 -12
  30. package/src/client/theme/icons/github.tsx +15 -15
  31. package/src/client/theme/icons/npm.tsx +13 -13
  32. package/src/client/theme/icons/pnpm.tsx +72 -72
  33. package/src/client/theme/icons/twitter.tsx +12 -12
  34. package/src/client/theme/styles/markdown.css +343 -343
  35. package/src/client/theme/styles/variables.css +162 -162
  36. package/src/client/theme/styles.css +37 -37
  37. package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -10
  38. package/src/client/theme/ui/BackgroundGradient/index.ts +1 -1
  39. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -68
  40. package/src/client/theme/ui/Breadcrumbs/index.ts +1 -1
  41. package/src/client/theme/ui/Footer/footer.css +32 -32
  42. package/src/client/theme/ui/Head/Head.tsx +69 -69
  43. package/src/client/theme/ui/Head/index.ts +1 -1
  44. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -125
  45. package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -1
  46. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -98
  47. package/src/client/theme/ui/Layout/Layout.tsx +202 -202
  48. package/src/client/theme/ui/Layout/base.css +76 -76
  49. package/src/client/theme/ui/Layout/index.ts +2 -2
  50. package/src/client/theme/ui/Layout/pagination.css +72 -72
  51. package/src/client/theme/ui/Layout/responsive.css +36 -36
  52. package/src/client/theme/ui/Link/Link.tsx +254 -254
  53. package/src/client/theme/ui/Link/index.ts +2 -2
  54. package/src/client/theme/ui/Loading/Loading.tsx +10 -10
  55. package/src/client/theme/ui/Loading/index.ts +1 -1
  56. package/src/client/theme/ui/Loading/loading.css +30 -30
  57. package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -27
  58. package/src/client/theme/ui/Navbar/Navbar.tsx +145 -145
  59. package/src/client/theme/ui/Navbar/index.ts +2 -2
  60. package/src/client/theme/ui/Navbar/navbar.css +233 -233
  61. package/src/client/theme/ui/NotFound/NotFound.tsx +19 -19
  62. package/src/client/theme/ui/NotFound/index.ts +1 -1
  63. package/src/client/theme/ui/NotFound/not-found.css +64 -64
  64. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +235 -235
  65. package/src/client/theme/ui/OnThisPage/index.ts +1 -1
  66. package/src/client/theme/ui/OnThisPage/toc.css +132 -132
  67. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -18
  68. package/src/client/theme/ui/PoweredBy/index.ts +1 -1
  69. package/src/client/theme/ui/PoweredBy/powered-by.css +76 -76
  70. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -199
  71. package/src/client/theme/ui/SearchDialog/index.ts +1 -1
  72. package/src/client/theme/ui/SearchDialog/search.css +152 -152
  73. package/src/client/theme/ui/Sidebar/Sidebar.tsx +204 -204
  74. package/src/client/theme/ui/Sidebar/index.ts +1 -1
  75. package/src/client/theme/ui/Sidebar/sidebar.css +236 -236
  76. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -69
  77. package/src/client/theme/ui/ThemeToggle/index.ts +1 -1
  78. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -136
  79. package/src/client/theme/ui/VersionSwitcher/index.ts +1 -1
  80. package/src/client/types.ts +50 -50
  81. package/src/client/utils.ts +26 -26
  82. package/src/node/cache.ts +408 -408
  83. package/src/node/config.ts +192 -192
  84. package/src/node/index.ts +21 -21
  85. package/src/node/mdx.ts +120 -120
  86. package/src/node/plugin/entry.ts +58 -58
  87. package/src/node/plugin/html.ts +55 -55
  88. package/src/node/plugin/index.ts +193 -193
  89. package/src/node/plugin/types.ts +11 -11
  90. package/src/node/routes/cache.ts +28 -28
  91. package/src/node/routes/index.ts +167 -167
  92. package/src/node/routes/parser.ts +153 -127
  93. package/src/node/routes/sorter.ts +42 -42
  94. package/src/node/routes/types.ts +49 -49
  95. package/src/node/ssg/index.ts +114 -114
  96. package/src/node/ssg/meta.ts +34 -34
  97. package/src/node/ssg/options.ts +13 -13
  98. package/src/node/ssg/sitemap.ts +54 -54
  99. package/src/node/utils.ts +134 -134
  100. package/tsconfig.json +20 -20
  101. package/tsup.config.ts +22 -22
@@ -1,80 +1,80 @@
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
+ 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,57 +1,57 @@
1
- import React, { Children } from "react";
2
- import { Check, ChevronRight } from "lucide-react";
3
-
4
- export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
5
- /** Visual variant */
6
- variant?: "checked" | "arrow" | "default";
7
- children: React.ReactNode;
8
- }
9
-
10
- const ICON_MAP: Record<string, React.ReactNode> = {
11
- checked: <Check size={14} className="ld-list__icon" />,
12
- arrow: <ChevronRight size={14} className="ld-list__icon" />,
13
- };
14
-
15
- /**
16
- * Enhanced list component with icon variants.
17
- *
18
- * ```mdx
19
- * <List variant="checked">
20
- * <li>File-system routing</li>
21
- * <li>MDX support</li>
22
- * <li>Syntax highlighting</li>
23
- * </List>
24
- * ```
25
- */
26
- export function List({
27
- variant = "default",
28
- children,
29
- className = "",
30
- ...rest
31
- }: ListProps) {
32
- if (variant === "default") {
33
- return (
34
- <ul className={`ld-list ${className}`.trim()} {...rest}>
35
- {children}
36
- </ul>
37
- );
38
- }
39
-
40
- const icon = ICON_MAP[variant];
41
-
42
- return (
43
- <ul className={`ld-list ld-list--${variant} ${className}`.trim()} {...rest}>
44
- {Children.map(children, (child) => {
45
- if (!React.isValidElement(child)) return child;
46
- return (
47
- <li className="ld-list__item">
48
- {icon}
49
- <span className="ld-list__text">
50
- {(child as React.ReactElement<any>).props.children}
51
- </span>
52
- </li>
53
- );
54
- })}
55
- </ul>
56
- );
57
- }
1
+ import React, { Children } from "react";
2
+ import { Check, ChevronRight } from "lucide-react";
3
+
4
+ export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
5
+ /** Visual variant */
6
+ variant?: "checked" | "arrow" | "default";
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ const ICON_MAP: Record<string, React.ReactNode> = {
11
+ checked: <Check size={14} className="ld-list__icon" />,
12
+ arrow: <ChevronRight size={14} className="ld-list__icon" />,
13
+ };
14
+
15
+ /**
16
+ * Enhanced list component with icon variants.
17
+ *
18
+ * ```mdx
19
+ * <List variant="checked">
20
+ * <li>File-system routing</li>
21
+ * <li>MDX support</li>
22
+ * <li>Syntax highlighting</li>
23
+ * </List>
24
+ * ```
25
+ */
26
+ export function List({
27
+ variant = "default",
28
+ children,
29
+ className = "",
30
+ ...rest
31
+ }: ListProps) {
32
+ if (variant === "default") {
33
+ return (
34
+ <ul className={`ld-list ${className}`.trim()} {...rest}>
35
+ {children}
36
+ </ul>
37
+ );
38
+ }
39
+
40
+ const icon = ICON_MAP[variant];
41
+
42
+ return (
43
+ <ul className={`ld-list ld-list--${variant} ${className}`.trim()} {...rest}>
44
+ {Children.map(children, (child) => {
45
+ if (!React.isValidElement(child)) return child;
46
+ return (
47
+ <li className="ld-list__item">
48
+ {icon}
49
+ <span className="ld-list__text">
50
+ {(child as React.ReactElement<any>).props.children}
51
+ </span>
52
+ </li>
53
+ );
54
+ })}
55
+ </ul>
56
+ );
57
+ }
@@ -1,94 +1,94 @@
1
- import React, { useState, Children, isValidElement, useRef } from "react";
2
-
3
- /* ─── Tab (individual panel) ──────────────────────────────── */
4
- export interface TabProps {
5
- /** The label shown in the tab bar */
6
- label: string;
7
- children: React.ReactNode;
8
- }
9
-
10
- /**
11
- * A single tab panel. Must be used inside `<Tabs>`.
12
- *
13
- * ```mdx
14
- * <Tab label="npm">npm install boltdocs</Tab>
15
- * ```
16
- */
17
- export function Tab({ children }: TabProps) {
18
- return <div className="ld-tab-panel">{children}</div>;
19
- }
20
-
21
- /* ─── Tabs (container) ────────────────────────────────────── */
22
- export interface TabsProps {
23
- /** Which tab index is initially active (0-based, default 0) */
24
- defaultIndex?: number;
25
- children: React.ReactNode;
26
- }
27
-
28
- /**
29
- * Tab container that manages active state.
30
- *
31
- * ```mdx
32
- * <Tabs>
33
- * <Tab label="npm">npm install boltdocs</Tab>
34
- * <Tab label="pnpm">pnpm add boltdocs</Tab>
35
- * <Tab label="yarn">yarn add boltdocs</Tab>
36
- * </Tabs>
37
- * ```
38
- */
39
- export function Tabs({ defaultIndex = 0, children }: TabsProps) {
40
- const [active, setActive] = useState(defaultIndex);
41
- const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
42
-
43
- // Extract Tab children
44
- const tabs = Children.toArray(children).filter(
45
- (child) => isValidElement(child) && (child as any).props?.label,
46
- );
47
-
48
- const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
49
- let newIndex = active;
50
- if (e.key === "ArrowRight") {
51
- newIndex = (active + 1) % tabs.length;
52
- } else if (e.key === "ArrowLeft") {
53
- newIndex = (active - 1 + tabs.length) % tabs.length;
54
- }
55
-
56
- if (newIndex !== active) {
57
- setActive(newIndex);
58
- tabRefs.current[newIndex]?.focus();
59
- }
60
- };
61
-
62
- return (
63
- <div className="ld-tabs">
64
- <div className="ld-tabs__bar" role="tablist" onKeyDown={handleKeyDown}>
65
- {tabs.map((child, i) => {
66
- const label = (child as React.ReactElement<TabProps>).props.label;
67
- return (
68
- <button
69
- key={i}
70
- role="tab"
71
- aria-selected={i === active}
72
- aria-controls={`tabpanel-${i}`}
73
- id={`tab-${i}`}
74
- tabIndex={i === active ? 0 : -1}
75
- ref={(el) => { tabRefs.current[i] = el; }}
76
- className={`ld-tabs__trigger ${i === active ? "ld-tabs__trigger--active" : ""}`}
77
- onClick={() => setActive(i)}
78
- >
79
- {label}
80
- </button>
81
- );
82
- })}
83
- </div>
84
- <div
85
- className="ld-tabs__content"
86
- role="tabpanel"
87
- id={`tabpanel-${active}`}
88
- aria-labelledby={`tab-${active}`}
89
- >
90
- {tabs[active]}
91
- </div>
92
- </div>
93
- );
94
- }
1
+ import React, { useState, Children, isValidElement, useRef } from "react";
2
+
3
+ /* ─── Tab (individual panel) ──────────────────────────────── */
4
+ export interface TabProps {
5
+ /** The label shown in the tab bar */
6
+ label: string;
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ /**
11
+ * A single tab panel. Must be used inside `<Tabs>`.
12
+ *
13
+ * ```mdx
14
+ * <Tab label="npm">npm install boltdocs</Tab>
15
+ * ```
16
+ */
17
+ export function Tab({ children }: TabProps) {
18
+ return <div className="ld-tab-panel">{children}</div>;
19
+ }
20
+
21
+ /* ─── Tabs (container) ────────────────────────────────────── */
22
+ export interface TabsProps {
23
+ /** Which tab index is initially active (0-based, default 0) */
24
+ defaultIndex?: number;
25
+ children: React.ReactNode;
26
+ }
27
+
28
+ /**
29
+ * Tab container that manages active state.
30
+ *
31
+ * ```mdx
32
+ * <Tabs>
33
+ * <Tab label="npm">npm install boltdocs</Tab>
34
+ * <Tab label="pnpm">pnpm add boltdocs</Tab>
35
+ * <Tab label="yarn">yarn add boltdocs</Tab>
36
+ * </Tabs>
37
+ * ```
38
+ */
39
+ export function Tabs({ defaultIndex = 0, children }: TabsProps) {
40
+ const [active, setActive] = useState(defaultIndex);
41
+ const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
42
+
43
+ // Extract Tab children
44
+ const tabs = Children.toArray(children).filter(
45
+ (child) => isValidElement(child) && (child as any).props?.label,
46
+ );
47
+
48
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
49
+ let newIndex = active;
50
+ if (e.key === "ArrowRight") {
51
+ newIndex = (active + 1) % tabs.length;
52
+ } else if (e.key === "ArrowLeft") {
53
+ newIndex = (active - 1 + tabs.length) % tabs.length;
54
+ }
55
+
56
+ if (newIndex !== active) {
57
+ setActive(newIndex);
58
+ tabRefs.current[newIndex]?.focus();
59
+ }
60
+ };
61
+
62
+ return (
63
+ <div className="ld-tabs">
64
+ <div className="ld-tabs__bar" role="tablist" onKeyDown={handleKeyDown}>
65
+ {tabs.map((child, i) => {
66
+ const label = (child as React.ReactElement<TabProps>).props.label;
67
+ return (
68
+ <button
69
+ key={i}
70
+ role="tab"
71
+ aria-selected={i === active}
72
+ aria-controls={`tabpanel-${i}`}
73
+ id={`tab-${i}`}
74
+ tabIndex={i === active ? 0 : -1}
75
+ ref={(el) => { tabRefs.current[i] = el; }}
76
+ className={`ld-tabs__trigger ${i === active ? "ld-tabs__trigger--active" : ""}`}
77
+ onClick={() => setActive(i)}
78
+ >
79
+ {label}
80
+ </button>
81
+ );
82
+ })}
83
+ </div>
84
+ <div
85
+ className="ld-tabs__content"
86
+ role="tabpanel"
87
+ id={`tabpanel-${active}`}
88
+ aria-labelledby={`tab-${active}`}
89
+ >
90
+ {tabs[active]}
91
+ </div>
92
+ </div>
93
+ );
94
+ }
@@ -1,18 +1,18 @@
1
- // MDX UI Components — barrel export
2
- export { Button } from "./Button";
3
- export type { ButtonProps } from "./Button";
4
-
5
- export { Badge } from "./Badge";
6
- export type { BadgeProps } from "./Badge";
7
-
8
- export { Card, Cards } from "./Card";
9
- export type { CardProps, CardsProps } from "./Card";
10
-
11
- export { Tabs, Tab } from "./Tabs";
12
- export type { TabsProps, TabProps } from "./Tabs";
13
-
14
- export { Admonition, Note, Tip, Warning, Danger, InfoBox } from "./Admonition";
15
- export type { AdmonitionProps } from "./Admonition";
16
-
17
- export { List } from "./List";
18
- export type { ListProps } from "./List";
1
+ // MDX UI Components — barrel export
2
+ export { Button } from "./Button";
3
+ export type { ButtonProps } from "./Button";
4
+
5
+ export { Badge } from "./Badge";
6
+ export type { BadgeProps } from "./Badge";
7
+
8
+ export { Card, Cards } from "./Card";
9
+ export type { CardProps, CardsProps } from "./Card";
10
+
11
+ export { Tabs, Tab } from "./Tabs";
12
+ export type { TabsProps, TabProps } from "./Tabs";
13
+
14
+ export { Admonition, Note, Tip, Warning, Danger, InfoBox } from "./Admonition";
15
+ export type { AdmonitionProps } from "./Admonition";
16
+
17
+ export { List } from "./List";
18
+ export type { ListProps } from "./List";