@softize/opus 8.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.md +1616 -0
  2. package/LICENSE +21 -0
  3. package/README.md +113 -0
  4. package/bin/cli.mjs +528 -0
  5. package/bin/lib/check.mjs +307 -0
  6. package/bin/lib/components.mjs +151 -0
  7. package/bin/lib/create.mjs +208 -0
  8. package/bin/lib/db-check-runner.mjs +86 -0
  9. package/bin/lib/db-migrate-runner.mjs +89 -0
  10. package/bin/lib/db-scaffold-runner.mjs +84 -0
  11. package/bin/lib/db.mjs +261 -0
  12. package/bin/lib/docs-include.mjs +48 -0
  13. package/bin/lib/gen-dicts.mjs +134 -0
  14. package/bin/lib/gen-docs.mjs +288 -0
  15. package/bin/lib/gen-manifest.mjs +102 -0
  16. package/bin/lib/gen-openapi.mjs +195 -0
  17. package/bin/lib/gen-runner.mjs +472 -0
  18. package/bin/lib/gen-stubs.mjs +463 -0
  19. package/bin/lib/gen.mjs +311 -0
  20. package/bin/lib/init.mjs +514 -0
  21. package/bin/lib/introspect.mjs +107 -0
  22. package/bin/lib/mcp.mjs +85 -0
  23. package/bin/lib/postinstall.mjs +56 -0
  24. package/docs/chat-event-protocol.md +85 -0
  25. package/docs/code-style.md +16 -0
  26. package/docs/data-layer.md +246 -0
  27. package/docs/ownership-vs-shadcn-lock.md +102 -0
  28. package/docs/protocol.md +2053 -0
  29. package/docs/releasing.md +110 -0
  30. package/docs/shellnav.md +131 -0
  31. package/package.json +338 -0
  32. package/registry/hooks/hooks.json +26 -0
  33. package/registry/hooks/link-memory-on-start.mjs +46 -0
  34. package/registry/hooks/opus-check-on-stop.mjs +114 -0
  35. package/registry/skills/create-action/SKILL.md +49 -0
  36. package/registry/skills/create-action/scaffold.mjs +122 -0
  37. package/registry/templates/app/_gitignore +3 -0
  38. package/registry/templates/app/_npmrc +1 -0
  39. package/registry/templates/app/_opus/_gitignore +5 -0
  40. package/registry/templates/app/_prettierrc.json +6 -0
  41. package/registry/templates/app/index.html +13 -0
  42. package/registry/templates/app/opus.config.ts +16 -0
  43. package/registry/templates/app/package.json +43 -0
  44. package/registry/templates/app/pnpm-workspace.yaml +11 -0
  45. package/registry/templates/app/public/favicon.svg +4 -0
  46. package/registry/templates/app/src/App.tsx +37 -0
  47. package/registry/templates/app/src/domains/tasks/actions/list.test.ts +34 -0
  48. package/registry/templates/app/src/domains/tasks/actions/list.ts +33 -0
  49. package/registry/templates/app/src/domains/tasks/index.ts +13 -0
  50. package/registry/templates/app/src/index.css +18 -0
  51. package/registry/templates/app/src/main.tsx +25 -0
  52. package/registry/templates/app/tsconfig.json +20 -0
  53. package/registry/templates/app/vite.config.ts +46 -0
  54. package/registry/templates/monorepo/_gitignore +3 -0
  55. package/registry/templates/monorepo/_npmrc +1 -0
  56. package/registry/templates/monorepo/package.json +9 -0
  57. package/registry/templates/monorepo/pnpm-workspace.yaml +14 -0
  58. package/src/ai/ask.ts +64 -0
  59. package/src/ai/drivers/anthropic.ts +309 -0
  60. package/src/ai/index.ts +17 -0
  61. package/src/audit/drivers/console.ts +117 -0
  62. package/src/audit/drivers/pg.ts +172 -0
  63. package/src/audit/index.ts +51 -0
  64. package/src/auth/drivers/better-auth.ts +103 -0
  65. package/src/auth/drivers/jwt.ts +188 -0
  66. package/src/auth/index.ts +9 -0
  67. package/src/client/drivers/fetch.ts +202 -0
  68. package/src/client/index.ts +22 -0
  69. package/src/core/actions.ts +110 -0
  70. package/src/core/audit.ts +239 -0
  71. package/src/core/contracts.ts +137 -0
  72. package/src/core/domain.ts +310 -0
  73. package/src/core/errors.ts +181 -0
  74. package/src/core/index.ts +174 -0
  75. package/src/core/logical-type.ts +31 -0
  76. package/src/core/reactions.ts +81 -0
  77. package/src/core/runtime.ts +1167 -0
  78. package/src/core/schedules.ts +41 -0
  79. package/src/core/types.ts +1356 -0
  80. package/src/data/drivers/kysely.ts +389 -0
  81. package/src/data/index.ts +10 -0
  82. package/src/data/readonly-pool.ts +160 -0
  83. package/src/dsl/eval.ts +136 -0
  84. package/src/dsl/index.ts +29 -0
  85. package/src/dsl/kysely.ts +230 -0
  86. package/src/dsl/loads.ts +123 -0
  87. package/src/dsl/parser.ts +423 -0
  88. package/src/dsl/types.ts +113 -0
  89. package/src/events/drivers/mitt.ts +70 -0
  90. package/src/events/index.ts +9 -0
  91. package/src/log/drivers/pino.ts +57 -0
  92. package/src/log/index.ts +9 -0
  93. package/src/mcp/index.ts +62 -0
  94. package/src/queue/drivers/bullmq.ts +190 -0
  95. package/src/queue/index.ts +9 -0
  96. package/src/scheduler/drivers/node-cron.ts +93 -0
  97. package/src/scheduler/every.ts +45 -0
  98. package/src/scheduler/index.ts +9 -0
  99. package/src/schema/drivers/zod.ts +765 -0
  100. package/src/schema/entity.ts +439 -0
  101. package/src/schema/format/locale.ts +144 -0
  102. package/src/schema/index.ts +65 -0
  103. package/src/schema/openapi.ts +302 -0
  104. package/src/schema/scaffold.ts +160 -0
  105. package/src/server/drivers/fastify.ts +224 -0
  106. package/src/server/drivers/node.ts +386 -0
  107. package/src/server/index.ts +142 -0
  108. package/src/storage/drivers/fs.ts +90 -0
  109. package/src/storage/drivers/s3.ts +117 -0
  110. package/src/storage/index.ts +27 -0
  111. package/src/testing/fake.ts +298 -0
  112. package/src/testing/index.ts +324 -0
  113. package/src/ui/components/patterns/action-form-card.tsx +48 -0
  114. package/src/ui/components/patterns/action-list-dialog.tsx +93 -0
  115. package/src/ui/components/patterns/app-shell.tsx +227 -0
  116. package/src/ui/components/patterns/confirm.tsx +226 -0
  117. package/src/ui/components/patterns/data-state.tsx +75 -0
  118. package/src/ui/components/patterns/form-dialog.tsx +64 -0
  119. package/src/ui/components/patterns/form.tsx +584 -0
  120. package/src/ui/components/patterns/list.tsx +1488 -0
  121. package/src/ui/components/patterns/page.tsx +46 -0
  122. package/src/ui/components/patterns/section-shell.tsx +246 -0
  123. package/src/ui/components/patterns/shell-nav.tsx +150 -0
  124. package/src/ui/components/patterns/sidebar.tsx +89 -0
  125. package/src/ui/components/patterns/split.tsx +93 -0
  126. package/src/ui/components/patterns/trigger.tsx +196 -0
  127. package/src/ui/components/patterns/view.tsx +84 -0
  128. package/src/ui/components/primitives/accordion.tsx +64 -0
  129. package/src/ui/components/primitives/alert-dialog.tsx +190 -0
  130. package/src/ui/components/primitives/alert.tsx +116 -0
  131. package/src/ui/components/primitives/aspect-ratio.tsx +9 -0
  132. package/src/ui/components/primitives/avatar.tsx +107 -0
  133. package/src/ui/components/primitives/badge.tsx +37 -0
  134. package/src/ui/components/primitives/breadcrumb.tsx +109 -0
  135. package/src/ui/components/primitives/button-group.tsx +83 -0
  136. package/src/ui/components/primitives/button.tsx +102 -0
  137. package/src/ui/components/primitives/calendar.tsx +218 -0
  138. package/src/ui/components/primitives/card.tsx +56 -0
  139. package/src/ui/components/primitives/carousel.tsx +239 -0
  140. package/src/ui/components/primitives/chat.tsx +407 -0
  141. package/src/ui/components/primitives/checkbox.tsx +30 -0
  142. package/src/ui/components/primitives/collapsible.tsx +31 -0
  143. package/src/ui/components/primitives/command.tsx +182 -0
  144. package/src/ui/components/primitives/composer.tsx +121 -0
  145. package/src/ui/components/primitives/copyable.tsx +50 -0
  146. package/src/ui/components/primitives/dialog.tsx +147 -0
  147. package/src/ui/components/primitives/drawer.tsx +141 -0
  148. package/src/ui/components/primitives/empty.tsx +104 -0
  149. package/src/ui/components/primitives/field.tsx +246 -0
  150. package/src/ui/components/primitives/icon-picker.tsx +180 -0
  151. package/src/ui/components/primitives/input-group.tsx +168 -0
  152. package/src/ui/components/primitives/input-otp.tsx +75 -0
  153. package/src/ui/components/primitives/input.tsx +72 -0
  154. package/src/ui/components/primitives/item.tsx +193 -0
  155. package/src/ui/components/primitives/kbd.tsx +28 -0
  156. package/src/ui/components/primitives/label.tsx +22 -0
  157. package/src/ui/components/primitives/markdown.tsx +35 -0
  158. package/src/ui/components/primitives/menu.tsx +255 -0
  159. package/src/ui/components/primitives/pagination.tsx +127 -0
  160. package/src/ui/components/primitives/popover.tsx +87 -0
  161. package/src/ui/components/primitives/progress.tsx +29 -0
  162. package/src/ui/components/primitives/radio-group.tsx +43 -0
  163. package/src/ui/components/primitives/resizable.tsx +51 -0
  164. package/src/ui/components/primitives/scroll-area.tsx +56 -0
  165. package/src/ui/components/primitives/select.tsx +479 -0
  166. package/src/ui/components/primitives/separator.tsx +26 -0
  167. package/src/ui/components/primitives/skeleton.tsx +13 -0
  168. package/src/ui/components/primitives/slider.tsx +61 -0
  169. package/src/ui/components/primitives/sonner.tsx +46 -0
  170. package/src/ui/components/primitives/spinner.tsx +29 -0
  171. package/src/ui/components/primitives/switch.tsx +33 -0
  172. package/src/ui/components/primitives/table.tsx +114 -0
  173. package/src/ui/components/primitives/tabs.tsx +104 -0
  174. package/src/ui/components/primitives/textarea.tsx +18 -0
  175. package/src/ui/components/primitives/toggle-group.tsx +81 -0
  176. package/src/ui/components/primitives/toggle.tsx +45 -0
  177. package/src/ui/components/primitives/tooltip.tsx +55 -0
  178. package/src/ui/components/primitives/truncate.tsx +49 -0
  179. package/src/ui/docs/DocBrowser.tsx +90 -0
  180. package/src/ui/docs/changelog.tsx +80 -0
  181. package/src/ui/docs/content/accordion.md +86 -0
  182. package/src/ui/docs/content/action-form-card.md +24 -0
  183. package/src/ui/docs/content/action-form-dialog.md +30 -0
  184. package/src/ui/docs/content/action-form.md +125 -0
  185. package/src/ui/docs/content/action-list-dialog.md +68 -0
  186. package/src/ui/docs/content/action-list.md +194 -0
  187. package/src/ui/docs/content/action-trigger.md +72 -0
  188. package/src/ui/docs/content/action-view.md +47 -0
  189. package/src/ui/docs/content/actions.md +138 -0
  190. package/src/ui/docs/content/ai.md +112 -0
  191. package/src/ui/docs/content/alert-dialog.md +73 -0
  192. package/src/ui/docs/content/alert.md +69 -0
  193. package/src/ui/docs/content/app-shell.md +155 -0
  194. package/src/ui/docs/content/aspect-ratio.md +66 -0
  195. package/src/ui/docs/content/audit.md +84 -0
  196. package/src/ui/docs/content/auth.md +70 -0
  197. package/src/ui/docs/content/avatar.md +94 -0
  198. package/src/ui/docs/content/badge.md +48 -0
  199. package/src/ui/docs/content/breadcrumb.md +87 -0
  200. package/src/ui/docs/content/button-group.md +71 -0
  201. package/src/ui/docs/content/button.md +60 -0
  202. package/src/ui/docs/content/calendar.md +62 -0
  203. package/src/ui/docs/content/card.md +49 -0
  204. package/src/ui/docs/content/carousel.md +85 -0
  205. package/src/ui/docs/content/chat.md +69 -0
  206. package/src/ui/docs/content/checkbox.md +75 -0
  207. package/src/ui/docs/content/cli.md +58 -0
  208. package/src/ui/docs/content/collapsible.md +64 -0
  209. package/src/ui/docs/content/command.md +56 -0
  210. package/src/ui/docs/content/composer.md +50 -0
  211. package/src/ui/docs/content/confirm.md +120 -0
  212. package/src/ui/docs/content/copyable.md +30 -0
  213. package/src/ui/docs/content/customization.md +110 -0
  214. package/src/ui/docs/content/cycle.md +34 -0
  215. package/src/ui/docs/content/data-state.md +47 -0
  216. package/src/ui/docs/content/data.md +99 -0
  217. package/src/ui/docs/content/dialog.md +60 -0
  218. package/src/ui/docs/content/drawer.md +55 -0
  219. package/src/ui/docs/content/empty.md +66 -0
  220. package/src/ui/docs/content/events.md +61 -0
  221. package/src/ui/docs/content/field.md +58 -0
  222. package/src/ui/docs/content/getting-started.md +109 -0
  223. package/src/ui/docs/content/icon-picker.md +51 -0
  224. package/src/ui/docs/content/input-group.md +78 -0
  225. package/src/ui/docs/content/input-otp.md +72 -0
  226. package/src/ui/docs/content/input.md +78 -0
  227. package/src/ui/docs/content/item.md +84 -0
  228. package/src/ui/docs/content/kbd.md +62 -0
  229. package/src/ui/docs/content/label.md +32 -0
  230. package/src/ui/docs/content/log.md +55 -0
  231. package/src/ui/docs/content/markdown.md +41 -0
  232. package/src/ui/docs/content/mcp.md +44 -0
  233. package/src/ui/docs/content/menu.md +114 -0
  234. package/src/ui/docs/content/microcopy.md +83 -0
  235. package/src/ui/docs/content/page.md +34 -0
  236. package/src/ui/docs/content/pagination.md +99 -0
  237. package/src/ui/docs/content/popover.md +49 -0
  238. package/src/ui/docs/content/progress.md +69 -0
  239. package/src/ui/docs/content/queue.md +62 -0
  240. package/src/ui/docs/content/radio-group.md +77 -0
  241. package/src/ui/docs/content/resizable.md +86 -0
  242. package/src/ui/docs/content/router.md +56 -0
  243. package/src/ui/docs/content/runtime.md +77 -0
  244. package/src/ui/docs/content/scheduler.md +66 -0
  245. package/src/ui/docs/content/scroll-area.md +89 -0
  246. package/src/ui/docs/content/section-shell.md +121 -0
  247. package/src/ui/docs/content/select.md +342 -0
  248. package/src/ui/docs/content/separator.md +33 -0
  249. package/src/ui/docs/content/sidebar.md +38 -0
  250. package/src/ui/docs/content/skeleton.md +34 -0
  251. package/src/ui/docs/content/slider.md +64 -0
  252. package/src/ui/docs/content/spinner.md +37 -0
  253. package/src/ui/docs/content/split.md +33 -0
  254. package/src/ui/docs/content/storage.md +69 -0
  255. package/src/ui/docs/content/switch.md +69 -0
  256. package/src/ui/docs/content/table.md +102 -0
  257. package/src/ui/docs/content/tabs.md +94 -0
  258. package/src/ui/docs/content/testing.md +89 -0
  259. package/src/ui/docs/content/textarea.md +30 -0
  260. package/src/ui/docs/content/toast.md +67 -0
  261. package/src/ui/docs/content/toggle-group.md +81 -0
  262. package/src/ui/docs/content/toggle.md +72 -0
  263. package/src/ui/docs/content/tokens.md +171 -0
  264. package/src/ui/docs/content/tooltip.md +50 -0
  265. package/src/ui/docs/content/truncate.md +37 -0
  266. package/src/ui/docs/content/ui.md +40 -0
  267. package/src/ui/docs/content/upgrading.md +48 -0
  268. package/src/ui/docs/doc-client.tsx +214 -0
  269. package/src/ui/docs/doc.tsx +301 -0
  270. package/src/ui/docs/folder.tsx +149 -0
  271. package/src/ui/docs/index.ts +21 -0
  272. package/src/ui/docs/markdown.tsx +130 -0
  273. package/src/ui/docs/md-raw.d.ts +4 -0
  274. package/src/ui/docs/plugin.ts +104 -0
  275. package/src/ui/docs/registry.tsx +424 -0
  276. package/src/ui/docs/standalone.tsx +107 -0
  277. package/src/ui/drivers/react.tsx +627 -0
  278. package/src/ui/index.ts +92 -0
  279. package/src/ui/lib/cn.ts +10 -0
  280. package/src/ui/lib/zod-pt-br.ts +38 -0
  281. package/src/ui/meta.ts +412 -0
  282. package/src/ui/react.tsx +235 -0
  283. package/src/ui/router.ts +96 -0
  284. package/src/ui/theme.css +234 -0
  285. package/src/vite/design.ts +652 -0
  286. package/src/vite/index.ts +8 -0
