@suzumiyaaoba/mdxr 0.1.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 (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +2902 -0
  5. package/dist/components.d.mts +791 -0
  6. package/dist/components.mjs +2 -0
  7. package/dist/config-SI9IyFiC.mjs +184 -0
  8. package/dist/doc-context-CEqzMYKv.d.mts +568 -0
  9. package/dist/index.d.mts +20 -0
  10. package/dist/index.mjs +4 -0
  11. package/dist/ui-GKFD0mx5.mjs +15986 -0
  12. package/package.json +131 -0
  13. package/skill/SKILL.md +49 -0
  14. package/skill/references/components/charts.md +172 -0
  15. package/skill/references/components/document.md +98 -0
  16. package/skill/references/components/forms.md +35 -0
  17. package/skill/references/components/investigation.md +198 -0
  18. package/skill/references/components/layout.md +68 -0
  19. package/skill/references/components/output.md +158 -0
  20. package/skill/references/components/planning.md +155 -0
  21. package/skill/references/components/reports.md +252 -0
  22. package/skill/references/components/shadcn.md +19 -0
  23. package/skill/references/components.md +186 -0
  24. package/skill/references/extending.md +48 -0
  25. package/src/ask-sheet.ts +40 -0
  26. package/src/assets/css.ts +392 -0
  27. package/src/assets/scripts.ts +78 -0
  28. package/src/catalog.ts +287 -0
  29. package/src/cli.ts +178 -0
  30. package/src/client/doc-events.ts +1108 -0
  31. package/src/client/entry.ts +27 -0
  32. package/src/client-js.ts +47 -0
  33. package/src/component-map.ts +47 -0
  34. package/src/components/ui/accordion.tsx +77 -0
  35. package/src/components/ui/alert-dialog.tsx +185 -0
  36. package/src/components/ui/alert.tsx +76 -0
  37. package/src/components/ui/aspect-ratio.tsx +22 -0
  38. package/src/components/ui/attachment.tsx +208 -0
  39. package/src/components/ui/avatar.tsx +106 -0
  40. package/src/components/ui/badge.tsx +52 -0
  41. package/src/components/ui/breadcrumb.tsx +121 -0
  42. package/src/components/ui/bubble.tsx +128 -0
  43. package/src/components/ui/button-group.tsx +88 -0
  44. package/src/components/ui/button.tsx +58 -0
  45. package/src/components/ui/calendar.tsx +226 -0
  46. package/src/components/ui/card.tsx +102 -0
  47. package/src/components/ui/carousel.tsx +246 -0
  48. package/src/components/ui/chart.tsx +379 -0
  49. package/src/components/ui/checkbox.tsx +27 -0
  50. package/src/components/ui/collapsible.tsx +19 -0
  51. package/src/components/ui/combobox.tsx +298 -0
  52. package/src/components/ui/command.tsx +193 -0
  53. package/src/components/ui/context-menu.tsx +271 -0
  54. package/src/components/ui/dialog.tsx +159 -0
  55. package/src/components/ui/direction.tsx +4 -0
  56. package/src/components/ui/drawer.tsx +227 -0
  57. package/src/components/ui/dropdown-menu.tsx +269 -0
  58. package/src/components/ui/empty.tsx +104 -0
  59. package/src/components/ui/field.tsx +237 -0
  60. package/src/components/ui/fieldset.tsx +32 -0
  61. package/src/components/ui/frame.tsx +87 -0
  62. package/src/components/ui/hover-card.tsx +50 -0
  63. package/src/components/ui/input-group.tsx +159 -0
  64. package/src/components/ui/input-otp.tsx +83 -0
  65. package/src/components/ui/input.tsx +19 -0
  66. package/src/components/ui/item.tsx +202 -0
  67. package/src/components/ui/kbd.tsx +26 -0
  68. package/src/components/ui/label.tsx +19 -0
  69. package/src/components/ui/marker.tsx +71 -0
  70. package/src/components/ui/menubar.tsx +284 -0
  71. package/src/components/ui/message-scroller.tsx +128 -0
  72. package/src/components/ui/message.tsx +91 -0
  73. package/src/components/ui/meter.tsx +80 -0
  74. package/src/components/ui/native-select.tsx +64 -0
  75. package/src/components/ui/navigation-menu.tsx +170 -0
  76. package/src/components/ui/pagination.tsx +133 -0
  77. package/src/components/ui/popover.tsx +87 -0
  78. package/src/components/ui/progress.tsx +82 -0
  79. package/src/components/ui/questionnaire.tsx +328 -0
  80. package/src/components/ui/radio-group.tsx +35 -0
  81. package/src/components/ui/resizable.tsx +49 -0
  82. package/src/components/ui/scroll-area.tsx +50 -0
  83. package/src/components/ui/select.tsx +201 -0
  84. package/src/components/ui/separator.tsx +22 -0
  85. package/src/components/ui/sheet.tsx +135 -0
  86. package/src/components/ui/sidebar.tsx +730 -0
  87. package/src/components/ui/skeleton.tsx +13 -0
  88. package/src/components/ui/slider.tsx +51 -0
  89. package/src/components/ui/spinner.tsx +16 -0
  90. package/src/components/ui/switch.tsx +31 -0
  91. package/src/components/ui/table.tsx +113 -0
  92. package/src/components/ui/tabs.tsx +82 -0
  93. package/src/components/ui/textarea.tsx +17 -0
  94. package/src/components/ui/toast.tsx +229 -0
  95. package/src/components/ui/toggle-group.tsx +87 -0
  96. package/src/components/ui/toggle.tsx +43 -0
  97. package/src/components/ui/tooltip.tsx +65 -0
  98. package/src/components.ts +78 -0
  99. package/src/config.ts +56 -0
  100. package/src/define.ts +122 -0
  101. package/src/doc-context.ts +20 -0
  102. package/src/editor.ts +94 -0
  103. package/src/format-error.ts +78 -0
  104. package/src/guards.ts +84 -0
  105. package/src/hooks/use-mobile.ts +21 -0
  106. package/src/html.ts +91 -0
  107. package/src/hydrate/export-index.ts +232 -0
  108. package/src/hydrate/import-scan.ts +169 -0
  109. package/src/hydrate/plugins.ts +118 -0
  110. package/src/hydrate/runtime-module.ts +145 -0
  111. package/src/hydrate-runtime.ts +67 -0
  112. package/src/hydrate.ts +147 -0
  113. package/src/index.ts +16 -0
  114. package/src/init.ts +57 -0
  115. package/src/langs.ts +148 -0
  116. package/src/lines.ts +53 -0
  117. package/src/load-user-module.ts +191 -0
  118. package/src/mdx.ts +248 -0
  119. package/src/paths.ts +36 -0
  120. package/src/rehype/shiki.ts +533 -0
  121. package/src/remark/alerts.ts +53 -0
  122. package/src/remark/ast.ts +96 -0
  123. package/src/remark/callouts.ts +25 -0
  124. package/src/remark/code-file.ts +85 -0
  125. package/src/remark/code-meta.ts +21 -0
  126. package/src/remark/directives.ts +170 -0
  127. package/src/remark/file-paths.ts +64 -0
  128. package/src/remark/headings.ts +131 -0
  129. package/src/remark/no-js.ts +40 -0
  130. package/src/render.ts +337 -0
  131. package/src/serve.ts +322 -0
  132. package/src/styles/globals.css +134 -0
  133. package/src/styles/shadcn.css +641 -0
  134. package/src/tailwind.ts +119 -0
  135. package/src/ui/approvals.tsx +76 -0
  136. package/src/ui/ask-question.tsx +386 -0
  137. package/src/ui/ask.tsx +206 -0
  138. package/src/ui/attrs.ts +51 -0
  139. package/src/ui/audit.tsx +139 -0
  140. package/src/ui/bar-chart.tsx +334 -0
  141. package/src/ui/benchmarks.tsx +143 -0
  142. package/src/ui/bits.tsx +537 -0
  143. package/src/ui/board.tsx +173 -0
  144. package/src/ui/bridge.tsx +207 -0
  145. package/src/ui/bumps.tsx +178 -0
  146. package/src/ui/callout.tsx +106 -0
  147. package/src/ui/changes.tsx +89 -0
  148. package/src/ui/chart-bits.tsx +52 -0
  149. package/src/ui/chart.ts +577 -0
  150. package/src/ui/checks.tsx +203 -0
  151. package/src/ui/child-index.tsx +44 -0
  152. package/src/ui/children.ts +43 -0
  153. package/src/ui/chips.tsx +49 -0
  154. package/src/ui/cmd.tsx +27 -0
  155. package/src/ui/columns.tsx +31 -0
  156. package/src/ui/comments.tsx +544 -0
  157. package/src/ui/compare.tsx +67 -0
  158. package/src/ui/decision.tsx +79 -0
  159. package/src/ui/deps.tsx +78 -0
  160. package/src/ui/details.tsx +43 -0
  161. package/src/ui/diff-parse.ts +307 -0
  162. package/src/ui/diff.tsx +458 -0
  163. package/src/ui/diffstat.tsx +58 -0
  164. package/src/ui/due.tsx +65 -0
  165. package/src/ui/effort.tsx +29 -0
  166. package/src/ui/endpoints.tsx +118 -0
  167. package/src/ui/envvars.tsx +96 -0
  168. package/src/ui/figure.tsx +37 -0
  169. package/src/ui/file-icon.ts +1020 -0
  170. package/src/ui/file-link.ts +32 -0
  171. package/src/ui/file-ref.tsx +39 -0
  172. package/src/ui/files.tsx +112 -0
  173. package/src/ui/findings.tsx +85 -0
  174. package/src/ui/flow.tsx +73 -0
  175. package/src/ui/funnel.tsx +121 -0
  176. package/src/ui/gantt.tsx +443 -0
  177. package/src/ui/gauges.tsx +135 -0
  178. package/src/ui/glossary.tsx +29 -0
  179. package/src/ui/graph-layout.ts +149 -0
  180. package/src/ui/graph-specs.tsx +102 -0
  181. package/src/ui/graph.tsx +278 -0
  182. package/src/ui/grid.tsx +119 -0
  183. package/src/ui/hypothesis.tsx +94 -0
  184. package/src/ui/icon.tsx +80 -0
  185. package/src/ui/incident.tsx +130 -0
  186. package/src/ui/index.ts +342 -0
  187. package/src/ui/ins-del.tsx +41 -0
  188. package/src/ui/json.tsx +190 -0
  189. package/src/ui/layout.ts +9 -0
  190. package/src/ui/line-chart.tsx +251 -0
  191. package/src/ui/matrix.tsx +208 -0
  192. package/src/ui/meta.tsx +73 -0
  193. package/src/ui/option.tsx +64 -0
  194. package/src/ui/owner.tsx +40 -0
  195. package/src/ui/packages.tsx +104 -0
  196. package/src/ui/pathway.tsx +96 -0
  197. package/src/ui/phase.tsx +41 -0
  198. package/src/ui/pie-chart.tsx +170 -0
  199. package/src/ui/plan.tsx +77 -0
  200. package/src/ui/pre.tsx +175 -0
  201. package/src/ui/priority.tsx +51 -0
  202. package/src/ui/props.tsx +77 -0
  203. package/src/ui/quadrant.tsx +172 -0
  204. package/src/ui/radar.tsx +200 -0
  205. package/src/ui/ref.tsx +160 -0
  206. package/src/ui/release.tsx +178 -0
  207. package/src/ui/req.tsx +42 -0
  208. package/src/ui/review.tsx +133 -0
  209. package/src/ui/risk.tsx +67 -0
  210. package/src/ui/sankey.tsx +287 -0
  211. package/src/ui/scatter.tsx +237 -0
  212. package/src/ui/schema.tsx +113 -0
  213. package/src/ui/score.tsx +105 -0
  214. package/src/ui/search.tsx +120 -0
  215. package/src/ui/series.tsx +38 -0
  216. package/src/ui/severity.tsx +69 -0
  217. package/src/ui/shadcn.tsx +216 -0
  218. package/src/ui/spark.tsx +86 -0
  219. package/src/ui/stack.tsx +57 -0
  220. package/src/ui/stats.tsx +63 -0
  221. package/src/ui/status-badge.tsx +66 -0
  222. package/src/ui/statuspage.tsx +238 -0
  223. package/src/ui/steps.tsx +74 -0
  224. package/src/ui/summary.tsx +41 -0
  225. package/src/ui/symbol-ref.tsx +73 -0
  226. package/src/ui/terminal.tsx +117 -0
  227. package/src/ui/tests.tsx +218 -0
  228. package/src/ui/timeline.tsx +63 -0
  229. package/src/ui/toc.tsx +56 -0
  230. package/src/ui/tones.ts +187 -0
  231. package/src/ui/trace.tsx +69 -0
  232. package/src/ui/tree.tsx +281 -0
  233. package/src/ui/treemap.tsx +128 -0
  234. package/src/ui/venn.tsx +258 -0
  235. package/src/ui/verdict.tsx +78 -0
  236. package/src/ui/waterfall.tsx +142 -0
@@ -0,0 +1,71 @@
1
+ import { mergeProps } from "@base-ui/react/merge-props";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import { cva } from "class-variance-authority";
4
+ import type { VariantProps } from "class-variance-authority";
5
+ import { cn } from "cn";
6
+ import * as React from "react";
7
+
8
+ const markerVariants = cva(
9
+ "group/marker text-muted-foreground [a]:hover:text-foreground relative flex min-h-4 w-full items-center gap-2 text-left text-sm [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ border: "border-border border-b pb-2",
14
+ default: "",
15
+ separator:
16
+ "before:bg-border after:bg-border before:mr-1 before:h-px before:min-w-0 before:flex-1 after:ml-1 after:h-px after:min-w-0 after:flex-1",
17
+ },
18
+ },
19
+ }
20
+ );
21
+
22
+ function Marker({
23
+ className,
24
+ variant = "default",
25
+ render,
26
+ ...props
27
+ }: useRender.ComponentProps<"div"> & VariantProps<typeof markerVariants>) {
28
+ return useRender({
29
+ defaultTagName: "div",
30
+ props: mergeProps<"div">(
31
+ {
32
+ className: cn(markerVariants({ className, variant })),
33
+ },
34
+ props
35
+ ),
36
+ render,
37
+ state: {
38
+ slot: "marker",
39
+ variant,
40
+ },
41
+ });
42
+ }
43
+
44
+ function MarkerIcon({ className, ...props }: React.ComponentProps<"span">) {
45
+ return (
46
+ <span
47
+ data-slot="marker-icon"
48
+ aria-hidden="true"
49
+ className={cn(
50
+ "size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ );
56
+ }
57
+
58
+ function MarkerContent({ className, ...props }: React.ComponentProps<"span">) {
59
+ return (
60
+ <span
61
+ data-slot="marker-content"
62
+ className={cn(
63
+ "*:[a]:hover:text-foreground min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ );
69
+ }
70
+
71
+ export { Marker, MarkerIcon, MarkerContent, markerVariants };
@@ -0,0 +1,284 @@
1
+ "use client";
2
+
3
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
4
+ import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
5
+ import { cn } from "cn";
6
+ import { CheckIcon } from "lucide-react";
7
+ import * as React from "react";
8
+
9
+ import {
10
+ DropdownMenu,
11
+ DropdownMenuContent,
12
+ DropdownMenuGroup,
13
+ DropdownMenuItem,
14
+ DropdownMenuLabel,
15
+ DropdownMenuPortal,
16
+ DropdownMenuRadioGroup,
17
+ DropdownMenuSeparator,
18
+ DropdownMenuShortcut,
19
+ DropdownMenuSub,
20
+ DropdownMenuSubContent,
21
+ DropdownMenuSubTrigger,
22
+ DropdownMenuTrigger,
23
+ } from "./dropdown-menu.js";
24
+
25
+ function Menubar({ className, ...props }: MenubarPrimitive.Props) {
26
+ return (
27
+ <MenubarPrimitive
28
+ data-slot="menubar"
29
+ className={cn(
30
+ "flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ );
36
+ }
37
+
38
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
39
+ return <DropdownMenu data-slot="menubar-menu" {...props} />;
40
+ }
41
+
42
+ function MenubarGroup({
43
+ ...props
44
+ }: React.ComponentProps<typeof DropdownMenuGroup>) {
45
+ return <DropdownMenuGroup data-slot="menubar-group" {...props} />;
46
+ }
47
+
48
+ function MenubarPortal({
49
+ ...props
50
+ }: React.ComponentProps<typeof DropdownMenuPortal>) {
51
+ return <DropdownMenuPortal data-slot="menubar-portal" {...props} />;
52
+ }
53
+
54
+ function MenubarTrigger({
55
+ className,
56
+ ...props
57
+ }: React.ComponentProps<typeof DropdownMenuTrigger>) {
58
+ return (
59
+ <DropdownMenuTrigger
60
+ data-slot="menubar-trigger"
61
+ className={cn(
62
+ "hover:bg-muted aria-expanded:bg-muted flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ );
68
+ }
69
+
70
+ function MenubarContent({
71
+ className,
72
+ align = "start",
73
+ alignOffset = -4,
74
+ sideOffset = 8,
75
+ ...props
76
+ }: React.ComponentProps<typeof DropdownMenuContent>) {
77
+ return (
78
+ <DropdownMenuContent
79
+ data-slot="menubar-content"
80
+ align={align}
81
+ alignOffset={alignOffset}
82
+ sideOffset={sideOffset}
83
+ className={cn(
84
+ "bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ );
90
+ }
91
+
92
+ function MenubarItem({
93
+ className,
94
+ inset,
95
+ variant = "default",
96
+ ...props
97
+ }: React.ComponentProps<typeof DropdownMenuItem>) {
98
+ return (
99
+ <DropdownMenuItem
100
+ data-slot="menubar-item"
101
+ data-inset={inset}
102
+ data-variant={variant}
103
+ className={cn(
104
+ "group/menubar-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive! gap-1.5 rounded-md px-1.5 py-1 text-sm data-disabled:opacity-50 data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4",
105
+ className
106
+ )}
107
+ {...props}
108
+ />
109
+ );
110
+ }
111
+
112
+ function MenubarCheckboxItem({
113
+ className,
114
+ children,
115
+ checked,
116
+ inset,
117
+ ...props
118
+ }: MenuPrimitive.CheckboxItem.Props & {
119
+ inset?: boolean;
120
+ }) {
121
+ return (
122
+ <MenuPrimitive.CheckboxItem
123
+ data-slot="menubar-checkbox-item"
124
+ data-inset={inset}
125
+ className={cn(
126
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0",
127
+ className
128
+ )}
129
+ checked={checked}
130
+ {...props}
131
+ >
132
+ <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
133
+ <MenuPrimitive.CheckboxItemIndicator>
134
+ <CheckIcon />
135
+ </MenuPrimitive.CheckboxItemIndicator>
136
+ </span>
137
+ {children}
138
+ </MenuPrimitive.CheckboxItem>
139
+ );
140
+ }
141
+
142
+ function MenubarRadioGroup({
143
+ ...props
144
+ }: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
145
+ return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />;
146
+ }
147
+
148
+ function MenubarRadioItem({
149
+ className,
150
+ children,
151
+ inset,
152
+ ...props
153
+ }: MenuPrimitive.RadioItem.Props & {
154
+ inset?: boolean;
155
+ }) {
156
+ return (
157
+ <MenuPrimitive.RadioItem
158
+ data-slot="menubar-radio-item"
159
+ data-inset={inset}
160
+ className={cn(
161
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
162
+ className
163
+ )}
164
+ {...props}
165
+ >
166
+ <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
167
+ <MenuPrimitive.RadioItemIndicator>
168
+ <CheckIcon />
169
+ </MenuPrimitive.RadioItemIndicator>
170
+ </span>
171
+ {children}
172
+ </MenuPrimitive.RadioItem>
173
+ );
174
+ }
175
+
176
+ function MenubarLabel({
177
+ className,
178
+ inset,
179
+ ...props
180
+ }: React.ComponentProps<typeof DropdownMenuLabel> & {
181
+ inset?: boolean;
182
+ }) {
183
+ return (
184
+ <DropdownMenuLabel
185
+ data-slot="menubar-label"
186
+ data-inset={inset}
187
+ className={cn(
188
+ "px-1.5 py-1 text-sm font-medium data-inset:pl-7",
189
+ className
190
+ )}
191
+ {...props}
192
+ />
193
+ );
194
+ }
195
+
196
+ function MenubarSeparator({
197
+ className,
198
+ ...props
199
+ }: React.ComponentProps<typeof DropdownMenuSeparator>) {
200
+ return (
201
+ <DropdownMenuSeparator
202
+ data-slot="menubar-separator"
203
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
204
+ {...props}
205
+ />
206
+ );
207
+ }
208
+
209
+ function MenubarShortcut({
210
+ className,
211
+ ...props
212
+ }: React.ComponentProps<typeof DropdownMenuShortcut>) {
213
+ return (
214
+ <DropdownMenuShortcut
215
+ data-slot="menubar-shortcut"
216
+ className={cn(
217
+ "text-muted-foreground group-focus/menubar-item:text-accent-foreground ml-auto text-xs tracking-widest",
218
+ className
219
+ )}
220
+ {...props}
221
+ />
222
+ );
223
+ }
224
+
225
+ function MenubarSub({
226
+ ...props
227
+ }: React.ComponentProps<typeof DropdownMenuSub>) {
228
+ return <DropdownMenuSub data-slot="menubar-sub" {...props} />;
229
+ }
230
+
231
+ function MenubarSubTrigger({
232
+ className,
233
+ inset,
234
+ ...props
235
+ }: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
236
+ inset?: boolean;
237
+ }) {
238
+ return (
239
+ <DropdownMenuSubTrigger
240
+ data-slot="menubar-sub-trigger"
241
+ data-inset={inset}
242
+ className={cn(
243
+ "focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4",
244
+ className
245
+ )}
246
+ {...props}
247
+ />
248
+ );
249
+ }
250
+
251
+ function MenubarSubContent({
252
+ className,
253
+ ...props
254
+ }: React.ComponentProps<typeof DropdownMenuSubContent>) {
255
+ return (
256
+ <DropdownMenuSubContent
257
+ data-slot="menubar-sub-content"
258
+ className={cn(
259
+ "bg-popover text-popover-foreground ring-foreground/10 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 min-w-32 rounded-lg p-1 shadow-lg ring-1 duration-100",
260
+ className
261
+ )}
262
+ {...props}
263
+ />
264
+ );
265
+ }
266
+
267
+ export {
268
+ Menubar,
269
+ MenubarPortal,
270
+ MenubarMenu,
271
+ MenubarTrigger,
272
+ MenubarContent,
273
+ MenubarGroup,
274
+ MenubarSeparator,
275
+ MenubarLabel,
276
+ MenubarItem,
277
+ MenubarShortcut,
278
+ MenubarCheckboxItem,
279
+ MenubarRadioGroup,
280
+ MenubarRadioItem,
281
+ MenubarSub,
282
+ MenubarSubTrigger,
283
+ MenubarSubContent,
284
+ };
@@ -0,0 +1,128 @@
1
+ import {
2
+ MessageScroller as MessageScrollerPrimitive,
3
+ useMessageScroller,
4
+ useMessageScrollerScrollable,
5
+ useMessageScrollerVisibility,
6
+ } from "@shadcn/react/message-scroller";
7
+ import { cn } from "cn";
8
+ import { ArrowDownIcon } from "lucide-react";
9
+ import * as React from "react";
10
+
11
+ import { Button } from "./button.js";
12
+
13
+ function MessageScrollerProvider(
14
+ props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
15
+ ) {
16
+ return <MessageScrollerPrimitive.Provider {...props} />;
17
+ }
18
+
19
+ function MessageScroller({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
23
+ return (
24
+ <MessageScrollerPrimitive.Root
25
+ data-slot="message-scroller"
26
+ className={cn(
27
+ "group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
28
+ className
29
+ )}
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+
35
+ function MessageScrollerViewport({
36
+ className,
37
+ ...props
38
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
39
+ return (
40
+ <MessageScrollerPrimitive.Viewport
41
+ data-slot="message-scroller-viewport"
42
+ className={cn(
43
+ "scroll-fade-b no-scrollbar size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain contain-content data-pending-scroll:invisible",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ function MessageScrollerContent({
52
+ className,
53
+ ...props
54
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
55
+ return (
56
+ <MessageScrollerPrimitive.Content
57
+ data-slot="message-scroller-content"
58
+ className={cn("flex h-max min-h-full flex-col gap-6", className)}
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+
64
+ function MessageScrollerItem({
65
+ className,
66
+ scrollAnchor = false,
67
+ ...props
68
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
69
+ return (
70
+ <MessageScrollerPrimitive.Item
71
+ data-slot="message-scroller-item"
72
+ scrollAnchor={scrollAnchor}
73
+ className={cn(
74
+ "min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
75
+ className
76
+ )}
77
+ {...props}
78
+ />
79
+ );
80
+ }
81
+
82
+ function MessageScrollerButton({
83
+ direction = "end",
84
+ className,
85
+ children,
86
+ render,
87
+ variant = "secondary",
88
+ size = "icon-sm",
89
+ ...props
90
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
91
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
92
+ return (
93
+ <MessageScrollerPrimitive.Button
94
+ data-slot="message-scroller-button"
95
+ data-direction={direction}
96
+ data-variant={variant}
97
+ data-size={size}
98
+ direction={direction}
99
+ className={cn(
100
+ "border-border bg-background text-foreground hover:bg-muted hover:text-foreground absolute inset-s-1/2 -translate-x-1/2 transition-[translate,scale,opacity] duration-200 data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
101
+ className
102
+ )}
103
+ render={render ?? <Button variant={variant} size={size} />}
104
+ {...props}
105
+ >
106
+ {children ?? (
107
+ <>
108
+ <ArrowDownIcon />
109
+ <span className="sr-only">
110
+ {direction === "end" ? "Scroll to end" : "Scroll to start"}
111
+ </span>
112
+ </>
113
+ )}
114
+ </MessageScrollerPrimitive.Button>
115
+ );
116
+ }
117
+
118
+ export {
119
+ MessageScrollerProvider,
120
+ MessageScroller,
121
+ MessageScrollerViewport,
122
+ MessageScrollerContent,
123
+ MessageScrollerItem,
124
+ MessageScrollerButton,
125
+ useMessageScroller,
126
+ useMessageScrollerScrollable,
127
+ useMessageScrollerVisibility,
128
+ };
@@ -0,0 +1,91 @@
1
+ import { cn } from "cn";
2
+ import * as React from "react";
3
+
4
+ function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
5
+ return (
6
+ <div
7
+ data-slot="message-group"
8
+ className={cn("flex min-w-0 flex-col gap-2", className)}
9
+ {...props}
10
+ />
11
+ );
12
+ }
13
+
14
+ function Message({
15
+ className,
16
+ align = "start",
17
+ ...props
18
+ }: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
19
+ return (
20
+ <div
21
+ data-slot="message"
22
+ data-align={align}
23
+ className={cn(
24
+ "group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
33
+ return (
34
+ <div
35
+ data-slot="message-avatar"
36
+ className={cn(
37
+ "bg-muted flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full group-has-data-[slot=message-footer]/message:-translate-y-8",
38
+ className
39
+ )}
40
+ {...props}
41
+ />
42
+ );
43
+ }
44
+
45
+ function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
46
+ return (
47
+ <div
48
+ data-slot="message-content"
49
+ className={cn(
50
+ "flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ );
56
+ }
57
+
58
+ function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
59
+ return (
60
+ <div
61
+ data-slot="message-header"
62
+ className={cn(
63
+ "text-muted-foreground flex max-w-full min-w-0 items-center px-3 text-xs font-medium group-has-data-[variant=ghost]/message:px-0",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ );
69
+ }
70
+
71
+ function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
72
+ return (
73
+ <div
74
+ data-slot="message-footer"
75
+ className={cn(
76
+ "text-muted-foreground flex max-w-full min-w-0 items-center px-3 text-xs font-medium group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ export {
85
+ MessageGroup,
86
+ Message,
87
+ MessageAvatar,
88
+ MessageContent,
89
+ MessageFooter,
90
+ MessageHeader,
91
+ };
@@ -0,0 +1,80 @@
1
+ "use client";
2
+
3
+ import { Meter as MeterPrimitive } from "@base-ui/react/meter";
4
+ import { cn } from "cn";
5
+ import type React from "react";
6
+
7
+ export function Meter({
8
+ className,
9
+ children,
10
+ ...props
11
+ }: MeterPrimitive.Root.Props): React.ReactElement {
12
+ return (
13
+ <MeterPrimitive.Root
14
+ className={cn("flex w-full flex-col gap-2", className)}
15
+ {...props}
16
+ >
17
+ {children ? (
18
+ children
19
+ ) : (
20
+ <MeterTrack>
21
+ <MeterIndicator />
22
+ </MeterTrack>
23
+ )}
24
+ </MeterPrimitive.Root>
25
+ );
26
+ }
27
+
28
+ export function MeterLabel({
29
+ className,
30
+ ...props
31
+ }: MeterPrimitive.Label.Props): React.ReactElement {
32
+ return (
33
+ <MeterPrimitive.Label
34
+ className={cn("text-foreground text-sm font-medium", className)}
35
+ data-slot="meter-label"
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ export function MeterTrack({
42
+ className,
43
+ ...props
44
+ }: MeterPrimitive.Track.Props): React.ReactElement {
45
+ return (
46
+ <MeterPrimitive.Track
47
+ className={cn("bg-input block h-2 w-full overflow-hidden", className)}
48
+ data-slot="meter-track"
49
+ {...props}
50
+ />
51
+ );
52
+ }
53
+
54
+ export function MeterIndicator({
55
+ className,
56
+ ...props
57
+ }: MeterPrimitive.Indicator.Props): React.ReactElement {
58
+ return (
59
+ <MeterPrimitive.Indicator
60
+ className={cn("bg-primary transition-all duration-500", className)}
61
+ data-slot="meter-indicator"
62
+ {...props}
63
+ />
64
+ );
65
+ }
66
+
67
+ export function MeterValue({
68
+ className,
69
+ ...props
70
+ }: MeterPrimitive.Value.Props): React.ReactElement {
71
+ return (
72
+ <MeterPrimitive.Value
73
+ className={cn("text-foreground text-sm tabular-nums", className)}
74
+ data-slot="meter-value"
75
+ {...props}
76
+ />
77
+ );
78
+ }
79
+
80
+ export { MeterPrimitive };