@vantageos/mosaic-blocks 0.5.7-alpha → 0.5.8-alpha

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/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { Menu } from '@base-ui/react/menu';
27
27
  import { AlertDialog } from '@base-ui/react/alert-dialog';
28
28
 
29
29
  // src/version.ts
30
- var version = "0.5.7-alpha";
30
+ var version = "0.5.8-alpha";
31
31
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
32
32
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
33
33
  }
@@ -11969,7 +11969,208 @@ function MosaicMarkdown({ content, renderCodeBlock, className, ref }) {
11969
11969
  }) });
11970
11970
  }
11971
11971
  MosaicMarkdown.displayName = "MosaicMarkdown";
11972
+ var chatMessageContainerVariants = cva(["flex w-full min-w-0"], {
11973
+ variants: {
11974
+ align: {
11975
+ start: "justify-start",
11976
+ end: "justify-end"
11977
+ }
11978
+ },
11979
+ defaultVariants: {
11980
+ align: "start"
11981
+ }
11982
+ });
11983
+ var chatMessageBubbleVariants = cva(["min-w-0"], {
11984
+ variants: {
11985
+ role: {
11986
+ user: [
11987
+ "max-w-[85%] rounded-[18px] border border-border/40 bg-muted/70 px-3 py-1.5",
11988
+ "text-[15px] leading-6 text-foreground shadow-sm"
11989
+ ],
11990
+ assistant: "w-full max-w-none text-sm leading-relaxed text-foreground"
11991
+ }
11992
+ },
11993
+ defaultVariants: {
11994
+ role: "assistant"
11995
+ }
11996
+ });
11997
+ var chatMessageToolStatusVariants = cva(["text-xs font-medium"], {
11998
+ variants: {
11999
+ status: {
12000
+ running: "text-muted-foreground",
12001
+ completed: "text-emerald-600 dark:text-emerald-500",
12002
+ denied: "text-destructive",
12003
+ error: "text-destructive"
12004
+ }
12005
+ },
12006
+ defaultVariants: {
12007
+ status: "running"
12008
+ }
12009
+ });
12010
+ function cn76(...classes) {
12011
+ return classes.filter(Boolean).join(" ");
12012
+ }
12013
+ function partKey(part, index) {
12014
+ return part.type === "tool" ? part.toolCallId : `${part.type}:${index}`;
12015
+ }
12016
+ function toolStatusOf(part) {
12017
+ switch (part.state) {
12018
+ case "input-streaming":
12019
+ case "approval-requested":
12020
+ return "running";
12021
+ case "output-available":
12022
+ return "completed";
12023
+ case "output-denied":
12024
+ return "denied";
12025
+ case "output-error":
12026
+ return "error";
12027
+ }
12028
+ }
12029
+ function formatPayload(value) {
12030
+ if (typeof value === "string") {
12031
+ return value;
12032
+ }
12033
+ try {
12034
+ return JSON.stringify(value, null, 2);
12035
+ } catch {
12036
+ return String(value);
12037
+ }
12038
+ }
12039
+ function ChatMessageTextPartView({
12040
+ part,
12041
+ renderText
12042
+ }) {
12043
+ return /* @__PURE__ */ jsx("div", { "data-slot": "chat-message-text", className: "whitespace-pre-wrap break-words", children: renderText(part.text) });
12044
+ }
12045
+ function ChatMessageReasoningPartView({
12046
+ part,
12047
+ reasoningLabel,
12048
+ reasoningStreamingLabel,
12049
+ renderText
12050
+ }) {
12051
+ const isStreaming = Boolean(part.isStreaming);
12052
+ return /* @__PURE__ */ jsxs(
12053
+ MosaicCollapsible,
12054
+ {
12055
+ "data-slot": "chat-message-reasoning",
12056
+ defaultOpen: isStreaming,
12057
+ className: "my-3 w-full",
12058
+ children: [
12059
+ /* @__PURE__ */ jsx(MosaicCollapsibleTrigger, { className: "justify-start gap-2 text-sm text-muted-foreground", children: /* @__PURE__ */ jsx("span", { children: isStreaming ? reasoningStreamingLabel : reasoningLabel }) }),
12060
+ /* @__PURE__ */ jsx(MosaicCollapsiblePanel, { className: "border-l border-border pl-4 text-muted-foreground", children: renderText(part.text) })
12061
+ ]
12062
+ }
12063
+ );
12064
+ }
12065
+ function ChatMessageToolPartView({
12066
+ part,
12067
+ toolStatusLabels
12068
+ }) {
12069
+ const status = toolStatusOf(part);
12070
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "chat-message-tool", className: "my-2 flex flex-col gap-1 px-3", children: [
12071
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
12072
+ /* @__PURE__ */ jsx(
12073
+ "span",
12074
+ {
12075
+ "data-slot": "chat-message-tool-name",
12076
+ className: "rounded bg-muted/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",
12077
+ children: part.toolName
12078
+ }
12079
+ ),
12080
+ /* @__PURE__ */ jsx(
12081
+ "span",
12082
+ {
12083
+ "data-slot": "chat-message-tool-status",
12084
+ className: chatMessageToolStatusVariants({ status }),
12085
+ children: toolStatusLabels[status]
12086
+ }
12087
+ )
12088
+ ] }),
12089
+ part.input !== void 0 && /* @__PURE__ */ jsx(
12090
+ "pre",
12091
+ {
12092
+ "data-slot": "chat-message-tool-input",
12093
+ className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
12094
+ children: formatPayload(part.input)
12095
+ }
12096
+ ),
12097
+ part.state === "approval-requested" && /* @__PURE__ */ jsx("div", { "data-slot": "chat-message-tool-approval", children: part.renderApproval(part) }),
12098
+ part.state === "output-available" && /* @__PURE__ */ jsx(
12099
+ "pre",
12100
+ {
12101
+ "data-slot": "chat-message-tool-output",
12102
+ className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
12103
+ children: formatPayload(part.output)
12104
+ }
12105
+ ),
12106
+ part.state === "output-error" && /* @__PURE__ */ jsx(
12107
+ "p",
12108
+ {
12109
+ "data-slot": "chat-message-tool-error",
12110
+ className: "rounded bg-destructive/10 p-2 font-mono text-[11px] leading-5 text-destructive",
12111
+ children: part.errorText
12112
+ }
12113
+ )
12114
+ ] });
12115
+ }
12116
+ function ChatMessagePartView({
12117
+ part,
12118
+ renderText,
12119
+ reasoningLabel,
12120
+ reasoningStreamingLabel,
12121
+ toolStatusLabels
12122
+ }) {
12123
+ switch (part.type) {
12124
+ case "text":
12125
+ return /* @__PURE__ */ jsx(ChatMessageTextPartView, { part, renderText });
12126
+ case "reasoning":
12127
+ return /* @__PURE__ */ jsx(
12128
+ ChatMessageReasoningPartView,
12129
+ {
12130
+ part,
12131
+ reasoningLabel,
12132
+ reasoningStreamingLabel,
12133
+ renderText
12134
+ }
12135
+ );
12136
+ case "tool":
12137
+ return /* @__PURE__ */ jsx(ChatMessageToolPartView, { part, toolStatusLabels });
12138
+ }
12139
+ }
12140
+ function MosaicChatMessage({
12141
+ messageRole,
12142
+ parts,
12143
+ renderText,
12144
+ reasoningLabel,
12145
+ reasoningStreamingLabel,
12146
+ toolStatusLabels,
12147
+ className,
12148
+ ref
12149
+ }) {
12150
+ const isUser = messageRole === "user";
12151
+ return /* @__PURE__ */ jsx(
12152
+ "article",
12153
+ {
12154
+ ref,
12155
+ "data-slot": "chat-message",
12156
+ "data-role": messageRole,
12157
+ className: cn76(chatMessageContainerVariants({ align: isUser ? "end" : "start" }), className),
12158
+ children: /* @__PURE__ */ jsx("div", { className: chatMessageBubbleVariants({ role: messageRole }), children: parts.map((part, index) => /* @__PURE__ */ jsx(
12159
+ ChatMessagePartView,
12160
+ {
12161
+ part,
12162
+ renderText,
12163
+ reasoningLabel,
12164
+ reasoningStreamingLabel,
12165
+ toolStatusLabels
12166
+ },
12167
+ partKey(part, index)
12168
+ )) })
12169
+ }
12170
+ );
12171
+ }
12172
+ MosaicChatMessage.displayName = "MosaicChatMessage";
11972
12173
 
11973
- export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicAppSidebar, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, badgeVariants, buttonVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
12174
+ export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicAppSidebar, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
11974
12175
  //# sourceMappingURL=index.js.map
11975
12176
  //# sourceMappingURL=index.js.map