@barodoc/theme-docs 3.0.0 → 6.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.
- package/package.json +6 -2
- package/src/components/Breadcrumb.astro +8 -8
- package/src/components/CodeCopy.astro +14 -13
- package/src/components/Contributors.astro +71 -0
- package/src/components/DocHeader.tsx +24 -24
- package/src/components/DocsSidebar.tsx +11 -15
- package/src/components/KeyboardShortcuts.astro +108 -0
- package/src/components/LanguageSwitcher.astro +3 -3
- package/src/components/MobileNavSheet.tsx +1 -1
- package/src/components/Search.tsx +10 -10
- package/src/components/SearchDialog.tsx +8 -8
- package/src/components/TableOfContents.astro +5 -5
- package/src/components/ThemeToggle.tsx +4 -4
- package/src/components/VersionSwitcher.tsx +79 -0
- package/src/components/api/ApiEndpoint.astro +5 -5
- package/src/components/api/ApiParam.astro +4 -4
- package/src/components/api/ApiParams.astro +3 -3
- package/src/components/api/ApiResponse.astro +2 -2
- package/src/components/index.ts +5 -0
- package/src/components/mdx/Accordion.tsx +6 -6
- package/src/components/mdx/ApiPlayground.tsx +200 -0
- package/src/components/mdx/Badge.tsx +1 -1
- package/src/components/mdx/Callout.astro +20 -20
- package/src/components/mdx/Card.astro +5 -5
- package/src/components/mdx/CodeGroup.astro +23 -20
- package/src/components/mdx/CodeGroup.tsx +6 -6
- package/src/components/mdx/DocAccordion.tsx +5 -5
- package/src/components/mdx/DocCard.tsx +2 -2
- package/src/components/mdx/DocTabs.tsx +3 -3
- package/src/components/mdx/Expandable.tsx +11 -11
- package/src/components/mdx/FileTree.tsx +6 -6
- package/src/components/mdx/Frame.tsx +2 -2
- package/src/components/mdx/ImageZoom.tsx +35 -0
- package/src/components/mdx/Mermaid.tsx +3 -3
- package/src/components/mdx/ParamField.tsx +7 -7
- package/src/components/mdx/ResponseField.tsx +6 -6
- package/src/components/mdx/Step.astro +2 -2
- package/src/components/mdx/Steps.astro +3 -3
- package/src/components/mdx/Steps.tsx +10 -19
- package/src/components/mdx/Tabs.tsx +5 -8
- package/src/components/mdx/Tooltip.tsx +20 -19
- package/src/components/mdx/Video.tsx +71 -0
- package/src/components/ui/accordion.tsx +2 -2
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/button.tsx +3 -3
- package/src/components/ui/card.tsx +2 -2
- package/src/components/ui/dialog.tsx +2 -2
- package/src/components/ui/scroll-area.tsx +1 -1
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +3 -3
- package/src/components/ui/tabs.tsx +2 -2
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/index.ts +33 -1
- package/src/layouts/BaseLayout.astro +10 -1
- package/src/layouts/BlogLayout.astro +93 -0
- package/src/layouts/DocsLayout.astro +72 -23
- package/src/pages/404.astro +5 -5
- package/src/pages/blog/[...slug].astro +39 -0
- package/src/pages/blog/index.astro +92 -0
- package/src/pages/changelog/index.astro +72 -0
- package/src/pages/docs/[...slug].astro +6 -2
- package/src/pages/index.astro +21 -21
- package/src/styles/global.css +1041 -166
|
@@ -9,9 +9,9 @@ interface Props {
|
|
|
9
9
|
const { titles = [] } = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<div class="code-group not-prose my-4 rounded-lg border border-[var(--
|
|
13
|
-
<div class="code-group-tabs flex flex-wrap gap-0 border-b border-[var(--
|
|
14
|
-
<div class="code-group-content bg-[var(--
|
|
12
|
+
<div class="code-group not-prose my-4 rounded-lg border border-[var(--bd-border)] overflow-hidden" data-titles={JSON.stringify(titles)}>
|
|
13
|
+
<div class="code-group-tabs flex flex-wrap gap-0 border-b border-[var(--bd-border)] bg-[var(--bd-bg-muted)]"></div>
|
|
14
|
+
<div class="code-group-content bg-[var(--bd-bg-subtle)]">
|
|
15
15
|
<slot />
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
@@ -21,37 +21,40 @@ const { titles = [] } = Astro.props;
|
|
|
21
21
|
document.querySelectorAll('.code-group').forEach((group) => {
|
|
22
22
|
const tabsContainer = group.querySelector('.code-group-tabs');
|
|
23
23
|
const contentContainer = group.querySelector('.code-group-content');
|
|
24
|
+
if (!tabsContainer || !contentContainer) return;
|
|
25
|
+
|
|
26
|
+
tabsContainer.innerHTML = '';
|
|
27
|
+
|
|
24
28
|
const fallbackTitles = JSON.parse(group.getAttribute('data-titles') || '[]');
|
|
25
29
|
|
|
26
|
-
const codeItems = contentContainer
|
|
27
|
-
const directPres = contentContainer
|
|
30
|
+
const codeItems = contentContainer.querySelectorAll(':scope > .code-item');
|
|
31
|
+
const directPres = contentContainer.querySelectorAll(':scope > pre');
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
const useCodeItems = (codeItems?.length ?? 0) > 0;
|
|
33
|
+
const useCodeItems = codeItems.length > 0;
|
|
31
34
|
const tabPanels = useCodeItems
|
|
32
|
-
? Array.from(codeItems
|
|
33
|
-
: Array.from(directPres
|
|
34
|
-
const titles = useCodeItems
|
|
35
|
-
? Array.from(codeItems
|
|
35
|
+
? Array.from(codeItems)
|
|
36
|
+
: Array.from(directPres);
|
|
37
|
+
const titles = useCodeItems
|
|
38
|
+
? Array.from(codeItems).map((el) => (el as HTMLElement).getAttribute('data-title') ?? '')
|
|
36
39
|
: fallbackTitles;
|
|
37
40
|
const numTabs = tabPanels.length;
|
|
38
41
|
|
|
39
|
-
if (
|
|
42
|
+
if (numTabs === 0) return;
|
|
40
43
|
|
|
41
44
|
// Create tabs from titles; show/hide tabPanels
|
|
42
45
|
tabPanels.forEach((_panel, index) => {
|
|
43
46
|
const tab = document.createElement('button');
|
|
44
|
-
tab.className = 'shrink-0 px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap text-[var(--
|
|
47
|
+
tab.className = 'shrink-0 px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap text-[var(--bd-text-muted)] hover:text-[var(--bd-text)]';
|
|
45
48
|
tab.textContent = titles[index]?.trim() || `Tab ${index + 1}`;
|
|
46
49
|
const panel = tabPanels[index] as HTMLElement;
|
|
47
50
|
tab.addEventListener('click', () => {
|
|
48
51
|
tabsContainer.querySelectorAll('button').forEach((t, i) => {
|
|
49
52
|
if (i === index) {
|
|
50
|
-
t.classList.add('border-b-2', 'border-primary-500', 'text-[var(--
|
|
51
|
-
t.classList.remove('text-[var(--
|
|
53
|
+
t.classList.add('border-b-2', 'border-primary-500', 'text-[var(--bd-text)]', '-mb-px');
|
|
54
|
+
t.classList.remove('text-[var(--bd-text-muted)]');
|
|
52
55
|
} else {
|
|
53
|
-
t.classList.remove('border-b-2', 'border-primary-500', 'text-[var(--
|
|
54
|
-
t.classList.add('text-[var(--
|
|
56
|
+
t.classList.remove('border-b-2', 'border-primary-500', 'text-[var(--bd-text)]', '-mb-px');
|
|
57
|
+
t.classList.add('text-[var(--bd-text-muted)]');
|
|
55
58
|
}
|
|
56
59
|
});
|
|
57
60
|
tabPanels.forEach((p, i) => {
|
|
@@ -61,8 +64,8 @@ const { titles = [] } = Astro.props;
|
|
|
61
64
|
tabsContainer.appendChild(tab);
|
|
62
65
|
|
|
63
66
|
if (index === 0) {
|
|
64
|
-
tab.classList.add('border-b-2', 'border-primary-500', 'text-[var(--
|
|
65
|
-
tab.classList.remove('text-[var(--
|
|
67
|
+
tab.classList.add('border-b-2', 'border-primary-500', 'text-[var(--bd-text)]', '-mb-px');
|
|
68
|
+
tab.classList.remove('text-[var(--bd-text-muted)]');
|
|
66
69
|
} else {
|
|
67
70
|
panel.style.display = 'none';
|
|
68
71
|
}
|
|
@@ -70,6 +73,6 @@ const { titles = [] } = Astro.props;
|
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
initCodeGroups();
|
|
74
76
|
document.addEventListener('astro:page-load', initCodeGroups);
|
|
77
|
+
if (document.readyState === 'complete') initCodeGroups();
|
|
75
78
|
</script>
|
|
@@ -72,16 +72,16 @@ export function CodeGroup({ children, titles = [] }: CodeGroupProps) {
|
|
|
72
72
|
|
|
73
73
|
if (codeBlocks.length === 0) {
|
|
74
74
|
return (
|
|
75
|
-
<div className="code-group not-prose my-4 rounded-lg border border-[var(--
|
|
75
|
+
<div className="code-group not-prose my-4 rounded-lg border border-[var(--bd-border)] overflow-hidden p-4 text-[var(--bd-text-muted)] text-sm">
|
|
76
76
|
No code blocks found inside CodeGroup.
|
|
77
77
|
</div>
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<div className="code-group not-prose my-4 rounded-lg border border-[var(--
|
|
82
|
+
<div className="code-group not-prose my-4 rounded-lg border border-[var(--bd-border)] overflow-hidden">
|
|
83
83
|
{/* Tabs */}
|
|
84
|
-
<div className="flex flex-wrap gap-0 bg-[var(--
|
|
84
|
+
<div className="flex flex-wrap gap-0 bg-[var(--bd-bg-muted)] border-b border-[var(--bd-border)]">
|
|
85
85
|
{tabTitles.map((title, index) => {
|
|
86
86
|
const isActive = activeIndex === index;
|
|
87
87
|
return (
|
|
@@ -91,8 +91,8 @@ export function CodeGroup({ children, titles = [] }: CodeGroupProps) {
|
|
|
91
91
|
onClick={() => setActiveIndex(index)}
|
|
92
92
|
className={`shrink-0 px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${
|
|
93
93
|
isActive
|
|
94
|
-
? "bg-[var(--
|
|
95
|
-
: "text-[var(--
|
|
94
|
+
? "bg-[var(--bd-bg-subtle)] text-[var(--bd-text)] border-b-2 border-primary-500 -mb-px"
|
|
95
|
+
: "text-[var(--bd-text-muted)] hover:text-[var(--bd-text)]"
|
|
96
96
|
}`}
|
|
97
97
|
>
|
|
98
98
|
{title}
|
|
@@ -102,7 +102,7 @@ export function CodeGroup({ children, titles = [] }: CodeGroupProps) {
|
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
{/* Content */}
|
|
105
|
-
<div className="bg-[var(--
|
|
105
|
+
<div className="bg-[var(--bd-bg-subtle)]">
|
|
106
106
|
{codeBlocks.map((block, index) => (
|
|
107
107
|
<div
|
|
108
108
|
key={index}
|
|
@@ -36,11 +36,11 @@ export function DocAccordion({
|
|
|
36
36
|
<AccordionItem
|
|
37
37
|
key={value}
|
|
38
38
|
value={value}
|
|
39
|
-
className="border-b border-[var(--
|
|
39
|
+
className="border-b border-[var(--bd-border)] last:border-b-0"
|
|
40
40
|
>
|
|
41
41
|
<div className="flex items-start gap-3 px-4">
|
|
42
42
|
{item.icon && (
|
|
43
|
-
<span className="flex items-center justify-center w-8 h-8 rounded-lg bg-[var(--
|
|
43
|
+
<span className="flex items-center justify-center w-8 h-8 rounded-lg bg-[var(--bd-bg-subtle)] text-lg shrink-0 mt-3">
|
|
44
44
|
{item.icon}
|
|
45
45
|
</span>
|
|
46
46
|
)}
|
|
@@ -48,7 +48,7 @@ export function DocAccordion({
|
|
|
48
48
|
<AccordionTrigger className="text-left">
|
|
49
49
|
{item.title}
|
|
50
50
|
</AccordionTrigger>
|
|
51
|
-
<AccordionContent className="text-[var(--
|
|
51
|
+
<AccordionContent className="text-[var(--bd-text-secondary)]">
|
|
52
52
|
{item.content}
|
|
53
53
|
</AccordionContent>
|
|
54
54
|
</div>
|
|
@@ -63,7 +63,7 @@ export function DocAccordion({
|
|
|
63
63
|
type="single"
|
|
64
64
|
collapsible={collapsible}
|
|
65
65
|
defaultValue={defaultValue as string}
|
|
66
|
-
className={cn("not-prose my-6 rounded-xl border border-[var(--
|
|
66
|
+
className={cn("not-prose my-6 rounded-xl border border-[var(--bd-border)] overflow-hidden", className)}
|
|
67
67
|
>
|
|
68
68
|
{renderItems()}
|
|
69
69
|
</Accordion>
|
|
@@ -74,7 +74,7 @@ export function DocAccordion({
|
|
|
74
74
|
<Accordion
|
|
75
75
|
type="multiple"
|
|
76
76
|
defaultValue={defaultValue as string[]}
|
|
77
|
-
className={cn("not-prose my-6 rounded-xl border border-[var(--
|
|
77
|
+
className={cn("not-prose my-6 rounded-xl border border-[var(--bd-border)] overflow-hidden", className)}
|
|
78
78
|
>
|
|
79
79
|
{renderItems()}
|
|
80
80
|
</Accordion>
|
|
@@ -24,7 +24,7 @@ export function DocCard({ title, icon, href, children }: DocCardProps) {
|
|
|
24
24
|
<div className="absolute inset-0 bg-gradient-to-br from-primary-50/50 to-transparent dark:from-primary-950/30 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" />
|
|
25
25
|
<CardHeader className="relative">
|
|
26
26
|
{icon && (
|
|
27
|
-
<div className="flex items-center justify-center w-10 h-10 rounded-lg bg-[var(--
|
|
27
|
+
<div className="flex items-center justify-center w-10 h-10 rounded-lg bg-[var(--bd-bg-subtle)] group-hover:bg-primary-50 dark:group-hover:bg-primary-950/50 mb-3 transition-colors">
|
|
28
28
|
<span className="text-xl">{icon}</span>
|
|
29
29
|
</div>
|
|
30
30
|
)}
|
|
@@ -33,7 +33,7 @@ export function DocCard({ title, icon, href, children }: DocCardProps) {
|
|
|
33
33
|
{title}
|
|
34
34
|
</CardTitle>
|
|
35
35
|
{href && (
|
|
36
|
-
<ChevronRight className="h-4 w-4 text-[var(--
|
|
36
|
+
<ChevronRight className="h-4 w-4 text-[var(--bd-text-muted)] opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200" />
|
|
37
37
|
)}
|
|
38
38
|
</div>
|
|
39
39
|
{children && (
|
|
@@ -19,12 +19,12 @@ export function DocTabs({ items, defaultValue, className }: DocTabsProps) {
|
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<Tabs defaultValue={defaultTab} className={cn("not-prose my-6", className)}>
|
|
22
|
-
<TabsList className="w-full justify-start bg-[var(--
|
|
22
|
+
<TabsList className="w-full justify-start bg-[var(--bd-bg-subtle)] rounded-lg p-1">
|
|
23
23
|
{items.map((item) => (
|
|
24
24
|
<TabsTrigger
|
|
25
25
|
key={item.value}
|
|
26
26
|
value={item.value}
|
|
27
|
-
className="data-[state=active]:bg-[var(--
|
|
27
|
+
className="data-[state=active]:bg-[var(--bd-bg)] data-[state=active]:shadow-sm"
|
|
28
28
|
>
|
|
29
29
|
{item.label}
|
|
30
30
|
</TabsTrigger>
|
|
@@ -34,7 +34,7 @@ export function DocTabs({ items, defaultValue, className }: DocTabsProps) {
|
|
|
34
34
|
<TabsContent
|
|
35
35
|
key={item.value}
|
|
36
36
|
value={item.value}
|
|
37
|
-
className="mt-4 rounded-lg border border-[var(--
|
|
37
|
+
className="mt-4 rounded-lg border border-[var(--bd-border)] bg-[var(--bd-bg-subtle)] p-4"
|
|
38
38
|
>
|
|
39
39
|
<div className="text-sm">
|
|
40
40
|
{item.children}
|
|
@@ -20,27 +20,27 @@ export function Expandable({
|
|
|
20
20
|
return (
|
|
21
21
|
<div
|
|
22
22
|
className={cn(
|
|
23
|
-
"not-prose border border-[var(--
|
|
23
|
+
"not-prose border border-[var(--bd-border)] rounded-lg overflow-hidden my-4",
|
|
24
24
|
className
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<button
|
|
28
28
|
type="button"
|
|
29
29
|
onClick={() => setIsOpen(!isOpen)}
|
|
30
|
-
className="flex w-full items-center justify-between px-4 py-3 bg-[var(--
|
|
30
|
+
className="flex w-full items-center justify-between px-4 py-3 bg-[var(--bd-bg-subtle)] hover:bg-[var(--bd-bg-muted)] transition-colors text-left"
|
|
31
31
|
>
|
|
32
|
-
<span className="text-sm font-medium text-[var(--
|
|
32
|
+
<span className="text-sm font-medium text-[var(--bd-text)]">
|
|
33
33
|
{title}
|
|
34
34
|
</span>
|
|
35
35
|
<ChevronDown
|
|
36
36
|
className={cn(
|
|
37
|
-
"h-4 w-4 text-[var(--
|
|
37
|
+
"h-4 w-4 text-[var(--bd-text-muted)] transition-transform",
|
|
38
38
|
isOpen && "rotate-180"
|
|
39
39
|
)}
|
|
40
40
|
/>
|
|
41
41
|
</button>
|
|
42
42
|
{isOpen && (
|
|
43
|
-
<div className="px-4 py-3 bg-[var(--
|
|
43
|
+
<div className="px-4 py-3 bg-[var(--bd-bg)] border-t border-[var(--bd-border)] text-sm text-[var(--bd-text-secondary)]">
|
|
44
44
|
{children}
|
|
45
45
|
</div>
|
|
46
46
|
)}
|
|
@@ -77,28 +77,28 @@ export function ExpandableItem({
|
|
|
77
77
|
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<div className="not-prose border-l-2 border-[var(--
|
|
80
|
+
<div className="not-prose border-l-2 border-[var(--bd-border)] pl-4">
|
|
81
81
|
<button
|
|
82
82
|
type="button"
|
|
83
83
|
onClick={() => setIsOpen(!isOpen)}
|
|
84
84
|
className="flex items-center gap-2 text-left group"
|
|
85
85
|
>
|
|
86
86
|
{isOpen ? (
|
|
87
|
-
<Minus className="h-3 w-3 text-[var(--
|
|
87
|
+
<Minus className="h-3 w-3 text-[var(--bd-text-muted)]" />
|
|
88
88
|
) : (
|
|
89
|
-
<Plus className="h-3 w-3 text-[var(--
|
|
89
|
+
<Plus className="h-3 w-3 text-[var(--bd-text-muted)]" />
|
|
90
90
|
)}
|
|
91
|
-
<code className="font-mono text-sm text-[var(--
|
|
91
|
+
<code className="font-mono text-sm text-[var(--bd-text)] group-hover:text-primary-600 dark:group-hover:text-primary-400">
|
|
92
92
|
{title}
|
|
93
93
|
</code>
|
|
94
94
|
{type && (
|
|
95
|
-
<span className="font-mono text-xs text-[var(--
|
|
95
|
+
<span className="font-mono text-xs text-[var(--bd-text-muted)]">
|
|
96
96
|
{type}
|
|
97
97
|
</span>
|
|
98
98
|
)}
|
|
99
99
|
</button>
|
|
100
100
|
{isOpen && (
|
|
101
|
-
<div className="mt-2 ml-5 text-sm text-[var(--
|
|
101
|
+
<div className="mt-2 ml-5 text-sm text-[var(--bd-text-secondary)]">
|
|
102
102
|
{children}
|
|
103
103
|
</div>
|
|
104
104
|
)}
|
|
@@ -9,7 +9,7 @@ interface FileTreeProps {
|
|
|
9
9
|
|
|
10
10
|
export function FileTree({ children, className }: FileTreeProps) {
|
|
11
11
|
return (
|
|
12
|
-
<div className={cn("not-prose my-4 rounded-lg border border-[var(--
|
|
12
|
+
<div className={cn("not-prose my-4 rounded-lg border border-[var(--bd-border)] bg-[var(--bd-bg-subtle)] p-4 font-mono text-sm", className)}>
|
|
13
13
|
<ul className="space-y-1">{children}</ul>
|
|
14
14
|
</div>
|
|
15
15
|
);
|
|
@@ -22,8 +22,8 @@ interface FileProps {
|
|
|
22
22
|
|
|
23
23
|
export function TreeFile({ name, icon }: FileProps) {
|
|
24
24
|
return (
|
|
25
|
-
<li className="flex items-center gap-2 py-0.5 text-[var(--
|
|
26
|
-
{icon || <File className="h-4 w-4 text-[var(--
|
|
25
|
+
<li className="flex items-center gap-2 py-0.5 text-[var(--bd-text-secondary)]">
|
|
26
|
+
{icon || <File className="h-4 w-4 text-[var(--bd-text-muted)]" />}
|
|
27
27
|
<span>{name}</span>
|
|
28
28
|
</li>
|
|
29
29
|
);
|
|
@@ -44,12 +44,12 @@ export function TreeFolder({ name, children, defaultOpen = false }: FolderProps)
|
|
|
44
44
|
<button
|
|
45
45
|
type="button"
|
|
46
46
|
onClick={() => setIsOpen(!isOpen)}
|
|
47
|
-
className="flex w-full items-center gap-1 py-0.5 text-[var(--
|
|
47
|
+
className="flex w-full items-center gap-1 py-0.5 text-[var(--bd-text)] hover:text-primary-600 dark:hover:text-primary-400 transition-colors"
|
|
48
48
|
>
|
|
49
49
|
{hasChildren && (
|
|
50
50
|
<ChevronRight
|
|
51
51
|
className={cn(
|
|
52
|
-
"h-3 w-3 text-[var(--
|
|
52
|
+
"h-3 w-3 text-[var(--bd-text-muted)] transition-transform",
|
|
53
53
|
isOpen && "rotate-90"
|
|
54
54
|
)}
|
|
55
55
|
/>
|
|
@@ -63,7 +63,7 @@ export function TreeFolder({ name, children, defaultOpen = false }: FolderProps)
|
|
|
63
63
|
<span className="font-medium">{name}</span>
|
|
64
64
|
</button>
|
|
65
65
|
{isOpen && hasChildren && (
|
|
66
|
-
<ul className="ml-4 border-l border-[var(--
|
|
66
|
+
<ul className="ml-4 border-l border-[var(--bd-border)] pl-3 mt-1 space-y-1">
|
|
67
67
|
{children}
|
|
68
68
|
</ul>
|
|
69
69
|
)}
|
|
@@ -10,11 +10,11 @@ interface FrameProps {
|
|
|
10
10
|
export function Frame({ children, caption, className }: FrameProps) {
|
|
11
11
|
return (
|
|
12
12
|
<figure className={cn("not-prose my-6", className)}>
|
|
13
|
-
<div className="overflow-hidden rounded-lg border border-[var(--
|
|
13
|
+
<div className="overflow-hidden rounded-lg border border-[var(--bd-border)] bg-[var(--bd-bg-subtle)]">
|
|
14
14
|
{children}
|
|
15
15
|
</div>
|
|
16
16
|
{caption && (
|
|
17
|
-
<figcaption className="mt-2 text-center text-sm text-[var(--
|
|
17
|
+
<figcaption className="mt-2 text-center text-sm text-[var(--bd-text-muted)]">
|
|
18
18
|
{caption}
|
|
19
19
|
</figcaption>
|
|
20
20
|
)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import mediumZoom from "medium-zoom";
|
|
3
|
+
import type { Zoom } from "medium-zoom";
|
|
4
|
+
|
|
5
|
+
interface ImageZoomProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
6
|
+
zoomSrc?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ImageZoom({ zoomSrc, ...props }: ImageZoomProps) {
|
|
10
|
+
const imgRef = React.useRef<HTMLImageElement>(null);
|
|
11
|
+
const zoomRef = React.useRef<Zoom | null>(null);
|
|
12
|
+
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (!imgRef.current) return;
|
|
15
|
+
|
|
16
|
+
zoomRef.current = mediumZoom(imgRef.current, {
|
|
17
|
+
margin: 24,
|
|
18
|
+
background: "var(--bd-bg)",
|
|
19
|
+
scrollOffset: 0,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return () => {
|
|
23
|
+
zoomRef.current?.detach();
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<img
|
|
29
|
+
ref={imgRef}
|
|
30
|
+
data-zoom-src={zoomSrc}
|
|
31
|
+
className="bd-image-zoom"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -78,8 +78,8 @@ export function Mermaid({ chart, className }: MermaidProps) {
|
|
|
78
78
|
|
|
79
79
|
if (!svg) {
|
|
80
80
|
return (
|
|
81
|
-
<div className={cn("not-prose my-4 flex items-center justify-center p-8 bg-[var(--
|
|
82
|
-
<div className="text-sm text-[var(--
|
|
81
|
+
<div className={cn("not-prose my-4 flex items-center justify-center p-8 bg-[var(--bd-bg-subtle)] rounded-lg", className)}>
|
|
82
|
+
<div className="text-sm text-[var(--bd-text-muted)]">Loading diagram...</div>
|
|
83
83
|
</div>
|
|
84
84
|
);
|
|
85
85
|
}
|
|
@@ -87,7 +87,7 @@ export function Mermaid({ chart, className }: MermaidProps) {
|
|
|
87
87
|
return (
|
|
88
88
|
<div
|
|
89
89
|
ref={containerRef}
|
|
90
|
-
className={cn("not-prose my-4 flex justify-center overflow-x-auto rounded-lg bg-[var(--
|
|
90
|
+
className={cn("not-prose my-4 flex justify-center overflow-x-auto rounded-lg bg-[var(--bd-bg)] p-4", className)}
|
|
91
91
|
dangerouslySetInnerHTML={{ __html: svg }}
|
|
92
92
|
/>
|
|
93
93
|
);
|
|
@@ -21,16 +21,16 @@ export function ParamField({
|
|
|
21
21
|
return (
|
|
22
22
|
<div
|
|
23
23
|
className={cn(
|
|
24
|
-
"not-prose border-b border-[var(--
|
|
24
|
+
"not-prose border-b border-[var(--bd-border)] py-4 last:border-b-0",
|
|
25
25
|
className
|
|
26
26
|
)}
|
|
27
27
|
>
|
|
28
28
|
<div className="flex flex-wrap items-baseline gap-2">
|
|
29
|
-
<code className="font-mono text-sm font-semibold text-[var(--
|
|
29
|
+
<code className="font-mono text-sm font-semibold text-[var(--bd-text)]">
|
|
30
30
|
{name}
|
|
31
31
|
</code>
|
|
32
32
|
{type && (
|
|
33
|
-
<span className="font-mono text-xs text-[var(--
|
|
33
|
+
<span className="font-mono text-xs text-[var(--bd-text-muted)]">
|
|
34
34
|
{type}
|
|
35
35
|
</span>
|
|
36
36
|
)}
|
|
@@ -40,13 +40,13 @@ export function ParamField({
|
|
|
40
40
|
</span>
|
|
41
41
|
)}
|
|
42
42
|
{defaultValue && (
|
|
43
|
-
<span className="text-xs text-[var(--
|
|
43
|
+
<span className="text-xs text-[var(--bd-text-muted)]">
|
|
44
44
|
default: <code className="font-mono">{defaultValue}</code>
|
|
45
45
|
</span>
|
|
46
46
|
)}
|
|
47
47
|
</div>
|
|
48
48
|
{children && (
|
|
49
|
-
<div className="mt-2 text-sm text-[var(--
|
|
49
|
+
<div className="mt-2 text-sm text-[var(--bd-text-secondary)] prose prose-sm dark:prose-invert max-w-none">
|
|
50
50
|
{children}
|
|
51
51
|
</div>
|
|
52
52
|
)}
|
|
@@ -64,11 +64,11 @@ export function ParamFieldGroup({ children, title, className }: ParamFieldGroupP
|
|
|
64
64
|
return (
|
|
65
65
|
<div className={cn("my-6", className)}>
|
|
66
66
|
{title && (
|
|
67
|
-
<h4 className="text-sm font-semibold text-[var(--
|
|
67
|
+
<h4 className="text-sm font-semibold text-[var(--bd-text)] mb-4 uppercase tracking-wide">
|
|
68
68
|
{title}
|
|
69
69
|
</h4>
|
|
70
70
|
)}
|
|
71
|
-
<div className="rounded-lg border border-[var(--
|
|
71
|
+
<div className="rounded-lg border border-[var(--bd-border)] bg-[var(--bd-bg)] px-4">
|
|
72
72
|
{children}
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
@@ -17,22 +17,22 @@ export function ResponseField({
|
|
|
17
17
|
return (
|
|
18
18
|
<div
|
|
19
19
|
className={cn(
|
|
20
|
-
"not-prose border-b border-[var(--
|
|
20
|
+
"not-prose border-b border-[var(--bd-border)] py-4 first:pt-0 last:border-b-0",
|
|
21
21
|
className
|
|
22
22
|
)}
|
|
23
23
|
>
|
|
24
24
|
<div className="flex flex-wrap items-baseline gap-2">
|
|
25
|
-
<code className="font-mono text-sm font-semibold text-[var(--
|
|
25
|
+
<code className="font-mono text-sm font-semibold text-[var(--bd-text)]">
|
|
26
26
|
{name}
|
|
27
27
|
</code>
|
|
28
28
|
{type && (
|
|
29
|
-
<span className="font-mono text-xs text-[var(--
|
|
29
|
+
<span className="font-mono text-xs text-[var(--bd-text-muted)]">
|
|
30
30
|
{type}
|
|
31
31
|
</span>
|
|
32
32
|
)}
|
|
33
33
|
</div>
|
|
34
34
|
{children && (
|
|
35
|
-
<div className="mt-2 text-sm text-[var(--
|
|
35
|
+
<div className="mt-2 text-sm text-[var(--bd-text-secondary)] prose prose-sm dark:prose-invert max-w-none">
|
|
36
36
|
{children}
|
|
37
37
|
</div>
|
|
38
38
|
)}
|
|
@@ -50,11 +50,11 @@ export function ResponseFieldGroup({ children, title, className }: ResponseField
|
|
|
50
50
|
return (
|
|
51
51
|
<div className={cn("my-6", className)}>
|
|
52
52
|
{title && (
|
|
53
|
-
<h4 className="text-sm font-semibold text-[var(--
|
|
53
|
+
<h4 className="text-sm font-semibold text-[var(--bd-text)] mb-4 uppercase tracking-wide">
|
|
54
54
|
{title}
|
|
55
55
|
</h4>
|
|
56
56
|
)}
|
|
57
|
-
<div className="rounded-lg border border-[var(--
|
|
57
|
+
<div className="rounded-lg border border-[var(--bd-border)] bg-[var(--bd-bg)] px-4">
|
|
58
58
|
{children}
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
@@ -7,8 +7,8 @@ const { title } = Astro.props;
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<div class="relative">
|
|
10
|
-
<h3 class="font-semibold text-[var(--
|
|
11
|
-
<div class="text-sm text-[var(--
|
|
10
|
+
<h3 class="font-semibold text-[var(--bd-text)] mb-2">{title}</h3>
|
|
11
|
+
<div class="text-sm text-[var(--bd-text-secondary)]">
|
|
12
12
|
<slot />
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Steps component for step-by-step guides
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
<div class="not-prose my-6 space-y-4 border-l-2 border-[var(--
|
|
5
|
+
<div class="not-prose my-6 space-y-4 border-l-2 border-[var(--bd-border)] pl-6 ml-2">
|
|
6
6
|
<slot />
|
|
7
7
|
</div>
|
|
8
8
|
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
height: 1.5rem;
|
|
24
24
|
font-size: 0.75rem;
|
|
25
25
|
font-weight: 600;
|
|
26
|
-
background-color: var(--
|
|
27
|
-
border: 2px solid var(--
|
|
26
|
+
background-color: var(--bd-bg);
|
|
27
|
+
border: 2px solid var(--bd-border);
|
|
28
28
|
border-radius: 9999px;
|
|
29
29
|
}
|
|
30
30
|
</style>
|
|
@@ -8,15 +8,8 @@ interface StepsProps {
|
|
|
8
8
|
|
|
9
9
|
export function Steps({ children, className }: StepsProps) {
|
|
10
10
|
return (
|
|
11
|
-
<div className={cn("
|
|
12
|
-
{
|
|
13
|
-
if (React.isValidElement(child)) {
|
|
14
|
-
return React.cloneElement(child as React.ReactElement<StepProps>, {
|
|
15
|
-
stepNumber: index + 1,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return child;
|
|
19
|
-
})}
|
|
11
|
+
<div className={cn("bd-steps", className)}>
|
|
12
|
+
{children}
|
|
20
13
|
</div>
|
|
21
14
|
);
|
|
22
15
|
}
|
|
@@ -24,22 +17,20 @@ export function Steps({ children, className }: StepsProps) {
|
|
|
24
17
|
interface StepProps {
|
|
25
18
|
title: string;
|
|
26
19
|
children?: React.ReactNode;
|
|
27
|
-
stepNumber?: number;
|
|
28
20
|
className?: string;
|
|
29
21
|
}
|
|
30
22
|
|
|
31
|
-
export function Step({ title, children,
|
|
23
|
+
export function Step({ title, children, className }: StepProps) {
|
|
32
24
|
return (
|
|
33
|
-
<div className={cn("
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
<div className={cn("bd-step", className)}>
|
|
26
|
+
<div className="bd-step-indicator">
|
|
27
|
+
<span className="bd-step-number" />
|
|
28
|
+
<div className="bd-step-connector" />
|
|
37
29
|
</div>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<h3 className="font-semibold text-[var(--color-text)] mb-2">{title}</h3>
|
|
30
|
+
<div className="bd-step-content">
|
|
31
|
+
<h3 className="bd-step-title">{title}</h3>
|
|
41
32
|
{children && (
|
|
42
|
-
<div className="
|
|
33
|
+
<div className="bd-step-body prose prose-sm dark:prose-invert max-w-none">
|
|
43
34
|
{children}
|
|
44
35
|
</div>
|
|
45
36
|
)}
|
|
@@ -16,22 +16,19 @@ export function Tabs({ items, defaultValue }: TabsProps) {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<div className="not-prose my-4">
|
|
19
|
-
<div className="flex border-b border-[var(--
|
|
19
|
+
<div className="flex border-b border-[var(--bd-border)]">
|
|
20
20
|
{items.map((item) => {
|
|
21
21
|
const isActive = activeTab === item.value;
|
|
22
22
|
return (
|
|
23
23
|
<button
|
|
24
24
|
key={item.value}
|
|
25
25
|
type="button"
|
|
26
|
-
onClick={() =>
|
|
27
|
-
console.log('Tab clicked:', item.value);
|
|
28
|
-
setActiveTab(item.value);
|
|
29
|
-
}}
|
|
26
|
+
onClick={() => setActiveTab(item.value)}
|
|
30
27
|
style={{ cursor: 'pointer' }}
|
|
31
28
|
className={`px-4 py-2 text-sm font-medium transition-colors ${
|
|
32
29
|
isActive
|
|
33
|
-
? "border-b-2 border-
|
|
34
|
-
: "text-
|
|
30
|
+
? "border-b-2 border-primary-500 text-primary-600 dark:text-primary-400 -mb-px"
|
|
31
|
+
: "text-[var(--bd-text-muted)] hover:text-[var(--bd-text)]"
|
|
35
32
|
}`}
|
|
36
33
|
>
|
|
37
34
|
{item.label}
|
|
@@ -45,7 +42,7 @@ export function Tabs({ items, defaultValue }: TabsProps) {
|
|
|
45
42
|
if (!isActive) return null;
|
|
46
43
|
return (
|
|
47
44
|
<div key={item.value}>
|
|
48
|
-
<pre className="bg-
|
|
45
|
+
<pre className="bg-[var(--bd-bg-code)] border border-[var(--bd-border)] rounded-md p-3 text-sm overflow-x-auto">
|
|
49
46
|
<code>{item.children}</code>
|
|
50
47
|
</pre>
|
|
51
48
|
</div>
|