@tulipfarm/sprout 0.3.1 → 0.5.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 +75 -68
- package/dist/components/accordion.d.ts +2 -2
- package/dist/components/accordion.js +9 -9
- package/dist/components/agent-avatar.d.ts +27 -0
- package/dist/components/agent-avatar.js +67 -0
- package/dist/components/agent-fanout.d.ts +2 -2
- package/dist/components/agent-fanout.js +65 -87
- package/dist/components/alert-dialog.d.ts +8 -8
- package/dist/components/alert-dialog.js +21 -21
- package/dist/components/alert.d.ts +6 -6
- package/dist/components/alert.js +13 -13
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/aspect-ratio.js +2 -2
- package/dist/components/attachment.d.ts +18 -18
- package/dist/components/attachment.js +82 -115
- package/dist/components/avatar.d.ts +9 -17
- package/dist/components/avatar.js +14 -51
- package/dist/components/badge.d.ts +4 -4
- package/dist/components/badge.js +18 -18
- package/dist/components/board.d.ts +107 -0
- package/dist/components/board.js +640 -0
- package/dist/components/brand-icon.d.ts +6 -6
- package/dist/components/brand-icon.js +55 -63
- package/dist/components/breadcrumb.d.ts +11 -11
- package/dist/components/breadcrumb.js +16 -18
- package/dist/components/button-group.d.ts +6 -6
- package/dist/components/button-group.js +14 -14
- package/dist/components/button.d.ts +13 -13
- package/dist/components/button.js +31 -57
- package/dist/components/calendar.d.ts +5 -5
- package/dist/components/calendar.js +44 -53
- package/dist/components/canvas.d.ts +4 -4
- package/dist/components/canvas.js +39 -46
- package/dist/components/card.d.ts +7 -7
- package/dist/components/card.js +17 -17
- package/dist/components/carousel.d.ts +7 -7
- package/dist/components/carousel.js +57 -75
- package/dist/components/chart.d.ts +5 -112
- package/dist/components/chart.js +5 -172
- package/dist/components/chat-confirmation.d.ts +10 -10
- package/dist/components/chat-confirmation.js +32 -38
- package/dist/components/chat-input.d.ts +4 -4
- package/dist/components/chat-input.js +74 -81
- package/dist/components/chat-plan.d.ts +2 -2
- package/dist/components/chat-plan.js +15 -20
- package/dist/components/chat-sources.d.ts +8 -8
- package/dist/components/chat-sources.js +18 -27
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +9 -9
- package/dist/components/choice-list.d.ts +2 -2
- package/dist/components/choice-list.js +16 -18
- package/dist/components/code-block.d.ts +5 -5
- package/dist/components/code-block.js +26 -26
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +7 -11
- package/dist/components/combobox.d.ts +12 -6
- package/dist/components/combobox.js +27 -26
- package/dist/components/command.d.ts +13 -13
- package/dist/components/command.js +61 -73
- package/dist/components/context-menu.d.ts +5 -5
- package/dist/components/context-menu.js +22 -22
- package/dist/components/dialog.d.ts +6 -6
- package/dist/components/dialog.js +23 -28
- package/dist/components/direction.d.ts +1 -1
- package/dist/components/direction.js +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -5
- package/dist/components/dropdown-menu.js +20 -20
- package/dist/components/field.d.ts +11 -11
- package/dist/components/field.js +41 -61
- package/dist/components/file-explorer.d.ts +2 -2
- package/dist/components/file-explorer.js +89 -105
- package/dist/components/file-viewer.d.ts +10 -10
- package/dist/components/file-viewer.js +112 -140
- package/dist/components/form.d.ts +7 -7
- package/dist/components/form.js +24 -28
- package/dist/components/glass-banner.d.ts +3 -3
- package/dist/components/glass-banner.js +21 -24
- package/dist/components/gradient-banner.d.ts +7 -7
- package/dist/components/gradient-banner.js +13 -22
- package/dist/components/hover-card.d.ts +4 -4
- package/dist/components/hover-card.js +6 -6
- package/dist/components/input-group.d.ts +18 -18
- package/dist/components/input-group.js +25 -39
- package/dist/components/input-otp.d.ts +14 -10
- package/dist/components/input-otp.js +15 -15
- package/dist/components/input.d.ts +3 -3
- package/dist/components/input.js +7 -7
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +5 -5
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +2 -2
- package/dist/components/mention-list.d.ts +3 -3
- package/dist/components/mention-list.js +10 -10
- package/dist/components/menubar.d.ts +6 -6
- package/dist/components/menubar.js +22 -22
- package/dist/components/message-actions.d.ts +2 -2
- package/dist/components/message-actions.js +29 -31
- package/dist/components/message-response.d.ts +3 -3
- package/dist/components/message-response.js +18 -18
- package/dist/components/message-scroller.d.ts +12 -12
- package/dist/components/message-scroller.js +44 -56
- package/dist/components/message.d.ts +11 -11
- package/dist/components/message.js +25 -25
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +15 -15
- package/dist/components/notice-banner.d.ts +2 -2
- package/dist/components/notice-banner.js +2 -2
- package/dist/components/page-content.d.ts +2 -2
- package/dist/components/page-content.js +2 -2
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +17 -17
- package/dist/components/pagination.d.ts +9 -9
- package/dist/components/pagination.js +17 -17
- package/dist/components/plan-outline.d.ts +2 -2
- package/dist/components/plan-outline.js +43 -60
- package/dist/components/popover.d.ts +6 -6
- package/dist/components/popover.js +15 -15
- package/dist/components/presence-cursor.d.ts +2 -2
- package/dist/components/presence-cursor.js +3 -3
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +8 -8
- package/dist/components/prompt-list.d.ts +3 -3
- package/dist/components/prompt-list.js +6 -6
- package/dist/components/questionnaire.d.ts +19 -19
- package/dist/components/questionnaire.js +183 -242
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +6 -6
- package/dist/components/reasoning-effort.d.ts +3 -3
- package/dist/components/reasoning-effort.js +9 -12
- package/dist/components/record-list.d.ts +66 -0
- package/dist/components/record-list.js +151 -0
- package/dist/components/resizable.d.ts +5 -5
- package/dist/components/resizable.js +76 -102
- package/dist/components/result-card.d.ts +4 -4
- package/dist/components/result-card.js +42 -53
- package/dist/components/result-notice.d.ts +18 -0
- package/dist/components/result-notice.js +29 -0
- package/dist/components/review-card.d.ts +6 -6
- package/dist/components/review-card.js +18 -18
- package/dist/components/rich-text-editor.d.ts +5 -5
- package/dist/components/rich-text-editor.js +56 -72
- package/dist/components/schema-diagram.d.ts +3 -3
- package/dist/components/schema-diagram.js +39 -53
- package/dist/components/scroll-area.d.ts +3 -3
- package/dist/components/scroll-area.js +10 -14
- package/dist/components/search-dialog.d.ts +6 -6
- package/dist/components/search-dialog.js +16 -16
- package/dist/components/search-field.d.ts +1 -1
- package/dist/components/search-field.js +11 -11
- package/dist/components/select.d.ts +5 -9
- package/dist/components/select.js +20 -20
- package/dist/components/selection-slot.d.ts +2 -2
- package/dist/components/selection-slot.js +6 -9
- package/dist/components/separator.d.ts +15 -15
- package/dist/components/separator.js +22 -27
- package/dist/components/settings-list.d.ts +3 -3
- package/dist/components/settings-list.js +5 -5
- package/dist/components/sheet.d.ts +6 -6
- package/dist/components/sheet.js +27 -27
- package/dist/components/sidebar.d.ts +22 -22
- package/dist/components/sidebar.js +57 -58
- package/dist/components/skeleton.d.ts +5 -5
- package/dist/components/skeleton.js +14 -21
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +6 -6
- package/dist/components/spinner.d.ts +7 -7
- package/dist/components/spinner.js +22 -26
- package/dist/components/sql-viewer.d.ts +14 -14
- package/dist/components/sql-viewer.js +99 -128
- package/dist/components/state-panel-samples.d.ts +2 -2
- package/dist/components/state-panel-samples.js +209 -245
- package/dist/components/state-panel.d.ts +2 -35
- package/dist/components/state-panel.js +2 -29
- package/dist/components/state-sample.d.ts +8 -8
- package/dist/components/state-sample.js +18 -31
- package/dist/components/switch.d.ts +3 -3
- package/dist/components/switch.js +7 -7
- package/dist/components/table-nuqs.d.ts +2 -2
- package/dist/components/table-nuqs.js +11 -12
- package/dist/components/table.d.ts +4 -4
- package/dist/components/table.js +166 -235
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +12 -12
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +6 -8
- package/dist/components/timeline.d.ts +3 -0
- package/dist/components/timeline.js +3 -0
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/toast.js +19 -25
- package/dist/components/toggle-group.d.ts +4 -4
- package/dist/components/toggle-group.js +18 -20
- package/dist/components/toggle.d.ts +4 -4
- package/dist/components/toggle.js +8 -8
- package/dist/components/tool-activity.d.ts +1 -1
- package/dist/components/tool-activity.js +83 -110
- package/dist/components/toolbar-status.d.ts +2 -2
- package/dist/components/toolbar-status.js +7 -7
- package/dist/components/tooltip.d.ts +5 -5
- package/dist/components/tooltip.js +12 -11
- package/dist/components/typed-text.d.ts +2 -2
- package/dist/components/typed-text.js +10 -12
- package/dist/components/view-switcher.d.ts +51 -0
- package/dist/components/view-switcher.js +114 -0
- package/dist/index.d.ts +99 -93
- package/dist/index.js +99 -93
- package/dist/internal/agent-avatar-artwork.d.ts +4 -0
- package/dist/internal/agent-avatar-artwork.js +219 -0
- package/dist/internal/chart-kit.d.ts +142 -0
- package/dist/internal/chart-kit.js +200 -0
- package/dist/internal/charts/bars.d.ts +61 -0
- package/dist/internal/charts/bars.js +86 -0
- package/dist/internal/charts/lines.d.ts +67 -0
- package/dist/internal/charts/lines.js +70 -0
- package/dist/internal/charts/more.d.ts +77 -0
- package/dist/internal/charts/more.js +68 -0
- package/dist/internal/charts/parts.d.ts +54 -0
- package/dist/internal/charts/parts.js +82 -0
- package/dist/internal/charts/timeline-dates.d.ts +38 -0
- package/dist/internal/charts/timeline-dates.js +113 -0
- package/dist/internal/charts/timeline-window.d.ts +31 -0
- package/dist/internal/charts/timeline-window.js +26 -0
- package/dist/internal/charts/timeline.d.ts +72 -0
- package/dist/internal/charts/timeline.js +287 -0
- package/dist/internal/classes.d.ts +1 -1
- package/dist/internal/classes.js +7 -9
- package/dist/internal/code-tokens.d.ts +2 -2
- package/dist/internal/code-tokens.js +12 -12
- package/dist/internal/fieldset.d.ts +1 -1
- package/dist/internal/fieldset.js +6 -6
- package/dist/internal/file-kind.d.ts +1 -1
- package/dist/internal/file-kind.js +43 -51
- package/dist/internal/flow.d.ts +4 -4
- package/dist/internal/flow.js +20 -23
- package/dist/internal/hash.d.ts +1 -0
- package/dist/internal/hash.js +9 -0
- package/dist/internal/languages.js +999 -999
- package/dist/internal/message-scroller.d.ts +3 -3
- package/dist/internal/message-scroller.js +64 -112
- package/dist/internal/pressable.d.ts +1 -1
- package/dist/internal/pressable.js +7 -7
- package/dist/internal/state-panel.d.ts +35 -0
- package/dist/internal/state-panel.js +22 -0
- package/dist/internal/syntax.d.ts +2 -2
- package/dist/internal/syntax.js +36 -47
- package/dist/styles/accordion.css +3 -5
- package/dist/styles/agent-fanout.css +64 -60
- package/dist/styles/alert-dialog.css +12 -26
- package/dist/styles/alert.css +10 -15
- package/dist/styles/attachment.css +56 -98
- package/dist/styles/avatar.css +14 -33
- package/dist/styles/badge.css +11 -36
- package/dist/styles/board.css +571 -0
- package/dist/styles/brand-icon.css +7 -8
- package/dist/styles/breadcrumb.css +4 -7
- package/dist/styles/button-group.css +9 -15
- package/dist/styles/button.css +45 -175
- package/dist/styles/calendar.css +24 -36
- package/dist/styles/canvas.css +2 -3
- package/dist/styles/card.css +7 -23
- package/dist/styles/carousel.css +11 -12
- package/dist/styles/chart.css +215 -31
- package/dist/styles/chat-input.css +15 -39
- package/dist/styles/chat-plan.css +3 -4
- package/dist/styles/chat-sources.css +4 -6
- package/dist/styles/checkbox.css +11 -25
- package/dist/styles/choice-list.css +17 -31
- package/dist/styles/code-block.css +11 -25
- package/dist/styles/collapsible.css +10 -15
- package/dist/styles/combobox.css +24 -17
- package/dist/styles/command.css +8 -9
- package/dist/styles/context-menu.css +4 -2
- package/dist/styles/dialog.css +5 -16
- package/dist/styles/dropdown-menu.css +4 -2
- package/dist/styles/field.css +15 -21
- package/dist/styles/file-explorer.css +19 -33
- package/dist/styles/file-viewer.css +13 -17
- package/dist/styles/form.css +3 -3
- package/dist/styles/glass-banner.css +12 -47
- package/dist/styles/gradient-banner.css +16 -39
- package/dist/styles/hover-card.css +9 -15
- package/dist/styles/index.css +121 -112
- package/dist/styles/input-group.css +61 -69
- package/dist/styles/input-otp.css +18 -9
- package/dist/styles/input.css +19 -11
- package/dist/styles/kbd.css +1 -1
- package/dist/styles/label.css +9 -30
- package/dist/styles/mention-list.css +6 -8
- package/dist/styles/menubar.css +9 -8
- package/dist/styles/message-actions.css +1 -1
- package/dist/styles/message-response.css +3 -5
- package/dist/styles/message-scroller.css +14 -21
- package/dist/styles/message.css +23 -60
- package/dist/styles/navigation-menu.css +15 -30
- package/dist/styles/notice-banner.css +1 -2
- package/dist/styles/page-header.css +11 -10
- package/dist/styles/pagination.css +12 -6
- package/dist/styles/plan-outline.css +20 -37
- package/dist/styles/popover.css +10 -19
- package/dist/styles/presence-cursor.css +1 -2
- package/dist/styles/progress.css +2 -4
- package/dist/styles/prompt-list.css +6 -17
- package/dist/styles/questionnaire.css +16 -40
- package/dist/styles/radio-group.css +12 -23
- package/dist/styles/reasoning-effort.css +8 -15
- package/dist/styles/record-list.css +243 -0
- package/dist/styles/resizable.css +10 -11
- package/dist/styles/result-card.css +4 -4
- package/dist/styles/result-notice.css +80 -0
- package/dist/styles/review-card.css +2 -3
- package/dist/styles/rich-text-editor.css +4 -5
- package/dist/styles/schema-diagram.css +12 -17
- package/dist/styles/scroll-area.css +8 -10
- package/dist/styles/search-dialog.css +1 -5
- package/dist/styles/search-field.css +1 -2
- package/dist/styles/select.css +15 -19
- package/dist/styles/selection-slot.css +1 -2
- package/dist/styles/separator.css +7 -8
- package/dist/styles/settings-list.css +1 -2
- package/dist/styles/sheet.css +40 -73
- package/dist/styles/sidebar.css +32 -34
- package/dist/styles/skeleton.css +9 -11
- package/dist/styles/slider.css +11 -21
- package/dist/styles/spinner.css +2 -2
- package/dist/styles/sql-viewer.css +29 -29
- package/dist/styles/state-panel.css +8 -9
- package/dist/styles/state-sample.css +20 -33
- package/dist/styles/switch.css +11 -18
- package/dist/styles/table.css +62 -81
- package/dist/styles/tabs.css +13 -19
- package/dist/styles/textarea.css +3 -3
- package/dist/styles/themes/chatgpt.css +11 -23
- package/dist/styles/themes/claude.css +12 -24
- package/dist/styles/themes/cloudflare.css +11 -23
- package/dist/styles/themes/discord.css +11 -23
- package/dist/styles/themes/github.css +11 -23
- package/dist/styles/themes/grok.css +11 -23
- package/dist/styles/themes/linear.css +12 -25
- package/dist/styles/themes/neutral.css +11 -23
- package/dist/styles/themes/notion.css +11 -23
- package/dist/styles/themes/perplexity.css +11 -23
- package/dist/styles/themes/raycast.css +11 -23
- package/dist/styles/themes/spotify.css +11 -23
- package/dist/styles/themes/stripe.css +11 -23
- package/dist/styles/themes/supabase.css +11 -23
- package/dist/styles/themes/tulipfarm.css +9 -10
- package/dist/styles/themes/vercel.css +12 -25
- package/dist/styles/timeline.css +276 -0
- package/dist/styles/toast.css +13 -20
- package/dist/styles/toggle-group.css +23 -29
- package/dist/styles/toggle.css +14 -14
- package/dist/styles/tool-activity.css +7 -13
- package/dist/styles/toolbar-status.css +2 -7
- package/dist/styles/tooltip.css +15 -21
- package/dist/styles/view-switcher.css +297 -0
- package/package.json +25 -1
package/README.md
CHANGED
|
@@ -62,21 +62,21 @@ The package is also on GitHub Packages. It needs a GitHub token with
|
|
|
62
62
|
Add the styles to your CSS entry:
|
|
63
63
|
|
|
64
64
|
```css
|
|
65
|
-
@import
|
|
66
|
-
@import
|
|
65
|
+
@import 'tailwindcss';
|
|
66
|
+
@import '@tulipfarm/sprout/styles.css';
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
Use a component:
|
|
70
70
|
|
|
71
71
|
```tsx
|
|
72
|
-
import { Button } from
|
|
73
|
-
import { Badge } from
|
|
72
|
+
import { Button } from '@tulipfarm/sprout/button';
|
|
73
|
+
import { Badge } from '@tulipfarm/sprout/badge';
|
|
74
74
|
|
|
75
75
|
export function Status() {
|
|
76
76
|
return (
|
|
77
77
|
<>
|
|
78
78
|
<Badge variant="success">Connected</Badge>
|
|
79
|
-
<Button state={{ kind:
|
|
79
|
+
<Button state={{ kind: 'busy' }} pendingLabel="Saving…">
|
|
80
80
|
Save
|
|
81
81
|
</Button>
|
|
82
82
|
</>
|
|
@@ -98,7 +98,7 @@ for notes on each one.
|
|
|
98
98
|
|
|
99
99
|
<!-- bundle-size:start -->
|
|
100
100
|
|
|
101
|
-
Full library: **
|
|
101
|
+
Full library: **866.4 kB** gzip. Each component path is smaller. Sizes are minified, with React and other peer dependencies left out.
|
|
102
102
|
|
|
103
103
|
<details>
|
|
104
104
|
<summary>Size of each component</summary>
|
|
@@ -106,99 +106,105 @@ Full library: **786.4 kB** gzip. Each component path is smaller. Sizes are minif
|
|
|
106
106
|
| Component | Raw | Gzip | Brotli |
|
|
107
107
|
| ------------------- | -------: | -------: | -------: |
|
|
108
108
|
| `accordion` | 64.1 kB | 21.9 kB | 19.3 kB |
|
|
109
|
-
| `agent-fanout` | 260.
|
|
109
|
+
| `agent-fanout` | 260.7 kB | 86.6 kB | 74.5 kB |
|
|
110
|
+
| `agent-avatar` | 137.7 kB | 39.9 kB | 34.0 kB |
|
|
110
111
|
| `alert` | 35.2 kB | 11.5 kB | 10.1 kB |
|
|
111
|
-
| `alert-dialog` |
|
|
112
|
+
| `alert-dialog` | 168.8 kB | 56.9 kB | 49.7 kB |
|
|
112
113
|
| `aspect-ratio` | 30.2 kB | 9.7 kB | 8.5 kB |
|
|
113
|
-
| `attachment` |
|
|
114
|
-
| `avatar` |
|
|
114
|
+
| `attachment` | 351.9 kB | 118.6 kB | 97.8 kB |
|
|
115
|
+
| `avatar` | 44.0 kB | 14.6 kB | 12.9 kB |
|
|
115
116
|
| `badge` | 34.9 kB | 11.4 kB | 10.0 kB |
|
|
116
|
-
| `
|
|
117
|
+
| `board` | 452.2 kB | 148.3 kB | 125.3 kB |
|
|
118
|
+
| `brand-icon` | 195.1 kB | 70.2 kB | 61.3 kB |
|
|
117
119
|
| `breadcrumb` | 40.5 kB | 13.4 kB | 11.7 kB |
|
|
118
|
-
| `button` | 50.
|
|
120
|
+
| `button` | 50.3 kB | 16.6 kB | 14.6 kB |
|
|
119
121
|
| `button-group` | 37.9 kB | 12.1 kB | 10.7 kB |
|
|
120
|
-
| `calendar` | 312.
|
|
121
|
-
| `canvas` |
|
|
122
|
+
| `calendar` | 312.0 kB | 103.4 kB | 88.2 kB |
|
|
123
|
+
| `canvas` | 234.9 kB | 80.7 kB | 69.0 kB |
|
|
122
124
|
| `card` | 35.4 kB | 11.6 kB | 10.1 kB |
|
|
123
|
-
| `carousel` | 60.
|
|
124
|
-
| `chart` |
|
|
125
|
-
| `
|
|
125
|
+
| `carousel` | 60.2 kB | 19.8 kB | 17.5 kB |
|
|
126
|
+
| `chart` | 540.1 kB | 155.5 kB | 129.9 kB |
|
|
127
|
+
| `timeline` | 598.3 kB | 175.8 kB | 147.0 kB |
|
|
128
|
+
| `chat-confirmation` | 76.5 kB | 26.2 kB | 22.4 kB |
|
|
126
129
|
| `chat-plan` | 42.3 kB | 13.4 kB | 11.7 kB |
|
|
127
|
-
| `chat-sources` | 206.
|
|
128
|
-
| `chat-input` |
|
|
130
|
+
| `chat-sources` | 206.0 kB | 70.5 kB | 60.3 kB |
|
|
131
|
+
| `chat-input` | 901.7 kB | 297.5 kB | 246.5 kB |
|
|
129
132
|
| `checkbox` | 60.0 kB | 21.0 kB | 18.5 kB |
|
|
130
133
|
| `choice-list` | 43.0 kB | 14.5 kB | 12.6 kB |
|
|
131
|
-
| `code-block` | 74.
|
|
134
|
+
| `code-block` | 74.3 kB | 26.0 kB | 22.3 kB |
|
|
132
135
|
| `collapsible` | 55.5 kB | 18.7 kB | 16.5 kB |
|
|
133
|
-
| `combobox` | 268.
|
|
134
|
-
| `command` | 181.
|
|
135
|
-
| `context-menu` | 242.8 kB | 81.0 kB |
|
|
136
|
-
| `dialog` | 170.
|
|
136
|
+
| `combobox` | 268.4 kB | 90.8 kB | 77.7 kB |
|
|
137
|
+
| `command` | 181.7 kB | 61.5 kB | 53.3 kB |
|
|
138
|
+
| `context-menu` | 242.8 kB | 81.0 kB | 70.0 kB |
|
|
139
|
+
| `dialog` | 170.5 kB | 57.4 kB | 50.1 kB |
|
|
137
140
|
| `direction` | 1.4 kB | 0.7 kB | 0.7 kB |
|
|
138
|
-
| `dropdown-menu` | 239.6 kB | 80.0 kB | 69.
|
|
139
|
-
| `field` | 97.9 kB | 34.
|
|
140
|
-
| `file-explorer` |
|
|
141
|
-
| `file-viewer` |
|
|
142
|
-
| `form` | 109.
|
|
141
|
+
| `dropdown-menu` | 239.6 kB | 80.0 kB | 69.1 kB |
|
|
142
|
+
| `field` | 97.9 kB | 34.1 kB | 29.6 kB |
|
|
143
|
+
| `file-explorer` | 175.6 kB | 61.4 kB | 51.5 kB |
|
|
144
|
+
| `file-viewer` | 320.6 kB | 108.2 kB | 90.5 kB |
|
|
145
|
+
| `form` | 109.5 kB | 37.2 kB | 32.1 kB |
|
|
143
146
|
| `glass-banner` | 33.0 kB | 10.6 kB | 9.4 kB |
|
|
144
147
|
| `gradient-banner` | 32.2 kB | 10.3 kB | 9.1 kB |
|
|
145
148
|
| `hover-card` | 163.2 kB | 56.3 kB | 49.1 kB |
|
|
146
|
-
| `input` | 108.2 kB | 37.4 kB | 32.
|
|
147
|
-
| `input-group` |
|
|
148
|
-
| `input-otp` | 65.
|
|
149
|
+
| `input` | 108.2 kB | 37.4 kB | 32.4 kB |
|
|
150
|
+
| `input-group` | 118.9 kB | 40.3 kB | 34.6 kB |
|
|
151
|
+
| `input-otp` | 65.4 kB | 22.9 kB | 20.4 kB |
|
|
149
152
|
| `kbd` | 30.4 kB | 9.7 kB | 8.5 kB |
|
|
150
153
|
| `label` | 30.2 kB | 9.6 kB | 8.4 kB |
|
|
151
|
-
| `mention-list` | 52.
|
|
154
|
+
| `mention-list` | 52.4 kB | 17.2 kB | 15.1 kB |
|
|
152
155
|
| `menubar` | 244.9 kB | 82.2 kB | 70.7 kB |
|
|
153
156
|
| `message` | 36.2 kB | 11.7 kB | 10.3 kB |
|
|
154
|
-
| `message-actions` | 71.
|
|
155
|
-
| `message-response` | 232.
|
|
156
|
-
| `message-scroller` |
|
|
157
|
-
| `navigation-menu` | 182.3 kB | 63.0 kB | 54.
|
|
157
|
+
| `message-actions` | 71.2 kB | 24.8 kB | 20.8 kB |
|
|
158
|
+
| `message-response` | 232.6 kB | 74.2 kB | 64.1 kB |
|
|
159
|
+
| `message-scroller` | 68.8 kB | 22.0 kB | 19.5 kB |
|
|
160
|
+
| `navigation-menu` | 182.3 kB | 63.0 kB | 54.8 kB |
|
|
158
161
|
| `notice-banner` | 30.4 kB | 9.7 kB | 8.5 kB |
|
|
159
162
|
| `page-content` | 30.2 kB | 9.6 kB | 8.4 kB |
|
|
160
|
-
| `page-header` | 54.
|
|
161
|
-
| `pagination` | 55.
|
|
162
|
-
| `plan-outline` | 79.9 kB | 26.
|
|
163
|
-
| `popover` | 178.0 kB | 60.7 kB | 52.
|
|
163
|
+
| `page-header` | 54.4 kB | 17.5 kB | 15.4 kB |
|
|
164
|
+
| `pagination` | 55.1 kB | 17.8 kB | 15.6 kB |
|
|
165
|
+
| `plan-outline` | 79.9 kB | 26.8 kB | 22.9 kB |
|
|
166
|
+
| `popover` | 178.0 kB | 60.7 kB | 52.7 kB |
|
|
164
167
|
| `presence-cursor` | 30.8 kB | 9.9 kB | 8.6 kB |
|
|
165
168
|
| `progress` | 39.8 kB | 13.2 kB | 11.6 kB |
|
|
166
|
-
| `prompt-list` | 199.0 kB | 71.9 kB | 62.
|
|
167
|
-
| `questionnaire` | 69.
|
|
168
|
-
| `radio-group` | 80.8 kB | 27.9 kB | 24.
|
|
169
|
+
| `prompt-list` | 199.0 kB | 71.9 kB | 62.7 kB |
|
|
170
|
+
| `questionnaire` | 69.3 kB | 23.3 kB | 20.3 kB |
|
|
171
|
+
| `radio-group` | 80.8 kB | 27.9 kB | 24.8 kB |
|
|
169
172
|
| `reasoning-effort` | 35.5 kB | 12.0 kB | 10.5 kB |
|
|
173
|
+
| `record-list` | 65.6 kB | 22.2 kB | 18.9 kB |
|
|
170
174
|
| `resizable` | 39.4 kB | 13.4 kB | 11.8 kB |
|
|
171
|
-
| `result-card` | 240.
|
|
172
|
-
| `
|
|
175
|
+
| `result-card` | 240.0 kB | 85.2 kB | 72.2 kB |
|
|
176
|
+
| `result-notice` | 34.3 kB | 11.3 kB | 9.9 kB |
|
|
177
|
+
| `review-card` | 61.6 kB | 21.2 kB | 18.4 kB |
|
|
173
178
|
| `rich-text-editor` | 442.5 kB | 140.2 kB | 119.8 kB |
|
|
174
|
-
| `schema-diagram` | 247.
|
|
175
|
-
| `sql-viewer` | 265.
|
|
179
|
+
| `schema-diagram` | 247.7 kB | 82.8 kB | 71.1 kB |
|
|
180
|
+
| `sql-viewer` | 265.4 kB | 89.1 kB | 76.2 kB |
|
|
176
181
|
| `scroll-area` | 57.3 kB | 19.7 kB | 17.4 kB |
|
|
177
|
-
| `search-dialog` | 190.
|
|
178
|
-
| `search-field` | 122.
|
|
179
|
-
| `select` | 230.4 kB | 79.3 kB | 67.
|
|
182
|
+
| `search-dialog` | 190.0 kB | 64.5 kB | 55.3 kB |
|
|
183
|
+
| `search-field` | 122.0 kB | 41.3 kB | 35.5 kB |
|
|
184
|
+
| `select` | 230.4 kB | 79.3 kB | 67.9 kB |
|
|
180
185
|
| `selection-slot` | 31.5 kB | 10.2 kB | 8.9 kB |
|
|
181
186
|
| `separator` | 36.9 kB | 11.9 kB | 10.5 kB |
|
|
182
187
|
| `settings-list` | 31.1 kB | 9.9 kB | 8.7 kB |
|
|
183
|
-
| `sheet` | 213.
|
|
184
|
-
| `sidebar` | 251.1 kB | 85.
|
|
188
|
+
| `sheet` | 213.2 kB | 72.9 kB | 63.1 kB |
|
|
189
|
+
| `sidebar` | 251.1 kB | 85.7 kB | 72.8 kB |
|
|
185
190
|
| `skeleton` | 35.1 kB | 11.5 kB | 10.1 kB |
|
|
186
|
-
| `slider` | 83.6 kB | 29.5 kB |
|
|
187
|
-
| `spinner` | 36.5 kB | 11.6 kB | 10.
|
|
188
|
-
| `state-panel` |
|
|
191
|
+
| `slider` | 83.6 kB | 29.5 kB | 26.0 kB |
|
|
192
|
+
| `spinner` | 36.5 kB | 11.6 kB | 10.2 kB |
|
|
193
|
+
| `state-panel` | 552.5 kB | 180.4 kB | 149.2 kB |
|
|
189
194
|
| `state-sample` | 33.5 kB | 10.5 kB | 9.2 kB |
|
|
190
|
-
| `switch` | 50.
|
|
191
|
-
| `table` |
|
|
195
|
+
| `switch` | 50.2 kB | 17.3 kB | 15.4 kB |
|
|
196
|
+
| `table` | 541.1 kB | 173.1 kB | 145.7 kB |
|
|
192
197
|
| `table-nuqs` | 2.1 kB | 1.1 kB | 1.0 kB |
|
|
193
|
-
| `tabs` | 80.
|
|
194
|
-
| `textarea` | 98.2 kB | 34.2 kB | 29.
|
|
195
|
-
| `toast` | 189.
|
|
198
|
+
| `tabs` | 80.3 kB | 27.6 kB | 24.4 kB |
|
|
199
|
+
| `textarea` | 98.2 kB | 34.2 kB | 29.6 kB |
|
|
200
|
+
| `toast` | 189.3 kB | 65.1 kB | 56.6 kB |
|
|
196
201
|
| `toggle` | 46.1 kB | 15.7 kB | 13.8 kB |
|
|
197
|
-
| `toggle-group` | 67.1 kB | 23.0 kB | 20.
|
|
198
|
-
| `tool-activity` | 86.
|
|
199
|
-
| `toolbar-status` | 189.
|
|
202
|
+
| `toggle-group` | 67.1 kB | 23.0 kB | 20.4 kB |
|
|
203
|
+
| `tool-activity` | 86.5 kB | 29.1 kB | 25.1 kB |
|
|
204
|
+
| `toolbar-status` | 189.1 kB | 64.2 kB | 55.4 kB |
|
|
200
205
|
| `tooltip` | 164.7 kB | 56.7 kB | 49.4 kB |
|
|
201
206
|
| `typed-text` | 31.2 kB | 10.1 kB | 8.8 kB |
|
|
207
|
+
| `view-switcher` | 270.0 kB | 90.6 kB | 77.0 kB |
|
|
202
208
|
|
|
203
209
|
</details>
|
|
204
210
|
<!-- bundle-size:end -->
|
|
@@ -210,9 +216,9 @@ CI compares sizes on each pull request. Run `pnpm size` to see them locally.
|
|
|
210
216
|
| **Actions** | Button · Button Group · Toggle · Toggle Group · Toolbar Status · Kbd |
|
|
211
217
|
| **Forms** | Field · Form · Label · Input · Input Group · Input OTP · Textarea · Checkbox · Radio Group · Switch · Slider · Select · Combobox · Choice List · Calendar · Search Field · Rich Text Editor · Mention List · Questionnaire · Selection Slot · Reasoning Effort |
|
|
212
218
|
| **Overlays** | Dialog · Alert Dialog · Sheet · Popover · Hover Card · Tooltip · Dropdown Menu · Context Menu · Menubar · Command · Search Dialog · Toast |
|
|
213
|
-
| **Layout & navigation** | Sidebar · Navigation Menu · Breadcrumb · Pagination · Tabs · Accordion · Collapsible · Page Header · Page Content · Settings List · Card · Carousel · Resizable · Scroll Area · Separator · Aspect Ratio · Direction · Canvas
|
|
219
|
+
| **Layout & navigation** | Sidebar · Navigation Menu · Breadcrumb · Pagination · Tabs · View Switcher · Accordion · Collapsible · Page Header · Page Content · Settings List · Card · Carousel · Resizable · Scroll Area · Separator · Aspect Ratio · Direction · Canvas |
|
|
214
220
|
| **Feedback** | Alert · Notice Banner · Badge · Progress · Spinner · Skeleton · State Panel · State Sample |
|
|
215
|
-
| **Data display** | Table · Chart · Code Block · File Viewer · Schema Diagram · Avatar · Brand Icon · Attachment · Typed Text · Gradient Banner · Glass Banner
|
|
221
|
+
| **Data display** | Table · Chart · Code Block · File Viewer · Schema Diagram · Avatar · Agent Avatar · Brand Icon · Attachment · Typed Text · Gradient Banner · Glass Banner |
|
|
216
222
|
| **Agents & chat** | Message · Message Actions · Message Response · Message Scroller · Chat Confirmation · Chat Plan · Chat Sources · Plan Outline · Prompt List · Result Card · Review Card · Tool Activity |
|
|
217
223
|
|
|
218
224
|
## Theming
|
|
@@ -229,7 +235,7 @@ Presets live in `@tulipfarm/sprout/themes/*`: `neutral`, `tulipfarm`, `github`,
|
|
|
229
235
|
`linear`, `vercel`, `stripe`, `notion`, and more.
|
|
230
236
|
|
|
231
237
|
```css
|
|
232
|
-
@import
|
|
238
|
+
@import '@tulipfarm/sprout/themes/tulipfarm.css';
|
|
233
239
|
```
|
|
234
240
|
|
|
235
241
|
### shadcn
|
|
@@ -248,11 +254,12 @@ pnpm dev # docs and live examples at http://localhost:4321
|
|
|
248
254
|
```
|
|
249
255
|
|
|
250
256
|
After you change package code, run `pnpm --filter @tulipfarm/sprout build`.
|
|
257
|
+
After you change agent avatar artwork in `packages/sprout/artwork/agent-avatars`, run `pnpm avatars`.
|
|
251
258
|
|
|
252
259
|
```sh
|
|
253
260
|
pnpm build
|
|
254
261
|
pnpm typecheck
|
|
255
|
-
pnpm format
|
|
262
|
+
pnpm lint # Oxfmt check and Oxlint; `pnpm format` fixes formatting
|
|
256
263
|
pnpm test
|
|
257
264
|
pnpm exec playwright install chromium
|
|
258
265
|
pnpm test:browser
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordion as BaseAccordion } from
|
|
1
|
+
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
2
2
|
export declare const accordionTriggerVariantNames: readonly ["default", "quiet"];
|
|
3
3
|
export type AccordionTriggerVariant = (typeof accordionTriggerVariantNames)[number];
|
|
4
4
|
export type AccordionProps<Value = any> = BaseAccordion.Root.Props<Value>;
|
|
@@ -20,7 +20,7 @@ export interface AccordionTriggerProps extends BaseAccordion.Trigger.Props {
|
|
|
20
20
|
}
|
|
21
21
|
/** The heading button that opens and closes its section. */
|
|
22
22
|
export declare function AccordionTrigger({ className, children, variant, ...props }: AccordionTriggerProps): import("react").JSX.Element;
|
|
23
|
-
export interface AccordionContentProps extends Omit<BaseAccordion.Panel.Props,
|
|
23
|
+
export interface AccordionContentProps extends Omit<BaseAccordion.Panel.Props, 'className'> {
|
|
24
24
|
/** Classes for the padded inner box that holds the content. */
|
|
25
25
|
className?: string;
|
|
26
26
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Accordion as BaseAccordion } from
|
|
4
|
-
import { ChevronDown } from
|
|
5
|
-
import { cn, stateClassName } from
|
|
6
|
-
export const accordionTriggerVariantNames = [
|
|
3
|
+
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
4
|
+
import { ChevronDown } from 'reicon-react/icons/ChevronDown';
|
|
5
|
+
import { cn, stateClassName } from '../internal/classes.js';
|
|
6
|
+
export const accordionTriggerVariantNames = ['default', 'quiet'];
|
|
7
7
|
/**
|
|
8
8
|
* A stack of sections that open in place. One section opens at a time unless
|
|
9
9
|
* you pass `multiple`. Pass `value` and `onValueChange` to control which
|
|
10
10
|
* sections are open, or `defaultValue` to let it manage itself.
|
|
11
11
|
*/
|
|
12
12
|
export function Accordion({ className, ...props }) {
|
|
13
|
-
return (_jsx(BaseAccordion.Root, { "data-slot": "accordion", ...props, className: stateClassName(
|
|
13
|
+
return (_jsx(BaseAccordion.Root, { "data-slot": "accordion", ...props, className: stateClassName('sprout-accordion', className) }));
|
|
14
14
|
}
|
|
15
15
|
/** One section. Give it a `value` to open it by default or to control it. */
|
|
16
16
|
export function AccordionItem({ className, ...props }) {
|
|
17
|
-
return (_jsx(BaseAccordion.Item, { "data-slot": "accordion-item", ...props, className: stateClassName(
|
|
17
|
+
return (_jsx(BaseAccordion.Item, { "data-slot": "accordion-item", ...props, className: stateClassName('sprout-accordion-item', className) }));
|
|
18
18
|
}
|
|
19
19
|
/** The heading button that opens and closes its section. */
|
|
20
|
-
export function AccordionTrigger({ className, children, variant =
|
|
20
|
+
export function AccordionTrigger({ className, children, variant = 'default', ...props }) {
|
|
21
21
|
return (_jsx(BaseAccordion.Header, { "data-slot": "accordion-header", className: "sprout-accordion-header", children: _jsxs(BaseAccordion.Trigger, { "data-slot": "accordion-trigger", "data-variant": variant, ...props, className: stateClassName(`sprout-accordion-trigger sprout-accordion-trigger-${variant}`, className), children: [children, _jsx(ChevronDown, { size: 16, "aria-hidden": "true", "data-slot": "accordion-trigger-icon", className: "sprout-accordion-trigger-icon" })] }) }));
|
|
22
22
|
}
|
|
23
23
|
/** The section body. It grows open and shrinks closed. */
|
|
24
24
|
export function AccordionContent({ className, children, ...props }) {
|
|
25
|
-
return (_jsx(BaseAccordion.Panel, { "data-slot": "accordion-content", ...props, className: "sprout-accordion-content", children: _jsx("div", { className: cn(
|
|
25
|
+
return (_jsx(BaseAccordion.Panel, { "data-slot": "accordion-content", ...props, className: "sprout-accordion-content", children: _jsx("div", { className: cn('sprout-accordion-content-inner', className), children: children }) }));
|
|
26
26
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { colors, objects } from '../internal/agent-avatar-artwork.js';
|
|
2
|
+
import { type AvatarProps } from './avatar.js';
|
|
3
|
+
export type AgentAvatarObject = (typeof objects)[number];
|
|
4
|
+
export type AgentAvatarColor = (typeof colors)[number];
|
|
5
|
+
export declare const agentAvatarObjects: readonly AgentAvatarObject[];
|
|
6
|
+
export declare const agentAvatarColors: readonly AgentAvatarColor[];
|
|
7
|
+
/** A `data:` URL for one object in one color. Needs no network. */
|
|
8
|
+
export declare function agentAvatarArtwork(object: AgentAvatarObject, color: AgentAvatarColor): string;
|
|
9
|
+
/** The stable object and color for an agent, and its artwork. */
|
|
10
|
+
export declare function agentAvatar(agentId: string): {
|
|
11
|
+
object: "sprout" | "tulip" | "tulip-bouquet" | "cactus" | "sunflower" | "daisy" | "bonsai" | "monstera" | "fern" | "lavender" | "rose" | "poppy" | "daffodil" | "lily" | "bellflower" | "eucalyptus" | "ivy" | "succulent" | "acorn" | "pinecone" | "watering-can" | "hand-trowel" | "garden-fork" | "pruning-shears" | "gardening-gloves" | "rain-boots" | "wheelbarrow" | "seed-packet" | "flower-pot" | "plant-mister" | "spade" | "rake" | "hoe" | "garden-hose" | "seed-tray" | "garden-apron" | "plant-label" | "twine-spool" | "compost-bin" | "pruning-saw" | "mushroom" | "strawberry" | "carrot" | "pumpkin" | "apple" | "pear" | "lemon" | "corn-cob" | "honey-jar" | "harvest-basket" | "windmill" | "barn" | "tractor" | "wheat" | "pea-pod" | "beetroot" | "radish" | "eggplant" | "cherries" | "hay-bale" | "umbrella" | "mug" | "teapot" | "moka-pot" | "lantern" | "candle" | "picnic-basket" | "straw-hat" | "vase" | "jam-jar" | "birdhouse" | "rocking-chair" | "kettle" | "bread-loaf" | "croissant" | "milk-bottle" | "cookie" | "oven-mitt" | "thermos" | "yarn-ball" | "notebook" | "pencil" | "paintbrush" | "paint-palette" | "fountain-pen" | "camera" | "headphones" | "desk-lamp" | "book-stack" | "alarm-clock" | "scissors" | "ruler" | "stapler" | "paperclip" | "binder-clip" | "tape-dispenser" | "magnifying-glass" | "envelope" | "typewriter" | "globe";
|
|
12
|
+
color: "pink" | "coral" | "orange" | "yellow" | "green" | "teal" | "blue" | "purple";
|
|
13
|
+
src: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function agentAvatarSrc(agentId: string): string;
|
|
16
|
+
export interface AgentAvatarProps extends Omit<AvatarProps, 'children'> {
|
|
17
|
+
agentId: string;
|
|
18
|
+
/** The agent's name. Its first letter shows if a custom `src` fails. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Overrides the object derived from `agentId`. */
|
|
21
|
+
object?: AgentAvatarObject | undefined;
|
|
22
|
+
/** Overrides the color derived from `agentId`. */
|
|
23
|
+
color?: AgentAvatarColor | undefined;
|
|
24
|
+
/** Your own artwork instead of the built-in collection. */
|
|
25
|
+
src?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function AgentAvatar({ agentId, name, object, color, src, ...props }: AgentAvatarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { artwork, colors, objects, palettes } from '../internal/agent-avatar-artwork.js';
|
|
4
|
+
import { hash } from '../internal/hash.js';
|
|
5
|
+
import { Avatar, AvatarFallback, AvatarImage } from './avatar.js';
|
|
6
|
+
export const agentAvatarObjects = objects;
|
|
7
|
+
export const agentAvatarColors = colors;
|
|
8
|
+
function grain(seed) {
|
|
9
|
+
let state = seed;
|
|
10
|
+
const coordinate = () => {
|
|
11
|
+
state = (Math.imul(state, 1664525) + 1013904223) >>> 0;
|
|
12
|
+
return ((state / 2 ** 32) * 31).toFixed(2);
|
|
13
|
+
};
|
|
14
|
+
return Array.from({ length: 96 }, () => `M${coordinate()} ${coordinate()}h.55v.55h-.55z`).join('');
|
|
15
|
+
}
|
|
16
|
+
let finish;
|
|
17
|
+
// The circle with a faint diagonal wash and fixed-seed grain, shared by every object.
|
|
18
|
+
function background() {
|
|
19
|
+
const circle = '<circle cx="128" cy="128" r="120"';
|
|
20
|
+
finish ??=
|
|
21
|
+
'<defs><linearGradient id="tf-background-wash" x2="1" y2="1">' +
|
|
22
|
+
'<stop stop-color="#0000a5" stop-opacity=".08"/><stop offset="1" stop-color="#0000a2" stop-opacity=".08"/>' +
|
|
23
|
+
'</linearGradient><pattern id="tf-background-grain" width="32" height="32" patternUnits="userSpaceOnUse">' +
|
|
24
|
+
`<path d="${grain(19)}" fill="#0000a2" opacity=".1"/><path d="${grain(73)}" fill="#0000a5" opacity=".09"/>` +
|
|
25
|
+
`</pattern></defs>${circle} fill="#0000a1"/>${circle} fill="url(#tf-background-wash)"/>` +
|
|
26
|
+
`${circle} fill="url(#tf-background-grain)"/>`;
|
|
27
|
+
return finish;
|
|
28
|
+
}
|
|
29
|
+
const cache = new Map();
|
|
30
|
+
/** A `data:` URL for one object in one color. Needs no network. */
|
|
31
|
+
export function agentAvatarArtwork(object, color) {
|
|
32
|
+
const key = `${object}/${color}`;
|
|
33
|
+
let src = cache.get(key);
|
|
34
|
+
if (src === undefined) {
|
|
35
|
+
const index = objects.indexOf(object);
|
|
36
|
+
const palette = palettes[colors.indexOf(color)];
|
|
37
|
+
if (index < 0 || palette === undefined)
|
|
38
|
+
throw new Error(`Unknown agent avatar: ${key}`);
|
|
39
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">' +
|
|
40
|
+
artwork[index].replace('$', background()).replace(/#0000a([1-7])/g, (_, role) => palette[Number(role) - 1]) +
|
|
41
|
+
'</svg>';
|
|
42
|
+
src = `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
43
|
+
cache.set(key, src);
|
|
44
|
+
}
|
|
45
|
+
return src;
|
|
46
|
+
}
|
|
47
|
+
/** The stable object and color for an agent, and its artwork. */
|
|
48
|
+
export function agentAvatar(agentId) {
|
|
49
|
+
const h = hash(agentId);
|
|
50
|
+
const object = objects[h % objects.length];
|
|
51
|
+
const color = colors[(h >>> 16) % colors.length];
|
|
52
|
+
return { object, color, src: agentAvatarArtwork(object, color) };
|
|
53
|
+
}
|
|
54
|
+
export function agentAvatarSrc(agentId) {
|
|
55
|
+
return agentAvatar(agentId).src;
|
|
56
|
+
}
|
|
57
|
+
function initial(name) {
|
|
58
|
+
return name.trim().charAt(0).toUpperCase() || '?';
|
|
59
|
+
}
|
|
60
|
+
export function AgentAvatar({ agentId, name, object, color, src, ...props }) {
|
|
61
|
+
let art;
|
|
62
|
+
if (src === undefined) {
|
|
63
|
+
const derived = agentAvatar(agentId);
|
|
64
|
+
art = agentAvatarArtwork(object ?? derived.object, color ?? derived.color);
|
|
65
|
+
}
|
|
66
|
+
return (_jsx(Avatar, { "data-agent-avatar": "", ...props, children: art === undefined ? (_jsxs(_Fragment, { children: [_jsx(AvatarImage, { src: src, alt: "" }), _jsx(AvatarFallback, { children: initial(name) })] })) : (_jsx("img", { "data-slot": "avatar-image", className: "sprout-avatar-image", src: art, alt: "", draggable: false })) }));
|
|
67
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
export declare const agentFanoutStatusNames: readonly ["queued", "working", "done", "failed", "stopped"];
|
|
3
3
|
export declare const agentFanoutStateNames: readonly ["running", "done", "stopped"];
|
|
4
4
|
export type AgentFanoutStatus = (typeof agentFanoutStatusNames)[number];
|
|
@@ -15,7 +15,7 @@ export interface AgentFanoutAgent {
|
|
|
15
15
|
status: AgentFanoutStatus;
|
|
16
16
|
/** How long the subagent took, in ms. Shown once it is done. */
|
|
17
17
|
duration?: number | undefined;
|
|
18
|
-
/** Any CSS color. Defaults to the next of
|
|
18
|
+
/** Any CSS color. Defaults to the next of ten `--sprout-chart-*` colors. */
|
|
19
19
|
color?: string | undefined;
|
|
20
20
|
/** Subagents this agent calls in turn. They take its color. */
|
|
21
21
|
agents?: AgentFanoutAgent[] | undefined;
|