@clidey/dory 0.21.4 → 0.23.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/bin/dory.ts +18 -4
- package/dist/api-playground-demo.mdx +119 -0
- package/dist/api-reference/asyncapi.json +324 -0
- package/dist/api-reference/openapi.json +366 -0
- package/dist/api-reference/operations/create.mdx +5 -0
- package/dist/api-reference/operations/delete.mdx +5 -0
- package/dist/api-reference/operations/get.mdx +5 -0
- package/dist/api-reference/operations/update.mdx +5 -0
- package/dist/api-reference/websocket-operations/receive-chat-message.mdx +5 -0
- package/dist/api-reference/websocket-operations/receive-notifications.mdx +5 -0
- package/dist/api-reference/websocket-operations/receive-presence-update.mdx +5 -0
- package/dist/api-reference/websocket-operations/send-chat-message.mdx +5 -0
- package/dist/api-reference/websocket-operations/send-presence-update.mdx +5 -0
- package/dist/dory.json +64 -0
- package/dist/favicon.svg +75 -0
- package/dist/features.mdx +440 -0
- package/dist/frontmatter.json +77 -0
- package/dist/index.html +55 -0
- package/dist/introduction.mdx +44 -0
- package/dist/llms.txt +561 -0
- package/dist/websocket-playground-demo.mdx +135 -0
- package/docs/dory.json +5 -0
- package/docs/favicon.svg +1 -1
- package/docs/introduction.mdx +2 -2
- package/package.json +13 -10
- package/src/app.css +2 -0
- package/src/components/dropdown.tsx +30 -26
- package/src/components/loading.tsx +6 -8
- package/src/components/navigation.tsx +8 -6
- package/src/components/notification.tsx +9 -93
- package/src/components/routes.tsx +1 -1
- package/src/components/search.tsx +31 -104
- package/src/components/store.ts +4 -1
- package/src/main.tsx +9 -5
- package/src/mdx/accordion.tsx +21 -28
- package/src/mdx/api-playground.tsx +68 -83
- package/src/mdx/api.tsx +21 -21
- package/src/mdx/async-api.tsx +15 -31
- package/src/mdx/callout.tsx +27 -43
- package/src/mdx/card.tsx +20 -14
- package/src/mdx/code.tsx +26 -26
- package/src/mdx/expandable.tsx +21 -25
- package/src/mdx/fence.tsx +2 -2
- package/src/mdx/list.tsx +2 -2
- package/src/mdx/open-api.tsx +31 -45
- package/src/mdx/table.tsx +8 -3
- package/src/mdx/tag.tsx +27 -40
- package/src/mdx/text.tsx +3 -2
- package/src/mdx/websocket-playground.tsx +150 -81
- package/src/theme.scss +50 -106
- package/src/types/config.ts +47 -0
- package/src/ui/header.tsx +12 -9
- package/src/ui/layout.tsx +5 -4
- package/src/ui/mobile-navigation.tsx +36 -63
- package/src/ui/table-of-content.tsx +3 -3
- package/src/utils/colors.ts +54 -0
- package/src/utils/fonts.ts +4 -1
- package/vite.config.ts +2 -0
- package/.claude/settings.json +0 -29
- package/.claude/settings.local.json +0 -12
- package/.github/ISSUE_TEMPLATE/anything-else.md +0 -10
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -39
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/claude.yml +0 -37
- package/docs/assets/dory.jpeg +0 -0
- package/k8s/Dockerfile +0 -14
- package/k8s/config/nginx-default.conf +0 -22
- package/k8s/dev.Dockerfile +0 -16
- package/k8s/docs.Dockerfile +0 -15
- package/public/demo.mov +0 -0
- package/src/components/dark-mode-toggle.tsx +0 -25
- package/src/index.css +0 -24
- package/src/utils/hooks.ts +0 -46
- /package/{assets → dist/logo}/logo.svg +0 -0
package/src/mdx/callout.tsx
CHANGED
|
@@ -1,40 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Alert, AlertTitle, AlertDescription } from '@clidey/ux'
|
|
2
2
|
import { Icon } from "./icon"
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
note:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
container: 'my-6 flex gap-2.5 rounded-2xl border border-amber-500/20 bg-amber-50/50 p-4 text-sm/6 text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/5 dark:text-amber-200 dark:[--tw-prose-links-hover:var(--color-amber-300)] dark:[--tw-prose-links:var(--color-white)]',
|
|
12
|
-
title: 'text-amber-900 dark:text-amber-200',
|
|
13
|
-
body: 'text-amber-900 dark:text-amber-200',
|
|
14
|
-
},
|
|
15
|
-
info: {
|
|
16
|
-
container: 'my-6 flex gap-2.5 rounded-2xl border border-blue-500/20 bg-blue-50/50 p-4 text-sm/6 text-blue-900 dark:border-blue-500/30 dark:bg-blue-500/5 dark:text-blue-200 dark:[--tw-prose-links-hover:var(--color-blue-300)] dark:[--tw-prose-links:var(--color-white)]',
|
|
17
|
-
title: 'text-blue-900 dark:text-blue-200',
|
|
18
|
-
body: 'text-blue-900 dark:text-blue-200',
|
|
19
|
-
},
|
|
20
|
-
tip: {
|
|
21
|
-
container: 'my-6 flex gap-2.5 rounded-2xl border border-green-500/20 bg-green-50/50 p-4 text-sm/6 text-green-900 dark:border-green-500/30 dark:bg-green-500/5 dark:text-green-200 dark:[--tw-prose-links-hover:var(--color-green-300)] dark:[--tw-prose-links:var(--color-white)]',
|
|
22
|
-
title: 'text-green-900 dark:text-green-200',
|
|
23
|
-
body: 'text-green-900 dark:text-green-200',
|
|
24
|
-
},
|
|
25
|
-
check: {
|
|
26
|
-
container: 'my-6 flex gap-2.5 rounded-2xl border border-purple-500/20 bg-purple-50/50 p-4 text-sm/6 text-purple-900 dark:border-purple-500/30 dark:bg-purple-500/5 dark:text-purple-200 dark:[--tw-prose-links-hover:var(--color-purple-300)] dark:[--tw-prose-links:var(--color-white)]',
|
|
27
|
-
title: 'text-purple-900 dark:text-purple-200',
|
|
28
|
-
body: 'text-purple-900 dark:text-purple-200',
|
|
29
|
-
},
|
|
30
|
-
}
|
|
4
|
+
const typeToVariant = {
|
|
5
|
+
note: 'default',
|
|
6
|
+
warning: 'destructive',
|
|
7
|
+
info: 'default',
|
|
8
|
+
tip: 'default',
|
|
9
|
+
check: 'default',
|
|
10
|
+
} as const
|
|
31
11
|
|
|
32
12
|
const icons = {
|
|
33
|
-
note:
|
|
34
|
-
warning:
|
|
35
|
-
info:
|
|
36
|
-
tip:
|
|
37
|
-
check:
|
|
13
|
+
note: 'InfoCircle',
|
|
14
|
+
warning: 'AlertTriangle',
|
|
15
|
+
info: 'InfoCircle',
|
|
16
|
+
tip: 'Lightbulb',
|
|
17
|
+
check: 'CheckCircle',
|
|
18
|
+
} as const
|
|
19
|
+
|
|
20
|
+
const typeColors = {
|
|
21
|
+
note: 'border-emerald-500/30 bg-emerald-500/10 text-emerald-900 dark:text-emerald-200',
|
|
22
|
+
warning: 'border-amber-500/30 bg-amber-500/10 text-amber-900 dark:text-amber-200 *:data-[slot=alert-description]:text-inherit dark:data-[slot=alert-description]:text-inherit',
|
|
23
|
+
info: 'border-blue-500/30 bg-blue-500/10 text-blue-900 dark:text-blue-200',
|
|
24
|
+
tip: 'border-green-500/30 bg-green-500/10 text-green-900 dark:text-green-200',
|
|
25
|
+
check: 'border-purple-500/30 bg-purple-500/10 text-purple-900 dark:text-purple-200',
|
|
38
26
|
}
|
|
39
27
|
|
|
40
28
|
export function Callout({
|
|
@@ -44,18 +32,14 @@ export function Callout({
|
|
|
44
32
|
}: {
|
|
45
33
|
title: string
|
|
46
34
|
children: React.ReactNode
|
|
47
|
-
type?: keyof typeof
|
|
35
|
+
type?: keyof typeof icons
|
|
48
36
|
}) {
|
|
49
|
-
const IconComponent = icons[type]
|
|
50
|
-
|
|
51
37
|
return (
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
38
|
+
<Alert variant={typeToVariant[type]} className={`my-6 ${typeColors[type]}`}>
|
|
39
|
+
<Icon icon={icons[type]} className="h-4 w-4" />
|
|
40
|
+
<AlertTitle>{title}</AlertTitle>
|
|
41
|
+
<AlertDescription>{children}</AlertDescription>
|
|
42
|
+
</Alert>
|
|
59
43
|
)
|
|
60
44
|
}
|
|
61
45
|
|
package/src/mdx/card.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import classNames from "classnames";
|
|
2
|
+
import {
|
|
3
|
+
Card as UXCard,
|
|
4
|
+
CardHeader,
|
|
5
|
+
CardTitle,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardContent
|
|
8
|
+
} from '@clidey/ux'
|
|
2
9
|
import { Icon } from "./icon";
|
|
3
10
|
import type { ComponentChildren } from "preact";
|
|
4
11
|
|
|
@@ -29,20 +36,19 @@ export function Card({
|
|
|
29
36
|
children?: ComponentChildren
|
|
30
37
|
}) {
|
|
31
38
|
return (
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
<span className="absolute -inset-px rounded-xl" />
|
|
39
|
-
{title}
|
|
40
|
-
</a>
|
|
41
|
-
</h2>
|
|
42
|
-
<div className="text-sm text-slate-700 dark:text-slate-400 leading-tight [&>p]:mb-0">
|
|
43
|
-
{description ?? children}
|
|
39
|
+
<UXCard className="group relative">
|
|
40
|
+
<a href={href} className="absolute inset-0 z-10" aria-label={title} />
|
|
41
|
+
<CardHeader>
|
|
42
|
+
<div className="flex items-center gap-3">
|
|
43
|
+
<Icon icon={icon} className="h-8 w-8" />
|
|
44
|
+
<CardTitle className="text-base">{title}</CardTitle>
|
|
44
45
|
</div>
|
|
45
|
-
</
|
|
46
|
-
|
|
46
|
+
</CardHeader>
|
|
47
|
+
<CardContent>
|
|
48
|
+
<CardDescription className="text-sm leading-tight">
|
|
49
|
+
{description ?? children}
|
|
50
|
+
</CardDescription>
|
|
51
|
+
</CardContent>
|
|
52
|
+
</UXCard>
|
|
47
53
|
)
|
|
48
54
|
}
|
package/src/mdx/code.tsx
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from 'react'
|
|
11
11
|
import { Tag } from './tag'
|
|
12
12
|
import { toTitleCase } from '../utils/functions'
|
|
13
|
+
import { Button, Card } from '@clidey/ux'
|
|
14
|
+
import { CheckIcon } from 'lucide-react'
|
|
13
15
|
|
|
14
16
|
export const supportedLanguages = {
|
|
15
17
|
'python': 'Python',
|
|
@@ -73,10 +75,9 @@ function CopyButton({ code }: { code: string }) {
|
|
|
73
75
|
}, [copied])
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
|
-
<
|
|
77
|
-
type="button"
|
|
78
|
+
<Button
|
|
78
79
|
className={classNames(
|
|
79
|
-
'group/button absolute top-
|
|
80
|
+
'group/button absolute top-1 right-2 overflow-hidden rounded-full py-1 pr-3 pl-2 text-2xs font-medium opacity-0 backdrop-blur-sm transition group-hover:opacity-100 focus:opacity-100',
|
|
80
81
|
{
|
|
81
82
|
'bg-emerald-400/10 ring-1 ring-emerald-400/20 ring-inset': copied,
|
|
82
83
|
'bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5': !copied,
|
|
@@ -95,8 +96,7 @@ function CopyButton({ code }: { code: string }) {
|
|
|
95
96
|
copied && '-translate-y-1.5 opacity-0',
|
|
96
97
|
)}
|
|
97
98
|
>
|
|
98
|
-
<ClipboardIcon className="h-
|
|
99
|
-
Copy
|
|
99
|
+
<ClipboardIcon className="h-4 w-4 fill-zinc-500/20 stroke-zinc-500 transition-colors group-hover/button:stroke-zinc-400" />
|
|
100
100
|
</span>
|
|
101
101
|
<span
|
|
102
102
|
aria-hidden={!copied}
|
|
@@ -105,9 +105,9 @@ function CopyButton({ code }: { code: string }) {
|
|
|
105
105
|
!copied && 'translate-y-1.5 opacity-0',
|
|
106
106
|
)}
|
|
107
107
|
>
|
|
108
|
-
|
|
108
|
+
<CheckIcon className="h-4 w-4" />
|
|
109
109
|
</span>
|
|
110
|
-
</
|
|
110
|
+
</Button>
|
|
111
111
|
)
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -158,7 +158,7 @@ function CodePanel({
|
|
|
158
158
|
<div className="group dark:bg-white/2.5">
|
|
159
159
|
<CodePanelHeader tag={tag} label={label} />
|
|
160
160
|
<div className="relative">
|
|
161
|
-
<pre className="overflow-x-auto p-4 text-xs
|
|
161
|
+
<pre className="overflow-x-auto p-4 text-xs">{children}</pre>
|
|
162
162
|
<CopyButton code={code ?? ''} />
|
|
163
163
|
</div>
|
|
164
164
|
</div>
|
|
@@ -179,9 +179,9 @@ function CodeGroupHeader({
|
|
|
179
179
|
if (!title && !hasTabs) return null
|
|
180
180
|
|
|
181
181
|
return (
|
|
182
|
-
<div className="flex
|
|
182
|
+
<div className="flex flex-wrap items-start gap-x-4 px-4 pb-2">
|
|
183
183
|
{title && (
|
|
184
|
-
<p className="mr-auto pt-3 text-xs font-semibold
|
|
184
|
+
<p className="mr-auto pt-3 text-xs font-semibold">
|
|
185
185
|
{title}
|
|
186
186
|
</p>
|
|
187
187
|
)}
|
|
@@ -197,7 +197,7 @@ function CodeGroupHeader({
|
|
|
197
197
|
<Tab
|
|
198
198
|
key={index}
|
|
199
199
|
className={classNames(
|
|
200
|
-
'
|
|
200
|
+
'pt-2 transition data-selected:not-data-focus:outline-hidden',
|
|
201
201
|
index === selectedIndex
|
|
202
202
|
? 'border-emerald-500 text-emerald-400'
|
|
203
203
|
: 'border-transparent text-zinc-400 hover:text-zinc-300',
|
|
@@ -247,7 +247,6 @@ export function CodeGroup({
|
|
|
247
247
|
|
|
248
248
|
const hasTabs = childrenArray.length > 1
|
|
249
249
|
|
|
250
|
-
const containerClassName = 'docucod-mdx-code-group my-6 overflow-hidden rounded-2xl shadow-md dark:ring-1 dark:ring-white/10'
|
|
251
250
|
const header = (
|
|
252
251
|
<CodeGroupHeader title={title} selectedIndex={selectedIndex}>
|
|
253
252
|
{children}
|
|
@@ -258,24 +257,25 @@ export function CodeGroup({
|
|
|
258
257
|
return (
|
|
259
258
|
<CodeGroupContext.Provider value={true}>
|
|
260
259
|
{hasTabs ? (
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
260
|
+
<Card className="py-0 border-black/10 bg-none overflow-hidden mb-4">
|
|
261
|
+
<TabGroup
|
|
262
|
+
as="div"
|
|
263
|
+
selectedIndex={selectedIndex}
|
|
264
|
+
onChange={setSelectedIndex}
|
|
265
|
+
>
|
|
266
|
+
<div className="not-prose">
|
|
267
|
+
{header}
|
|
268
|
+
{panels}
|
|
269
|
+
</div>
|
|
270
|
+
</TabGroup>
|
|
271
|
+
</Card>
|
|
272
272
|
) : (
|
|
273
|
-
<
|
|
273
|
+
<Card className="py-0 border-black/10 bg-none overflow-hidden mb-4">
|
|
274
274
|
<div className="not-prose">
|
|
275
275
|
{header}
|
|
276
276
|
{panels}
|
|
277
277
|
</div>
|
|
278
|
-
</
|
|
278
|
+
</Card>
|
|
279
279
|
)}
|
|
280
280
|
</CodeGroupContext.Provider>
|
|
281
281
|
)
|
|
@@ -285,5 +285,5 @@ export function Code({
|
|
|
285
285
|
children,
|
|
286
286
|
...props
|
|
287
287
|
}: React.ComponentPropsWithoutRef<'code'>) {
|
|
288
|
-
return <code className={classNames('
|
|
288
|
+
return <code className={classNames('dory-mdx-code rounded-md py-1 text-sm px-2', props.className)} {...props}>{children}</code>
|
|
289
289
|
}
|
package/src/mdx/expandable.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Icon } from './icon'
|
|
1
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@clidey/ux";
|
|
2
|
+
import { Icon } from './icon';
|
|
4
3
|
|
|
5
4
|
export function Expandable({
|
|
6
5
|
title,
|
|
@@ -12,29 +11,26 @@ export function Expandable({
|
|
|
12
11
|
icon?: React.ComponentProps<typeof Icon>['icon']
|
|
13
12
|
}) {
|
|
14
13
|
return (
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</span>
|
|
30
|
-
</DisclosureButton>
|
|
31
|
-
<DisclosurePanel as="dd" className="px-6 pb-6">
|
|
14
|
+
<Accordion
|
|
15
|
+
type="single"
|
|
16
|
+
collapsible
|
|
17
|
+
className="my-6 rounded-xl border border-slate-200 dark:border-slate-700"
|
|
18
|
+
>
|
|
19
|
+
<AccordionItem value="expandable">
|
|
20
|
+
<AccordionTrigger className="group flex w-full items-start justify-between text-left text-slate-900 dark:text-white p-6">
|
|
21
|
+
<div className="flex items-center gap-2">
|
|
22
|
+
{icon && <Icon icon={icon} className="h-8 w-8" />}
|
|
23
|
+
<span className="text-base font-display text-slate-900 dark:text-white">{title}</span>
|
|
24
|
+
</div>
|
|
25
|
+
</AccordionTrigger>
|
|
26
|
+
<AccordionContent asChild>
|
|
27
|
+
<dd className="px-6 pb-6">
|
|
32
28
|
<div className="text-sm text-slate-700 dark:text-slate-400 leading-tight [&>p]:mb-0">
|
|
33
29
|
{children}
|
|
34
30
|
</div>
|
|
35
|
-
</
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</
|
|
39
|
-
)
|
|
31
|
+
</dd>
|
|
32
|
+
</AccordionContent>
|
|
33
|
+
</AccordionItem>
|
|
34
|
+
</Accordion>
|
|
35
|
+
);
|
|
40
36
|
}
|
package/src/mdx/fence.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Highlight, themes } from 'prism-react-renderer'
|
|
|
3
3
|
import { Code, CodeGroup, CodeGroupContext, supportedLanguages } from './code'
|
|
4
4
|
import { MermaidRenderer } from './mermaid'
|
|
5
5
|
import { Loading } from '../components/loading'
|
|
6
|
-
import {
|
|
6
|
+
import { useTheme } from '@clidey/ux'
|
|
7
7
|
import classNames from 'classnames'
|
|
8
8
|
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ export function Fence({
|
|
|
14
14
|
children: string
|
|
15
15
|
language: string
|
|
16
16
|
}) {
|
|
17
|
-
const
|
|
17
|
+
const isDark = useTheme().theme === 'dark';
|
|
18
18
|
|
|
19
19
|
if (language === 'mermaid') {
|
|
20
20
|
return (
|
package/src/mdx/list.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSX } from 'preact/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
export const UnorderedList = (props: JSX.IntrinsicElements['ul']) => <ul className="list-disc list-inside" {...props} />;
|
|
3
|
+
export const UnorderedList = (props: JSX.IntrinsicElements['ul']) => <ul className="list-disc list-inside my-2" {...props} />;
|
|
4
4
|
|
|
5
|
-
export const OrderedList = (props: JSX.IntrinsicElements['ol']) => <ol className="list-decimal list-inside" {...props} />;
|
|
5
|
+
export const OrderedList = (props: JSX.IntrinsicElements['ol']) => <ol className="list-decimal list-inside my-2" {...props} />;
|
|
6
6
|
|
|
7
7
|
export const ListItem = (props: JSX.IntrinsicElements['li']) => <li className="ml-4 mt-2" {...props} />;
|
package/src/mdx/open-api.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { APIPlayground, PlayButton, type Server } from "./api-playground"
|
|
|
4
4
|
import { Fence } from "./fence"
|
|
5
5
|
import { Tag } from "./tag"
|
|
6
6
|
import { Col, Row } from "./text"
|
|
7
|
-
import {
|
|
7
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, Button } from "@clidey/ux"
|
|
8
8
|
|
|
9
9
|
export function Properties({ children }: { children: React.ReactNode }) {
|
|
10
10
|
return (
|
|
@@ -33,12 +33,16 @@ export function Property({
|
|
|
33
33
|
return (
|
|
34
34
|
<div className="m-0 px-0 first:pt-0 last:pb-0">
|
|
35
35
|
<div className="my-4 flex flex-wrap items-center gap-x-3 gap-2">
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
<div className="flex gap-2 items-center grow">
|
|
37
|
+
<Tag className="px-4 py-1">{name}</Tag>
|
|
38
|
+
<p className="font-mono text-xs text-zinc-400 dark:text-zinc-500">
|
|
39
|
+
{type}
|
|
40
|
+
</p>
|
|
41
|
+
<div className="flex grow justify-end ">
|
|
42
|
+
{required && <span className="text-rose-400 ml-1 text-xs">Required</span>}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<p className="w-full flex-none [&>:first-child]:mt-0 [&>:last-child]:mb-0 text-xs text-muted-foreground">
|
|
42
46
|
{children}
|
|
43
47
|
</p>
|
|
44
48
|
</div>
|
|
@@ -170,36 +174,18 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
170
174
|
|
|
171
175
|
return (
|
|
172
176
|
<div className="max-w-none w-full">
|
|
173
|
-
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
<button
|
|
186
|
-
onClick={() => setShowPlayground(false)}
|
|
187
|
-
className="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
|
|
188
|
-
>
|
|
189
|
-
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
190
|
-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
|
191
|
-
</svg>
|
|
192
|
-
</button>
|
|
193
|
-
</div>
|
|
194
|
-
<APIPlayground
|
|
195
|
-
method={selectedMethod}
|
|
196
|
-
url={selectedPath}
|
|
197
|
-
servers={openAPIJson.servers}
|
|
198
|
-
/>
|
|
199
|
-
</div>
|
|
200
|
-
</motion.div>
|
|
201
|
-
}
|
|
202
|
-
|
|
177
|
+
<Sheet open={showPlayground} onOpenChange={setShowPlayground} modal={true}>
|
|
178
|
+
<SheetContent side="bottom" className="h-[90vh] w-full overflow-y-auto p-8">
|
|
179
|
+
<SheetHeader className="p-0">
|
|
180
|
+
<SheetTitle>API Playground</SheetTitle>
|
|
181
|
+
</SheetHeader>
|
|
182
|
+
<APIPlayground
|
|
183
|
+
method={selectedMethod}
|
|
184
|
+
url={selectedPath}
|
|
185
|
+
servers={openAPIJson.servers}
|
|
186
|
+
/>
|
|
187
|
+
</SheetContent>
|
|
188
|
+
</Sheet>
|
|
203
189
|
{Object.entries(paths).map(([path, methods]) => {
|
|
204
190
|
if (path !== selectedPath) {
|
|
205
191
|
return null;
|
|
@@ -216,7 +202,7 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
216
202
|
}
|
|
217
203
|
|
|
218
204
|
return (
|
|
219
|
-
<Row key={`${method}-${path}`} cols={2}>
|
|
205
|
+
<Row key={`${method}-${path}`} cols={2} className="gap-0">
|
|
220
206
|
<Col>
|
|
221
207
|
<h2 className="flex items-center mt-4">
|
|
222
208
|
<Tag variant="medium" className="mr-2 py-1 px-4 rounded-lg">{methodUpper}</Tag>
|
|
@@ -227,7 +213,7 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
227
213
|
|
|
228
214
|
{parameters && parameters.length > 0 && (
|
|
229
215
|
<div className="mt-4">
|
|
230
|
-
<h3>Parameters</h3>
|
|
216
|
+
<h3 className="font-bold">Parameters</h3>
|
|
231
217
|
<Properties>
|
|
232
218
|
{parameters.map((param) => (
|
|
233
219
|
<ParamField
|
|
@@ -245,7 +231,7 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
245
231
|
)}
|
|
246
232
|
{requestBody && (
|
|
247
233
|
<div className="mt-4">
|
|
248
|
-
<h3>Request Body</h3>
|
|
234
|
+
<h3 className="font-bold">Request Body</h3>
|
|
249
235
|
<p>{requestBody.description}</p>
|
|
250
236
|
{requestBody.content?.['application/json']?.schema && (
|
|
251
237
|
(() => {
|
|
@@ -271,9 +257,9 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
271
257
|
)}
|
|
272
258
|
{components?.schemas && (
|
|
273
259
|
<div>
|
|
274
|
-
<h3>Schemas</h3>
|
|
260
|
+
<h3 className="font-bold">Schemas</h3>
|
|
275
261
|
{Object.entries(components.schemas).filter(([, schema]) => schema.properties).map(([name, schema]) => (
|
|
276
|
-
<div key={name} className="mt-
|
|
262
|
+
<div key={name} className="mt-8">
|
|
277
263
|
<h4>{name}</h4>
|
|
278
264
|
<Properties>
|
|
279
265
|
{Object.entries(schema.properties || {}).map(([propName, prop]) => (
|
|
@@ -293,12 +279,12 @@ export function OpenAPI({ openAPIJson, method: selectedMethod, path: selectedPat
|
|
|
293
279
|
)}
|
|
294
280
|
</Col>
|
|
295
281
|
<Col sticky>
|
|
296
|
-
<
|
|
282
|
+
<Button
|
|
297
283
|
onClick={handleShowPlayground}
|
|
298
|
-
className='ml-auto mt-3 flex items-center gap-2
|
|
284
|
+
className='ml-auto mt-3 flex items-center gap-2'>
|
|
299
285
|
Try
|
|
300
286
|
<PlayButton className="h-4 w-4" />
|
|
301
|
-
</
|
|
287
|
+
</Button>
|
|
302
288
|
<APIGroup title="Request" tag={methodUpper} label={path}>
|
|
303
289
|
{Object.entries(responses).map(([code, response]) => (
|
|
304
290
|
<div key={code} title={code}>
|
package/src/mdx/table.tsx
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { JSX } from 'preact/jsx-runtime';
|
|
2
|
+
import {
|
|
3
|
+
Table as UXTable,
|
|
4
|
+
TableHead,
|
|
5
|
+
TableCell
|
|
6
|
+
} from '@clidey/ux'
|
|
2
7
|
|
|
3
8
|
export const Table = (props: JSX.IntrinsicElements['table']) => (
|
|
4
9
|
<div className="overflow-x-auto rounded-lg my-8">
|
|
5
|
-
<
|
|
10
|
+
<UXTable {...props} />
|
|
6
11
|
</div>
|
|
7
12
|
);
|
|
8
13
|
|
|
9
14
|
export const Th = (props: JSX.IntrinsicElements['th']) => (
|
|
10
|
-
<
|
|
15
|
+
<TableHead {...props} />
|
|
11
16
|
);
|
|
12
17
|
|
|
13
18
|
export const Td = (props: JSX.IntrinsicElements['td']) => (
|
|
14
|
-
<
|
|
19
|
+
<TableCell {...props} />
|
|
15
20
|
);
|
package/src/mdx/tag.tsx
CHANGED
|
@@ -1,66 +1,53 @@
|
|
|
1
|
+
import { Badge } from '@clidey/ux'
|
|
1
2
|
import classNames from 'classnames'
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const valueColorMap = {
|
|
5
|
+
GET: 'default',
|
|
6
|
+
POST: 'secondary',
|
|
7
|
+
PUT: 'outline',
|
|
8
|
+
DELETE: 'destructive',
|
|
9
|
+
} as const
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
emerald:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
sky: {
|
|
15
|
-
small: 'text-sky-500',
|
|
16
|
-
medium:
|
|
17
|
-
'ring-sky-300 bg-sky-400/10 text-sky-500 dark:ring-sky-400/30 dark:bg-sky-400/10 dark:text-sky-400',
|
|
18
|
-
},
|
|
19
|
-
amber: {
|
|
20
|
-
small: 'text-amber-500',
|
|
21
|
-
medium:
|
|
22
|
-
'ring-amber-300 bg-amber-400/10 text-amber-500 dark:ring-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400',
|
|
23
|
-
},
|
|
24
|
-
rose: {
|
|
25
|
-
small: 'text-red-500 dark:text-rose-500',
|
|
26
|
-
medium:
|
|
27
|
-
'ring-rose-200 bg-rose-50 text-red-500 dark:ring-rose-500/20 dark:bg-rose-400/10 dark:text-rose-400',
|
|
28
|
-
},
|
|
29
|
-
zinc: {
|
|
30
|
-
small: 'text-zinc-400 dark:text-zinc-500',
|
|
31
|
-
medium:
|
|
32
|
-
'ring-zinc-200 bg-zinc-50 text-zinc-500 dark:ring-zinc-500/20 dark:bg-zinc-400/10 dark:text-zinc-400',
|
|
33
|
-
},
|
|
11
|
+
const customColorClasses = {
|
|
12
|
+
emerald: 'bg-emerald-400/10 text-emerald-500 dark:text-emerald-400 border-emerald-300 dark:border-emerald-400/30',
|
|
13
|
+
sky: 'bg-sky-400/10 text-sky-500 dark:text-sky-400 border-sky-300 dark:border-sky-400/30',
|
|
14
|
+
amber: 'bg-amber-400/10 text-amber-500 dark:text-amber-400 border-amber-300 dark:border-amber-400/30',
|
|
15
|
+
rose: 'bg-rose-50 text-red-500 dark:bg-rose-400/10 dark:text-rose-400 border-rose-200 dark:border-rose-500/20',
|
|
16
|
+
zinc: 'bg-zinc-50 text-zinc-500 dark:bg-zinc-400/10 dark:text-zinc-400 border-zinc-200 dark:border-zinc-500/20',
|
|
34
17
|
}
|
|
35
18
|
|
|
36
|
-
const
|
|
19
|
+
const methodColors: Record<string, keyof typeof customColorClasses> = {
|
|
37
20
|
GET: 'emerald',
|
|
38
21
|
POST: 'sky',
|
|
39
22
|
PUT: 'amber',
|
|
40
23
|
DELETE: 'rose',
|
|
41
|
-
}
|
|
24
|
+
}
|
|
42
25
|
|
|
43
26
|
export function Tag({
|
|
44
27
|
children,
|
|
45
28
|
variant = 'medium',
|
|
46
|
-
color
|
|
29
|
+
color,
|
|
47
30
|
className,
|
|
48
31
|
}: {
|
|
49
|
-
children:
|
|
50
|
-
variant?:
|
|
51
|
-
color?: keyof typeof
|
|
32
|
+
children: string
|
|
33
|
+
variant?: 'small' | 'medium'
|
|
34
|
+
color?: keyof typeof customColorClasses
|
|
52
35
|
className?: string
|
|
53
36
|
}) {
|
|
37
|
+
const colorKey = color || methodColors[children] || 'zinc'
|
|
38
|
+
const badgeVariant = valueColorMap[children as keyof typeof valueColorMap] || 'outline'
|
|
39
|
+
|
|
54
40
|
return (
|
|
55
|
-
<
|
|
41
|
+
<Badge
|
|
42
|
+
variant={badgeVariant}
|
|
56
43
|
className={classNames(
|
|
57
44
|
'font-mono text-[0.625rem]/6 font-semibold',
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
customColorClasses[colorKey],
|
|
46
|
+
variant === 'small' && 'px-1 py-0',
|
|
60
47
|
className,
|
|
61
48
|
)}
|
|
62
49
|
>
|
|
63
50
|
{children}
|
|
64
|
-
</
|
|
51
|
+
</Badge>
|
|
65
52
|
)
|
|
66
53
|
}
|
package/src/mdx/text.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cn } from "@clidey/ux"
|
|
1
2
|
import classNames from "classnames"
|
|
2
3
|
import { useState } from "preact/hooks"
|
|
3
4
|
|
|
@@ -30,9 +31,9 @@ export const p = function P(props: preact.JSX.HTMLAttributes<HTMLParagraphElemen
|
|
|
30
31
|
return <p className="mb-2 inline-block" {...props} />
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
export function Row({ children, cols = 1 }: { children: preact.ComponentChildren, cols?: number }) {
|
|
34
|
+
export function Row({ children, cols = 1, className }: { children: preact.ComponentChildren, cols?: number, className?: string }) {
|
|
34
35
|
return (
|
|
35
|
-
<div className={`grid grid-cols-1 items-start gap-x-16 gap-y-10 xl:max-w-none
|
|
36
|
+
<div className={cn(`py-6 grid grid-cols-1 items-start gap-x-16 gap-y-10 xl:max-w-none`, className)} style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` }}>
|
|
36
37
|
{children}
|
|
37
38
|
</div>
|
|
38
39
|
)
|