@vantageos/mosaic-blocks 0.5.34-alpha → 0.5.36-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.
Files changed (149) hide show
  1. package/README.md +9 -8
  2. package/dist/index.cjs +1517 -101
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1283 -15
  5. package/dist/index.d.ts +1283 -15
  6. package/dist/index.js +1487 -102
  7. package/dist/index.js.map +1 -1
  8. package/dist/styles.css +18 -0
  9. package/package.json +38 -26
  10. package/r/mosaic-accordion.json +18 -0
  11. package/r/mosaic-activity-feed.json +16 -0
  12. package/r/mosaic-adaptive-grid.json +18 -0
  13. package/r/mosaic-adaptive-modal.json +18 -0
  14. package/r/mosaic-adaptive-navigation.json +18 -0
  15. package/r/mosaic-add-memory-form.json +25 -0
  16. package/r/mosaic-admin-only-guard.json +18 -0
  17. package/r/mosaic-agent-builder-modal.json +23 -0
  18. package/r/mosaic-agent-card.json +16 -0
  19. package/r/mosaic-agent-chat.json +26 -0
  20. package/r/mosaic-agent-composer.json +28 -0
  21. package/r/mosaic-agent-editor.json +25 -0
  22. package/r/mosaic-agent-list.json +21 -0
  23. package/r/mosaic-agent-preview.json +21 -0
  24. package/r/mosaic-alert-dialog.json +23 -0
  25. package/r/mosaic-animated-list.json +16 -0
  26. package/r/mosaic-api-key-panel.json +21 -0
  27. package/r/mosaic-app-sidebar.json +18 -0
  28. package/r/mosaic-approval-prompt.json +21 -0
  29. package/r/mosaic-artifact-canvas-adapter.json +26 -0
  30. package/r/mosaic-artifact-chart.json +18 -0
  31. package/r/mosaic-artifact-checklist.json +18 -0
  32. package/r/mosaic-artifact-data-table.json +18 -0
  33. package/r/mosaic-artifact-document.json +16 -0
  34. package/r/mosaic-artifact-library.json +18 -0
  35. package/r/mosaic-artifact-save-as-memory-form.json +24 -0
  36. package/r/mosaic-artifact-version-history.json +16 -0
  37. package/r/mosaic-avatar.json +18 -0
  38. package/r/mosaic-badge.json +23 -0
  39. package/r/mosaic-blurred-orb.json +16 -0
  40. package/r/mosaic-button.json +24 -0
  41. package/r/mosaic-callout.json +23 -0
  42. package/r/mosaic-card.json +16 -0
  43. package/r/mosaic-chat-composer.json +21 -0
  44. package/r/mosaic-chat-message.json +23 -0
  45. package/r/mosaic-chat-sidebar.json +21 -0
  46. package/r/mosaic-chat-thread.json +21 -0
  47. package/r/mosaic-checkbox.json +18 -0
  48. package/r/mosaic-clerk-org-switcher.json +18 -0
  49. package/r/mosaic-clerk-webhook-handler.json +18 -0
  50. package/r/mosaic-collapsible.json +18 -0
  51. package/r/mosaic-combobox.json +18 -0
  52. package/r/mosaic-counter.json +16 -0
  53. package/r/mosaic-dashboard-content.json +18 -0
  54. package/r/mosaic-dashboard-header.json +18 -0
  55. package/r/mosaic-dashboard-layout.json +20 -0
  56. package/r/mosaic-data-table.json +16 -0
  57. package/r/mosaic-delete-confirmation-dialog.json +18 -0
  58. package/r/mosaic-device-provider.json +16 -0
  59. package/r/mosaic-document-table.json +52 -0
  60. package/r/mosaic-document-upload.json +21 -0
  61. package/r/mosaic-drawer.json +23 -0
  62. package/r/mosaic-dropdown-menu.json +18 -0
  63. package/r/mosaic-edit-memory-dialog.json +27 -0
  64. package/r/mosaic-edit-session-dialog.json +25 -0
  65. package/r/mosaic-editable-cell.json +23 -0
  66. package/r/mosaic-empty-state.json +16 -0
  67. package/r/mosaic-falling-pattern.json +16 -0
  68. package/r/mosaic-feature-3col.json +16 -0
  69. package/r/mosaic-feature-centered-media.json +16 -0
  70. package/r/mosaic-field.json +18 -0
  71. package/r/mosaic-filter-bar.json +18 -0
  72. package/r/mosaic-filter-sidebar.json +18 -0
  73. package/r/mosaic-footer-simple.json +16 -0
  74. package/r/mosaic-hero-split.json +16 -0
  75. package/r/mosaic-input-group.json +16 -0
  76. package/r/mosaic-input.json +18 -0
  77. package/r/mosaic-integrations-badge.json +16 -0
  78. package/r/mosaic-kanban-board.json +21 -0
  79. package/r/mosaic-logos-grid.json +16 -0
  80. package/r/mosaic-main-nav.json +18 -0
  81. package/r/mosaic-markdown.json +21 -0
  82. package/r/mosaic-marketplace-card.json +24 -0
  83. package/r/mosaic-marketplace-list.json +20 -0
  84. package/r/mosaic-match-input.json +23 -0
  85. package/r/mosaic-memory-card.json +21 -0
  86. package/r/mosaic-memory-dashboard.json +23 -0
  87. package/r/mosaic-memory-grid.json +21 -0
  88. package/r/mosaic-memory-list.json +21 -0
  89. package/r/mosaic-memory-search.json +23 -0
  90. package/r/mosaic-mention-input.json +23 -0
  91. package/r/mosaic-message-card.json +16 -0
  92. package/r/mosaic-message-list.json +19 -0
  93. package/r/mosaic-message-search.json +18 -0
  94. package/r/mosaic-model-selector.json +23 -0
  95. package/r/mosaic-module-card.json +16 -0
  96. package/r/mosaic-module-library.json +18 -0
  97. package/r/mosaic-multi-tenant-provider.json +19 -0
  98. package/r/mosaic-navbar.json +16 -0
  99. package/r/mosaic-org-context-display.json +18 -0
  100. package/r/mosaic-org-panel.json +19 -0
  101. package/r/mosaic-org-profile-page.json +18 -0
  102. package/r/mosaic-org-switcher.json +16 -0
  103. package/r/mosaic-pdf-viewer.json +23 -0
  104. package/r/mosaic-popover.json +23 -0
  105. package/r/mosaic-preferences-panel.json +18 -0
  106. package/r/mosaic-pricing-card.json +16 -0
  107. package/r/mosaic-profile-panel.json +18 -0
  108. package/r/mosaic-progress.json +18 -0
  109. package/r/mosaic-quick-action-card.json +16 -0
  110. package/r/mosaic-quick-actions-menu.json +18 -0
  111. package/r/mosaic-quick-agent-selector.json +19 -0
  112. package/r/mosaic-radio-group.json +18 -0
  113. package/r/mosaic-reply-input.json +21 -0
  114. package/r/mosaic-resizable-split-pane.json +23 -0
  115. package/r/mosaic-save-chat-as-memory-form.json +25 -0
  116. package/r/mosaic-save-template-modal.json +27 -0
  117. package/r/mosaic-scroll-area.json +18 -0
  118. package/r/mosaic-select.json +18 -0
  119. package/r/mosaic-selector-modal.json +18 -0
  120. package/r/mosaic-separator.json +18 -0
  121. package/r/mosaic-session-card.json +24 -0
  122. package/r/mosaic-session-list.json +21 -0
  123. package/r/mosaic-sign-in-layout.json +18 -0
  124. package/r/mosaic-sign-up-layout.json +18 -0
  125. package/r/mosaic-skeleton.json +23 -0
  126. package/r/mosaic-slider.json +18 -0
  127. package/r/mosaic-stats-grid.json +16 -0
  128. package/r/mosaic-step-pipeline.json +21 -0
  129. package/r/mosaic-switch.json +18 -0
  130. package/r/mosaic-tabs.json +18 -0
  131. package/r/mosaic-tag-input.json +23 -0
  132. package/r/mosaic-template-agent-card.json +21 -0
  133. package/r/mosaic-template-category-chips.json +21 -0
  134. package/r/mosaic-template-gallery.json +20 -0
  135. package/r/mosaic-template-list.json +21 -0
  136. package/r/mosaic-template-management-panel.json +25 -0
  137. package/r/mosaic-testimonials-grid.json +16 -0
  138. package/r/mosaic-textarea.json +16 -0
  139. package/r/mosaic-theme-provider.json +18 -0
  140. package/r/mosaic-theme-toggle.json +16 -0
  141. package/r/mosaic-thread-indicator.json +21 -0
  142. package/r/mosaic-thread-view.json +21 -0
  143. package/r/mosaic-toast.json +28 -0
  144. package/r/mosaic-tool-toggle-list.json +23 -0
  145. package/r/mosaic-tooltip.json +18 -0
  146. package/r/mosaic-url-scraper.json +21 -0
  147. package/r/mosaic-user-button.json +18 -0
  148. package/r/use-effective-workspace-id.json +18 -0
  149. package/registry.json +179 -130
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-footer-simple",
4
+ "title": "MosaicFooterSimple",
5
+ "description": "Simple multi-column footer. Props: columns[] {id, heading, links[]}, legal, logo?, social[] {label, href, iconSrc?}.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/footer-simple/MosaicFooterSimple.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicFooterSimple — simple multi-column footer\n *\n * Ported from heyfabrika/styleui components/templates/axis/footer.tsx (MIT).\n * Adapted: props-driven columns (heading + links), legal text, social links.\n * No next/image or next/link — lib-portable.\n */\n\nimport type * as React from \"react\";\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface FooterLink {\n label: string;\n href: string;\n}\n\nexport interface FooterColumn {\n /** Stable unique identifier */\n id: string;\n /** Column heading */\n heading: string;\n /** Links in this column */\n links: FooterLink[];\n}\n\nexport interface SocialLink {\n label: string;\n href: string;\n /** Optional icon — renders as img if src provided, else renders label text */\n iconSrc?: string;\n}\n\nexport interface MosaicFooterSimpleProps {\n /** Footer link columns */\n columns: FooterColumn[];\n /** Legal / copyright string */\n legal: string;\n /** Optional logo node */\n logo?: React.ReactNode;\n /** Optional social icon links */\n social?: SocialLink[];\n className?: string;\n ref?: React.Ref<HTMLElement>;\n}\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicFooterSimple — footer with columns of links, optional logo, social\n * links, and legal text. All content via props.\n *\n * @example\n * <MosaicFooterSimple\n * logo={<img src=\"/logo.svg\" alt=\"Brand\" className=\"h-8 w-auto\" />}\n * columns={[\n * { id: \"c1\", heading: \"Product\", links: [{ label: \"Features\", href: \"#\" }] },\n * { id: \"c2\", heading: \"Company\", links: [{ label: \"About\", href: \"#\" }] },\n * ]}\n * social={[{ label: \"Twitter\", href: \"https://x.com\", iconSrc: \"/icons/x.svg\" }]}\n * legal=\"© 2026 Mosaic. All rights reserved.\"\n * />\n */\nexport function MosaicFooterSimple({\n columns,\n legal,\n logo,\n social,\n className,\n ref,\n}: MosaicFooterSimpleProps) {\n return (\n <footer\n ref={ref}\n className={cn(\n \"flex flex-col items-center gap-10 px-4 py-16 border-t border-[oklch(0.9_0.005_250)]\",\n className,\n )}\n >\n {/* Logo */}\n {logo && <div>{logo}</div>}\n\n {/* Columns */}\n {columns.length > 0 && (\n <div\n className=\"grid w-full max-w-4xl gap-8\"\n style={{\n gridTemplateColumns: `repeat(${Math.min(columns.length, 4)}, minmax(0, 1fr))`,\n }}\n >\n {columns.map((col) => (\n <div key={col.id} className=\"flex flex-col gap-3\">\n <p className=\"text-xs font-semibold uppercase tracking-widest text-[oklch(0.3_0.01_250)]\">\n {col.heading}\n </p>\n <ul className=\"flex flex-col gap-2\">\n {col.links.map((link) => (\n <li key={link.href}>\n <a\n href={link.href}\n className=\"text-sm text-[oklch(0.5_0.01_250)] transition-colors hover:text-[oklch(0.15_0.01_250)]\"\n >\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n )}\n\n {/* Social links */}\n {social && social.length > 0 && (\n <div className=\"flex flex-row gap-4\">\n {social.map((s) => (\n <a\n key={s.href}\n href={s.href}\n aria-label={s.label}\n className=\"flex items-center justify-center transition-opacity hover:opacity-70\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {s.iconSrc ? (\n <img src={s.iconSrc} alt={s.label} width={24} height={24} className=\"size-6\" />\n ) : (\n <span className=\"text-sm text-[oklch(0.5_0.01_250)]\">{s.label}</span>\n )}\n </a>\n ))}\n </div>\n )}\n\n {/* Legal */}\n <p className=\"text-center text-sm text-[oklch(0.55_0.01_250)]\">{legal}</p>\n </footer>\n );\n}\n\nMosaicFooterSimple.displayName = \"MosaicFooterSimple\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-hero-split",
4
+ "title": "MosaicHeroSplit",
5
+ "description": "Two-column split hero: copy left, media right. Props: eyebrow, title, subtitle, cta, ctaSecondary, media. Falls back to centered single-column when no media.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/hero-split/MosaicHeroSplit.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicHeroSplit — split hero section\n *\n * Ported from heyfabrika/styleui components/templates/axis/hero.tsx (MIT).\n * Adapted: fully props-driven, no hardcoded copy/images/branding.\n * Motion: CSS fade-up via Tailwind animate utilities (@keyframes in globals).\n * Media slot: accepts any React node (image, illustration, video, etc.).\n */\n\nimport type * as React from \"react\";\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface HeroCta {\n label: string;\n href: string;\n}\n\nexport interface MosaicHeroSplitProps {\n /** Small badge text above the title */\n eyebrow?: string;\n /** Main heading — the primary message */\n title: React.ReactNode;\n /** Supporting paragraph */\n subtitle: React.ReactNode;\n /** Primary CTA */\n cta?: HeroCta;\n /** Secondary CTA */\n ctaSecondary?: HeroCta;\n /** Right-column media slot — accepts img, video, SVG, or any node */\n media?: React.ReactNode;\n className?: string;\n ref?: React.Ref<HTMLElement>;\n}\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicHeroSplit — two-column hero: copy on left, media on right.\n * Falls back to centered single-column when no media provided.\n *\n * @example\n * <MosaicHeroSplit\n * eyebrow=\"New\"\n * title=\"The platform built for modern teams\"\n * subtitle=\"Ship faster, collaborate smarter.\"\n * cta={{ label: \"Start free\", href: \"/signup\" }}\n * media={<img src=\"/hero.png\" alt=\"Product screenshot\" className=\"w-full rounded-2xl\" />}\n * />\n */\nexport function MosaicHeroSplit({\n eyebrow,\n title,\n subtitle,\n cta,\n ctaSecondary,\n media,\n className,\n ref,\n}: MosaicHeroSplitProps) {\n return (\n <section\n ref={ref}\n className={cn(\n \"flex flex-col gap-16 items-center justify-center py-8 lg:pt-16 px-4\",\n className,\n )}\n >\n <div className=\"flex flex-col lg:flex-row items-center justify-between w-full gap-8 max-w-6xl mx-auto\">\n {/* Copy */}\n <div className=\"flex flex-col gap-6 lg:max-w-xl\">\n {eyebrow && (\n <span className=\"inline-flex w-fit items-center rounded-full border border-[oklch(0.85_0.01_250)] bg-[oklch(0.97_0.005_250)] px-3 py-1 text-xs font-semibold tracking-wide text-[oklch(0.4_0.02_250)] uppercase\">\n {eyebrow}\n </span>\n )}\n <h1 className=\"text-3xl md:text-5xl lg:text-6xl font-medium tracking-tighter text-center lg:text-left text-[oklch(0.12_0.01_250)]\">\n {title}\n </h1>\n <p className=\"text-base md:text-lg text-center lg:text-left text-[oklch(0.45_0.01_250)] leading-relaxed\">\n {subtitle}\n </p>\n {(cta ?? ctaSecondary) && (\n <div className=\"flex flex-row flex-wrap gap-3 justify-center lg:justify-start\">\n {cta && (\n <a\n href={cta.href}\n className=\"inline-flex items-center justify-center rounded-full bg-[oklch(0.15_0.01_250)] px-6 py-2.5 text-sm font-medium text-[oklch(0.98_0_0)] transition-colors hover:bg-[oklch(0.25_0.01_250)]\"\n >\n {cta.label}\n </a>\n )}\n {ctaSecondary && (\n <a\n href={ctaSecondary.href}\n className=\"inline-flex items-center justify-center rounded-full border border-[oklch(0.75_0.01_250)] bg-transparent px-6 py-2.5 text-sm font-medium text-[oklch(0.15_0.01_250)] transition-colors hover:bg-[oklch(0.96_0.005_250)]\"\n >\n {ctaSecondary.label}\n </a>\n )}\n </div>\n )}\n </div>\n\n {/* Media slot */}\n {media && <div className=\"w-full lg:max-w-lg xl:max-w-2xl flex-shrink-0\">{media}</div>}\n </div>\n </section>\n );\n}\n\nMosaicHeroSplit.displayName = \"MosaicHeroSplit\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-input-group",
4
+ "title": "MosaicInputGroup",
5
+ "description": "Composition wrapper laying out prefix/suffix addons around an input. data-slot=\"input-group\".",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/input-group/MosaicInputGroup.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicInputGroup — composition wrapper for MosaicInput with addons\n *\n * Lays out an optional prefix addon + children (MosaicInput) + optional suffix\n * horizontally. Plain <div> wrapper — no base-ui primitive needed.\n * data-slot=\"input-group\".\n *\n * Design tokens: Tailwind v4 semantic classes only.\n */\n\nimport type * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n// Omit 'prefix' from HTMLAttributes because the DOM attribute is `string | undefined`\n// but our `prefix` prop accepts any ReactNode.\nexport interface MosaicInputGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"prefix\"> {\n /** Element rendered before the input (icon, text addon, etc.) */\n prefix?: React.ReactNode;\n /** Element rendered after the input (icon, text addon, etc.) */\n suffix?: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * MosaicInputGroup — wraps MosaicInput with optional prefix/suffix addons.\n *\n * @example\n * <MosaicInputGroup prefix={<SearchIcon />}>\n * <MosaicInput placeholder=\"Search…\" />\n * </MosaicInputGroup>\n *\n * <MosaicInputGroup\n * prefix={<span>https://</span>}\n * suffix={<span>.com</span>}\n * >\n * <MosaicInput placeholder=\"yoursite\" />\n * </MosaicInputGroup>\n */\nexport function MosaicInputGroup({\n prefix,\n suffix,\n className,\n children,\n ref,\n ...props\n}: MosaicInputGroupProps) {\n return (\n <div\n ref={ref}\n data-slot=\"input-group\"\n className={cn(\"flex items-center\", className)}\n {...props}\n >\n {prefix ? (\n <div\n data-slot=\"input-group-prefix\"\n className=\"flex shrink-0 items-center text-sm text-muted-foreground\"\n >\n {prefix}\n </div>\n ) : null}\n <div className=\"min-w-0 flex-1\">{children}</div>\n {suffix ? (\n <div\n data-slot=\"input-group-suffix\"\n className=\"flex shrink-0 items-center text-sm text-muted-foreground\"\n >\n {suffix}\n </div>\n ) : null}\n </div>\n );\n}\n\nMosaicInputGroup.displayName = \"MosaicInputGroup\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-input",
4
+ "title": "MosaicInput",
5
+ "description": "Text input built on @base-ui/react/input. Forwards ref to native input. data-slot=\"input\".",
6
+ "dependencies": [
7
+ "@base-ui/react"
8
+ ],
9
+ "registryDependencies": [],
10
+ "files": [
11
+ {
12
+ "path": "src/components/input/MosaicInput.tsx",
13
+ "type": "registry:ui",
14
+ "content": "/**\n * MosaicInput — built on @base-ui/react/input\n *\n * Uses the Input primitive from @base-ui/react/input which renders a native\n * <input> element with Field integration and ref-as-prop (React 19).\n * data-slot=\"input\".\n *\n * Design tokens: Tailwind v4 semantic classes (bg-background, border-border,\n * text-foreground, ring-ring). No hardcoded colors.\n */\n\nimport { Input as InputPrimitive } from \"@base-ui/react/input\";\nimport type * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\nexport interface MosaicInputProps extends InputPrimitive.Props {\n className?: string;\n}\n\n/**\n * MosaicInput — accessible text input built on @base-ui/react Input.\n *\n * Forwards ref to the underlying <input> element.\n * Accepts all standard input props plus className.\n *\n * @example\n * <MosaicInput placeholder=\"Search…\" />\n * <MosaicInput type=\"email\" value={email} onChange={handleChange} />\n */\nexport function MosaicInput({ className, ref, ...props }: MosaicInputProps) {\n return (\n <InputPrimitive\n ref={ref as React.Ref<HTMLElement>}\n data-slot=\"input\"\n className={cn(\n \"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1\",\n \"text-sm text-foreground shadow-xs\",\n \"placeholder:text-muted-foreground\",\n \"outline-none transition-colors\",\n \"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nMosaicInput.displayName = \"MosaicInput\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-integrations-badge",
4
+ "title": "MosaicIntegrationsBadge",
5
+ "description": "Integration badge/pill with logo slot + label. Renders as <a> when href provided. Props: label, logo?, href?, target?. OKLCH theme-reactive. No hardcoded branding.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/integrations-badge/MosaicIntegrationsBadge.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicIntegrationsBadge — integration badge / pill\n *\n * Ported from heyfabrika/styleui components/integrations-badge (MIT).\n * Props-driven: logo slot (ReactNode), label string, optional href.\n * Theme-reactive via OKLCH CSS variables; no hardcoded branding colors.\n * Zero extra deps — pure HTML/CSS.\n */\n\nimport type * as React from \"react\";\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicIntegrationsBadgeProps {\n /** Badge label text (e.g. \"Stripe\", \"GitHub\") */\n label: string;\n /** Optional logo/icon slot — use <img>, <svg>, or any ReactNode */\n logo?: React.ReactNode;\n /** When provided, renders the badge as an <a> tag */\n href?: string;\n /** Link target (default \"_blank\" for external links) */\n target?: React.HTMLAttributeAnchorTarget;\n className?: string;\n ref?: React.Ref<HTMLAnchorElement & HTMLSpanElement>;\n}\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Shared styles ─────────────────────────────────────────────────────────────\n\nconst badgeClass =\n \"inline-flex items-center gap-2 rounded-full border border-[oklch(0.88_0.01_250)] bg-[oklch(0.98_0.005_250)] px-3 py-1.5 text-sm font-medium text-[oklch(0.25_0.01_250)] shadow-[0_1px_3px_oklch(0_0_0_/_0.06)] transition-colors\";\n\nconst hoverClass =\n \"hover:border-[oklch(0.8_0.01_250)] hover:bg-[oklch(0.96_0.005_250)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[oklch(0.5_0.15_250)]\";\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicIntegrationsBadge — pill-shaped badge showing a logo + label.\n * Renders as `<a>` when `href` is provided.\n *\n * @example\n * <MosaicIntegrationsBadge\n * label=\"Stripe\"\n * logo={<img src=\"/stripe-logo.svg\" alt=\"\" width={16} height={16} />}\n * href=\"https://stripe.com\"\n * />\n */\nexport function MosaicIntegrationsBadge({\n label,\n logo,\n href,\n target = \"_blank\",\n className,\n ref,\n}: MosaicIntegrationsBadgeProps) {\n const inner = (\n <>\n {logo && <span className=\"flex shrink-0 items-center\">{logo}</span>}\n <span>{label}</span>\n </>\n );\n\n if (href) {\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={cn(badgeClass, hoverClass, className)}\n >\n {inner}\n </a>\n );\n }\n\n return (\n <span ref={ref as React.Ref<HTMLSpanElement>} className={cn(badgeClass, className)}>\n {inner}\n </span>\n );\n}\n\nMosaicIntegrationsBadge.displayName = \"MosaicIntegrationsBadge\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-kanban-board",
4
+ "title": "MosaicKanbanBoard",
5
+ "description": "MosaicKanbanBoard — horizontal scrollable kanban board container.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/kanban/MosaicKanbanBoard.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicKanbanBoard — horizontal scrollable kanban board container.\n *\n * Presentational container — columns are caller-provided children.\n * No drag-drop logic, no data fetching, no \"use client\" directive.\n * data-slot=\"kanban-board\" for composability and testing.\n *\n * Design tokens: Tailwind v4 semantic classes only. No hardcoded colors.\n *\n * @example\n * <MosaicKanbanBoard>\n * <MosaicKanbanColumn title=\"À faire\" count={3}>\n * <TaskCard />\n * </MosaicKanbanColumn>\n * <MosaicKanbanColumn title=\"En cours\" count={1}>\n * <TaskCard />\n * </MosaicKanbanColumn>\n * </MosaicKanbanBoard>\n */\n\nimport type * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\nexport interface MosaicKanbanBoardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Kanban columns (MosaicKanbanColumn elements). */\n children: React.ReactNode;\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * MosaicKanbanBoard — horizontal-scroll flex row of kanban columns.\n *\n * Replaces TaskBoard / MandateBoard / MissionBoard in the VP shell.\n * Pure presentational — columns and cards are caller-owned children.\n *\n * @example\n * <MosaicKanbanBoard>\n * <MosaicKanbanColumn title=\"Backlog\" count={5}>…</MosaicKanbanColumn>\n * <MosaicKanbanColumn title=\"In Progress\" count={2}>…</MosaicKanbanColumn>\n * <MosaicKanbanColumn title=\"Done\" count={12}>…</MosaicKanbanColumn>\n * </MosaicKanbanBoard>\n */\nexport function MosaicKanbanBoard({ children, className, ref, ...props }: MosaicKanbanBoardProps) {\n return (\n <div\n ref={ref}\n data-slot=\"kanban-board\"\n className={cn(\n \"flex gap-4 overflow-x-auto pb-4\",\n \"min-h-0\",\n // Smooth momentum scrolling on iOS\n \"[scroll-behavior:smooth]\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nMosaicKanbanBoard.displayName = \"MosaicKanbanBoard\";\n"
13
+ },
14
+ {
15
+ "path": "src/components/kanban/MosaicKanbanColumn.tsx",
16
+ "type": "registry:ui",
17
+ "content": "/**\n * MosaicKanbanColumn — vertical column within a MosaicKanbanBoard.\n *\n * Presentational container — cards are caller-provided children.\n * Renders: header (title + optional count badge + optional trailing actions)\n * scrollable card stack (children)\n * optional footer (e.g. \"load more\" / Convex paginate trigger)\n *\n * No drag-drop logic, no data fetching, no \"use client\" directive.\n * data-slot=\"kanban-column\" for composability and testing.\n *\n * Design tokens: Tailwind v4 semantic classes only (border-border, bg-muted,\n * text-muted-foreground, bg-background). No hardcoded colors.\n *\n * i18n: `countLabel` is a REQUIRED prop — the host owns the language (e.g.\n * next-intl `t()`). No English default, no fallback lives in this component.\n *\n * @example\n * // Host owns i18n (e.g. next-intl) — countLabel is always a required prop.\n * <MosaicKanbanColumn\n * title=\"To Do\"\n * count={3}\n * countLabel={(n) => t('Kanban.itemCount', { count: n })}\n * >\n * <TaskCard task={task} />\n * </MosaicKanbanColumn>\n *\n * // French host\n * <MosaicKanbanColumn\n * title=\"À faire\"\n * count={3}\n * countLabel={(n) => `${n} éléments`}\n * headerActions={<button aria-label={t('Kanban.aria.addTask')}>+</button>}\n * footer={<button>{t('Kanban.loadMore')}</button>}\n * >\n * <TaskCard task={task} />\n * </MosaicKanbanColumn>\n */\n\nimport type * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\nexport interface MosaicKanbanColumnProps {\n /** Column heading — caller-provided; can be a string or any ReactNode. */\n title: React.ReactNode;\n /** Optional item count rendered as a badge in the header. */\n count?: number;\n /** Optional trailing slot in the header (e.g. add-task button). */\n headerActions?: React.ReactNode;\n /** Card children — caller-owned. */\n children: React.ReactNode;\n /** Optional footer slot (e.g. \"Load more\" / Convex pagination button). */\n footer?: React.ReactNode;\n /**\n * Formatter for the count badge aria-label. Required — the host owns the\n * language (e.g. FR: `(n) => \\`${n} éléments\\``). No default, no fallback.\n */\n countLabel: (count: number) => string;\n className?: string;\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * MosaicKanbanColumn — single column within MosaicKanbanBoard.\n *\n * Replaces TaskColumn / MandateColumn in the VP shell.\n * The column is a fixed-width, shrink-0 card with a scrollable body.\n * Title and labels are caller-provided — no hardcoded English strings.\n *\n * @example\n * <MosaicKanbanColumn title=\"En cours\" count={2} countLabel={(n) => `${n} éléments`}>\n * <TaskCard />\n * </MosaicKanbanColumn>\n */\nexport function MosaicKanbanColumn({\n title,\n count,\n headerActions,\n children,\n footer,\n countLabel,\n className,\n ref,\n}: MosaicKanbanColumnProps) {\n return (\n <section\n ref={ref}\n data-slot=\"kanban-column\"\n className={cn(\n // Fixed column width, never shrink so board stays scrollable\n \"flex flex-col w-72 shrink-0\",\n // Surface\n \"rounded-lg border border-border bg-muted/30\",\n className,\n )}\n >\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <div\n data-slot=\"kanban-column-header\"\n className=\"flex items-center justify-between gap-2 px-3 py-2.5 border-b border-border\"\n >\n <div className=\"flex items-center gap-2 min-w-0\">\n <span className=\"text-sm font-semibold text-foreground truncate\">{title}</span>\n {count !== undefined && (\n <span\n data-slot=\"kanban-column-count\"\n aria-label={countLabel(count)}\n className={cn(\n \"inline-flex items-center justify-center\",\n \"min-w-[1.25rem] h-5 px-1.5 rounded-full\",\n \"bg-muted text-muted-foreground\",\n \"text-xs font-medium tabular-nums\",\n \"select-none\",\n )}\n >\n {count}\n </span>\n )}\n </div>\n {headerActions && (\n <div\n data-slot=\"kanban-column-header-actions\"\n className=\"flex items-center gap-1 shrink-0\"\n >\n {headerActions}\n </div>\n )}\n </div>\n\n {/* ── Card stack ─────────────────────────────────────────────────── */}\n <div\n data-slot=\"kanban-column-body\"\n className=\"flex flex-col gap-2 p-2 overflow-y-auto flex-1 min-h-0\"\n >\n {children}\n </div>\n\n {/* ── Footer (optional) ──────────────────────────────────────────── */}\n {footer && (\n <div\n data-slot=\"kanban-column-footer\"\n className=\"px-3 py-2 border-t border-border text-sm text-muted-foreground\"\n >\n {footer}\n </div>\n )}\n </section>\n );\n}\n\nMosaicKanbanColumn.displayName = \"MosaicKanbanColumn\";\n"
18
+ }
19
+ ],
20
+ "type": "registry:ui"
21
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-logos-grid",
4
+ "title": "MosaicLogosGrid",
5
+ "description": "Logo cloud / partner logos grid. Props: logos[] {name, src, width, height}, heading. Grayscale hover effect. Optional stagger-motion variant: pass stagger=true or stagger=80 for CSS keyframe staggered reveal; respects prefers-reduced-motion.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/logos-grid/MosaicLogosGrid.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicLogosGrid — logo cloud / partner logos grid\n *\n * Ported from heyfabrika/styleui blocks/logo-cloud.tsx (MIT).\n * Adapted: fully props-driven logos array (name, src, width, height).\n * No next/image dependency (lib-portable), uses native <img> with role.\n * No motion/react dependency — CSS opacity transition only.\n *\n * T4 addition: opt-in `stagger` prop for staggered reveal animation.\n * The `mosaic-logo-in` keyframe ships statically in styles.css (no runtime injection).\n * Requires importing `@vantageos/mosaic-blocks/styles.css`. Respects prefers-reduced-motion.\n */\n\nimport type * as React from \"react\";\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface LogoItem {\n /** Alt text / brand name */\n name: string;\n /** Image src URL */\n src: string;\n /** Optional explicit width (defaults to 80) */\n width?: number;\n /** Optional explicit height (defaults to 80) */\n height?: number;\n}\n\nexport interface MosaicLogosGridProps {\n /** Array of logos to display */\n logos: LogoItem[];\n /** Optional heading text above the grid */\n heading?: React.ReactNode;\n /**\n * Opt-in staggered reveal animation.\n * - `true` → default step of 80ms between items\n * - `number` → explicit ms step between items\n * - `false` / `undefined` → no animation (default, fully backward-compatible)\n * Respects prefers-reduced-motion: no delay applied when reduced motion is set.\n * Requires importing `@vantageos/mosaic-blocks/styles.css` for the keyframe.\n */\n stagger?: boolean | number;\n className?: string;\n ref?: React.Ref<HTMLElement>;\n}\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction prefersReducedMotion(): boolean {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicLogosGrid — wrapping flex grid of partner/integration logos.\n * Pass `heading` for a \"Trusted by\" label above the logos.\n * Pass `stagger` (true or ms number) for a staggered reveal animation.\n * The `mosaic-logo-in` keyframe is defined in styles.css (static, SSR-safe).\n *\n * @example\n * <MosaicLogosGrid\n * heading=\"Trusted by leading teams\"\n * logos={[\n * { name: \"Notion\", src: \"/logos/notion.svg\", width: 100, height: 40 },\n * { name: \"Slack\", src: \"/logos/slack.svg\", width: 80, height: 80 },\n * ]}\n * stagger={80}\n * />\n */\nexport function MosaicLogosGrid({ logos, heading, stagger, className, ref }: MosaicLogosGridProps) {\n const isStagger = stagger !== undefined && stagger !== false;\n const stepMs = typeof stagger === \"number\" ? stagger : 80;\n\n const reducedMotion = prefersReducedMotion();\n\n return (\n <section\n ref={ref}\n className={cn(\n \"flex flex-col items-center justify-center gap-8 px-4 py-12 mx-auto max-w-6xl\",\n className,\n )}\n >\n {heading && (\n <p className=\"text-center text-sm font-light text-[oklch(0.5_0.01_250)]\">{heading}</p>\n )}\n <div className=\"flex flex-wrap items-center justify-center gap-6 md:gap-8 lg:gap-12\">\n {logos.map((logo, i) => {\n return (\n <div\n key={logo.name}\n data-slot=\"logos-grid-item\"\n className={cn(\n \"transition-transform duration-200 hover:scale-110\",\n isStagger && !reducedMotion && \"mosaic-logo-stagger\",\n )}\n style={\n isStagger && !reducedMotion\n ? {\n opacity: 0,\n animation: `mosaic-logo-in 400ms ease-out ${i * stepMs}ms forwards`,\n animationDelay: `${i * stepMs}ms`,\n }\n : {}\n }\n >\n {/* Native img — lib-portable; consumers using Next.js should wrap with next/image */}\n <img\n src={logo.src}\n alt={logo.name}\n width={logo.width ?? 80}\n height={logo.height ?? 80}\n className=\"object-contain opacity-70 grayscale hover:opacity-100 hover:grayscale-0 transition-all duration-200\"\n />\n </div>\n );\n })}\n </div>\n </section>\n );\n}\n\nMosaicLogosGrid.displayName = \"MosaicLogosGrid\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-main-nav",
4
+ "title": "MosaicMainNav",
5
+ "description": "Generic responsive top-nav. Desktop: inline link strip. Mobile: hamburger + drawer. Items are props.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-device-provider.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/main-nav/MosaicMainNav.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicMainNav — generic responsive top-nav\n *\n * Ported from components/layout/main-nav.tsx\n *\n * Desktop: inline horizontal link strip.\n * Mobile: hamburger → slide-out drawer (pure CSS, no Radix Sheet dep).\n * All nav items, branding, and hrefs are props — zero hardcoded debate routes.\n * next/link replaced with `renderLink` prop (default: <a> tag).\n * Respects prefers-reduced-motion.\n */\n\nimport * as React from \"react\";\nimport { useDevice } from \"@/components/ui/MosaicDeviceProvider\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicNavItem {\n href: string;\n label: string;\n /** Lucide-compatible icon component */\n icon?: React.ElementType;\n /** If true, only rendered when isAdmin=true */\n adminOnly?: boolean;\n /** Whether this item is currently active */\n isActive?: boolean;\n}\n\nexport interface MosaicMainNavProps {\n items?: MosaicNavItem[];\n /** Current pathname for active-state matching (if items don't carry isActive) */\n activePath?: string;\n /** When true, adminOnly items are shown */\n isAdmin?: boolean;\n /** Custom link renderer (e.g. Next.js Link). Defaults to <a>. */\n renderLink?: (\n item: MosaicNavItem,\n children: React.ReactNode,\n className: string,\n onClick?: () => void,\n ) => React.ReactNode;\n /** Mobile drawer title. Required, no default. */\n drawerTitle: string;\n /** Mobile drawer subtitle. Required, no default. */\n drawerSubtitle: string;\n /**\n * Required host-owned strings — no default, no fallback. The host owns\n * the language (e.g. next-intl `t()`).\n */\n openMenuAriaLabel: string;\n closeMenuAriaLabel: string;\n drawerNavAriaLabel: string;\n mainNavAriaLabel: string;\n adminBadgeLabel: string;\n className?: string;\n}\n\n// ── Keyframe injection ────────────────────────────────────────────────────────\n\nconst ANIM_ID = \"mosaic-main-nav-kf\";\n\nfunction injectStyles() {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(ANIM_ID)) return;\n const s = document.createElement(\"style\");\n s.id = ANIM_ID;\n s.textContent = `\n @keyframes mosaic-drawer-in {\n from { transform: translateX(-100%); }\n to { transform: translateX(0); }\n }\n @keyframes mosaic-drawer-out {\n from { transform: translateX(0); }\n to { transform: translateX(-100%); }\n }\n .mosaic-nav-drawer[data-open=\"true\"] {\n animation: mosaic-drawer-in 220ms ease-out forwards;\n }\n .mosaic-nav-drawer[data-open=\"false\"] {\n animation: mosaic-drawer-out 180ms ease-in forwards;\n }\n @media (prefers-reduced-motion: reduce) {\n .mosaic-nav-drawer { animation: none !important; }\n }\n `;\n document.head.appendChild(s);\n}\n\n// ── Hamburger icon (inline SVG) ───────────────────────────────────────────────\n\nfunction HamburgerIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\" />\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" />\n <line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\" />\n </svg>\n );\n}\n\nfunction CloseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n// ── Default link renderer ─────────────────────────────────────────────────────\n\nfunction defaultRenderLink(\n item: MosaicNavItem,\n children: React.ReactNode,\n className: string,\n onClick?: () => void,\n) {\n return (\n <a key={item.href} href={item.href} className={className} onClick={onClick}>\n {children}\n </a>\n );\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\nexport function MosaicMainNav({\n items = [],\n activePath,\n isAdmin = false,\n renderLink,\n drawerTitle,\n drawerSubtitle,\n openMenuAriaLabel,\n closeMenuAriaLabel,\n drawerNavAriaLabel,\n mainNavAriaLabel,\n adminBadgeLabel,\n className,\n}: MosaicMainNavProps) {\n const { isMobile } = useDevice();\n const [isOpen, setIsOpen] = React.useState(false);\n const linkRenderer = renderLink ?? defaultRenderLink;\n\n React.useEffect(() => {\n injectStyles();\n }, []);\n\n // Close on escape\n React.useEffect(() => {\n if (!isOpen) return;\n const handler = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setIsOpen(false);\n };\n document.addEventListener(\"keydown\", handler);\n return () => document.removeEventListener(\"keydown\", handler);\n }, [isOpen]);\n\n const filteredItems = items.filter((item) => !item.adminOnly || isAdmin);\n\n const isItemActive = (item: MosaicNavItem) =>\n item.isActive ?? (activePath !== undefined && item.href === activePath);\n\n if (isMobile) {\n return (\n <div data-slot=\"main-nav\" className={className}>\n <button\n type=\"button\"\n onClick={() => setIsOpen(!isOpen)}\n className={cn(\n \"inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-md p-0\",\n \"text-foreground hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n aria-label={openMenuAriaLabel}\n aria-expanded={isOpen}\n >\n <HamburgerIcon />\n </button>\n\n {/* Backdrop */}\n {isOpen && (\n <button\n type=\"button\"\n className=\"fixed inset-0 z-40 bg-black/50 cursor-default\"\n onClick={() => setIsOpen(false)}\n aria-label={closeMenuAriaLabel}\n tabIndex={-1}\n />\n )}\n\n {/* Drawer */}\n <dialog\n aria-label={drawerNavAriaLabel}\n open={isOpen}\n data-open={isOpen ? \"true\" : \"false\"}\n className={cn(\n \"mosaic-nav-drawer\",\n \"fixed inset-y-0 left-0 z-50 m-0 w-[280px] max-h-none h-full p-0\",\n \"border-r border-border bg-background shadow-xl\",\n !isOpen && \"hidden\",\n )}\n >\n <div className=\"flex items-center justify-between border-b border-border p-4\">\n <div>\n <p className=\"font-semibold\">{drawerTitle}</p>\n <p className=\"text-sm text-muted-foreground\">{drawerSubtitle}</p>\n </div>\n <button\n type=\"button\"\n onClick={() => setIsOpen(false)}\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md\",\n \"text-muted-foreground hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n aria-label={closeMenuAriaLabel}\n >\n <CloseIcon />\n </button>\n </div>\n <nav className=\"flex flex-col gap-1 p-4\" aria-label={mainNavAriaLabel}>\n {filteredItems.map((item) => {\n const Icon = item.icon;\n const active = isItemActive(item);\n const itemClass = cn(\n \"flex items-center gap-3 rounded-lg px-3 py-3 text-sm font-medium transition-colors\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"min-h-[44px]\",\n active && \"bg-accent text-accent-foreground\",\n );\n return (\n <React.Fragment key={item.href}>\n {linkRenderer(\n item,\n <>\n {Icon && <Icon className=\"h-5 w-5 shrink-0\" aria-hidden=\"true\" />}\n <span>{item.label}</span>\n {item.adminOnly && (\n <span className=\"ml-auto rounded bg-primary/10 px-2 py-0.5 text-xs text-primary\">\n {adminBadgeLabel}\n </span>\n )}\n </>,\n itemClass,\n () => setIsOpen(false),\n )}\n </React.Fragment>\n );\n })}\n </nav>\n </dialog>\n </div>\n );\n }\n\n return (\n <nav\n data-slot=\"main-nav\"\n className={cn(\"flex items-center gap-1\", className)}\n aria-label={mainNavAriaLabel}\n >\n {filteredItems.map((item) => {\n const Icon = item.icon;\n const active = isItemActive(item);\n const itemClass = cn(\n \"flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n active && \"bg-accent text-accent-foreground\",\n );\n return (\n <React.Fragment key={item.href}>\n {linkRenderer(\n item,\n <>\n {Icon && <Icon className=\"h-4 w-4\" aria-hidden=\"true\" />}\n <span>{item.label}</span>\n {item.adminOnly && (\n <span className=\"rounded bg-primary/10 px-1.5 py-0.5 text-xs text-primary\">\n {adminBadgeLabel}\n </span>\n )}\n </>,\n itemClass,\n )}\n </React.Fragment>\n );\n })}\n </nav>\n );\n}\n\nMosaicMainNav.displayName = \"MosaicMainNav\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-markdown",
4
+ "title": "MosaicMarkdown",
5
+ "description": "MosaicMarkdown — presentational, dependency-free markdown renderer",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/markdown/MosaicMarkdown.tsx",
11
+ "type": "registry:ui",
12
+ "content": "/**\n * MosaicMarkdown — presentational, dependency-free markdown renderer\n *\n * Renders a subset of markdown (headings, paragraphs, ordered/unordered\n * lists, links, bold/italic, inline code, fenced code blocks, tables,\n * blockquotes, horizontal rules) straight from a `content: string` prop.\n *\n * SECURITY — non-negotiable: `content` is assumed to come from an untrusted\n * source (an LLM's own generated text). This component NEVER parses raw HTML\n * out of that string and NEVER uses `dangerouslySetInnerHTML`: every markdown\n * token is turned into React elements built from parsed TEXT, so anything\n * that looks like an HTML tag (`<script>…</script>`, `<img onerror=…>`) is\n * rendered as an inert text node, never as an active DOM element. Link\n * `href`s are scheme-checked (`http:`/`https:`/`mailto:`/relative only), after\n * every ASCII control character is stripped from the whole string (not just\n * the edges) so a scheme obfuscated with an internal control character (e.g.\n * a TAB inserted mid-`javascript:`) cannot slip past as scheme-less —\n * `javascript:`/`data:` and any other scheme are rejected and the link\n * degrades to its plain label text. Every external link renders with\n * `rel=\"noopener noreferrer\"` and `target=\"_blank\"`.\n *\n * DEPENDENCY POLICY: this library's `dependencies` are currently limited to\n * `@base-ui/react` and `class-variance-authority`. A full markdown renderer\n * (react-markdown, marked, remark, streamdown…) was deliberately NOT added\n * — none of them are declared here, in `dependencies` or otherwise. Instead\n * this file implements a minimal, dependency-free block + inline parser\n * covering the required subset. See this package's PR description for the\n * explicit statement of this choice.\n *\n * Code blocks: no syntax highlighter is bundled (would be a hidden\n * dependency and/or heavy runtime cost). The optional `renderCodeBlock` prop\n * is the host's extension point — pass a highlighter of your choice\n * (Shiki, Prism, etc.) and this component defers to it entirely; omit it and\n * a plain `<pre><code>` block is rendered.\n *\n * No \"use client\" — prepend-use-client.mjs adds it to dist. Presentational:\n * zero network calls, zero side effects beyond rendering.\n *\n * @example\n * <MosaicMarkdown content={\"# Title\\n\\nSome **bold** text with a [link](https://example.com).\"} />\n *\n * @example\n * // Host-provided syntax highlighting\n * <MosaicMarkdown\n * content={agentReply}\n * renderCodeBlock={({ language, code }) => <MyHighlighter language={language}>{code}</MyHighlighter>}\n * />\n */\n\nimport type * as React from \"react\";\nimport {\n markdownBlockquoteVariants,\n markdownCodeBlockVariants,\n markdownEmphasisVariants,\n markdownHeadingVariants,\n markdownHrVariants,\n markdownInlineCodeVariants,\n markdownLinkVariants,\n markdownListItemVariants,\n markdownListVariants,\n markdownParagraphVariants,\n markdownRootVariants,\n markdownTableCellVariants,\n markdownTableVariants,\n markdownTableWrapperVariants,\n} from \"./markdown-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n/**\n * Allow-list link scheme check. `javascript:`, `data:`, `vbscript:` and any\n * other active/opaque scheme are rejected — only `http:`, `https:`,\n * `mailto:`, or a scheme-less (relative/anchor) URL are considered safe.\n *\n * This guarantee holds on its own, independent of any host-runtime behavior:\n * every ASCII control character (`\\x00`-`\\x20`, which includes tab, newline,\n * and carriage return) is stripped from the ENTIRE string — not just the\n * leading/trailing edges — before the scheme is matched. Without this, a\n * scheme obfuscated with an internal control character (e.g. `java` + TAB +\n * `script:...`) would fail the scheme regex, get treated as scheme-less, and\n * be returned unmodified; only React's own href-sanitization would then\n * block it at render time — a filter this component must not rely on.\n */\nfunction sanitizeHref(rawHref: string): string | null {\n // Strip every ASCII control character (\\x00-\\x20) anywhere in the string,\n // not merely at the edges: trim() alone only removes edge whitespace and\n // leaves an internally-inserted control character (e.g. a TAB placed\n // mid-scheme) untouched — exactly the obfuscation vector this guards\n // against.\n // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional — stripping control chars is the security fix itself\n const href = rawHref.replace(/[\\x00-\\x20]/g, \"\");\n if (!href) return null;\n const schemeMatch = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(href);\n if (!schemeMatch) return href; // scheme-less: relative path, anchor, etc.\n const scheme = schemeMatch[1].toLowerCase();\n return scheme === \"http\" || scheme === \"https\" || scheme === \"mailto\" ? href : null;\n}\n\n// ── Inline parsing ──────────────────────────────────────────────────────────\n\ntype IdSource = { next: () => number };\n\nfunction makeIdSource(): IdSource {\n let current = 0;\n return {\n next: () => {\n current += 1;\n return current;\n },\n };\n}\n\n/**\n * Turns a run of inline markdown text into React nodes. Recognizes, in\n * priority order: inline code (`` `code` ``), links (`[label](href)`), bold\n * (`**text**`), italic (`*text*`). Everything else — including anything that\n * LOOKS like an HTML tag — is treated as plain text and never parsed as\n * markup, so it can never execute.\n */\nfunction parseInline(text: string, ids: IdSource): React.ReactNode[] {\n const nodes: React.ReactNode[] = [];\n let buffer = \"\";\n let i = 0;\n\n const flush = () => {\n if (buffer.length > 0) {\n nodes.push(buffer);\n buffer = \"\";\n }\n };\n\n while (i < text.length) {\n const rest = text.slice(i);\n\n const codeMatch = /^`([^`]+)`/.exec(rest);\n if (codeMatch) {\n flush();\n nodes.push(\n <code key={ids.next()} className={markdownInlineCodeVariants()}>\n {codeMatch[1]}\n </code>,\n );\n i += codeMatch[0].length;\n continue;\n }\n\n const linkMatch = /^\\[([^\\]]*)\\]\\(((?:[^()]|\\([^()]*\\))*)\\)/.exec(rest);\n if (linkMatch) {\n flush();\n const label = linkMatch[1];\n const safeHref = sanitizeHref(linkMatch[2]);\n if (safeHref) {\n nodes.push(\n <a\n key={ids.next()}\n href={safeHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={markdownLinkVariants()}\n >\n {parseInline(label, ids)}\n </a>,\n );\n } else {\n nodes.push(...parseInline(label, ids));\n }\n i += linkMatch[0].length;\n continue;\n }\n\n const boldMatch = /^\\*\\*([^*]+)\\*\\*/.exec(rest);\n if (boldMatch) {\n flush();\n nodes.push(\n <strong key={ids.next()} className={markdownEmphasisVariants({ tone: \"strong\" })}>\n {parseInline(boldMatch[1], ids)}\n </strong>,\n );\n i += boldMatch[0].length;\n continue;\n }\n\n const italicMatch = /^\\*([^*]+)\\*/.exec(rest);\n if (italicMatch) {\n flush();\n nodes.push(\n <em key={ids.next()} className={markdownEmphasisVariants({ tone: \"emphasis\" })}>\n {parseInline(italicMatch[1], ids)}\n </em>,\n );\n i += italicMatch[0].length;\n continue;\n }\n\n buffer += text[i];\n i += 1;\n }\n\n flush();\n return nodes;\n}\n\n// ── Block parsing ─────────────────────────────────────────────────────────────\n\ntype Block =\n | { id: number; kind: \"heading\"; level: 1 | 2 | 3 | 4 | 5 | 6; text: string }\n | { id: number; kind: \"paragraph\"; text: string }\n | { id: number; kind: \"list\"; ordered: boolean; items: { id: number; text: string }[] }\n | { id: number; kind: \"blockquote\"; text: string }\n | { id: number; kind: \"hr\" }\n | { id: number; kind: \"code\"; language: string | undefined; code: string }\n | { id: number; kind: \"table\"; header: string[]; rows: string[][] };\n\nconst FENCE_RE = /^```(\\S*)\\s*$/;\nconst HEADING_RE = /^(#{1,6})\\s+(.*)$/;\nconst HR_RE = /^(-{3,}|\\*{3,}|_{3,})$/;\nconst UNORDERED_ITEM_RE = /^[-*+]\\s+/;\nconst ORDERED_ITEM_RE = /^\\d+\\.\\s+/;\nconst BLOCKQUOTE_LINE_RE = /^>\\s?/;\nconst TABLE_SEPARATOR_RE = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/;\n\nfunction parseTableRow(line: string): string[] {\n const trimmed = line.trim().replace(/^\\|/, \"\").replace(/\\|$/, \"\");\n return trimmed.split(\"|\").map((cell) => cell.trim());\n}\n\nfunction parseBlocks(content: string): Block[] {\n const lines = content.split(/\\r?\\n/);\n const blocks: Block[] = [];\n let id = 0;\n const nextId = () => {\n id += 1;\n return id;\n };\n\n let i = 0;\n while (i < lines.length) {\n const line = lines[i];\n\n if (line.trim() === \"\") {\n i += 1;\n continue;\n }\n\n const fenceMatch = FENCE_RE.exec(line);\n if (fenceMatch) {\n const language = fenceMatch[1] || undefined;\n const codeLines: string[] = [];\n i += 1;\n while (i < lines.length && !/^```\\s*$/.test(lines[i])) {\n codeLines.push(lines[i]);\n i += 1;\n }\n i += 1; // skip closing fence\n blocks.push({ id: nextId(), kind: \"code\", language, code: codeLines.join(\"\\n\") });\n continue;\n }\n\n const headingMatch = HEADING_RE.exec(line);\n if (headingMatch) {\n blocks.push({\n id: nextId(),\n kind: \"heading\",\n level: headingMatch[1].length as 1 | 2 | 3 | 4 | 5 | 6,\n text: headingMatch[2].trim(),\n });\n i += 1;\n continue;\n }\n\n if (HR_RE.test(line.trim())) {\n blocks.push({ id: nextId(), kind: \"hr\" });\n i += 1;\n continue;\n }\n\n if (line.includes(\"|\") && i + 1 < lines.length && TABLE_SEPARATOR_RE.test(lines[i + 1])) {\n const header = parseTableRow(line);\n i += 2;\n const rows: string[][] = [];\n while (i < lines.length && lines[i].trim() !== \"\" && lines[i].includes(\"|\")) {\n rows.push(parseTableRow(lines[i]));\n i += 1;\n }\n blocks.push({ id: nextId(), kind: \"table\", header, rows });\n continue;\n }\n\n if (BLOCKQUOTE_LINE_RE.test(line)) {\n const quoteLines: string[] = [];\n while (i < lines.length && BLOCKQUOTE_LINE_RE.test(lines[i])) {\n quoteLines.push(lines[i].replace(BLOCKQUOTE_LINE_RE, \"\"));\n i += 1;\n }\n blocks.push({ id: nextId(), kind: \"blockquote\", text: quoteLines.join(\" \") });\n continue;\n }\n\n if (UNORDERED_ITEM_RE.test(line)) {\n const items: { id: number; text: string }[] = [];\n while (i < lines.length && UNORDERED_ITEM_RE.test(lines[i])) {\n items.push({ id: nextId(), text: lines[i].replace(UNORDERED_ITEM_RE, \"\") });\n i += 1;\n }\n blocks.push({ id: nextId(), kind: \"list\", ordered: false, items });\n continue;\n }\n\n if (ORDERED_ITEM_RE.test(line)) {\n const items: { id: number; text: string }[] = [];\n while (i < lines.length && ORDERED_ITEM_RE.test(lines[i])) {\n items.push({ id: nextId(), text: lines[i].replace(ORDERED_ITEM_RE, \"\") });\n i += 1;\n }\n blocks.push({ id: nextId(), kind: \"list\", ordered: true, items });\n continue;\n }\n\n const paragraphLines: string[] = [];\n while (\n i < lines.length &&\n lines[i].trim() !== \"\" &&\n !FENCE_RE.test(lines[i]) &&\n !HEADING_RE.test(lines[i]) &&\n !UNORDERED_ITEM_RE.test(lines[i]) &&\n !ORDERED_ITEM_RE.test(lines[i]) &&\n !BLOCKQUOTE_LINE_RE.test(lines[i]) &&\n !HR_RE.test(lines[i].trim())\n ) {\n paragraphLines.push(lines[i]);\n i += 1;\n }\n blocks.push({ id: nextId(), kind: \"paragraph\", text: paragraphLines.join(\" \") });\n }\n\n return blocks;\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicMarkdownProps {\n /**\n * Markdown source to render. Treated as UNTRUSTED (e.g. straight from an\n * LLM reply): no raw HTML in this string is ever parsed as active markup.\n */\n content: string;\n /**\n * Extension point for fenced-code-block rendering (e.g. host-side syntax\n * highlighting). When omitted, code renders in a plain `<pre><code>` block\n * with no highlighting and no bundled highlighter dependency.\n */\n renderCodeBlock?: (props: { language: string | undefined; code: string }) => React.ReactNode;\n /** Additional Tailwind classes on the root element. */\n className?: string;\n /** React 19 ref prop — forwarded to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicMarkdown — production markdown-rendering atom for\n * @vantageos/mosaic-blocks.\n *\n * Purely presentational: parses `content` into a minimal block/inline AST and\n * renders it as React elements. No network call, no raw-HTML injection.\n */\nexport function MosaicMarkdown({ content, renderCodeBlock, className, ref }: MosaicMarkdownProps) {\n const blocks = parseBlocks(content);\n const ids = makeIdSource();\n\n return (\n <div ref={ref} data-slot=\"markdown\" className={cn(markdownRootVariants(), className)}>\n {blocks.map((block) => {\n if (block.kind === \"heading\") {\n const HeadingTag = `h${block.level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <HeadingTag key={block.id} className={markdownHeadingVariants({ level: block.level })}>\n {parseInline(block.text, ids)}\n </HeadingTag>\n );\n }\n\n if (block.kind === \"paragraph\") {\n return (\n <p key={block.id} className={markdownParagraphVariants()}>\n {parseInline(block.text, ids)}\n </p>\n );\n }\n\n if (block.kind === \"list\") {\n const ListTag = block.ordered ? \"ol\" : \"ul\";\n return (\n <ListTag key={block.id} className={markdownListVariants({ ordered: block.ordered })}>\n {block.items.map((item) => (\n <li key={item.id} className={markdownListItemVariants()}>\n {parseInline(item.text, ids)}\n </li>\n ))}\n </ListTag>\n );\n }\n\n if (block.kind === \"blockquote\") {\n return (\n <blockquote key={block.id} className={markdownBlockquoteVariants()}>\n {parseInline(block.text, ids)}\n </blockquote>\n );\n }\n\n if (block.kind === \"hr\") {\n return <hr key={block.id} className={markdownHrVariants()} />;\n }\n\n if (block.kind === \"code\") {\n if (renderCodeBlock) {\n return (\n <div key={block.id}>\n {renderCodeBlock({ language: block.language, code: block.code })}\n </div>\n );\n }\n return (\n <pre\n key={block.id}\n data-slot=\"markdown-code-block\"\n {...(block.language ? { \"data-language\": block.language } : {})}\n className={markdownCodeBlockVariants()}\n >\n <code>{block.code}</code>\n </pre>\n );\n }\n\n // table\n return (\n <div key={block.id} className={markdownTableWrapperVariants()}>\n <table className={markdownTableVariants()}>\n <thead>\n <tr>\n {block.header.map((cell) => (\n <th key={ids.next()} className={markdownTableCellVariants({ header: true })}>\n {parseInline(cell, ids)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {block.rows.map((row) => (\n <tr key={ids.next()}>\n {row.map((cell) => (\n <td key={ids.next()} className={markdownTableCellVariants({ header: false })}>\n {parseInline(cell, ids)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n })}\n </div>\n );\n}\n\nMosaicMarkdown.displayName = \"MosaicMarkdown\";\n"
13
+ },
14
+ {
15
+ "path": "src/components/markdown/markdown-variants.ts",
16
+ "type": "registry:ui",
17
+ "content": "/**\n * markdownVariants — pure CVA variant functions for MosaicMarkdown.\n *\n * Isolated in their own module so they can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React.\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\n/** Root container — resets first/last child margins so the block sits flush. */\nexport const markdownRootVariants = cva([\n \"min-w-0 text-[15px] leading-6 text-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0\",\n]);\n\n/** Heading variants, by level 1-6. */\nexport const markdownHeadingVariants = cva([\"font-medium tracking-normal text-foreground\"], {\n variants: {\n level: {\n 1: \"mt-7 mb-4 text-xl leading-7\",\n 2: \"mt-6 mb-3 text-base leading-6\",\n 3: \"mt-5 mb-2 text-sm leading-6\",\n 4: \"mt-4 mb-2 text-sm leading-6\",\n 5: \"mt-4 mb-2 text-xs leading-5\",\n 6: \"mt-4 mb-2 text-xs leading-5 text-muted-foreground\",\n },\n },\n defaultVariants: {\n level: 1,\n },\n});\n\n/** Paragraph text. */\nexport const markdownParagraphVariants = cva([\"mb-3 text-[15px] leading-6 text-foreground\"]);\n\n/** Ordered/unordered list container, by ordered flag. */\nexport const markdownListVariants = cva([\"mb-3 flex flex-col gap-1.5 pl-8 text-[15px] leading-6\"], {\n variants: {\n ordered: {\n true: \"list-decimal\",\n false: \"list-disc\",\n },\n },\n defaultVariants: {\n ordered: false,\n },\n});\n\n/** List item. */\nexport const markdownListItemVariants = cva([\"pl-1 text-[15px] leading-6 text-foreground\"]);\n\n/** Blockquote. */\nexport const markdownBlockquoteVariants = cva([\n \"mb-3 border-l-2 border-border pl-3 text-[15px] leading-6 text-muted-foreground\",\n]);\n\n/** Horizontal rule. */\nexport const markdownHrVariants = cva([\"my-4 border-border/70\"]);\n\n/** Inline emphasis (bold / italic). */\nexport const markdownEmphasisVariants = cva([], {\n variants: {\n tone: {\n strong: \"font-medium text-foreground\",\n emphasis: \"italic\",\n },\n },\n});\n\n/** Inline code span. */\nexport const markdownInlineCodeVariants = cva([\n \"rounded-md border border-border/70 bg-muted/40 px-1.5 py-0.5 font-mono text-[0.92em] text-foreground\",\n]);\n\n/** Fenced code block container. */\nexport const markdownCodeBlockVariants = cva([\n \"mb-3 overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-[0.92em] text-foreground\",\n]);\n\n/** External link. */\nexport const markdownLinkVariants = cva([\n \"font-medium text-foreground underline decoration-border underline-offset-4 transition-colors hover:decoration-foreground\",\n]);\n\n/** Table wrapper (scroll container). */\nexport const markdownTableWrapperVariants = cva([\"mb-3 w-full overflow-x-auto\"]);\n\n/** Table element. */\nexport const markdownTableVariants = cva([\"w-full border-collapse text-[15px] leading-6\"]);\n\n/** Table cell, by header flag + column alignment. */\nexport const markdownTableCellVariants = cva([\"border border-border px-3 py-1.5\"], {\n variants: {\n header: {\n true: \"bg-muted/40 font-medium text-foreground\",\n false: \"text-foreground\",\n },\n align: {\n left: \"text-left\",\n center: \"text-center\",\n right: \"text-right\",\n },\n },\n defaultVariants: {\n header: false,\n align: \"left\",\n },\n});\n"
18
+ }
19
+ ],
20
+ "type": "registry:ui"
21
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-marketplace-card",
4
+ "title": "MosaicMarketplaceCard",
5
+ "description": "MosaicMarketplaceCard — standalone agent-type gallery tile (M1)",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-badge.json",
9
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-card.json"
10
+ ],
11
+ "files": [
12
+ {
13
+ "path": "src/components/marketplace-card/MosaicMarketplaceCard.tsx",
14
+ "type": "registry:ui",
15
+ "content": "\"use client\";\n\n/**\n * MosaicMarketplaceCard — standalone agent-type gallery tile (M1)\n *\n * Ported from any-debate-ai components/marketplace/desktop/marketplace-card-desktop.tsx\n * and components/marketplace/mobile/marketplace-card-mobile.tsx.\n *\n * This is the tile shown for an agent-type inside a PUBLIC gallery — what a\n * visitor sees before adopting someone else's work. Distinct from the private\n * `MarketplaceCard` embedded inside MosaicMarketplaceList (which is coupled to\n * that list's filter/search state and not exported standalone): this card is a\n * composable, standalone atom usable in any grid, storybook page, or gallery\n * outside a filtered list context.\n *\n * SIN-01: every visible string (adopt/unadopt/preview labels, rating label,\n * mentions) is a required prop with no default. No popularity threshold, no\n * computed rating judgement, no host-decided badge — mentions are plain\n * strings supplied by the caller.\n *\n * Composes MosaicCard sub-parts + MosaicBadge rather than re-implementing\n * card chrome or badge chrome.\n */\n\nimport type * as React from \"react\";\nimport { MosaicBadge } from \"@/components/ui/MosaicBadge\";\nimport { MosaicCard, MosaicCardDescription, MosaicCardTitle } from \"@/components/ui/MosaicCard\";\nimport { marketplaceCardVariants } from \"./marketplace-card-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicMarketplaceCardProps {\n /** Stable identifier forwarded to onAdopt/onUnadopt/onPreview. */\n id: string;\n /** Agent-type name. Required content. */\n name: string;\n /** Optional agent-type description. */\n description?: string;\n /** Icon/avatar node rendered at the top of the card. */\n icon?: React.ReactNode;\n /** Host-provided rating value (e.g. 4.8). No computed threshold or judgement. */\n rating?: number;\n /** Host-provided plain-text mentions/badges (e.g. \"Verified\", \"New\"). No lib-decided badges. */\n mentions?: string[];\n /** Whether this agent-type is already adopted by the viewer. */\n isAdopted?: boolean;\n /** Called with `id` when the adopt action is invoked. */\n onAdopt?: (id: string) => void;\n /** Called with `id` when the unadopt action is invoked. */\n onUnadopt?: (id: string) => void;\n /** Called with `id` when the preview action is invoked. Preview button renders only when provided. */\n onPreview?: (id: string) => void;\n /** Label for the adopt action button. Required — host-owned, no default. */\n adoptLabel: string;\n /** Label for the unadopt action button. Required — host-owned, no default. */\n unadoptLabel: string;\n /** Label for the preview action button. Required — host-owned, no default. */\n previewLabel: string;\n /** Accessible suffix rendered next to the rating value (e.g. \"out of 5\"). Required — host-owned, no default. */\n ratingLabel: string;\n /** Layout variant. */\n variant?: \"default\" | \"compact\";\n className?: string;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicMarketplaceCard — standalone tile for an agent-type in a public gallery.\n *\n * @example\n * <MosaicMarketplaceCard\n * id=\"agent-42\"\n * name=\"Vantage Researcher\"\n * description=\"Deep research agent for market analysis\"\n * mentions={[\"Verified\"]}\n * onAdopt={(id) => adopt(id)}\n * onPreview={(id) => openPreview(id)}\n * adoptLabel=\"Adopt\"\n * unadoptLabel=\"Remove\"\n * previewLabel=\"Preview\"\n * ratingLabel=\"out of 5\"\n * />\n */\nexport function MosaicMarketplaceCard({\n id,\n name,\n description,\n icon,\n rating,\n mentions,\n isAdopted = false,\n onAdopt,\n onUnadopt,\n onPreview,\n adoptLabel,\n unadoptLabel,\n previewLabel,\n ratingLabel,\n variant = \"default\",\n className,\n}: MosaicMarketplaceCardProps) {\n const compact = variant === \"compact\";\n\n return (\n <MosaicCard\n data-slot=\"marketplace-card\"\n className={cn(marketplaceCardVariants({ variant }), className)}\n >\n {icon && (\n <div\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground\",\n compact ? \"h-10 w-10\" : \"h-12 w-12\",\n )}\n >\n {icon}\n </div>\n )}\n\n <div className=\"min-w-0 flex-1\">\n <MosaicCardTitle className={cn(\"truncate\", compact ? \"text-sm\" : \"text-base\")}>\n {name}\n </MosaicCardTitle>\n\n {description && (\n <MosaicCardDescription\n data-slot=\"marketplace-card-description\"\n className=\"mt-1 line-clamp-2\"\n >\n {description}\n </MosaicCardDescription>\n )}\n\n {mentions && mentions.length > 0 && (\n <div className=\"mt-2 flex flex-wrap gap-1\">\n {mentions.map((mention) => (\n <MosaicBadge key={mention} variant=\"secondary\">\n {mention}\n </MosaicBadge>\n ))}\n </div>\n )}\n\n {rating != null && (\n <div\n data-slot=\"marketplace-card-rating\"\n className=\"mt-2 flex items-center gap-1 text-xs text-muted-foreground\"\n >\n <span className=\"font-medium text-foreground\">{rating}</span>\n <span>{ratingLabel}</span>\n </div>\n )}\n </div>\n\n <div className={cn(\"flex gap-2\", compact ? \"shrink-0\" : \"mt-1\")}>\n {onPreview && (\n <button\n type=\"button\"\n onClick={() => onPreview(id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md border border-border\",\n \"bg-background px-3 text-xs font-medium text-foreground\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {previewLabel}\n </button>\n )}\n {isAdopted\n ? onUnadopt && (\n <button\n type=\"button\"\n onClick={() => onUnadopt(id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md\",\n \"bg-secondary px-3 text-xs font-medium text-secondary-foreground\",\n \"hover:bg-secondary/80\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {unadoptLabel}\n </button>\n )\n : onAdopt && (\n <button\n type=\"button\"\n onClick={() => onAdopt(id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md\",\n \"bg-primary px-3 text-xs font-medium text-primary-foreground\",\n \"hover:bg-primary/90\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {adoptLabel}\n </button>\n )}\n </div>\n </MosaicCard>\n );\n}\n\nMosaicMarketplaceCard.displayName = \"MosaicMarketplaceCard\";\n"
16
+ },
17
+ {
18
+ "path": "src/components/marketplace-card/marketplace-card-variants.ts",
19
+ "type": "registry:ui",
20
+ "content": "/**\n * marketplaceCardVariants — pure CVA variant function for MosaicMarketplaceCard.\n *\n * Isolated in its own module so it can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React.\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const marketplaceCardVariants = cva(\n [\"rounded-xl border border-border bg-card p-4 transition-shadow\", \"hover:shadow-md\"],\n {\n variants: {\n variant: {\n default: \"flex flex-col gap-3\",\n compact: \"flex flex-row items-center gap-3\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n"
21
+ }
22
+ ],
23
+ "type": "registry:ui"
24
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-marketplace-list",
4
+ "title": "MosaicMarketplaceList",
5
+ "description": "Responsive marketplace grid/list (responsive-pair). Install/uninstall actions, rating, downloads, price.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-adaptive-modal.json",
9
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-device-provider.json",
10
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-filter-sidebar.json"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/components/marketplace-list/MosaicMarketplaceList.tsx",
15
+ "type": "registry:ui",
16
+ "content": "\"use client\";\n\n/**\n * MosaicMarketplaceList — responsive marketplace grid/list (responsive-pair)\n *\n * Ported from components/marketplace/ (marketplace-list.tsx +\n * desktop/marketplace-list-desktop.tsx + mobile/marketplace-list-mobile.tsx +\n * MarketplaceFilterSidebar.tsx)\n *\n * Features:\n * - Desktop: filter sidebar + card grid\n * - Mobile: compact list + filter sheet\n * - Install/uninstall action callbacks\n * - Rating stars, download count, price, category badges\n *\n * Reuses MosaicFilterSidebar for filter sidebar.\n * All mock data stripped — items are props.\n */\n\nimport * as React from \"react\";\nimport { MosaicAdaptiveModal } from \"@/components/ui/MosaicAdaptiveModal\";\nimport { useDevice } from \"@/components/ui/MosaicDeviceProvider\";\nimport { MosaicFilterSidebar } from \"@/components/ui/MosaicFilterSidebar\";\nimport type { MosaicFilterOption } from \"@/components/ui/MosaicFilterSidebar\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicMarketplaceItem {\n id: string;\n title: string;\n description?: string;\n category: string;\n rating?: number;\n downloads?: number;\n price?: string;\n isInstalled?: boolean;\n /** Tailwind accent class for the icon bg (e.g. \"bg-purple-500/10 text-purple-500\") */\n accentClass?: string;\n /** Icon node to render */\n icon?: React.ReactNode;\n tags?: string[];\n}\n\nexport interface MosaicMarketplaceListProps {\n items: MosaicMarketplaceItem[];\n filters?: MosaicFilterOption[];\n selectedFilter: string;\n onFilterChange: (id: string) => void;\n categories?: MosaicFilterOption[];\n selectedCategory: string;\n onCategoryChange: (id: string) => void;\n onInstall?: (itemId: string) => void;\n onUninstall?: (itemId: string) => void;\n onPreview?: (itemId: string) => void;\n title?: string;\n searchPlaceholder?: string;\n /** Label for the install action button. Required, no default. */\n installLabel: string;\n /** Label for the uninstall action button. Required, no default. */\n uninstallLabel: string;\n /**\n * Label for the preview button on each card. Required — host-owned,\n * no default.\n */\n previewLabel: string;\n /**\n * Message shown when the filtered item list is empty. Required —\n * host-owned, no default.\n */\n emptyMessage: string;\n /** aria-label for the mobile \"open filters\" button. Required, no default. */\n openFiltersAriaLabel: string;\n /** Title of the mobile filters modal. Required, no default. */\n filtersModalTitle: string;\n /** aria-label for the mobile filters modal close button. Required, no default. */\n closeFiltersAriaLabel: string;\n /** Forwarded to MosaicFilterSidebar — required, no default. */\n expandFiltersAriaLabel: string;\n /** Forwarded to MosaicFilterSidebar — required, no default. */\n categoriesHeading: string;\n /** Forwarded to MosaicFilterSidebar — required, no default. */\n collapseSidebarAriaLabel: string;\n /** Forwarded to MosaicFilterSidebar — required, no default. */\n expandSidebarAriaLabel: string;\n className?: string;\n}\n\n// ── Inline icons ──────────────────────────────────────────────────────────────\n\nfunction StarIcon({ filled }: { filled?: boolean }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill={filled ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\" />\n </svg>\n );\n}\n\nfunction DownloadIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <polyline points=\"7 10 12 15 17 10\" />\n <line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\" />\n </svg>\n );\n}\n\nfunction SearchIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" />\n </svg>\n );\n}\n\nfunction FilterIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n );\n}\n\n// ── Item card ─────────────────────────────────────────────────────────────────\n\nfunction MarketplaceCard({\n item,\n onInstall,\n onUninstall,\n onPreview,\n installLabel,\n uninstallLabel,\n previewLabel,\n compact = false,\n}: {\n item: MosaicMarketplaceItem;\n onInstall?: (id: string) => void;\n onUninstall?: (id: string) => void;\n onPreview?: (id: string) => void;\n installLabel: string;\n uninstallLabel: string;\n previewLabel: string;\n compact?: boolean;\n}) {\n const ratingInt = Math.round(item.rating ?? 0);\n\n return (\n <div\n data-slot=\"marketplace-card\"\n className={cn(\n \"rounded-lg border border-border bg-card p-4 transition-shadow hover:shadow-md\",\n compact ? \"flex items-center gap-3\" : \"flex flex-col gap-3\",\n )}\n >\n {/* Icon */}\n {item.icon && (\n <div\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-lg\",\n compact ? \"h-10 w-10\" : \"h-12 w-12\",\n item.accentClass ?? \"bg-muted text-muted-foreground\",\n )}\n >\n {item.icon}\n </div>\n )}\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className={cn(\"font-semibold leading-tight\", compact ? \"text-sm\" : \"text-base\")}>\n {item.title}\n </p>\n {item.description && !compact && (\n <p className=\"mt-1 text-sm text-muted-foreground line-clamp-2\">{item.description}</p>\n )}\n </div>\n {item.price && (\n <span className=\"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground\">\n {item.price}\n </span>\n )}\n </div>\n\n {!compact && (\n <div className=\"mt-2 flex items-center gap-3 text-xs text-muted-foreground\">\n <span className=\"rounded-md border border-border px-2 py-0.5\">{item.category}</span>\n {item.rating != null && (\n <span className=\"flex items-center gap-1 text-yellow-500\">\n {([1, 2, 3, 4, 5] as const).map((star) => (\n <StarIcon key={star} filled={star <= ratingInt} />\n ))}\n <span className=\"text-muted-foreground\">{item.rating.toFixed(1)}</span>\n </span>\n )}\n {item.downloads != null && (\n <span className=\"flex items-center gap-1\">\n <DownloadIcon />\n {item.downloads.toLocaleString()}\n </span>\n )}\n </div>\n )}\n </div>\n\n {/* Actions */}\n <div className={cn(\"flex gap-2\", compact ? \"shrink-0\" : \"mt-1\")}>\n {onPreview && (\n <button\n type=\"button\"\n onClick={() => onPreview(item.id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md border border-border\",\n \"bg-background px-3 text-xs font-medium text-foreground\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {previewLabel}\n </button>\n )}\n {item.isInstalled\n ? onUninstall && (\n <button\n type=\"button\"\n onClick={() => onUninstall(item.id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md\",\n \"bg-secondary px-3 text-xs font-medium text-secondary-foreground\",\n \"hover:bg-secondary/80\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {uninstallLabel}\n </button>\n )\n : onInstall && (\n <button\n type=\"button\"\n onClick={() => onInstall(item.id)}\n className={cn(\n \"inline-flex min-h-[36px] items-center justify-center rounded-md\",\n \"bg-primary px-3 text-xs font-medium text-primary-foreground\",\n \"hover:bg-primary/90\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n {installLabel}\n </button>\n )}\n </div>\n </div>\n );\n}\n\n// ── Desktop variant ───────────────────────────────────────────────────────────\n\nfunction MarketplaceListDesktop(props: MosaicMarketplaceListProps) {\n const {\n items,\n filters,\n selectedFilter,\n onFilterChange,\n categories,\n selectedCategory,\n onCategoryChange,\n onInstall,\n onUninstall,\n onPreview,\n title,\n searchPlaceholder,\n installLabel,\n uninstallLabel,\n previewLabel,\n emptyMessage,\n expandFiltersAriaLabel,\n categoriesHeading,\n collapseSidebarAriaLabel,\n expandSidebarAriaLabel,\n } = props;\n\n const [query, setQuery] = React.useState(\"\");\n const [sidebarCollapsed, setSidebarCollapsed] = React.useState(false);\n\n const filtered = items.filter(\n (i) =>\n !query ||\n i.title.toLowerCase().includes(query.toLowerCase()) ||\n (i.description ?? \"\").toLowerCase().includes(query.toLowerCase()),\n );\n\n return (\n <div data-slot=\"marketplace-list-desktop\" className=\"flex h-full flex-col\">\n <div className=\"flex items-center border-b border-border px-6 py-4\">\n <h1 className=\"text-lg font-semibold\">{title}</h1>\n </div>\n <div className=\"flex flex-1 min-h-0\">\n <MosaicFilterSidebar\n isCollapsed={sidebarCollapsed}\n onToggleCollapse={() => setSidebarCollapsed((v) => !v)}\n filters={filters}\n selectedFilter={selectedFilter}\n onFilterChange={onFilterChange}\n categories={categories}\n selectedCategory={selectedCategory}\n onCategoryChange={onCategoryChange}\n expandFiltersAriaLabel={expandFiltersAriaLabel}\n categoriesHeading={categoriesHeading}\n collapseSidebarAriaLabel={collapseSidebarAriaLabel}\n expandSidebarAriaLabel={expandSidebarAriaLabel}\n />\n <div className=\"flex flex-1 flex-col min-w-0\">\n <div className=\"border-b border-border px-6 py-4\">\n <div className=\"relative max-w-md\">\n <span className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n <SearchIcon />\n </span>\n <input\n type=\"search\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={searchPlaceholder}\n className={cn(\n \"w-full rounded-md border border-input bg-background py-2 pl-9 pr-3\",\n \"text-sm placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n />\n </div>\n </div>\n <div className=\"flex-1 overflow-y-auto p-6\">\n <div className=\"grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3\">\n {filtered.map((item) => (\n <MarketplaceCard\n key={item.id}\n item={item}\n onInstall={onInstall}\n onUninstall={onUninstall}\n onPreview={onPreview}\n installLabel={installLabel}\n uninstallLabel={uninstallLabel}\n previewLabel={previewLabel}\n />\n ))}\n </div>\n {filtered.length === 0 && (\n <p className=\"py-12 text-center text-sm text-muted-foreground\">{emptyMessage}</p>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n// ── Mobile variant ────────────────────────────────────────────────────────────\n\nfunction MarketplaceListMobile(props: MosaicMarketplaceListProps) {\n const {\n items,\n filters,\n selectedFilter,\n onFilterChange,\n categories,\n selectedCategory,\n onCategoryChange,\n onInstall,\n onUninstall,\n onPreview,\n title,\n searchPlaceholder,\n installLabel,\n uninstallLabel,\n previewLabel,\n emptyMessage,\n openFiltersAriaLabel,\n filtersModalTitle,\n closeFiltersAriaLabel,\n expandFiltersAriaLabel,\n categoriesHeading,\n collapseSidebarAriaLabel,\n expandSidebarAriaLabel,\n } = props;\n\n const [filterOpen, setFilterOpen] = React.useState(false);\n const [query, setQuery] = React.useState(\"\");\n\n const filtered = items.filter(\n (i) =>\n !query ||\n i.title.toLowerCase().includes(query.toLowerCase()) ||\n (i.description ?? \"\").toLowerCase().includes(query.toLowerCase()),\n );\n\n return (\n <div data-slot=\"marketplace-list-mobile\" className=\"flex flex-col\">\n <div className=\"sticky top-0 z-10 border-b border-border bg-background px-4 py-3\">\n <div className=\"flex items-center justify-between\">\n <h1 className=\"text-base font-semibold\">{title}</h1>\n <button\n type=\"button\"\n onClick={() => setFilterOpen(true)}\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={openFiltersAriaLabel}\n >\n <FilterIcon />\n </button>\n </div>\n <div className=\"relative mt-2\">\n <span className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n <SearchIcon />\n </span>\n <input\n type=\"search\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={searchPlaceholder}\n className={cn(\n \"w-full rounded-md border border-input bg-background py-2 pl-9 pr-3\",\n \"text-sm placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n />\n </div>\n </div>\n\n <div className=\"space-y-3 p-4\">\n {filtered.map((item) => (\n <MarketplaceCard\n key={item.id}\n item={item}\n onInstall={onInstall}\n onUninstall={onUninstall}\n onPreview={onPreview}\n installLabel={installLabel}\n uninstallLabel={uninstallLabel}\n previewLabel={previewLabel}\n compact\n />\n ))}\n {filtered.length === 0 && (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">{emptyMessage}</p>\n )}\n </div>\n\n <MosaicAdaptiveModal\n isOpen={filterOpen}\n onClose={() => setFilterOpen(false)}\n title={filtersModalTitle}\n closeAriaLabel={closeFiltersAriaLabel}\n >\n <div className=\"p-4\">\n <MosaicFilterSidebar\n isCollapsed={false}\n onToggleCollapse={() => setFilterOpen(false)}\n filters={filters}\n selectedFilter={selectedFilter}\n onFilterChange={(id) => {\n onFilterChange(id);\n setFilterOpen(false);\n }}\n categories={categories}\n selectedCategory={selectedCategory}\n expandFiltersAriaLabel={expandFiltersAriaLabel}\n categoriesHeading={categoriesHeading}\n collapseSidebarAriaLabel={collapseSidebarAriaLabel}\n expandSidebarAriaLabel={expandSidebarAriaLabel}\n onCategoryChange={(id) => {\n onCategoryChange(id);\n setFilterOpen(false);\n }}\n />\n </div>\n </MosaicAdaptiveModal>\n </div>\n );\n}\n\n// ── Orchestrator ──────────────────────────────────────────────────────────────\n\nexport function MosaicMarketplaceList(props: MosaicMarketplaceListProps) {\n const { isMobile } = useDevice();\n return isMobile ? <MarketplaceListMobile {...props} /> : <MarketplaceListDesktop {...props} />;\n}\n\nMosaicMarketplaceList.displayName = \"MosaicMarketplaceList\";\n\nexport { MarketplaceListDesktop as MosaicMarketplaceListDesktop };\nexport { MarketplaceListMobile as MosaicMarketplaceListMobile };\n"
17
+ }
18
+ ],
19
+ "type": "registry:ui"
20
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-match-input",
4
+ "title": "MosaicMatchInput",
5
+ "description": "MosaicMatchInput — autocomplete carrying a match state",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-combobox.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/match-input/MosaicMatchInput.tsx",
13
+ "type": "registry:ui",
14
+ "content": "/**\n * MosaicMatchInput — autocomplete carrying a match state\n *\n * Composes MosaicCombobox (no autocomplete re-implementation) and adds a\n * match-state indicator. `matchState` and `stateLabels` are REQUIRED\n * props: the four match states are match semantics, never business\n * logic, and the host owns every label — no English fallback.\n *\n * data-slot=\"match-input\" on the wrapper div.\n */\n\nimport {\n MosaicCombobox,\n type MosaicComboboxItem,\n type MosaicComboboxProps,\n} from \"@/components/ui/MosaicCombobox\";\nimport { matchStateSignal, matchStateVariants } from \"./match-input-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport type MosaicMatchInputState = \"exact\" | \"partial\" | \"ambiguous\" | \"none\";\n\nexport interface MosaicMatchInputStateLabels {\n exact: string;\n partial: string;\n ambiguous: string;\n none: string;\n}\n\nexport interface MosaicMatchInputProps extends Omit<MosaicComboboxProps, \"disabled\" | \"className\"> {\n /** Required — the four match states are match semantics, never inferred. */\n matchState: MosaicMatchInputState;\n /** Required — the host owns every label, no default copy is generated. */\n stateLabels: MosaicMatchInputStateLabels;\n /** Locked mode: the input becomes read-only/disabled. */\n locked?: boolean;\n className?: string;\n}\n\nexport type { MosaicComboboxItem };\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicMatchInput — combobox + match-state indicator.\n *\n * @example\n * <MosaicMatchInput\n * items={items}\n * matchState=\"ambiguous\"\n * stateLabels={{\n * exact: t('MatchInput.exact'),\n * partial: t('MatchInput.partial'),\n * ambiguous: t('MatchInput.ambiguous'),\n * none: t('MatchInput.none'),\n * }}\n * emptyMessage={t('MatchInput.empty')}\n * />\n */\nexport function MosaicMatchInput({\n matchState,\n stateLabels,\n locked,\n className,\n ...comboboxProps\n}: MosaicMatchInputProps) {\n const { role, ariaLive } = matchStateSignal(matchState);\n const label = stateLabels[matchState];\n\n return (\n <div data-slot=\"match-input\" className={cn(\"flex flex-col gap-1\", className)}>\n <MosaicCombobox {...comboboxProps} disabled={locked} />\n <span\n role={role}\n aria-live={ariaLive}\n data-match-state={matchState}\n className={matchStateVariants({ matchState })}\n >\n {label}\n </span>\n </div>\n );\n}\n\nMosaicMatchInput.displayName = \"MosaicMatchInput\";\n"
15
+ },
16
+ {
17
+ "path": "src/components/match-input/match-input-variants.ts",
18
+ "type": "registry:ui",
19
+ "content": "/**\n * matchStateVariants — pure CVA variant function for the match-state\n * indicator rendered by MosaicMatchInput.\n *\n * Each match state maps to a distinct visual + accessible signal so the\n * four states are mutually distinguishable BY THE COMPONENT, independent\n * of whatever label text the host passes in\n * (see MosaicMatchInput.test.tsx negative-pole tests, which pass an\n * IDENTICAL label for all four states on purpose).\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const matchStateVariants = cva([\"text-xs font-medium\"], {\n variants: {\n matchState: {\n exact: \"text-success-700\",\n partial: \"text-warning-700\",\n ambiguous: \"text-warning-700\",\n none: \"text-destructive\",\n },\n },\n defaultVariants: {\n matchState: \"none\",\n },\n});\n\nexport type MosaicMatchInputMatchState = \"exact\" | \"partial\" | \"ambiguous\" | \"none\";\n\nexport interface MatchStateSignal {\n role: \"status\" | \"alert\";\n ariaLive: \"off\" | \"polite\" | \"assertive\";\n}\n\n/**\n * Accessible (role, aria-live) pair per match state. Every one of the four\n * states carries a DIFFERENT pair, so any two states are distinguishable\n * from each other purely from these DOM attributes — never from the\n * label text, which the host controls and must not be relied upon.\n *\n * - exact: status / off — resolved, nothing to announce\n * - partial: status / polite — informational, low urgency\n * - ambiguous: alert / assertive — the dangerous state: a wrong\n * candidate could be silently accepted, so it is the MOST\n * urgent signal, distinct from both \"partial\" (role) and\n * \"none\" (aria-live)\n * - none: alert / polite — terminal, no decision pending, so\n * alert without the assertive urgency of \"ambiguous\"\n */\nexport function matchStateSignal(matchState: MosaicMatchInputMatchState): MatchStateSignal {\n switch (matchState) {\n case \"exact\":\n return { role: \"status\", ariaLive: \"off\" };\n case \"partial\":\n return { role: \"status\", ariaLive: \"polite\" };\n case \"ambiguous\":\n return { role: \"alert\", ariaLive: \"assertive\" };\n case \"none\":\n return { role: \"alert\", ariaLive: \"polite\" };\n }\n}\n"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-memory-card",
4
+ "title": "MosaicMemoryCard",
5
+ "description": "MosaicMemoryCard — memory item card (detailed / compact variants)",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/memory-card/MosaicMemoryCard.tsx",
11
+ "type": "registry:ui",
12
+ "content": "\"use client\";\n\n/**\n * MosaicMemoryCard — memory item card (detailed / compact variants)\n *\n * Ported from any-debate-ai's memory-card-desktop.tsx + memory-card-mobile.tsx\n * as ONE component with a `variant` prop, not two components. What actually\n * differed between the two source files:\n * - Layout density: detailed uses a leading icon chip + title/scope-badge\n * stack + separate content paragraph + tags row + footer with a labelled\n * usage count; compact folds title + content into one truncated header\n * row and drops the tags row entirely. Both variants call\n * `formatUsageCount` for the footer usage count — the caller decides\n * whether that renders a label or a bare number.\n * - Hover-reveal actions: the 3-dot menu trigger is `opacity-0\n * group-hover:opacity-100` in detailed (desktop hover affordance), always\n * visible in compact (no hover on touch).\n * - Scope badge chrome: bordered in detailed, borderless in compact.\n * Everything else (scope colors, source icon, edit/delete menu, time-ago\n * footer) is shared and modeled once.\n *\n * Pattern: MosaicAgentCard.tsx (data-slot, manual dropdown + outside-click\n * close, inline SVG icons, React 19 ref prop, displayName, JSDoc).\n * No \"use client\" side effects beyond menu state — prepend-use-client.mjs\n * adds the directive to dist regardless.\n * Design tokens: --card, --card-foreground, --border, --muted-foreground,\n * --accent, --accent-foreground, --destructive, --popover, --ring.\n * No icon library — inline SVGs only (no lucide-react dependency in this repo).\n * a11y: dropdown via role=\"menu\"/\"menuitem\", aria-haspopup, aria-expanded,\n * required aria-label on the trigger.\n * Bilingual (SIN-01): zero user-facing strings hardcoded. Every label is a\n * required prop or a required formatter function — no optional prop with an\n * English default anywhere in this file.\n *\n * Props are pushed into the `MosaicMemoryCardVariantProps` discriminated\n * union exactly where they are read — no prop is required on a variant that\n * never renders it. `formatMoreTags` is required only on the `\"detailed\"`\n * (default) member: the `\"compact\"` variant drops the tags row entirely and\n * never calls it, so it is not part of `\"compact\"`'s member of the union\n * (fixed after being flagged as a \"lying prop contract\" by the\n * `no-lying-prop-contract` guard test — see that file and the memory-card's\n * own type definitions below).\n *\n * Closes T1 (bu-mcp memory wave) — mosaic-memory-card.\n *\n * @example\n * // Detailed variant (default) — full card with tags row and labelled footer\n * <MosaicMemoryCard\n * memory={memory}\n * editLabel=\"Edit\"\n * deleteLabel=\"Delete\"\n * moreActionsLabel=\"Memory actions\"\n * formatScope={(scope) => t(`memory.scope.${scope}`)}\n * formatTimeAgo={(createdAt) => formatRelative(createdAt)}\n * formatUsageCount={(count) => t(\"memory.usageCount\", { count })}\n * formatMoreTags={(count) => `+${count}`}\n * onEdit={(m) => openEditDialog(m)}\n * onDelete={(id) => deleteMemory(id)}\n * />\n *\n * @example\n * // Compact variant — condensed list row, no tags row. formatUsageCount is\n * // still called here; this host simply chooses to render the bare number.\n * <MosaicMemoryCard\n * memory={memory}\n * variant=\"compact\"\n * editLabel=\"Modifier\"\n * deleteLabel=\"Supprimer\"\n * moreActionsLabel=\"Actions sur le souvenir\"\n * formatScope={(scope) => t(`memory.scope.${scope}`)}\n * formatTimeAgo={(createdAt) => formatRelative(createdAt)}\n * formatUsageCount={(count) => `${count}`}\n * formatMoreTags={(count) => `+${count}`}\n * />\n */\n\nimport * as React from \"react\";\nimport {\n memoryActionsMenuTriggerVariants,\n memoryCardVariants,\n memoryScopeBadgeVariants,\n memoryTagBadgeVariants,\n} from \"./memory-card-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport type MosaicMemoryScope = \"organization\" | \"workspace\" | \"user\" | \"chat\";\nexport type MosaicMemorySource = \"manual\" | \"document\" | \"url\";\n\nexport interface MosaicMemoryData {\n id: string;\n title: string;\n content: string;\n scope: MosaicMemoryScope;\n source: MosaicMemorySource;\n tags: string[];\n /** Epoch milliseconds. */\n createdAt: number;\n usageCount: number;\n}\n\n/**\n * Props shared by both variants — read unconditionally regardless of\n * `variant`.\n */\nexport interface MosaicMemoryCardBaseProps {\n memory: MosaicMemoryData;\n onEdit?: (memory: MosaicMemoryData) => void;\n onDelete?: (memoryId: string) => void;\n /** Label for the \"edit\" menu item. Required — host-owned, no default. */\n editLabel: string;\n /** Label for the \"delete\" menu item. Required — host-owned, no default. */\n deleteLabel: string;\n /** aria-label for the 3-dot actions menu trigger. Required — host-owned, no default. */\n moreActionsLabel: string;\n /**\n * Formatter mapping `memory.scope` to its displayed label. Required — the\n * host owns the language (e.g. `(scope) => t(\\`memory.scope.\\${scope}\\`)`).\n */\n formatScope: (scope: MosaicMemoryScope) => React.ReactNode;\n /**\n * Formatter producing the relative time caption from `memory.createdAt`.\n * Required — the host owns date formatting and language\n * (e.g. `(createdAt) => t(\"memory.timeAgo\", { value: formatRelative(createdAt) })`).\n */\n formatTimeAgo: (createdAt: number) => React.ReactNode;\n /**\n * Formatter producing the labelled usage-count caption from\n * `memory.usageCount`. Applied in BOTH variants — the raw number is never\n * rendered directly. A host that wants the bare number in compact passes\n * `formatUsageCount={(count) => String(count)}`; that is the host's\n * choice, not a hidden default of the library.\n * Required — host-owned (e.g. `(count) => t(\"memory.usageCount\", { count })`).\n */\n formatUsageCount: (count: number) => React.ReactNode;\n className?: string;\n /** React 19 ref prop — forwarded to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Discriminated union on `variant` — the sole property that differs between\n * variants (`formatMoreTags`) is required EXACTLY on the branch that reads\n * it (`\"detailed\"`, the default), not on the shared base. The `\"compact\"`\n * variant never renders a tags row and therefore never calls\n * `formatMoreTags` — requiring it there would force every host to supply a\n * value the library never displays (a \"lying prop contract\"; see the\n * `no-lying-prop-contract` guard test and the file's changelog note below).\n */\nexport type MosaicMemoryCardVariantProps =\n | {\n /**\n * Full-density layout: icon chip + tags row + labelled usage footer.\n * Default when omitted.\n * @default \"detailed\"\n */\n variant?: \"detailed\";\n /**\n * Formatter producing the \"+N\" overflow caption when a memory has more\n * than 3 tags. Only ever rendered in the detailed variant — required\n * here, not on `\"compact\"`. Host-owned (e.g. `(count) => \\`+\\${count}\\``\n * or a pluralized `t()` call).\n */\n formatMoreTags: (count: number) => React.ReactNode;\n }\n | {\n /** Condensed list row, no tags row, no `formatMoreTags` call. */\n variant: \"compact\";\n };\n\nexport type MosaicMemoryCardProps = MosaicMemoryCardBaseProps & MosaicMemoryCardVariantProps;\n\nconst MAX_VISIBLE_TAGS = 3;\n\n// ── Inline SVG icons ──────────────────────────────────────────────────────────\n\nfunction FileTextIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n <line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\" />\n <line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\" />\n <line x1=\"10\" y1=\"9\" x2=\"8\" y2=\"9\" />\n </svg>\n );\n}\n\nfunction FileIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n </svg>\n );\n}\n\nfunction LinkIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n <path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n </svg>\n );\n}\n\nfunction ClockIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <polyline points=\"12 6 12 12 16 14\" />\n </svg>\n );\n}\n\nfunction TagIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z\" />\n <circle cx=\"7.5\" cy=\"7.5\" r=\"1.5\" />\n </svg>\n );\n}\n\nfunction MoreVertIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\nconst SOURCE_ICONS: Record<MosaicMemorySource, () => React.ReactElement> = {\n manual: FileTextIcon,\n document: FileIcon,\n url: LinkIcon,\n};\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicMemoryCard — production memory-item card for @vantageos/mosaic-blocks.\n *\n * One component, two density variants (`detailed` default / `compact`) —\n * see file JSDoc for the exact desktop/mobile differences and how they were\n * modeled as `variant` + CVA compound variants rather than as two components.\n */\nexport function MosaicMemoryCard(props: MosaicMemoryCardProps) {\n const {\n memory,\n onEdit,\n onDelete,\n editLabel,\n deleteLabel,\n moreActionsLabel,\n formatScope,\n formatTimeAgo,\n formatUsageCount,\n className,\n ref,\n } = props;\n const variant = props.variant ?? \"detailed\";\n const [menuOpen, setMenuOpen] = React.useState(false);\n const menuRef = React.useRef<HTMLDivElement>(null);\n const SourceIcon = SOURCE_ICONS[memory.source];\n\n React.useEffect(() => {\n if (!menuOpen) return;\n const handler = (event: MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(event.target as Node)) {\n setMenuOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [menuOpen]);\n\n const visibleTags = memory.tags.slice(0, MAX_VISIBLE_TAGS);\n const hiddenTagCount = memory.tags.length - visibleTags.length;\n\n const actionsMenu = (\n <div ref={menuRef} className=\"relative shrink-0\">\n <button\n type=\"button\"\n onClick={() => setMenuOpen((open) => !open)}\n aria-label={moreActionsLabel}\n aria-haspopup=\"menu\"\n aria-expanded={menuOpen}\n className={cn(memoryActionsMenuTriggerVariants({ variant }))}\n >\n <MoreVertIcon />\n </button>\n\n {menuOpen && (\n <div\n role=\"menu\"\n className={cn(\n \"absolute right-0 top-full z-50 mt-1 min-w-[140px] rounded-md border border-border\",\n \"bg-popover py-1 shadow-md\",\n )}\n >\n {onEdit && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n onEdit(memory);\n setMenuOpen(false);\n }}\n className=\"flex w-full items-center px-3 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground\"\n >\n {editLabel}\n </button>\n )}\n {onDelete && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n onDelete(memory.id);\n setMenuOpen(false);\n }}\n className=\"flex w-full items-center px-3 py-2 text-sm text-destructive hover:bg-destructive/10\"\n >\n {deleteLabel}\n </button>\n )}\n </div>\n )}\n </div>\n );\n\n return (\n <div\n ref={ref}\n data-slot=\"memory-card\"\n data-variant={variant}\n className={cn(memoryCardVariants({ variant }), className)}\n >\n {props.variant !== \"compact\" ? (\n <div className=\"space-y-3\">\n {/* Header */}\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 flex-1 items-start gap-3\">\n <div className=\"rounded-lg bg-muted p-2 text-muted-foreground\">\n <SourceIcon />\n </div>\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"line-clamp-1 text-base font-semibold\">{memory.title}</h3>\n <span\n className={cn(\n memoryScopeBadgeVariants({ scope: memory.scope, bordered: true }),\n \"mt-1\",\n )}\n >\n {formatScope(memory.scope)}\n </span>\n </div>\n </div>\n {actionsMenu}\n </div>\n\n {/* Content */}\n <p className=\"line-clamp-3 text-sm text-muted-foreground\">{memory.content}</p>\n\n {/* Tags */}\n <div data-slot=\"memory-tags\" className=\"flex flex-wrap gap-1\">\n {visibleTags.map((tag) => (\n <span key={tag} className={cn(memoryTagBadgeVariants())}>\n {tag}\n </span>\n ))}\n {hiddenTagCount > 0 && (\n <span className={cn(memoryTagBadgeVariants())}>\n {props.formatMoreTags(hiddenTagCount)}\n </span>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-between border-t pt-2 text-xs text-muted-foreground\">\n <span className=\"flex items-center gap-1\">\n <ClockIcon />\n {formatTimeAgo(memory.createdAt)}\n </span>\n <span className=\"flex items-center gap-1\">\n <TagIcon />\n {formatUsageCount(memory.usageCount)}\n </span>\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {/* Header */}\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"line-clamp-1 text-sm font-medium\">{memory.title}</h3>\n <p className=\"mt-1 line-clamp-2 text-xs text-muted-foreground\">{memory.content}</p>\n </div>\n <div className=\"flex shrink-0 items-center gap-1 text-muted-foreground\">\n <SourceIcon />\n {actionsMenu}\n </div>\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <div className=\"flex items-center gap-2\">\n <span\n className={cn(memoryScopeBadgeVariants({ scope: memory.scope, bordered: false }))}\n >\n {formatScope(memory.scope)}\n </span>\n <span className=\"flex items-center gap-1\">\n <ClockIcon />\n {formatTimeAgo(memory.createdAt)}\n </span>\n </div>\n <span className=\"flex items-center gap-1\">\n <TagIcon />\n {formatUsageCount(memory.usageCount)}\n </span>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nMosaicMemoryCard.displayName = \"MosaicMemoryCard\";\n"
13
+ },
14
+ {
15
+ "path": "src/components/memory-card/memory-card-variants.ts",
16
+ "type": "registry:ui",
17
+ "content": "/**\n * memoryCardVariants — pure CVA variant functions for MosaicMemoryCard.\n *\n * Isolated in their own module so they can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React.\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\n/** Root card container variants */\nexport const memoryCardVariants = cva(\n [\n \"group relative rounded-lg border border-border bg-card text-card-foreground shadow-sm\",\n \"transition-all\",\n ],\n {\n variants: {\n variant: {\n detailed: \"p-5 hover:shadow-lg\",\n compact: \"min-h-[80px] p-4\",\n },\n },\n defaultVariants: {\n variant: \"detailed\",\n },\n },\n);\n\n/** Scope badge — colored per memory scope, bordered only in the detailed variant */\nexport const memoryScopeBadgeVariants = cva(\n [\"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium\"],\n {\n variants: {\n scope: {\n organization: \"bg-purple-500/10 text-purple-500\",\n workspace: \"bg-blue-500/10 text-blue-500\",\n user: \"bg-green-500/10 text-green-500\",\n chat: \"bg-orange-500/10 text-orange-500\",\n },\n bordered: {\n true: \"border\",\n false: \"\",\n },\n },\n compoundVariants: [\n { scope: \"organization\", bordered: true, className: \"border-purple-500/20\" },\n { scope: \"workspace\", bordered: true, className: \"border-blue-500/20\" },\n { scope: \"user\", bordered: true, className: \"border-green-500/20\" },\n { scope: \"chat\", bordered: true, className: \"border-orange-500/20\" },\n ],\n defaultVariants: {\n scope: \"user\",\n bordered: false,\n },\n },\n);\n\n/** Tag badge (detailed variant only) */\nexport const memoryTagBadgeVariants = cva([\n \"inline-flex items-center rounded-full border border-border px-2 py-0.5 text-xs\",\n]);\n\n/** Actions menu trigger button — hover-reveal in detailed, always visible in compact */\nexport const memoryActionsMenuTriggerVariants = cva(\n [\n \"inline-flex items-center justify-center rounded-md text-muted-foreground transition-opacity\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n ],\n {\n variants: {\n variant: {\n detailed: \"h-11 w-11 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100\",\n compact: \"h-8 w-8\",\n },\n },\n defaultVariants: {\n variant: \"detailed\",\n },\n },\n);\n"
18
+ }
19
+ ],
20
+ "type": "registry:ui"
21
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-memory-dashboard",
4
+ "title": "MosaicMemoryDashboard",
5
+ "description": "MosaicMemoryDashboard — landing surface of a knowledge base: a header with a title and a primary \"add\" action, a row of host-supplied summary statistics, an optional slot for a search bar, a host-controlled view-mode toggle (tiles / rows), and a slot for results.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.36-alpha/r/mosaic-button.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/memory-dashboard/MosaicMemoryDashboard.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicMemoryDashboard — landing surface of a knowledge base: a header with\n * a title and a primary \"add\" action, a row of host-supplied summary\n * statistics, an optional slot for a search bar, a host-controlled view-mode\n * toggle (tiles / rows), and a slot for results.\n *\n * Pure composition — this component never fetches, searches, filters, counts,\n * or invents anything. The statistics are host data (each with its own\n * host-supplied label and value); this component renders exactly the array\n * it is given, in the order it is given, with no minimum or maximum count\n * assumed. Search and results are host-owned React nodes passed in as\n * `searchSlot` and `children` — this component does not implement a search\n * bar or a list itself.\n *\n * The active view mode is a prop (`viewMode`), never internal state invented\n * by this component — toggling it is a callback (`onViewModeChange`) that the\n * host decides how to honor.\n *\n * Every user-facing string is a required prop with no default — this library\n * carries zero words (SIN-01), bilingual FR+EN by design. `searchSlot` and\n * `children` are optional because their absence encodes a real absence of\n * state (no search bar composed / no results yet) — not a missing word.\n *\n * data-slot=\"memory-dashboard\" on the root, data-slot=\"memory-dashboard-stats\"\n * on the stats row, data-slot=\"memory-dashboard-stat\" per stat,\n * data-slot=\"memory-dashboard-search\" on the search slot wrapper (rendered\n * only when `searchSlot` is supplied), data-slot=\"memory-dashboard-view-toggle\"\n * on the toggle group, data-slot=\"memory-dashboard-results\" on the results\n * slot wrapper.\n *\n * Deps: @base-ui/react (via MosaicButton) + class-variance-authority only.\n */\n\nimport type * as React from \"react\";\nimport { MosaicButton } from \"@/components/ui/Button\";\nimport { memoryDashboardViewToggleButtonVariants } from \"./memory-dashboard-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport type MosaicMemoryDashboardViewMode = \"tiles\" | \"rows\";\n\nexport interface MosaicMemoryDashboardStat {\n /** Host-owned statistic label — pure data, never invented by this component. */\n label: string;\n /** Host-owned statistic value — pure data, never computed by this component. */\n value: string;\n}\n\nexport interface MosaicMemoryDashboardProps {\n /** Dashboard title. Required, no default. */\n title: string;\n /** Label for the primary \"add\" action button. Required, no default. */\n addLabel: string;\n /** Called when the primary \"add\" action is activated. */\n onAdd: () => void;\n /**\n * Host-supplied summary statistics. Pure data — never fetched, computed, or\n * invented here. Rendered exactly as given, in order, with no assumed count.\n */\n stats: MosaicMemoryDashboardStat[];\n /**\n * Optional host-owned search bar node. Absence means no search bar is\n * composed for this instance — a real absence of state, not a missing word.\n */\n searchSlot?: React.ReactNode;\n /** Current view mode. Host-controlled — this component holds no internal state for it. */\n viewMode: MosaicMemoryDashboardViewMode;\n /** Called with the requested view mode when a toggle button is activated. */\n onViewModeChange: (mode: MosaicMemoryDashboardViewMode) => void;\n /** Label for the \"tiles\" view toggle button. Required, no default. */\n tilesViewLabel: string;\n /** Label for the \"rows\" view toggle button. Required, no default. */\n rowsViewLabel: string;\n /**\n * Host-owned results content, rendered in the results slot. Absence means\n * no results have been composed yet — a real absence of state.\n */\n children?: React.ReactNode;\n className?: string;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicMemoryDashboard — production knowledge-base landing surface for\n * @vantageos/mosaic-blocks.\n *\n * @example\n * <MosaicMemoryDashboard\n * title=\"Knowledge base\"\n * addLabel=\"Add memory\"\n * onAdd={() => openAddMemoryForm()}\n * stats={[{ label: \"Total memories\", value: \"128\" }, { label: \"Namespaces\", value: \"6\" }]}\n * searchSlot={<SearchBar />}\n * viewMode={viewMode}\n * onViewModeChange={setViewMode}\n * tilesViewLabel=\"Tiles\"\n * rowsViewLabel=\"Rows\"\n * >\n * <ResultsList />\n * </MosaicMemoryDashboard>\n */\nexport function MosaicMemoryDashboard({\n title,\n addLabel,\n onAdd,\n stats,\n searchSlot,\n viewMode,\n onViewModeChange,\n tilesViewLabel,\n rowsViewLabel,\n children,\n className,\n}: MosaicMemoryDashboardProps) {\n return (\n <div\n data-slot=\"memory-dashboard\"\n className={cn(\n \"flex flex-col gap-4 rounded-lg border border-border bg-background p-4\",\n className,\n )}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <h1 className=\"font-semibold text-foreground text-lg\">{title}</h1>\n <MosaicButton type=\"button\" onClick={onAdd}>\n {addLabel}\n </MosaicButton>\n </div>\n\n {stats.length > 0 && (\n <div data-slot=\"memory-dashboard-stats\" className=\"grid grid-cols-2 gap-3 sm:grid-cols-4\">\n {stats.map((stat) => (\n <div\n key={stat.label}\n data-slot=\"memory-dashboard-stat\"\n className=\"flex flex-col rounded-md border border-border px-3 py-2\"\n >\n <span className=\"font-semibold text-foreground text-lg tabular-nums\">\n {stat.value}\n </span>\n <span className=\"text-muted-foreground text-xs\">{stat.label}</span>\n </div>\n ))}\n </div>\n )}\n\n {searchSlot && (\n <div data-slot=\"memory-dashboard-search\" className=\"w-full\">\n {searchSlot}\n </div>\n )}\n\n <div data-slot=\"memory-dashboard-view-toggle\" className=\"flex items-center gap-2 self-start\">\n <button\n type=\"button\"\n aria-pressed={viewMode === \"tiles\"}\n onClick={() => onViewModeChange(\"tiles\")}\n className={memoryDashboardViewToggleButtonVariants({ pressed: viewMode === \"tiles\" })}\n >\n {tilesViewLabel}\n </button>\n <button\n type=\"button\"\n aria-pressed={viewMode === \"rows\"}\n onClick={() => onViewModeChange(\"rows\")}\n className={memoryDashboardViewToggleButtonVariants({ pressed: viewMode === \"rows\" })}\n >\n {rowsViewLabel}\n </button>\n </div>\n\n <div data-slot=\"memory-dashboard-results\" className=\"flex flex-col gap-2\">\n {children}\n </div>\n </div>\n );\n}\n\nMosaicMemoryDashboard.displayName = \"MosaicMemoryDashboard\";\n"
15
+ },
16
+ {
17
+ "path": "src/components/memory-dashboard/memory-dashboard-variants.ts",
18
+ "type": "registry:ui",
19
+ "content": "import { cva } from \"class-variance-authority\";\n\nexport const memoryDashboardViewToggleButtonVariants = cva(\n \"flex items-center justify-center rounded-md border border-border px-3 py-1.5 text-sm transition-colors\",\n {\n variants: {\n pressed: {\n true: \"bg-foreground text-background\",\n false: \"bg-background text-muted-foreground hover:bg-muted\",\n },\n },\n defaultVariants: {\n pressed: false,\n },\n },\n);\n"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }