@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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## 1. Hero & Positioning
12
12
 
13
- `@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 125 opinionated, fully-typed UI components that integrate natively with:
13
+ `@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 126 opinionated, fully-typed UI components that integrate natively with:
14
14
 
15
15
  - **Clerk** — auth sign-in/up flows, org switcher, RBAC, webhook sync
16
16
  - **Convex** — real-time data binding ready
@@ -169,7 +169,7 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
169
169
 
170
170
  ## 6. Component Catalogue Summary
171
171
 
172
- 125 exported `Mosaic*` components across 9 sections (142 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
172
+ 126 exported `Mosaic*` components across 9 sections (143 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
173
173
 
174
174
  > There is **no "Debate" section**. No `Mosaic*` debate component (room/timer/participant) is exported by this package — despite the "absorbed from anydebate" origin story below, the debate UI was never ported. If you need debate-room UI, it does not exist here yet.
175
175
 
@@ -470,7 +470,8 @@ This package follows [Semantic Versioning](https://semver.org/). While in alpha
470
470
 
471
471
  | Version | Status | Notes |
472
472
  |---|---|---|
473
- | `0.4.8-alpha` | Current | 125 exported `Mosaic*` components, Clerk auth, mobile-first, Storybook 10, 30 stories |
473
+ | `0.5.1-alpha` | Current | 126 exported `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread), Clerk auth, mobile-first, Storybook 10, 30 stories |
474
+ | `0.4.8-alpha` | Historical | 125 shipped `Mosaic*` components — superseded by the Current row above |
474
475
  | `0.4.7-alpha` | Historical | 124 shipped `Mosaic*` components — superseded by the Current row above |
475
476
  | `0.2.0-alpha` | Historical | anydebate absorb (partial) — counts quoted for this release are historical and superseded by the Current row above; see [CHANGELOG.md](CHANGELOG.md) |
476
477
  | `0.1.0-alpha.1` | Historical | Initial alpha publish |
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ function _interopNamespace(e) {
46
46
  var React28__namespace = /*#__PURE__*/_interopNamespace(React28);
47
47
 
48
48
  // src/version.ts
49
- var version = "0.4.8-alpha";
49
+ var version = "0.5.1-alpha";
50
50
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
51
51
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
52
52
  }
@@ -6047,25 +6047,24 @@ var SOURCE_ICONS = {
6047
6047
  document: FileIcon,
6048
6048
  url: LinkIcon
6049
6049
  };
6050
- function MosaicMemoryCard({
6051
- memory,
6052
- variant = "detailed",
6053
- onEdit,
6054
- onDelete,
6055
- editLabel,
6056
- deleteLabel,
6057
- moreActionsLabel,
6058
- formatScope,
6059
- formatTimeAgo,
6060
- formatUsageCount,
6061
- formatMoreTags,
6062
- className,
6063
- ref
6064
- }) {
6050
+ function MosaicMemoryCard(props) {
6051
+ const {
6052
+ memory,
6053
+ onEdit,
6054
+ onDelete,
6055
+ editLabel,
6056
+ deleteLabel,
6057
+ moreActionsLabel,
6058
+ formatScope,
6059
+ formatTimeAgo,
6060
+ formatUsageCount,
6061
+ className,
6062
+ ref
6063
+ } = props;
6064
+ const variant = props.variant ?? "detailed";
6065
6065
  const [menuOpen, setMenuOpen] = React28__namespace.useState(false);
6066
6066
  const menuRef = React28__namespace.useRef(null);
6067
6067
  const SourceIcon = SOURCE_ICONS[memory.source];
6068
- const isDetailed = variant === "detailed";
6069
6068
  React28__namespace.useEffect(() => {
6070
6069
  if (!menuOpen) return;
6071
6070
  const handler = (event) => {
@@ -6137,7 +6136,7 @@ function MosaicMemoryCard({
6137
6136
  "data-slot": "memory-card",
6138
6137
  "data-variant": variant,
6139
6138
  className: cn53(memoryCardVariants({ variant }), className),
6140
- children: isDetailed ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
6139
+ children: props.variant !== "compact" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
6141
6140
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
6142
6141
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
6143
6142
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-muted p-2 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(SourceIcon, {}) }),
@@ -6160,7 +6159,7 @@ function MosaicMemoryCard({
6160
6159
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-3 text-sm text-muted-foreground", children: memory.content }),
6161
6160
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "memory-tags", className: "flex flex-wrap gap-1", children: [
6162
6161
  visibleTags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn53(memoryTagBadgeVariants()), children: tag }, tag)),
6163
- hiddenTagCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn53(memoryTagBadgeVariants()), children: formatMoreTags(hiddenTagCount) })
6162
+ hiddenTagCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn53(memoryTagBadgeVariants()), children: props.formatMoreTags(hiddenTagCount) })
6164
6163
  ] }),
6165
6164
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-t pt-2 text-xs text-muted-foreground", children: [
6166
6165
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
@@ -8568,21 +8567,20 @@ function XIcon2() {
8568
8567
  }
8569
8568
  );
8570
8569
  }
8571
- function MosaicModuleForm({
8572
- item,
8573
- mode,
8574
- formFields = [],
8575
- onSave,
8576
- onCancel,
8577
- nameFieldLabel,
8578
- descriptionFieldLabel,
8579
- namePlaceholder,
8580
- descriptionPlaceholder,
8581
- cancelLabel,
8582
- saveChangesLabel,
8583
- createItemLabel,
8584
- tagListAddPlaceholder
8585
- }) {
8570
+ function MosaicModuleForm(props) {
8571
+ const {
8572
+ item,
8573
+ mode,
8574
+ formFields = [],
8575
+ onSave,
8576
+ onCancel,
8577
+ nameFieldLabel,
8578
+ descriptionFieldLabel,
8579
+ namePlaceholder,
8580
+ descriptionPlaceholder,
8581
+ cancelLabel,
8582
+ tagListAddPlaceholder
8583
+ } = props;
8586
8584
  const [formData, setFormData] = React28__namespace.useState({
8587
8585
  name: item?.name ?? "",
8588
8586
  description: item?.description ?? "",
@@ -8780,7 +8778,7 @@ function MosaicModuleForm({
8780
8778
  onClick: handleSave,
8781
8779
  disabled: !formData.name,
8782
8780
  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",
8783
- children: mode === "edit" ? saveChangesLabel : createItemLabel
8781
+ children: props.mode === "edit" ? props.saveChangesLabel : props.createItemLabel
8784
8782
  }
8785
8783
  )
8786
8784
  ] })
@@ -9001,7 +8999,6 @@ function LibraryContent({
9001
8999
  MosaicModuleForm,
9002
9000
  {
9003
9001
  item: editingItem,
9004
- mode: editorMode,
9005
9002
  formFields,
9006
9003
  onSave: handleSave,
9007
9004
  onCancel: () => setEditorOpen(false),
@@ -9010,9 +9007,8 @@ function LibraryContent({
9010
9007
  namePlaceholder,
9011
9008
  descriptionPlaceholder,
9012
9009
  cancelLabel,
9013
- saveChangesLabel,
9014
- createItemLabel,
9015
- tagListAddPlaceholder
9010
+ tagListAddPlaceholder,
9011
+ ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
9016
9012
  }
9017
9013
  )
9018
9014
  }
@@ -11483,6 +11479,87 @@ function MosaicUrlScraper(props) {
11483
11479
  ] });
11484
11480
  }
11485
11481
  MosaicUrlScraper.displayName = "MosaicUrlScraper";
11482
+ var chatThreadRootVariants = classVarianceAuthority.cva([
11483
+ "relative flex min-h-0 flex-1 flex-col overflow-y-auto"
11484
+ ]);
11485
+ var chatThreadContentVariants = classVarianceAuthority.cva([
11486
+ "mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6"
11487
+ ]);
11488
+ var chatThreadScrollButtonVariants = classVarianceAuthority.cva([
11489
+ "absolute bottom-4 left-1/2 -translate-x-1/2 inline-flex size-9",
11490
+ "items-center justify-center rounded-full border border-border bg-card text-foreground shadow-sm",
11491
+ "transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
11492
+ ]);
11493
+ function cn73(...classes) {
11494
+ return classes.filter(Boolean).join(" ");
11495
+ }
11496
+ var BOTTOM_THRESHOLD_PX = 24;
11497
+ function isNearBottom(element) {
11498
+ return element.scrollHeight - element.scrollTop - element.clientHeight <= BOTTOM_THRESHOLD_PX;
11499
+ }
11500
+ function MosaicChatThread({
11501
+ children,
11502
+ scrollToBottomLabel,
11503
+ className,
11504
+ ref
11505
+ }) {
11506
+ const containerRef = React28.useRef(null);
11507
+ const isAtBottomRef = React28.useRef(true);
11508
+ const [isAtBottom, setIsAtBottom] = React28.useState(true);
11509
+ function setRefs(node) {
11510
+ containerRef.current = node;
11511
+ if (typeof ref === "function") {
11512
+ ref(node);
11513
+ } else if (ref) {
11514
+ ref.current = node;
11515
+ }
11516
+ }
11517
+ function handleScroll(event) {
11518
+ const atBottom = isNearBottom(event.currentTarget);
11519
+ isAtBottomRef.current = atBottom;
11520
+ setIsAtBottom(atBottom);
11521
+ }
11522
+ function handleScrollToBottomClick() {
11523
+ const element = containerRef.current;
11524
+ if (!element) {
11525
+ return;
11526
+ }
11527
+ element.scrollTop = element.scrollHeight;
11528
+ isAtBottomRef.current = true;
11529
+ setIsAtBottom(true);
11530
+ }
11531
+ React28.useLayoutEffect(() => {
11532
+ const element = containerRef.current;
11533
+ if (element && isAtBottomRef.current) {
11534
+ element.scrollTop = element.scrollHeight;
11535
+ }
11536
+ }, [children]);
11537
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11538
+ "div",
11539
+ {
11540
+ ref: setRefs,
11541
+ "data-slot": "chat-thread",
11542
+ role: "log",
11543
+ onScroll: handleScroll,
11544
+ className: cn73(chatThreadRootVariants(), className),
11545
+ children: [
11546
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
11547
+ !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
11548
+ "button",
11549
+ {
11550
+ type: "button",
11551
+ "data-slot": "chat-thread-scroll-button",
11552
+ "aria-label": scrollToBottomLabel,
11553
+ onClick: handleScrollToBottomClick,
11554
+ className: chatThreadScrollButtonVariants(),
11555
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u2193" })
11556
+ }
11557
+ )
11558
+ ]
11559
+ }
11560
+ );
11561
+ }
11562
+ MosaicChatThread.displayName = "MosaicChatThread";
11486
11563
 
11487
11564
  Object.defineProperty(exports, "Accordion", {
11488
11565
  enumerable: true,
@@ -11521,6 +11598,7 @@ exports.MosaicCardDescription = MosaicCardDescription;
11521
11598
  exports.MosaicCardFooter = MosaicCardFooter;
11522
11599
  exports.MosaicCardHeader = MosaicCardHeader;
11523
11600
  exports.MosaicCardTitle = MosaicCardTitle;
11601
+ exports.MosaicChatThread = MosaicChatThread;
11524
11602
  exports.MosaicCheckbox = MosaicCheckbox;
11525
11603
  exports.MosaicClerkOrgSwitcher = MosaicClerkOrgSwitcher;
11526
11604
  exports.MosaicClerkWebhookHandler = MosaicClerkWebhookHandler;