moi-computer 0.11.0 → 0.11.1-next.1

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 (196) hide show
  1. package/client/AGENTS.md +2 -2
  2. package/client/components/ui/button.tsx +1 -53
  3. package/client/components/ui/collapsible.tsx +1 -15
  4. package/client/components/ui/dialog.tsx +1 -58
  5. package/client/components/ui/dropdown-menu.tsx +1 -254
  6. package/client/components/ui/hover-card.tsx +1 -44
  7. package/client/components/ui/input.tsx +1 -21
  8. package/client/components/ui/popover.tsx +1 -88
  9. package/client/components/ui/resizable.tsx +1 -40
  10. package/client/components/ui/skeleton.tsx +1 -13
  11. package/client/components/ui/slider.tsx +1 -70
  12. package/client/components/ui/spinner.tsx +1 -18
  13. package/client/components/ui/switch.tsx +1 -23
  14. package/client/components/ui/tabs.tsx +1 -0
  15. package/client/components/ui/textarea.tsx +1 -18
  16. package/client/components/ui/tooltip.tsx +1 -51
  17. package/client/features/chat/ChatPanel.tsx +6 -6
  18. package/client/features/chat/ChatPopup.tsx +3 -4
  19. package/client/features/chat/TurnView.tsx +5 -4
  20. package/client/features/chat/api.ts +5 -14
  21. package/client/features/chat/chat-frames.ts +5 -2
  22. package/client/features/chat/composer/ChatComposer.tsx +5 -1
  23. package/client/features/chat/composer/ModelPicker.tsx +4 -3
  24. package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
  25. package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
  26. package/client/features/chat/group-turns.ts +11 -0
  27. package/client/features/chat/session-view.ts +53 -0
  28. package/client/features/chat/useChat.ts +5 -1
  29. package/client/features/dev/ChatStatesPage.tsx +3 -1
  30. package/client/features/dev/DevIndexPage.tsx +5 -0
  31. package/client/features/dev/DevRoutes.tsx +2 -0
  32. package/client/features/dev/HarnessDebugPage.tsx +1 -1
  33. package/client/features/dev/UiComponentPreviews.tsx +834 -0
  34. package/client/features/dev/UiComponentsPage.tsx +60 -0
  35. package/client/features/home/WorkspacePreview.tsx +1 -1
  36. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  37. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  38. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  39. package/client/features/settings/SettingsLayout.tsx +1 -1
  40. package/client/features/settings/WorkspaceSettings.tsx +4 -1
  41. package/client/features/views/ViewManager.tsx +14 -9
  42. package/client/features/widgets/WidgetFrame.tsx +1 -1
  43. package/client/features/widgets/Widgets.tsx +1 -3
  44. package/client/features/workspace/WorkspaceScreen.tsx +5 -1
  45. package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
  46. package/client/features/workspace/api.ts +2 -4
  47. package/client/index.css +22 -29
  48. package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
  49. package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
  50. package/dist/chunk-6664vxpk.css +1 -0
  51. package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
  52. package/dist/chunk-a6jad1a6.js +1 -0
  53. package/dist/chunk-dghwstd2.js +9 -0
  54. package/dist/chunk-eg120aca.js +1 -0
  55. package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
  56. package/dist/chunk-vwjeezeb.js +1 -0
  57. package/dist/chunk-w482ew2c.js +546 -0
  58. package/dist/chunk-yc471zah.js +70 -0
  59. package/dist/index.html +1 -1
  60. package/lib/format.ts +49 -1
  61. package/lib/themes.ts +6 -6
  62. package/lib/types.ts +5 -7
  63. package/package.json +17 -7
  64. package/registry.json +643 -0
  65. package/server/AGENTS.md +1 -0
  66. package/server/agent.ts +1 -1
  67. package/server/api.ts +25 -29
  68. package/server/applets.ts +30 -29
  69. package/server/bundler/applet-css.ts +6 -1
  70. package/server/bundler/build-applet.ts +5 -1
  71. package/server/bundler/build-worker.ts +178 -0
  72. package/server/cli-ui-components.ts +28 -33
  73. package/server/cli.ts +6 -11
  74. package/server/data-dir.ts +1 -1
  75. package/server/harness/README.md +13 -9
  76. package/server/harness/acp/NOTES.md +426 -0
  77. package/server/harness/acp/discovery.ts +27 -30
  78. package/server/harness/acp/model-state.ts +57 -0
  79. package/server/harness/acp/session.ts +18 -6
  80. package/server/harness/claude-code/NOTES.md +47 -12
  81. package/server/harness/claude-code/cli.ts +40 -0
  82. package/server/harness/claude-code/index.ts +11 -5
  83. package/server/harness/claude-code/models.ts +72 -19
  84. package/server/harness/claude-code/session.ts +408 -299
  85. package/server/harness/hermes/NOTES.md +18 -0
  86. package/server/harness/hermes/discovery.ts +20 -0
  87. package/server/harness/hermes/index.ts +9 -0
  88. package/server/harness/hermes/models.ts +28 -8
  89. package/server/harness/types.ts +4 -2
  90. package/server/moi-scaffold.ts +1 -1
  91. package/server/preview.ts +3 -1
  92. package/server/registry.ts +63 -41
  93. package/server/scratchpad-executor.ts +79 -56
  94. package/server/scratchpad-shape-defaults.ts +82 -0
  95. package/server/tldraw-package.d.ts +4 -0
  96. package/server/ui-components.ts +101 -434
  97. package/server/view-builders.ts +2 -1
  98. package/server/web.ts +9 -5
  99. package/server/workspace-env.ts +3 -2
  100. package/tsconfig.json +0 -1
  101. package/ui-components/accordion.tsx +71 -0
  102. package/ui-components/alert-dialog.tsx +165 -0
  103. package/ui-components/alert.tsx +68 -0
  104. package/ui-components/attachment.tsx +195 -0
  105. package/ui-components/avatar.tsx +90 -0
  106. package/ui-components/badge.tsx +49 -0
  107. package/ui-components/button-group.tsx +78 -0
  108. package/ui-components/button.tsx +55 -0
  109. package/ui-components/calendar.tsx +180 -0
  110. package/ui-components/card.tsx +84 -0
  111. package/ui-components/carousel.tsx +235 -0
  112. package/ui-components/chart.tsx +338 -0
  113. package/ui-components/checkbox.tsx +27 -0
  114. package/ui-components/collapsible.tsx +15 -0
  115. package/ui-components/combobox.tsx +265 -0
  116. package/ui-components/context-menu.tsx +244 -0
  117. package/ui-components/dialog.tsx +138 -0
  118. package/ui-components/docs/accordion.md +463 -0
  119. package/ui-components/docs/alert-dialog.md +481 -0
  120. package/ui-components/docs/alert.md +301 -0
  121. package/ui-components/docs/attachment.md +689 -0
  122. package/ui-components/docs/avatar.md +495 -0
  123. package/ui-components/docs/badge.md +258 -0
  124. package/ui-components/docs/button-group.md +879 -0
  125. package/ui-components/docs/button.md +26 -0
  126. package/ui-components/docs/calendar.md +862 -0
  127. package/ui-components/docs/card.md +265 -0
  128. package/ui-components/docs/carousel.md +627 -0
  129. package/ui-components/docs/chart.md +1256 -0
  130. package/ui-components/docs/checkbox.md +477 -0
  131. package/ui-components/docs/collapsible.md +446 -0
  132. package/ui-components/docs/combobox.md +1003 -0
  133. package/ui-components/docs/context-menu.md +860 -0
  134. package/ui-components/docs/data-table.md +1580 -0
  135. package/ui-components/docs/date-picker.md +614 -0
  136. package/ui-components/docs/dialog.md +414 -0
  137. package/ui-components/docs/drawer.md +51 -0
  138. package/ui-components/docs/dropdown-menu.md +1000 -0
  139. package/ui-components/docs/field.md +1192 -0
  140. package/ui-components/docs/hover-card.md +275 -0
  141. package/ui-components/docs/input-group.md +866 -0
  142. package/ui-components/docs/input.md +456 -0
  143. package/ui-components/docs/label.md +295 -0
  144. package/ui-components/docs/pagination.md +416 -0
  145. package/ui-components/docs/popover.md +348 -0
  146. package/ui-components/docs/progress.md +214 -0
  147. package/ui-components/docs/radio-group.md +389 -0
  148. package/ui-components/docs/resizable.md +265 -0
  149. package/ui-components/docs/select.md +616 -0
  150. package/ui-components/docs/separator.md +216 -0
  151. package/ui-components/docs/skeleton.md +205 -0
  152. package/ui-components/docs/slider.md +226 -0
  153. package/ui-components/docs/spinner.md +332 -0
  154. package/ui-components/docs/switch.md +236 -0
  155. package/ui-components/docs/table.md +551 -0
  156. package/ui-components/docs/tabs.md +379 -0
  157. package/ui-components/docs/textarea.md +187 -0
  158. package/ui-components/docs/toggle-group.md +370 -0
  159. package/ui-components/docs/toggle.md +91 -0
  160. package/ui-components/docs/tooltip.md +290 -0
  161. package/ui-components/drawer.tsx +213 -0
  162. package/ui-components/dropdown-menu.tsx +263 -0
  163. package/ui-components/field.tsx +224 -0
  164. package/ui-components/hover-card.tsx +46 -0
  165. package/ui-components/input-group.tsx +146 -0
  166. package/ui-components/input.tsx +20 -0
  167. package/ui-components/label.tsx +17 -0
  168. package/ui-components/pagination.tsx +124 -0
  169. package/ui-components/popover.tsx +81 -0
  170. package/ui-components/progress.tsx +63 -0
  171. package/ui-components/radio-group.tsx +37 -0
  172. package/ui-components/resizable.tsx +40 -0
  173. package/ui-components/scoped-portal.tsx +31 -0
  174. package/ui-components/select.tsx +195 -0
  175. package/ui-components/separator.tsx +18 -0
  176. package/ui-components/skeleton.tsx +15 -0
  177. package/ui-components/slider.tsx +75 -0
  178. package/ui-components/spinner.tsx +20 -0
  179. package/ui-components/switch.tsx +26 -0
  180. package/ui-components/table.tsx +86 -0
  181. package/ui-components/tabs.tsx +75 -0
  182. package/ui-components/textarea.tsx +17 -0
  183. package/ui-components/toggle-group.tsx +85 -0
  184. package/ui-components/toggle.tsx +42 -0
  185. package/ui-components/tooltip.tsx +61 -0
  186. package/ui-components/utils.ts +8 -0
  187. package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
  188. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
  189. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  190. package/dist/chunk-59zf0m6n.js +0 -1
  191. package/dist/chunk-bj3akjs2.js +0 -1
  192. package/dist/chunk-j2w2vak4.js +0 -546
  193. package/dist/chunk-k2r9c95m.js +0 -10
  194. package/dist/chunk-kmbxhgwv.js +0 -1
  195. package/dist/chunk-p1yqa71k.js +0 -83
  196. package/dist/chunk-r5xrenjy.css +0 -1
