@vantageos/mosaic-blocks 0.4.9-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.9-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
  }
@@ -11479,6 +11479,87 @@ function MosaicUrlScraper(props) {
11479
11479
  ] });
11480
11480
  }
11481
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";
11482
11563
 
11483
11564
  Object.defineProperty(exports, "Accordion", {
11484
11565
  enumerable: true,
@@ -11517,6 +11598,7 @@ exports.MosaicCardDescription = MosaicCardDescription;
11517
11598
  exports.MosaicCardFooter = MosaicCardFooter;
11518
11599
  exports.MosaicCardHeader = MosaicCardHeader;
11519
11600
  exports.MosaicCardTitle = MosaicCardTitle;
11601
+ exports.MosaicChatThread = MosaicChatThread;
11520
11602
  exports.MosaicCheckbox = MosaicCheckbox;
11521
11603
  exports.MosaicClerkOrgSwitcher = MosaicClerkOrgSwitcher;
11522
11604
  exports.MosaicClerkWebhookHandler = MosaicClerkWebhookHandler;