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,98 +0,0 @@
1
- import {
2
- ArrowCornerDownLeftIcon,
3
- ArrowDownIcon,
4
- ArrowLeftXIcon,
5
- ArrowUpIcon,
6
- ArrowWall2RightIcon,
7
- CmdIcon,
8
- ControlIcon,
9
- OptIcon,
10
- ShiftIcon,
11
- } from "blode-icons-react";
12
- import { cva } from "class-variance-authority";
13
- import type { VariantProps } from "class-variance-authority";
14
- import * as React from "react";
15
-
16
- import { cn } from "@/lib/utils";
17
-
18
- type KbdIcon =
19
- | "mod"
20
- | "shift"
21
- | "enter"
22
- | "command"
23
- | "ctrl"
24
- | "alt"
25
- | "tab"
26
- | "backspace"
27
- | "up"
28
- | "down";
29
-
30
- const kbdVariants = cva(
31
- "pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm px-1.5 font-medium font-sans text-xs ring-1 ring-inset [&_svg:not([class*='size-'])]:size-3",
32
- {
33
- defaultVariants: {
34
- variant: "default",
35
- },
36
- variants: {
37
- variant: {
38
- default:
39
- "bg-muted text-muted-foreground ring-border [[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background [[data-slot=tooltip-content]_&]:ring-background/20 dark:[[data-slot=tooltip-content]_&]:bg-background/10 dark:[[data-slot=tooltip-content]_&]:ring-background/10",
40
- tooltip:
41
- "bg-background/20 text-background ring-background/20 dark:bg-background/10 dark:ring-background/10",
42
- },
43
- },
44
- }
45
- );
46
-
47
- interface KbdProps
48
- extends
49
- React.ComponentPropsWithoutRef<"kbd">,
50
- VariantProps<typeof kbdVariants> {
51
- icon?: KbdIcon;
52
- }
53
-
54
- const iconMap: Record<KbdIcon, React.ReactNode> = {
55
- alt: <OptIcon className="size-3" />,
56
- backspace: <ArrowLeftXIcon className="size-3" />,
57
- command: <CmdIcon className="size-3" />,
58
- ctrl: <ControlIcon className="size-3" />,
59
- down: <ArrowDownIcon className="size-3" />,
60
- enter: <ArrowCornerDownLeftIcon className="size-3" />,
61
- mod: <CmdIcon className="size-3" />,
62
- shift: <ShiftIcon className="size-3" />,
63
- tab: <ArrowWall2RightIcon className="size-3" />,
64
- up: <ArrowUpIcon className="size-3" />,
65
- };
66
-
67
- const Kbd = React.forwardRef<React.ElementRef<"kbd">, KbdProps>(
68
- ({ className, variant, children, icon, ...props }, ref) => {
69
- const content = icon ? iconMap[icon] : children;
70
-
71
- return (
72
- <kbd
73
- className={cn(kbdVariants({ variant }), className)}
74
- data-slot="kbd"
75
- ref={ref}
76
- {...props}
77
- >
78
- {content}
79
- </kbd>
80
- );
81
- }
82
- );
83
- Kbd.displayName = "Kbd";
84
-
85
- const KbdGroup = React.forwardRef<
86
- React.ElementRef<"kbd">,
87
- React.ComponentPropsWithoutRef<"kbd">
88
- >(({ className, ...props }, ref) => (
89
- <kbd
90
- className={cn("inline-flex items-center gap-1", className)}
91
- data-slot="kbd-group"
92
- ref={ref}
93
- {...props}
94
- />
95
- ));
96
- KbdGroup.displayName = "KbdGroup";
97
-
98
- export { Kbd, KbdGroup };
@@ -1,22 +0,0 @@
1
- "use client";
2
-
3
- import { Label as LabelPrimitive } from "radix-ui";
4
- import * as React from "react";
5
-
6
- import { cn } from "@/lib/utils";
7
-
8
- const Label = ({
9
- className,
10
- ...props
11
- }: React.ComponentProps<typeof LabelPrimitive.Root>) => (
12
- <LabelPrimitive.Root
13
- data-slot="label"
14
- className={cn(
15
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
16
- className
17
- )}
18
- {...props}
19
- />
20
- );
21
-
22
- export { Label };
@@ -1,79 +0,0 @@
1
- "use client";
2
-
3
- import { motion, useReducedMotion } from "motion/react";
4
-
5
- import { cn } from "@/lib/utils";
6
-
7
- type MorphIconName = "cross" | "menu";
8
-
9
- interface MorphIconProps extends React.SVGAttributes<SVGSVGElement> {
10
- icon: MorphIconName;
11
- size?: number;
12
- strokeWidth?: number;
13
- }
14
-
15
- const ICONS = {
16
- cross: {
17
- opacity: [1, 1, 0] as const,
18
- paths: ["M2.5 2.5L11.5 11.5", "M11.5 2.5L2.5 11.5", "M7 7L7 7"] as const,
19
- },
20
- menu: {
21
- opacity: [1, 1, 1] as const,
22
- paths: ["M1 2.5L13 2.5", "M1 7L13 7", "M1 11.5L13 11.5"] as const,
23
- },
24
- } as const;
25
-
26
- const transition = {
27
- duration: 0.3,
28
- ease: [0.4, 0, 0.2, 1] as const,
29
- };
30
-
31
- const instantTransition = { duration: 0 };
32
-
33
- export const MorphIcon = ({
34
- icon,
35
- size = 32,
36
- strokeWidth = 2,
37
- className,
38
- style,
39
- ...props
40
- }: MorphIconProps) => {
41
- const prefersReducedMotion = useReducedMotion();
42
- const def = ICONS[icon];
43
- const [p0, p1, p2] = def.paths;
44
- const [o0, o1, o2] = def.opacity;
45
- const t = prefersReducedMotion ? instantTransition : transition;
46
-
47
- return (
48
- <svg
49
- aria-hidden="true"
50
- className={cn("text-current", className)}
51
- fill="none"
52
- height={size}
53
- stroke="currentColor"
54
- strokeLinecap="round"
55
- strokeWidth={strokeWidth}
56
- style={style}
57
- viewBox="0 0 14 14"
58
- width={size}
59
- xmlns="http://www.w3.org/2000/svg"
60
- {...props}
61
- >
62
- <motion.path
63
- initial={false}
64
- animate={{ d: p0, opacity: o0 }}
65
- transition={t}
66
- />
67
- <motion.path
68
- initial={false}
69
- animate={{ d: p1, opacity: o1 }}
70
- transition={t}
71
- />
72
- <motion.path
73
- initial={false}
74
- animate={{ d: p2, opacity: o2 }}
75
- transition={t}
76
- />
77
- </svg>
78
- );
79
- };
@@ -1,267 +0,0 @@
1
- "use client";
2
-
3
- import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
4
- import * as React from "react";
5
-
6
- import { cn } from "@/lib/utils";
7
-
8
- type PopoverInteractOutsideEvent = Event & {
9
- preventDefault: () => void;
10
- };
11
-
12
- interface PopoverContextType {
13
- anchor: HTMLElement | null;
14
- setAnchor: (anchor: HTMLElement | null) => void;
15
- setOnInteractOutside: (
16
- handler?: (event: PopoverInteractOutsideEvent) => void
17
- ) => void;
18
- }
19
-
20
- const PopoverContext = React.createContext<PopoverContextType | undefined>(
21
- undefined
22
- );
23
-
24
- const usePopoverContext = () => React.useContext(PopoverContext);
25
-
26
- const setRef = <T,>(ref: React.Ref<T> | undefined, value: T) => {
27
- if (typeof ref === "function") {
28
- ref(value);
29
- return;
30
- }
31
-
32
- if (ref && "current" in ref) {
33
- ref.current = value;
34
- }
35
- };
36
-
37
- const Popover = ({
38
- onOpenChange,
39
- ...props
40
- }: React.ComponentProps<typeof PopoverPrimitive.Root>) => {
41
- const [anchor, setAnchor] = React.useState<HTMLElement | null>(null);
42
- const onInteractOutsideRef = React.useRef<
43
- ((event: PopoverInteractOutsideEvent) => void) | null
44
- >(null);
45
-
46
- const handleOpenChange = React.useCallback<
47
- NonNullable<
48
- React.ComponentProps<typeof PopoverPrimitive.Root>["onOpenChange"]
49
- >
50
- >(
51
- (nextOpen, eventDetails) => {
52
- if (!nextOpen && eventDetails.reason === "outside-press") {
53
- const interactHandler = onInteractOutsideRef.current;
54
-
55
- if (interactHandler) {
56
- const wrappedEvent = Object.create(
57
- eventDetails.event
58
- ) as PopoverInteractOutsideEvent;
59
- wrappedEvent.preventDefault = () => eventDetails.cancel();
60
- interactHandler(wrappedEvent);
61
- }
62
- }
63
-
64
- onOpenChange?.(nextOpen, eventDetails);
65
- },
66
- [onOpenChange]
67
- );
68
-
69
- const contextValue = React.useMemo<PopoverContextType>(
70
- () => ({
71
- anchor,
72
- setAnchor,
73
- setOnInteractOutside: (handler) => {
74
- onInteractOutsideRef.current = handler ?? null;
75
- },
76
- }),
77
- [anchor]
78
- );
79
-
80
- return (
81
- <PopoverContext.Provider value={contextValue}>
82
- <PopoverPrimitive.Root
83
- data-slot="popover"
84
- onOpenChange={handleOpenChange}
85
- {...props}
86
- />
87
- </PopoverContext.Provider>
88
- );
89
- };
90
-
91
- const PopoverTrigger = ({
92
- asChild = false,
93
- children,
94
- ...props
95
- }: React.ComponentProps<typeof PopoverPrimitive.Trigger> & {
96
- asChild?: boolean;
97
- }) => {
98
- const render =
99
- asChild && React.isValidElement(children)
100
- ? (children as React.ReactElement)
101
- : undefined;
102
-
103
- return (
104
- <PopoverPrimitive.Trigger
105
- data-slot="popover-trigger"
106
- render={render}
107
- {...props}
108
- >
109
- {asChild ? null : children}
110
- </PopoverPrimitive.Trigger>
111
- );
112
- };
113
-
114
- type PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> &
115
- Pick<
116
- React.ComponentProps<typeof PopoverPrimitive.Positioner>,
117
- "align" | "alignOffset" | "side" | "sideOffset"
118
- > & {
119
- asChild?: boolean;
120
- onInteractOutside?: (event: PopoverInteractOutsideEvent) => void;
121
- onOpenAutoFocus?: (event: Event) => void;
122
- };
123
-
124
- const PopoverContent = ({
125
- asChild = false,
126
- children,
127
- className,
128
- align = "center",
129
- alignOffset = 0,
130
- side = "bottom",
131
- sideOffset = 4,
132
- initialFocus,
133
- onInteractOutside,
134
- onOpenAutoFocus,
135
- ...props
136
- }: PopoverContentProps) => {
137
- const popoverContext = usePopoverContext();
138
-
139
- React.useEffect(() => {
140
- popoverContext?.setOnInteractOutside(onInteractOutside);
141
-
142
- return () => {
143
- popoverContext?.setOnInteractOutside(undefined);
144
- };
145
- }, [onInteractOutside, popoverContext]);
146
-
147
- React.useEffect(() => {
148
- if (!onOpenAutoFocus) {
149
- return;
150
- }
151
-
152
- const event = new Event("openAutoFocus", { cancelable: true });
153
- onOpenAutoFocus(event);
154
- }, [onOpenAutoFocus]);
155
-
156
- const render =
157
- asChild && React.isValidElement(children)
158
- ? (children as React.ReactElement)
159
- : undefined;
160
-
161
- return (
162
- <PopoverPrimitive.Portal>
163
- <PopoverPrimitive.Positioner
164
- align={align}
165
- alignOffset={alignOffset}
166
- anchor={popoverContext?.anchor}
167
- className="isolate z-50"
168
- side={side}
169
- sideOffset={sideOffset}
170
- >
171
- <PopoverPrimitive.Popup
172
- className={cn(
173
- "data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-soft outline-hidden data-closed:animate-out data-open:animate-in",
174
- className
175
- )}
176
- data-slot="popover-content"
177
- initialFocus={onOpenAutoFocus ? false : initialFocus}
178
- render={render}
179
- {...props}
180
- >
181
- {asChild ? null : children}
182
- </PopoverPrimitive.Popup>
183
- </PopoverPrimitive.Positioner>
184
- </PopoverPrimitive.Portal>
185
- );
186
- };
187
-
188
- const PopoverAnchor = ({
189
- asChild = false,
190
- children,
191
- ref,
192
- ...props
193
- }: React.ComponentProps<"div"> & {
194
- asChild?: boolean;
195
- }) => {
196
- const popoverContext = usePopoverContext();
197
-
198
- const handleRef = React.useCallback(
199
- (node: HTMLElement | null) => {
200
- popoverContext?.setAnchor(node);
201
- setRef(ref as React.Ref<HTMLElement> | undefined, node);
202
- },
203
- [popoverContext, ref]
204
- );
205
-
206
- if (asChild && React.isValidElement(children)) {
207
- const child = children as React.ReactElement<{
208
- ref?: React.Ref<HTMLElement>;
209
- [key: string]: unknown;
210
- }>;
211
-
212
- // oxlint-disable-next-line eslint-plugin-react/no-clone-element -- asChild escape hatch
213
- return React.cloneElement(child, {
214
- ...props,
215
- ref: (node: HTMLElement | null) => {
216
- setRef(child.props.ref, node);
217
- handleRef(node);
218
- },
219
- });
220
- }
221
-
222
- return (
223
- <div data-slot="popover-anchor" ref={handleRef} {...props}>
224
- {children}
225
- </div>
226
- );
227
- };
228
-
229
- const PopoverHeader = ({
230
- className,
231
- ...props
232
- }: React.ComponentProps<"div">) => (
233
- <div
234
- className={cn("flex flex-col gap-1 text-sm", className)}
235
- data-slot="popover-header"
236
- {...props}
237
- />
238
- );
239
-
240
- const PopoverTitle = ({ className, ...props }: React.ComponentProps<"h2">) => (
241
- <div
242
- className={cn("font-medium", className)}
243
- data-slot="popover-title"
244
- {...props}
245
- />
246
- );
247
-
248
- const PopoverDescription = ({
249
- className,
250
- ...props
251
- }: React.ComponentProps<"p">) => (
252
- <p
253
- className={cn("text-muted-foreground", className)}
254
- data-slot="popover-description"
255
- {...props}
256
- />
257
- );
258
-
259
- export {
260
- Popover,
261
- PopoverTrigger,
262
- PopoverContent,
263
- PopoverAnchor,
264
- PopoverHeader,
265
- PopoverTitle,
266
- PopoverDescription,
267
- };