@townco/ui 0.1.6 → 0.1.8

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 (255) hide show
  1. package/README.md +11 -11
  2. package/dist/core/hooks/index.d.ts +1 -0
  3. package/dist/core/hooks/index.js +1 -0
  4. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  5. package/dist/core/hooks/use-chat-input.js +55 -64
  6. package/dist/core/hooks/use-chat-messages.d.ts +11 -11
  7. package/dist/core/hooks/use-chat-messages.js +114 -121
  8. package/dist/core/hooks/use-chat-session.d.ts +5 -5
  9. package/dist/core/hooks/use-chat-session.js +80 -78
  10. package/dist/core/hooks/use-media-query.d.ts +5 -5
  11. package/dist/core/hooks/use-media-query.js +42 -38
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.js +1 -1
  14. package/dist/core/schemas/chat.d.ts +56 -83
  15. package/dist/core/schemas/chat.js +25 -27
  16. package/dist/core/store/chat-store.d.ts +22 -28
  17. package/dist/core/store/chat-store.js +50 -59
  18. package/dist/gui/components/Button.d.ts +7 -23
  19. package/dist/gui/components/Button.js +27 -40
  20. package/dist/gui/components/Card.d.ts +7 -26
  21. package/dist/gui/components/Card.js +8 -54
  22. package/dist/gui/components/ChatHeader.d.ts +31 -58
  23. package/dist/gui/components/ChatHeader.js +68 -171
  24. package/dist/gui/components/ChatInput.d.ts +54 -58
  25. package/dist/gui/components/ChatInput.js +207 -194
  26. package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
  27. package/dist/gui/components/ChatInputCommandMenu.js +62 -0
  28. package/dist/gui/components/ChatLayout.d.ts +41 -71
  29. package/dist/gui/components/ChatLayout.js +87 -214
  30. package/dist/gui/components/ChatPanelTabContent.d.ts +9 -18
  31. package/dist/gui/components/ChatPanelTabContent.js +10 -88
  32. package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
  33. package/dist/gui/components/ChatSecondaryPanel.js +38 -115
  34. package/dist/gui/components/ChatSidebar.d.ts +13 -26
  35. package/dist/gui/components/ChatSidebar.js +14 -48
  36. package/dist/gui/components/ChatStatus.d.ts +2 -4
  37. package/dist/gui/components/ChatStatus.js +34 -45
  38. package/dist/gui/components/Conversation.d.ts +14 -17
  39. package/dist/gui/components/Conversation.js +83 -143
  40. package/dist/gui/components/Dialog.d.ts +11 -57
  41. package/dist/gui/components/Dialog.js +8 -84
  42. package/dist/gui/components/DropdownMenu.d.ts +20 -101
  43. package/dist/gui/components/DropdownMenu.js +14 -161
  44. package/dist/gui/components/HeightTransition.d.ts +7 -12
  45. package/dist/gui/components/HeightTransition.js +77 -88
  46. package/dist/gui/components/Input.d.ts +6 -13
  47. package/dist/gui/components/Input.js +16 -27
  48. package/dist/gui/components/Label.d.ts +1 -7
  49. package/dist/gui/components/Label.js +2 -12
  50. package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
  51. package/dist/gui/components/MarkdownRenderer.js +81 -178
  52. package/dist/gui/components/Message.d.ts +22 -25
  53. package/dist/gui/components/Message.js +97 -44
  54. package/dist/gui/components/MessageContent.d.ts +22 -29
  55. package/dist/gui/components/MessageContent.js +85 -157
  56. package/dist/gui/components/Reasoning.d.ts +24 -30
  57. package/dist/gui/components/Reasoning.js +60 -187
  58. package/dist/gui/components/Response.d.ts +9 -11
  59. package/dist/gui/components/Response.js +90 -229
  60. package/dist/gui/components/Select.d.ts +10 -69
  61. package/dist/gui/components/Select.js +12 -118
  62. package/dist/gui/components/Sonner.d.ts +1 -3
  63. package/dist/gui/components/Sonner.js +18 -29
  64. package/dist/gui/components/Tabs.d.ts +4 -24
  65. package/dist/gui/components/Tabs.js +4 -32
  66. package/dist/gui/components/Task.d.ts +24 -28
  67. package/dist/gui/components/Task.js +31 -164
  68. package/dist/gui/components/Textarea.d.ts +7 -15
  69. package/dist/gui/components/Textarea.js +46 -63
  70. package/dist/gui/components/ThinkingBlock.d.ts +10 -20
  71. package/dist/gui/components/ThinkingBlock.js +35 -134
  72. package/dist/gui/components/TodoList.d.ts +10 -12
  73. package/dist/gui/components/TodoList.js +7 -22
  74. package/dist/gui/components/TodoListItem.d.ts +6 -9
  75. package/dist/gui/components/TodoListItem.js +4 -18
  76. package/dist/gui/components/index.d.ts +16 -59
  77. package/dist/gui/components/index.js +18 -42
  78. package/dist/gui/lib/utils.js +1 -1
  79. package/dist/index.d.ts +1 -1
  80. package/dist/index.js +1 -1
  81. package/dist/index.test.js +1 -0
  82. package/dist/sdk/client/acp-client.d.ts +76 -88
  83. package/dist/sdk/client/acp-client.js +217 -215
  84. package/dist/sdk/index.d.ts +1 -1
  85. package/dist/sdk/index.js +1 -1
  86. package/dist/sdk/schemas/agent.d.ts +64 -111
  87. package/dist/sdk/schemas/agent.js +24 -24
  88. package/dist/sdk/schemas/message.d.ts +147 -245
  89. package/dist/sdk/schemas/message.js +40 -40
  90. package/dist/sdk/schemas/session.d.ts +135 -219
  91. package/dist/sdk/schemas/session.js +27 -27
  92. package/dist/sdk/transports/http.d.ts +55 -55
  93. package/dist/sdk/transports/http.js +469 -472
  94. package/dist/sdk/transports/stdio.d.ts +20 -20
  95. package/dist/sdk/transports/stdio.js +286 -289
  96. package/dist/sdk/transports/types.d.ts +42 -42
  97. package/dist/sdk/transports/websocket.d.ts +12 -12
  98. package/dist/sdk/transports/websocket.js +46 -52
  99. package/dist/tui/components/ChatView.d.ts +2 -4
  100. package/dist/tui/components/ChatView.js +18 -51
  101. package/dist/tui/components/GameOfLife.js +35 -64
  102. package/dist/tui/components/InputBox.d.ts +11 -18
  103. package/dist/tui/components/InputBox.js +10 -70
  104. package/dist/tui/components/MessageList.d.ts +2 -4
  105. package/dist/tui/components/MessageList.js +10 -37
  106. package/dist/tui/components/MultiSelect.d.ts +10 -15
  107. package/dist/tui/components/MultiSelect.js +73 -116
  108. package/dist/tui/components/ReadlineInput.d.ts +6 -12
  109. package/dist/tui/components/ReadlineInput.js +237 -252
  110. package/dist/tui/components/SingleSelect.d.ts +9 -15
  111. package/dist/tui/components/SingleSelect.js +43 -84
  112. package/dist/tui/components/StatusBar.d.ts +6 -11
  113. package/dist/tui/components/StatusBar.js +67 -102
  114. package/dist/tui/index.d.ts +1 -1
  115. package/dist/tui/index.js +1 -1
  116. package/package.json +6 -4
  117. package/src/styles/global.css +2 -0
  118. package/dist/core/hooks/index.d.ts.map +0 -1
  119. package/dist/core/hooks/index.js.map +0 -1
  120. package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
  121. package/dist/core/hooks/use-chat-input.js.map +0 -1
  122. package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
  123. package/dist/core/hooks/use-chat-messages.js.map +0 -1
  124. package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
  125. package/dist/core/hooks/use-chat-session.js.map +0 -1
  126. package/dist/core/index.d.ts.map +0 -1
  127. package/dist/core/index.js.map +0 -1
  128. package/dist/core/schemas/chat.d.ts.map +0 -1
  129. package/dist/core/schemas/chat.js.map +0 -1
  130. package/dist/core/schemas/index.d.ts.map +0 -1
  131. package/dist/core/schemas/index.js.map +0 -1
  132. package/dist/core/store/chat-store.d.ts.map +0 -1
  133. package/dist/core/store/chat-store.js.map +0 -1
  134. package/dist/gui/components/Button.d.ts.map +0 -1
  135. package/dist/gui/components/Button.js.map +0 -1
  136. package/dist/gui/components/Card.d.ts.map +0 -1
  137. package/dist/gui/components/Card.js.map +0 -1
  138. package/dist/gui/components/ChatInput.d.ts.map +0 -1
  139. package/dist/gui/components/ChatInput.js.map +0 -1
  140. package/dist/gui/components/ChatInterface.d.ts +0 -12
  141. package/dist/gui/components/ChatInterface.d.ts.map +0 -1
  142. package/dist/gui/components/ChatInterface.js +0 -204
  143. package/dist/gui/components/ChatInterface.js.map +0 -1
  144. package/dist/gui/components/ChatPreview.d.ts +0 -12
  145. package/dist/gui/components/ChatPreview.d.ts.map +0 -1
  146. package/dist/gui/components/ChatPreview.js +0 -214
  147. package/dist/gui/components/ChatPreview.js.map +0 -1
  148. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
  149. package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
  150. package/dist/gui/components/ChatStatus.d.ts.map +0 -1
  151. package/dist/gui/components/ChatStatus.js.map +0 -1
  152. package/dist/gui/components/ChatView.d.ts +0 -8
  153. package/dist/gui/components/ChatView.d.ts.map +0 -1
  154. package/dist/gui/components/ChatView.js +0 -42
  155. package/dist/gui/components/ChatView.js.map +0 -1
  156. package/dist/gui/components/ConfigPanel.d.ts +0 -20
  157. package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
  158. package/dist/gui/components/ConfigPanel.js +0 -225
  159. package/dist/gui/components/ConfigPanel.js.map +0 -1
  160. package/dist/gui/components/Conversation.d.ts.map +0 -1
  161. package/dist/gui/components/Conversation.js.map +0 -1
  162. package/dist/gui/components/Dialog.d.ts.map +0 -1
  163. package/dist/gui/components/Dialog.js.map +0 -1
  164. package/dist/gui/components/HeightTransition.d.ts.map +0 -1
  165. package/dist/gui/components/HeightTransition.js.map +0 -1
  166. package/dist/gui/components/Input.d.ts.map +0 -1
  167. package/dist/gui/components/Input.js.map +0 -1
  168. package/dist/gui/components/InputBox.d.ts +0 -21
  169. package/dist/gui/components/InputBox.d.ts.map +0 -1
  170. package/dist/gui/components/InputBox.js +0 -90
  171. package/dist/gui/components/InputBox.js.map +0 -1
  172. package/dist/gui/components/Label.d.ts.map +0 -1
  173. package/dist/gui/components/Label.js.map +0 -1
  174. package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
  175. package/dist/gui/components/MarkdownRenderer.js.map +0 -1
  176. package/dist/gui/components/Message.d.ts.map +0 -1
  177. package/dist/gui/components/Message.js.map +0 -1
  178. package/dist/gui/components/MessageContent.d.ts.map +0 -1
  179. package/dist/gui/components/MessageContent.js.map +0 -1
  180. package/dist/gui/components/MessageList.d.ts.map +0 -1
  181. package/dist/gui/components/MessageList.js.map +0 -1
  182. package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
  183. package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
  184. package/dist/gui/components/PlaygroundLayout.js +0 -49
  185. package/dist/gui/components/PlaygroundLayout.js.map +0 -1
  186. package/dist/gui/components/Reasoning.d.ts.map +0 -1
  187. package/dist/gui/components/Reasoning.js.map +0 -1
  188. package/dist/gui/components/Response.d.ts.map +0 -1
  189. package/dist/gui/components/Response.js.map +0 -1
  190. package/dist/gui/components/Select.d.ts.map +0 -1
  191. package/dist/gui/components/Select.js.map +0 -1
  192. package/dist/gui/components/StatusBar.d.ts +0 -12
  193. package/dist/gui/components/StatusBar.d.ts.map +0 -1
  194. package/dist/gui/components/StatusBar.js +0 -58
  195. package/dist/gui/components/StatusBar.js.map +0 -1
  196. package/dist/gui/components/Tabs.d.ts.map +0 -1
  197. package/dist/gui/components/Tabs.js.map +0 -1
  198. package/dist/gui/components/Task.d.ts.map +0 -1
  199. package/dist/gui/components/Task.js.map +0 -1
  200. package/dist/gui/components/Textarea.d.ts.map +0 -1
  201. package/dist/gui/components/Textarea.js.map +0 -1
  202. package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
  203. package/dist/gui/components/ThinkingBlock.js.map +0 -1
  204. package/dist/gui/components/TodoList.d.ts.map +0 -1
  205. package/dist/gui/components/TodoList.js.map +0 -1
  206. package/dist/gui/components/TodoListItem.d.ts.map +0 -1
  207. package/dist/gui/components/TodoListItem.js.map +0 -1
  208. package/dist/gui/components/index.d.ts.map +0 -1
  209. package/dist/gui/components/index.js.map +0 -1
  210. package/dist/gui/index.d.ts.map +0 -1
  211. package/dist/gui/index.js.map +0 -1
  212. package/dist/gui/lib/utils.d.ts.map +0 -1
  213. package/dist/gui/lib/utils.js.map +0 -1
  214. package/dist/index.d.ts.map +0 -1
  215. package/dist/index.js.map +0 -1
  216. package/dist/sdk/client/acp-client.d.ts.map +0 -1
  217. package/dist/sdk/client/acp-client.js.map +0 -1
  218. package/dist/sdk/client/index.d.ts.map +0 -1
  219. package/dist/sdk/client/index.js.map +0 -1
  220. package/dist/sdk/index.d.ts.map +0 -1
  221. package/dist/sdk/index.js.map +0 -1
  222. package/dist/sdk/schemas/agent.d.ts.map +0 -1
  223. package/dist/sdk/schemas/agent.js.map +0 -1
  224. package/dist/sdk/schemas/index.d.ts.map +0 -1
  225. package/dist/sdk/schemas/index.js.map +0 -1
  226. package/dist/sdk/schemas/message.d.ts.map +0 -1
  227. package/dist/sdk/schemas/message.js.map +0 -1
  228. package/dist/sdk/schemas/session.d.ts.map +0 -1
  229. package/dist/sdk/schemas/session.js.map +0 -1
  230. package/dist/sdk/transports/http.d.ts.map +0 -1
  231. package/dist/sdk/transports/http.js.map +0 -1
  232. package/dist/sdk/transports/index.d.ts.map +0 -1
  233. package/dist/sdk/transports/index.js.map +0 -1
  234. package/dist/sdk/transports/stdio.d.ts.map +0 -1
  235. package/dist/sdk/transports/stdio.js.map +0 -1
  236. package/dist/sdk/transports/types.d.ts.map +0 -1
  237. package/dist/sdk/transports/types.js.map +0 -1
  238. package/dist/sdk/transports/websocket.d.ts.map +0 -1
  239. package/dist/sdk/transports/websocket.js.map +0 -1
  240. package/dist/tui/components/ChatView.d.ts.map +0 -1
  241. package/dist/tui/components/ChatView.js.map +0 -1
  242. package/dist/tui/components/GameOfLife.d.ts.map +0 -1
  243. package/dist/tui/components/GameOfLife.js.map +0 -1
  244. package/dist/tui/components/InputBox.d.ts.map +0 -1
  245. package/dist/tui/components/InputBox.js.map +0 -1
  246. package/dist/tui/components/MessageList.d.ts.map +0 -1
  247. package/dist/tui/components/MessageList.js.map +0 -1
  248. package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
  249. package/dist/tui/components/ReadlineInput.js.map +0 -1
  250. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  251. package/dist/tui/components/StatusBar.js.map +0 -1
  252. package/dist/tui/components/index.d.ts.map +0 -1
  253. package/dist/tui/components/index.js.map +0 -1
  254. package/dist/tui/index.d.ts.map +0 -1
  255. package/dist/tui/index.js.map +0 -1
