@vantageos/mosaic-blocks 0.5.7-alpha → 0.5.9-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.9-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,317 @@ 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";
12173
+ var approvalPromptCardVariants = cva(["flex flex-col gap-3 rounded-lg border p-4"], {
12174
+ variants: {
12175
+ tone: {
12176
+ pending: "border-border bg-card",
12177
+ approved: "border-border bg-card",
12178
+ denied: "border-destructive/40 bg-destructive/5",
12179
+ error: "border-destructive/40 bg-destructive/5"
12180
+ }
12181
+ },
12182
+ defaultVariants: {
12183
+ tone: "pending"
12184
+ }
12185
+ });
12186
+ var approvalPromptMessageVariants = cva(["text-sm"], {
12187
+ variants: {
12188
+ tone: {
12189
+ muted: "text-muted-foreground",
12190
+ approved: "text-foreground",
12191
+ denied: "text-destructive",
12192
+ error: "text-destructive"
12193
+ }
12194
+ },
12195
+ defaultVariants: {
12196
+ tone: "muted"
12197
+ }
12198
+ });
12199
+ var approvalPromptButtonVariants = cva(
12200
+ [
12201
+ "min-h-9 inline-flex items-center justify-center rounded-md border px-4 text-sm font-medium transition-colors disabled:opacity-50"
12202
+ ],
12203
+ {
12204
+ variants: {
12205
+ intent: {
12206
+ approve: "border-border hover:bg-accent/50",
12207
+ deny: "border-destructive/40 text-destructive hover:bg-destructive/5"
12208
+ }
12209
+ }
12210
+ }
12211
+ );
12212
+ function cn77(...classes) {
12213
+ return classes.filter(Boolean).join(" ");
12214
+ }
12215
+ function MosaicApprovalPrompt(props) {
12216
+ const { toolName, toolNameLabel, promptTitle, renderArguments, className, ref } = props;
12217
+ const tone = props.status === "responded" ? props.decision : props.status === "error" ? "error" : "pending";
12218
+ return /* @__PURE__ */ jsxs(
12219
+ "fieldset",
12220
+ {
12221
+ ref,
12222
+ "data-slot": "approval-prompt",
12223
+ "aria-label": promptTitle,
12224
+ className: cn77("border-0 p-0 m-0", approvalPromptCardVariants({ tone }), className),
12225
+ children: [
12226
+ /* @__PURE__ */ jsx("legend", { "data-slot": "approval-prompt-title", className: "text-base font-semibold md:text-lg", children: promptTitle }),
12227
+ /* @__PURE__ */ jsxs("div", { "data-slot": "approval-prompt-tool", className: "flex flex-col gap-1", children: [
12228
+ /* @__PURE__ */ jsx(
12229
+ "span",
12230
+ {
12231
+ "data-slot": "approval-prompt-tool-label",
12232
+ className: approvalPromptMessageVariants({ tone: "muted" }),
12233
+ children: toolNameLabel
12234
+ }
12235
+ ),
12236
+ /* @__PURE__ */ jsx("span", { "data-slot": "approval-prompt-tool-name", className: "text-sm font-medium", children: toolName })
12237
+ ] }),
12238
+ /* @__PURE__ */ jsx("div", { "data-slot": "approval-prompt-arguments", children: renderArguments }),
12239
+ props.status === "pending" && /* @__PURE__ */ jsxs("div", { "data-slot": "approval-prompt-actions", className: "flex gap-2", children: [
12240
+ /* @__PURE__ */ jsx(
12241
+ "button",
12242
+ {
12243
+ type: "button",
12244
+ "data-slot": "approval-prompt-approve-button",
12245
+ onClick: props.onApprove,
12246
+ className: approvalPromptButtonVariants({ intent: "approve" }),
12247
+ children: props.approveButtonLabel
12248
+ }
12249
+ ),
12250
+ /* @__PURE__ */ jsx(
12251
+ "button",
12252
+ {
12253
+ type: "button",
12254
+ "data-slot": "approval-prompt-deny-button",
12255
+ onClick: props.onDeny,
12256
+ className: approvalPromptButtonVariants({ intent: "deny" }),
12257
+ children: props.denyButtonLabel
12258
+ }
12259
+ )
12260
+ ] }),
12261
+ props.status === "responded" && /* @__PURE__ */ jsx(
12262
+ "p",
12263
+ {
12264
+ "data-slot": "approval-prompt-decision",
12265
+ className: approvalPromptMessageVariants({ tone: props.decision }),
12266
+ children: props.decisionMessage
12267
+ }
12268
+ ),
12269
+ props.status === "error" && /* @__PURE__ */ jsx(
12270
+ "p",
12271
+ {
12272
+ "data-slot": "approval-prompt-error",
12273
+ className: approvalPromptMessageVariants({ tone: "error" }),
12274
+ children: props.errorMessage
12275
+ }
12276
+ )
12277
+ ]
12278
+ }
12279
+ );
12280
+ }
12281
+ MosaicApprovalPrompt.displayName = "MosaicApprovalPrompt";
11972
12282
 
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 };
12283
+ export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicAppSidebar, MosaicApprovalPrompt, 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
12284
  //# sourceMappingURL=index.js.map
11975
12285
  //# sourceMappingURL=index.js.map