blodemd 0.0.15 → 0.2.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.
Files changed (286) hide show
  1. package/README.md +26 -1
  2. package/dist/cli.mjs +217 -217
  3. package/dist/cli.mjs.map +1 -1
  4. package/package.json +3 -36
  5. package/dev-server/app/[[...slug]]/page.tsx +0 -140
  6. package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
  7. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
  8. package/dev-server/app/blodemd-dev/version/route.ts +0 -14
  9. package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
  10. package/dev-server/app/error.tsx +0 -24
  11. package/dev-server/app/favicon.ico +0 -0
  12. package/dev-server/app/globals.css +0 -4
  13. package/dev-server/app/layout.tsx +0 -38
  14. package/dev-server/app/not-found.tsx +0 -18
  15. package/dev-server/app/search/route.ts +0 -17
  16. package/dev-server/components/dev-reload-script.tsx +0 -86
  17. package/dev-server/components/providers.tsx +0 -15
  18. package/dev-server/lib/dev-state.ts +0 -8
  19. package/dev-server/lib/local-content-source.ts +0 -103
  20. package/dev-server/lib/local-runtime.tsx +0 -555
  21. package/dev-server/next-env.d.ts +0 -5
  22. package/dev-server/next.config.js +0 -54
  23. package/dev-server/package.json +0 -61
  24. package/dev-server/postcss.config.mjs +0 -7
  25. package/dev-server/public/glide-variable.woff2 +0 -0
  26. package/dev-server/tsconfig.json +0 -50
  27. package/docs/app/globals.css +0 -471
  28. package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
  29. package/docs/components/api/api-playground.tsx +0 -467
  30. package/docs/components/api/api-reference.tsx +0 -157
  31. package/docs/components/content/collection-index.tsx +0 -114
  32. package/docs/components/docs/contextual-menu.tsx +0 -495
  33. package/docs/components/docs/copy-page-menu.tsx +0 -364
  34. package/docs/components/docs/doc-header.tsx +0 -223
  35. package/docs/components/docs/doc-shell.tsx +0 -355
  36. package/docs/components/docs/doc-sidebar.tsx +0 -256
  37. package/docs/components/docs/doc-toc.tsx +0 -46
  38. package/docs/components/docs/mobile-nav.tsx +0 -195
  39. package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
  40. package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
  41. package/docs/components/git/repo-picker.tsx +0 -529
  42. package/docs/components/icons/doc-icon.tsx +0 -96
  43. package/docs/components/mdx/accordion.tsx +0 -83
  44. package/docs/components/mdx/agent-instructions.tsx +0 -17
  45. package/docs/components/mdx/badge.tsx +0 -79
  46. package/docs/components/mdx/callout.tsx +0 -88
  47. package/docs/components/mdx/card.tsx +0 -110
  48. package/docs/components/mdx/code-block.tsx +0 -80
  49. package/docs/components/mdx/code-group.tsx +0 -203
  50. package/docs/components/mdx/color.tsx +0 -87
  51. package/docs/components/mdx/columns.tsx +0 -25
  52. package/docs/components/mdx/expandable.tsx +0 -45
  53. package/docs/components/mdx/field-layout.tsx +0 -77
  54. package/docs/components/mdx/frame.tsx +0 -23
  55. package/docs/components/mdx/get-text-content.ts +0 -18
  56. package/docs/components/mdx/icon.tsx +0 -12
  57. package/docs/components/mdx/iframe.tsx +0 -62
  58. package/docs/components/mdx/index.tsx +0 -121
  59. package/docs/components/mdx/installer.tsx +0 -20
  60. package/docs/components/mdx/panel.tsx +0 -11
  61. package/docs/components/mdx/param-field.tsx +0 -56
  62. package/docs/components/mdx/preview.tsx +0 -36
  63. package/docs/components/mdx/prompt.tsx +0 -63
  64. package/docs/components/mdx/request-example.tsx +0 -27
  65. package/docs/components/mdx/response-field.tsx +0 -42
  66. package/docs/components/mdx/steps.tsx +0 -92
  67. package/docs/components/mdx/tabs.tsx +0 -193
  68. package/docs/components/mdx/tile.tsx +0 -43
  69. package/docs/components/mdx/tooltip.tsx +0 -71
  70. package/docs/components/mdx/tree.tsx +0 -120
  71. package/docs/components/mdx/type-table.tsx +0 -71
  72. package/docs/components/mdx/update.tsx +0 -44
  73. package/docs/components/mdx/video.tsx +0 -45
  74. package/docs/components/mdx/view.tsx +0 -66
  75. package/docs/components/posthog-provider.tsx +0 -42
  76. package/docs/components/providers.tsx +0 -15
  77. package/docs/components/tenant-analytics.tsx +0 -49
  78. package/docs/components/third-parties.tsx +0 -32
  79. package/docs/components/ui/badge.tsx +0 -61
  80. package/docs/components/ui/breadcrumb.tsx +0 -112
  81. package/docs/components/ui/button-group.tsx +0 -83
  82. package/docs/components/ui/button.tsx +0 -65
  83. package/docs/components/ui/card.tsx +0 -92
  84. package/docs/components/ui/command.tsx +0 -167
  85. package/docs/components/ui/copy-button.tsx +0 -129
  86. package/docs/components/ui/dialog.tsx +0 -146
  87. package/docs/components/ui/field.tsx +0 -237
  88. package/docs/components/ui/input.tsx +0 -23
  89. package/docs/components/ui/kbd.tsx +0 -98
  90. package/docs/components/ui/label.tsx +0 -22
  91. package/docs/components/ui/morph-icon.tsx +0 -79
  92. package/docs/components/ui/popover.tsx +0 -267
  93. package/docs/components/ui/search-dialog.tsx +0 -431
  94. package/docs/components/ui/search.tsx +0 -101
  95. package/docs/components/ui/separator.tsx +0 -26
  96. package/docs/components/ui/sheet.tsx +0 -133
  97. package/docs/components/ui/sidebar.tsx +0 -758
  98. package/docs/components/ui/skeleton.tsx +0 -11
  99. package/docs/components/ui/switch.tsx +0 -32
  100. package/docs/components/ui/tabs.tsx +0 -138
  101. package/docs/components/ui/theme-toggle.tsx +0 -62
  102. package/docs/components/ui/tooltip.tsx +0 -53
  103. package/docs/components/web-mcp.tsx +0 -115
  104. package/docs/lib/agent-skills.ts +0 -48
  105. package/docs/lib/api-client.ts +0 -72
  106. package/docs/lib/config.ts +0 -6
  107. package/docs/lib/content-root.ts +0 -33
  108. package/docs/lib/content-source.ts +0 -70
  109. package/docs/lib/contextual-options.ts +0 -222
  110. package/docs/lib/dashboard-session.ts +0 -167
  111. package/docs/lib/db.ts +0 -13
  112. package/docs/lib/docs-collection.ts +0 -7
  113. package/docs/lib/docs-runtime.tsx +0 -745
  114. package/docs/lib/edge-config.ts +0 -95
  115. package/docs/lib/env.ts +0 -23
  116. package/docs/lib/etag.ts +0 -22
  117. package/docs/lib/github-install.ts +0 -33
  118. package/docs/lib/llms-full.ts +0 -82
  119. package/docs/lib/marketing-markdown.ts +0 -79
  120. package/docs/lib/marketing-site.ts +0 -31
  121. package/docs/lib/mdx.ts +0 -98
  122. package/docs/lib/navigation.ts +0 -288
  123. package/docs/lib/openapi-proxy.ts +0 -88
  124. package/docs/lib/openapi.ts +0 -158
  125. package/docs/lib/platform-config.ts +0 -6
  126. package/docs/lib/project-authz.ts +0 -46
  127. package/docs/lib/routes.ts +0 -103
  128. package/docs/lib/server-cache.ts +0 -83
  129. package/docs/lib/shiki.ts +0 -44
  130. package/docs/lib/supabase.ts +0 -37
  131. package/docs/lib/tenancy.ts +0 -364
  132. package/docs/lib/tenant-headers.ts +0 -43
  133. package/docs/lib/tenant-static.ts +0 -705
  134. package/docs/lib/tenant-utility-context.ts +0 -62
  135. package/docs/lib/tenants.ts +0 -72
  136. package/docs/lib/theme.ts +0 -29
  137. package/docs/lib/time-ago.ts +0 -24
  138. package/docs/lib/toc.ts +0 -2
  139. package/docs/lib/use-mobile.ts +0 -19
  140. package/docs/lib/use-tab-observer.ts +0 -71
  141. package/docs/lib/utils.ts +0 -5
  142. package/packages/@repo/common/dist/index.d.ts +0 -16
  143. package/packages/@repo/common/dist/index.d.ts.map +0 -1
  144. package/packages/@repo/common/dist/index.js +0 -84
  145. package/packages/@repo/common/package.json +0 -34
  146. package/packages/@repo/common/src/index.ts +0 -101
  147. package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
  148. package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
  149. package/packages/@repo/contracts/dist/analytics.js +0 -18
  150. package/packages/@repo/contracts/dist/dates.d.ts +0 -4
  151. package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
  152. package/packages/@repo/contracts/dist/dates.js +0 -2
  153. package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
  154. package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
  155. package/packages/@repo/contracts/dist/deployment.js +0 -46
  156. package/packages/@repo/contracts/dist/domain.d.ts +0 -94
  157. package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
  158. package/packages/@repo/contracts/dist/domain.js +0 -36
  159. package/packages/@repo/contracts/dist/git.d.ts +0 -28
  160. package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
  161. package/packages/@repo/contracts/dist/git.js +0 -24
  162. package/packages/@repo/contracts/dist/ids.d.ts +0 -14
  163. package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
  164. package/packages/@repo/contracts/dist/ids.js +0 -11
  165. package/packages/@repo/contracts/dist/index.d.ts +0 -11
  166. package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
  167. package/packages/@repo/contracts/dist/index.js +0 -12
  168. package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
  169. package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
  170. package/packages/@repo/contracts/dist/pagination.js +0 -15
  171. package/packages/@repo/contracts/dist/project.d.ts +0 -42
  172. package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
  173. package/packages/@repo/contracts/dist/project.js +0 -25
  174. package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
  175. package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
  176. package/packages/@repo/contracts/dist/tenant.js +0 -58
  177. package/packages/@repo/contracts/dist/user.d.ts +0 -9
  178. package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
  179. package/packages/@repo/contracts/dist/user.js +0 -9
  180. package/packages/@repo/contracts/package.json +0 -37
  181. package/packages/@repo/contracts/src/analytics.ts +0 -33
  182. package/packages/@repo/contracts/src/dates.ts +0 -4
  183. package/packages/@repo/contracts/src/deployment.ts +0 -73
  184. package/packages/@repo/contracts/src/domain.ts +0 -51
  185. package/packages/@repo/contracts/src/git.ts +0 -31
  186. package/packages/@repo/contracts/src/ids.ts +0 -23
  187. package/packages/@repo/contracts/src/index.ts +0 -12
  188. package/packages/@repo/contracts/src/pagination.ts +0 -21
  189. package/packages/@repo/contracts/src/project.ts +0 -32
  190. package/packages/@repo/contracts/src/tenant.ts +0 -94
  191. package/packages/@repo/contracts/src/user.ts +0 -12
  192. package/packages/@repo/models/dist/docs-config.d.ts +0 -961
  193. package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
  194. package/packages/@repo/models/dist/docs-config.js +0 -531
  195. package/packages/@repo/models/dist/index.d.ts +0 -3
  196. package/packages/@repo/models/dist/index.d.ts.map +0 -1
  197. package/packages/@repo/models/dist/index.js +0 -3
  198. package/packages/@repo/models/dist/tenant.d.ts +0 -37
  199. package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
  200. package/packages/@repo/models/dist/tenant.js +0 -1
  201. package/packages/@repo/models/package.json +0 -37
  202. package/packages/@repo/models/src/docs-config.ts +0 -629
  203. package/packages/@repo/models/src/index.ts +0 -3
  204. package/packages/@repo/models/src/tenant.ts +0 -44
  205. package/packages/@repo/prebuild/dist/index.d.ts +0 -2
  206. package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
  207. package/packages/@repo/prebuild/dist/index.js +0 -2
  208. package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
  209. package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
  210. package/packages/@repo/prebuild/dist/openapi.js +0 -86
  211. package/packages/@repo/prebuild/package.json +0 -39
  212. package/packages/@repo/prebuild/src/index.ts +0 -2
  213. package/packages/@repo/prebuild/src/openapi.ts +0 -154
  214. package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
  215. package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
  216. package/packages/@repo/previewing/dist/blob-source.js +0 -128
  217. package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
  218. package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
  219. package/packages/@repo/previewing/dist/config-loader.js +0 -231
  220. package/packages/@repo/previewing/dist/constants.d.ts +0 -15
  221. package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
  222. package/packages/@repo/previewing/dist/constants.js +0 -14
  223. package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
  224. package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
  225. package/packages/@repo/previewing/dist/content-index.js +0 -291
  226. package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
  227. package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
  228. package/packages/@repo/previewing/dist/content-source.js +0 -1
  229. package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
  230. package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
  231. package/packages/@repo/previewing/dist/fs-source.js +0 -71
  232. package/packages/@repo/previewing/dist/index.d.ts +0 -16
  233. package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
  234. package/packages/@repo/previewing/dist/index.js +0 -13
  235. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
  236. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
  237. package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
  238. package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
  239. package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
  240. package/packages/@repo/previewing/dist/markdown/format.js +0 -43
  241. package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
  242. package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
  243. package/packages/@repo/previewing/dist/markdown/links.js +0 -31
  244. package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
  245. package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
  246. package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
  247. package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
  248. package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
  249. package/packages/@repo/previewing/dist/search-index.js +0 -23
  250. package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
  251. package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
  252. package/packages/@repo/previewing/dist/serialization.js +0 -108
  253. package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
  254. package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
  255. package/packages/@repo/previewing/dist/toc-index.js +0 -53
  256. package/packages/@repo/previewing/dist/types.d.ts +0 -92
  257. package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
  258. package/packages/@repo/previewing/dist/types.js +0 -1
  259. package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
  260. package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
  261. package/packages/@repo/previewing/dist/utility-index.js +0 -201
  262. package/packages/@repo/previewing/package.json +0 -41
  263. package/packages/@repo/previewing/src/blob-source.ts +0 -185
  264. package/packages/@repo/previewing/src/config-loader.ts +0 -316
  265. package/packages/@repo/previewing/src/constants.ts +0 -16
  266. package/packages/@repo/previewing/src/content-index.ts +0 -384
  267. package/packages/@repo/previewing/src/content-source.ts +0 -12
  268. package/packages/@repo/previewing/src/fs-source.ts +0 -103
  269. package/packages/@repo/previewing/src/index.ts +0 -71
  270. package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
  271. package/packages/@repo/previewing/src/markdown/format.ts +0 -63
  272. package/packages/@repo/previewing/src/markdown/links.ts +0 -46
  273. package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
  274. package/packages/@repo/previewing/src/search-index.ts +0 -38
  275. package/packages/@repo/previewing/src/serialization.ts +0 -191
  276. package/packages/@repo/previewing/src/toc-index.ts +0 -72
  277. package/packages/@repo/previewing/src/types.ts +0 -105
  278. package/packages/@repo/previewing/src/utility-index.ts +0 -304
  279. package/packages/@repo/validation/dist/index.d.ts +0 -12
  280. package/packages/@repo/validation/dist/index.d.ts.map +0 -1
  281. package/packages/@repo/validation/dist/index.js +0 -30
  282. package/packages/@repo/validation/package.json +0 -38
  283. package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
  284. package/packages/@repo/validation/src/index.ts +0 -59
  285. package/scripts/prepare-package.mjs +0 -53
  286. package/scripts/repo-packages.mjs +0 -8