@@ -1,91 +1,80 @@
1
- import { useCallback, useEffect, useRef } from "react";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef } from "react";
3
3
  import { cn } from "../lib/utils.js";
4
- export function HeightTransition({
5
- children,
6
- durationMs = 320,
7
- easing = "ease",
8
- pinContentTo = "top",
9
- className,
10
- }) {
11
- const containerRef = useRef(null);
12
- const contentRef = useRef(null);
13
- const prevHeightRef = useRef(null);
14
- const isAnimatingRef = useRef(false);
15
- const durationRef = useRef(durationMs);
16
- const easingRef = useRef(easing);
17
- useEffect(() => {
18
- durationRef.current = durationMs;
19
- easingRef.current = easing;
20
- }, [durationMs, easing]);
21
- const transitionTo = useCallback(
22
- (next) => {
23
- const el = containerRef.current;
24
- const contentEl = contentRef.current;
25
- if (!el || !contentEl) return;
26
- const prev = prevHeightRef.current ?? el.getBoundingClientRect().height;
27
- if (Math.abs(prev - next) < 0.5) {
28
- prevHeightRef.current = next;
29
- el.style.height = `${next}px`;
30
- return;
31
- }
32
- if (isAnimatingRef.current) return;
33
- isAnimatingRef.current = true;
34
- el.style.transition = "none";
35
- el.style.height = `${prev}px`;
36
- void el.getBoundingClientRect();
37
- el.style.transition = `height ${durationRef.current}ms ${easingRef.current}`;
38
- el.style.height = `${next}px`;
39
- contentEl.style.position = "absolute";
40
- if (pinContentTo === "top") {
41
- contentEl.style.top = "0";
42
- } else {
43
- contentEl.style.bottom = "0";
44
- }
45
- prevHeightRef.current = next;
46
- },
47
- [pinContentTo],
48
- );
49
- const onEndTransition = useCallback((e) => {
50
- const el = containerRef.current;
51
- const contentEl = contentRef.current;
52
- if (!el || !contentEl) return;
53
- if (e.propertyName !== "height") return;
54
- if (e.target !== el) return;
55
- el.style.transition = "";
56
- el.style.height = `auto`;
57
- contentEl.style.removeProperty("position");
58
- contentEl.style.removeProperty("top");
59
- contentEl.style.removeProperty("bottom");
60
- isAnimatingRef.current = false;
61
- }, []);
62
- // Observe intrinsic content height changes and animate container height accordingly
63
- useEffect(() => {
64
- const el = containerRef.current;
65
- const contentEl = contentRef.current;
66
- if (!el || !contentEl) return;
67
- const initial = contentEl.scrollHeight;
68
- prevHeightRef.current = initial;
69
- const ro = new ResizeObserver(() => {
70
- const next = contentEl.scrollHeight;
71
- transitionTo(next);
72
- });
73
- ro.observe(contentEl);
74
- el.addEventListener("transitionend", onEndTransition);
75
- return () => {
76
- ro.disconnect();
77
- el.removeEventListener("transitionend", onEndTransition);
78
- };
79
- // eslint-disable-next-line react-hooks/exhaustive-deps
80
- }, [onEndTransition, transitionTo]);
81
- return _jsx("div", {
82
- ref: containerRef,
83
- className: cn("overflow-hidden relative", className),
84
- style: { willChange: "height" },
85
- children: _jsx("div", {
86
- ref: contentRef,
87
- className: "w-full",
88
- children: children,
89
- }),
90
- });
4
+ export function HeightTransition({ children, durationMs = 320, easing = "ease", pinContentTo = "top", className, }) {
5
+ const containerRef = useRef(null);
6
+ const contentRef = useRef(null);
7
+ const prevHeightRef = useRef(null);
8
+ const isAnimatingRef = useRef(false);
9
+ const durationRef = useRef(durationMs);
10
+ const easingRef = useRef(easing);
11
+ useEffect(() => {
12
+ durationRef.current = durationMs;
13
+ easingRef.current = easing;
14
+ }, [durationMs, easing]);
15
+ const transitionTo = useCallback((next) => {
16
+ const el = containerRef.current;
17
+ const contentEl = contentRef.current;
18
+ if (!el || !contentEl)
19
+ return;
20
+ const prev = prevHeightRef.current ?? el.getBoundingClientRect().height;
21
+ if (Math.abs(prev - next) < 0.5) {
22
+ prevHeightRef.current = next;
23
+ el.style.height = `${next}px`;
24
+ return;
25
+ }
26
+ if (isAnimatingRef.current)
27
+ return;
28
+ isAnimatingRef.current = true;
29
+ el.style.transition = "none";
30
+ el.style.height = `${prev}px`;
31
+ void el.getBoundingClientRect();
32
+ el.style.transition = `height ${durationRef.current}ms ${easingRef.current}`;
33
+ el.style.height = `${next}px`;
34
+ contentEl.style.position = "absolute";
35
+ if (pinContentTo === "top") {
36
+ contentEl.style.top = "0";
37
+ }
38
+ else {
39
+ contentEl.style.bottom = "0";
40
+ }
41
+ prevHeightRef.current = next;
42
+ }, [pinContentTo]);
43
+ const onEndTransition = useCallback((e) => {
44
+ const el = containerRef.current;
45
+ const contentEl = contentRef.current;
46
+ if (!el || !contentEl)
47
+ return;
48
+ if (e.propertyName !== "height")
49
+ return;
50
+ if (e.target !== el)
51
+ return;
52
+ el.style.transition = "";
53
+ el.style.height = `auto`;
54
+ contentEl.style.removeProperty("position");
55
+ contentEl.style.removeProperty("top");
56
+ contentEl.style.removeProperty("bottom");
57
+ isAnimatingRef.current = false;
58
+ }, []);
59
+ // Observe intrinsic content height changes and animate container height accordingly
60
+ useEffect(() => {
61
+ const el = containerRef.current;
62
+ const contentEl = contentRef.current;
63
+ if (!el || !contentEl)
64
+ return;
65
+ const initial = contentEl.scrollHeight;
66
+ prevHeightRef.current = initial;
67
+ const ro = new ResizeObserver(() => {
68
+ const next = contentEl.scrollHeight;
69
+ transitionTo(next);
70
+ });
71
+ ro.observe(contentEl);
72
+ el.addEventListener("transitionend", onEndTransition);
73
+ return () => {
74
+ ro.disconnect();
75
+ el.removeEventListener("transitionend", onEndTransition);
76
+ };
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ }, [onEndTransition, transitionTo]);
79
+ return (_jsx("div", { ref: containerRef, className: cn("overflow-hidden relative", className), style: { willChange: "height" }, children: _jsx("div", { ref: contentRef, className: "w-full", children: children }) }));
91
80
  }
@@ -1,16 +1,9 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
- declare const inputVariants: (
4
- props?:
5
- | ({
6
- variant?: "default" | "error" | "success" | null | undefined;
7
- } & import("class-variance-authority/types").ClassProp)
8
- | undefined,
9
- ) => string;
10
- export interface InputProps
11
- extends React.InputHTMLAttributes<HTMLInputElement>,
12
- VariantProps<typeof inputVariants> {}
13
- declare const Input: React.ForwardRefExoticComponent<
14
- InputProps & React.RefAttributes<HTMLInputElement>
15
- >;
3
+ declare const inputVariants: (props?: ({
4
+ variant?: "success" | "default" | "error" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
7
+ }
8
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
16
9
  export { Input, inputVariants };
@@ -1,32 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { cva } from "class-variance-authority";
2
3
  import * as React from "react";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { cn } from "../lib/utils.js";
5
-
6
- const inputVariants = cva(
7
- "flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
8
- {
9
- variants: {
10
- variant: {
11
- default: "border-input focus-visible:ring-ring",
12
- error: "border-destructive focus-visible:ring-destructive",
13
- success: "border-green-500 focus-visible:ring-green-500",
14
- },
15
- },
16
- defaultVariants: {
17
- variant: "default",
18
- },
19
- },
20
- );
21
- const Input = React.forwardRef(
22
- ({ className, type, variant, ...props }, ref) => {
23
- return _jsx("input", {
24
- type: type,
25
- className: cn(inputVariants({ variant, className })),
26
- ref: ref,
27
- ...props,
28
- });
29
- },
30
- );
5
+ const inputVariants = cva("flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", {
6
+ variants: {
7
+ variant: {
8
+ default: "border-input focus-visible:ring-ring",
9
+ error: "border-destructive focus-visible:ring-destructive",
10
+ success: "border-green-500 focus-visible:ring-green-500",
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ variant: "default",
15
+ },
16
+ });
17
+ const Input = React.forwardRef(({ className, type, variant, ...props }, ref) => {
18
+ return (_jsx("input", { type: type, className: cn(inputVariants({ variant, className })), ref: ref, ...props }));
19
+ });
31
20
  Input.displayName = "Input";
32
21
  export { Input, inputVariants };
@@ -1,10 +1,4 @@
1
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
2
  import * as React from "react";
3
- declare const Label: React.ForwardRefExoticComponent<
4
- Omit<
5
- LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>,
6
- "ref"
7
- > &
8
- React.RefAttributes<HTMLLabelElement>
9
- >;
3
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
10
4
  export { Label };
@@ -1,17 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import * as LabelPrimitive from "@radix-ui/react-label";
2
3
  import * as React from "react";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { cn } from "../lib/utils.js";
5
-
6
- const Label = React.forwardRef(({ className, ...props }, ref) =>
7
- _jsx(LabelPrimitive.Root, {
8
- ref: ref,
9
- className: cn(
10
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
11
- className,
12
- ),
13
- ...props,
14
- }),
15
- );
5
+ const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, className: cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className), ...props })));
16
6
  Label.displayName = LabelPrimitive.Root.displayName;
