@vantageos/mosaic-blocks 0.5.6-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/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 127 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 129 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
- 127 exported `Mosaic*` components across 9 sections (144 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
+ 129 exported `Mosaic*` components across 9 sections (149 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
 
@@ -179,7 +179,7 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
179
179
  | Device / Adaptive | `MosaicDeviceProvider`, `MosaicAdaptiveGrid`, `MosaicAdaptiveModal`, `MosaicAdaptiveNavigation` | 4 |
180
180
  | Auth / Multi-tenant | `MosaicMultiTenantProvider`, `MosaicSignInLayout`, `MosaicOrgPanel`, `MosaicClerkWebhookHandler` | 14 |
181
181
  | Agents & messaging | `MosaicAgentComposer`, `MosaicAgentCard`, `MosaicAgentList`, `MosaicMessageList`, `MosaicMarketplaceList` | 28 |
182
- | Data display | `MosaicDataTable`, `MosaicKanbanBoard`, `MosaicStepPipeline`, `MosaicActivityFeed`, `MosaicDocumentUpload`, `MosaicUrlScraper` | 8 |
182
+ | Data display | `MosaicDataTable`, `MosaicKanbanBoard`, `MosaicStepPipeline`, `MosaicActivityFeed`, `MosaicDocumentUpload`, `MosaicUrlScraper`, `MosaicMarkdown` | 9 |
183
183
  | Forms & inputs | `MosaicInput`, `MosaicSelect`, `MosaicField`, `MosaicCombobox`, `MosaicFilterBar` | 17 |
184
184
  | Primitives (incl. base-ui atoms) | `MosaicButton`, `MosaicBadge`, `MosaicCard`, `MosaicTabs`, `MosaicTooltip`, `MosaicAccordion` | 30 |
185
185
  | Landing & utility blocks | `MosaicHeroSplit`, `MosaicStatsGrid`, `MosaicPricingCard`, `MosaicCounter`, `MosaicThemeToggle` | 13 |
@@ -470,8 +470,11 @@ This package follows [Semantic Versioning](https://semver.org/). While in alpha
470
470
 
471
471
  | Version | Status | Notes |
472
472
  |---|---|---|
473
- | `0.5.6-alpha` | Current | 127 exported `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread) and `MosaicChatComposer` (chat input + send/stop button), Clerk auth, mobile-first, Storybook 10, 30 stories |
474
- | `0.4.8-alpha` | Historical | 125 shipped `Mosaic*` components — superseded by the Current row above |
473
+ | `0.5.8-alpha` | Current | 129 exported `Mosaic*` components — adds `MosaicChatMessage` (chat message: role + text/reasoning/tool-call parts) |
474
+ | `0.5.7-alpha` | Historical | 128 shipped `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread), `MosaicChatComposer` (chat input + send/stop button), and `MosaicMarkdown` (dependency-free markdown renderer), Clerk auth, mobile-first, Storybook 10, 30 stories — superseded by the Current row above |
475
+ | `0.5.6-alpha` | Historical | 127 shipped `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread) and `MosaicChatComposer` (chat input + send/stop button), Clerk auth, mobile-first, Storybook 10, 30 stories — superseded by the Current row above |
476
+ | `0.5.1-alpha` | Historical | 126 shipped `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread) — superseded by the Current row above |
477
+ | `0.4.8-alpha` | Historical | 125 shipped `Mosaic*` components, Clerk auth, mobile-first, Storybook 10, 30 stories — superseded by the Current row above |
475
478
  | `0.4.7-alpha` | Historical | 124 shipped `Mosaic*` components — superseded by the Current row above |
476
479
  | `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) |
477
480
  | `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.5.6-alpha";
49
+ var version = "0.5.8-alpha";
50
50
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
51
51
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
52
52
  }
@@ -11682,6 +11682,513 @@ function MosaicChatComposer(props) {
11682
11682
  );
11683
11683
  }
11684
11684
  MosaicChatComposer.displayName = "MosaicChatComposer";
11685
+ var markdownRootVariants = classVarianceAuthority.cva([
11686
+ "min-w-0 text-[15px] leading-6 text-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0"
11687
+ ]);
11688
+ var markdownHeadingVariants = classVarianceAuthority.cva(["font-medium tracking-normal text-foreground"], {
11689
+ variants: {
11690
+ level: {
11691
+ 1: "mt-7 mb-4 text-xl leading-7",
11692
+ 2: "mt-6 mb-3 text-base leading-6",
11693
+ 3: "mt-5 mb-2 text-sm leading-6",
11694
+ 4: "mt-4 mb-2 text-sm leading-6",
11695
+ 5: "mt-4 mb-2 text-xs leading-5",
11696
+ 6: "mt-4 mb-2 text-xs leading-5 text-muted-foreground"
11697
+ }
11698
+ },
11699
+ defaultVariants: {
11700
+ level: 1
11701
+ }
11702
+ });
11703
+ var markdownParagraphVariants = classVarianceAuthority.cva(["mb-3 text-[15px] leading-6 text-foreground"]);
11704
+ var markdownListVariants = classVarianceAuthority.cva(["mb-3 flex flex-col gap-1.5 pl-8 text-[15px] leading-6"], {
11705
+ variants: {
11706
+ ordered: {
11707
+ true: "list-decimal",
11708
+ false: "list-disc"
11709
+ }
11710
+ },
11711
+ defaultVariants: {
11712
+ ordered: false
11713
+ }
11714
+ });
11715
+ var markdownListItemVariants = classVarianceAuthority.cva(["pl-1 text-[15px] leading-6 text-foreground"]);
11716
+ var markdownBlockquoteVariants = classVarianceAuthority.cva([
11717
+ "mb-3 border-l-2 border-border pl-3 text-[15px] leading-6 text-muted-foreground"
11718
+ ]);
11719
+ var markdownHrVariants = classVarianceAuthority.cva(["my-4 border-border/70"]);
11720
+ var markdownEmphasisVariants = classVarianceAuthority.cva([], {
11721
+ variants: {
11722
+ tone: {
11723
+ strong: "font-medium text-foreground",
11724
+ emphasis: "italic"
11725
+ }
11726
+ }
11727
+ });
11728
+ var markdownInlineCodeVariants = classVarianceAuthority.cva([
11729
+ "rounded-md border border-border/70 bg-muted/40 px-1.5 py-0.5 font-mono text-[0.92em] text-foreground"
11730
+ ]);
11731
+ var markdownCodeBlockVariants = classVarianceAuthority.cva([
11732
+ "mb-3 overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-[0.92em] text-foreground"
11733
+ ]);
11734
+ var markdownLinkVariants = classVarianceAuthority.cva([
11735
+ "font-medium text-foreground underline decoration-border underline-offset-4 transition-colors hover:decoration-foreground"
11736
+ ]);
11737
+ var markdownTableWrapperVariants = classVarianceAuthority.cva(["mb-3 w-full overflow-x-auto"]);
11738
+ var markdownTableVariants = classVarianceAuthority.cva(["w-full border-collapse text-[15px] leading-6"]);
11739
+ var markdownTableCellVariants = classVarianceAuthority.cva(["border border-border px-3 py-1.5"], {
11740
+ variants: {
11741
+ header: {
11742
+ true: "bg-muted/40 font-medium text-foreground",
11743
+ false: "text-foreground"
11744
+ },
11745
+ align: {
11746
+ left: "text-left",
11747
+ center: "text-center",
11748
+ right: "text-right"
11749
+ }
11750
+ },
11751
+ defaultVariants: {
11752
+ header: false,
11753
+ align: "left"
11754
+ }
11755
+ });
11756
+ function cn75(...classes) {
11757
+ return classes.filter(Boolean).join(" ");
11758
+ }
11759
+ function sanitizeHref(rawHref) {
11760
+ const href = rawHref.replace(/[\x00-\x20]/g, "");
11761
+ if (!href) return null;
11762
+ const schemeMatch = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(href);
11763
+ if (!schemeMatch) return href;
11764
+ const scheme = schemeMatch[1].toLowerCase();
11765
+ return scheme === "http" || scheme === "https" || scheme === "mailto" ? href : null;
11766
+ }
11767
+ function makeIdSource() {
11768
+ let current = 0;
11769
+ return {
11770
+ next: () => {
11771
+ current += 1;
11772
+ return current;
11773
+ }
11774
+ };
11775
+ }
11776
+ function parseInline(text, ids) {
11777
+ const nodes = [];
11778
+ let buffer = "";
11779
+ let i = 0;
11780
+ const flush = () => {
11781
+ if (buffer.length > 0) {
11782
+ nodes.push(buffer);
11783
+ buffer = "";
11784
+ }
11785
+ };
11786
+ while (i < text.length) {
11787
+ const rest = text.slice(i);
11788
+ const codeMatch = /^`([^`]+)`/.exec(rest);
11789
+ if (codeMatch) {
11790
+ flush();
11791
+ nodes.push(
11792
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: markdownInlineCodeVariants(), children: codeMatch[1] }, ids.next())
11793
+ );
11794
+ i += codeMatch[0].length;
11795
+ continue;
11796
+ }
11797
+ const linkMatch = /^\[([^\]]*)\]\(((?:[^()]|\([^()]*\))*)\)/.exec(rest);
11798
+ if (linkMatch) {
11799
+ flush();
11800
+ const label = linkMatch[1];
11801
+ const safeHref = sanitizeHref(linkMatch[2]);
11802
+ if (safeHref) {
11803
+ nodes.push(
11804
+ /* @__PURE__ */ jsxRuntime.jsx(
11805
+ "a",
11806
+ {
11807
+ href: safeHref,
11808
+ target: "_blank",
11809
+ rel: "noopener noreferrer",
11810
+ className: markdownLinkVariants(),
11811
+ children: parseInline(label, ids)
11812
+ },
11813
+ ids.next()
11814
+ )
11815
+ );
11816
+ } else {
11817
+ nodes.push(...parseInline(label, ids));
11818
+ }
11819
+ i += linkMatch[0].length;
11820
+ continue;
11821
+ }
11822
+ const boldMatch = /^\*\*([^*]+)\*\*/.exec(rest);
11823
+ if (boldMatch) {
11824
+ flush();
11825
+ nodes.push(
11826
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { className: markdownEmphasisVariants({ tone: "strong" }), children: parseInline(boldMatch[1], ids) }, ids.next())
11827
+ );
11828
+ i += boldMatch[0].length;
11829
+ continue;
11830
+ }
11831
+ const italicMatch = /^\*([^*]+)\*/.exec(rest);
11832
+ if (italicMatch) {
11833
+ flush();
11834
+ nodes.push(
11835
+ /* @__PURE__ */ jsxRuntime.jsx("em", { className: markdownEmphasisVariants({ tone: "emphasis" }), children: parseInline(italicMatch[1], ids) }, ids.next())
11836
+ );
11837
+ i += italicMatch[0].length;
11838
+ continue;
11839
+ }
11840
+ buffer += text[i];
11841
+ i += 1;
11842
+ }
11843
+ flush();
11844
+ return nodes;
11845
+ }
11846
+ var FENCE_RE = /^```(\S*)\s*$/;
11847
+ var HEADING_RE = /^(#{1,6})\s+(.*)$/;
11848
+ var HR_RE = /^(-{3,}|\*{3,}|_{3,})$/;
11849
+ var UNORDERED_ITEM_RE = /^[-*+]\s+/;
11850
+ var ORDERED_ITEM_RE = /^\d+\.\s+/;
11851
+ var BLOCKQUOTE_LINE_RE = /^>\s?/;
11852
+ var TABLE_SEPARATOR_RE = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
11853
+ function parseTableRow(line) {
11854
+ const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
11855
+ return trimmed.split("|").map((cell) => cell.trim());
11856
+ }
11857
+ function parseBlocks(content) {
11858
+ const lines = content.split(/\r?\n/);
11859
+ const blocks = [];
11860
+ let id = 0;
11861
+ const nextId = () => {
11862
+ id += 1;
11863
+ return id;
11864
+ };
11865
+ let i = 0;
11866
+ while (i < lines.length) {
11867
+ const line = lines[i];
11868
+ if (line.trim() === "") {
11869
+ i += 1;
11870
+ continue;
11871
+ }
11872
+ const fenceMatch = FENCE_RE.exec(line);
11873
+ if (fenceMatch) {
11874
+ const language = fenceMatch[1] || void 0;
11875
+ const codeLines = [];
11876
+ i += 1;
11877
+ while (i < lines.length && !/^```\s*$/.test(lines[i])) {
11878
+ codeLines.push(lines[i]);
11879
+ i += 1;
11880
+ }
11881
+ i += 1;
11882
+ blocks.push({ id: nextId(), kind: "code", language, code: codeLines.join("\n") });
11883
+ continue;
11884
+ }
11885
+ const headingMatch = HEADING_RE.exec(line);
11886
+ if (headingMatch) {
11887
+ blocks.push({
11888
+ id: nextId(),
11889
+ kind: "heading",
11890
+ level: headingMatch[1].length,
11891
+ text: headingMatch[2].trim()
11892
+ });
11893
+ i += 1;
11894
+ continue;
11895
+ }
11896
+ if (HR_RE.test(line.trim())) {
11897
+ blocks.push({ id: nextId(), kind: "hr" });
11898
+ i += 1;
11899
+ continue;
11900
+ }
11901
+ if (line.includes("|") && i + 1 < lines.length && TABLE_SEPARATOR_RE.test(lines[i + 1])) {
11902
+ const header = parseTableRow(line);
11903
+ i += 2;
11904
+ const rows = [];
11905
+ while (i < lines.length && lines[i].trim() !== "" && lines[i].includes("|")) {
11906
+ rows.push(parseTableRow(lines[i]));
11907
+ i += 1;
11908
+ }
11909
+ blocks.push({ id: nextId(), kind: "table", header, rows });
11910
+ continue;
11911
+ }
11912
+ if (BLOCKQUOTE_LINE_RE.test(line)) {
11913
+ const quoteLines = [];
11914
+ while (i < lines.length && BLOCKQUOTE_LINE_RE.test(lines[i])) {
11915
+ quoteLines.push(lines[i].replace(BLOCKQUOTE_LINE_RE, ""));
11916
+ i += 1;
11917
+ }
11918
+ blocks.push({ id: nextId(), kind: "blockquote", text: quoteLines.join(" ") });
11919
+ continue;
11920
+ }
11921
+ if (UNORDERED_ITEM_RE.test(line)) {
11922
+ const items = [];
11923
+ while (i < lines.length && UNORDERED_ITEM_RE.test(lines[i])) {
11924
+ items.push({ id: nextId(), text: lines[i].replace(UNORDERED_ITEM_RE, "") });
11925
+ i += 1;
11926
+ }
11927
+ blocks.push({ id: nextId(), kind: "list", ordered: false, items });
11928
+ continue;
11929
+ }
11930
+ if (ORDERED_ITEM_RE.test(line)) {
11931
+ const items = [];
11932
+ while (i < lines.length && ORDERED_ITEM_RE.test(lines[i])) {
11933
+ items.push({ id: nextId(), text: lines[i].replace(ORDERED_ITEM_RE, "") });
11934
+ i += 1;
11935
+ }
11936
+ blocks.push({ id: nextId(), kind: "list", ordered: true, items });
11937
+ continue;
11938
+ }
11939
+ const paragraphLines = [];
11940
+ while (i < lines.length && lines[i].trim() !== "" && !FENCE_RE.test(lines[i]) && !HEADING_RE.test(lines[i]) && !UNORDERED_ITEM_RE.test(lines[i]) && !ORDERED_ITEM_RE.test(lines[i]) && !BLOCKQUOTE_LINE_RE.test(lines[i]) && !HR_RE.test(lines[i].trim())) {
11941
+ paragraphLines.push(lines[i]);
11942
+ i += 1;
11943
+ }
11944
+ blocks.push({ id: nextId(), kind: "paragraph", text: paragraphLines.join(" ") });
11945
+ }
11946
+ return blocks;
11947
+ }
11948
+ function MosaicMarkdown({ content, renderCodeBlock, className, ref }) {
11949
+ const blocks = parseBlocks(content);
11950
+ const ids = makeIdSource();
11951
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-slot": "markdown", className: cn75(markdownRootVariants(), className), children: blocks.map((block) => {
11952
+ if (block.kind === "heading") {
11953
+ const HeadingTag = `h${block.level}`;
11954
+ return /* @__PURE__ */ jsxRuntime.jsx(HeadingTag, { className: markdownHeadingVariants({ level: block.level }), children: parseInline(block.text, ids) }, block.id);
11955
+ }
11956
+ if (block.kind === "paragraph") {
11957
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: markdownParagraphVariants(), children: parseInline(block.text, ids) }, block.id);
11958
+ }
11959
+ if (block.kind === "list") {
11960
+ const ListTag = block.ordered ? "ol" : "ul";
11961
+ return /* @__PURE__ */ jsxRuntime.jsx(ListTag, { className: markdownListVariants({ ordered: block.ordered }), children: block.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: markdownListItemVariants(), children: parseInline(item.text, ids) }, item.id)) }, block.id);
11962
+ }
11963
+ if (block.kind === "blockquote") {
11964
+ return /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: markdownBlockquoteVariants(), children: parseInline(block.text, ids) }, block.id);
11965
+ }
11966
+ if (block.kind === "hr") {
11967
+ return /* @__PURE__ */ jsxRuntime.jsx("hr", { className: markdownHrVariants() }, block.id);
11968
+ }
11969
+ if (block.kind === "code") {
11970
+ if (renderCodeBlock) {
11971
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderCodeBlock({ language: block.language, code: block.code }) }, block.id);
11972
+ }
11973
+ return /* @__PURE__ */ jsxRuntime.jsx(
11974
+ "pre",
11975
+ {
11976
+ "data-slot": "markdown-code-block",
11977
+ ...block.language ? { "data-language": block.language } : {},
11978
+ className: markdownCodeBlockVariants(),
11979
+ children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: block.code })
11980
+ },
11981
+ block.id
11982
+ );
11983
+ }
11984
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: markdownTableWrapperVariants(), children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: markdownTableVariants(), children: [
11985
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: block.header.map((cell) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: markdownTableCellVariants({ header: true }), children: parseInline(cell, ids) }, ids.next())) }) }),
11986
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: block.rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx("tr", { children: row.map((cell) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: markdownTableCellVariants({ header: false }), children: parseInline(cell, ids) }, ids.next())) }, ids.next())) })
11987
+ ] }) }, block.id);
11988
+ }) });
11989
+ }
11990
+ MosaicMarkdown.displayName = "MosaicMarkdown";
11991
+ var chatMessageContainerVariants = classVarianceAuthority.cva(["flex w-full min-w-0"], {
11992
+ variants: {
11993
+ align: {
11994
+ start: "justify-start",
11995
+ end: "justify-end"
11996
+ }
11997
+ },
11998
+ defaultVariants: {
11999
+ align: "start"
12000
+ }
12001
+ });
12002
+ var chatMessageBubbleVariants = classVarianceAuthority.cva(["min-w-0"], {
12003
+ variants: {
12004
+ role: {
12005
+ user: [
12006
+ "max-w-[85%] rounded-[18px] border border-border/40 bg-muted/70 px-3 py-1.5",
12007
+ "text-[15px] leading-6 text-foreground shadow-sm"
12008
+ ],
12009
+ assistant: "w-full max-w-none text-sm leading-relaxed text-foreground"
12010
+ }
12011
+ },
12012
+ defaultVariants: {
12013
+ role: "assistant"
12014
+ }
12015
+ });
12016
+ var chatMessageToolStatusVariants = classVarianceAuthority.cva(["text-xs font-medium"], {
12017
+ variants: {
12018
+ status: {
12019
+ running: "text-muted-foreground",
12020
+ completed: "text-emerald-600 dark:text-emerald-500",
12021
+ denied: "text-destructive",
12022
+ error: "text-destructive"
12023
+ }
12024
+ },
12025
+ defaultVariants: {
12026
+ status: "running"
12027
+ }
12028
+ });
12029
+ function cn76(...classes) {
12030
+ return classes.filter(Boolean).join(" ");
12031
+ }
12032
+ function partKey(part, index) {
12033
+ return part.type === "tool" ? part.toolCallId : `${part.type}:${index}`;
12034
+ }
12035
+ function toolStatusOf(part) {
12036
+ switch (part.state) {
12037
+ case "input-streaming":
12038
+ case "approval-requested":
12039
+ return "running";
12040
+ case "output-available":
12041
+ return "completed";
12042
+ case "output-denied":
12043
+ return "denied";
12044
+ case "output-error":
12045
+ return "error";
12046
+ }
12047
+ }
12048
+ function formatPayload(value) {
12049
+ if (typeof value === "string") {
12050
+ return value;
12051
+ }
12052
+ try {
12053
+ return JSON.stringify(value, null, 2);
12054
+ } catch {
12055
+ return String(value);
12056
+ }
12057
+ }
12058
+ function ChatMessageTextPartView({
12059
+ part,
12060
+ renderText
12061
+ }) {
12062
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-message-text", className: "whitespace-pre-wrap break-words", children: renderText(part.text) });
12063
+ }
12064
+ function ChatMessageReasoningPartView({
12065
+ part,
12066
+ reasoningLabel,
12067
+ reasoningStreamingLabel,
12068
+ renderText
12069
+ }) {
12070
+ const isStreaming = Boolean(part.isStreaming);
12071
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12072
+ MosaicCollapsible,
12073
+ {
12074
+ "data-slot": "chat-message-reasoning",
12075
+ defaultOpen: isStreaming,
12076
+ className: "my-3 w-full",
12077
+ children: [
12078
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicCollapsibleTrigger, { className: "justify-start gap-2 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: isStreaming ? reasoningStreamingLabel : reasoningLabel }) }),
12079
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicCollapsiblePanel, { className: "border-l border-border pl-4 text-muted-foreground", children: renderText(part.text) })
12080
+ ]
12081
+ }
12082
+ );
12083
+ }
12084
+ function ChatMessageToolPartView({
12085
+ part,
12086
+ toolStatusLabels
12087
+ }) {
12088
+ const status = toolStatusOf(part);
12089
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "chat-message-tool", className: "my-2 flex flex-col gap-1 px-3", children: [
12090
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12091
+ /* @__PURE__ */ jsxRuntime.jsx(
12092
+ "span",
12093
+ {
12094
+ "data-slot": "chat-message-tool-name",
12095
+ className: "rounded bg-muted/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",
12096
+ children: part.toolName
12097
+ }
12098
+ ),
12099
+ /* @__PURE__ */ jsxRuntime.jsx(
12100
+ "span",
12101
+ {
12102
+ "data-slot": "chat-message-tool-status",
12103
+ className: chatMessageToolStatusVariants({ status }),
12104
+ children: toolStatusLabels[status]
12105
+ }
12106
+ )
12107
+ ] }),
12108
+ part.input !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
12109
+ "pre",
12110
+ {
12111
+ "data-slot": "chat-message-tool-input",
12112
+ className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
12113
+ children: formatPayload(part.input)
12114
+ }
12115
+ ),
12116
+ part.state === "approval-requested" && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-message-tool-approval", children: part.renderApproval(part) }),
12117
+ part.state === "output-available" && /* @__PURE__ */ jsxRuntime.jsx(
12118
+ "pre",
12119
+ {
12120
+ "data-slot": "chat-message-tool-output",
12121
+ className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
12122
+ children: formatPayload(part.output)
12123
+ }
12124
+ ),
12125
+ part.state === "output-error" && /* @__PURE__ */ jsxRuntime.jsx(
12126
+ "p",
12127
+ {
12128
+ "data-slot": "chat-message-tool-error",
12129
+ className: "rounded bg-destructive/10 p-2 font-mono text-[11px] leading-5 text-destructive",
12130
+ children: part.errorText
12131
+ }
12132
+ )
12133
+ ] });
12134
+ }
12135
+ function ChatMessagePartView({
12136
+ part,
12137
+ renderText,
12138
+ reasoningLabel,
12139
+ reasoningStreamingLabel,
12140
+ toolStatusLabels
12141
+ }) {
12142
+ switch (part.type) {
12143
+ case "text":
12144
+ return /* @__PURE__ */ jsxRuntime.jsx(ChatMessageTextPartView, { part, renderText });
12145
+ case "reasoning":
12146
+ return /* @__PURE__ */ jsxRuntime.jsx(
12147
+ ChatMessageReasoningPartView,
12148
+ {
12149
+ part,
12150
+ reasoningLabel,
12151
+ reasoningStreamingLabel,
12152
+ renderText
12153
+ }
12154
+ );
12155
+ case "tool":
12156
+ return /* @__PURE__ */ jsxRuntime.jsx(ChatMessageToolPartView, { part, toolStatusLabels });
12157
+ }
12158
+ }
12159
+ function MosaicChatMessage({
12160
+ messageRole,
12161
+ parts,
12162
+ renderText,
12163
+ reasoningLabel,
12164
+ reasoningStreamingLabel,
12165
+ toolStatusLabels,
12166
+ className,
12167
+ ref
12168
+ }) {
12169
+ const isUser = messageRole === "user";
12170
+ return /* @__PURE__ */ jsxRuntime.jsx(
12171
+ "article",
12172
+ {
12173
+ ref,
12174
+ "data-slot": "chat-message",
12175
+ "data-role": messageRole,
12176
+ className: cn76(chatMessageContainerVariants({ align: isUser ? "end" : "start" }), className),
12177
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chatMessageBubbleVariants({ role: messageRole }), children: parts.map((part, index) => /* @__PURE__ */ jsxRuntime.jsx(
12178
+ ChatMessagePartView,
12179
+ {
12180
+ part,
12181
+ renderText,
12182
+ reasoningLabel,
12183
+ reasoningStreamingLabel,
12184
+ toolStatusLabels
12185
+ },
12186
+ partKey(part, index)
12187
+ )) })
12188
+ }
12189
+ );
12190
+ }
12191
+ MosaicChatMessage.displayName = "MosaicChatMessage";
11685
12192
 
11686
12193
  Object.defineProperty(exports, "Accordion", {
11687
12194
  enumerable: true,
@@ -11721,6 +12228,7 @@ exports.MosaicCardFooter = MosaicCardFooter;
11721
12228
  exports.MosaicCardHeader = MosaicCardHeader;
11722
12229
  exports.MosaicCardTitle = MosaicCardTitle;
11723
12230
  exports.MosaicChatComposer = MosaicChatComposer;
12231
+ exports.MosaicChatMessage = MosaicChatMessage;
11724
12232
  exports.MosaicChatThread = MosaicChatThread;
11725
12233
  exports.MosaicCheckbox = MosaicCheckbox;
11726
12234
  exports.MosaicClerkOrgSwitcher = MosaicClerkOrgSwitcher;
@@ -11760,6 +12268,7 @@ exports.MosaicKanbanBoard = MosaicKanbanBoard;
11760
12268
  exports.MosaicKanbanColumn = MosaicKanbanColumn;
11761
12269
  exports.MosaicLogosGrid = MosaicLogosGrid;
11762
12270
  exports.MosaicMainNav = MosaicMainNav;
12271
+ exports.MosaicMarkdown = MosaicMarkdown;
11763
12272
  exports.MosaicMarketplaceList = MosaicMarketplaceList;
11764
12273
  exports.MosaicMarketplaceListDesktop = MarketplaceListDesktop;
11765
12274
  exports.MosaicMarketplaceListMobile = MarketplaceListMobile;
@@ -11821,6 +12330,9 @@ exports.MosaicUserButton = MosaicUserButton;
11821
12330
  exports.Placeholder = Placeholder;
11822
12331
  exports.badgeVariants = badgeVariants;
11823
12332
  exports.buttonVariants = buttonVariants;
12333
+ exports.chatMessageBubbleVariants = chatMessageBubbleVariants;
12334
+ exports.chatMessageContainerVariants = chatMessageContainerVariants;
12335
+ exports.chatMessageToolStatusVariants = chatMessageToolStatusVariants;
11824
12336
  exports.skeletonVariants = skeletonVariants;
11825
12337
  exports.useBreakpoint = useBreakpoint;
11826
12338
  exports.useDevice = useDevice;