@@ -0,0 +1,72 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from '../../lib/cn.ts'
4
+
5
+ export interface InputProps extends React.ComponentProps<"input"> {
6
+ /** Ícone LEADING dentro do campo (identidade — calendário na data, prédio na filial).
7
+ * É a MESMA prop do Select e do Alert: adorno de campo é prop, não composição à mão. */
8
+ icon?: React.ReactNode
9
+ /** Ação TRAILING dentro do campo, no fim — um botão que age sobre o valor (limpar,
10
+ * mostrar senha). Par do `icon`, igual ao Select. Pra addon rico (prefixo de texto,
11
+ * adorno em bloco, múltiplos), use `InputGroup`. */
12
+ trailing?: React.ReactNode
13
+ }
14
+
15
+ // O <input> CRU (sem adorno): ELE é o campo — borda, foco, ref e className moram nele.
16
+ const bareInput =
17
+ "h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40"
18
+
19
+ function Input({ className, type, icon, trailing, ...props }: InputProps) {
20
+ // Sem adorno: o <input> cru de sempre — retrocompatível (refs, forms, InputGroupInput).
21
+ if (icon === undefined && trailing === undefined) {
22
+ return <input type={type} data-slot="input" className={cn(bareInput, className)} {...props} />
23
+ }
24
+ // Adornado: o MESMO modelo flex do InputGroup/Select. A borda e o anel moram no WRAPPER
25
+ // (disparados pelo `:focus-visible` do input interno — foco de teclado); o <input> fica
26
+ // SEM borda e CRESCE (flex-1), e os adornos são IRMÃOS ao lado. Sem conta de pl-9/pr-9: o
27
+ // `px-3` + `gap` posicionam sozinhos (o trailing fica a 12px da borda, como no Select). O
28
+ // `className` estiliza o CAMPO (largura, raio, fundo, fonte), como no Select — e a fonte/
29
+ // cor cascateiam pro <input> (um `text-xs`/`font-mono` aqui alcança o texto digitado).
30
+ return (
31
+ <div
32
+ data-slot="input-wrapper"
33
+ className={cn(
34
+ "flex h-9 w-full min-w-0 items-center gap-1.5 rounded-md border border-input bg-transparent px-3 text-base transition-[color,box-shadow] outline-none md:text-sm dark:bg-input/30",
35
+ "has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-ring/50",
36
+ "has-[input[aria-invalid=true]]:border-destructive has-[input[aria-invalid=true]]:ring-destructive/20 dark:has-[input[aria-invalid=true]]:ring-destructive/40",
37
+ "has-[input:disabled]:pointer-events-none has-[input:disabled]:opacity-50",
38
+ className,
39
+ )}
40
+ >
41
+ {icon !== undefined && (
42
+ // Decorativo (identidade): aria-hidden + não recebe clique; o tom muted mora aqui.
43
+ <span
44
+ data-slot="input-leading"
45
+ aria-hidden="true"
46
+ className="pointer-events-none flex shrink-0 items-center text-muted-foreground select-none [&_svg]:size-4"
47
+ >
48
+ {icon}
49
+ </span>
50
+ )}
51
+ <input
52
+ type={type}
53
+ data-slot="input"
54
+ // Sem borda/fundo/fonte próprios: quem desenha o campo é o wrapper, e o texto HERDA
55
+ // a fonte e a cor dele (font/color cascateiam nos elementos de formulário).
56
+ className="h-full min-w-0 flex-1 border-0 bg-transparent py-1 outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed"
57
+ {...props}
58
+ />
59
+ {trailing !== undefined && (
60
+ // Interativo (AÇÃO, não decoração): sem pointer-events-none. O tom muted (ação
61
+ // secundária) mora no slot — o botão ghost herda, sem sprinklar no call site. Se o
62
+ // trailing é BOTÃO, puxa ~6px pra o inset direito casar com o vertical (botão
63
+ // quadrado no canto, não flutuando a 12px), como o InputGroup.
64
+ <span data-slot="input-trailing" className="flex shrink-0 items-center text-muted-foreground has-[button]:-mr-1.5">
65
+ {trailing}
66
+ </span>
67
+ )}
68
+ </div>
69
+ )
70
+ }
71
+
72
+ export { Input }
@@ -0,0 +1,193 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { Slot } from "radix-ui"
4
+
5
+ import { cn } from '../../lib/cn.ts'
6
+ import { Separator } from './separator.tsx'
7
+
8
+ function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
9
+ return (
10
+ <div
11
+ role="list"
12
+ data-slot="item-group"
13
+ className={cn("group/item-group flex flex-col", className)}
14
+ {...props}
15
+ />
16
+ )
17
+ }
18
+
19
+ function ItemSeparator({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<typeof Separator>) {
23
+ return (
24
+ <Separator
25
+ data-slot="item-separator"
26
+ orientation="horizontal"
27
+ className={cn("my-0", className)}
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+
33
+ const itemVariants = cva(
34
+ "group/item flex flex-wrap items-center rounded-md border border-transparent text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-accent/50",
35
+ {
36
+ variants: {
37
+ variant: {
38
+ default: "bg-transparent",
39
+ outline: "border-border",
40
+ muted: "bg-muted/50",
41
+ },
42
+ size: {
43
+ default: "gap-4 p-4",
44
+ sm: "gap-2.5 px-4 py-3",
45
+ },
46
+ },
47
+ defaultVariants: {
48
+ variant: "default",
49
+ size: "default",
50
+ },
51
+ }
52
+ )
53
+
54
+ function Item({
55
+ className,
56
+ variant = "default",
57
+ size = "default",
58
+ asChild = false,
59
+ ...props
60
+ }: React.ComponentProps<"div"> &
61
+ VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62
+ const Comp = asChild ? Slot.Root : "div"
63
+ return (
64
+ <Comp
65
+ data-slot="item"
66
+ data-variant={variant}
67
+ data-size={size}
68
+ className={cn(itemVariants({ variant, size, className }))}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ const itemMediaVariants = cva(
75
+ "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none",
76
+ {
77
+ variants: {
78
+ variant: {
79
+ default: "bg-transparent",
80
+ icon: "size-8 rounded-sm border bg-muted [&_svg:not([class*='size-'])]:size-4",
81
+ image:
82
+ "size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
83
+ },
84
+ },
85
+ defaultVariants: {
86
+ variant: "default",
87
+ },
88
+ }
89
+ )
90
+
91
+ function ItemMedia({
92
+ className,
93
+ variant = "default",
94
+ ...props
95
+ }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
96
+ return (
97
+ <div
98
+ data-slot="item-media"
99
+ data-variant={variant}
100
+ className={cn(itemMediaVariants({ variant, className }))}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
107
+ return (
108
+ <div
109
+ data-slot="item-content"
110
+ className={cn(
111
+ "flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
112
+ className
113
+ )}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
120
+ return (
121
+ <div
122
+ data-slot="item-title"
123
+ className={cn(
124
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium",
125
+ className
126
+ )}
127
+ {...props}
128
+ />
129
+ )
130
+ }
131
+
132
+ function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
133
+ return (
134
+ <p
135
+ data-slot="item-description"
136
+ className={cn(
137
+ "line-clamp-2 text-sm leading-normal font-normal text-balance text-muted-foreground",
138
+ "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
139
+ className
140
+ )}
141
+ {...props}
142
+ />
143
+ )
144
+ }
145
+
146
+ function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
147
+ return (
148
+ <div
149
+ data-slot="item-actions"
150
+ className={cn("flex items-center gap-2", className)}
151
+ {...props}
152
+ />
153
+ )
154
+ }
155
+
156
+ function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
157
+ return (
158
+ <div
159
+ data-slot="item-header"
160
+ className={cn(
161
+ "flex basis-full items-center justify-between gap-2",
162
+ className
163
+ )}
164
+ {...props}
165
+ />
166
+ )
167
+ }
168
+
169
+ function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
170
+ return (
171
+ <div
172
+ data-slot="item-footer"
173
+ className={cn(
174
+ "flex basis-full items-center justify-between gap-2",
175
+ className
176
+ )}
177
+ {...props}
178
+ />
179
+ )
180
+ }
181
+
182
+ export {
183
+ Item,
184
+ ItemMedia,
185
+ ItemContent,
186
+ ItemActions,
187
+ ItemGroup,
188
+ ItemSeparator,
189
+ ItemTitle,
190
+ ItemDescription,
191
+ ItemHeader,
192
+ ItemFooter,
193
+ }
@@ -0,0 +1,28 @@
1
+ import { cn } from '../../lib/cn.ts'
2
+
3
+ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
4
+ return (
5
+ <kbd
6
+ data-slot="kbd"
7
+ className={cn(
8
+ "pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none",
9
+ "[&_svg:not([class*='size-'])]:size-3",
10
+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <kbd
21
+ data-slot="kbd-group"
22
+ className={cn("inline-flex items-center gap-1", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Kbd, KbdGroup }
@@ -0,0 +1,22 @@
1
+ import * as React from "react"
2
+ import { Label as LabelPrimitive } from "radix-ui"
3
+
4
+ import { cn } from '../../lib/cn.ts'
5
+
6
+ function Label({
7
+ className,
8
+ ...props
9
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
10
+ return (
11
+ <LabelPrimitive.Root
12
+ data-slot="label"
13
+ className={cn(
14
+ "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",
15
+ className
16
+ )}
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ export { Label }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Markdown — o renderer da casa. UM motor só (markdown-it) pra chat, painel e doc: antes
3
+ * havia dois (um parser de regex aqui e o markdown-it nas docs), com coberturas diferentes
4
+ * — a mesma mensagem renderizava distinto dependendo de onde caía. O `markdown-it` já era
5
+ * dependência do pacote por causa da doc, então o parser à mão não economizava nada.
6
+ *
7
+ * `html: false` — tag HTML no fonte é ESCAPADA, não interpretada. É o que torna seguro
8
+ * renderizar texto vindo do usuário ou de um modelo.
9
+ *
10
+ * A tipografia é delegada ao `prose` (@tailwindcss/typography), mapeado pros tokens da casa
11
+ * no theme.css; as tags saem SEMÂNTICAS e sem classe.
12
+ */
13
+ import MarkdownIt from 'markdown-it'
14
+
15
+ /** A instância ÚNICA — a doc (`DocMarkdown`) importa esta mesma. Duas instâncias com
16
+ * opções próprias divergiriam no primeiro edge case, e "mesmo motor" viraria promessa. */
17
+ export const markdownIt = new MarkdownIt({ html: false, linkify: true })
18
+
19
+ export interface MarkdownProps {
20
+ content: string
21
+ className?: string
22
+ }
23
+
24
+ export function Markdown({ content, className }: MarkdownProps): React.ReactElement {
25
+ return (
26
+ <div
27
+ data-slot="markdown"
28
+ // O primeiro/último bloco não empurra a caixa que o contém. Isto mora AQUI porque a
29
+ // margem é do `<p>`, dentro deste wrapper: quem tentava zerar de fora (a bolha do
30
+ // chat fazia) acertava o wrapper e errava o parágrafo.
31
+ className={`prose prose-sm max-w-none [&>:first-child]:mt-0 [&>:last-child]:mb-0${className !== undefined ? ` ${className}` : ''}`}
32
+ dangerouslySetInnerHTML={{ __html: markdownIt.render(content) }}
33
+ />
34
+ )
35
+ }
@@ -0,0 +1,255 @@
1
+ import * as React from "react"
2
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
3
+ import { DropdownMenu as MenuPrimitive } from "radix-ui"
4
+
5
+ import { cn } from '../../lib/cn.ts'
6
+
7
+ function Menu({
8
+ ...props
9
+ }: React.ComponentProps<typeof MenuPrimitive.Root>) {
10
+ return <MenuPrimitive.Root data-slot="menu" {...props} />
11
+ }
12
+
13
+ function MenuPortal({
14
+ ...props
15
+ }: React.ComponentProps<typeof MenuPrimitive.Portal>) {
16
+ return (
17
+ <MenuPrimitive.Portal data-slot="menu-portal" {...props} />
18
+ )
19
+ }
20
+
21
+ function MenuTrigger({
22
+ ...props
23
+ }: React.ComponentProps<typeof MenuPrimitive.Trigger>) {
24
+ return (
25
+ <MenuPrimitive.Trigger
26
+ data-slot="menu-trigger"
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function MenuContent({
33
+ className,
34
+ sideOffset = 4,
35
+ ...props
36
+ }: React.ComponentProps<typeof MenuPrimitive.Content>) {
37
+ return (
38
+ <MenuPrimitive.Portal>
39
+ <MenuPrimitive.Content
40
+ data-slot="menu-content"
41
+ sideOffset={sideOffset}
42
+ className={cn(
43
+ "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[10rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-popover bg-popover p-1 text-popover-foreground ring-1 ring-edge shadow-popover will-change-[transform,opacity] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ </MenuPrimitive.Portal>
49
+ )
50
+ }
51
+
52
+ function MenuGroup({
53
+ ...props
54
+ }: React.ComponentProps<typeof MenuPrimitive.Group>) {
55
+ return (
56
+ <MenuPrimitive.Group data-slot="menu-group" {...props} />
57
+ )
58
+ }
59
+
60
+ function MenuItem({
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
+ }: React.ComponentProps<typeof MenuPrimitive.Item> & {
66
+ inset?: boolean
67
+ variant?: "default" | "destructive"
68
+ }) {
69
+ return (
70
+ <MenuPrimitive.Item
71
+ data-slot="menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:focus:*:[svg]:text-destructive!",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
+ }
82
+
83
+ function MenuCheckboxItem({
84
+ className,
85
+ children,
86
+ checked,
87
+ ...props
88
+ }: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {
89
+ return (
90
+ <MenuPrimitive.CheckboxItem
91
+ data-slot="menu-checkbox-item"
92
+ className={cn(
93
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
+ className
95
+ )}
96
+ checked={checked}
97
+ {...props}
98
+ >
99
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
100
+ <MenuPrimitive.ItemIndicator>
101
+ <CheckIcon className="size-4" />
102
+ </MenuPrimitive.ItemIndicator>
103
+ </span>
104
+ {children}
105
+ </MenuPrimitive.CheckboxItem>
106
+ )
107
+ }
108
+
109
+ function MenuRadioGroup({
110
+ ...props
111
+ }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {
112
+ return (
113
+ <MenuPrimitive.RadioGroup
114
+ data-slot="menu-radio-group"
115
+ {...props}
116
+ />
117
+ )
118
+ }
119
+
120
+ function MenuRadioItem({
121
+ className,
122
+ children,
123
+ ...props
124
+ }: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {
125
+ return (
126
+ <MenuPrimitive.RadioItem
127
+ data-slot="menu-radio-item"
128
+ className={cn(
129
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
+ className
131
+ )}
132
+ {...props}
133
+ >
134
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
135
+ <MenuPrimitive.ItemIndicator>
136
+ <CircleIcon className="size-2 fill-current" />
137
+ </MenuPrimitive.ItemIndicator>
138
+ </span>
139
+ {children}
140
+ </MenuPrimitive.RadioItem>
141
+ )
142
+ }
143
+
144
+ function MenuLabel({
145
+ className,
146
+ inset,
147
+ ...props
148
+ }: React.ComponentProps<typeof MenuPrimitive.Label> & {
149
+ inset?: boolean
150
+ }) {
151
+ return (
152
+ <MenuPrimitive.Label
153
+ data-slot="menu-label"
154
+ data-inset={inset}
155
+ className={cn(
156
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
157
+ className
158
+ )}
159
+ {...props}
160
+ />
161
+ )
162
+ }
163
+
164
+ function MenuSeparator({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof MenuPrimitive.Separator>) {
168
+ return (
169
+ <MenuPrimitive.Separator
170
+ data-slot="menu-separator"
171
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
172
+ {...props}
173
+ />
174
+ )
175
+ }
176
+
177
+ function MenuShortcut({
178
+ className,
179
+ ...props
180
+ }: React.ComponentProps<"span">) {
181
+ return (
182
+ <span
183
+ data-slot="menu-shortcut"
184
+ className={cn(
185
+ "ml-auto text-xs tracking-widest text-muted-foreground",
186
+ className
187
+ )}
188
+ {...props}
189
+ />
190
+ )
191
+ }
192
+
193
+ function MenuSub({
194
+ ...props
195
+ }: React.ComponentProps<typeof MenuPrimitive.Sub>) {
196
+ return <MenuPrimitive.Sub data-slot="menu-sub" {...props} />
197
+ }
198
+
199
+ function MenuSubTrigger({
200
+ className,
201
+ inset,
202
+ children,
203
+ ...props
204
+ }: React.ComponentProps<typeof MenuPrimitive.SubTrigger> & {
205
+ inset?: boolean
206
+ }) {
207
+ return (
208
+ <MenuPrimitive.SubTrigger
209
+ data-slot="menu-sub-trigger"
210
+ data-inset={inset}
211
+ className={cn(
212
+ "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
213
+ className
214
+ )}
215
+ {...props}
216
+ >
217
+ {children}
218
+ <ChevronRightIcon className="ml-auto size-4" />
219
+ </MenuPrimitive.SubTrigger>
220
+ )
221
+ }
222
+
223
+ function MenuSubContent({
224
+ className,
225
+ ...props
226
+ }: React.ComponentProps<typeof MenuPrimitive.SubContent>) {
227
+ return (
228
+ <MenuPrimitive.SubContent
229
+ data-slot="menu-sub-content"
230
+ className={cn(
231
+ "z-50 min-w-[10rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-popover bg-popover p-1 text-popover-foreground ring-1 ring-edge shadow-popover will-change-[transform,opacity] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
232
+ className
233
+ )}
234
+ {...props}
235
+ />
236
+ )
237
+ }
238
+
239
+ export {
240
+ Menu,
241
+ MenuPortal,
242
+ MenuTrigger,
243
+ MenuContent,
244
+ MenuGroup,
245
+ MenuLabel,
246
+ MenuItem,
247
+ MenuCheckboxItem,
248
+ MenuRadioGroup,
249
+ MenuRadioItem,
250
+ MenuSeparator,
251
+ MenuShortcut,
252
+ MenuSub,
253
+ MenuSubTrigger,
254
+ MenuSubContent,
255
+ }