17
7
  export { Label };
@@ -1,8 +1,6 @@
1
1
  interface MarkdownRendererProps {
2
- content: string;
3
- className?: string;
2
+ content: string;
3
+ className?: string;
4
4
  }
5
- export declare function MarkdownRenderer({
6
- content,
7
- className,
8
- }: MarkdownRendererProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function MarkdownRenderer({ content, className, }: MarkdownRendererProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -2,182 +2,85 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import ReactMarkdown from "react-markdown";
3
3
  import remarkGfm from "remark-gfm";
4
4
  import { cn } from "../lib/utils.js";
5
- export function MarkdownRenderer({ content, className }) {
6
- if (!content) {
7
- return null;
8
- }
9
- const components = {
10
- // Table styling
11
- table: ({ node, ...props }) =>
12
- _jsx("div", {
13
- className: "overflow-x-auto my-4",
14
- children: _jsx("table", {
15
- className:
16
- "min-w-full border-collapse border border-border rounded-md",
17
- ...props,
18
- }),
19
- }),
20
- thead: ({ node, ...props }) =>
21
- _jsx("thead", { className: "bg-card border-b border-border", ...props }),
22
- tbody: ({ node, ...props }) => _jsx("tbody", { ...props }),
23
- tr: ({ node, ...props }) =>
24
- _jsx("tr", {
25
- className: "border-b border-border hover:bg-card transition-colors",
26
- ...props,
27
- }),
28
- th: ({ node, ...props }) =>
29
- _jsx("th", {
30
- className:
31
- "px-4 py-2 text-left font-semibold text-foreground border-r border-border last:border-r-0",
32
- ...props,
33
- }),
34
- td: ({ node, ...props }) =>
35
- _jsx("td", {
36
- className:
37
- "px-4 py-2 text-foreground border-r border-border last:border-r-0",
38
- ...props,
39
- }),
40
- // Task list styling
41
- input: ({ node, checked, ...props }) => {
42
- if (props.type === "checkbox") {
43
- return _jsx("input", {
44
- type: "checkbox",
45
- checked: checked || false,
46
- disabled: true,
47
- readOnly: true,
48
- className: "mr-2 w-4 h-4 accent-[primary] cursor-not-allowed",
49
- ...props,
50
- });
51
- }
52
- return _jsx("input", { ...props });
53
- },
54
- // Code block styling
55
- code: ({ node, ...props }) => {
56
- const inline = !props.className?.includes("language-");
57
- if (inline) {
58
- return _jsx("code", {
59
- className:
60
- "px-1.5 py-0.5 bg-card border border-border rounded text-sm font-mono text-foreground",
61
- ...props,
62
- });
63
- }
64
- return _jsx("code", {
65
- className:
66
- "block p-4 bg-card border border-border rounded-md overflow-x-auto text-sm font-mono text-foreground",
67
- ...props,
68
- });
69
- },
70
- pre: ({ node, ...props }) => _jsx("pre", { className: "my-4", ...props }),
71
- // Heading styling
72
- h1: ({ node, ...props }) =>
73
- _jsx("h1", {
74
- className: "text-2xl font-bold mt-6 mb-4 text-foreground",
75
- ...props,
76
- }),
77
- h2: ({ node, ...props }) =>
78
- _jsx("h2", {
79
- className: "text-xl font-semibold mt-5 mb-3 text-foreground",
80
- ...props,
81
- }),
82
- h3: ({ node, ...props }) =>
83
- _jsx("h3", {
84
- className: "text-lg font-semibold mt-4 mb-2 text-foreground",
85
- ...props,
86
- }),
87
- // List styling
88
- ul: ({ node, ...props }) => {
89
- // Check if this is a task list by looking for checkbox inputs in children
90
- const isTaskList = node?.children?.some(
91
- (child) =>
92
- typeof child === "object" &&
93
- child !== null &&
94
- "type" in child &&
95
- child.type === "element" &&
96
- "tagName" in child &&
97
- child.tagName === "li" &&
98
- "children" in child &&
99
- Array.isArray(child.children) &&
100
- child.children.some(
101
- (grandChild) =>
102
- typeof grandChild === "object" &&
103
- grandChild !== null &&
104
- "type" in grandChild &&
105
- grandChild.type === "element" &&
106
- "tagName" in grandChild &&
107
- grandChild.tagName === "input" &&
108
- "properties" in grandChild &&
109
- typeof grandChild.properties === "object" &&
110
- grandChild.properties !== null &&
111
- "type" in grandChild.properties &&
112
- grandChild.properties.type === "checkbox",
113
- ),
114
- );
115
- return _jsx("ul", {
116
- className: cn(
117
- "my-2 space-y-1 text-foreground",
118
- isTaskList ? "list-none space-y-2" : "list-disc list-inside",
119
- ),
120
- ...props,
121
- });
122
- },
123
- ol: ({ node, ...props }) =>
124
- _jsx("ol", {
125
- className: "list-decimal list-inside my-2 space-y-1 text-foreground",
126
- ...props,
127
- }),
128
- // List item styling
129
- li: ({ node, ...props }) => {
130
- // Check if this li contains a checkbox (task list item)
131
- const isTaskListItem = node?.children?.some(
132
- (child) =>
133
- typeof child === "object" &&
134
- child !== null &&
135
- "type" in child &&
136
- child.type === "element" &&
137
- "tagName" in child &&
138
- child.tagName === "input" &&
139
- "properties" in child &&
140
- typeof child.properties === "object" &&
141
- child.properties !== null &&
142
- "type" in child.properties &&
143
- child.properties.type === "checkbox",
144
- );
145
- return _jsx("li", {
146
- className: cn("flex items-start", isTaskListItem ? "gap-2" : "ml-2"),
147
- ...props,
148
- });
149
- },
150
- // Link styling
151
- a: ({ node, ...props }) =>
152
- _jsx("a", {
153
- className: "text-primary hover:underline",
154
- target: "_blank",
155
- rel: "noopener noreferrer",
156
- ...props,
157
- }),
158
- // Paragraph styling
159
- p: ({ node, ...props }) =>
160
- _jsx("p", {
161
- className: "my-2 text-foreground leading-relaxed",
162
- ...props,
163
- }),
164
- // Blockquote styling
165
- blockquote: ({ node, ...props }) =>
166
- _jsx("blockquote", {
167
- className:
168
- "border-l-4 border-[primary] pl-4 italic my-4 text-foreground bg-card py-2",
169
- ...props,
170
- }),
171
- };
172
- return _jsx("div", {
173
- className: cn(
174
- "markdown-content prose prose-sm max-w-none dark:prose-invert",
175
- className,
176
- ),
177
- children: _jsx(ReactMarkdown, {
178
- remarkPlugins: [remarkGfm],
179
- components: components,
180
- children: content,
181
- }),
182
- });
5
+ export function MarkdownRenderer({ content, className, }) {
6
+ if (!content) {
7
+ return null;
8
+ }
9
+ const components = {
10
+ // Table styling
11
+ table: ({ node, ...props }) => (_jsx("div", { className: "overflow-x-auto my-4", children: _jsx("table", { className: "min-w-full border-collapse border border-border rounded-md", ...props }) })),
12
+ thead: ({ node, ...props }) => (_jsx("thead", { className: "bg-card border-b border-border", ...props })),
13
+ tbody: ({ node, ...props }) => _jsx("tbody", { ...props }),
14
+ tr: ({ node, ...props }) => (_jsx("tr", { className: "border-b border-border hover:bg-card transition-colors", ...props })),
15
+ th: ({ node, ...props }) => (_jsx("th", { className: "px-4 py-2 text-left font-semibold text-foreground border-r border-border last:border-r-0", ...props })),
16
+ td: ({ node, ...props }) => (_jsx("td", { className: "px-4 py-2 text-foreground border-r border-border last:border-r-0", ...props })),
17
+ // Task list styling
18
+ input: ({ node, checked, ...props }) => {
19
+ if (props.type === "checkbox") {
20
+ return (_jsx("input", { type: "checkbox", checked: checked || false, disabled: true, readOnly: true, className: "mr-2 w-4 h-4 accent-[primary] cursor-not-allowed", ...props }));
21
+ }
22
+ return _jsx("input", { ...props });
23
+ },
24
+ // Code block styling
25
+ code: ({ node, ...props }) => {
26
+ const inline = !props.className?.includes("language-");
27
+ if (inline) {
28
+ return (_jsx("code", { className: "px-1.5 py-0.5 bg-card border border-border rounded text-sm font-mono text-foreground", ...props }));
29
+ }
30
+ return (_jsx("code", { className: "block p-4 bg-card border border-border rounded-md overflow-x-auto text-sm font-mono text-foreground", ...props }));
31
+ },
32
+ pre: ({ node, ...props }) => _jsx("pre", { className: "my-4", ...props }),
33
+ // Heading styling
34
+ h1: ({ node, ...props }) => (_jsx("h1", { className: "text-2xl font-bold mt-6 mb-4 text-foreground", ...props })),
35
+ h2: ({ node, ...props }) => (_jsx("h2", { className: "text-xl font-semibold mt-5 mb-3 text-foreground", ...props })),
36
+ h3: ({ node, ...props }) => (_jsx("h3", { className: "text-lg font-semibold mt-4 mb-2 text-foreground", ...props })),
37
+ // List styling
38
+ ul: ({ node, ...props }) => {
39
+ // Check if this is a task list by looking for checkbox inputs in children
40
+ const isTaskList = node?.children?.some((child) => typeof child === "object" &&
41
+ child !== null &&
42
+ "type" in child &&
43
+ child.type === "element" &&
44
+ "tagName" in child &&
45
+ child.tagName === "li" &&
46
+ "children" in child &&
47
+ Array.isArray(child.children) &&
48
+ child.children.some((grandChild) => typeof grandChild === "object" &&
49
+ grandChild !== null &&
50
+ "type" in grandChild &&
51
+ grandChild.type === "element" &&
52
+ "tagName" in grandChild &&
53
+ grandChild.tagName === "input" &&
54
+ "properties" in grandChild &&
55
+ typeof grandChild.properties === "object" &&
56
+ grandChild.properties !== null &&
57
+ "type" in grandChild.properties &&
58
+ grandChild.properties.type === "checkbox"));
59
+ return (_jsx("ul", { className: cn("my-2 space-y-1 text-foreground", isTaskList ? "list-none space-y-2" : "list-disc list-inside"), ...props }));
60
+ },
61
+ ol: ({ node, ...props }) => (_jsx("ol", { className: "list-decimal list-inside my-2 space-y-1 text-foreground", ...props })),
62
+ // List item styling
63
+ li: ({ node, ...props }) => {
64
+ // Check if this li contains a checkbox (task list item)
65
+ const isTaskListItem = node?.children?.some((child) => typeof child === "object" &&
66
+ child !== null &&
67
+ "type" in child &&
68
+ child.type === "element" &&
69
+ "tagName" in child &&
70
+ child.tagName === "input" &&
71
+ "properties" in child &&
72
+ typeof child.properties === "object" &&
73
+ child.properties !== null &&
74
+ "type" in child.properties &&
75
+ child.properties.type === "checkbox");
76
+ return (_jsx("li", { className: cn("flex items-start", isTaskListItem ? "gap-2" : "ml-2"), ...props }));
77
+ },
78
+ // Link styling
79
+ a: ({ node, ...props }) => (_jsx("a", { className: "text-primary hover:underline", target: "_blank", rel: "noopener noreferrer", ...props })),
80
+ // Paragraph styling
81
+ p: ({ node, ...props }) => (_jsx("p", { className: "my-2 text-foreground leading-relaxed", ...props })),
82
+ // Blockquote styling
83
+ blockquote: ({ node, ...props }) => (_jsx("blockquote", { className: "border-l-4 border-[primary] pl-4 italic my-4 text-foreground bg-card py-2", ...props })),
84
+ };
85
+ return (_jsx("div", { className: cn("markdown-content prose prose-sm max-w-none dark:prose-invert", className), children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], components: components, children: content }) }));
183
86
  }
