boltdocs 2.4.1 → 2.5.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.
- package/CHANGELOG.md +16 -0
- package/dist/cache-3FOEPC2P.mjs +1 -0
- package/dist/chunk-ITFGVXPE.mjs +1 -0
- package/dist/chunk-TP5KMRD3.mjs +1 -0
- package/dist/chunk-UD2LQG2M.mjs +75 -0
- package/dist/chunk-Y4RE5KI7.mjs +1 -0
- package/dist/client/index.d.mts +1225 -14
- package/dist/client/index.d.ts +1225 -14
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/client/ssr.js +1 -1
- package/dist/client/ssr.mjs +1 -1
- package/dist/node/cli-entry.js +37 -35
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.d.mts +263 -1
- package/dist/node/index.d.ts +263 -1
- package/dist/node/index.js +34 -32
- package/dist/node/index.mjs +1 -1
- package/dist/package-TWC3BMZ7.mjs +1 -0
- package/dist/search-dialog-YBM4GYDR.mjs +1 -0
- package/package.json +46 -76
- package/src/client/components/primitives/breadcrumbs.tsx +10 -10
- package/src/client/components/primitives/index.ts +17 -16
- package/src/client/components/primitives/menu.tsx +11 -14
- package/src/client/components/primitives/navbar.tsx +29 -29
- package/src/client/components/primitives/navigation-menu.tsx +7 -9
- package/src/client/components/primitives/on-this-page.tsx +16 -18
- package/src/client/components/primitives/page-nav.tsx +10 -13
- package/src/client/components/primitives/search-dialog.tsx +17 -19
- package/src/client/components/primitives/sidebar.tsx +8 -10
- package/src/client/components/primitives/tabs.tsx +10 -12
- package/src/client/components/primitives/tooltip.tsx +3 -5
- package/src/client/components/ui-base/breadcrumbs.tsx +12 -15
- package/src/client/components/ui-base/copy-markdown.tsx +8 -10
- package/src/client/components/ui-base/navbar.tsx +10 -10
- package/src/client/components/ui-base/on-this-page.tsx +13 -12
- package/src/client/components/ui-base/page-nav.tsx +15 -15
- package/src/client/components/ui-base/search-dialog.tsx +13 -20
- package/src/client/components/ui-base/sidebar.tsx +9 -9
- package/src/client/components/ui-base/tabs.tsx +6 -7
- package/src/client/components/ui-base/theme-toggle.tsx +11 -11
- package/src/client/hooks/index.ts +12 -12
- package/src/client/index.ts +34 -11
- package/src/node/config.ts +48 -6
- package/src/node/errors.ts +44 -0
- package/src/node/index.ts +29 -2
- package/src/node/mdx/index.ts +9 -2
- package/src/node/plugin/index.ts +72 -4
- package/src/node/plugins/index.ts +17 -0
- package/src/node/plugins/plugin-errors.ts +62 -0
- package/src/node/plugins/plugin-lifecycle.ts +117 -0
- package/src/node/plugins/plugin-sandbox.ts +59 -0
- package/src/node/plugins/plugin-store.ts +54 -0
- package/src/node/plugins/plugin-types.ts +107 -0
- package/src/node/plugins/plugin-validator.ts +105 -0
- package/src/node/routes/parser.ts +35 -5
- package/src/node/schema/config.ts +208 -0
- package/src/node/schema/frontmatter.ts +17 -0
- package/src/node/security/constants/index.ts +10 -0
- package/src/node/security/csp.ts +31 -0
- package/src/node/security/headers.ts +27 -0
- package/src/node/utils.ts +153 -5
- package/tsup.config.ts +0 -6
- package/dist/base-ui/index.d.mts +0 -25
- package/dist/base-ui/index.d.ts +0 -25
- package/dist/base-ui/index.js +0 -1
- package/dist/base-ui/index.mjs +0 -1
- package/dist/cache-P6WK424C.mjs +0 -1
- package/dist/chunk-2DI3OGHV.mjs +0 -1
- package/dist/chunk-2Z5T6EAU.mjs +0 -1
- package/dist/chunk-64AJ5QLT.mjs +0 -1
- package/dist/chunk-DDX52BX4.mjs +0 -1
- package/dist/chunk-HRZDSFR5.mjs +0 -1
- package/dist/chunk-JD3RSDE4.mjs +0 -1
- package/dist/chunk-JZXLCA2E.mjs +0 -1
- package/dist/chunk-NBCYHLAA.mjs +0 -1
- package/dist/chunk-PPVDMDEL.mjs +0 -1
- package/dist/chunk-T3W44KWY.mjs +0 -1
- package/dist/chunk-UBE4CKOA.mjs +0 -1
- package/dist/chunk-UWT4AJTH.mjs +0 -73
- package/dist/chunk-WWJ7WKDI.mjs +0 -1
- package/dist/chunk-Y4RRHPXC.mjs +0 -1
- package/dist/client/types.d.mts +0 -3
- package/dist/client/types.d.ts +0 -3
- package/dist/client/types.js +0 -1
- package/dist/client/types.mjs +0 -0
- package/dist/copy-markdown--9yjpbyy.d.mts +0 -15
- package/dist/copy-markdown-l2MYkcG7.d.ts +0 -15
- package/dist/hooks/index.d.mts +0 -137
- package/dist/hooks/index.d.ts +0 -137
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/index.mjs +0 -1
- package/dist/integrations/index.d.mts +0 -48
- package/dist/integrations/index.d.ts +0 -48
- package/dist/integrations/index.js +0 -1
- package/dist/integrations/index.mjs +0 -1
- package/dist/link-DfBwCeZc.d.mts +0 -68
- package/dist/link-DfBwCeZc.d.ts +0 -68
- package/dist/loading-BwUos0wZ.d.mts +0 -57
- package/dist/loading-nlnUD01v.d.ts +0 -57
- package/dist/mdx/index.d.mts +0 -178
- package/dist/mdx/index.d.ts +0 -178
- package/dist/mdx/index.js +0 -1
- package/dist/mdx/index.mjs +0 -1
- package/dist/primitives/index.d.mts +0 -292
- package/dist/primitives/index.d.ts +0 -292
- package/dist/primitives/index.js +0 -1
- package/dist/primitives/index.mjs +0 -1
- package/dist/search-dialog-OONKKC5H.mjs +0 -1
- package/dist/types-opDA2E9-.d.mts +0 -394
- package/dist/types-opDA2E9-.d.ts +0 -394
- package/dist/use-routes-DNwgTRpU.d.ts +0 -29
- package/dist/use-routes-DrT80Eom.d.mts +0 -29
|
@@ -14,7 +14,7 @@ export interface TooltipProps extends Omit<RAC.TooltipProps, 'children'> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// Fixed type for TooltipContentProps to match RAC's internal expectations
|
|
17
|
-
export interface TooltipContentProps extends RAC.TooltipProps {}
|
|
17
|
+
export interface TooltipContentProps extends RAC.TooltipProps { }
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Modern, accessible Tooltip component built with React Aria Components.
|
|
@@ -77,7 +77,5 @@ export const Tooltip = ({
|
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
TooltipContent,
|
|
83
|
-
}
|
|
80
|
+
Tooltip.Root = Tooltip
|
|
81
|
+
Tooltip.Content = TooltipContent
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { useBreadcrumbs } from '@hooks/use-breadcrumbs'
|
|
2
2
|
import { Home } from 'lucide-react'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
BreadcrumbsLink,
|
|
6
|
-
BreadcrumbsRoot,
|
|
7
|
-
BreadcrumbsSeparator,
|
|
4
|
+
Breadcrumbs as BreadcrumbsRoot,
|
|
8
5
|
} from '@components/primitives/breadcrumbs'
|
|
9
6
|
import { cn } from '@client/utils/cn'
|
|
10
7
|
import { useConfig } from '@client/app/config-context'
|
|
@@ -19,25 +16,25 @@ export function Breadcrumbs() {
|
|
|
19
16
|
if (!themeConfig?.breadcrumbs) return null
|
|
20
17
|
|
|
21
18
|
return (
|
|
22
|
-
<BreadcrumbsRoot>
|
|
23
|
-
<
|
|
24
|
-
<
|
|
19
|
+
<BreadcrumbsRoot.Root>
|
|
20
|
+
<BreadcrumbsRoot.Item>
|
|
21
|
+
<BreadcrumbsRoot.Link href="/">
|
|
25
22
|
<Home size={14} />
|
|
26
|
-
</
|
|
27
|
-
</
|
|
23
|
+
</BreadcrumbsRoot.Link>
|
|
24
|
+
</BreadcrumbsRoot.Item>
|
|
28
25
|
{crumbs.map((crumb, i) => (
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
26
|
+
<BreadcrumbsRoot.Item key={`crumb-${crumb.href}-${crumb.label}-${i}`}>
|
|
27
|
+
<BreadcrumbsRoot.Separator />
|
|
28
|
+
<BreadcrumbsRoot.Link
|
|
32
29
|
href={crumb.href}
|
|
33
30
|
className={cn({
|
|
34
31
|
'font-medium text-text-main': crumb.href === activeRoute?.path,
|
|
35
32
|
})}
|
|
36
33
|
>
|
|
37
34
|
{crumb.label}
|
|
38
|
-
</
|
|
39
|
-
</
|
|
35
|
+
</BreadcrumbsRoot.Link>
|
|
36
|
+
</BreadcrumbsRoot.Item>
|
|
40
37
|
))}
|
|
41
|
-
</BreadcrumbsRoot>
|
|
38
|
+
</BreadcrumbsRoot.Root>
|
|
42
39
|
)
|
|
43
40
|
}
|
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
Button,
|
|
5
5
|
ButtonGroup,
|
|
6
6
|
Menu,
|
|
7
|
-
MenuItem,
|
|
8
|
-
MenuTrigger,
|
|
9
7
|
cn,
|
|
10
8
|
} from '@client/components/primitives'
|
|
11
9
|
|
|
@@ -69,7 +67,7 @@ export function CopyMarkdown({ content, mdxRaw, config }: CopyMarkdownProps) {
|
|
|
69
67
|
{copied ? 'Copied!' : buttonText}
|
|
70
68
|
</Button>
|
|
71
69
|
|
|
72
|
-
<
|
|
70
|
+
<Menu.Trigger placement="bottom end">
|
|
73
71
|
<Button
|
|
74
72
|
variant="ghost"
|
|
75
73
|
isIconOnly
|
|
@@ -79,8 +77,8 @@ export function CopyMarkdown({ content, mdxRaw, config }: CopyMarkdownProps) {
|
|
|
79
77
|
'transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500',
|
|
80
78
|
)}
|
|
81
79
|
/>
|
|
82
|
-
<Menu className="w-52">
|
|
83
|
-
<
|
|
80
|
+
<Menu.Root className="w-52">
|
|
81
|
+
<Menu.Item onAction={handleCopy}>
|
|
84
82
|
<Copy
|
|
85
83
|
size={16}
|
|
86
84
|
className="size-4 mt-0.5 text-text-muted group-hover:text-primary-500"
|
|
@@ -88,8 +86,8 @@ export function CopyMarkdown({ content, mdxRaw, config }: CopyMarkdownProps) {
|
|
|
88
86
|
<span className="font-medium text-[0.8125rem]">
|
|
89
87
|
Copy Markdown
|
|
90
88
|
</span>
|
|
91
|
-
</
|
|
92
|
-
<
|
|
89
|
+
</Menu.Item>
|
|
90
|
+
<Menu.Item onAction={handleOpenRaw}>
|
|
93
91
|
<ExternalLink
|
|
94
92
|
size={16}
|
|
95
93
|
className="size-4 mt-0.5 text-text-muted group-hover:text-primary-500"
|
|
@@ -97,9 +95,9 @@ export function CopyMarkdown({ content, mdxRaw, config }: CopyMarkdownProps) {
|
|
|
97
95
|
<span className="font-medium text-[0.8125rem]">
|
|
98
96
|
View as Markdown
|
|
99
97
|
</span>
|
|
100
|
-
</
|
|
101
|
-
</Menu>
|
|
102
|
-
</
|
|
98
|
+
</Menu.Item>
|
|
99
|
+
</Menu.Root>
|
|
100
|
+
</Menu.Trigger>
|
|
103
101
|
</ButtonGroup>
|
|
104
102
|
</div>
|
|
105
103
|
)
|
|
@@ -9,7 +9,7 @@ import { GithubStars } from './github-stars'
|
|
|
9
9
|
import { Tabs } from './tabs'
|
|
10
10
|
import { useLocation } from 'react-router-dom'
|
|
11
11
|
import type { BoltdocsSocialLink } from '@node/config'
|
|
12
|
-
import Menu from '@components/primitives/menu'
|
|
12
|
+
import { Menu } from '@components/primitives/menu'
|
|
13
13
|
import { Button } from '@components/primitives/button'
|
|
14
14
|
import { ChevronDown, Languages } from 'lucide-react'
|
|
15
15
|
import { useLocalizedTo } from '@hooks/use-localized-to'
|
|
@@ -30,11 +30,11 @@ export function Navbar() {
|
|
|
30
30
|
const hasTabs = themeConfig?.tabs && themeConfig.tabs.length > 0
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<NavbarPrimitive.
|
|
33
|
+
<NavbarPrimitive.Root className={hasTabs ? 'border-b-0' : ''}>
|
|
34
34
|
<NavbarPrimitive.Content>
|
|
35
|
-
<NavbarPrimitive.
|
|
35
|
+
<NavbarPrimitive.Left>
|
|
36
36
|
{logo && (
|
|
37
|
-
<NavbarPrimitive.
|
|
37
|
+
<NavbarPrimitive.Logo
|
|
38
38
|
src={logo}
|
|
39
39
|
alt={logoProps?.alt || title}
|
|
40
40
|
width={logoProps?.width ?? 24}
|
|
@@ -44,8 +44,8 @@ export function Navbar() {
|
|
|
44
44
|
<NavbarPrimitive.Title>{title}</NavbarPrimitive.Title>
|
|
45
45
|
|
|
46
46
|
{config.versions && currentVersion && <NavbarVersion />}
|
|
47
|
-
</NavbarPrimitive.
|
|
48
|
-
<NavbarPrimitive.
|
|
47
|
+
</NavbarPrimitive.Left>
|
|
48
|
+
<NavbarPrimitive.Center>
|
|
49
49
|
<Suspense
|
|
50
50
|
fallback={
|
|
51
51
|
<div className="h-9 w-32 animate-pulse rounded-md bg-bg-surface" />
|
|
@@ -53,8 +53,8 @@ export function Navbar() {
|
|
|
53
53
|
>
|
|
54
54
|
<SearchDialog routes={routes || []} />
|
|
55
55
|
</Suspense>
|
|
56
|
-
</NavbarPrimitive.
|
|
57
|
-
<NavbarPrimitive.
|
|
56
|
+
</NavbarPrimitive.Center>
|
|
57
|
+
<NavbarPrimitive.Right>
|
|
58
58
|
<NavbarPrimitive.Links>
|
|
59
59
|
{links.map((link) => (
|
|
60
60
|
<>
|
|
@@ -77,7 +77,7 @@ export function Navbar() {
|
|
|
77
77
|
/>
|
|
78
78
|
))}
|
|
79
79
|
</div>
|
|
80
|
-
</NavbarPrimitive.
|
|
80
|
+
</NavbarPrimitive.Right>
|
|
81
81
|
</NavbarPrimitive.Content>
|
|
82
82
|
|
|
83
83
|
{isDocs && hasTabs && themeConfig?.tabs && (
|
|
@@ -85,7 +85,7 @@ export function Navbar() {
|
|
|
85
85
|
<Tabs tabs={themeConfig.tabs} routes={allRoutes || routes || []} />
|
|
86
86
|
</div>
|
|
87
87
|
)}
|
|
88
|
-
</NavbarPrimitive.
|
|
88
|
+
</NavbarPrimitive.Root>
|
|
89
89
|
)
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
OnThisPage as OTP,
|
|
2
3
|
AnchorProvider,
|
|
3
4
|
ScrollProvider,
|
|
4
5
|
useActiveAnchor,
|
|
@@ -81,35 +82,35 @@ function OnThisPageInner({
|
|
|
81
82
|
)
|
|
82
83
|
|
|
83
84
|
return (
|
|
84
|
-
<OTP.
|
|
85
|
-
<OTP.
|
|
85
|
+
<OTP.Root>
|
|
86
|
+
<OTP.Header className="flex flex-row gap-x-2">
|
|
86
87
|
<TextAlignStart size={16} />
|
|
87
88
|
On this page
|
|
88
|
-
</OTP.
|
|
89
|
+
</OTP.Header>
|
|
89
90
|
<ScrollProvider containerRef={scrollContainerRef}>
|
|
90
|
-
<OTP.
|
|
91
|
+
<OTP.Content
|
|
91
92
|
className="max-h-[450px] boltdocs-otp-scroll-area"
|
|
92
93
|
ref={scrollContainerRef}
|
|
93
94
|
>
|
|
94
|
-
<OTP.
|
|
95
|
+
<OTP.Indicator style={indicatorStyle} />
|
|
95
96
|
<ul
|
|
96
97
|
className="relative space-y-2 border-l border-border-subtle"
|
|
97
98
|
ref={listRef}
|
|
98
99
|
>
|
|
99
100
|
{headings.map((h) => (
|
|
100
|
-
<OTP.
|
|
101
|
-
<OTP.
|
|
101
|
+
<OTP.Item key={h.id} level={h.level}>
|
|
102
|
+
<OTP.Link
|
|
102
103
|
href={`#${h.id}`}
|
|
103
104
|
active={activeId === h.id}
|
|
104
105
|
onClick={(e) => handleClick(e, h.id)}
|
|
105
106
|
className="pl-4"
|
|
106
107
|
>
|
|
107
108
|
{h.text}
|
|
108
|
-
</OTP.
|
|
109
|
-
</OTP.
|
|
109
|
+
</OTP.Link>
|
|
110
|
+
</OTP.Item>
|
|
110
111
|
))}
|
|
111
112
|
</ul>
|
|
112
|
-
</OTP.
|
|
113
|
+
</OTP.Content>
|
|
113
114
|
</ScrollProvider>
|
|
114
115
|
|
|
115
116
|
{(editLink || communityHelp) && (
|
|
@@ -147,6 +148,6 @@ function OnThisPageInner({
|
|
|
147
148
|
</ul>
|
|
148
149
|
</div>
|
|
149
150
|
)}
|
|
150
|
-
</OTP.
|
|
151
|
+
</OTP.Root>
|
|
151
152
|
)
|
|
152
153
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { usePageNav } from '@hooks/use-page-nav'
|
|
2
|
-
import PageNavPrimitive from '@components/primitives/page-nav'
|
|
2
|
+
import { PageNav as PageNavPrimitive } from '@components/primitives/page-nav'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Component to display the previous and next page navigation buttons.
|
|
@@ -11,30 +11,30 @@ export function PageNav() {
|
|
|
11
11
|
if (!prevPage && !nextPage) return null
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<PageNavPrimitive.
|
|
14
|
+
<PageNavPrimitive.Root className="animate-in fade-in slide-in-from-bottom-4 duration-700">
|
|
15
15
|
{prevPage ? (
|
|
16
|
-
<PageNavPrimitive.
|
|
17
|
-
<PageNavPrimitive.
|
|
16
|
+
<PageNavPrimitive.Link to={prevPage.path} direction="prev">
|
|
17
|
+
<PageNavPrimitive.Title>
|
|
18
18
|
Previous
|
|
19
|
-
</PageNavPrimitive.
|
|
20
|
-
<PageNavPrimitive.
|
|
19
|
+
</PageNavPrimitive.Title>
|
|
20
|
+
<PageNavPrimitive.Description>
|
|
21
21
|
{prevPage.title}
|
|
22
|
-
</PageNavPrimitive.
|
|
23
|
-
</PageNavPrimitive.
|
|
22
|
+
</PageNavPrimitive.Description>
|
|
23
|
+
</PageNavPrimitive.Link>
|
|
24
24
|
) : (
|
|
25
25
|
<div />
|
|
26
26
|
)}
|
|
27
27
|
|
|
28
28
|
{nextPage && (
|
|
29
|
-
<PageNavPrimitive.
|
|
30
|
-
<PageNavPrimitive.
|
|
29
|
+
<PageNavPrimitive.Link to={nextPage.path} direction="next">
|
|
30
|
+
<PageNavPrimitive.Title>
|
|
31
31
|
Next
|
|
32
|
-
</PageNavPrimitive.
|
|
33
|
-
<PageNavPrimitive.
|
|
32
|
+
</PageNavPrimitive.Title>
|
|
33
|
+
<PageNavPrimitive.Description>
|
|
34
34
|
{nextPage.title}
|
|
35
|
-
</PageNavPrimitive.
|
|
36
|
-
</PageNavPrimitive.
|
|
35
|
+
</PageNavPrimitive.Description>
|
|
36
|
+
</PageNavPrimitive.Link>
|
|
37
37
|
)}
|
|
38
|
-
</PageNavPrimitive.
|
|
38
|
+
</PageNavPrimitive.Root>
|
|
39
39
|
)
|
|
40
40
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { useEffect, useCallback } from 'react'
|
|
2
2
|
import { useSearch } from '@hooks/use-search'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
SearchDialogInput,
|
|
6
|
-
SearchDialogItemBio,
|
|
7
|
-
SearchDialogItemIcon,
|
|
8
|
-
SearchDialogItemRoot,
|
|
9
|
-
SearchDialogItemTitle,
|
|
10
|
-
SearchDialogList,
|
|
11
|
-
SearchDialogRoot,
|
|
4
|
+
SearchDialog as SearchDialogPrimitive,
|
|
12
5
|
} from '@components/primitives/search-dialog'
|
|
13
6
|
import Navbar from '@components/primitives/navbar'
|
|
14
7
|
import { useNavigate } from 'react-router-dom'
|
|
@@ -63,31 +56,31 @@ export function SearchDialog({ routes }: { routes: ComponentRoute[] }) {
|
|
|
63
56
|
<>
|
|
64
57
|
<Navbar.SearchTrigger onPress={() => setIsOpen(true)} />
|
|
65
58
|
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
<
|
|
59
|
+
<SearchDialogPrimitive.Root isOpen={isOpen} onOpenChange={setIsOpen}>
|
|
60
|
+
<SearchDialogPrimitive.Autocomplete onSelectionChange={handleSelect}>
|
|
61
|
+
<SearchDialogPrimitive.Input
|
|
69
62
|
value={query}
|
|
70
63
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
71
64
|
setQuery(e.target.value)
|
|
72
65
|
}
|
|
73
66
|
/>
|
|
74
|
-
<
|
|
67
|
+
<SearchDialogPrimitive.List items={list as SearchResult[]}>
|
|
75
68
|
{(item: SearchResult) => (
|
|
76
|
-
<
|
|
69
|
+
<SearchDialogPrimitive.Item
|
|
77
70
|
key={item.id}
|
|
78
71
|
onPress={() => handleSelect(item.id)}
|
|
79
72
|
textValue={item.title}
|
|
80
73
|
>
|
|
81
|
-
<
|
|
74
|
+
<SearchDialogPrimitive.Item.Icon isHeading={item.isHeading} />
|
|
82
75
|
<div className="flex flex-col justify-center gap-0.5">
|
|
83
|
-
<
|
|
84
|
-
<
|
|
76
|
+
<SearchDialogPrimitive.Item.Title>{item.title}</SearchDialogPrimitive.Item.Title>
|
|
77
|
+
<SearchDialogPrimitive.Item.Bio>{item.bio}</SearchDialogPrimitive.Item.Bio>
|
|
85
78
|
</div>
|
|
86
|
-
</
|
|
79
|
+
</SearchDialogPrimitive.Item>
|
|
87
80
|
)}
|
|
88
|
-
</
|
|
89
|
-
</
|
|
90
|
-
</
|
|
81
|
+
</SearchDialogPrimitive.List>
|
|
82
|
+
</SearchDialogPrimitive.Autocomplete>
|
|
83
|
+
</SearchDialogPrimitive.Root>
|
|
91
84
|
</>
|
|
92
85
|
)
|
|
93
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, useMemo } from 'react'
|
|
2
2
|
import { useSidebar } from '@hooks/use-sidebar'
|
|
3
|
-
import SidebarPrimitive from '@components/primitives/sidebar'
|
|
3
|
+
import { Sidebar as SidebarPrimitive } from '@components/primitives/sidebar'
|
|
4
4
|
import { PoweredBy } from './powered-by'
|
|
5
5
|
import * as LucideIcons from 'lucide-react'
|
|
6
6
|
import type { ComponentRoute } from '@client/types'
|
|
@@ -41,7 +41,7 @@ function CollapsibleSidebarGroup({
|
|
|
41
41
|
}, [hasActiveRoute])
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<SidebarPrimitive.
|
|
44
|
+
<SidebarPrimitive.Group
|
|
45
45
|
title={group.title}
|
|
46
46
|
isOpen={isOpen}
|
|
47
47
|
onToggle={() => setIsOpen(!isOpen)}
|
|
@@ -51,7 +51,7 @@ function CollapsibleSidebarGroup({
|
|
|
51
51
|
activePath ===
|
|
52
52
|
(route.path.endsWith('/') ? route.path.slice(0, -1) : route.path)
|
|
53
53
|
return (
|
|
54
|
-
<SidebarPrimitive.
|
|
54
|
+
<SidebarPrimitive.Link
|
|
55
55
|
key={route.path}
|
|
56
56
|
label={route.title}
|
|
57
57
|
href={route.path}
|
|
@@ -61,7 +61,7 @@ function CollapsibleSidebarGroup({
|
|
|
61
61
|
/>
|
|
62
62
|
)
|
|
63
63
|
})}
|
|
64
|
-
</SidebarPrimitive.
|
|
64
|
+
</SidebarPrimitive.Group>
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -76,15 +76,15 @@ export function Sidebar({
|
|
|
76
76
|
const themeConfig = config.theme || {}
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<SidebarPrimitive.
|
|
79
|
+
<SidebarPrimitive.Root>
|
|
80
80
|
{ungrouped.length > 0 && (
|
|
81
|
-
<SidebarPrimitive.
|
|
81
|
+
<SidebarPrimitive.Group className="mb-6">
|
|
82
82
|
{ungrouped.map((route) => {
|
|
83
83
|
const isCurrent =
|
|
84
84
|
activePath ===
|
|
85
85
|
(route.path.endsWith('/') ? route.path.slice(0, -1) : route.path)
|
|
86
86
|
return (
|
|
87
|
-
<SidebarPrimitive.
|
|
87
|
+
<SidebarPrimitive.Link
|
|
88
88
|
key={route.path}
|
|
89
89
|
label={route.title}
|
|
90
90
|
href={route.path}
|
|
@@ -94,7 +94,7 @@ export function Sidebar({
|
|
|
94
94
|
/>
|
|
95
95
|
)
|
|
96
96
|
})}
|
|
97
|
-
</SidebarPrimitive.
|
|
97
|
+
</SidebarPrimitive.Group>
|
|
98
98
|
)}
|
|
99
99
|
|
|
100
100
|
{groups.map((group) => (
|
|
@@ -111,6 +111,6 @@ export function Sidebar({
|
|
|
111
111
|
<PoweredBy />
|
|
112
112
|
</div>
|
|
113
113
|
)}
|
|
114
|
-
</SidebarPrimitive.
|
|
114
|
+
</SidebarPrimitive.Root>
|
|
115
115
|
)
|
|
116
116
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTabs as useTabsHook } from '@hooks/use-tabs'
|
|
2
|
-
import T from '@components/primitives/tabs'
|
|
2
|
+
import { Tabs as T } from '@components/primitives/tabs'
|
|
3
3
|
import { Link } from '@components/primitives/link'
|
|
4
4
|
import type { BoltdocsTab, ComponentRoute } from '@client/types'
|
|
5
5
|
import * as Icons from 'lucide-react'
|
|
@@ -35,7 +35,7 @@ export function Tabs({
|
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<div className="mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6">
|
|
38
|
-
<T.
|
|
38
|
+
<T.List className="border-none py-0">
|
|
39
39
|
{tabs.map((tab, index) => {
|
|
40
40
|
const isActive = index === activeIndex
|
|
41
41
|
const firstRoute = routes.find(
|
|
@@ -50,19 +50,18 @@ export function Tabs({
|
|
|
50
50
|
ref={(el: HTMLAnchorElement | null) => {
|
|
51
51
|
tabRefs.current[index] = el
|
|
52
52
|
}}
|
|
53
|
-
className={`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors outline-none ${
|
|
54
|
-
isActive
|
|
53
|
+
className={`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors outline-none ${isActive
|
|
55
54
|
? 'text-primary-500'
|
|
56
55
|
: 'text-text-muted hover:text-text-main'
|
|
57
|
-
|
|
56
|
+
}`}
|
|
58
57
|
>
|
|
59
58
|
{renderTabIcon(tab.icon)}
|
|
60
59
|
<span>{getTranslated(tab.text, currentLocale)}</span>
|
|
61
60
|
</Link>
|
|
62
61
|
)
|
|
63
62
|
})}
|
|
64
|
-
<T.
|
|
65
|
-
</T.
|
|
63
|
+
<T.Indicator style={indicatorStyle} />
|
|
64
|
+
</T.List>
|
|
66
65
|
</div>
|
|
67
66
|
)
|
|
68
67
|
}
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
|
|
|
2
2
|
import { Sun, Moon, Monitor } from 'lucide-react'
|
|
3
3
|
import { useTheme } from '@client/app/theme-context'
|
|
4
4
|
import { Button } from 'react-aria-components'
|
|
5
|
-
import { Menu
|
|
5
|
+
import { Menu } from '@components/primitives/menu'
|
|
6
6
|
|
|
7
7
|
export function ThemeToggle() {
|
|
8
8
|
const { theme, setTheme } = useTheme()
|
|
@@ -19,14 +19,14 @@ export function ThemeToggle() {
|
|
|
19
19
|
const Icon = theme === 'system' ? Monitor : theme === 'dark' ? Moon : Sun
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
22
|
+
<Menu.Trigger placement="bottom right">
|
|
23
23
|
<Button
|
|
24
24
|
className="flex h-9 w-9 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-bg-surface hover:text-text-main outline-none focus-visible:ring-2 focus-visible:ring-primary-500"
|
|
25
25
|
aria-label="Selection theme"
|
|
26
26
|
>
|
|
27
27
|
<Icon size={20} className="animate-in fade-in zoom-in duration-300" />
|
|
28
28
|
</Button>
|
|
29
|
-
<Menu
|
|
29
|
+
<Menu.Root
|
|
30
30
|
selectionMode="single"
|
|
31
31
|
selectedKeys={[theme]}
|
|
32
32
|
onSelectionChange={(keys) => {
|
|
@@ -34,19 +34,19 @@ export function ThemeToggle() {
|
|
|
34
34
|
setTheme(newTheme)
|
|
35
35
|
}}
|
|
36
36
|
>
|
|
37
|
-
<
|
|
37
|
+
<Menu.Item id="light">
|
|
38
38
|
<Sun size={16} />
|
|
39
39
|
<span>Light</span>
|
|
40
|
-
</
|
|
41
|
-
<
|
|
40
|
+
</Menu.Item>
|
|
41
|
+
<Menu.Item id="dark">
|
|
42
42
|
<Moon size={16} />
|
|
43
43
|
<span>Dark</span>
|
|
44
|
-
</
|
|
45
|
-
<
|
|
44
|
+
</Menu.Item>
|
|
45
|
+
<Menu.Item id="system">
|
|
46
46
|
<Monitor size={16} />
|
|
47
47
|
<span>System</span>
|
|
48
|
-
</
|
|
49
|
-
</Menu>
|
|
50
|
-
</
|
|
48
|
+
</Menu.Item>
|
|
49
|
+
</Menu.Root>
|
|
50
|
+
</Menu.Trigger>
|
|
51
51
|
)
|
|
52
52
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
1
|
+
export { useNavbar } from './use-navbar'
|
|
2
|
+
export { useSidebar } from './use-sidebar'
|
|
3
|
+
export { useSearch } from './use-search'
|
|
4
|
+
export { useOnThisPage } from './use-onthispage'
|
|
5
|
+
export { useTabs } from './use-tabs'
|
|
6
|
+
export { useVersion } from './use-version'
|
|
7
|
+
export { useI18n } from './use-i18n'
|
|
8
|
+
export { usePageNav } from './use-page-nav'
|
|
9
|
+
export { useBreadcrumbs } from './use-breadcrumbs'
|
|
10
|
+
export { useRoutes } from './use-routes'
|
|
11
|
+
export { useLocalizedTo } from './use-localized-to'
|
|
12
|
+
export { useLocation } from './use-location'
|
package/src/client/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { useTheme } from '@client/app/theme-context'
|
|
|
10
10
|
export { useRoutes } from '@client/hooks/use-routes'
|
|
11
11
|
export { useMdxComponents } from '@client/app/mdx-components-context'
|
|
12
12
|
|
|
13
|
+
// Hooks
|
|
14
|
+
export * from '@hooks/index'
|
|
13
15
|
// Composable layout building blocks
|
|
14
16
|
export { DocsLayout } from '@components/docs-layout'
|
|
15
17
|
export { DefaultLayout } from '@components/default-layout'
|
|
@@ -28,18 +30,8 @@ export { NotFound } from '@components/ui-base/not-found'
|
|
|
28
30
|
export { Loading } from '@components/ui-base/loading'
|
|
29
31
|
export { CodeBlock } from '@components/mdx/code-block'
|
|
30
32
|
export { Video } from '@components/mdx/video'
|
|
31
|
-
export {
|
|
32
|
-
defineSandbox,
|
|
33
|
-
openSandbox,
|
|
34
|
-
embedSandbox,
|
|
35
|
-
} from '@integrations/codesandbox'
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
SandboxOptions,
|
|
39
|
-
SandboxFile,
|
|
40
|
-
SandboxFiles,
|
|
41
|
-
SandboxEmbedOptions,
|
|
42
|
-
} from './types'
|
|
34
|
+
// MDX Components
|
|
43
35
|
export {
|
|
44
36
|
Button,
|
|
45
37
|
Badge,
|
|
@@ -64,6 +56,7 @@ export {
|
|
|
64
56
|
Link,
|
|
65
57
|
Image,
|
|
66
58
|
} from './components/mdx'
|
|
59
|
+
|
|
67
60
|
export type {
|
|
68
61
|
ButtonProps,
|
|
69
62
|
BadgeProps,
|
|
@@ -81,3 +74,33 @@ export type {
|
|
|
81
74
|
LinkProps,
|
|
82
75
|
ImageProps,
|
|
83
76
|
} from './components/mdx'
|
|
77
|
+
|
|
78
|
+
// Primitives
|
|
79
|
+
export { Navbar as PrimitiveNavbar } from './components/primitives/navbar'
|
|
80
|
+
export { NavigationMenu as PrimitiveNavigationMenu } from './components/primitives/navigation-menu'
|
|
81
|
+
export { SearchDialog as SearchDialogPrimitive } from './components/primitives/search-dialog'
|
|
82
|
+
export {
|
|
83
|
+
OnThisPage as PrimitiveOnThisPage,
|
|
84
|
+
AnchorProvider,
|
|
85
|
+
ScrollProvider,
|
|
86
|
+
useActiveAnchor,
|
|
87
|
+
useActiveAnchors,
|
|
88
|
+
useItems,
|
|
89
|
+
} from './components/primitives/on-this-page'
|
|
90
|
+
export { PageNav as PrimitivePageNav } from './components/primitives/page-nav'
|
|
91
|
+
export { Tabs as PrimitiveTabs } from './components/primitives/tabs'
|
|
92
|
+
export { Sidebar as PrimitiveSidebar } from './components/primitives/sidebar'
|
|
93
|
+
export { Breadcrumbs as PrimitiveBreadcrumbs } from './components/primitives/breadcrumbs'
|
|
94
|
+
export { Button as PrimitiveButton } from './components/primitives/button'
|
|
95
|
+
export { ButtonGroup } from './components/primitives/button-group'
|
|
96
|
+
export { Menu as PrimitiveMenu } from './components/primitives/menu'
|
|
97
|
+
export { Popover as PrimitivePopover } from './components/primitives/popover'
|
|
98
|
+
export { Tooltip as PrimitiveTooltip } from './components/primitives/tooltip'
|
|
99
|
+
export {
|
|
100
|
+
Link as PrimitiveLink,
|
|
101
|
+
NavLink as PrimitiveNavLink,
|
|
102
|
+
} from './components/primitives/link'
|
|
103
|
+
export { Skeleton as PrimitiveSkeleton } from './components/primitives/skeleton'
|
|
104
|
+
|
|
105
|
+
// Utilities
|
|
106
|
+
export { cn } from './utils/cn'
|