blodemd 0.0.4 → 0.0.6

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 (185) hide show
  1. package/README.md +12 -1
  2. package/dev-server/app/[[...slug]]/page.tsx +139 -0
  3. package/dev-server/app/blodemd-dev/invalidate/route.ts +12 -0
  4. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +32 -0
  5. package/dev-server/app/blodemd-dev/version/route.ts +14 -0
  6. package/dev-server/app/blodemd-internal/proxy/route.ts +86 -0
  7. package/dev-server/app/error.tsx +24 -0
  8. package/dev-server/app/globals.css +4 -0
  9. package/dev-server/app/layout.tsx +38 -0
  10. package/dev-server/app/not-found.tsx +18 -0
  11. package/dev-server/app/search/route.ts +17 -0
  12. package/dev-server/components/dev-reload-script.tsx +86 -0
  13. package/dev-server/components/providers.tsx +15 -0
  14. package/dev-server/lib/dev-state.ts +8 -0
  15. package/dev-server/lib/local-content-source.ts +103 -0
  16. package/dev-server/lib/local-runtime.tsx +558 -0
  17. package/dev-server/next.config.js +46 -0
  18. package/dev-server/package.json +57 -0
  19. package/dev-server/postcss.config.mjs +7 -0
  20. package/dev-server/public/glide-variable.woff2 +0 -0
  21. package/dev-server/tsconfig.json +49 -0
  22. package/dist/cli.mjs +299 -26
  23. package/dist/cli.mjs.map +1 -1
  24. package/docs/app/globals.css +455 -0
  25. package/docs/components/api/api-playground.tsx +295 -0
  26. package/docs/components/api/api-reference.tsx +121 -0
  27. package/docs/components/content/collection-index.tsx +114 -0
  28. package/docs/components/docs/contextual-menu.tsx +406 -0
  29. package/docs/components/docs/copy-page-menu.tsx +255 -0
  30. package/docs/components/docs/doc-header.tsx +192 -0
  31. package/docs/components/docs/doc-shell.tsx +289 -0
  32. package/docs/components/docs/doc-sidebar.tsx +206 -0
  33. package/docs/components/docs/doc-toc.tsx +45 -0
  34. package/docs/components/docs/mobile-nav.tsx +207 -0
  35. package/docs/components/mdx/accordion.tsx +83 -0
  36. package/docs/components/mdx/badge.tsx +79 -0
  37. package/docs/components/mdx/callout.tsx +88 -0
  38. package/docs/components/mdx/card.tsx +104 -0
  39. package/docs/components/mdx/code-block.tsx +75 -0
  40. package/docs/components/mdx/code-group.tsx +94 -0
  41. package/docs/components/mdx/color.tsx +87 -0
  42. package/docs/components/mdx/columns.tsx +25 -0
  43. package/docs/components/mdx/expandable.tsx +45 -0
  44. package/docs/components/mdx/field-layout.tsx +77 -0
  45. package/docs/components/mdx/frame.tsx +23 -0
  46. package/docs/components/mdx/get-text-content.ts +18 -0
  47. package/docs/components/mdx/icon.tsx +56 -0
  48. package/docs/components/mdx/index.tsx +96 -0
  49. package/docs/components/mdx/installer.tsx +20 -0
  50. package/docs/components/mdx/panel.tsx +11 -0
  51. package/docs/components/mdx/param-field.tsx +56 -0
  52. package/docs/components/mdx/preview.tsx +36 -0
  53. package/docs/components/mdx/prompt.tsx +63 -0
  54. package/docs/components/mdx/request-example.tsx +27 -0
  55. package/docs/components/mdx/response-field.tsx +42 -0
  56. package/docs/components/mdx/steps.tsx +92 -0
  57. package/docs/components/mdx/tabs.tsx +88 -0
  58. package/docs/components/mdx/tile.tsx +43 -0
  59. package/docs/components/mdx/tooltip.tsx +71 -0
  60. package/docs/components/mdx/tree.tsx +120 -0
  61. package/docs/components/mdx/type-table.tsx +71 -0
  62. package/docs/components/mdx/update.tsx +44 -0
  63. package/docs/components/mdx/video.tsx +12 -0
  64. package/docs/components/mdx/view.tsx +66 -0
  65. package/docs/components/providers.tsx +15 -0
  66. package/docs/components/ui/breadcrumb.tsx +92 -0
  67. package/docs/components/ui/button.tsx +90 -0
  68. package/docs/components/ui/card.tsx +92 -0
  69. package/docs/components/ui/command.tsx +139 -0
  70. package/docs/components/ui/dialog.tsx +97 -0
  71. package/docs/components/ui/field.tsx +237 -0
  72. package/docs/components/ui/input.tsx +105 -0
  73. package/docs/components/ui/label.tsx +22 -0
  74. package/docs/components/ui/popover.tsx +72 -0
  75. package/docs/components/ui/search.tsx +380 -0
  76. package/docs/components/ui/separator.tsx +26 -0
  77. package/docs/components/ui/sheet.tsx +104 -0
  78. package/docs/components/ui/sidebar.tsx +433 -0
  79. package/docs/components/ui/theme-toggle.tsx +62 -0
  80. package/docs/components/ui/tooltip.tsx +53 -0
  81. package/docs/lib/contextual-options.ts +193 -0
  82. package/docs/lib/docs-collection.ts +22 -0
  83. package/docs/lib/mdx.ts +90 -0
  84. package/docs/lib/navigation.ts +288 -0
  85. package/docs/lib/openapi.ts +158 -0
  86. package/docs/lib/routes.ts +10 -0
  87. package/docs/lib/server-cache.ts +83 -0
  88. package/docs/lib/shiki.ts +35 -0
  89. package/docs/lib/theme.ts +29 -0
  90. package/docs/lib/toc.ts +2 -0
  91. package/docs/lib/utils.ts +5 -0
  92. package/package.json +34 -3
  93. package/packages/@repo/common/dist/index.d.ts +9 -0
  94. package/packages/@repo/common/dist/index.d.ts.map +1 -0
  95. package/packages/@repo/common/dist/index.js +42 -0
  96. package/packages/@repo/common/package.json +34 -0
  97. package/packages/@repo/common/src/common.unit.test.ts +55 -0
  98. package/packages/@repo/common/src/index.ts +51 -0
  99. package/packages/@repo/contracts/dist/api-key.d.ts +30 -0
  100. package/packages/@repo/contracts/dist/api-key.d.ts.map +1 -0
  101. package/packages/@repo/contracts/dist/api-key.js +20 -0
  102. package/packages/@repo/contracts/dist/dates.d.ts +4 -0
  103. package/packages/@repo/contracts/dist/dates.d.ts.map +1 -0
  104. package/packages/@repo/contracts/dist/dates.js +2 -0
  105. package/packages/@repo/contracts/dist/deployment.d.ts +71 -0
  106. package/packages/@repo/contracts/dist/deployment.d.ts.map +1 -0
  107. package/packages/@repo/contracts/dist/deployment.js +46 -0
  108. package/packages/@repo/contracts/dist/domain.d.ts +94 -0
  109. package/packages/@repo/contracts/dist/domain.d.ts.map +1 -0
  110. package/packages/@repo/contracts/dist/domain.js +36 -0
  111. package/packages/@repo/contracts/dist/ids.d.ts +14 -0
  112. package/packages/@repo/contracts/dist/ids.d.ts.map +1 -0
  113. package/packages/@repo/contracts/dist/ids.js +10 -0
  114. package/packages/@repo/contracts/dist/index.d.ts +10 -0
  115. package/packages/@repo/contracts/dist/index.d.ts.map +1 -0
  116. package/packages/@repo/contracts/dist/index.js +11 -0
  117. package/packages/@repo/contracts/dist/pagination.d.ts +23 -0
  118. package/packages/@repo/contracts/dist/pagination.d.ts.map +1 -0
  119. package/packages/@repo/contracts/dist/pagination.js +15 -0
  120. package/packages/@repo/contracts/dist/project.d.ts +25 -0
  121. package/packages/@repo/contracts/dist/project.d.ts.map +1 -0
  122. package/packages/@repo/contracts/dist/project.js +23 -0
  123. package/packages/@repo/contracts/dist/tenant.d.ts +99 -0
  124. package/packages/@repo/contracts/dist/tenant.d.ts.map +1 -0
  125. package/packages/@repo/contracts/dist/tenant.js +36 -0
  126. package/packages/@repo/contracts/dist/user.d.ts +9 -0
  127. package/packages/@repo/contracts/dist/user.d.ts.map +1 -0
  128. package/packages/@repo/contracts/dist/user.js +9 -0
  129. package/packages/@repo/contracts/package.json +37 -0
  130. package/packages/@repo/contracts/src/api-key.ts +27 -0
  131. package/packages/@repo/contracts/src/dates.ts +4 -0
  132. package/packages/@repo/contracts/src/deployment.ts +73 -0
  133. package/packages/@repo/contracts/src/domain.ts +51 -0
  134. package/packages/@repo/contracts/src/ids.ts +22 -0
  135. package/packages/@repo/contracts/src/index.ts +11 -0
  136. package/packages/@repo/contracts/src/pagination.ts +21 -0
  137. package/packages/@repo/contracts/src/project.ts +30 -0
  138. package/packages/@repo/contracts/src/tenant.ts +54 -0
  139. package/packages/@repo/contracts/src/user.ts +12 -0
  140. package/packages/@repo/models/dist/docs-config.d.ts +985 -0
  141. package/packages/@repo/models/dist/docs-config.d.ts.map +1 -0
  142. package/packages/@repo/models/dist/docs-config.js +548 -0
  143. package/packages/@repo/models/dist/index.d.ts +3 -0
  144. package/packages/@repo/models/dist/index.d.ts.map +1 -0
  145. package/packages/@repo/models/dist/index.js +3 -0
  146. package/packages/@repo/models/dist/tenant.d.ts +25 -0
  147. package/packages/@repo/models/dist/tenant.d.ts.map +1 -0
  148. package/packages/@repo/models/dist/tenant.js +1 -0
  149. package/packages/@repo/models/package.json +37 -0
  150. package/packages/@repo/models/src/docs-config.ts +648 -0
  151. package/packages/@repo/models/src/index.ts +3 -0
  152. package/packages/@repo/models/src/tenant.ts +29 -0
  153. package/packages/@repo/prebuild/dist/index.d.ts +2 -0
  154. package/packages/@repo/prebuild/dist/index.d.ts.map +1 -0
  155. package/packages/@repo/prebuild/dist/index.js +2 -0
  156. package/packages/@repo/prebuild/dist/openapi.d.ts +43 -0
  157. package/packages/@repo/prebuild/dist/openapi.d.ts.map +1 -0
  158. package/packages/@repo/prebuild/dist/openapi.js +58 -0
  159. package/packages/@repo/prebuild/package.json +39 -0
  160. package/packages/@repo/prebuild/src/index.ts +2 -0
  161. package/packages/@repo/prebuild/src/openapi.ts +116 -0
  162. package/packages/@repo/previewing/dist/blob-source.d.ts +16 -0
  163. package/packages/@repo/previewing/dist/blob-source.d.ts.map +1 -0
  164. package/packages/@repo/previewing/dist/blob-source.js +110 -0
  165. package/packages/@repo/previewing/dist/content-source.d.ts +12 -0
  166. package/packages/@repo/previewing/dist/content-source.d.ts.map +1 -0
  167. package/packages/@repo/previewing/dist/content-source.js +1 -0
  168. package/packages/@repo/previewing/dist/fs-source.d.ts +11 -0
  169. package/packages/@repo/previewing/dist/fs-source.d.ts.map +1 -0
  170. package/packages/@repo/previewing/dist/fs-source.js +79 -0
  171. package/packages/@repo/previewing/dist/index.d.ts +120 -0
  172. package/packages/@repo/previewing/dist/index.d.ts.map +1 -0
  173. package/packages/@repo/previewing/dist/index.js +984 -0
  174. package/packages/@repo/previewing/package.json +41 -0
  175. package/packages/@repo/previewing/src/blob-source.ts +167 -0
  176. package/packages/@repo/previewing/src/content-source.ts +12 -0
  177. package/packages/@repo/previewing/src/fs-source.ts +111 -0
  178. package/packages/@repo/previewing/src/index.ts +1490 -0
  179. package/packages/@repo/previewing/src/index.unit.test.ts +290 -0
  180. package/packages/@repo/validation/dist/index.d.ts +12 -0
  181. package/packages/@repo/validation/dist/index.d.ts.map +1 -0
  182. package/packages/@repo/validation/dist/index.js +30 -0
  183. package/packages/@repo/validation/package.json +37 -0
  184. package/packages/@repo/validation/src/index.ts +59 -0
  185. package/packages/@repo/validation/src/mintlify-docs-schema.json +5016 -0