package/server/web.ts CHANGED
@@ -6,6 +6,7 @@ import { api } from './api'
6
6
  import { PORT } from './constants'
7
7
  import { control } from './control'
8
8
  import { EVENTS_TOPIC, publishEvent, setEventServer } from './events'
9
+ import { killBuildWorkers } from './bundler/build-worker'
9
10
  import { killAllWorkers } from './functions'
10
11
  import { startScratchpadSweeper } from './scratchpad'
11
12
  import { resolveScratchOp } from './scratchpad-relay'
@@ -96,10 +97,10 @@ export const app = Bun.serve<WsData>({
96
97
 
97
98
  // Locally-vendored React ESM (offline; no CDN). The importmap in
98
99
  // client/index.html points here; the handler picks dev/prod per env.
99
- '/vendor/react/*': req => serveVendorReact(req),
100
+ '/vendor/react/*': (req: Request) => serveVendorReact(req),
100
101
 
101
102
  // Vendored emojibase-data for the settings emoji picker (offline; no CDN).
102
- '/vendor/emojibase/*': req => serveVendorEmojibase(req),
103
+ '/vendor/emojibase/*': (req: Request) => serveVendorEmojibase(req),
103
104
 
104
105
  // Client-side routes — serve the SPA shell.
105
106
  '/': shell,
@@ -109,12 +110,13 @@ export const app = Bun.serve<WsData>({
109
110
 
110
111
  // Chat websocket — app-wide (one per client, not per workspace). Each chat
111
112
  // frame carries its own workspaceId.
112
- '/ws': (req, server) => upgrade(server, req, { channel: 'chat', workspaceId: '' }),
113
+ '/ws': (req: Request, server: Bun.Server<WsData>) =>
114
+ upgrade(server, req, { channel: 'chat', workspaceId: '' }),
113
115
 
114
116
  // Live widget-event stream (build/refresh pushes). A static path, so Bun
115
117
  // routes it ahead of the Hono-served `/api/workspaces/:id`; the upgrade
116
118
  // happens in-handler via the route's `server` argument.
117
- '/api/workspaces/ws': (req, server) =>
119
+ '/api/workspaces/ws': (req: Request, server: Bun.Server<WsData>) =>
118
120
  upgrade(server, req, { channel: 'events', workspaceId: '' })
119
121
  },
120
122
  // Anything not matched above (the whole HTTP API + prod static assets + 404)
@@ -215,7 +217,8 @@ startServiceLogMaintenance()
215
217
 
216
218
  // Graceful shutdown. In dev the supervisor sends SIGTERM on server-file
217
219
  // changes; in any context Ctrl-C sends SIGINT. Close both servers and kill the
218
- // per-workspace function workers so no child processes are orphaned.
220
+ // per-workspace function workers and any in-flight applet build child so no
221
+ // child processes are orphaned.
219
222
  function shutdown() {
220
223
  try {
221
224
  app.stop(true)
@@ -225,6 +228,7 @@ function shutdown() {
225
228
  } catch {}
226
229
  for (const h of allHarnesses()) h.shutdown?.()
227
230
  killAllWorkers()
231
+ killBuildWorkers()
228
232
  process.exit()
229
233
  }
230
234
  process.on('SIGTERM', shutdown)
@@ -18,7 +18,7 @@ import { chmod, mkdir, rename } from 'node:fs/promises'
18
18
  import { dirname, join, resolve } from 'node:path'
19
19
  import { parseEnv } from 'node:util'
20
20
 
21
- import type { WorkspaceEnvView } from '@/lib/types'
21
+ import type { WorkspaceEnvVar, WorkspaceEnvView } from '@/lib/types'
22
22
 
23
23
  import { DATA_DIR } from './data-dir'
24
24
 
@@ -373,7 +373,8 @@ export async function getWorkspaceEnvView(
373
373
  const vars = [...keys].sort().map(key => {
374
374
  const inCustom = key in secrets
375
375
  const fromDotenv = key in dotenv
376
- const source = inCustom && fromDotenv ? 'both' : inCustom ? 'custom' : 'dotenv'
376
+ const source: WorkspaceEnvVar['source'] =
377
+ inCustom && fromDotenv ? 'both' : inCustom ? 'custom' : 'dotenv'
377
378
  return {
378
379
  key,
379
380
  source,
package/tsconfig.json CHANGED
@@ -11,7 +11,6 @@
11
11
  "resolveJsonModule": true,
12
12
  "isolatedModules": true,
13
13
  "noEmit": true,
14
- "baseUrl": ".",
15
14
  "paths": {
16
15
  "@/*": ["./*"]
17
16
  }
@@ -0,0 +1,71 @@
1
+ import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion'
2
+ import { cn } from './utils'
3
+ import { IconChevronDown, IconChevronUp } from '@tabler/icons-react'
4
+
5
+ function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) {
6
+ return (
7
+ <AccordionPrimitive.Root
8
+ data-slot="accordion"
9
+ className={cn('flex w-full flex-col', className)}
10
+ {...props}
11
+ />
12
+ )
13
+ }
14
+
15
+ function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {
16
+ return (
17
+ <AccordionPrimitive.Item
18
+ data-slot="accordion-item"
19
+ className={cn('not-last:border-b', className)}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ function AccordionTrigger({ className, children, ...props }: AccordionPrimitive.Trigger.Props) {
26
+ return (
27
+ <AccordionPrimitive.Header className="flex">
28
+ <AccordionPrimitive.Trigger
29
+ data-slot="accordion-trigger"
30
+ className={cn(
31
+ 'group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground',
32
+ className
33
+ )}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <IconChevronDown
38
+ stroke={1.75}
39
+ data-slot="accordion-trigger-icon"
40
+ className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
41
+ />
42
+ <IconChevronUp
43
+ stroke={1.75}
44
+ data-slot="accordion-trigger-icon"
45
+ className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
46
+ />
47
+ </AccordionPrimitive.Trigger>
48
+ </AccordionPrimitive.Header>
49
+ )
50
+ }
51
+
52
+ function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props) {
53
+ return (
54
+ <AccordionPrimitive.Panel
55
+ data-slot="accordion-content"
56
+ className="overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
57
+ {...props}
58
+ >
59
+ <div
60
+ className={cn(
61
+ 'h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',
62
+ className
63
+ )}
64
+ >
65
+ {children}
66
+ </div>
67
+ </AccordionPrimitive.Panel>
68
+ )
69
+ }
70
+
71
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -0,0 +1,165 @@
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'
5
+ import { cn } from './utils'
6
+
7
+ import { Button } from './button'
8
+ import { ScopedPortal } from './scoped-portal'
9
+
10
+ function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) {
11
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
12
+ }
13
+
14
+ function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) {
15
+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
16
+ }
17
+
18
+ function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) {
19
+ return (
20
+ <ScopedPortal portal={AlertDialogPrimitive.Portal} data-slot="alert-dialog-portal" {...props} />
21
+ )
22
+ }
23
+
24
+ function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) {
25
+ return (
26
+ <AlertDialogPrimitive.Backdrop
27
+ data-slot="alert-dialog-overlay"
28
+ className={cn(
29
+ 'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
30
+ className
31
+ )}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function AlertDialogContent({
38
+ className,
39
+ size = 'default',
40
+ ...props
41
+ }: AlertDialogPrimitive.Popup.Props & {
42
+ size?: 'default' | 'sm'
43
+ }) {
44
+ return (
45
+ <AlertDialogPortal>
46
+ <AlertDialogOverlay />
47
+ <AlertDialogPrimitive.Popup
48
+ data-slot="alert-dialog-content"
49
+ data-size={size}
50
+ className={cn(
51
+ 'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-sm text-popover-foreground shadow-xl duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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',
52
+ className
53
+ )}
54
+ {...props}
55
+ />
56
+ </AlertDialogPortal>
57
+ )
58
+ }
59
+
60
+ function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
61
+ return (
62
+ <div
63
+ data-slot="alert-dialog-header"
64
+ className={cn(
65
+ 'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ )
71
+ }
72
+
73
+ function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
74
+ return (
75
+ <div
76
+ data-slot="alert-dialog-footer"
77
+ className={cn(
78
+ '-mx-6 -mb-6 flex flex-col-reverse gap-2 rounded-b-xl p-6 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ )
84
+ }
85
+
86
+ function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>) {
87
+ return (
88
+ <div
89
+ data-slot="alert-dialog-media"
90
+ className={cn(
91
+ "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ )
97
+ }
98
+
99
+ function AlertDialogTitle({
100
+ className,
101
+ ...props
102
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
103
+ return (
104
+ <AlertDialogPrimitive.Title
105
+ data-slot="alert-dialog-title"
106
+ className={cn(
107
+ 'text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',
108
+ className
109
+ )}
110
+ {...props}
111
+ />
112
+ )
113
+ }
114
+
115
+ function AlertDialogDescription({
116
+ className,
117
+ ...props
118
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
119
+ return (
120
+ <AlertDialogPrimitive.Description
121
+ data-slot="alert-dialog-description"
122
+ className={cn(
123
+ 'text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
124
+ className
125
+ )}
126
+ {...props}
127
+ />
128
+ )
129
+ }
130
+
131
+ function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof Button>) {
132
+ return <Button data-slot="alert-dialog-action" className={cn(className)} {...props} />
133
+ }
134
+
135
+ function AlertDialogCancel({
136
+ className,
137
+ variant = 'outline',
138
+ size = 'default',
139
+ ...props
140
+ }: AlertDialogPrimitive.Close.Props &
141
+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {
142
+ return (
143
+ <AlertDialogPrimitive.Close
144
+ data-slot="alert-dialog-cancel"
145
+ className={cn(className)}
146
+ render={<Button variant={variant} size={size} />}
147
+ {...props}
148
+ />
149
+ )
150
+ }
151
+
152
+ export {
153
+ AlertDialog,
154
+ AlertDialogAction,
155
+ AlertDialogCancel,
156
+ AlertDialogContent,
157
+ AlertDialogDescription,
158
+ AlertDialogFooter,
159
+ AlertDialogHeader,
160
+ AlertDialogMedia,
161
+ AlertDialogOverlay,
162
+ AlertDialogPortal,
163
+ AlertDialogTitle,
164
+ AlertDialogTrigger
165
+ }
@@ -0,0 +1,68 @@
1
+ import * as React from 'react'
2
+ import { cva, type VariantProps } from 'class-variance-authority'
3
+ import { cn } from './utils'
4
+
5
+ const alertVariants = cva(
6
+ "group/alert relative grid w-full gap-0.5 rounded-lg px-2.5 py-2 text-left text-sm ring-1 ring-border has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: 'bg-card text-card-foreground',
11
+ destructive:
12
+ 'bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current'
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ variant: 'default'
17
+ }
18
+ }
19
+ )
20
+
21
+ function Alert({
22
+ className,
23
+ variant,
24
+ ...props
25
+ }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
26
+ return (
27
+ <div
28
+ data-slot="alert"
29
+ role="alert"
30
+ className={cn(alertVariants({ variant }), className)}
31
+ {...props}
32
+ />
33
+ )
34
+ }
35
+
36
+ function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
37
+ return (
38
+ <div
39
+ data-slot="alert-title"
40
+ className={cn(
41
+ 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',
42
+ className
43
+ )}
44
+ {...props}
45
+ />
46
+ )
47
+ }
48
+
49
+ function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
50
+ return (
51
+ <div
52
+ data-slot="alert-description"
53
+ className={cn(
54
+ 'text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ )
60
+ }
61
+
62
+ function AlertAction({ className, ...props }: React.ComponentProps<'div'>) {
63
+ return (
64
+ <div data-slot="alert-action" className={cn('absolute top-2 right-2', className)} {...props} />
65
+ )
66
+ }
67
+
68
+ export { Alert, AlertTitle, AlertDescription, AlertAction }
@@ -0,0 +1,195 @@
1
+ import * as React from 'react'
2
+ import { mergeProps } from '@base-ui/react/merge-props'
3
+ import { useRender } from '@base-ui/react/use-render'
4
+ import { cva, type VariantProps } from 'class-variance-authority'
5
+ import { cn } from './utils'
6
+
7
+ import { Button } from './button'
8
+
9
+ const attachmentVariants = cva(
10
+ 'group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed',
11
+ {
12
+ variants: {
13
+ size: {
14
+ default:
15
+ 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',
16
+ sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',
17
+ xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1'
18
+ },
19
+ orientation: {
20
+ horizontal: 'min-w-40 items-center',
21
+ vertical: 'w-24 flex-col has-data-[slot=attachment-content]:w-30'
22
+ }
23
+ }
24
+ }
25
+ )
26
+
27
+ function Attachment({
28
+ className,
29
+ state = 'done',
30
+ size = 'default',
31
+ orientation = 'horizontal',
32
+ ...props
33
+ }: React.ComponentProps<'div'> &
34
+ VariantProps<typeof attachmentVariants> & {
35
+ state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done'
36
+ }) {
37
+ return (
38
+ <div
39
+ data-slot="attachment"
40
+ data-state={state}
41
+ data-size={size}
42
+ data-orientation={orientation}
43
+ className={cn(attachmentVariants({ size, orientation }), className)}
44
+ {...props}
45
+ />
46
+ )
47
+ }
48
+
49
+ const attachmentMediaVariants = cva(
50
+ "relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",
51
+ {
52
+ variants: {
53
+ variant: {
54
+ icon: '',
55
+ image:
56
+ 'opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover'
57
+ }
58
+ },
59
+ defaultVariants: {
60
+ variant: 'icon'
61
+ }
62
+ }
63
+ )
64
+
65
+ function AttachmentMedia({
66
+ className,
67
+ variant = 'icon',
68
+ ...props
69
+ }: React.ComponentProps<'div'> & VariantProps<typeof attachmentMediaVariants>) {
70
+ return (
71
+ <div
72
+ data-slot="attachment-media"
73
+ data-variant={variant}
74
+ className={cn(attachmentMediaVariants({ variant }), className)}
75
+ {...props}
76
+ />
77
+ )
78
+ }
79
+
80
+ function AttachmentContent({ className, ...props }: React.ComponentProps<'div'>) {
81
+ return (
82
+ <div
83
+ data-slot="attachment-content"
84
+ className={cn(
85
+ 'max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1',
86
+ className
87
+ )}
88
+ {...props}
89
+ />
90
+ )
91
+ }
92
+
93
+ function AttachmentTitle({ className, ...props }: React.ComponentProps<'span'>) {
94
+ return (
95
+ <span
96
+ data-slot="attachment-title"
97
+ className={cn(
98
+ 'block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer',
99
+ className
100
+ )}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function AttachmentDescription({ className, ...props }: React.ComponentProps<'span'>) {
107
+ return (
108
+ <span
109
+ data-slot="attachment-description"
110
+ className={cn(
111
+ 'mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80',
112
+ 'max-w-full',
113
+ className
114
+ )}
115
+ {...props}
116
+ />
117
+ )
118
+ }
119
+
120
+ function AttachmentActions({ className, ...props }: React.ComponentProps<'div'>) {
121
+ return (
122
+ <div
123
+ data-slot="attachment-actions"
124
+ className={cn(
125
+ 'relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1',
126
+ className
127
+ )}
128
+ {...props}
129
+ />
130
+ )
131
+ }
132
+
133
+ function AttachmentAction({
134
+ className,
135
+ variant,
136
+ size = 'icon-xs',
137
+ ...props
138
+ }: React.ComponentProps<typeof Button>) {
139
+ return (
140
+ <Button
141
+ data-slot="attachment-action"
142
+ variant={variant ?? 'ghost'}
143
+ size={size}
144
+ className={cn(className)}
145
+ {...props}
146
+ />
147
+ )
148
+ }
149
+
150
+ function AttachmentTrigger({
151
+ className,
152
+ render,
153
+ type,
154
+ ...props
155
+ }: useRender.ComponentProps<'button'>) {
156
+ return useRender({
157
+ defaultTagName: 'button',
158
+ props: mergeProps<'button'>(
159
+ {
160
+ type: render ? type : (type ?? 'button'),
161
+ className: cn('absolute inset-0 z-10 outline-none', className)
162
+ },
163
+ props
164
+ ),
165
+ render,
166
+ state: {
167
+ slot: 'attachment-trigger'
168
+ }
169
+ })
170
+ }
171
+
172
+ function AttachmentGroup({ className, ...props }: React.ComponentProps<'div'>) {
173
+ return (
174
+ <div
175
+ data-slot="attachment-group"
176
+ className={cn(
177
+ 'flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start',
178
+ className
179
+ )}
180
+ {...props}
181
+ />
182
+ )
183
+ }
184
+
185
+ export {
186
+ Attachment,
187
+ AttachmentGroup,
188
+ AttachmentMedia,
189
+ AttachmentContent,
190
+ AttachmentTitle,
191
+ AttachmentDescription,
192
+ AttachmentActions,
193
+ AttachmentAction,
194
+ AttachmentTrigger
195
+ }
@@ -0,0 +1,90 @@
1
+ import * as React from 'react'
2
+ import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar'
3
+ import { cn } from './utils'
4
+
5
+ function Avatar({
6
+ className,
7
+ size = 'default',
8
+ ...props
9
+ }: AvatarPrimitive.Root.Props & {
10
+ size?: 'default' | 'sm' | 'lg'
11
+ }) {
12
+ return (
13
+ <AvatarPrimitive.Root
14
+ data-slot="avatar"
15
+ data-size={size}
16
+ className={cn(
17
+ 'group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten',
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
26
+ return (
27
+ <AvatarPrimitive.Image
28
+ data-slot="avatar-image"
29
+ className={cn('aspect-square size-full rounded-full object-cover', className)}
30
+ {...props}
31
+ />
32
+ )
33
+ }
34
+
35
+ function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
36
+ return (
37
+ <AvatarPrimitive.Fallback
38
+ data-slot="avatar-fallback"
39
+ className={cn(
40
+ 'flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs',
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ )
46
+ }
47
+
48
+ function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
49
+ return (
50
+ <span
51
+ data-slot="avatar-badge"
52
+ className={cn(
53
+ 'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none',
54
+ 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
55
+ 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
56
+ 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
63
+
64
+ function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) {
65
+ return (
66
+ <div
67
+ data-slot="avatar-group"
68
+ className={cn(
69
+ 'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
70
+ className
71
+ )}
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) {
78
+ return (
79
+ <div
80
+ data-slot="avatar-group-count"
81
+ className={cn(
82
+ 'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3',
83
+ className
84
+ )}
85
+ {...props}
86
+ />
87
+ )
88
+ }
89
+
90
+ export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge }