@vettvangur/ai-sdk 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -20
- package/dist/styles.css +2103 -94
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @vettvangur/ai-sdk
|
|
2
2
|
|
|
3
|
-
Framework-agnostic
|
|
3
|
+
Framework-agnostic AI chat primitives for server-rendered shells.
|
|
4
4
|
|
|
5
5
|
It exports protocol-v1 contracts, parsing and SSE stream-reading primitives, a headless chat session,
|
|
6
6
|
a DOM binding for a server-rendered shell, and the few generic pieces a host draws tool results with. It
|
|
7
|
-
ships no styles by default: every element it renders carries a BEM class
|
|
8
|
-
|
|
7
|
+
ships no styles by default: every element it renders carries a BEM class. An opt-in stylesheet lays
|
|
8
|
+
out and draws the chat, its window and launcher, themed by custom properties (see [Styles](#styles)).
|
|
9
9
|
|
|
10
10
|
```html
|
|
11
11
|
<section data-ai-chat data-ai-chat-endpoint="/webapi/aichat/stream"
|
|
@@ -316,27 +316,60 @@ or cell) holds Markdown, which the card would show as its characters.
|
|
|
316
316
|
|
|
317
317
|
## Styles
|
|
318
318
|
|
|
319
|
-
`@vettvangur/ai-sdk/styles.css` is an opt-in
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
319
|
+
`@vettvangur/ai-sdk/styles.css` is an opt-in look for the chat page, the window over every page and
|
|
320
|
+
its launcher: the shell's layout, everything the SDK renders, the live-chat header states, the
|
|
321
|
+
window growing out of the launcher's corner as the launcher spins away, and a plain default theme.
|
|
322
|
+
Load it before the host's own styles; its selectors are as plain as each rule allows, so a later
|
|
323
|
+
host rule of the same weight wins. Its tokens sit in `:where(:root)`, so any host declaration of
|
|
324
|
+
them wins too.
|
|
325
|
+
|
|
326
|
+
The shell's markup stays the host's (labels, icons and editable text are the site's), and carries
|
|
327
|
+
these classes beside its `data-ai-*` attributes:
|
|
328
|
+
|
|
329
|
+
| Part | Classes |
|
|
330
|
+
| --- | --- |
|
|
331
|
+
| Root | `vv-ai-chat`, plus `vv-ai-chat--window` for the window |
|
|
332
|
+
| Header | `__header`, `__header-inner`, `__identity`, `__avatar` (`--agent`), `__who`, `__name` and `__status` (`--ai`, `--waiting`, `--agent`), `__header-actions`, `__reset`, `__expand`, `__close`, `__menu`, `__menu-toggle`, `__menu-list`, `__menu-item` |
|
|
333
|
+
| Thread | `__thread`, `__thread-inner`, `__intro`, `__intro-avatar`, `__intro-title`, `__intro-text`, `__suggestions`, `__suggestion`, `__suggestion-icon` |
|
|
334
|
+
| Reply actions template | `__reply-action` (`--copy`), `__reply-icon` (`--done`) |
|
|
335
|
+
| Composer | `__composer`, `__composer-inner`, `__prompt`, `__input`, `__send` (`--stop`), `__counter`, `__disclaimer` (`--agent`), `__cancel`, `__brand` |
|
|
336
|
+
| Launcher | `vv-ai-launcher`, `__action`, `__icon`, `__teaser`, `__teaser-open`, `__teaser-title`, `__teaser-text`, `__teaser-dismiss` |
|
|
337
|
+
|
|
338
|
+
Every `vv-ai-chat__` class above is under the root. The page pins the root between the element
|
|
339
|
+
`data-ai-chat-offset` names and the keyboard, and stops the body scrolling. The window floats in the
|
|
340
|
+
corner from `36rem` up and fills the screen below it. The thread is the `vv-ai-chat-thread`
|
|
341
|
+
container, so a host's cards can lay out by its width with `@container vv-ai-chat-thread`.
|
|
342
|
+
|
|
343
|
+
The theme's custom properties, set on the root or any ancestor of the chat and the launcher:
|
|
329
344
|
|
|
330
345
|
| Property | Default |
|
|
331
346
|
| --- | --- |
|
|
332
|
-
| `--vv-ai-
|
|
333
|
-
| `--vv-ai-
|
|
334
|
-
| `--vv-ai-
|
|
335
|
-
| `--vv-ai-
|
|
347
|
+
| `--vv-ai-color-accent`, `-accent-hover`, `-on-accent` | `#2563eb`, `#1d4ed8`, `#fff` |
|
|
348
|
+
| `--vv-ai-color-text`, `-text-muted`, `-text-subtle` | `#374151`, `#6b7280`, `#9ca3af` |
|
|
349
|
+
| `--vv-ai-color-surface`, `-surface-muted`, `-surface-subtle` | `#fff`, `#f1f4f8`, `#f3f4f6` |
|
|
350
|
+
| `--vv-ai-color-border`, `-border-strong`, `-border-accent` | `#e5e7eb`, `#9ca3af`, `#60a5fa` |
|
|
351
|
+
| `--vv-ai-color-disabled`, `-success`, `-error` | `#d1d5db`, `#16a34a`, `#dc2626` |
|
|
352
|
+
| `--vv-ai-color-error-surface`, `-error-border` | `#fef2f2`, `#fca5a5` |
|
|
353
|
+
| `--vv-ai-color-agent`, `-online`, `-waiting` (initials, header dots) | `#f59e0b`, `#5be38c`, `#ffc93d` |
|
|
354
|
+
| `--vv-ai-font-heading`, `--vv-ai-font-weight-bold` | `inherit`, `700` |
|
|
355
|
+
| `--vv-ai-radius`, `-radius-l`, `-radius-bubble` | `0.3125rem`, `0.625rem`, `1rem` |
|
|
356
|
+
| `--vv-ai-shadow-prompt`, `--vv-ai-focus-ring` | a faint ring, the accent at 15% |
|
|
357
|
+
| `--vv-ai-chat-window-z` (the launcher sits one above) | `1000` |
|
|
358
|
+
| `--vv-ai-chat-window-width`, `-height`, `-inset`, `-radius`, `-shadow` | `23.75rem`, `38.75rem`, `1.25rem`, `1rem`, a soft drop |
|
|
359
|
+
| `--vv-ai-chat-window-header`, `-header-agent`, `-header-text`, `-header-muted`, `-header-hover` | the accent, its hover, on-accent, white at 85% and 15% |
|
|
360
|
+
| `--vv-ai-chat-assistant-avatar` (an image in the window's assistant avatar) | `none` |
|
|
361
|
+
| `--vv-ai-launcher-shadow`, `--vv-ai-launcher-teaser-shadow`, `--vv-ai-menu-shadow` | soft drops |
|
|
362
|
+
| `--vv-ai-chat-spring`, `--vv-ai-launcher-spring`, `--vv-ai-launcher-wind-up` | the window's and launcher's easings |
|
|
363
|
+
| `--vv-ai-chat-window-delay` (the window opens once the launcher has mostly spun away) | `0.35s` |
|
|
364
|
+
| `--vv-ai-chat-dot-size`, `--vv-ai-chat-dot-color` | `0.375rem`, `-border-strong` |
|
|
365
|
+
| `--vv-ai-chat-divider-color`, `--vv-ai-chat-divider-gap` | `-border`, `0.625rem` |
|
|
336
366
|
| `--vv-ai-survey-toggle-width`, `-height`, `-inset` | `2.125rem`, `1.25rem`, `0.125rem` |
|
|
337
|
-
| `--vv-ai-survey-toggle-off`, `-on`, `-knob` |
|
|
338
|
-
| `--vv-ai-chat-sheet-background` |
|
|
367
|
+
| `--vv-ai-survey-toggle-off`, `-on`, `-knob` | `-border-strong`, the accent, `-surface` |
|
|
368
|
+
| `--vv-ai-chat-sheet-background` | `-surface` |
|
|
369
|
+
|
|
370
|
+
Reduced motion turns off the window's and launcher's transitions, the pulsing dots and smooth
|
|
371
|
+
scrolling.
|
|
339
372
|
|
|
340
373
|
The package accepts protocol-v1 events (`delta`, `tool`, `tool_result`, `tool_done`, `suggestions`,
|
|
341
374
|
`done` with an optional `turn` token, and `error`) and ignores any other. Host-specific card
|
|
342
|
-
rendering
|
|
375
|
+
rendering remains the host's.
|