boltdocs 1.11.0 → 2.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 (46) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/dist/cache-7G6D532T.mjs +1 -0
  4. package/dist/chunk-A4HQPEPU.mjs +1 -0
  5. package/dist/chunk-BA5NH5HU.mjs +1 -0
  6. package/dist/chunk-BQCD3DWG.mjs +1 -0
  7. package/dist/chunk-H63UMKYF.mjs +1 -0
  8. package/dist/chunk-IWHRQHS7.mjs +1 -0
  9. package/dist/chunk-JZXLCA2E.mjs +1 -0
  10. package/dist/chunk-MFU7Q6WF.mjs +1 -0
  11. package/dist/chunk-QYPNX5UN.mjs +1 -0
  12. package/dist/chunk-XEAPSFMB.mjs +1 -0
  13. package/dist/client/components/mdx/index.d.mts +209 -0
  14. package/dist/client/components/mdx/index.d.ts +209 -0
  15. package/dist/client/components/mdx/index.js +1 -0
  16. package/dist/client/components/mdx/index.mjs +1 -0
  17. package/dist/client/hooks/index.d.mts +133 -0
  18. package/dist/client/hooks/index.d.ts +133 -0
  19. package/dist/client/hooks/index.js +1 -0
  20. package/dist/client/hooks/index.mjs +1 -0
  21. package/dist/client/index.d.mts +212 -0
  22. package/dist/client/index.d.ts +212 -0
  23. package/dist/client/index.js +1 -0
  24. package/dist/client/index.mjs +1 -0
  25. package/dist/client/ssr.d.mts +31 -0
  26. package/dist/client/ssr.d.ts +31 -0
  27. package/dist/client/ssr.js +1 -0
  28. package/dist/client/ssr.mjs +1 -0
  29. package/dist/config-CX4l-ZNp.d.mts +166 -0
  30. package/dist/config-CX4l-ZNp.d.ts +166 -0
  31. package/dist/node/index.d.mts +89 -0
  32. package/dist/node/index.d.ts +89 -0
  33. package/dist/node/index.js +57 -0
  34. package/dist/node/index.mjs +57 -0
  35. package/dist/search-dialog-EB3N4TYM.mjs +1 -0
  36. package/dist/types-BuZWFT7r.d.ts +159 -0
  37. package/dist/types-CvT-SGbK.d.mts +159 -0
  38. package/dist/use-routes-5bAtAAYX.d.mts +30 -0
  39. package/dist/use-routes-BefRXY3v.d.ts +30 -0
  40. package/package.json +10 -10
  41. package/src/client/app/index.tsx +9 -6
  42. package/src/client/types.ts +1 -1
  43. package/src/node/plugin/index.ts +0 -1
  44. package/src/node/routes/parser.ts +27 -32
  45. package/src/node/ssg/index.ts +29 -3
  46. package/src/node/utils.ts +23 -0
