@vantageos/mosaic-blocks 0.4.8-alpha → 0.5.1-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
@@ -3,7 +3,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { Button } from '@base-ui/react/button';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import * as React28 from 'react';
6
- import { useState, useEffect, useRef, useId } from 'react';
6
+ import { useState, useEffect, useRef, useId, useLayoutEffect } from 'react';
7
7
  import { Accordion } from '@base-ui/react/accordion';
8
8
  export { Accordion } from '@base-ui/react/accordion';
9
9
  import { Checkbox } from '@base-ui/react/checkbox';
@@ -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.4.8-alpha";
30
+ var version = "0.5.1-alpha";
31
31
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
32
32
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
33
33
  }
@@ -6028,25 +6028,24 @@ var SOURCE_ICONS = {
6028
6028
  document: FileIcon,
6029
6029
  url: LinkIcon
6030
6030
  };
6031
- function MosaicMemoryCard({
6032
- memory,
6033
- variant = "detailed",
6034
- onEdit,
6035
- onDelete,
6036
- editLabel,
6037
- deleteLabel,
6038
- moreActionsLabel,
6039
- formatScope,
6040
- formatTimeAgo,
6041
- formatUsageCount,
6042
- formatMoreTags,
6043
- className,
6044
- ref
6045
- }) {
6031
+ function MosaicMemoryCard(props) {
6032
+ const {
6033
+ memory,
6034
+ onEdit,
6035
+ onDelete,
6036
+ editLabel,
6037
+ deleteLabel,
6038
+ moreActionsLabel,
6039
+ formatScope,
6040
+ formatTimeAgo,
6041
+ formatUsageCount,
6042
+ className,
6043
+ ref
6044
+ } = props;
6045
+ const variant = props.variant ?? "detailed";
6046
6046
  const [menuOpen, setMenuOpen] = React28.useState(false);
6047
6047
  const menuRef = React28.useRef(null);
6048
6048
  const SourceIcon = SOURCE_ICONS[memory.source];
6049
- const isDetailed = variant === "detailed";
6050
6049
  React28.useEffect(() => {
6051
6050
  if (!menuOpen) return;
6052
6051
  const handler = (event) => {
@@ -6118,7 +6117,7 @@ function MosaicMemoryCard({
6118
6117
  "data-slot": "memory-card",
6119
6118
  "data-variant": variant,
6120
6119
  className: cn53(memoryCardVariants({ variant }), className),
6121
- children: isDetailed ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6120
+ children: props.variant !== "compact" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6122
6121
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
6123
6122
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
6124
6123
  /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted p-2 text-muted-foreground", children: /* @__PURE__ */ jsx(SourceIcon, {}) }),
@@ -6141,7 +6140,7 @@ function MosaicMemoryCard({
6141
6140
  /* @__PURE__ */ jsx("p", { className: "line-clamp-3 text-sm text-muted-foreground", children: memory.content }),
6142
6141
  /* @__PURE__ */ jsxs("div", { "data-slot": "memory-tags", className: "flex flex-wrap gap-1", children: [
6143
6142
  visibleTags.map((tag) => /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: tag }, tag)),
6144
- hiddenTagCount > 0 && /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: formatMoreTags(hiddenTagCount) })
6143
+ hiddenTagCount > 0 && /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: props.formatMoreTags(hiddenTagCount) })
6145
6144
  ] }),
6146
6145
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t pt-2 text-xs text-muted-foreground", children: [
6147
6146
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
@@ -8549,21 +8548,20 @@ function XIcon2() {
8549
8548
  }
8550
8549
  );
8551
8550
  }
8552
- function MosaicModuleForm({
8553
- item,
8554
- mode,
8555
- formFields = [],
8556
- onSave,
8557
- onCancel,
8558
- nameFieldLabel,
8559
- descriptionFieldLabel,
8560
- namePlaceholder,
8561
- descriptionPlaceholder,
8562
- cancelLabel,
8563
- saveChangesLabel,
8564
- createItemLabel,
8565
- tagListAddPlaceholder
8566
- }) {
8551
+ function MosaicModuleForm(props) {
8552
+ const {
8553
+ item,
8554
+ mode,
8555
+ formFields = [],
8556
+ onSave,
8557
+ onCancel,
8558
+ nameFieldLabel,
8559
+ descriptionFieldLabel,
8560
+ namePlaceholder,
8561
+ descriptionPlaceholder,
8562
+ cancelLabel,
8563
+ tagListAddPlaceholder
8564
+ } = props;
8567
8565
  const [formData, setFormData] = React28.useState({
8568
8566
  name: item?.name ?? "",
8569
8567
  description: item?.description ?? "",
@@ -8761,7 +8759,7 @@ function MosaicModuleForm({
8761
8759
  onClick: handleSave,
8762
8760
  disabled: !formData.name,
8763
8761
  className: "inline-flex min-h-[44px] items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:pointer-events-none",
8764
- children: mode === "edit" ? saveChangesLabel : createItemLabel
8762
+ children: props.mode === "edit" ? props.saveChangesLabel : props.createItemLabel
8765
8763
  }
8766
8764
  )
8767
8765
  ] })
@@ -8982,7 +8980,6 @@ function LibraryContent({
8982
8980
  MosaicModuleForm,
8983
8981
  {
8984
8982
  item: editingItem,
8985
- mode: editorMode,
8986
8983
  formFields,
8987
8984
  onSave: handleSave,
8988
8985
  onCancel: () => setEditorOpen(false),
@@ -8991,9 +8988,8 @@ function LibraryContent({
8991
8988
  namePlaceholder,
8992
8989
  descriptionPlaceholder,
8993
8990
  cancelLabel,
8994
- saveChangesLabel,
8995
- createItemLabel,
8996
- tagListAddPlaceholder
8991
+ tagListAddPlaceholder,
8992
+ ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
8997
8993
  }
8998
8994
  )
8999
8995
  }
@@ -11464,7 +11460,88 @@ function MosaicUrlScraper(props) {
11464
11460
  ] });
11465
11461
  }
11466
11462
  MosaicUrlScraper.displayName = "MosaicUrlScraper";
11463
+ var chatThreadRootVariants = cva([
11464
+ "relative flex min-h-0 flex-1 flex-col overflow-y-auto"
11465
+ ]);
11466
+ var chatThreadContentVariants = cva([
11467
+ "mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6"
11468
+ ]);
11469
+ var chatThreadScrollButtonVariants = cva([
11470
+ "absolute bottom-4 left-1/2 -translate-x-1/2 inline-flex size-9",
11471
+ "items-center justify-center rounded-full border border-border bg-card text-foreground shadow-sm",
11472
+ "transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
11473
+ ]);
11474
+ function cn73(...classes) {
11475
+ return classes.filter(Boolean).join(" ");
11476
+ }
11477
+ var BOTTOM_THRESHOLD_PX = 24;
11478
+ function isNearBottom(element) {
11479
+ return element.scrollHeight - element.scrollTop - element.clientHeight <= BOTTOM_THRESHOLD_PX;
11480
+ }
11481
+ function MosaicChatThread({
11482
+ children,
11483
+ scrollToBottomLabel,
11484
+ className,
11485
+ ref
11486
+ }) {
11487
+ const containerRef = useRef(null);
11488
+ const isAtBottomRef = useRef(true);
11489
+ const [isAtBottom, setIsAtBottom] = useState(true);
11490
+ function setRefs(node) {
11491
+ containerRef.current = node;
11492
+ if (typeof ref === "function") {
11493
+ ref(node);
11494
+ } else if (ref) {
11495
+ ref.current = node;
11496
+ }
11497
+ }
11498
+ function handleScroll(event) {
11499
+ const atBottom = isNearBottom(event.currentTarget);
11500
+ isAtBottomRef.current = atBottom;
11501
+ setIsAtBottom(atBottom);
11502
+ }
11503
+ function handleScrollToBottomClick() {
11504
+ const element = containerRef.current;
11505
+ if (!element) {
11506
+ return;
11507
+ }
11508
+ element.scrollTop = element.scrollHeight;
11509
+ isAtBottomRef.current = true;
11510
+ setIsAtBottom(true);
11511
+ }
11512
+ useLayoutEffect(() => {
11513
+ const element = containerRef.current;
11514
+ if (element && isAtBottomRef.current) {
11515
+ element.scrollTop = element.scrollHeight;
11516
+ }
11517
+ }, [children]);
11518
+ return /* @__PURE__ */ jsxs(
11519
+ "div",
11520
+ {
11521
+ ref: setRefs,
11522
+ "data-slot": "chat-thread",
11523
+ role: "log",
11524
+ onScroll: handleScroll,
11525
+ className: cn73(chatThreadRootVariants(), className),
11526
+ children: [
11527
+ /* @__PURE__ */ jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
11528
+ !isAtBottom && /* @__PURE__ */ jsx(
11529
+ "button",
11530
+ {
11531
+ type: "button",
11532
+ "data-slot": "chat-thread-scroll-button",
11533
+ "aria-label": scrollToBottomLabel,
11534
+ onClick: handleScrollToBottomClick,
11535
+ className: chatThreadScrollButtonVariants(),
11536
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2193" })
11537
+ }
11538
+ )
11539
+ ]
11540
+ }
11541
+ );
11542
+ }
11543
+ MosaicChatThread.displayName = "MosaicChatThread";
11467
11544
 
11468
- 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, 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, 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 };
11545
+ 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, 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, 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 };
11469
11546
  //# sourceMappingURL=index.js.map
11470
11547
  //# sourceMappingURL=index.js.map