blodemd 0.0.5 → 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 (184) hide show
  1. package/dev-server/app/[[...slug]]/page.tsx +139 -0
  2. package/dev-server/app/blodemd-dev/invalidate/route.ts +12 -0
  3. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +32 -0
  4. package/dev-server/app/blodemd-dev/version/route.ts +14 -0
  5. package/dev-server/app/blodemd-internal/proxy/route.ts +86 -0
  6. package/dev-server/app/error.tsx +24 -0
  7. package/dev-server/app/globals.css +4 -0
  8. package/dev-server/app/layout.tsx +38 -0
  9. package/dev-server/app/not-found.tsx +18 -0
  10. package/dev-server/app/search/route.ts +17 -0
  11. package/dev-server/components/dev-reload-script.tsx +86 -0
  12. package/dev-server/components/providers.tsx +15 -0
  13. package/dev-server/lib/dev-state.ts +8 -0
  14. package/dev-server/lib/local-content-source.ts +103 -0
  15. package/dev-server/lib/local-runtime.tsx +558 -0
  16. package/dev-server/next.config.js +46 -0
  17. package/dev-server/package.json +57 -0
  18. package/dev-server/postcss.config.mjs +7 -0
  19. package/dev-server/public/glide-variable.woff2 +0 -0
  20. package/dev-server/tsconfig.json +49 -0
  21. package/dist/cli.mjs +108 -39
  22. package/dist/cli.mjs.map +1 -1
  23. package/docs/app/globals.css +455 -0
  24. package/docs/components/api/api-playground.tsx +295 -0
  25. package/docs/components/api/api-reference.tsx +121 -0
  26. package/docs/components/content/collection-index.tsx +114 -0
  27. package/docs/components/docs/contextual-menu.tsx +406 -0
  28. package/docs/components/docs/copy-page-menu.tsx +255 -0
  29. package/docs/components/docs/doc-header.tsx +192 -0
  30. package/docs/components/docs/doc-shell.tsx +289 -0
  31. package/docs/components/docs/doc-sidebar.tsx +206 -0
  32. package/docs/components/docs/doc-toc.tsx +45 -0
  33. package/docs/components/docs/mobile-nav.tsx +207 -0
  34. package/docs/components/mdx/accordion.tsx +83 -0
  35. package/docs/components/mdx/badge.tsx +79 -0
  36. package/docs/components/mdx/callout.tsx +88 -0
  37. package/docs/components/mdx/card.tsx +104 -0
  38. package/docs/components/mdx/code-block.tsx +75 -0
  39. package/docs/components/mdx/code-group.tsx +94 -0
  40. package/docs/components/mdx/color.tsx +87 -0
  41. package/docs/components/mdx/columns.tsx +25 -0
  42. package/docs/components/mdx/expandable.tsx +45 -0
  43. package/docs/components/mdx/field-layout.tsx +77 -0
  44. package/docs/components/mdx/frame.tsx +23 -0
  45. package/docs/components/mdx/get-text-content.ts +18 -0
  46. package/docs/components/mdx/icon.tsx +56 -0
  47. package/docs/components/mdx/index.tsx +96 -0
  48. package/docs/components/mdx/installer.tsx +20 -0
  49. package/docs/components/mdx/panel.tsx +11 -0
  50. package/docs/components/mdx/param-field.tsx +56 -0
  51. package/docs/components/mdx/preview.tsx +36 -0
  52. package/docs/components/mdx/prompt.tsx +63 -0
  53. package/docs/components/mdx/request-example.tsx +27 -0
  54. package/docs/components/mdx/response-field.tsx +42 -0
  55. package/docs/components/mdx/steps.tsx +92 -0
  56. package/docs/components/mdx/tabs.tsx +88 -0
  57. package/docs/components/mdx/tile.tsx +43 -0
  58. package/docs/components/mdx/tooltip.tsx +71 -0
  59. package/docs/components/mdx/tree.tsx +120 -0
  60. package/docs/components/mdx/type-table.tsx +71 -0
  61. package/docs/components/mdx/update.tsx +44 -0
  62. package/docs/components/mdx/video.tsx +12 -0
  63. package/docs/components/mdx/view.tsx +66 -0
  64. package/docs/components/providers.tsx +15 -0
  65. package/docs/components/ui/breadcrumb.tsx +92 -0
  66. package/docs/components/ui/button.tsx +90 -0
  67. package/docs/components/ui/card.tsx +92 -0
  68. package/docs/components/ui/command.tsx +139 -0
  69. package/docs/components/ui/dialog.tsx +97 -0
  70. package/docs/components/ui/field.tsx +237 -0
  71. package/docs/components/ui/input.tsx +105 -0
  72. package/docs/components/ui/label.tsx +22 -0
  73. package/docs/components/ui/popover.tsx +72 -0
  74. package/docs/components/ui/search.tsx +380 -0
  75. package/docs/components/ui/separator.tsx +26 -0
  76. package/docs/components/ui/sheet.tsx +104 -0
  77. package/docs/components/ui/sidebar.tsx +433 -0
  78. package/docs/components/ui/theme-toggle.tsx +62 -0
  79. package/docs/components/ui/tooltip.tsx +53 -0
  80. package/docs/lib/contextual-options.ts +193 -0
  81. package/docs/lib/docs-collection.ts +22 -0
  82. package/docs/lib/mdx.ts +90 -0
  83. package/docs/lib/navigation.ts +288 -0
  84. package/docs/lib/openapi.ts +158 -0
  85. package/docs/lib/routes.ts +10 -0
  86. package/docs/lib/server-cache.ts +83 -0
  87. package/docs/lib/shiki.ts +35 -0
  88. package/docs/lib/theme.ts +29 -0
  89. package/docs/lib/toc.ts +2 -0
  90. package/docs/lib/utils.ts +5 -0
  91. package/package.json +33 -4
  92. package/packages/@repo/common/dist/index.d.ts +9 -0
  93. package/packages/@repo/common/dist/index.d.ts.map +1 -0
  94. package/packages/@repo/common/dist/index.js +42 -0
  95. package/packages/@repo/common/package.json +34 -0
  96. package/packages/@repo/common/src/common.unit.test.ts +55 -0
  97. package/packages/@repo/common/src/index.ts +51 -0
  98. package/packages/@repo/contracts/dist/api-key.d.ts +30 -0
  99. package/packages/@repo/contracts/dist/api-key.d.ts.map +1 -0
  100. package/packages/@repo/contracts/dist/api-key.js +20 -0
  101. package/packages/@repo/contracts/dist/dates.d.ts +4 -0
  102. package/packages/@repo/contracts/dist/dates.d.ts.map +1 -0
  103. package/packages/@repo/contracts/dist/dates.js +2 -0
  104. package/packages/@repo/contracts/dist/deployment.d.ts +71 -0
  105. package/packages/@repo/contracts/dist/deployment.d.ts.map +1 -0
  106. package/packages/@repo/contracts/dist/deployment.js +46 -0
  107. package/packages/@repo/contracts/dist/domain.d.ts +94 -0
  108. package/packages/@repo/contracts/dist/domain.d.ts.map +1 -0
  109. package/packages/@repo/contracts/dist/domain.js +36 -0
  110. package/packages/@repo/contracts/dist/ids.d.ts +14 -0
  111. package/packages/@repo/contracts/dist/ids.d.ts.map +1 -0
  112. package/packages/@repo/contracts/dist/ids.js +10 -0
  113. package/packages/@repo/contracts/dist/index.d.ts +10 -0
  114. package/packages/@repo/contracts/dist/index.d.ts.map +1 -0
  115. package/packages/@repo/contracts/dist/index.js +11 -0
  116. package/packages/@repo/contracts/dist/pagination.d.ts +23 -0
  117. package/packages/@repo/contracts/dist/pagination.d.ts.map +1 -0
  118. package/packages/@repo/contracts/dist/pagination.js +15 -0
  119. package/packages/@repo/contracts/dist/project.d.ts +25 -0
  120. package/packages/@repo/contracts/dist/project.d.ts.map +1 -0
  121. package/packages/@repo/contracts/dist/project.js +23 -0
  122. package/packages/@repo/contracts/dist/tenant.d.ts +99 -0
  123. package/packages/@repo/contracts/dist/tenant.d.ts.map +1 -0
  124. package/packages/@repo/contracts/dist/tenant.js +36 -0
  125. package/packages/@repo/contracts/dist/user.d.ts +9 -0
  126. package/packages/@repo/contracts/dist/user.d.ts.map +1 -0
  127. package/packages/@repo/contracts/dist/user.js +9 -0
  128. package/packages/@repo/contracts/package.json +37 -0
  129. package/packages/@repo/contracts/src/api-key.ts +27 -0
  130. package/packages/@repo/contracts/src/dates.ts +4 -0
  131. package/packages/@repo/contracts/src/deployment.ts +73 -0
  132. package/packages/@repo/contracts/src/domain.ts +51 -0
  133. package/packages/@repo/contracts/src/ids.ts +22 -0
  134. package/packages/@repo/contracts/src/index.ts +11 -0
  135. package/packages/@repo/contracts/src/pagination.ts +21 -0
  136. package/packages/@repo/contracts/src/project.ts +30 -0
  137. package/packages/@repo/contracts/src/tenant.ts +54 -0
  138. package/packages/@repo/contracts/src/user.ts +12 -0
  139. package/packages/@repo/models/dist/docs-config.d.ts +985 -0
  140. package/packages/@repo/models/dist/docs-config.d.ts.map +1 -0
  141. package/packages/@repo/models/dist/docs-config.js +548 -0
  142. package/packages/@repo/models/dist/index.d.ts +3 -0
  143. package/packages/@repo/models/dist/index.d.ts.map +1 -0
  144. package/packages/@repo/models/dist/index.js +3 -0
  145. package/packages/@repo/models/dist/tenant.d.ts +25 -0
  146. package/packages/@repo/models/dist/tenant.d.ts.map +1 -0
  147. package/packages/@repo/models/dist/tenant.js +1 -0
  148. package/packages/@repo/models/package.json +37 -0
  149. package/packages/@repo/models/src/docs-config.ts +648 -0
  150. package/packages/@repo/models/src/index.ts +3 -0
  151. package/packages/@repo/models/src/tenant.ts +29 -0
  152. package/packages/@repo/prebuild/dist/index.d.ts +2 -0
  153. package/packages/@repo/prebuild/dist/index.d.ts.map +1 -0
  154. package/packages/@repo/prebuild/dist/index.js +2 -0
  155. package/packages/@repo/prebuild/dist/openapi.d.ts +43 -0
  156. package/packages/@repo/prebuild/dist/openapi.d.ts.map +1 -0
  157. package/packages/@repo/prebuild/dist/openapi.js +58 -0
  158. package/packages/@repo/prebuild/package.json +39 -0
  159. package/packages/@repo/prebuild/src/index.ts +2 -0
  160. package/packages/@repo/prebuild/src/openapi.ts +116 -0
  161. package/packages/@repo/previewing/dist/blob-source.d.ts +16 -0
  162. package/packages/@repo/previewing/dist/blob-source.d.ts.map +1 -0
  163. package/packages/@repo/previewing/dist/blob-source.js +110 -0
  164. package/packages/@repo/previewing/dist/content-source.d.ts +12 -0
  165. package/packages/@repo/previewing/dist/content-source.d.ts.map +1 -0
  166. package/packages/@repo/previewing/dist/content-source.js +1 -0
  167. package/packages/@repo/previewing/dist/fs-source.d.ts +11 -0
  168. package/packages/@repo/previewing/dist/fs-source.d.ts.map +1 -0
  169. package/packages/@repo/previewing/dist/fs-source.js +79 -0
  170. package/packages/@repo/previewing/dist/index.d.ts +120 -0
  171. package/packages/@repo/previewing/dist/index.d.ts.map +1 -0
  172. package/packages/@repo/previewing/dist/index.js +984 -0
  173. package/packages/@repo/previewing/package.json +41 -0
  174. package/packages/@repo/previewing/src/blob-source.ts +167 -0
  175. package/packages/@repo/previewing/src/content-source.ts +12 -0
  176. package/packages/@repo/previewing/src/fs-source.ts +111 -0
  177. package/packages/@repo/previewing/src/index.ts +1490 -0
  178. package/packages/@repo/previewing/src/index.unit.test.ts +290 -0
  179. package/packages/@repo/validation/dist/index.d.ts +12 -0
  180. package/packages/@repo/validation/dist/index.d.ts.map +1 -0
  181. package/packages/@repo/validation/dist/index.js +30 -0
  182. package/packages/@repo/validation/package.json +37 -0
  183. package/packages/@repo/validation/src/index.ts +59 -0
  184. package/packages/@repo/validation/src/mintlify-docs-schema.json +5016 -0