@@ -0,0 +1,212 @@
1
+ import { B as BoltdocsConfig } from '../config-CX4l-ZNp.mjs';
2
+ export { a as BoltdocsThemeConfig } from '../config-CX4l-ZNp.mjs';
3
+ import { a as CreateBoltdocsAppOptions, C as ComponentRoute, O as OnThisPageProps, S as SandboxOptions } from '../types-CvT-SGbK.mjs';
4
+ export { L as LayoutProps, b as SandboxEmbedOptions, c as SandboxFile, d as SandboxFiles } from '../types-CvT-SGbK.mjs';
5
+ export { u as useRoutes } from '../use-routes-5bAtAAYX.mjs';
6
+ import * as React$1 from 'react';
7
+ import React__default, { Component, ReactNode, ErrorInfo } from 'react';
8
+ import * as react_jsx_runtime from 'react/jsx-runtime';
9
+ export { Admonition, AdmonitionProps, Badge, BadgeProps, Button, ButtonProps, Card, CardProps, Cards, CardsProps, Caution, CodeBlock, ComponentPreview, ComponentPreviewProps, ComponentProps, ComponentPropsProps, CopyMarkdown, Danger, Field, FieldProps, FileTree, FileTreeProps, Image, ImageProps, Important, InfoBox, Link, LinkProps, List, ListProps, Note, Tab, TabProps, Table, TableProps, Tabs, TabsProps, Tip, Video, Warning } from './components/mdx/index.mjs';
10
+ import 'vite';
11
+ import 'class-variance-authority/types';
12
+ import 'react-aria-components';
13
+ import 'class-variance-authority';
14
+
15
+ /**
16
+ * Creates and mounts the Boltdocs documentation app.
17
+ *
18
+ * Usage:
19
+ * ```tsx
20
+ * import { createBoltdocsApp } from 'boltdocs/client'
21
+ * import routes from 'virtual:boltdocs-routes'
22
+ * import config from 'virtual:boltdocs-config'
23
+ * import 'boltdocs/style.css'
24
+ * import HomePage from './HomePage'
25
+ *
26
+ * createBoltdocsApp({
27
+ * target: '#root',
28
+ * routes,
29
+ * config,
30
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
31
+ * hot: import.meta.hot,
32
+ * homePage: HomePage,
33
+ * })
34
+ * ```
35
+ */
36
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
37
+
38
+ /**
39
+ * Hook to access the Boltdocs configuration.
40
+ */
41
+ declare function useConfig(): BoltdocsConfig;
42
+
43
+ type Theme = 'light' | 'dark';
44
+ interface ThemeContextType {
45
+ theme: Theme;
46
+ toggleTheme: () => void;
47
+ setTheme: (theme: Theme) => void;
48
+ }
49
+ declare function useTheme(): ThemeContextType;
50
+
51
+ type MdxComponentsType = Record<string, React__default.ComponentType<any>>;
52
+ declare function useMdxComponents(): MdxComponentsType;
53
+
54
+ /**
55
+ * Props shared by all layout slot components.
56
+ */
57
+ interface SlotProps {
58
+ children?: React__default.ReactNode;
59
+ className?: string;
60
+ style?: React__default.CSSProperties;
61
+ }
62
+ /**
63
+ * Root layout shell. Renders a full-height flex column.
64
+ *
65
+ * Usage:
66
+ * ```tsx
67
+ * <DocsLayout>
68
+ * <Navbar />
69
+ * <DocsLayout.Body>...</DocsLayout.Body>
70
+ * </DocsLayout>
71
+ * ```
72
+ */
73
+ declare function DocsLayoutRoot({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
74
+ /**
75
+ * Horizontal flex container for sidebar + content + toc.
76
+ */
77
+ declare function Body({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
78
+ /**
79
+ * Main scrollable content area.
80
+ */
81
+ declare function Content({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
82
+ /**
83
+ * Content header row (breadcrumbs + copy markdown).
84
+ */
85
+ declare function ContentHeader({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
86
+ /**
87
+ * Footer area inside the content section (page nav).
88
+ */
89
+ declare function ContentFooter({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
90
+ declare const DocsLayout: typeof DocsLayoutRoot & {
91
+ Body: typeof Body;
92
+ Content: typeof Content;
93
+ ContentHeader: typeof ContentHeader;
94
+ ContentFooter: typeof ContentFooter;
95
+ };
96
+
97
+ interface LayoutProps {
98
+ children: React.ReactNode;
99
+ }
100
+ /**
101
+ * The built-in default layout for Boltdocs.
102
+ * Users who create their own `layout.tsx` can import the same building blocks
103
+ * and rearrange, wrap, or replace any section.
104
+ */
105
+ declare function DefaultLayout({ children }: LayoutProps): react_jsx_runtime.JSX.Element;
106
+
107
+ declare function Navbar(): react_jsx_runtime.JSX.Element;
108
+
109
+ declare function Sidebar({ routes, config, }: {
110
+ routes: ComponentRoute[];
111
+ config: BoltdocsConfig;
112
+ }): react_jsx_runtime.JSX.Element;
113
+
114
+ declare function OnThisPage({ headings: rawHeadings, editLink, communityHelp, filePath, }: OnThisPageProps): react_jsx_runtime.JSX.Element | null;
115
+
116
+ interface HeadProps {
117
+ siteTitle: string;
118
+ siteDescription?: string;
119
+ routes: Array<{
120
+ path: string;
121
+ title: string;
122
+ description?: string;
123
+ }>;
124
+ }
125
+ declare function Head({ siteTitle, siteDescription, routes }: HeadProps): null;
126
+
127
+ declare function Breadcrumbs(): react_jsx_runtime.JSX.Element | null;
128
+
129
+ /**
130
+ * Component to display the previous and next page navigation buttons.
131
+ */
132
+ declare function PageNav(): react_jsx_runtime.JSX.Element | null;
133
+
134
+ /**
135
+ * A reading progress bar component that tracks the scroll position
136
+ * within the Boltdocs content area.
137
+ *
138
+ * It utilizes react-aria-components for accessibility and is fixed
139
+ * to the top of the viewport for a premium, non-intrusive UI experience.
140
+ */
141
+ declare function ProgressBar(): react_jsx_runtime.JSX.Element;
142
+
143
+ interface Props {
144
+ children?: ReactNode;
145
+ fallback?: ReactNode;
146
+ }
147
+ interface State {
148
+ hasError: boolean;
149
+ error?: Error;
150
+ }
151
+ declare class ErrorBoundary extends Component<Props, State> {
152
+ state: State;
153
+ static getDerivedStateFromError(error: Error): State;
154
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
155
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
156
+ }
157
+
158
+ declare function NotFound(): react_jsx_runtime.JSX.Element;
159
+
160
+ /**
161
+ * A premium loading component that includes an SVG fill animation
162
+ * and a synchronized progress indicator.
163
+ *
164
+ * It features a glassmorphism container and a Bolt-style SVG logo
165
+ * with a dynamic fill effect.
166
+ */
167
+ declare function Loading(): react_jsx_runtime.JSX.Element;
168
+
169
+ /**
170
+ * Helper to define a sandbox and get a URL for the CodeSandbox Define API.
171
+ * Uses the official SDK `getParameters` for proper LZ-string compression.
172
+ */
173
+ declare function defineSandbox(options: SandboxOptions): {
174
+ parameters: string;
175
+ url: string;
176
+ options: SandboxOptions;
177
+ };
178
+ /**
179
+ * CORE API: Open a CodeSandbox using a form POST to the Define API.
180
+ *
181
+ * Uses a hidden form + POST which avoids URL length limits and is the
182
+ * recommended approach from CodeSandbox documentation. The SDK's
183
+ * `getParameters` handles LZ-string compression internally.
184
+ */
185
+ declare function openSandbox(options: SandboxOptions): {
186
+ parameters: string;
187
+ url: string;
188
+ options: SandboxOptions;
189
+ };
190
+ /**
191
+ * Generate an embeddable iframe URL for a CodeSandbox.
192
+ *
193
+ * This gives you more control than `openSandbox` — you can embed the sandbox
194
+ * inline on the page rather than opening a new tab. The returned URL can be
195
+ * used as the `src` of an `<iframe>`.
196
+ *
197
+ * @example
198
+ * ```tsx
199
+ * const url = embedSandbox({
200
+ * files: { "index.js": { content: "console.log('hello')" } },
201
+ * embed: { view: "editor", theme: "dark" },
202
+ * }).url;
203
+ * // url → "https://codesandbox.io/api/v1/sandboxes/define?parameters=…&embed=1&view=editor&theme=dark"
204
+ * ```
205
+ */
206
+ declare function embedSandbox(options: SandboxOptions): {
207
+ parameters: string;
208
+ url: string;
209
+ options: SandboxOptions;
210
+ };
211
+
212
+ export { BoltdocsConfig, Breadcrumbs, ComponentRoute, CreateBoltdocsAppOptions, DefaultLayout, DocsLayout, ErrorBoundary, Head, Loading, Navbar, NotFound, OnThisPage, PageNav, ProgressBar, SandboxOptions, Sidebar, createBoltdocsApp, defineSandbox, embedSandbox, openSandbox, useConfig, useMdxComponents, useTheme };
@@ -0,0 +1,212 @@
1
+ import { B as BoltdocsConfig } from '../config-CX4l-ZNp.js';
2
+ export { a as BoltdocsThemeConfig } from '../config-CX4l-ZNp.js';
3
+ import { a as CreateBoltdocsAppOptions, C as ComponentRoute, O as OnThisPageProps, S as SandboxOptions } from '../types-BuZWFT7r.js';
4
+ export { L as LayoutProps, b as SandboxEmbedOptions, c as SandboxFile, d as SandboxFiles } from '../types-BuZWFT7r.js';
5
+ export { u as useRoutes } from '../use-routes-BefRXY3v.js';
6
+ import * as React$1 from 'react';
7
+ import React__default, { Component, ReactNode, ErrorInfo } from 'react';
8
+ import * as react_jsx_runtime from 'react/jsx-runtime';
9
+ export { Admonition, AdmonitionProps, Badge, BadgeProps, Button, ButtonProps, Card, CardProps, Cards, CardsProps, Caution, CodeBlock, ComponentPreview, ComponentPreviewProps, ComponentProps, ComponentPropsProps, CopyMarkdown, Danger, Field, FieldProps, FileTree, FileTreeProps, Image, ImageProps, Important, InfoBox, Link, LinkProps, List, ListProps, Note, Tab, TabProps, Table, TableProps, Tabs, TabsProps, Tip, Video, Warning } from './components/mdx/index.js';
10
+ import 'vite';
11
+ import 'class-variance-authority/types';
12
+ import 'react-aria-components';
13
+ import 'class-variance-authority';
14
+
15
+ /**
16
+ * Creates and mounts the Boltdocs documentation app.
17
+ *
18
+ * Usage:
19
+ * ```tsx
20
+ * import { createBoltdocsApp } from 'boltdocs/client'
21
+ * import routes from 'virtual:boltdocs-routes'
22
+ * import config from 'virtual:boltdocs-config'
23
+ * import 'boltdocs/style.css'
24
+ * import HomePage from './HomePage'
25
+ *
26
+ * createBoltdocsApp({
27
+ * target: '#root',
28
+ * routes,
29
+ * config,
30
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
31
+ * hot: import.meta.hot,
32
+ * homePage: HomePage,
33
+ * })
34
+ * ```
35
+ */
36
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
37
+
38
+ /**
39
+ * Hook to access the Boltdocs configuration.
40
+ */
41
+ declare function useConfig(): BoltdocsConfig;
42
+
43
+ type Theme = 'light' | 'dark';
44
+ interface ThemeContextType {
45
+ theme: Theme;
46
+ toggleTheme: () => void;
47
+ setTheme: (theme: Theme) => void;
48
+ }
49
+ declare function useTheme(): ThemeContextType;
50
+
51
+ type MdxComponentsType = Record<string, React__default.ComponentType<any>>;
52
+ declare function useMdxComponents(): MdxComponentsType;
53
+
54
+ /**
55
+ * Props shared by all layout slot components.
56
+ */
57
+ interface SlotProps {
58
+ children?: React__default.ReactNode;
59
+ className?: string;
60
+ style?: React__default.CSSProperties;
61
+ }
62
+ /**
63
+ * Root layout shell. Renders a full-height flex column.
64
+ *
65
+ * Usage:
66
+ * ```tsx
67
+ * <DocsLayout>
68
+ * <Navbar />
69
+ * <DocsLayout.Body>...</DocsLayout.Body>
70
+ * </DocsLayout>
71
+ * ```
72
+ */
73
+ declare function DocsLayoutRoot({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
74
+ /**
75
+ * Horizontal flex container for sidebar + content + toc.
76
+ */
77
+ declare function Body({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
78
+ /**
79
+ * Main scrollable content area.
80
+ */
81
+ declare function Content({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
82
+ /**
83
+ * Content header row (breadcrumbs + copy markdown).
84
+ */
85
+ declare function ContentHeader({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
86
+ /**
87
+ * Footer area inside the content section (page nav).
88
+ */
89
+ declare function ContentFooter({ children, className, style }: SlotProps): react_jsx_runtime.JSX.Element;
90
+ declare const DocsLayout: typeof DocsLayoutRoot & {
91
+ Body: typeof Body;
92
+ Content: typeof Content;
93
+ ContentHeader: typeof ContentHeader;
94
+ ContentFooter: typeof ContentFooter;
95
+ };
96
+
97
+ interface LayoutProps {
98
+ children: React.ReactNode;
99
+ }
100
+ /**
101
+ * The built-in default layout for Boltdocs.
102
+ * Users who create their own `layout.tsx` can import the same building blocks
103
+ * and rearrange, wrap, or replace any section.
104
+ */
105
+ declare function DefaultLayout({ children }: LayoutProps): react_jsx_runtime.JSX.Element;
106
+
107
+ declare function Navbar(): react_jsx_runtime.JSX.Element;
108
+
109
+ declare function Sidebar({ routes, config, }: {
110
+ routes: ComponentRoute[];
111
+ config: BoltdocsConfig;
112
+ }): react_jsx_runtime.JSX.Element;
113
+
114
+ declare function OnThisPage({ headings: rawHeadings, editLink, communityHelp, filePath, }: OnThisPageProps): react_jsx_runtime.JSX.Element | null;
115
+
116
+ interface HeadProps {
117
+ siteTitle: string;
118
+ siteDescription?: string;
119
+ routes: Array<{
120
+ path: string;
121
+ title: string;
122
+ description?: string;
123
+ }>;
124
+ }
125
+ declare function Head({ siteTitle, siteDescription, routes }: HeadProps): null;
126
+
127
+ declare function Breadcrumbs(): react_jsx_runtime.JSX.Element | null;
128
+
129
+ /**
130
+ * Component to display the previous and next page navigation buttons.
131
+ */
132
+ declare function PageNav(): react_jsx_runtime.JSX.Element | null;
133
+
134
+ /**
135
+ * A reading progress bar component that tracks the scroll position
136
+ * within the Boltdocs content area.
137
+ *
138
+ * It utilizes react-aria-components for accessibility and is fixed
139
+ * to the top of the viewport for a premium, non-intrusive UI experience.
140
+ */
141
+ declare function ProgressBar(): react_jsx_runtime.JSX.Element;
142
+
143
+ interface Props {
144
+ children?: ReactNode;
145
+ fallback?: ReactNode;
146
+ }
147
+ interface State {
148
+ hasError: boolean;
149
+ error?: Error;
150
+ }
151
+ declare class ErrorBoundary extends Component<Props, State> {
152
+ state: State;
153
+ static getDerivedStateFromError(error: Error): State;
154
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
155
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
156
+ }
157
+
158
+ declare function NotFound(): react_jsx_runtime.JSX.Element;
159
+
160
+ /**
161
+ * A premium loading component that includes an SVG fill animation
162
+ * and a synchronized progress indicator.
163
+ *
164
+ * It features a glassmorphism container and a Bolt-style SVG logo
165
+ * with a dynamic fill effect.
166
+ */
167
+ declare function Loading(): react_jsx_runtime.JSX.Element;
168
+
169
+ /**
170
+ * Helper to define a sandbox and get a URL for the CodeSandbox Define API.
171
+ * Uses the official SDK `getParameters` for proper LZ-string compression.
172
+ */
173
+ declare function defineSandbox(options: SandboxOptions): {
174
+ parameters: string;
175
+ url: string;
176
+ options: SandboxOptions;
177
+ };
178
+ /**
179
+ * CORE API: Open a CodeSandbox using a form POST to the Define API.
180
+ *
181
+ * Uses a hidden form + POST which avoids URL length limits and is the
182
+ * recommended approach from CodeSandbox documentation. The SDK's
183
+ * `getParameters` handles LZ-string compression internally.
184
+ */
185
+ declare function openSandbox(options: SandboxOptions): {
186
+ parameters: string;
187
+ url: string;
188
+ options: SandboxOptions;
189
+ };
190
+ /**
191
+ * Generate an embeddable iframe URL for a CodeSandbox.
192
+ *
193
+ * This gives you more control than `openSandbox` — you can embed the sandbox
194
+ * inline on the page rather than opening a new tab. The returned URL can be
195
+ * used as the `src` of an `<iframe>`.
196
+ *
197
+ * @example
198
+ * ```tsx
199
+ * const url = embedSandbox({
200
+ * files: { "index.js": { content: "console.log('hello')" } },
201
+ * embed: { view: "editor", theme: "dark" },
202
+ * }).url;
203
+ * // url → "https://codesandbox.io/api/v1/sandboxes/define?parameters=…&embed=1&view=editor&theme=dark"
204
+ * ```
205
+ */
206
+ declare function embedSandbox(options: SandboxOptions): {
207
+ parameters: string;
208
+ url: string;
209
+ options: SandboxOptions;
210
+ };
211
+
212
+ export { BoltdocsConfig, Breadcrumbs, ComponentRoute, CreateBoltdocsAppOptions, DefaultLayout, DocsLayout, ErrorBoundary, Head, Loading, Navbar, NotFound, OnThisPage, PageNav, ProgressBar, SandboxOptions, Sidebar, createBoltdocsApp, defineSandbox, embedSandbox, openSandbox, useConfig, useMdxComponents, useTheme };