boltdocs 1.0.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 (137) hide show
  1. package/dist/CodeBlock-37XMKCYY.mjs +7 -0
  2. package/dist/PackageManagerTabs-4NWXLXQO.mjs +314 -0
  3. package/dist/Playground-OE2OE6B6.mjs +7 -0
  4. package/dist/SearchDialog-FTOQZ763.mjs +187 -0
  5. package/dist/SearchDialog-ZAZXYIFX.css +2147 -0
  6. package/dist/Video-I6QY4X7J.mjs +7 -0
  7. package/dist/chunk-2YRDWM6O.mjs +56 -0
  8. package/dist/chunk-PN4GCTYG.mjs +67 -0
  9. package/dist/chunk-X2TDGMTR.mjs +64 -0
  10. package/dist/chunk-X6BYQHVC.mjs +12 -0
  11. package/dist/chunk-Z7JHYNAS.mjs +57 -0
  12. package/dist/chunk-ZFCOLEXN.mjs +1644 -0
  13. package/dist/client/index.css +2147 -0
  14. package/dist/client/index.d.mts +298 -0
  15. package/dist/client/index.d.ts +298 -0
  16. package/dist/client/index.js +2793 -0
  17. package/dist/client/index.mjs +63 -0
  18. package/dist/client/ssr.css +2147 -0
  19. package/dist/client/ssr.d.mts +25 -0
  20. package/dist/client/ssr.d.ts +25 -0
  21. package/dist/client/ssr.js +2727 -0
  22. package/dist/client/ssr.mjs +32 -0
  23. package/dist/config-D2XmHJYe.d.mts +122 -0
  24. package/dist/config-D2XmHJYe.d.ts +122 -0
  25. package/dist/index-CRQKWAeo.d.mts +82 -0
  26. package/dist/index-CRQKWAeo.d.ts +82 -0
  27. package/dist/node/cli/index.d.mts +1 -0
  28. package/dist/node/cli/index.d.ts +1 -0
  29. package/dist/node/cli/index.js +199 -0
  30. package/dist/node/cli/index.mjs +154 -0
  31. package/dist/node/index.d.mts +79 -0
  32. package/dist/node/index.d.ts +79 -0
  33. package/dist/node/index.js +797 -0
  34. package/dist/node/index.mjs +719 -0
  35. package/package.json +79 -0
  36. package/src/client/app/index.tsx +422 -0
  37. package/src/client/app/preload.tsx +56 -0
  38. package/src/client/index.ts +40 -0
  39. package/src/client/ssr.tsx +50 -0
  40. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -0
  41. package/src/client/theme/components/CodeBlock/index.ts +1 -0
  42. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -0
  43. package/src/client/theme/components/PackageManagerTabs/index.ts +1 -0
  44. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -0
  45. package/src/client/theme/components/Playground/Playground.tsx +86 -0
  46. package/src/client/theme/components/Playground/index.ts +1 -0
  47. package/src/client/theme/components/Playground/playground.css +168 -0
  48. package/src/client/theme/components/Video/Video.tsx +84 -0
  49. package/src/client/theme/components/Video/index.ts +1 -0
  50. package/src/client/theme/components/Video/video.css +41 -0
  51. package/src/client/theme/components/mdx/Admonition.tsx +80 -0
  52. package/src/client/theme/components/mdx/Badge.tsx +31 -0
  53. package/src/client/theme/components/mdx/Button.tsx +50 -0
  54. package/src/client/theme/components/mdx/Card.tsx +80 -0
  55. package/src/client/theme/components/mdx/List.tsx +57 -0
  56. package/src/client/theme/components/mdx/Tabs.tsx +94 -0
  57. package/src/client/theme/components/mdx/index.ts +18 -0
  58. package/src/client/theme/components/mdx/mdx-components.css +405 -0
  59. package/src/client/theme/icons/bun.tsx +62 -0
  60. package/src/client/theme/icons/deno.tsx +20 -0
  61. package/src/client/theme/icons/discord.tsx +12 -0
  62. package/src/client/theme/icons/github.tsx +15 -0
  63. package/src/client/theme/icons/npm.tsx +13 -0
  64. package/src/client/theme/icons/pnpm.tsx +72 -0
  65. package/src/client/theme/icons/twitter.tsx +12 -0
  66. package/src/client/theme/styles/home.css +60 -0
  67. package/src/client/theme/styles/markdown.css +343 -0
  68. package/src/client/theme/styles/variables.css +162 -0
  69. package/src/client/theme/styles.css +38 -0
  70. package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -0
  71. package/src/client/theme/ui/BackgroundGradient/index.ts +1 -0
  72. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -0
  73. package/src/client/theme/ui/Breadcrumbs/index.ts +1 -0
  74. package/src/client/theme/ui/Footer/footer.css +32 -0
  75. package/src/client/theme/ui/Head/Head.tsx +69 -0
  76. package/src/client/theme/ui/Head/index.ts +1 -0
  77. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -0
  78. package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -0
  79. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -0
  80. package/src/client/theme/ui/Layout/Layout.tsx +213 -0
  81. package/src/client/theme/ui/Layout/base.css +76 -0
  82. package/src/client/theme/ui/Layout/index.ts +2 -0
  83. package/src/client/theme/ui/Layout/pagination.css +72 -0
  84. package/src/client/theme/ui/Layout/responsive.css +40 -0
  85. package/src/client/theme/ui/Link/Link.tsx +202 -0
  86. package/src/client/theme/ui/Link/index.ts +2 -0
  87. package/src/client/theme/ui/Loading/Loading.tsx +10 -0
  88. package/src/client/theme/ui/Loading/index.ts +1 -0
  89. package/src/client/theme/ui/Loading/loading.css +30 -0
  90. package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -0
  91. package/src/client/theme/ui/Navbar/Navbar.tsx +145 -0
  92. package/src/client/theme/ui/Navbar/index.ts +2 -0
  93. package/src/client/theme/ui/Navbar/navbar.css +233 -0
  94. package/src/client/theme/ui/NotFound/NotFound.tsx +20 -0
  95. package/src/client/theme/ui/NotFound/index.ts +1 -0
  96. package/src/client/theme/ui/NotFound/not-found.css +64 -0
  97. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +192 -0
  98. package/src/client/theme/ui/OnThisPage/index.ts +1 -0
  99. package/src/client/theme/ui/OnThisPage/toc.css +132 -0
  100. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -0
  101. package/src/client/theme/ui/PoweredBy/index.ts +1 -0
  102. package/src/client/theme/ui/PoweredBy/powered-by.css +76 -0
  103. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -0
  104. package/src/client/theme/ui/SearchDialog/index.ts +1 -0
  105. package/src/client/theme/ui/SearchDialog/search.css +152 -0
  106. package/src/client/theme/ui/Sidebar/Sidebar.tsx +200 -0
  107. package/src/client/theme/ui/Sidebar/index.ts +1 -0
  108. package/src/client/theme/ui/Sidebar/sidebar.css +269 -0
  109. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -0
  110. package/src/client/theme/ui/ThemeToggle/index.ts +1 -0
  111. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -0
  112. package/src/client/theme/ui/VersionSwitcher/index.ts +1 -0
  113. package/src/client/utils.ts +26 -0
  114. package/src/node/cache.ts +94 -0
  115. package/src/node/cli/commands/config.ts +15 -0
  116. package/src/node/cli/commands/generate-css.ts +24 -0
  117. package/src/node/cli/constants.ts +70 -0
  118. package/src/node/cli/index.ts +22 -0
  119. package/src/node/config.ts +185 -0
  120. package/src/node/index.ts +21 -0
  121. package/src/node/mdx.ts +41 -0
  122. package/src/node/plugin/entry.ts +58 -0
  123. package/src/node/plugin/html.ts +55 -0
  124. package/src/node/plugin/index.ts +190 -0
  125. package/src/node/plugin/types.ts +11 -0
  126. package/src/node/routes/cache.ts +24 -0
  127. package/src/node/routes/index.ts +152 -0
  128. package/src/node/routes/parser.ts +127 -0
  129. package/src/node/routes/sorter.ts +42 -0
  130. package/src/node/routes/types.ts +49 -0
  131. package/src/node/ssg/index.ts +110 -0
  132. package/src/node/ssg/meta.ts +34 -0
  133. package/src/node/ssg/options.ts +13 -0
  134. package/src/node/ssg/sitemap.ts +54 -0
  135. package/src/node/utils.ts +134 -0
  136. package/tsconfig.json +20 -0
  137. package/tsup.config.ts +22 -0
@@ -0,0 +1,80 @@
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
+ );
@@ -0,0 +1,31 @@
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
+ }
@@ -0,0 +1,50 @@
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
+ }
@@ -0,0 +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
+ }
@@ -0,0 +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
+ }
@@ -0,0 +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
+ }
@@ -0,0 +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";