@@ -0,0 +1,63 @@
1
+ "use client";
2
+
3
+ import { CheckIcon, ClipboardIcon } from "blode-icons-react";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
+ import type { ReactNode } from "react";
6
+
7
+ import { getTextContent } from "./get-text-content";
8
+
9
+ interface PromptProps {
10
+ description: string;
11
+ icon?: ReactNode;
12
+ children: ReactNode;
13
+ }
14
+
15
+ export const Prompt = ({ description, icon, children }: PromptProps) => {
16
+ const [copied, setCopied] = useState(false);
17
+ const text = useMemo(() => getTextContent(children), [children]);
18
+
19
+ useEffect(() => {
20
+ if (copied) {
21
+ const timer = setTimeout(() => setCopied(false), 2000);
22
+ return () => clearTimeout(timer);
23
+ }
24
+ }, [copied]);
25
+
26
+ const handleCopy = useCallback(async () => {
27
+ if (!text) {
28
+ return;
29
+ }
30
+ await navigator.clipboard.writeText(text);
31
+ setCopied(true);
32
+ }, [text]);
33
+
34
+ return (
35
+ <div className="my-4 rounded-xl border border-border bg-card">
36
+ <div className="flex items-start gap-3 border-b border-border p-4">
37
+ {icon ? (
38
+ <span className="mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground">
39
+ {icon}
40
+ </span>
41
+ ) : null}
42
+ <div className="min-w-0 flex-1 text-sm text-foreground">
43
+ {description}
44
+ </div>
45
+ <button
46
+ className="inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
47
+ onClick={handleCopy}
48
+ type="button"
49
+ >
50
+ <span className="sr-only">{copied ? "Copied" : "Copy prompt"}</span>
51
+ {copied ? (
52
+ <CheckIcon aria-hidden className="size-3.5" />
53
+ ) : (
54
+ <ClipboardIcon aria-hidden className="size-3.5" />
55
+ )}
56
+ </button>
57
+ </div>
58
+ <div className="p-4 text-sm text-muted-foreground [&>p:first-child]:mt-0 [&>p:last-child]:mb-0">
59
+ {children}
60
+ </div>
61
+ </div>
62
+ );
63
+ };
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ interface RequestExampleProps {
4
+ children: ReactNode;
5
+ }
6
+
7
+ export const RequestExample = ({ children }: RequestExampleProps) => (
8
+ <div className="my-4">
9
+ <div className="mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
10
+ Request
11
+ </div>
12
+ <div className="[&>pre]:mt-0 [&>[data-rehype-pretty-code-figure]]:mt-0">
13
+ {children}
14
+ </div>
15
+ </div>
16
+ );
17
+
18
+ export const ResponseExample = ({ children }: RequestExampleProps) => (
19
+ <div className="my-4">
20
+ <div className="mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
21
+ Response
22
+ </div>
23
+ <div className="[&>pre]:mt-0 [&>[data-rehype-pretty-code-figure]]:mt-0">
24
+ {children}
25
+ </div>
26
+ </div>
27
+ );
@@ -0,0 +1,42 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import { FieldLayout } from "./field-layout";
4
+
5
+ interface ResponseFieldProps {
6
+ name: string;
7
+ type: string;
8
+ default?: string;
9
+ required?: boolean;
10
+ deprecated?: boolean;
11
+ pre?: string[];
12
+ post?: string[];
13
+ children?: ReactNode;
14
+ }
15
+
16
+ export const ResponseField = ({
17
+ name,
18
+ type,
19
+ default: defaultValue,
20
+ required,
21
+ deprecated,
22
+ pre,
23
+ post,
24
+ children,
25
+ }: ResponseFieldProps) => {
26
+ const preBadges = pre?.map((label) => ({ label })) ?? [];
27
+ const postBadges = post?.map((label) => ({ label })) ?? [];
28
+ const badges = [...preBadges, ...postBadges];
29
+
30
+ return (
31
+ <FieldLayout
32
+ badges={badges.length > 0 ? badges : undefined}
33
+ defaultValue={defaultValue}
34
+ deprecated={deprecated}
35
+ name={name}
36
+ required={required}
37
+ type={type}
38
+ >
39
+ {children}
40
+ </FieldLayout>
41
+ );
42
+ };
@@ -0,0 +1,92 @@
1
+ import type { ReactNode } from "react";
2
+ import { isValidElement } from "react";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ interface StepProps {
7
+ title: string;
8
+ children?: ReactNode;
9
+ icon?: ReactNode;
10
+ stepNumber?: number;
11
+ titleSize?: "p" | "h2" | "h3" | "h4";
12
+ id?: string;
13
+ }
14
+
15
+ export const Step = ({
16
+ title,
17
+ children,
18
+ icon,
19
+ stepNumber,
20
+ titleSize = "p",
21
+ id,
22
+ }: StepProps) => {
23
+ const TitleTag = titleSize === "p" ? "div" : titleSize;
24
+ const anchorId = id ?? title.toLowerCase().replaceAll(/\s+/g, "-");
25
+
26
+ return (
27
+ <div className="relative pb-8 pl-10 last:pb-0" id={anchorId}>
28
+ <div
29
+ aria-hidden
30
+ className="absolute left-0 flex size-7 items-center justify-center rounded-full border border-border bg-muted font-mono text-xs font-medium"
31
+ >
32
+ {icon ?? stepNumber ?? null}
33
+ </div>
34
+ <TitleTag
35
+ className={cn(
36
+ "font-semibold leading-7",
37
+ titleSize === "h2" && "text-xl",
38
+ titleSize === "h3" && "text-lg",
39
+ titleSize === "h4" && "text-base",
40
+ titleSize === "p" && "text-base"
41
+ )}
42
+ >
43
+ {title}
44
+ </TitleTag>
45
+ {children ? (
46
+ <div className="mt-2 text-sm text-muted-foreground">{children}</div>
47
+ ) : null}
48
+ </div>
49
+ );
50
+ };
51
+
52
+ interface StepsProps {
53
+ children: ReactNode;
54
+ titleSize?: "p" | "h2" | "h3" | "h4";
55
+ }
56
+
57
+ export const Steps = ({ children, titleSize }: StepsProps) => {
58
+ const items = Array.isArray(children) ? children : [children];
59
+
60
+ const hasStepChildren = items.some(
61
+ (child) => isValidElement(child) && child.type === Step
62
+ );
63
+
64
+ if (!hasStepChildren) {
65
+ return (
66
+ <div className="steps mb-12 [counter-reset:step] md:ml-4 md:border-l md:pl-8 [&>h3]:step">
67
+ {children}
68
+ </div>
69
+ );
70
+ }
71
+
72
+ let counter = 0;
73
+ const numberedChildren = items.map((child) => {
74
+ if (isValidElement<StepProps>(child) && child.type === Step) {
75
+ counter += 1;
76
+ const stepNumber = child.props.stepNumber ?? counter;
77
+ return (
78
+ <Step
79
+ key={child.props.id ?? child.props.title}
80
+ {...child.props}
81
+ stepNumber={stepNumber}
82
+ titleSize={child.props.titleSize ?? titleSize}
83
+ />
84
+ );
85
+ }
86
+ return child;
87
+ });
88
+
89
+ return (
90
+ <div className="my-6 border-l border-border pl-2">{numberedChildren}</div>
91
+ );
92
+ };
@@ -0,0 +1,88 @@
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 TabProps {
9
+ title?: string;
10
+ label?: string;
11
+ icon?: ReactNode;
12
+ id?: string;
13
+ children: ReactNode;
14
+ }
15
+
16
+ export const Tab = ({ children }: TabProps) => (
17
+ <div className="p-4">{children}</div>
18
+ );
19
+
20
+ interface TabsProps {
21
+ children: ReactNode;
22
+ defaultTabIndex?: number;
23
+ borderBottom?: boolean;
24
+ }
25
+
26
+ export const Tabs = ({
27
+ children,
28
+ defaultTabIndex = 0,
29
+ borderBottom,
30
+ }: TabsProps) => {
31
+ const items = useMemo(() => {
32
+ const nodes = Array.isArray(children) ? children : [children];
33
+ return nodes.filter((child): child is ReactElement<TabProps> =>
34
+ isValidElement<TabProps>(child)
35
+ );
36
+ }, [children]);
37
+
38
+ const [active, setActive] = useState(defaultTabIndex);
39
+ const activeItem = items[active];
40
+ const handleTabClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {
41
+ const index = Number(event.currentTarget.dataset.index ?? "0");
42
+ setActive(index);
43
+ }, []);
44
+
45
+ if (!items.length) {
46
+ return null;
47
+ }
48
+
49
+ return (
50
+ <div
51
+ className={cn(
52
+ "overflow-hidden rounded-xl border border-border bg-surface",
53
+ borderBottom && "border-b-2"
54
+ )}
55
+ >
56
+ <div className="flex gap-2 bg-muted p-2" role="tablist">
57
+ {items.map((item, index) => {
58
+ const tabLabel =
59
+ item.props.title ?? item.props.label ?? `Tab ${index + 1}`;
60
+ return (
61
+ <button
62
+ aria-selected={index === active}
63
+ className={cn(
64
+ "inline-flex items-center gap-1.5 rounded-full border-none bg-transparent px-3 py-2 text-sm cursor-pointer transition-colors",
65
+ index === active
66
+ ? "bg-primary text-primary-foreground"
67
+ : "text-muted-foreground hover:text-foreground"
68
+ )}
69
+ data-index={index}
70
+ key={String(item.key ?? tabLabel)}
71
+ onClick={handleTabClick}
72
+ role="tab"
73
+ type="button"
74
+ >
75
+ {item.props.icon ? (
76
+ <span className="shrink-0">{item.props.icon}</span>
77
+ ) : null}
78
+ {tabLabel}
79
+ </button>
80
+ );
81
+ })}
82
+ </div>
83
+ <div className="p-4" role="tabpanel">
84
+ {activeItem}
85
+ </div>
86
+ </div>
87
+ );
88
+ };
@@ -0,0 +1,43 @@
1
+ import Link from "next/link";
2
+ import type { ReactNode } from "react";
3
+
4
+ interface TileProps {
5
+ href: string;
6
+ title?: string;
7
+ description?: string;
8
+ children: ReactNode;
9
+ }
10
+
11
+ export const Tile = ({ href, title, description, children }: TileProps) => {
12
+ const isExternal = href.startsWith("http");
13
+
14
+ const inner = (
15
+ <div className="group/tile overflow-hidden rounded-xl border border-border bg-card transition-colors hover:border-primary/30 hover:bg-accent/50">
16
+ <div className="flex items-center justify-center bg-muted/50 p-6">
17
+ {children}
18
+ </div>
19
+ {title || description ? (
20
+ <div className="border-t border-border p-3">
21
+ {title ? (
22
+ <div className="text-sm font-medium text-foreground">{title}</div>
23
+ ) : null}
24
+ {description ? (
25
+ <div className="mt-0.5 text-xs text-muted-foreground">
26
+ {description}
27
+ </div>
28
+ ) : null}
29
+ </div>
30
+ ) : null}
31
+ </div>
32
+ );
33
+
34
+ if (isExternal) {
35
+ return (
36
+ <a href={href} rel="noopener noreferrer" target="_blank">
37
+ {inner}
38
+ </a>
39
+ );
40
+ }
41
+
42
+ return <Link href={href}>{inner}</Link>;
43
+ };
@@ -0,0 +1,71 @@
1
+ "use client";
2
+
3
+ import { useCallback, useRef, useState } from "react";
4
+ import type { ReactNode } from "react";
5
+
6
+ interface TooltipProps {
7
+ tip: string;
8
+ headline?: string;
9
+ cta?: string;
10
+ href?: string;
11
+ children: ReactNode;
12
+ }
13
+
14
+ export const Tooltip = ({
15
+ tip,
16
+ headline,
17
+ cta,
18
+ href,
19
+ children,
20
+ }: TooltipProps) => {
21
+ const [open, setOpen] = useState(false);
22
+ const timeoutRef = useRef<ReturnType<typeof setTimeout>>(null);
23
+
24
+ const show = useCallback(() => {
25
+ if (timeoutRef.current) {
26
+ clearTimeout(timeoutRef.current);
27
+ }
28
+ setOpen(true);
29
+ }, []);
30
+
31
+ const hide = useCallback(() => {
32
+ timeoutRef.current = setTimeout(() => setOpen(false), 150);
33
+ }, []);
34
+
35
+ return (
36
+ <span className="relative inline-block">
37
+ <button
38
+ className="cursor-help border-b border-dashed border-muted-foreground bg-transparent p-0 text-inherit"
39
+ onBlur={hide}
40
+ onFocus={show}
41
+ onMouseEnter={show}
42
+ onMouseLeave={hide}
43
+ type="button"
44
+ >
45
+ {children}
46
+ </button>
47
+ {open ? (
48
+ <span
49
+ className="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-64 -translate-x-1/2 rounded-lg border border-border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-md"
50
+ onMouseEnter={show}
51
+ onMouseLeave={hide}
52
+ role="tooltip"
53
+ >
54
+ {headline ? (
55
+ <span className="mb-1 block font-semibold">{headline}</span>
56
+ ) : null}
57
+ <span className="block">{tip}</span>
58
+ {cta && href ? (
59
+ <a
60
+ className="mt-1 block text-primary hover:underline"
61
+ href={href}
62
+ rel="noopener noreferrer"
63
+ >
64
+ {cta}
65
+ </a>
66
+ ) : null}
67
+ </span>
68
+ ) : null}
69
+ </span>
70
+ );
71
+ };
@@ -0,0 +1,120 @@
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 TreeFileProps {
9
+ name: string;
10
+ }
11
+
12
+ const TreeFile = ({ name }: TreeFileProps) => (
13
+ <div className="flex items-center gap-2 py-0.5 pl-5 text-sm">
14
+ <svg
15
+ aria-hidden
16
+ className="size-4 shrink-0 text-muted-foreground"
17
+ fill="none"
18
+ stroke="currentColor"
19
+ strokeWidth={2}
20
+ viewBox="0 0 24 24"
21
+ >
22
+ <path
23
+ d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ <path
28
+ d="M14 2v4a2 2 0 0 0 2 2h4"
29
+ strokeLinecap="round"
30
+ strokeLinejoin="round"
31
+ />
32
+ </svg>
33
+ <span className="text-foreground">{name}</span>
34
+ </div>
35
+ );
36
+
37
+ interface TreeFolderProps {
38
+ name: string;
39
+ defaultOpen?: boolean;
40
+ openable?: boolean;
41
+ children?: ReactNode;
42
+ }
43
+
44
+ const TreeFolder = ({
45
+ name,
46
+ defaultOpen = false,
47
+ openable = true,
48
+ children,
49
+ }: TreeFolderProps) => {
50
+ const [open, setOpen] = useState(defaultOpen);
51
+
52
+ const toggle = useCallback(() => {
53
+ if (openable) {
54
+ setOpen((prev) => !prev);
55
+ }
56
+ }, [openable]);
57
+
58
+ return (
59
+ <div>
60
+ <button
61
+ className={cn(
62
+ "flex w-full items-center gap-2 py-0.5 text-sm border-none bg-transparent text-left",
63
+ openable && "cursor-pointer hover:bg-accent/50 rounded"
64
+ )}
65
+ disabled={!openable}
66
+ onClick={toggle}
67
+ type="button"
68
+ >
69
+ <svg
70
+ aria-hidden
71
+ className={cn(
72
+ "size-3 shrink-0 text-muted-foreground transition-transform",
73
+ open && "rotate-90"
74
+ )}
75
+ fill="currentColor"
76
+ viewBox="0 0 24 24"
77
+ >
78
+ <path d="m9 18 6-6-6-6" />
79
+ </svg>
80
+ <svg
81
+ aria-hidden
82
+ className="size-4 shrink-0 text-muted-foreground"
83
+ fill="none"
84
+ stroke="currentColor"
85
+ strokeWidth={2}
86
+ viewBox="0 0 24 24"
87
+ >
88
+ {open ? (
89
+ <path
90
+ d="M5 19a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4l2 2h4a2 2 0 0 1 2 2v1M5 19h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2Z"
91
+ strokeLinecap="round"
92
+ strokeLinejoin="round"
93
+ />
94
+ ) : (
95
+ <path
96
+ d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
97
+ strokeLinecap="round"
98
+ strokeLinejoin="round"
99
+ />
100
+ )}
101
+ </svg>
102
+ <span className="font-medium text-foreground">{name}</span>
103
+ </button>
104
+ {open && children ? (
105
+ <div className="ml-3 border-l border-border pl-2">{children}</div>
106
+ ) : null}
107
+ </div>
108
+ );
109
+ };
110
+
111
+ const Tree = ({ children }: { children: ReactNode }) => (
112
+ <div className="my-4 rounded-xl border border-border bg-card p-4 font-mono text-sm">
113
+ {children}
114
+ </div>
115
+ );
116
+
117
+ Tree.Folder = TreeFolder;
118
+ Tree.File = TreeFile;
119
+
120
+ export { Tree };
@@ -0,0 +1,71 @@
1
+ interface TypeField {
2
+ description?: string;
3
+ type?: string;
4
+ optional?: boolean;
5
+ required?: boolean;
6
+ default?: string;
7
+ }
8
+
9
+ export const TypeTable = ({ type }: { type: Record<string, TypeField> }) => {
10
+ const entries = Object.entries(type ?? {}).map(([name, field]) => ({
11
+ name,
12
+ ...field,
13
+ }));
14
+ const hasDefault = entries.some((entry) => entry.default);
15
+
16
+ return (
17
+ <div className="no-scrollbar my-4 w-full overflow-y-auto rounded-xl border border-border">
18
+ <table className="relative w-full overflow-hidden border-none text-sm">
19
+ <thead>
20
+ <tr>
21
+ <th className="border-b border-border bg-background/70 px-3 py-2.5 text-left text-xs uppercase tracking-wider text-muted-foreground">
22
+ Field
23
+ </th>
24
+ <th className="border-b border-border bg-background/70 px-3 py-2.5 text-left text-xs uppercase tracking-wider text-muted-foreground">
25
+ Type
26
+ </th>
27
+ <th className="border-b border-border bg-background/70 px-3 py-2.5 text-left text-xs uppercase tracking-wider text-muted-foreground">
28
+ Description
29
+ </th>
30
+ <th className="border-b border-border bg-background/70 px-3 py-2.5 text-left text-xs uppercase tracking-wider text-muted-foreground">
31
+ Required
32
+ </th>
33
+ {hasDefault ? (
34
+ <th className="border-b border-border bg-background/70 px-3 py-2.5 text-left text-xs uppercase tracking-wider text-muted-foreground">
35
+ Default
36
+ </th>
37
+ ) : null}
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ {entries.map((entry) => {
42
+ const required = entry.required ?? !entry.optional;
43
+ return (
44
+ <tr key={entry.name}>
45
+ <td className="border-b border-border px-3 py-2.5 text-left align-top">
46
+ <code className="rounded-md bg-muted px-1.5 py-0.5 font-mono text-xs">
47
+ {entry.name}
48
+ </code>
49
+ </td>
50
+ <td className="border-b border-border px-3 py-2.5 text-left align-top">
51
+ {entry.type ?? "\u2014"}
52
+ </td>
53
+ <td className="border-b border-border px-3 py-2.5 text-left align-top">
54
+ {entry.description ?? ""}
55
+ </td>
56
+ <td className="border-b border-border px-3 py-2.5 text-left align-top">
57
+ {required ? "Yes" : "Optional"}
58
+ </td>
59
+ {hasDefault ? (
60
+ <td className="border-b border-border px-3 py-2.5 text-left align-top">
61
+ {entry.default ?? "\u2014"}
62
+ </td>
63
+ ) : null}
64
+ </tr>
65
+ );
66
+ })}
67
+ </tbody>
68
+ </table>
69
+ </div>
70
+ );
71
+ };
@@ -0,0 +1,44 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ interface UpdateProps {
4
+ label: string;
5
+ description?: string;
6
+ tags?: string[];
7
+ children: ReactNode;
8
+ }
9
+
10
+ export const Update = ({ label, description, tags, children }: UpdateProps) => {
11
+ const anchorId = label.toLowerCase().replaceAll(/\s+/g, "-");
12
+
13
+ return (
14
+ <div
15
+ className="relative border-b border-border py-8 first:pt-0 last:border-b-0"
16
+ id={anchorId}
17
+ >
18
+ <div className="mb-4 flex flex-wrap items-center gap-3">
19
+ <a
20
+ className="text-lg font-semibold text-foreground hover:underline"
21
+ href={`#${anchorId}`}
22
+ >
23
+ {label}
24
+ </a>
25
+ {description ? (
26
+ <span className="rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground">
27
+ {description}
28
+ </span>
29
+ ) : null}
30
+ {tags?.map((tag) => (
31
+ <span
32
+ className="rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary"
33
+ key={tag}
34
+ >
35
+ {tag}
36
+ </span>
37
+ ))}
38
+ </div>
39
+ <div className="prose prose-sm text-muted-foreground [&>p:first-child]:mt-0 [&>p:last-child]:mb-0">
40
+ {children}
41
+ </div>
42
+ </div>
43
+ );
44
+ };
@@ -0,0 +1,12 @@
1
+ export const Video = ({ src }: { src: string }) => (
2
+ <div className="relative overflow-hidden rounded-xl border border-border bg-black pt-[56.25%]">
3
+ <iframe
4
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
5
+ allowFullScreen
6
+ className="absolute inset-0 h-full w-full border-0"
7
+ sandbox="allow-popups allow-presentation allow-scripts"
8
+ src={src}
9
+ title="Video"
10
+ />
11
+ </div>
12
+ );