@@ -5,29 +5,26 @@ import type { DisplayMessage } from "./MessageList.js";
5
5
  * Message wrapper component inspired by shadcn.io/ai
6
6
  * Provides role-based layout and styling for chat messages
7
7
  */
8
- declare const messageVariants: (
9
- props?:
10
- | ({
11
- role?: "user" | "assistant" | "system" | null | undefined;
12
- layout?: "default" | "full" | "compact" | null | undefined;
13
- } & import("class-variance-authority/types").ClassProp)
14
- | undefined,
15
- ) => string;
16
- export interface MessageProps
17
- extends React.HTMLAttributes<HTMLDivElement>,
18
- VariantProps<typeof messageVariants> {
19
- /**
20
- * Message object for smart rendering (optional)
21
- * When provided, automatically extracts role and id
22
- */
23
- message?: DisplayMessage;
24
- /** Message role - determines alignment and styling (fallback if message not provided) */
25
- role?: "user" | "assistant" | "system";
26
- /** Optional layout override */
27
- layout?: "default" | "full" | "compact";
28
- /** Optional message ID for accessibility (fallback if message not provided) */
29
- messageId?: string;
8
+ declare const messageVariants: (props?: ({
9
+ role?: "user" | "assistant" | "system" | null | undefined;
10
+ layout?: "default" | "full" | "compact" | null | undefined;
11
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
+ export interface MessageProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof messageVariants> {
13
+ /**
14
+ * Message object for smart rendering (optional)
15
+ * When provided, automatically extracts role and id
16
+ */
17
+ message?: DisplayMessage;
18
+ /** Message role - determines alignment and styling (fallback if message not provided) */
19
+ role?: "user" | "assistant" | "system";
20
+ /** Optional layout override */
21
+ layout?: "default" | "full" | "compact";
22
+ /** Optional message ID for accessibility (fallback if message not provided) */
23
+ messageId?: string;
24
+ /** Whether to auto-scroll this message into view when mounted (default: true for user messages) */
25
+ autoScroll?: boolean;
26
+ /** Whether this is the last message in the conversation (for dynamic min-height) */
27
+ isLastMessage?: boolean;
30
28
  }
31
- export declare const Message: React.ForwardRefExoticComponent<
32
- MessageProps & React.RefAttributes<HTMLDivElement>
33
- >;
29
+ export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>;
30
+ export {};