@svadmin/ai-elements 0.4.1 → 0.5.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 (39) hide show
  1. package/README.md +46 -0
  2. package/dist/ai-theme.css +28 -0
  3. package/dist/ai.css +2740 -153
  4. package/dist/ai.theme.css +2771 -0
  5. package/dist/components/ChatDialog.svelte +58 -28
  6. package/dist/components/ChatDialog.svelte.d.ts +4 -1
  7. package/dist/components/Conversation.svelte +10 -34
  8. package/dist/components/ConversationContent.svelte +1 -1
  9. package/dist/components/ConversationScrollButton.svelte +1 -0
  10. package/dist/components/Message.svelte +1 -1
  11. package/dist/components/MessageActions.svelte +1 -1
  12. package/dist/components/MessageContent.svelte +1 -1
  13. package/dist/components/MessageToolbar.svelte +1 -1
  14. package/dist/components/Response.svelte +6 -20
  15. package/dist/components/Tool.svelte +13 -13
  16. package/dist/components/Tool.svelte.d.ts +1 -1
  17. package/dist/components/checkpoint/index.d.ts +2 -2
  18. package/dist/components/code/code-variants.d.ts +25 -0
  19. package/dist/components/code/code-variants.js +20 -0
  20. package/dist/components/code/index.d.ts +1 -18
  21. package/dist/components/code/index.js +1 -11
  22. package/dist/components/conversation/scroll.d.ts +4 -0
  23. package/dist/components/conversation/scroll.js +85 -0
  24. package/dist/components/message/content-polish-html.d.ts +5 -0
  25. package/dist/components/message/content-polish-html.js +75 -0
  26. package/dist/components/prompt-input/PromptInput.svelte +17 -5
  27. package/dist/components/prompt-input/PromptInputSubmit.svelte +18 -5
  28. package/dist/components/prompt-input/PromptInputTextarea.svelte +11 -6
  29. package/dist/components/prompt-input/context.svelte.d.ts +7 -0
  30. package/dist/components/snippet/index.d.ts +3 -3
  31. package/dist/components/suggestion/index.d.ts +1 -1
  32. package/dist/components/tool/ToolContent.svelte +1 -1
  33. package/dist/components/tool/ToolHeader.svelte +5 -5
  34. package/dist/components/tool/ToolInput.svelte +4 -2
  35. package/dist/components/tool/ToolOutput.svelte +4 -2
  36. package/dist/components/tool/ToolStatusBadge.svelte +3 -2
  37. package/dist/components/tool/content-polish-scroll-region.d.ts +3 -0
  38. package/dist/components/tool/content-polish-scroll-region.js +22 -0
  39. package/package.json +17 -7
package/README.md CHANGED
@@ -14,6 +14,30 @@ Import the package stylesheet once in your application CSS:
14
14
  @import '@svadmin/ai-elements/ai.css';
15
15
  ```
16
16
 
17
+ This entry is precompiled: the host needs neither a Tailwind plugin nor
18
+ dependency source scanning. It includes the utility styles used by the package
19
+ and its Streamdown renderer, without injecting a global reset.
20
+
21
+ Tailwind v4 hosts can instead use the theme entry:
22
+
23
+ ```css
24
+ @import 'tailwindcss';
25
+ @import '@svadmin/ai-elements/ai.theme.css';
26
+ ```
27
+
28
+ Import one AI stylesheet entry, not both. Semantic colors read host CSS
29
+ variables such as `--background`, `--foreground`, and `--primary`, with system
30
+ color fallbacks. Nested themes use `.svadmin-theme`.
31
+ For a non-Tailwind host, define global typography/reset styles in the host
32
+ application; this package does not reset unrelated content.
33
+
34
+ Tailwind remains a build-time dependency. The package no longer declares
35
+ `tailwind-variants` or `tailwind-merge` as runtime dependencies, although Streamdown still
36
+ uses the latter transitively. SvelteFlow keeps its component-owned stylesheet.
37
+ No `@svadmin/ui` dependency is required.
38
+ The public `codeVariants` helper retains extension metadata; `tailwind-variants`
39
+ is used only in development to verify consumer extension compatibility.
40
+
17
41
  ## Vite SSR
18
42
 
19
43
  Vite SSR consumers must bundle the Svelte and ESM dependency boundary used by the complete package entry:
@@ -85,6 +109,28 @@ The packed-package verification loads the root entry through `vite.ssrLoadModule
85
109
  <PromptInput bind:value={prompt} />
86
110
  ```
87
111
 
112
+ ### Conversation Interaction
113
+
114
+ Use `ConversationContent` inside `Conversation` for automatic following,
115
+ including streamed Markdown and delayed content resizing. Scrolling away pauses
116
+ following; `ConversationScrollButton` returns to the latest content. Clearing
117
+ the history restores following.
118
+
119
+ Composed `PromptInputTextarea` and `PromptInputSubmit` inherit their form's
120
+ disabled, submission, streaming, and stop state. Explicit child props remain
121
+ supported. A busy submit control never submits another request. Disabling
122
+ editing does not disable stopping an active response unless the stop button
123
+ itself is explicitly disabled.
124
+
125
+ `ChatDialog` offers retry for the latest failed or stopped response, preserving
126
+ the original user request and any new draft. Retrying a tool run requires fresh
127
+ approval rather than reusing the prior confirmation. Restored local attachments
128
+ without file contents or a durable URL must be reattached before resending.
129
+
130
+ Long message text wraps, while wide Markdown code and tables scroll locally.
131
+ Tool details remain collapsed until opened; overflowing tool values are
132
+ keyboard-focusable. Code copy preserves literal HTML and nested code fences.
133
+
88
134
  Messages use the `ChatMessagePart` contract from `@svadmin/core`, including text, reasoning, tool calls/results, sources, images, files, approvals, and generated components.
89
135
 
90
136
  Generated components use TypeBox as their runtime boundary. The schema also
@@ -0,0 +1,28 @@
1
+ /* Semantic fallbacks keep this package independent of @svadmin/ui. */
2
+ @theme {
3
+ --color-background: var(--background, Canvas);
4
+ --color-foreground: var(--foreground, CanvasText);
5
+ --color-card: var(--card, Canvas);
6
+ --color-card-foreground: var(--card-foreground, CanvasText);
7
+ --color-popover: var(--popover, Canvas);
8
+ --color-popover-foreground: var(--popover-foreground, CanvasText);
9
+ --color-primary: var(--primary, Highlight);
10
+ --color-primary-foreground: var(--primary-foreground, HighlightText);
11
+ --color-secondary: var(--secondary, ButtonFace);
12
+ --color-secondary-foreground: var(--secondary-foreground, ButtonText);
13
+ --color-muted: var(--muted, ButtonFace);
14
+ --color-muted-foreground: var(--muted-foreground, GrayText);
15
+ --color-accent: var(--accent, ButtonFace);
16
+ --color-accent-foreground: var(--accent-foreground, ButtonText);
17
+ --color-destructive: var(--destructive, CanvasText);
18
+ --color-destructive-foreground: var(--destructive-foreground, Canvas);
19
+ --color-success: var(--success, CanvasText);
20
+ --color-success-foreground: var(--success-foreground, Canvas);
21
+ --color-warning: var(--warning, CanvasText);
22
+ --color-warning-foreground: var(--warning-foreground, Canvas);
23
+ --color-info: var(--info, Highlight);
24
+ --color-border: var(--border, ButtonBorder);
25
+ --color-input: var(--input, ButtonBorder);
26
+ --color-ring: var(--ring, Highlight);
27
+ --color-sidebar: var(--sidebar, Canvas);
28
+ }