@@ -1,17 +0,0 @@
1
- import type { ReactNode } from "react";
2
-
3
- interface AgentInstructionsProps {
4
- children: ReactNode;
5
- }
6
-
7
- /**
8
- * Content inside <AgentInstructions> is hidden from human readers in the
9
- * rendered HTML but preserved in the raw MDX source. When pages are exported
10
- * as Markdown (via /{page}.md or llms-full.txt), the content is included so
11
- * AI agents receive it as context.
12
- */
13
- export const AgentInstructions = ({ children }: AgentInstructionsProps) => (
14
- <div hidden data-agent-instructions="">
15
- {children}
16
- </div>
17
- );
@@ -1,79 +0,0 @@
1
- import type { ReactNode } from "react";
2
-
3
- import { cn } from "@/lib/utils";
4
-
5
- const colorStyles: Record<string, string> = {
6
- blue: "bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",
7
- gray: "bg-muted text-muted-foreground",
8
- green: "bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300",
9
- orange:
10
- "bg-orange-100 text-orange-800 dark:bg-orange-900/40 dark:text-orange-300",
11
- purple:
12
- "bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300",
13
- red: "bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300",
14
- surface: "bg-card text-card-foreground",
15
- white: "bg-white text-foreground dark:bg-white dark:text-black",
16
- yellow:
17
- "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-300",
18
- };
19
-
20
- const strokeStyles: Record<string, string> = {
21
- blue: "border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300",
22
- gray: "border-border text-muted-foreground",
23
- green:
24
- "border-green-300 text-green-700 dark:border-green-700 dark:text-green-300",
25
- orange:
26
- "border-orange-300 text-orange-700 dark:border-orange-700 dark:text-orange-300",
27
- purple:
28
- "border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300",
29
- red: "border-red-300 text-red-700 dark:border-red-700 dark:text-red-300",
30
- surface: "border-border text-card-foreground",
31
- white: "border-border text-foreground",
32
- yellow:
33
- "border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300",
34
- };
35
-
36
- const sizeStyles: Record<string, string> = {
37
- lg: "px-3 py-1.5 text-sm",
38
- md: "px-2.5 py-1 text-xs",
39
- sm: "px-2 py-0.5 text-xs",
40
- xs: "px-1.5 py-0.5 text-[10px]",
41
- };
42
-
43
- interface BadgeProps {
44
- color?: string;
45
- size?: "xs" | "sm" | "md" | "lg";
46
- shape?: "rounded" | "pill";
47
- icon?: ReactNode;
48
- stroke?: boolean;
49
- disabled?: boolean;
50
- className?: string;
51
- children: ReactNode;
52
- }
53
-
54
- export const Badge = ({
55
- color = "gray",
56
- size = "md",
57
- shape = "rounded",
58
- icon,
59
- stroke = false,
60
- disabled = false,
61
- className,
62
- children,
63
- }: BadgeProps) => (
64
- <span
65
- className={cn(
66
- "inline-flex items-center gap-1 font-medium",
67
- shape === "pill" ? "rounded-full" : "rounded-md",
68
- stroke
69
- ? cn("border bg-transparent", strokeStyles[color] ?? strokeStyles.gray)
70
- : (colorStyles[color] ?? colorStyles.gray),
71
- sizeStyles[size] ?? sizeStyles.md,
72
- disabled && "opacity-50",
73
- className
74
- )}
75
- >
76
- {icon ? <span className="shrink-0">{icon}</span> : null}
77
- {children}
78
- </span>
79
- );
@@ -1,88 +0,0 @@
1
- import type { ReactNode } from "react";
2
-
3
- import { cn } from "@/lib/utils";
4
-
5
- const variantStyles: Record<string, string> = {
6
- check:
7
- "border-emerald-600 bg-emerald-100 dark:border-emerald-400 dark:bg-emerald-900",
8
- danger: "border-red-600 bg-red-100 dark:border-red-400 dark:bg-red-900",
9
- info: "bg-card border-border",
10
- note: "bg-card border-border",
11
- success:
12
- "border-emerald-600 bg-emerald-100 dark:border-emerald-400 dark:bg-emerald-900",
13
- tip: "border-blue-600 bg-blue-100 dark:border-blue-400 dark:bg-blue-900",
14
- warning:
15
- "border-amber-600 bg-amber-100 dark:border-amber-400 dark:bg-amber-900",
16
- };
17
-
18
- interface CalloutProps {
19
- type?: "info" | "success" | "warning" | "danger" | "note" | "tip" | "check";
20
- title?: string;
21
- icon?: ReactNode;
22
- color?: string;
23
- children: ReactNode;
24
- }
25
-
26
- export const Callout = ({
27
- type = "info",
28
- title,
29
- icon,
30
- color,
31
- children,
32
- }: CalloutProps) => (
33
- <div
34
- data-slot="alert"
35
- role="alert"
36
- data-variant="default"
37
- className={cn(
38
- "relative grid grid-cols-[0_1fr] items-start gap-y-0.5 rounded-xl border px-4 py-3 text-sm text-surface-foreground",
39
- "has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3",
40
- "[&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
41
- "**:[code]:border md:-mx-1",
42
- variantStyles[type]
43
- )}
44
- style={
45
- color
46
- ? {
47
- backgroundColor: `${color}10`,
48
- borderColor: color,
49
- }
50
- : undefined
51
- }
52
- >
53
- {icon}
54
- <div
55
- data-slot="alert-description"
56
- className="col-start-2 grid justify-items-start gap-1 text-sm text-foreground [&_p]:leading-relaxed"
57
- >
58
- {title ? <strong className="font-medium">{title}</strong> : null}
59
- <div className="text-sm [&>p:first-child]:mt-0 [&>p:last-child]:mb-0 [&_p]:leading-relaxed [&_p:not(:first-child)]:mt-6">
60
- {children}
61
- </div>
62
- </div>
63
- </div>
64
- );
65
-
66
- export const Note = ({ children }: { children: ReactNode }) => (
67
- <Callout type="note">{children}</Callout>
68
- );
69
-
70
- export const Warning = ({ children }: { children: ReactNode }) => (
71
- <Callout type="warning">{children}</Callout>
72
- );
73
-
74
- export const Info = ({ children }: { children: ReactNode }) => (
75
- <Callout type="info">{children}</Callout>
76
- );
77
-
78
- export const Tip = ({ children }: { children: ReactNode }) => (
79
- <Callout type="tip">{children}</Callout>
80
- );
81
-
82
- export const Check = ({ children }: { children: ReactNode }) => (
83
- <Callout type="check">{children}</Callout>
84
- );
85
-
86
- export const Danger = ({ children }: { children: ReactNode }) => (
87
- <Callout type="danger">{children}</Callout>
88
- );
@@ -1,110 +0,0 @@
1
- import Image from "next/image";
2
- import Link from "next/link";
3
- import type { ReactNode } from "react";
4
-
5
- import { DocIcon } from "@/components/icons/doc-icon";
6
- import { cn } from "@/lib/utils";
7
-
8
- interface CardProps {
9
- title?: string;
10
- icon?: ReactNode;
11
- color?: string;
12
- href?: string;
13
- horizontal?: boolean;
14
- img?: string;
15
- cta?: string;
16
- children?: ReactNode;
17
- }
18
-
19
- const CardInner = ({
20
- title,
21
- icon,
22
- color,
23
- horizontal,
24
- img,
25
- cta,
26
- href,
27
- children,
28
- }: CardProps) => {
29
- const resolvedIcon =
30
- typeof icon === "string" ? <DocIcon icon={icon} size={18} /> : icon;
31
-
32
- return (
33
- <div
34
- className={cn(
35
- "group/card rounded-xl border border-border bg-card p-4 transition-colors",
36
- href && "hover:border-primary/30 hover:bg-accent/50",
37
- horizontal && "flex items-start gap-4"
38
- )}
39
- >
40
- {img && !horizontal ? (
41
- <div className="relative mb-3 aspect-video overflow-hidden rounded-lg">
42
- <Image
43
- alt={title ?? ""}
44
- className="object-cover"
45
- fill
46
- sizes="(max-width: 768px) 100vw, 50vw"
47
- src={img}
48
- unoptimized
49
- />
50
- </div>
51
- ) : null}
52
- {resolvedIcon ? (
53
- <div
54
- className="mb-3 flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground"
55
- style={color ? { color } : undefined}
56
- >
57
- {resolvedIcon}
58
- </div>
59
- ) : null}
60
- <div className="min-w-0 flex-1">
61
- {title ? (
62
- <div className="mb-1 font-medium text-foreground">{title}</div>
63
- ) : null}
64
- {children ? (
65
- <div className="text-sm text-muted-foreground [&>p:first-child]:mt-0 [&>p:last-child]:mb-0">
66
- {children}
67
- </div>
68
- ) : null}
69
- {cta ? (
70
- <div className="mt-2 text-sm font-medium text-primary">{cta}</div>
71
- ) : null}
72
- </div>
73
- {href ? (
74
- <svg
75
- aria-hidden
76
- className="mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform group-hover/card:translate-x-0.5"
77
- fill="none"
78
- stroke="currentColor"
79
- strokeWidth={2}
80
- viewBox="0 0 24 24"
81
- >
82
- <path
83
- d="M5 12h14M12 5l7 7-7 7"
84
- strokeLinecap="round"
85
- strokeLinejoin="round"
86
- />
87
- </svg>
88
- ) : null}
89
- </div>
90
- );
91
- };
92
-
93
- export const Card = (props: CardProps) => {
94
- if (props.href) {
95
- const isExternal = props.href.startsWith("http");
96
- if (isExternal) {
97
- return (
98
- <a href={props.href} rel="noopener noreferrer" target="_blank">
99
- <CardInner {...props} />
100
- </a>
101
- );
102
- }
103
- return (
104
- <Link href={props.href}>
105
- <CardInner {...props} />
106
- </Link>
107
- );
108
- }
109
- return <CardInner {...props} />;
110
- };
@@ -1,80 +0,0 @@
1
- "use client";
2
-
3
- import { CheckIcon, ClipboardIcon } from "blode-icons-react";
4
- import { useCallback, useEffect, useMemo, useState } from "react";
5
- import type { ComponentPropsWithoutRef, ReactNode } from "react";
6
-
7
- import { Button } from "@/components/ui/button";
8
- import { cn } from "@/lib/utils";
9
-
10
- import { getTextContent } from "./get-text-content";
11
-
12
- export const CodeBlock = ({
13
- children,
14
- className,
15
- style,
16
- tabIndex,
17
- ...props
18
- }: ComponentPropsWithoutRef<"pre"> & {
19
- children: ReactNode;
20
- }) => {
21
- const [copied, setCopied] = useState(false);
22
- const code = useMemo(() => getTextContent(children), [children]);
23
-
24
- useEffect(() => {
25
- if (copied) {
26
- const timer = setTimeout(() => setCopied(false), 2000);
27
- return () => clearTimeout(timer);
28
- }
29
- }, [copied]);
30
-
31
- const handleCopy = useCallback(async () => {
32
- if (!code) {
33
- return;
34
- }
35
- await navigator.clipboard.writeText(code);
36
- setCopied(true);
37
- }, [code]);
38
-
39
- const preStyle = style ? { ...style } : undefined;
40
- if (preStyle) {
41
- delete preStyle.backgroundColor;
42
- }
43
-
44
- return (
45
- <figure data-rehype-pretty-code-figure="">
46
- <pre
47
- className={cn(
48
- "no-scrollbar min-w-0 overflow-x-auto overflow-y-auto overscroll-y-auto overscroll-x-contain pl-4 pr-14 py-3.5 outline-none has-[[data-slot=tabs]]:p-0 has-[[data-highlighted-line]]:pl-0 has-[[data-line-numbers]]:pl-0",
49
- className
50
- )}
51
- style={preStyle}
52
- tabIndex={tabIndex ?? 0}
53
- {...props}
54
- >
55
- <div
56
- aria-hidden="true"
57
- className="pointer-events-none absolute top-0 right-0 bottom-0 z-[9] w-16 bg-gradient-to-r from-transparent to-code print:hidden"
58
- data-slot="fade-overlay"
59
- />
60
- <Button
61
- className="absolute top-3 right-2 z-10 size-7 bg-code hover:opacity-100 focus-visible:opacity-100"
62
- data-copied={copied}
63
- data-slot="copy-button"
64
- onClick={handleCopy}
65
- size="icon"
66
- type="button"
67
- variant="ghost"
68
- >
69
- <span className="sr-only">{copied ? "Copied" : "Copy"}</span>
70
- {copied ? (
71
- <CheckIcon aria-hidden="true" />
72
- ) : (
73
- <ClipboardIcon aria-hidden="true" />
74
- )}
75
- </Button>
76
- {children}
77
- </pre>
78
- </figure>
79
- );
80
- };
@@ -1,203 +0,0 @@
1
- "use client";
2
-
3
- import { isValidElement, useCallback, useId, useMemo, useState } from "react";
4
- import type { KeyboardEvent, MouseEvent, ReactElement, ReactNode } from "react";
5
-
6
- import { cn } from "@/lib/utils";
7
-
8
- interface CodeGroupProps {
9
- children: ReactNode;
10
- }
11
-
12
- interface CodeGroupItemProps {
13
- "data-rehype-pretty-code-title"?: string;
14
- children?: ReactNode;
15
- }
16
-
17
- interface ResolvedCodeItem {
18
- element: ReactElement<CodeGroupItemProps>;
19
- key: string;
20
- label: string;
21
- }
22
-
23
- const clampTabIndex = (index: number, total: number) => {
24
- if (total <= 0) {
25
- return 0;
26
- }
27
-
28
- return Math.min(Math.max(index, 0), total - 1);
29
- };
30
-
31
- const sanitizeDomId = (value: string) =>
32
- value.replaceAll(/[^a-zA-Z0-9_-]/g, "-");
33
-
34
- const toNodeArray = (children: ReactNode): ReactNode[] =>
35
- Array.isArray(children) ? children.flatMap(toNodeArray) : [children];
36
-
37
- const getCodeLabel = (
38
- element: ReactElement<CodeGroupItemProps>,
39
- index: number
40
- ) => {
41
- const title = element.props["data-rehype-pretty-code-title"];
42
- if (title) {
43
- return title;
44
- }
45
-
46
- const pre = toNodeArray(element.props.children).find(
47
- (child) => isValidElement(child) && child.type === "pre"
48
- );
49
- if (isValidElement<{ className?: string }>(pre)) {
50
- const languageClass = pre.props.className
51
- ?.split(" ")
52
- .find((className: string) => className.startsWith("language-"));
53
- if (languageClass) {
54
- return languageClass.replace("language-", "");
55
- }
56
- }
57
-
58
- return `Tab ${index + 1}`;
59
- };
60
-
61
- const resolveCodeItems = (children: ReactNode): ResolvedCodeItem[] =>
62
- toNodeArray(children)
63
- .filter((child): child is ReactElement<CodeGroupItemProps> =>
64
- isValidElement<CodeGroupItemProps>(child)
65
- )
66
- .map((element, index) => {
67
- const label = getCodeLabel(element, index);
68
- const key = sanitizeDomId(
69
- String(
70
- element.key ??
71
- element.props["data-rehype-pretty-code-title"] ??
72
- `code-${index + 1}`
73
- )
74
- );
75
-
76
- return {
77
- element,
78
- key,
79
- label,
80
- };
81
- });
82
-
83
- export const CodeGroup = ({ children }: CodeGroupProps) => {
84
- const items = useMemo(() => resolveCodeItems(children), [children]);
85
- const [active, setActive] = useState(0);
86
- const activeIndex = clampTabIndex(active, items.length);
87
- const activeItem = items[activeIndex];
88
- const tabsId = useId();
89
-
90
- const getTabId = useCallback(
91
- (index: number) => `${tabsId}-${items[index]?.key ?? index}-tab`,
92
- [items, tabsId]
93
- );
94
- const getPanelId = useCallback(
95
- (index: number) => `${tabsId}-${items[index]?.key ?? index}-panel`,
96
- [items, tabsId]
97
- );
98
- const focusTab = useCallback(
99
- (index: number) => {
100
- document.querySelector<HTMLElement>(`[id="${getTabId(index)}"]`)?.focus();
101
- },
102
- [getTabId]
103
- );
104
-
105
- const handleTabClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {
106
- const index = Number(event.currentTarget.dataset.index ?? "0");
107
- setActive(index);
108
- }, []);
109
-
110
- const handleTabKeyDown = useCallback(
111
- (event: KeyboardEvent<HTMLButtonElement>) => {
112
- if (!items.length) {
113
- return;
114
- }
115
-
116
- const index = Number(event.currentTarget.dataset.index ?? activeIndex);
117
- const lastIndex = items.length - 1;
118
- let nextIndex: number | null = null;
119
-
120
- switch (event.key) {
121
- case "ArrowDown":
122
- case "ArrowRight": {
123
- nextIndex = index === lastIndex ? 0 : index + 1;
124
- break;
125
- }
126
- case "ArrowLeft":
127
- case "ArrowUp": {
128
- nextIndex = index === 0 ? lastIndex : index - 1;
129
- break;
130
- }
131
- case "End": {
132
- nextIndex = lastIndex;
133
- break;
134
- }
135
- case "Home": {
136
- nextIndex = 0;
137
- break;
138
- }
139
- default: {
140
- return;
141
- }
142
- }
143
-
144
- event.preventDefault();
145
- setActive(nextIndex);
146
- focusTab(nextIndex);
147
- },
148
- [activeIndex, focusTab, items.length]
149
- );
150
-
151
- if (!activeItem) {
152
- return children as ReactElement;
153
- }
154
-
155
- if (items.length === 1) {
156
- return activeItem.element;
157
- }
158
-
159
- return (
160
- <div className="my-4 overflow-hidden rounded-xl bg-code">
161
- <div
162
- aria-orientation="horizontal"
163
- className="flex gap-1 border-b border-border bg-muted/50 px-2 pt-2"
164
- role="tablist"
165
- >
166
- {items.map((item, index) => {
167
- const isSelected = index === activeIndex;
168
-
169
- return (
170
- <button
171
- aria-controls={getPanelId(index)}
172
- aria-selected={isSelected}
173
- className={cn(
174
- "rounded-t-md border-b-2 px-3 py-1.5 font-mono text-xs transition-colors",
175
- isSelected
176
- ? "border-primary text-foreground"
177
- : "border-transparent text-muted-foreground hover:text-foreground"
178
- )}
179
- data-index={index}
180
- id={getTabId(index)}
181
- key={item.key}
182
- onClick={handleTabClick}
183
- onKeyDown={handleTabKeyDown}
184
- role="tab"
185
- tabIndex={isSelected ? 0 : -1}
186
- type="button"
187
- >
188
- {item.label}
189
- </button>
190
- );
191
- })}
192
- </div>
193
- <div
194
- aria-labelledby={getTabId(activeIndex)}
195
- id={getPanelId(activeIndex)}
196
- role="tabpanel"
197
- tabIndex={0}
198
- >
199
- {activeItem.element}
200
- </div>
201
- </div>
202
- );
203
- };
@@ -1,87 +0,0 @@
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 };
@@ -1,25 +0,0 @@
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
- );