@@ -0,0 +1,94 @@
1
+ "use client";
2
+
3
+ import { isValidElement, useCallback, useMemo, useState } from "react";
4
+ import type { MouseEvent, ReactElement, ReactNode } from "react";
5
+
6
+ import { cn } from "@/lib/utils";
7
+
8
+ interface CodeGroupProps {
9
+ children: ReactNode;
10
+ }
11
+
12
+ export const CodeGroup = ({ children }: CodeGroupProps) => {
13
+ const items = useMemo(() => {
14
+ const nodes = Array.isArray(children) ? children : [children];
15
+ return nodes.filter((child): child is ReactElement =>
16
+ isValidElement(child)
17
+ );
18
+ }, [children]);
19
+
20
+ const [active, setActive] = useState(0);
21
+
22
+ const labels = useMemo(
23
+ () =>
24
+ items.map((item) => {
25
+ if (
26
+ !isValidElement<{
27
+ "data-rehype-pretty-code-title"?: string;
28
+ children?: ReactNode;
29
+ }>(item)
30
+ ) {
31
+ return "Code";
32
+ }
33
+ const title = item.props["data-rehype-pretty-code-title"];
34
+ if (title) {
35
+ return title;
36
+ }
37
+ const itemChildren = Array.isArray(item.props.children)
38
+ ? item.props.children
39
+ : [item.props.children];
40
+ const pre = itemChildren.find(
41
+ (c: unknown) => isValidElement(c) && c.type === "pre"
42
+ );
43
+ if (isValidElement<{ className?: string }>(pre)) {
44
+ const lang = pre.props.className
45
+ ?.split(" ")
46
+ .find((c: string) => c.startsWith("language-"))
47
+ ?.replace("language-", "");
48
+ if (lang) {
49
+ return lang;
50
+ }
51
+ }
52
+ return `Tab ${items.indexOf(item) + 1}`;
53
+ }),
54
+ [items]
55
+ );
56
+
57
+ const handleTabClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {
58
+ const index = Number(event.currentTarget.dataset.index ?? "0");
59
+ setActive(index);
60
+ }, []);
61
+
62
+ if (items.length <= 1) {
63
+ return children as ReactElement;
64
+ }
65
+
66
+ return (
67
+ <div className="my-4 overflow-hidden rounded-xl border border-border bg-code">
68
+ <div
69
+ className="flex gap-1 border-b border-border bg-muted/50 px-2 pt-2"
70
+ role="tablist"
71
+ >
72
+ {labels.map((label, index) => (
73
+ <button
74
+ aria-selected={index === active}
75
+ className={cn(
76
+ "rounded-t-md border-b-2 px-3 py-1.5 font-mono text-xs transition-colors",
77
+ index === active
78
+ ? "border-primary text-foreground"
79
+ : "border-transparent text-muted-foreground hover:text-foreground"
80
+ )}
81
+ data-index={index}
82
+ key={label}
83
+ onClick={handleTabClick}
84
+ role="tab"
85
+ type="button"
86
+ >
87
+ {label}
88
+ </button>
89
+ ))}
90
+ </div>
91
+ <div role="tabpanel">{items[active]}</div>
92
+ </div>
93
+ );
94
+ };
@@ -0,0 +1,87 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ interface ColorItemProps {
6
+ name?: string;
7
+ value: string | { light: string; dark: string };
8
+ }
9
+
10
+ const ColorItem = ({ name, value }: ColorItemProps) => {
11
+ const lightValue = typeof value === "string" ? value : value.light;
12
+ const darkValue = typeof value === "string" ? value : value.dark;
13
+
14
+ return (
15
+ <div className="flex items-center gap-3">
16
+ <div
17
+ className="size-8 shrink-0 rounded-md border border-border"
18
+ style={{ backgroundColor: lightValue }}
19
+ >
20
+ {typeof value === "string" ? null : (
21
+ <div
22
+ className="hidden size-full rounded-md dark:block"
23
+ style={{ backgroundColor: darkValue }}
24
+ />
25
+ )}
26
+ </div>
27
+ <div className="min-w-0">
28
+ {name ? (
29
+ <div className="text-sm font-medium text-foreground">{name}</div>
30
+ ) : null}
31
+ <div className="font-mono text-xs text-muted-foreground">
32
+ {lightValue}
33
+ </div>
34
+ </div>
35
+ </div>
36
+ );
37
+ };
38
+
39
+ interface ColorRowProps {
40
+ title?: string;
41
+ children: ReactNode;
42
+ }
43
+
44
+ const ColorRow = ({ title, children }: ColorRowProps) => (
45
+ <>
46
+ {title ? (
47
+ <tr>
48
+ <td
49
+ className="border-b border-border bg-muted/50 px-4 py-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground"
50
+ colSpan={2}
51
+ >
52
+ {title}
53
+ </td>
54
+ </tr>
55
+ ) : null}
56
+ {children}
57
+ </>
58
+ );
59
+
60
+ interface ColorProps {
61
+ variant?: "compact" | "table";
62
+ children: ReactNode;
63
+ }
64
+
65
+ const Color = ({ variant = "compact", children }: ColorProps) => (
66
+ <div
67
+ className={cn(
68
+ "my-4",
69
+ variant === "compact" &&
70
+ "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",
71
+ variant === "table" && "overflow-hidden rounded-xl border border-border"
72
+ )}
73
+ >
74
+ {variant === "table" ? (
75
+ <table className="w-full text-sm">
76
+ <tbody>{children}</tbody>
77
+ </table>
78
+ ) : (
79
+ children
80
+ )}
81
+ </div>
82
+ );
83
+
84
+ Color.Item = ColorItem;
85
+ Color.Row = ColorRow;
86
+
87
+ export { Color };
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ interface ColumnsProps {
6
+ cols?: 1 | 2 | 3 | 4;
7
+ children: ReactNode;
8
+ }
9
+
10
+ const colStyles: Record<number, string> = {
11
+ 1: "grid-cols-1",
12
+ 2: "grid-cols-1 sm:grid-cols-2",
13
+ 3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
14
+ 4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
15
+ };
16
+
17
+ export const Columns = ({ cols = 2, children }: ColumnsProps) => (
18
+ <div className={cn("my-4 grid gap-4", colStyles[cols] ?? colStyles[2])}>
19
+ {children}
20
+ </div>
21
+ );
22
+
23
+ export const Column = ({ children }: { children: ReactNode }) => (
24
+ <div className="min-w-0">{children}</div>
25
+ );
@@ -0,0 +1,45 @@
1
+ "use client";
2
+
3
+ import { useCallback, useState } from "react";
4
+ import type { ReactNode } from "react";
5
+
6
+ import { cn } from "@/lib/utils";
7
+
8
+ interface ExpandableProps {
9
+ title?: string;
10
+ defaultOpen?: boolean;
11
+ children: ReactNode;
12
+ }
13
+
14
+ export const Expandable = ({
15
+ title = "properties",
16
+ defaultOpen = false,
17
+ children,
18
+ }: ExpandableProps) => {
19
+ const [open, setOpen] = useState(defaultOpen);
20
+ const toggle = useCallback(() => setOpen((prev) => !prev), []);
21
+
22
+ return (
23
+ <div className="mt-2 ml-4 border-l border-border pl-4">
24
+ <button
25
+ className="inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground"
26
+ onClick={toggle}
27
+ type="button"
28
+ >
29
+ <svg
30
+ aria-hidden
31
+ className={cn(
32
+ "size-3 transition-transform duration-150",
33
+ open && "rotate-90"
34
+ )}
35
+ fill="currentColor"
36
+ viewBox="0 0 24 24"
37
+ >
38
+ <path d="m9 18 6-6-6-6" />
39
+ </svg>
40
+ {open ? "Hide" : "Show"} {title}
41
+ </button>
42
+ {open ? <div className="mt-2">{children}</div> : null}
43
+ </div>
44
+ );
45
+ };
@@ -0,0 +1,77 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ interface FieldBadge {
6
+ label: string;
7
+ className?: string;
8
+ }
9
+
10
+ interface FieldLayoutProps {
11
+ name: string;
12
+ type?: string;
13
+ required?: boolean;
14
+ deprecated?: boolean;
15
+ defaultValue?: string;
16
+ badges?: FieldBadge[];
17
+ children?: ReactNode;
18
+ }
19
+
20
+ export const FieldLayout = ({
21
+ name,
22
+ type,
23
+ required,
24
+ deprecated,
25
+ defaultValue,
26
+ badges,
27
+ children,
28
+ }: FieldLayoutProps) => (
29
+ <div className="border-b border-border py-4 first:pt-0 last:border-b-0">
30
+ <div className="flex flex-wrap items-center gap-2">
31
+ {badges
32
+ ?.filter((b) => b.label)
33
+ .map((badge) => (
34
+ <span
35
+ className={cn(
36
+ "rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",
37
+ badge.className
38
+ )}
39
+ key={badge.label}
40
+ >
41
+ {badge.label}
42
+ </span>
43
+ ))}
44
+ <code className="rounded-md bg-muted px-1.5 py-0.5 font-mono text-sm font-medium">
45
+ {name}
46
+ </code>
47
+ {type ? (
48
+ <span className="text-xs text-muted-foreground">{type}</span>
49
+ ) : null}
50
+ {required ? (
51
+ <span className="text-xs font-medium text-red-600 dark:text-red-400">
52
+ required
53
+ </span>
54
+ ) : null}
55
+ {deprecated ? (
56
+ <span
57
+ className={cn(
58
+ "rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-700",
59
+ "dark:bg-amber-900/40 dark:text-amber-300"
60
+ )}
61
+ >
62
+ deprecated
63
+ </span>
64
+ ) : null}
65
+ {defaultValue ? (
66
+ <span className="text-xs text-muted-foreground">
67
+ Default: <code className="font-mono">{defaultValue}</code>
68
+ </span>
69
+ ) : null}
70
+ </div>
71
+ {children ? (
72
+ <div className="mt-2 text-sm text-muted-foreground [&>p:first-child]:mt-0 [&>p:last-child]:mb-0">
73
+ {children}
74
+ </div>
75
+ ) : null}
76
+ </div>
77
+ );
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ interface FrameProps {
4
+ caption?: string;
5
+ hint?: string;
6
+ children: ReactNode;
7
+ }
8
+
9
+ export const Frame = ({ caption, hint, children }: FrameProps) => (
10
+ <figure className="my-4">
11
+ {hint ? (
12
+ <div className="mb-2 text-sm text-muted-foreground">{hint}</div>
13
+ ) : null}
14
+ <div className="overflow-hidden rounded-xl border border-border bg-card">
15
+ {children}
16
+ </div>
17
+ {caption ? (
18
+ <figcaption className="mt-2 text-center text-sm text-muted-foreground">
19
+ {caption}
20
+ </figcaption>
21
+ ) : null}
22
+ </figure>
23
+ );
@@ -0,0 +1,18 @@
1
+ import { isValidElement } from "react";
2
+ import type { ReactNode } from "react";
3
+
4
+ export const getTextContent = (node: ReactNode): string => {
5
+ if (typeof node === "string") {
6
+ return node;
7
+ }
8
+ if (typeof node === "number") {
9
+ return String(node);
10
+ }
11
+ if (Array.isArray(node)) {
12
+ return node.map(getTextContent).join("");
13
+ }
14
+ if (isValidElement<{ children?: ReactNode }>(node)) {
15
+ return getTextContent(node.props.children);
16
+ }
17
+ return "";
18
+ };
@@ -0,0 +1,56 @@
1
+ import { cn } from "@/lib/utils";
2
+
3
+ interface IconProps {
4
+ icon: string;
5
+ color?: string;
6
+ size?: number;
7
+ className?: string;
8
+ }
9
+
10
+ export const Icon = ({ icon, color, size = 16, className }: IconProps) => (
11
+ <span
12
+ aria-hidden
13
+ className={cn("inline-flex items-center justify-center", className)}
14
+ style={{
15
+ color: color ?? undefined,
16
+ height: size,
17
+ width: size,
18
+ }}
19
+ >
20
+ <svg
21
+ className="size-full"
22
+ fill="none"
23
+ stroke="currentColor"
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ strokeWidth={2}
27
+ viewBox="0 0 24 24"
28
+ >
29
+ <title>{icon}</title>
30
+ {icon === "flag" && (
31
+ <path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1zM4 22v-7" />
32
+ )}
33
+ {icon === "check" && <path d="M20 6 9 17l-5-5" />}
34
+ {icon === "star" && (
35
+ <path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z" />
36
+ )}
37
+ {icon === "info" && (
38
+ <>
39
+ <circle cx="12" cy="12" r="10" />
40
+ <path d="M12 16v-4M12 8h.01" />
41
+ </>
42
+ )}
43
+ {icon === "alert-triangle" && (
44
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01" />
45
+ )}
46
+ {icon === "arrow-right" && <path d="M5 12h14M12 5l7 7-7 7" />}
47
+ {icon === "external-link" && (
48
+ <>
49
+ <path d="M15 3h6v6" />
50
+ <path d="M10 14 21 3" />
51
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
52
+ </>
53
+ )}
54
+ </svg>
55
+ </span>
56
+ );
@@ -0,0 +1,96 @@
1
+ import type { MDXComponents } from "mdx/types";
2
+ import Link from "next/link";
3
+
4
+ import { Accordion, AccordionGroup } from "./accordion";
5
+ import { Badge } from "./badge";
6
+ import { Callout, Check, Danger, Info, Note, Tip, Warning } from "./callout";
7
+ import { Card } from "./card";
8
+ import { CodeBlock } from "./code-block";
9
+ import { CodeGroup } from "./code-group";
10
+ import { Color } from "./color";
11
+ import { Column, Columns } from "./columns";
12
+ import { Expandable } from "./expandable";
13
+ import { Frame } from "./frame";
14
+ import { Icon } from "./icon";
15
+ import { Installer } from "./installer";
16
+ import { Panel } from "./panel";
17
+ import { ParamField } from "./param-field";
18
+ import { Preview } from "./preview";
19
+ import { Prompt } from "./prompt";
20
+ import { RequestExample, ResponseExample } from "./request-example";
21
+ import { ResponseField } from "./response-field";
22
+ import { Step, Steps } from "./steps";
23
+ import { Tab, Tabs } from "./tabs";
24
+ import { Tile } from "./tile";
25
+ import { Tooltip } from "./tooltip";
26
+ import { Tree } from "./tree";
27
+ import { TypeTable } from "./type-table";
28
+ import { Update } from "./update";
29
+ import { Video } from "./video";
30
+ import { View, ViewGroup } from "./view";
31
+
32
+ const MdxLink = ({
33
+ href,
34
+ children,
35
+ ...props
36
+ }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
37
+ if (!href) {
38
+ return <a {...props}>{children}</a>;
39
+ }
40
+ const isExternal = href.startsWith("http");
41
+ if (isExternal) {
42
+ return (
43
+ <a {...props} href={href} rel="noopener noreferrer" target="_blank">
44
+ {children}
45
+ </a>
46
+ );
47
+ }
48
+ return (
49
+ <Link href={href} {...props}>
50
+ {children}
51
+ </Link>
52
+ );
53
+ };
54
+
55
+ export const mdxComponents: MDXComponents = {
56
+ Accordion,
57
+ AccordionGroup,
58
+ Badge,
59
+ Callout,
60
+ Card,
61
+ Check,
62
+ CodeGroup,
63
+ Color,
64
+ Column,
65
+ Columns,
66
+ Danger,
67
+ Expandable,
68
+ Frame,
69
+ Icon,
70
+ Info,
71
+ Installer,
72
+ Note,
73
+ Panel,
74
+ ParamField,
75
+ Preview,
76
+ Prompt,
77
+ RequestExample,
78
+ ResponseExample,
79
+ ResponseField,
80
+ Step,
81
+ Steps,
82
+ Tab,
83
+ Tabs,
84
+ Tile,
85
+ Tip,
86
+ Tooltip,
87
+ Tree,
88
+ TypeTable,
89
+ Update,
90
+ Video,
91
+ View,
92
+ ViewGroup,
93
+ Warning,
94
+ a: MdxLink,
95
+ pre: CodeBlock,
96
+ };
@@ -0,0 +1,20 @@
1
+ export const Installer = ({
2
+ path,
3
+ command,
4
+ }: {
5
+ path: string;
6
+ command?: string;
7
+ }) => {
8
+ const resolvedCommand =
9
+ command ?? `npx @vercel/platform-elements@latest ${path}`;
10
+ return (
11
+ <div className="my-4 grid gap-2.5 rounded-xl border border-border bg-background/70 p-3.5">
12
+ <div className="text-xs uppercase tracking-widest text-muted-foreground">
13
+ Install
14
+ </div>
15
+ <pre className="m-0 overflow-x-auto rounded-lg bg-code p-3 font-mono text-sm text-code-foreground">
16
+ <code>{resolvedCommand}</code>
17
+ </pre>
18
+ </div>
19
+ );
20
+ };
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ interface PanelProps {
4
+ children: ReactNode;
5
+ }
6
+
7
+ export const Panel = ({ children }: PanelProps) => (
8
+ <aside className="my-4 rounded-xl border border-border bg-card p-4">
9
+ {children}
10
+ </aside>
11
+ );
@@ -0,0 +1,56 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import { FieldLayout } from "./field-layout";
4
+
5
+ interface ParamFieldProps {
6
+ path?: string;
7
+ query?: string;
8
+ body?: string;
9
+ header?: string;
10
+ type?: string;
11
+ required?: boolean;
12
+ deprecated?: boolean;
13
+ default?: string;
14
+ placeholder?: string;
15
+ children?: ReactNode;
16
+ }
17
+
18
+ export const ParamField = ({
19
+ path,
20
+ query,
21
+ body,
22
+ header,
23
+ type,
24
+ required,
25
+ deprecated,
26
+ default: defaultValue,
27
+ children,
28
+ }: ParamFieldProps) => {
29
+ const name = path ?? query ?? body ?? header ?? "";
30
+
31
+ let location: string | undefined;
32
+ if (path) {
33
+ location = "path";
34
+ } else if (query) {
35
+ location = "query";
36
+ } else if (body) {
37
+ location = "body";
38
+ } else if (header) {
39
+ location = "header";
40
+ }
41
+
42
+ const badges = location ? [{ label: location }] : undefined;
43
+
44
+ return (
45
+ <FieldLayout
46
+ badges={badges}
47
+ defaultValue={defaultValue}
48
+ deprecated={deprecated}
49
+ name={name}
50
+ required={required}
51
+ type={type}
52
+ >
53
+ {children}
54
+ </FieldLayout>
55
+ );
56
+ };
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export const Preview = ({
4
+ example,
5
+ source,
6
+ title = "Preview",
7
+ children,
8
+ }: {
9
+ example?: string;
10
+ source?: string;
11
+ title?: string;
12
+ children?: ReactNode;
13
+ }) => (
14
+ <div className="my-4 grid gap-3 rounded-xl border border-border bg-surface p-4">
15
+ <div className="flex flex-wrap items-center gap-2 text-xs uppercase tracking-wider text-muted-foreground">
16
+ <span className="font-semibold">{title}</span>
17
+ {example ? (
18
+ <span className="rounded-full border border-border bg-accent px-2.5 py-1 text-primary">
19
+ {example}
20
+ </span>
21
+ ) : null}
22
+ {source ? (
23
+ <span className="rounded-full border border-border bg-accent px-2.5 py-1 text-primary">
24
+ {source}
25
+ </span>
26
+ ) : null}
27
+ </div>
28
+ <div className="rounded-xl border border-dashed border-border bg-gradient-to-br from-primary/15 to-primary/5 p-4.5">
29
+ {children ?? (
30
+ <div className="text-sm text-muted-foreground">
31
+ Interactive preview placeholder
32
+ </div>
33
+ )}
34
+ </div>
35
+ </div>
36
+ );