@flikk/ui 1.0.0-beta.14 → 1.0.0-beta.16
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 +52 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +3 -1
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +4 -4
- package/dist/components/ai/StreamingResponse/AnimatedText.js +3 -3
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +22 -22
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +1 -1
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +10 -10
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +9 -3
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +1 -1
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +11 -11
- package/dist/components/ai/index.d.ts +0 -7
- package/dist/components/ai/index.js +8 -6
- package/dist/components/charts/DonutChart/DonutChart.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.js +1 -1
- package/dist/components/charts/shared/ChartLegend/ChartLegend.types.d.ts +13 -1
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.js +1 -1
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.types.d.ts +13 -2
- package/dist/components/core/Accordion/AccordionItem.js +1 -1
- package/dist/components/core/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -0
- package/dist/components/core/Alert/Alert.animations.js +44 -0
- package/dist/components/core/Alert/Alert.js +16 -3
- package/dist/components/core/Avatar/Avatar.js +12 -7
- package/dist/components/core/Avatar/Avatar.theme.d.ts +4 -6
- package/dist/components/core/Avatar/Avatar.theme.js +22 -12
- package/dist/components/core/Avatar/Avatar.types.d.ts +9 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.js +2 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.js +1 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +1 -1
- package/dist/components/core/Badge/Badge.animations.js +1 -1
- package/dist/components/core/Badge/Badge.js +23 -47
- package/dist/components/core/Badge/Badge.theme.js +48 -62
- package/dist/components/core/Badge/Badge.types.d.ts +5 -29
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.theme.js +2 -2
- package/dist/components/core/ButtonGroup/ButtonGroup.theme.js +6 -6
- package/dist/components/core/ButtonGroup/ButtonGroupText.js +1 -3
- package/dist/components/core/Calendar/Calendar.js +29 -3
- package/dist/components/core/Calendar/Calendar.theme.js +11 -7
- package/dist/components/core/Calendar/Calendar.types.d.ts +3 -0
- package/dist/components/core/Carousel/CarouselBody.js +0 -1
- package/dist/components/core/CommandPalette/CommandItem.js +1 -1
- package/dist/components/core/CommandPalette/CommandPalette.js +6 -4
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +1 -0
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +6 -0
- package/dist/components/core/ContextMenu/ContextMenu.js +5 -4
- package/dist/components/core/ContextMenu/ContextMenuTrigger.js +5 -6
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +25 -2
- package/dist/components/core/Drawer/Drawer.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.types.d.ts +6 -0
- package/dist/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.js +5 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +1 -0
- package/dist/components/core/Dropdown/DropdownItem.js +1 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +4 -4
- package/dist/components/core/Dropdown/DropdownSection.js +1 -1
- package/dist/components/core/Dropdown/DropdownSeparator.js +1 -1
- package/dist/components/core/Dropdown/DropdownTrigger.d.ts +6 -1
- package/dist/components/core/Dropdown/DropdownTrigger.js +10 -8
- package/dist/components/core/Kbd/Kbd.theme.js +3 -3
- package/dist/components/core/Link/Link.js +3 -1
- package/dist/components/core/Message/Message.d.ts +9 -0
- package/dist/components/core/Message/Message.js +44 -3
- package/dist/components/core/Message/Message.theme.js +22 -0
- package/dist/components/core/Message/Message.types.d.ts +115 -0
- package/dist/components/core/Message/MessageAudio.d.ts +8 -0
- package/dist/components/core/Message/MessageAudio.js +11 -0
- package/dist/components/core/Message/MessageContext.d.ts +3 -1
- package/dist/components/core/Message/MessageDateDivider.d.ts +6 -0
- package/dist/components/core/Message/MessageDateDivider.js +10 -0
- package/dist/components/core/Message/MessageFile.d.ts +9 -0
- package/dist/components/core/Message/MessageFile.js +15 -0
- package/dist/components/core/Message/MessageImage.d.ts +11 -0
- package/dist/components/core/Message/MessageImage.js +13 -0
- package/dist/components/core/Message/MessageLink.d.ts +10 -0
- package/dist/components/core/Message/MessageLink.js +15 -0
- package/dist/components/core/Message/MessageReactions.d.ts +8 -0
- package/dist/components/core/Message/MessageReactions.js +12 -0
- package/dist/components/core/Message/MessageReply.d.ts +8 -0
- package/dist/components/core/Message/MessageReply.js +10 -0
- package/dist/components/core/Message/MessageSenderName.d.ts +6 -0
- package/dist/components/core/Message/MessageSenderName.js +10 -0
- package/dist/components/core/Message/MessageStatusIndicator.d.ts +9 -0
- package/dist/components/core/Message/MessageStatusIndicator.js +45 -0
- package/dist/components/core/Message/index.d.ts +19 -1
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -0
- package/dist/components/core/Modal/Modal.animations.js +14 -11
- package/dist/components/core/Pagination/Pagination.theme.js +1 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/PopoverBody.js +2 -2
- package/dist/components/core/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/core/Popover/PopoverTrigger.js +11 -11
- package/dist/components/core/Progress/Progress.d.ts +9 -8
- package/dist/components/core/Progress/Progress.js +16 -16
- package/dist/components/core/Progress/Progress.theme.js +4 -15
- package/dist/components/core/Progress/Progress.types.d.ts +2 -20
- package/dist/components/core/Progress/index.d.ts +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +49 -7
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -3
- package/dist/components/core/ScrollArea/index.d.ts +1 -1
- package/dist/components/core/Segmented/SegmentedItem.js +1 -1
- package/dist/components/core/Sidebar/Sidebar.js +2 -1
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +2 -1
- package/dist/components/core/Sidebar/SidebarToggle.js +2 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.js +1 -1
- package/dist/components/core/SocialIcon/SocialIcon.js +1 -1
- package/dist/components/core/Sortable/Sortable.js +2 -2
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Sortable/Sortable.types.d.ts +7 -5
- package/dist/components/core/Tabs/TabsBody.js +1 -1
- package/dist/components/core/Tabs/TabsTrigger.js +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Toast/Toast.d.ts +2 -2
- package/dist/components/core/Toast/Toast.js +30 -21
- package/dist/components/core/Toast/Toast.theme.js +4 -9
- package/dist/components/core/Toast/Toast.types.d.ts +4 -21
- package/dist/components/core/Toast/index.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/index.js +9 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +2 -2
- package/dist/components/data-display/Table/Table.types.d.ts +8 -8
- package/dist/components/effects/CustomCursor/CustomCursor.js +2 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +1 -1
- package/dist/components/effects/GlassSurface/GlassSurface.js +17 -9
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +6 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.d.ts +39 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.js +98 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.js +104 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.types.d.ts +30 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.js +37 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.d.ts +14 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.js +41 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.d.ts +25 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.js +84 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.d.ts +18 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.js +35 -0
- package/dist/components/effects/InteractiveCharacters/index.d.ts +2 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +1 -1
- package/dist/components/effects/MorphingText/MorphingText.js +6 -5
- package/dist/components/effects/Neumorphic/InsetCircleButton.d.ts +10 -0
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +10 -0
- package/dist/components/effects/Neumorphic/InsetPill.d.ts +8 -0
- package/dist/components/effects/Neumorphic/InsetPill.js +7 -0
- package/dist/components/effects/Neumorphic/index.d.ts +4 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.d.ts +1 -1
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.js +4 -4
- package/dist/components/effects/Overlay/Overlay.js +6 -4
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +8 -0
- package/dist/components/effects/PageTransition/PageTransition.animations.js +53 -0
- package/dist/components/effects/PageTransition/PageTransition.d.ts +3 -0
- package/dist/components/effects/PageTransition/PageTransition.js +71 -0
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +15 -0
- package/dist/components/effects/PageTransition/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +6 -0
- package/dist/components/effects/index.js +4 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.d.ts +14 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.js +53 -0
- package/dist/components/forms/Checkbox/Checkbox.js +4 -2
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPicker.types.d.ts +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerBody.js +3 -3
- package/dist/components/forms/Combobox/Combobox.js +5 -3
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePicker.animations.d.ts +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.d.ts +37 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.js +110 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +52 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +154 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +208 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.js +41 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +32 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.js +59 -0
- package/dist/components/forms/DateRangePicker/index.d.ts +4 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.d.ts +36 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.js +22 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.d.ts +3 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.js +111 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.d.ts +19 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +27 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.types.d.ts +33 -0
- package/dist/components/forms/FileUpload/index.d.ts +3 -0
- package/dist/components/forms/Input/Input.js +8 -13
- package/dist/components/forms/Input/Input.types.d.ts +6 -0
- package/dist/components/forms/InputAddress/InputAddress.theme.js +1 -1
- package/dist/components/forms/InputCounter/InputCounter.js +1 -1
- package/dist/components/forms/InputCreditCard/InputCreditCard.theme.js +1 -1
- package/dist/components/forms/InputOTP/InputOTP.theme.js +1 -1
- package/dist/components/forms/Radio/Radio.animations.d.ts +10 -0
- package/dist/components/forms/Radio/Radio.animations.js +33 -0
- package/dist/components/forms/Radio/Radio.js +11 -2
- package/dist/components/forms/Radio/Radio.theme.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +13 -4
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +11 -0
- package/dist/components/forms/Select/Select.d.ts +1 -1
- package/dist/components/forms/Select/Select.js +7 -7
- package/dist/components/forms/Select/Select.types.d.ts +3 -3
- package/dist/components/forms/SelectableCard/SelectableCard.js +1 -1
- package/dist/components/forms/Slider/Slider.js +10 -3
- package/dist/components/forms/Slider/Slider.theme.js +3 -3
- package/dist/components/forms/Switch/Switch.js +10 -2
- package/dist/components/forms/Switch/Switch.theme.js +3 -3
- package/dist/components/forms/forms.theme.js +1 -1
- package/dist/components/forms/index.d.ts +6 -3
- package/dist/components/forms/index.js +8 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useMediaQuery.d.ts +5 -0
- package/dist/hooks/useMediaQuery.js +21 -0
- package/dist/index.js +21 -2
- package/dist/styles.css +1 -1
- package/dist/utils/dateUtils.js +56 -5
- package/dist/utils/formatUtils.d.ts +10 -0
- package/dist/utils/formatUtils.js +24 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +12 -4
- package/src/global.scss +319 -39
- package/src/styles/theme.css +105 -16
- package/src/theme-plugin.css +13 -0
- package/dist/components/ai/ApprovalCard/ApprovalCard.d.ts +0 -3
- package/dist/components/ai/ApprovalCard/ApprovalCard.js +0 -16
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.d.ts +0 -13
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.js +0 -15
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +0 -43
- package/dist/components/ai/ApprovalCard/index.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.d.ts +0 -18
- package/dist/components/ai/MessageHistory/MessageHistory.js +0 -98
- package/dist/components/ai/MessageHistory/MessageHistory.theme.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.theme.js +0 -8
- package/dist/components/ai/MessageHistory/MessageHistory.types.d.ts +0 -94
- package/dist/components/ai/MessageHistory/index.d.ts +0 -3
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.animations.d.ts +0 -10
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.animations.js +0 -47
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.d.ts +0 -20
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.js +0 -55
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.theme.d.ts +0 -2
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.theme.js +0 -20
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.types.d.ts +0 -67
- package/dist/components/ai/ThinkingIndicator/index.d.ts +0 -3
- package/dist/components/forms/TransferList/TransferList.animations.d.ts +0 -10
- package/dist/components/forms/TransferList/TransferList.animations.js +0 -32
- package/dist/components/forms/TransferList/TransferList.d.ts +0 -28
- package/dist/components/forms/TransferList/TransferList.js +0 -199
- package/dist/components/forms/TransferList/TransferList.theme.d.ts +0 -6
- package/dist/components/forms/TransferList/TransferList.theme.js +0 -60
- package/dist/components/forms/TransferList/TransferList.types.d.ts +0 -101
- package/dist/components/forms/TransferList/index.d.ts +0 -3
- package/dist/icons/Icon.d.ts +0 -24
- package/dist/icons/Icon.js +0 -30
- package/dist/icons/Index.d.ts +0 -16
- package/dist/icons/core/ChevronUpDown.d.ts +0 -1
- package/dist/icons/core/ChevronUpDown.js +0 -7
- package/dist/icons/core/DollarIcon.d.ts +0 -1
- package/dist/icons/core/DollarIcon.js +0 -5
- package/dist/icons/core/LockIcon.d.ts +0 -1
- package/dist/icons/core/LockIcon.js +0 -5
- package/dist/icons/core/MinusIcon.d.ts +0 -1
- package/dist/icons/core/MinusIcon.js +0 -7
- package/dist/icons/core/PlusIcon.d.ts +0 -1
- package/dist/icons/core/PlusIcon.js +0 -7
- package/dist/icons/core/SearchIcon.d.ts +0 -1
- package/dist/icons/core/SearchIcon.js +0 -7
- package/dist/icons/core/TickIcon.d.ts +0 -1
- package/dist/icons/core/TickIcon.js +0 -5
- package/dist/icons/core/User.d.ts +0 -1
- package/dist/utils/useClickOutside.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
1
|
# Flikkui
|
|
2
|
+
|
|
3
|
+
A modern React component library built with TypeScript, Tailwind CSS v4, and Framer Motion. 150+ components following the shadcn philosophy with complete `className` override support.
|
|
4
|
+
|
|
5
|
+
## MCP Server
|
|
6
|
+
|
|
7
|
+
Flikkui ships with an MCP (Model Context Protocol) server that gives AI coding tools full knowledge of the component library — component APIs, props, theme tokens, and code generation.
|
|
8
|
+
|
|
9
|
+
### What It Does
|
|
10
|
+
|
|
11
|
+
| Tool | Description |
|
|
12
|
+
|------|-------------|
|
|
13
|
+
| `get_component` | Look up any component's full API — props, types, sub-components, theme tokens, and code examples |
|
|
14
|
+
| `search_components` | Find components by name, category (`core`, `forms`, `charts`, etc.), or pattern type (`compound`, `simple`, etc.) |
|
|
15
|
+
| `get_theme_tokens` | Get all CSS variables with correct Tailwind syntax (`bg-[var(--color-primary)]`) |
|
|
16
|
+
| `generate_code` | Generate production-ready Flikkui code from a description |
|
|
17
|
+
|
|
18
|
+
### Setup for Claude Code
|
|
19
|
+
|
|
20
|
+
Add the following to your project's `.mcp.json`:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"flikkui": {
|
|
26
|
+
"command": "npx",
|
|
27
|
+
"args": ["@flikk/mcp"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or if you're working from a local clone of this repo:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"flikkui": {
|
|
39
|
+
"command": "node",
|
|
40
|
+
"args": ["./packages/mcp/dist/index.js"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Building from Source
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd packages/mcp
|
|
50
|
+
npm install
|
|
51
|
+
npm run extract # Parse component source files into registry.json
|
|
52
|
+
npm run build # Compile TypeScript
|
|
53
|
+
```
|
|
@@ -7,7 +7,7 @@ const codeBlockTheme = {
|
|
|
7
7
|
languageLabel: "text-sm uppercase tracking-wider font-semibold text-[var(--color-text-muted)]",
|
|
8
8
|
codeWrapper: "overflow-x-auto",
|
|
9
9
|
lineNumber: "text-[var(--color-text-muted)] select-none text-right tabular-nums min-w-[2.5rem] pr-4 opacity-50",
|
|
10
|
-
highlightedLine: " -mx-4 px-4 bg-[var(--color-primary-50)] border-l-2 border-l-[var(--color-primary)] dark:bg-neutral-400/5 dark:border-l-neutral-200",
|
|
10
|
+
highlightedLine: " -mx-4 px-4 bg-[var(--color-primary-50)] border-l-2 border-l-[var(--color-primary)] dark:bg-[var(--color-neutral-400)]/5 dark:border-l-[var(--color-neutral-200)]",
|
|
11
11
|
diffAddition: "-mx-4 px-4 bg-[var(--color-success-50)] border-l-4 border-l-[var(--color-success)] dark:bg-[var(--color-success-600)]/20 dark:border-l-[var(--color-success-700)]",
|
|
12
12
|
diffDeletion: "-mx-4 px-4 bg-[var(--color-danger-50)] border-l-4 border-l-[var(--color-danger)] dark:bg-[var(--color-danger-600)]/20 dark:border-l-[var(--color-danger-700)]",
|
|
13
13
|
copyButton: "p-1.5 rounded-[calc(var(--radius-base)*0.75)] text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-background-tertiary)] transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
@@ -518,7 +518,9 @@ className, textareaClassName, footerClassName, theme = {},
|
|
|
518
518
|
e.target.value = "";
|
|
519
519
|
}, className: "sr-only", "aria-label": "Attach files" }), jsxs("div", { className: cn("relative", mergedTheme.baseStyle, mergedTheme.stateStyle, variant === "simple" ? "p-3 rounded-full pl-5" : ""), onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [jsx(AnimatePresence, { children: isDragOver && enableDropzone && (jsxs(motion.div, { variants: dropzoneContainerVariants, initial: "initial", animate: "animate", exit: "exit", className: mergedTheme.dropzoneStyle, children: [jsx(motion.div, { variants: dropzoneChildVariants, children: jsx(CloudArrowUpIcon, { className: "size-8 text-[var(--color-primary)] mx-auto" }) }), jsx(motion.p, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneTitleStyle, children: dropzoneTitle ? (
|
|
520
520
|
// Parse **browse** as clickable button
|
|
521
|
-
jsx(Fragment, { children: resolvedDropzoneTitle
|
|
521
|
+
jsx(Fragment, { children: resolvedDropzoneTitle
|
|
522
|
+
.split(/\*\*(.*?)\*\*/)
|
|
523
|
+
.map((part, i) => i % 2 === 1 ? (jsx("button", { type: "button", onClick: handleDropzoneBrowse, className: "font-bold underline underline-offset-2 cursor-pointer hover:opacity-80", children: part }, i)) : (jsx("span", { children: part }, i))) })) : (resolvedDropzoneTitle) }), dropzoneSubtitle && (jsx(motion.p, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneSubtitleStyle, children: dropzoneSubtitle })), dropzoneTitle && (jsx(motion.div, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneActionsStyle, children: [
|
|
522
524
|
CloudArrowUpIcon,
|
|
523
525
|
MicrophoneIcon,
|
|
524
526
|
PaperClipIcon,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const promptSuggestionTheme = {
|
|
2
|
-
baseStyle: "inline-flex items-center gap-2 py-1 px-3 rounded-
|
|
3
|
-
"bg-
|
|
2
|
+
baseStyle: "inline-flex items-center gap-2 py-1 px-3 rounded-[var(--card-radius)] " +
|
|
3
|
+
"bg-[var(--color-surface)] " +
|
|
4
4
|
"border border-[var(--color-border)] " +
|
|
5
|
-
"text-base
|
|
5
|
+
"text-base text-[var(--color-text-primary)] " +
|
|
6
6
|
"cursor-pointer transition-all duration-300 " +
|
|
7
|
-
"hover:bg-[var(--color-background-secondary)]
|
|
7
|
+
"hover:bg-[var(--color-background-secondary)] " +
|
|
8
8
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
9
9
|
iconStyle: "size-4 flex-shrink-0",
|
|
10
10
|
};
|
|
@@ -17,7 +17,7 @@ const tokenize = (text) => {
|
|
|
17
17
|
* For performance, only the last N tokens are animated with motion.span,
|
|
18
18
|
* while older tokens are rendered as static text.
|
|
19
19
|
*/
|
|
20
|
-
const AnimatedText = ({ text, isStreaming, animateLastN =
|
|
20
|
+
const AnimatedText = ({ text, isStreaming, animateLastN = 12, enabled = true, className, }) => {
|
|
21
21
|
const shouldReduceMotion = useReducedMotion();
|
|
22
22
|
const animate = enabled && !shouldReduceMotion;
|
|
23
23
|
// Track which tokens have already been seen/animated
|
|
@@ -37,9 +37,9 @@ const AnimatedText = ({ text, isStreaming, animateLastN = 6, enabled = true, cla
|
|
|
37
37
|
const animatedTokens = tokens.slice(settledCount);
|
|
38
38
|
if (!animate || !isStreaming) {
|
|
39
39
|
// No animation: render plain text
|
|
40
|
-
return (jsx("p", { className: className || 'whitespace-pre-wrap break-
|
|
40
|
+
return (jsx("p", { className: className || 'whitespace-pre-wrap wrap-break-word', children: text }));
|
|
41
41
|
}
|
|
42
|
-
return (jsxs("p", { className: className || 'whitespace-pre-wrap break-
|
|
42
|
+
return (jsxs("p", { className: className || 'whitespace-pre-wrap wrap-break-word', children: [settledText, animatedTokens.map((token, i) => (jsx(motion.span, { variants: tokenFadeIn, initial: "hidden", animate: "visible", transition: tokenTransition, style: { display: 'inline' }, children: token }, `${settledCount + i}-${token}`)))] }));
|
|
43
43
|
};
|
|
44
44
|
AnimatedText.displayName = 'AnimatedText';
|
|
45
45
|
|
|
@@ -51,13 +51,13 @@ const SkipWords = ({ children }) => {
|
|
|
51
51
|
* Supports GitHub Flavored Markdown (tables, task lists, strikethrough, etc.)
|
|
52
52
|
* Animates individual words during streaming with a fade-in + blur effect
|
|
53
53
|
*/
|
|
54
|
-
const MarkdownRenderer = ({ content, options = {}, isStreaming = false, animated = true, showCursor = true, animateLastN =
|
|
54
|
+
const MarkdownRenderer = ({ content, options = {}, isStreaming = false, animated = true, showCursor = true, animateLastN = 12, }) => {
|
|
55
55
|
const { allowHtml = false, syntaxTheme = 'light', renderCodeBlock } = options;
|
|
56
56
|
const shouldReduceMotion = useReducedMotion();
|
|
57
57
|
const shouldAnimate = animated && isStreaming && !shouldReduceMotion;
|
|
58
58
|
// Append cursor character to content so it renders inline within the last element
|
|
59
59
|
const displayContent = isStreaming && showCursor
|
|
60
|
-
? content + '
|
|
60
|
+
? content + ' ▏'
|
|
61
61
|
: content;
|
|
62
62
|
const markdownComponents = useMemo(() => ({
|
|
63
63
|
// Code blocks with syntax highlighting
|
|
@@ -73,75 +73,75 @@ const MarkdownRenderer = ({ content, options = {}, isStreaming = false, animated
|
|
|
73
73
|
return (jsxs(AnimatedBlock, { animate: shouldAnimate, children: [jsx(SkipWords, { children: children }), jsx(Prism, { style: syntaxTheme === 'dark' ? oneDark : oneLight, language: language, PreTag: "div", className: "rounded-lg my-3", ...props, children: String(children).replace(/\n$/, '') })] }));
|
|
74
74
|
}
|
|
75
75
|
// Inline code — skip word animation for code tokens
|
|
76
|
-
return (jsxs(Fragment, { children: [jsx(SkipWords, { children: children }), jsx("code", { className: "bg-
|
|
76
|
+
return (jsxs(Fragment, { children: [jsx(SkipWords, { children: children }), jsx("code", { className: "bg-(--color-background-tertiary) text-(--color-primary) px-1.5 py-0.5 rounded text-base font-mono", ...props, children: children })] }));
|
|
77
77
|
},
|
|
78
78
|
// Paragraphs — word-level animation
|
|
79
79
|
p({ children }) {
|
|
80
|
-
return (jsx(AnimatedProse, { as: "p", className: "mb-3 last:mb-0 text-
|
|
80
|
+
return (jsx(AnimatedProse, { as: "p", className: "mb-3 last:mb-0 text-(--color-text-primary) leading-relaxed", children: children }));
|
|
81
81
|
},
|
|
82
82
|
// Headings — word-level animation
|
|
83
83
|
h1({ children }) {
|
|
84
|
-
return (jsx(AnimatedProse, { as: "h1", className: "text-2xl font-bold mb-4 text-
|
|
84
|
+
return (jsx(AnimatedProse, { as: "h1", className: "text-2xl font-bold mb-4 text-(--color-text-primary) border-b border-(--color-border) pb-2", children: children }));
|
|
85
85
|
},
|
|
86
86
|
h2({ children }) {
|
|
87
|
-
return (jsx(AnimatedProse, { as: "h2", className: "text-2xl font-bold mb-3 text-
|
|
87
|
+
return (jsx(AnimatedProse, { as: "h2", className: "text-2xl font-bold mb-3 text-(--color-text-primary) border-b border-(--color-border) pb-2", children: children }));
|
|
88
88
|
},
|
|
89
89
|
h3({ children }) {
|
|
90
|
-
return (jsx(AnimatedProse, { as: "h3", className: "text-xl font-semibold mb-2 text-
|
|
90
|
+
return (jsx(AnimatedProse, { as: "h3", className: "text-xl font-semibold mb-2 text-(--color-text-primary)", children: children }));
|
|
91
91
|
},
|
|
92
92
|
h4({ children }) {
|
|
93
|
-
return (jsx(AnimatedProse, { as: "h4", className: "text-lg font-semibold mb-2 text-
|
|
93
|
+
return (jsx(AnimatedProse, { as: "h4", className: "text-lg font-semibold mb-2 text-(--color-text-primary)", children: children }));
|
|
94
94
|
},
|
|
95
95
|
h5({ children }) {
|
|
96
|
-
return (jsx(AnimatedProse, { as: "h5", className: "text-base font-semibold mb-2 text-
|
|
96
|
+
return (jsx(AnimatedProse, { as: "h5", className: "text-base font-semibold mb-2 text-(--color-text-primary)", children: children }));
|
|
97
97
|
},
|
|
98
98
|
h6({ children }) {
|
|
99
|
-
return (jsx(AnimatedProse, { as: "h6", className: "text-base font-semibold mb-2 text-
|
|
99
|
+
return (jsx(AnimatedProse, { as: "h6", className: "text-base font-semibold mb-2 text-(--color-text-secondary)", children: children }));
|
|
100
100
|
},
|
|
101
101
|
// Lists — word-level animation on li
|
|
102
102
|
ul({ children }) {
|
|
103
|
-
return (jsx("ul", { className: "list-disc list-inside mb-3 space-y-1 text-
|
|
103
|
+
return (jsx("ul", { className: "list-disc list-inside mb-3 space-y-1 text-(--color-text-primary)", children: children }));
|
|
104
104
|
},
|
|
105
105
|
ol({ children }) {
|
|
106
|
-
return (jsx("ol", { className: "list-decimal list-inside mb-3 space-y-1 text-
|
|
106
|
+
return (jsx("ol", { className: "list-decimal list-inside mb-3 space-y-1 text-(--color-text-primary)", children: children }));
|
|
107
107
|
},
|
|
108
108
|
li({ children }) {
|
|
109
109
|
return (jsx(AnimatedProse, { as: "li", className: "ml-4", children: children }));
|
|
110
110
|
},
|
|
111
111
|
// Blockquotes — word-level animation
|
|
112
112
|
blockquote({ children }) {
|
|
113
|
-
return (jsx("blockquote", { className: "border-l-4 border-
|
|
113
|
+
return (jsx("blockquote", { className: "border-l-4 border-(--color-primary) pl-4 py-2 my-3 bg-(--color-background-secondary) italic text-(--color-text-secondary)", children: children }));
|
|
114
114
|
},
|
|
115
115
|
// Links
|
|
116
116
|
a({ href, children }) {
|
|
117
|
-
return (jsx("a", { href: href, className: "text-
|
|
117
|
+
return (jsx("a", { href: href, className: "text-(--color-primary) hover:text-(--color-primary-700) underline transition-colors", target: "_blank", rel: "noopener noreferrer", children: children }));
|
|
118
118
|
},
|
|
119
119
|
// Tables — block-level slide-in, skip word animation
|
|
120
120
|
table({ children }) {
|
|
121
|
-
return (jsxs(AnimatedBlock, { animate: shouldAnimate, children: [jsx(SkipWords, { children: children }), jsx("div", { className: "overflow-x-auto my-3", children: jsx("table", { className: "min-w-full border-collapse border border-
|
|
121
|
+
return (jsxs(AnimatedBlock, { animate: shouldAnimate, children: [jsx(SkipWords, { children: children }), jsx("div", { className: "overflow-x-auto my-3", children: jsx("table", { className: "min-w-full border-collapse border border-(--color-border)", children: children }) })] }));
|
|
122
122
|
},
|
|
123
123
|
thead({ children }) {
|
|
124
|
-
return jsx("thead", { className: "bg-
|
|
124
|
+
return jsx("thead", { className: "bg-(--color-background-secondary)", children: children });
|
|
125
125
|
},
|
|
126
126
|
tbody({ children }) {
|
|
127
127
|
return jsx("tbody", { children: children });
|
|
128
128
|
},
|
|
129
129
|
tr({ children }) {
|
|
130
|
-
return jsx("tr", { className: "border-b border-
|
|
130
|
+
return jsx("tr", { className: "border-b border-(--color-border)", children: children });
|
|
131
131
|
},
|
|
132
132
|
th({ children }) {
|
|
133
|
-
return (jsx("th", { className: "px-4 py-2 text-left font-semibold text-
|
|
133
|
+
return (jsx("th", { className: "px-4 py-2 text-left font-semibold text-(--color-text-primary) border border-(--color-border)", children: children }));
|
|
134
134
|
},
|
|
135
135
|
td({ children }) {
|
|
136
|
-
return (jsx("td", { className: "px-4 py-2 text-
|
|
136
|
+
return (jsx("td", { className: "px-4 py-2 text-(--color-text-primary) border border-(--color-border)", children: children }));
|
|
137
137
|
},
|
|
138
138
|
// Horizontal rule
|
|
139
139
|
hr() {
|
|
140
|
-
return jsx("hr", { className: "my-4 border-t border-
|
|
140
|
+
return jsx("hr", { className: "my-4 border-t border-(--color-border)" });
|
|
141
141
|
},
|
|
142
142
|
// Strong/Bold — pass through (word animation handles inline elements)
|
|
143
143
|
strong({ children }) {
|
|
144
|
-
return jsx("strong", { className: "font-semibold text-
|
|
144
|
+
return jsx("strong", { className: "font-semibold text-(--color-text-primary)", children: children });
|
|
145
145
|
},
|
|
146
146
|
// Emphasis/Italic
|
|
147
147
|
em({ children }) {
|
|
@@ -149,7 +149,7 @@ const MarkdownRenderer = ({ content, options = {}, isStreaming = false, animated
|
|
|
149
149
|
},
|
|
150
150
|
// Strikethrough (from remarkGfm)
|
|
151
151
|
del({ children }) {
|
|
152
|
-
return jsx("del", { className: "line-through text-
|
|
152
|
+
return jsx("del", { className: "line-through text-(--color-text-secondary)", children: children });
|
|
153
153
|
},
|
|
154
154
|
}), [shouldAnimate, syntaxTheme, renderCodeBlock]);
|
|
155
155
|
return (jsx(WordAnimationProvider, { content: displayContent, enabled: shouldAnimate, animateLastN: animateLastN, hasCursor: isStreaming && showCursor, children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], skipHtml: !allowHtml, components: markdownComponents, children: displayContent }) }));
|
|
@@ -4,7 +4,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
* StreamingCursor renders a blinking caret that indicates active streaming.
|
|
5
5
|
* Uses a simple CSS pulse animation — no framer motion, no layout shifts.
|
|
6
6
|
*/
|
|
7
|
-
const StreamingCursor = ({ visible, enabled = true, cursor = "
|
|
7
|
+
const StreamingCursor = ({ visible, enabled = true, cursor = "▏", className, }) => {
|
|
8
8
|
if (!visible)
|
|
9
9
|
return null;
|
|
10
10
|
return (jsx("span", { className: className || `font-extralight ml-0.5 ${enabled ? "animate-pulse" : ""}`, "aria-hidden": "true", children: cursor }));
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
const tokenFadeIn = {
|
|
10
10
|
hidden: {
|
|
11
11
|
opacity: 0,
|
|
12
|
-
y:
|
|
13
|
-
filter: 'blur(
|
|
12
|
+
y: 4,
|
|
13
|
+
filter: 'blur(1.5px)',
|
|
14
14
|
},
|
|
15
15
|
visible: {
|
|
16
16
|
opacity: 1,
|
|
@@ -19,8 +19,8 @@ const tokenFadeIn = {
|
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
const tokenTransition = {
|
|
22
|
-
duration: 0.
|
|
23
|
-
ease: [0.
|
|
22
|
+
duration: 0.25,
|
|
23
|
+
ease: [0.2, 0.8, 0.2, 1], // snappy easing
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Block slide-in animation
|
|
@@ -29,7 +29,7 @@ const tokenTransition = {
|
|
|
29
29
|
const blockSlideIn = {
|
|
30
30
|
hidden: {
|
|
31
31
|
opacity: 0,
|
|
32
|
-
y:
|
|
32
|
+
y: 6,
|
|
33
33
|
},
|
|
34
34
|
visible: {
|
|
35
35
|
opacity: 1,
|
|
@@ -37,8 +37,8 @@ const blockSlideIn = {
|
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
const blockTransition = {
|
|
40
|
-
duration: 0.
|
|
41
|
-
ease: [0.
|
|
40
|
+
duration: 0.35,
|
|
41
|
+
ease: [0.2, 0.8, 0.2, 1],
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Streaming cursor (caret) animation
|
|
@@ -62,7 +62,7 @@ const cursorPulse = {
|
|
|
62
62
|
const inlineTokenFadeIn = {
|
|
63
63
|
hidden: {
|
|
64
64
|
opacity: 0,
|
|
65
|
-
filter: 'blur(
|
|
65
|
+
filter: 'blur(1.5px)',
|
|
66
66
|
},
|
|
67
67
|
visible: {
|
|
68
68
|
opacity: 1,
|
|
@@ -70,8 +70,8 @@ const inlineTokenFadeIn = {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
const inlineTokenTransition = {
|
|
73
|
-
duration: 0.
|
|
74
|
-
ease: [0.
|
|
73
|
+
duration: 0.25,
|
|
74
|
+
ease: [0.2, 0.8, 0.2, 1],
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* Container animation for staggered children
|
|
@@ -4,6 +4,12 @@ import { useStreamingSSE } from '../../../hooks/useStreamingSSE.js';
|
|
|
4
4
|
import { Message } from '../../core/Message/Message.js';
|
|
5
5
|
import { TypeWriter } from '../../core/Message/TypeWriter.js';
|
|
6
6
|
import '../../core/Message/MessageBody.js';
|
|
7
|
+
import 'clsx';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
import '../../core/Button/Button.js';
|
|
10
|
+
import '@heroicons/react/16/solid';
|
|
11
|
+
import '@heroicons/react/24/outline';
|
|
12
|
+
import '@heroicons/react/24/solid';
|
|
7
13
|
import { ErrorDisplay } from './ErrorDisplay.js';
|
|
8
14
|
import { MarkdownRenderer } from './MarkdownRenderer.js';
|
|
9
15
|
import { AnimatedText } from './AnimatedText.js';
|
|
@@ -33,7 +39,7 @@ onToken, onComplete, onError, onStart, onAbort,
|
|
|
33
39
|
// Display options
|
|
34
40
|
typingSpeed = 100, enableTypewriter = true, enableMarkdown = true, markdownOptions,
|
|
35
41
|
// Animation
|
|
36
|
-
animated = true, showCursor = true, animateLastN =
|
|
42
|
+
animated = true, showCursor = true, animateLastN = 12,
|
|
37
43
|
// Message component props
|
|
38
44
|
role = 'assistant', avatar, showTimestamp = true, showActions = true, onCopy, onRegenerate,
|
|
39
45
|
// Error handling
|
|
@@ -74,11 +80,11 @@ className, }) => {
|
|
|
74
80
|
}
|
|
75
81
|
else if (enableTypewriter && isComplete && accumulatedText) {
|
|
76
82
|
// Use typewriter animation after streaming completes
|
|
77
|
-
messageContent = (jsx(TypeWriter, { text: accumulatedText, speed: typingSpeed, enabled: true, className: "whitespace-pre-wrap break-
|
|
83
|
+
messageContent = (jsx(TypeWriter, { text: accumulatedText, speed: typingSpeed, enabled: true, className: "whitespace-pre-wrap wrap-break-word" }));
|
|
78
84
|
}
|
|
79
85
|
else {
|
|
80
86
|
// Show raw text (streaming complete, typewriter disabled)
|
|
81
|
-
messageContent = (jsx("p", { className: "whitespace-pre-wrap break-
|
|
87
|
+
messageContent = (jsx("p", { className: "whitespace-pre-wrap wrap-break-word", children: accumulatedText }));
|
|
82
88
|
}
|
|
83
89
|
// Render with Message component
|
|
84
90
|
return (jsx(Message, { role: role, content: messageContent, avatar: avatar, timestamp: startTimeRef.current, showTimestamp: showTimestamp, isStreaming: isStreaming, showActions: showActions && !error, onCopy: onCopy, onRegenerate: onRegenerate, className: className }));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* inside markdown-rendered content. Works like AnimatedText but across
|
|
5
5
|
* all markdown elements (paragraphs, headings, lists, blockquotes, etc.).
|
|
6
6
|
*/
|
|
7
|
-
import React from
|
|
7
|
+
import React from "react";
|
|
8
8
|
interface WordAnimationContextValue {
|
|
9
9
|
/** Process children of a prose element, animating recent words */
|
|
10
10
|
processChildren: (children: React.ReactNode) => React.ReactNode;
|
|
@@ -18,7 +18,7 @@ const tokenize = (text) => {
|
|
|
18
18
|
const countWordsInChildren = (children) => {
|
|
19
19
|
let count = 0;
|
|
20
20
|
React__default.Children.forEach(children, (child) => {
|
|
21
|
-
if (typeof child ===
|
|
21
|
+
if (typeof child === "string") {
|
|
22
22
|
count += tokenize(child).length;
|
|
23
23
|
}
|
|
24
24
|
else if (React__default.isValidElement(child)) {
|
|
@@ -30,12 +30,12 @@ const countWordsInChildren = (children) => {
|
|
|
30
30
|
});
|
|
31
31
|
return count;
|
|
32
32
|
};
|
|
33
|
-
const WordAnimationProvider = ({ children, content, enabled, animateLastN =
|
|
33
|
+
const WordAnimationProvider = ({ children, content, enabled, animateLastN = 12, hasCursor = false, }) => {
|
|
34
34
|
const settledCountRef = useRef(0);
|
|
35
35
|
// Count total prose words in the raw content
|
|
36
36
|
const totalWords = useMemo(() => {
|
|
37
37
|
// Strip the cursor character before counting
|
|
38
|
-
const cleanContent = hasCursor ? content.replace(/\s
|
|
38
|
+
const cleanContent = hasCursor ? content.replace(/\s*▏\s*$/, "") : content;
|
|
39
39
|
return tokenize(cleanContent).length;
|
|
40
40
|
}, [content, hasCursor]);
|
|
41
41
|
// Update settled count — words that have aged out of the animation window
|
|
@@ -59,7 +59,7 @@ const WordAnimationProvider = ({ children, content, enabled, animateLastN = 6, h
|
|
|
59
59
|
*/
|
|
60
60
|
const processChildren = (children) => {
|
|
61
61
|
return React__default.Children.map(children, (child) => {
|
|
62
|
-
if (typeof child ===
|
|
62
|
+
if (typeof child === "string") {
|
|
63
63
|
return processTextNode(child);
|
|
64
64
|
}
|
|
65
65
|
if (React__default.isValidElement(child)) {
|
|
@@ -82,18 +82,18 @@ const WordAnimationProvider = ({ children, content, enabled, animateLastN = 6, h
|
|
|
82
82
|
if (tokens.length === 0)
|
|
83
83
|
return text;
|
|
84
84
|
const result = [];
|
|
85
|
-
let staticBuffer =
|
|
85
|
+
let staticBuffer = "";
|
|
86
86
|
for (const token of tokens) {
|
|
87
87
|
const currentIndex = wordIndexRef.current;
|
|
88
88
|
wordIndexRef.current++;
|
|
89
89
|
// Check if this is the cursor character
|
|
90
|
-
if (token.trim() ===
|
|
90
|
+
if (token.trim() === "▏") {
|
|
91
91
|
// Flush static buffer
|
|
92
92
|
if (staticBuffer) {
|
|
93
93
|
result.push(staticBuffer);
|
|
94
|
-
staticBuffer =
|
|
94
|
+
staticBuffer = "";
|
|
95
95
|
}
|
|
96
|
-
result.push(jsx("span", { className: "animate-pulse font-light", "aria-hidden": "true", children: "\
|
|
96
|
+
result.push(jsx("span", { className: "animate-pulse font-light", "aria-hidden": "true", children: "\u258F" }, "streaming-cursor"));
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
99
|
if (currentIndex < settledCount) {
|
|
@@ -104,10 +104,10 @@ const WordAnimationProvider = ({ children, content, enabled, animateLastN = 6, h
|
|
|
104
104
|
// Flush static buffer before animated tokens
|
|
105
105
|
if (staticBuffer) {
|
|
106
106
|
result.push(staticBuffer);
|
|
107
|
-
staticBuffer =
|
|
107
|
+
staticBuffer = "";
|
|
108
108
|
}
|
|
109
109
|
// Animated word
|
|
110
|
-
result.push(jsx(motion.span, { variants: inlineTokenFadeIn, initial: "hidden", animate: "visible", transition: inlineTokenTransition, style: { display:
|
|
110
|
+
result.push(jsx(motion.span, { variants: inlineTokenFadeIn, initial: "hidden", animate: "visible", transition: inlineTokenTransition, style: { display: "inline" }, children: token }, `word-${currentIndex}-${token.trim()}`));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
// Flush any remaining static buffer
|
|
@@ -129,6 +129,6 @@ const WordAnimationProvider = ({ children, content, enabled, animateLastN = 6, h
|
|
|
129
129
|
}, [enabled, settledCount, totalWords]);
|
|
130
130
|
return (jsx(WordAnimationContext.Provider, { value: contextValue, children: children }));
|
|
131
131
|
};
|
|
132
|
-
WordAnimationProvider.displayName =
|
|
132
|
+
WordAnimationProvider.displayName = "WordAnimationProvider";
|
|
133
133
|
|
|
134
134
|
export { WordAnimationProvider, useWordAnimation };
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export { Message, messageTheme } from "../core/Message";
|
|
2
2
|
export type { MessageProps, MessageRole, MessageVariant, MessageAvatarProps, MessageTheme, MessageThemeOverrides, } from "../core/Message";
|
|
3
|
-
export { MessageHistory, messageHistoryTheme } from "./MessageHistory";
|
|
4
|
-
export type { MessageHistoryProps, ChatMessageData, MessageHistoryTheme, MessageHistoryThemeOverrides, } from "./MessageHistory";
|
|
5
3
|
export { PromptInput, promptInputTheme } from "./PromptInput";
|
|
6
4
|
export type { PromptInputProps, PromptInputState, ModelOption, PromptInputTheme, PromptInputThemeOverrides, } from "./PromptInput";
|
|
7
|
-
export { ThinkingIndicator, thinkingIndicatorTheme } from "./ThinkingIndicator";
|
|
8
|
-
export type { ThinkingIndicatorProps, ThinkingIndicatorSize, ThinkingIndicatorTheme, ThinkingIndicatorThemeOverrides, } from "./ThinkingIndicator";
|
|
9
5
|
export { TokenCounter, tokenCounterTheme, estimateTokens, calculateCost, formatCost, formatTokenCount, MODEL_CONFIGS, } from "./TokenCounter";
|
|
10
6
|
export type { TokenCounterProps, TokenCounterModel, TokenCounterSize, TokenCounterTheme, TokenCounterThemeOverrides, ModelConfig, } from "./TokenCounter";
|
|
11
7
|
export { PromptSuggestion, promptSuggestionTheme } from "./PromptSuggestions";
|
|
@@ -14,6 +10,3 @@ export { StreamingResponse, ErrorDisplay, MarkdownRenderer, AnimatedText, Stream
|
|
|
14
10
|
export type { StreamingResponseProps, StreamingResponseTheme, MarkdownOptions, AnimatedTextProps, StreamingCursorProps, MarkdownRendererProps, } from "./StreamingResponse";
|
|
15
11
|
export { CodeBlock, codeBlockTheme } from "./CodeBlock";
|
|
16
12
|
export type { CodeBlockProps, CodeBlockLanguage, CodeBlockTheme, CodeBlockThemeOverrides, } from "./CodeBlock";
|
|
17
|
-
export { ApprovalCard } from "./ApprovalCard";
|
|
18
|
-
export type { ApprovalCardProps, ApprovalRiskLevel, } from "./ApprovalCard";
|
|
19
|
-
export { approvalCardTheme } from "./ApprovalCard/ApprovalCard.theme";
|
|
@@ -2,12 +2,16 @@ export { Message } from '../core/Message/Message.js';
|
|
|
2
2
|
export { messageTheme } from '../core/Message/Message.theme.js';
|
|
3
3
|
import '../core/Message/TypeWriter.js';
|
|
4
4
|
import '../core/Message/MessageBody.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'clsx';
|
|
7
|
+
import 'tailwind-merge';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '../core/Button/Button.js';
|
|
10
|
+
import '@heroicons/react/16/solid';
|
|
11
|
+
import '@heroicons/react/24/outline';
|
|
12
|
+
import '@heroicons/react/24/solid';
|
|
7
13
|
export { PromptInput } from './PromptInput/PromptInput.js';
|
|
8
14
|
export { promptInputTheme } from './PromptInput/PromptInput.theme.js';
|
|
9
|
-
export { ThinkingIndicator } from './ThinkingIndicator/ThinkingIndicator.js';
|
|
10
|
-
export { thinkingIndicatorTheme } from './ThinkingIndicator/ThinkingIndicator.theme.js';
|
|
11
15
|
export { TokenCounter } from './TokenCounter/TokenCounter.js';
|
|
12
16
|
export { tokenCounterTheme } from './TokenCounter/TokenCounter.theme.js';
|
|
13
17
|
export { MODEL_CONFIGS, calculateCost, estimateTokens, formatCost, formatTokenCount } from './TokenCounter/tokenUtils.js';
|
|
@@ -23,5 +27,3 @@ export { streamingResponseTheme } from './StreamingResponse/StreamingResponse.th
|
|
|
23
27
|
export { blockSlideIn, blockTransition, cursorPulse, staggerContainer, tokenFadeIn, tokenTransition } from './StreamingResponse/StreamingResponse.animations.js';
|
|
24
28
|
export { CodeBlock } from './CodeBlock/CodeBlock.js';
|
|
25
29
|
export { codeBlockTheme } from './CodeBlock/CodeBlock.theme.js';
|
|
26
|
-
export { ApprovalCard } from './ApprovalCard/ApprovalCard.js';
|
|
27
|
-
export { approvalCardTheme } from './ApprovalCard/ApprovalCard.theme.js';
|
|
@@ -10,7 +10,7 @@ import { resolveCssVariable, describeRingSegmentPath, interpolateHexColor, clamp
|
|
|
10
10
|
* DonutChart component for displaying a percentage value with a circular progress indicator
|
|
11
11
|
* Supports customization of size, thickness, animations, and theming
|
|
12
12
|
*/
|
|
13
|
-
const DonutChart = ({ variant = "solid", percentage, label, subtitle, size = 200, thickness = 2, segmentCount = 32, segmentGap = 0.35, showAnimation = true, className, children, theme: themeOverrides, colors, ...props }) => {
|
|
13
|
+
const DonutChart = ({ variant = "solid", percentage, label, subtitle, size = 200, thickness = 2, segmentCount = 32, segmentGap = 0.35, showAnimation = true, className, children, theme: themeOverrides, colors, onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...props }) => {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const [isHovered, setIsHovered] = useState(false);
|
|
16
16
|
const [hasAnimated, setHasAnimated] = useState(false);
|
|
@@ -93,7 +93,7 @@ const AnimatedStrokeSegment = React__default.memo(AnimatedStrokeSegmentInner);
|
|
|
93
93
|
* MultiSegmentDonutChart component for displaying multiple data values in a circular chart
|
|
94
94
|
* Each segment represents a different data point with its own value and optional color
|
|
95
95
|
*/
|
|
96
|
-
const MultiSegmentDonutChart = ({ data, size = 200, thickness = 4, segmentGap = 0.05, showAnimation = true, showLegend = false, legendPosition = "right", centerContent, className, theme: themeOverrides, onSegmentHover, onSegmentClick, roundedCaps = true, ...restProps }) => {
|
|
96
|
+
const MultiSegmentDonutChart = ({ data, size = 200, thickness = 4, segmentGap = 0.05, showAnimation = true, showLegend = false, legendPosition = "right", centerContent, className, theme: themeOverrides, onSegmentHover, onSegmentClick, roundedCaps = true, onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...restProps }) => {
|
|
97
97
|
const [hoveredSegment, setHoveredSegment] = useState(null);
|
|
98
98
|
const [hasAnimated, setHasAnimated] = useState(false);
|
|
99
99
|
const shouldReduceMotion = useReducedMotion();
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Individual payload item for chart legend entries
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartLegendPayloadItem {
|
|
6
|
+
value?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
dataKey?: string;
|
|
11
|
+
payload?: Record<string, unknown>;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
2
14
|
export interface ChartLegendProps {
|
|
3
15
|
content?: ReactNode;
|
|
4
16
|
wrapperStyle?: React.CSSProperties;
|
|
@@ -9,7 +21,7 @@ export interface ChartLegendProps {
|
|
|
9
21
|
className?: string;
|
|
10
22
|
}
|
|
11
23
|
export interface ChartLegendContentProps {
|
|
12
|
-
payload?:
|
|
24
|
+
payload?: ChartLegendPayloadItem[];
|
|
13
25
|
nameKey?: string;
|
|
14
26
|
className?: string;
|
|
15
27
|
}
|
|
@@ -11,7 +11,7 @@ const ChartLegendContent = ({ payload = [], nameKey = 'name', className, ...prop
|
|
|
11
11
|
return (jsx("div", { className: `flex flex-wrap gap-4 ${className || ''}`, ...props, children: payload.map((entry, index) => {
|
|
12
12
|
const name = entry[nameKey] || entry.dataKey || `Series ${index + 1}`;
|
|
13
13
|
const color = entry.color || '#8884d8';
|
|
14
|
-
return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "w-3 h-3 rounded", style: { backgroundColor: color } }), jsx("span", { className: "text-base text-gray-600", children: name })] }, index));
|
|
14
|
+
return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "w-3 h-3 rounded", style: { backgroundColor: color } }), jsx("span", { className: "text-base text-gray-600", children: String(name) })] }, index));
|
|
15
15
|
}) }));
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Individual payload item from chart data
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartTooltipPayloadItem {
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: number | string;
|
|
8
|
+
color?: string;
|
|
9
|
+
dataKey?: string;
|
|
10
|
+
payload?: Record<string, unknown>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* ChartTooltip theme configuration
|
|
4
15
|
*/
|
|
@@ -30,7 +41,7 @@ export interface ChartTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
30
41
|
contentStyle?: React.CSSProperties;
|
|
31
42
|
itemStyle?: React.CSSProperties;
|
|
32
43
|
active?: boolean;
|
|
33
|
-
payload?:
|
|
44
|
+
payload?: ChartTooltipPayloadItem[];
|
|
34
45
|
label?: string | number;
|
|
35
46
|
className?: string;
|
|
36
47
|
position?: {
|
|
@@ -42,7 +53,7 @@ export interface ChartTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
42
53
|
}
|
|
43
54
|
export interface ChartTooltipContentProps {
|
|
44
55
|
active?: boolean;
|
|
45
|
-
payload?:
|
|
56
|
+
payload?: ChartTooltipPayloadItem[];
|
|
46
57
|
label?: string | number;
|
|
47
58
|
labelKey?: string;
|
|
48
59
|
nameKey?: string;
|
|
@@ -52,6 +52,6 @@ const AccordionItem = React__default.forwardRef(({ children, className, value, .
|
|
|
52
52
|
const itemStyleClass = variant === "stacked" ? theme === null || theme === void 0 ? void 0 : theme.itemStyleStacked : theme === null || theme === void 0 ? void 0 : theme.itemStyle;
|
|
53
53
|
return (jsx(AccordionItemContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, className: cn(itemStyleClass, className), "data-state": isOpen ? "open" : "closed", "data-variant": variant, "data-value": value, ...props, children: children }) }));
|
|
54
54
|
});
|
|
55
|
-
AccordionItem.displayName = "
|
|
55
|
+
AccordionItem.displayName = "Accordion.Item";
|
|
56
56
|
|
|
57
57
|
export { AccordionItem, useAccordionItemContext };
|
|
@@ -26,6 +26,6 @@ const AccordionTrigger = React__default.forwardRef(({ children, className, chevr
|
|
|
26
26
|
const animatedChevron = (rotation, extraClass) => (jsx(motion.div, { initial: false, animate: isOpen ? "open" : "closed", variants: createTriggerIconVariants(rotation), className: cn("flex items-center justify-center shrink-0", extraClass), children: defaultChevronIcon }));
|
|
27
27
|
return (jsxs("button", { ref: ref, type: "button", id: triggerId, className: cn(theme === null || theme === void 0 ? void 0 : theme.triggerStyle, className), "aria-expanded": isOpen, "aria-controls": contentId, "data-state": isOpen ? "open" : "closed", onClick: toggle, ...props, children: [useDefaultOnLeft && animatedChevron(resolvedChevronRotation), children, resolvedChevron && (jsx(motion.div, { initial: false, animate: isOpen ? "open" : "closed", variants: createTriggerIconVariants(resolvedChevronRotation), className: "flex items-center justify-center shrink-0 ml-auto", children: resolvedChevron }))] }));
|
|
28
28
|
});
|
|
29
|
-
AccordionTrigger.displayName = "
|
|
29
|
+
AccordionTrigger.displayName = "Accordion.Trigger";
|
|
30
30
|
|
|
31
31
|
export { AccordionTrigger };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Variants } from "motion/react";
|
|
2
|
+
/**
|
|
3
|
+
* Alert entrance/exit animation variants
|
|
4
|
+
* Entrance: slide down from -8px + fade in
|
|
5
|
+
* Exit: fade out + collapse height
|
|
6
|
+
*/
|
|
7
|
+
export declare const alertVariants: Variants;
|
|
8
|
+
/**
|
|
9
|
+
* Reduced motion variants — instant opacity toggle, no slide or collapse
|
|
10
|
+
*/
|
|
11
|
+
export declare const reducedMotionAlertVariants: Variants;
|