@vantageos/mosaic-blocks 0.1.0-alpha.1 → 0.2.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +466 -108
- package/dist/index.cjs +8376 -705
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2281 -40
- package/dist/index.d.ts +2281 -40
- package/dist/index.js +8308 -703
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -0
- package/package.json +48 -5
- package/registry.json +536 -2
package/README.md
CHANGED
|
@@ -1,171 +1,529 @@
|
|
|
1
1
|
# @vantageos/mosaic-blocks
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@vantageos/mosaic-blocks)
|
|
3
4
|
[](https://github.com/vantageos-agency/mosaic-blocks/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
4
6
|
|
|
5
|
-
**
|
|
7
|
+
**Production-ready composed UI blocks for VantageOS products.** Built on React 19 + Tailwind v4 + `@base-ui/react`. Ships mobile-first, multi-tenant auth, OKLCH theming, and full bilingual (FR+EN) out of the box.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Hero & Positioning
|
|
12
|
+
|
|
13
|
+
`@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 85+ opinionated, fully-typed UI components that integrate natively with:
|
|
14
|
+
|
|
15
|
+
- **Clerk** — auth sign-in/up flows, org switcher, RBAC, webhook sync
|
|
16
|
+
- **Convex** — real-time data binding ready
|
|
17
|
+
- **Tailwind v4** — OKLCH semantic color tokens, dark mode, mobile-first breakpoints
|
|
18
|
+
- **Next.js 15+** — App Router, Server Components compatible
|
|
19
|
+
|
|
20
|
+
This is not a headless utility library. Components are composed, styled, and production-tested. Import and use — no assembly required.
|
|
21
|
+
|
|
22
|
+
> Absorbed from **anydebate** (production SaaS) — these blocks ran in a live multi-tenant debate platform before extraction. See [Section 17 — Credits](#17-credits).
|
|
23
|
+
|
|
24
|
+
---
|
|
8
25
|
|
|
9
|
-
##
|
|
26
|
+
## 2. Why This Package (vs shadcn raw / MUI / headless)
|
|
27
|
+
|
|
28
|
+
| | mosaic-blocks | shadcn raw | MUI | headless-ui |
|
|
29
|
+
|---|---|---|---|---|
|
|
30
|
+
| Composed blocks (Dashboard, OrgPanel, AgentComposer) | Yes | No | Partial | No |
|
|
31
|
+
| OKLCH dark mode out of the box | Yes | Manual | No | No |
|
|
32
|
+
| Clerk multi-tenant auth wired in | Yes | DIY | DIY | DIY |
|
|
33
|
+
| Mobile-first adaptive system (DeviceProvider) | Yes | No | No | No |
|
|
34
|
+
| FR+EN bilingual locale | Yes | No | No | No |
|
|
35
|
+
| React 19 / Tailwind v4 native | Yes | Partial | No | Partial |
|
|
36
|
+
| Zero config (CSS tokens auto-injected) | Yes | No | No | No |
|
|
37
|
+
|
|
38
|
+
shadcn/ui is the underlying primitive layer — mosaic-blocks sits on top and composes it with auth, layout, and multi-tenant concerns so you do not have to.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm add @vantageos/mosaic-blocks
|
|
46
|
+
```
|
|
10
47
|
|
|
11
|
-
|
|
12
|
-
- [docs/USAGE.md](docs/USAGE.md) — consume via npm + shadcn registry, theme setup, full component catalog.
|
|
13
|
-
- [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) — TDD workflow, local + CI gates, conventions.
|
|
14
|
-
- [docs/adr/0001-base-ui-vs-radix.md](docs/adr/0001-base-ui-vs-radix.md) — ADR: @base-ui/react vs Radix.
|
|
15
|
-
- [CHANGELOG.md](CHANGELOG.md) — release notes.
|
|
48
|
+
### Peer dependencies (required)
|
|
16
49
|
|
|
17
|
-
|
|
50
|
+
| Package | Min version | Required when |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `react` | `^19.0.0` | Always |
|
|
53
|
+
| `react-dom` | `^19.0.0` | Always |
|
|
54
|
+
| `tailwindcss` | `^4.3.1` | Always |
|
|
55
|
+
| `@base-ui/react` | `^1.5.0` | Auto-installed (direct dep) |
|
|
56
|
+
| `@clerk/nextjs` | `^7` | Using any auth component |
|
|
57
|
+
| `@vantageos/cloud-identity` | `^0.2` | `MosaicMultiTenantProvider` |
|
|
58
|
+
| `svix` | `^1.0.0` | `MosaicClerkWebhookHandler` only |
|
|
18
59
|
|
|
19
60
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
61
|
+
# Minimal — no auth
|
|
62
|
+
pnpm add @vantageos/mosaic-blocks react react-dom tailwindcss
|
|
63
|
+
|
|
64
|
+
# Full — with Clerk auth
|
|
65
|
+
pnpm add @vantageos/mosaic-blocks react react-dom tailwindcss @clerk/nextjs @vantageos/cloud-identity
|
|
22
66
|
```
|
|
23
67
|
|
|
24
|
-
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Optional peer dependencies
|
|
25
71
|
|
|
26
|
-
|
|
72
|
+
Some components in `@vantageos/mosaic-blocks` depend on packages that are NOT bundled into the library. Install them only when using the relevant component. The library never bundles these packages and throws a clear error at runtime if the required optional peer is absent.
|
|
27
73
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- class-variance-authority (variant management)
|
|
32
|
-
- shadcn registry protocol
|
|
74
|
+
| Package | Required for | Install |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `svix` | `MosaicClerkWebhookHandler` (Clerk webhook signature verification) | `npm install svix` |
|
|
33
77
|
|
|
34
|
-
|
|
78
|
+
### svix — webhook signature verification
|
|
35
79
|
|
|
36
|
-
|
|
37
|
-
Decision rationale, per-primitive availability table, and risk register: [`docs/adr/0001-base-ui-vs-radix.md`](docs/adr/0001-base-ui-vs-radix.md).
|
|
80
|
+
`MosaicClerkWebhookHandler` dynamically imports `svix` at runtime to verify Clerk webhook signatures. If `svix` is not installed in your app, the handler throws an explicit `Error` with installation instructions — it never silently fails.
|
|
38
81
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
82
|
+
```bash
|
|
83
|
+
npm install svix
|
|
84
|
+
# or
|
|
85
|
+
pnpm add svix
|
|
86
|
+
```
|
|
44
87
|
|
|
45
|
-
|
|
88
|
+
If you do not use `MosaicClerkWebhookHandler`, you do not need to install `svix`.
|
|
89
|
+
|
|
90
|
+
---
|
|
46
91
|
|
|
47
|
-
|
|
92
|
+
## 4. Quick Start (30 seconds)
|
|
48
93
|
|
|
49
94
|
```tsx
|
|
50
|
-
|
|
95
|
+
// app/layout.tsx
|
|
96
|
+
import "@vantageos/mosaic-blocks/styles.css";
|
|
97
|
+
import { MosaicDeviceProvider } from "@vantageos/mosaic-blocks";
|
|
98
|
+
|
|
99
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
100
|
+
return (
|
|
101
|
+
<html lang="en">
|
|
102
|
+
<body>
|
|
103
|
+
<MosaicDeviceProvider>{children}</MosaicDeviceProvider>
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
// app/dashboard/page.tsx
|
|
112
|
+
import { MosaicDashboardLayout } from "@vantageos/mosaic-blocks";
|
|
113
|
+
import Link from "next/link";
|
|
114
|
+
|
|
115
|
+
export default function DashboardPage() {
|
|
116
|
+
return (
|
|
117
|
+
<MosaicDashboardLayout
|
|
118
|
+
title="My App"
|
|
119
|
+
breadcrumbs={[{ label: "Dashboard" }]}
|
|
120
|
+
sidebarProps={{
|
|
121
|
+
navItems: [{ id: "home", label: "Home", href: "/", icon: null }],
|
|
122
|
+
quickActions: [],
|
|
123
|
+
}}
|
|
124
|
+
renderLink={(href, children) => <Link href={href}>{children}</Link>}
|
|
125
|
+
>
|
|
126
|
+
<p>Hello from mosaic-blocks.</p>
|
|
127
|
+
</MosaicDashboardLayout>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 5. Configuration
|
|
51
135
|
|
|
52
|
-
|
|
53
|
-
// Sizes: default | sm | lg | icon | icon-sm | icon-lg
|
|
136
|
+
### Tailwind v4 — `@source` directive (REQUIRED)
|
|
54
137
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
138
|
+
mosaic-blocks ships compiled JS that references Tailwind utility classes. Your Tailwind build must scan the package's `dist/` or classes will be purged:
|
|
139
|
+
|
|
140
|
+
```css
|
|
141
|
+
/* app/globals.css */
|
|
142
|
+
@import "tailwindcss";
|
|
143
|
+
|
|
144
|
+
/* Scan mosaic-blocks dist for utility classes */
|
|
145
|
+
@source "../node_modules/@vantageos/mosaic-blocks/dist";
|
|
146
|
+
|
|
147
|
+
/* Import OKLCH semantic token variables */
|
|
148
|
+
@import "@vantageos/mosaic-blocks/styles.css";
|
|
58
149
|
```
|
|
59
150
|
|
|
60
|
-
|
|
151
|
+
### Tailwind v3 — `content` path
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
// tailwind.config.js
|
|
155
|
+
module.exports = {
|
|
156
|
+
content: [
|
|
157
|
+
"./src/**/*.{tsx,ts}",
|
|
158
|
+
"./node_modules/@vantageos/mosaic-blocks/dist/**/*.{js,cjs}",
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
```
|
|
61
162
|
|
|
62
|
-
###
|
|
163
|
+
### Provider wrap
|
|
63
164
|
|
|
64
|
-
|
|
165
|
+
Wrap your application root with `MosaicDeviceProvider` for the full adaptive system:
|
|
65
166
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| **Atoms** (Batch C) | Button · Card · Badge · Avatar · Input · InputGroup · Field · Switch · Select · Combobox · DropdownMenu | Button shipped; rest in review (PR #6) |
|
|
69
|
-
| **Landing blocks** (Batch A) | Navbar · HeroSplit · FeatureCenteredMedia · StatsGrid · PricingCard · LogosGrid · TestimonialsGrid · FooterSimple | in review (PR #2) |
|
|
70
|
-
| **Utility blocks** (Batch B) | Counter · ThemeToggle · BlurredOrb · AnimatedList · IntegrationsBadge · FallingPattern · `useMediaQuery` | in review (PR #3) |
|
|
167
|
+
```tsx
|
|
168
|
+
import { MosaicDeviceProvider } from "@vantageos/mosaic-blocks";
|
|
71
169
|
|
|
72
|
-
|
|
170
|
+
// Wrap once at app root — all adaptive components require this ancestor
|
|
171
|
+
<MosaicDeviceProvider>{children}</MosaicDeviceProvider>
|
|
172
|
+
```
|
|
73
173
|
|
|
74
|
-
|
|
174
|
+
For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 10 — Theming](#10-theming).
|
|
75
175
|
|
|
76
|
-
|
|
176
|
+
---
|
|
77
177
|
|
|
78
|
-
|
|
79
|
-
|---|------|------|
|
|
80
|
-
| 1 | Lint | Biome — 0 warnings |
|
|
81
|
-
| 2 | Typecheck | tsc --noEmit — 0 errors |
|
|
82
|
-
| 3 | Tests | Vitest — all green |
|
|
83
|
-
| 4 | Parse guard | TS compiler API — syntax errors exit 1 |
|
|
84
|
-
| 5 | Build | tsup ESM+CJS+DTS |
|
|
85
|
-
| 6 | Sandbox build | Next.js build (Rule #19) |
|
|
86
|
-
| 7 | React-doctor | react-doctor@0.2.11 --fail-on error (Dimension 12) |
|
|
178
|
+
## 6. Component Catalogue Summary
|
|
87
179
|
|
|
88
|
-
|
|
180
|
+
85 exported components and hooks across 8 sections. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
|
|
89
181
|
|
|
182
|
+
| Section | Top components | Count |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| Layout | `MosaicDashboardLayout`, `MosaicSidebar`, `MosaicHeader` | 8 |
|
|
185
|
+
| Device / Adaptive | `MosaicDeviceProvider`, `MosaicAdaptiveGrid`, `MosaicAdaptiveModal`, `MosaicAdaptiveNavigation` | 7 |
|
|
186
|
+
| Auth / Multi-tenant | `MosaicMultiTenantProvider`, `MosaicSignInCard`, `MosaicOrgPanel`, `MosaicClerkWebhookHandler` | 12 |
|
|
187
|
+
| Agents | `MosaicAgentComposer`, `MosaicAgentCard`, `MosaicAgentGrid` | 9 |
|
|
188
|
+
| Debate | `MosaicDebateRoom`, `MosaicDebateTimer`, `MosaicDebateParticipant` | 11 |
|
|
189
|
+
| Data display | `MosaicDataTable`, `MosaicKpiCard`, `MosaicActivityFeed` | 14 |
|
|
190
|
+
| Forms | `MosaicForm`, `MosaicRichInput`, `MosaicSelect`, `MosaicTagInput` | 18 |
|
|
191
|
+
| Primitives | `MosaicButton`, `MosaicBadge`, `MosaicAvatar`, `MosaicToast` | 6 |
|
|
192
|
+
|
|
193
|
+
All exports: `import { ComponentName } from "@vantageos/mosaic-blocks"`
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 7. Auth Integration
|
|
198
|
+
|
|
199
|
+
mosaic-blocks includes production-ready Clerk auth components with multi-tenant support. Full guide: [docs/auth.md](docs/auth.md).
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
// app/layout.tsx — 5-line Clerk + multi-tenant setup
|
|
203
|
+
import { ClerkProvider } from "@clerk/nextjs";
|
|
204
|
+
import { MosaicMultiTenantProvider } from "@vantageos/mosaic-blocks";
|
|
205
|
+
|
|
206
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
207
|
+
return (
|
|
208
|
+
<ClerkProvider>
|
|
209
|
+
<MosaicMultiTenantProvider workspaceId={process.env.WORKSPACE_ID}>
|
|
210
|
+
{children}
|
|
211
|
+
</MosaicMultiTenantProvider>
|
|
212
|
+
</ClerkProvider>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
90
215
|
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
216
|
+
|
|
217
|
+
Key auth components:
|
|
218
|
+
|
|
219
|
+
- `MosaicSignInCard` / `MosaicSignUpCard` — styled Clerk auth flows
|
|
220
|
+
- `MosaicOrgSwitcher` — organization switcher with avatar, plan badge
|
|
221
|
+
- `MosaicOrgPanel` — full org management (members, roles, invitations)
|
|
222
|
+
- `MosaicClerkWebhookHandler` — Next.js route handler for Clerk webhook sync (requires `svix`)
|
|
223
|
+
- `useEffectiveWorkspaceId` — hook to read active workspace from context
|
|
224
|
+
|
|
225
|
+
RBAC is handled through Clerk's `has()` helper — see [docs/auth.md](docs/auth.md) for role guard patterns.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 8. Mobile-First
|
|
230
|
+
|
|
231
|
+
Every component is built mobile-first. Full guide: [docs/mobile-first.md](docs/mobile-first.md).
|
|
232
|
+
|
|
233
|
+
### DeviceProvider + adaptive primitives
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import {
|
|
237
|
+
MosaicDeviceProvider,
|
|
238
|
+
MosaicAdaptiveGrid,
|
|
239
|
+
useDevice,
|
|
240
|
+
} from "@vantageos/mosaic-blocks";
|
|
241
|
+
|
|
242
|
+
function MyPage() {
|
|
243
|
+
const { isMobile } = useDevice();
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<MosaicDeviceProvider>
|
|
247
|
+
<MosaicAdaptiveGrid
|
|
248
|
+
mobileColumns={1}
|
|
249
|
+
tabletColumns={2}
|
|
250
|
+
desktopColumns={3}
|
|
251
|
+
>
|
|
252
|
+
{items.map((item) => <Card key={item.id} {...item} />)}
|
|
253
|
+
</MosaicAdaptiveGrid>
|
|
254
|
+
</MosaicDeviceProvider>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
97
257
|
```
|
|
98
258
|
|
|
99
|
-
|
|
259
|
+
Breakpoints follow Tailwind v4 defaults: `sm` 640px / `md` 768px / `lg` 1024px / `xl` 1280px.
|
|
100
260
|
|
|
101
|
-
|
|
261
|
+
Adaptive components: `MosaicAdaptiveGrid`, `MosaicAdaptiveModal`, `MosaicAdaptiveNavigation`, `MosaicAgentComposer`. All require `MosaicDeviceProvider` in their ancestor tree.
|
|
102
262
|
|
|
103
|
-
|
|
104
|
-
|-------|--------------|
|
|
105
|
-
| `MosaicNavbar` | `logo`, `links[]`, `cta?` — scroll-aware, mobile menu |
|
|
106
|
-
| `MosaicHeroSplit` | `title`, `subtitle`, `eyebrow?`, `cta?`, `media?` |
|
|
107
|
-
| `MosaicFeatureCenteredMedia` | `title`, `body`, `features[]?`, `media?` |
|
|
108
|
-
| `MosaicStatsGrid` | `stats[] {label, value}`, `heading?` |
|
|
109
|
-
| `MosaicPricingCard` | `tier`, `price`, `features[]`, `cta`, `highlighted?` |
|
|
110
|
-
| `MosaicLogosGrid` | `logos[] {name, src}`, `heading?` |
|
|
111
|
-
| `MosaicTestimonialsGrid` | `testimonials[] {id, quote, author, role}`, `heading?` |
|
|
112
|
-
| `MosaicFooterSimple` | `columns[]`, `legal`, `logo?`, `social[]?` |
|
|
263
|
+
---
|
|
113
264
|
|
|
114
|
-
|
|
265
|
+
## 9. i18n
|
|
115
266
|
|
|
116
|
-
|
|
267
|
+
mosaic-blocks ships bilingual (FR+EN) out of the box via `@vantageos/mosaic-i18n`.
|
|
117
268
|
|
|
118
|
-
|
|
269
|
+
```bash
|
|
270
|
+
pnpm add @vantageos/mosaic-i18n react-i18next i18next
|
|
271
|
+
```
|
|
119
272
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| `MosaicCounter` | Animated metric count-up (rAF, easeOutExpo) | none |
|
|
123
|
-
| `MosaicThemeToggle` | Light/dark/system toggle via `data-theme` | none |
|
|
124
|
-
| `MosaicBlurredOrb` | Decorative blurred gradient orb (CSS filter) | none |
|
|
125
|
-
| `MosaicAnimatedList` | Staggered reveal list (CSS keyframe stagger) | none |
|
|
126
|
-
| `MosaicIntegrationsBadge` | Integration pill badge with logo slot | none |
|
|
127
|
-
| `MosaicFallingPattern` | Animated dot-grid background (SVG + CSS) | none |
|
|
273
|
+
```tsx
|
|
274
|
+
import { initMosaicI18n } from "@vantageos/mosaic-i18n";
|
|
128
275
|
|
|
129
|
-
|
|
276
|
+
// Initialize once at app root
|
|
277
|
+
initMosaicI18n({ defaultLanguage: "fr" }); // or "en"
|
|
278
|
+
```
|
|
130
279
|
|
|
131
|
-
|
|
280
|
+
Override individual strings:
|
|
132
281
|
|
|
133
|
-
|
|
282
|
+
```tsx
|
|
283
|
+
import { mergeMosaicTranslations } from "@vantageos/mosaic-i18n";
|
|
284
|
+
|
|
285
|
+
mergeMosaicTranslations("fr", {
|
|
286
|
+
"mosaic.button.confirm": "Valider",
|
|
287
|
+
"mosaic.debate.start": "Commencer le débat",
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Locale files (JSON): `@vantageos/mosaic-i18n/locales/en.json` and `@vantageos/mosaic-i18n/locales/fr.json`.
|
|
134
292
|
|
|
135
|
-
|
|
293
|
+
---
|
|
136
294
|
|
|
137
|
-
##
|
|
295
|
+
## 10. Theming
|
|
138
296
|
|
|
139
|
-
|
|
297
|
+
mosaic-blocks uses OKLCH semantic CSS variables provided by `@vantageos/mosaic-tokens`.
|
|
140
298
|
|
|
141
|
-
|
|
299
|
+
```bash
|
|
300
|
+
pnpm add @vantageos/mosaic-tokens
|
|
301
|
+
```
|
|
142
302
|
|
|
143
|
-
|
|
303
|
+
```css
|
|
304
|
+
/* app/globals.css */
|
|
305
|
+
@import "@vantageos/mosaic-tokens/css"; /* declares --mosaic-color-*, --mosaic-space-*, etc. */
|
|
306
|
+
@import "@vantageos/mosaic-blocks/styles.css"; /* maps tokens to Tailwind utility classes */
|
|
307
|
+
```
|
|
144
308
|
|
|
145
|
-
|
|
309
|
+
### Dark mode
|
|
146
310
|
|
|
311
|
+
```css
|
|
312
|
+
/* Automatic via Tailwind v4 dark: prefix — tokens handle the rest */
|
|
313
|
+
@import "tailwindcss";
|
|
314
|
+
@import "@vantageos/mosaic-tokens/css";
|
|
315
|
+
@import "@vantageos/mosaic-blocks/styles.css";
|
|
147
316
|
```
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
317
|
+
|
|
318
|
+
Components use semantic tokens (`--mosaic-color-neutral-50`, `--mosaic-color-danger-500`, etc.) — swap the token set at `:root` to rebrand entirely. 58 tokens across colors, spacing, typography, shadows, radii, and motion.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 11. TypeScript
|
|
323
|
+
|
|
324
|
+
mosaic-blocks is written in strict TypeScript. All props are fully typed with no `any`.
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# tsconfig.json requirement
|
|
328
|
+
{
|
|
329
|
+
"compilerOptions": {
|
|
330
|
+
"strict": true,
|
|
331
|
+
"moduleResolution": "bundler" // or "node16"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
154
334
|
```
|
|
155
335
|
|
|
156
|
-
|
|
336
|
+
Named exports only — tree-shakeable. Types are co-located with each component in `dist/index.d.ts`.
|
|
157
337
|
|
|
158
|
-
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## 12. Examples
|
|
159
341
|
|
|
342
|
+
### Basic — Dashboard layout with sidebar
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
import {
|
|
346
|
+
MosaicDashboardLayout,
|
|
347
|
+
MosaicDeviceProvider,
|
|
348
|
+
MosaicKpiCard,
|
|
349
|
+
} from "@vantageos/mosaic-blocks";
|
|
350
|
+
import Link from "next/link";
|
|
351
|
+
|
|
352
|
+
export default function DashboardPage() {
|
|
353
|
+
return (
|
|
354
|
+
<MosaicDeviceProvider>
|
|
355
|
+
<MosaicDashboardLayout
|
|
356
|
+
title="Analytics"
|
|
357
|
+
breadcrumbs={[{ label: "Dashboard" }]}
|
|
358
|
+
sidebarProps={{
|
|
359
|
+
navItems: [
|
|
360
|
+
{ id: "overview", label: "Overview", href: "/", icon: null },
|
|
361
|
+
{ id: "agents", label: "Agents", href: "/agents", icon: null },
|
|
362
|
+
],
|
|
363
|
+
quickActions: [],
|
|
364
|
+
}}
|
|
365
|
+
renderLink={(href, children) => <Link href={href}>{children}</Link>}
|
|
366
|
+
>
|
|
367
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
368
|
+
<MosaicKpiCard title="Active Agents" value={24} trend="+12%" />
|
|
369
|
+
<MosaicKpiCard title="Debates Today" value={8} trend="+3" />
|
|
370
|
+
</div>
|
|
371
|
+
</MosaicDashboardLayout>
|
|
372
|
+
</MosaicDeviceProvider>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
160
375
|
```
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
376
|
+
|
|
377
|
+
### Mobile-first — Adaptive grid with device detection
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
import {
|
|
381
|
+
MosaicDeviceProvider,
|
|
382
|
+
MosaicAdaptiveGrid,
|
|
383
|
+
useDevice,
|
|
384
|
+
} from "@vantageos/mosaic-blocks";
|
|
385
|
+
|
|
386
|
+
function AgentsList({ agents }: { agents: Agent[] }) {
|
|
387
|
+
const { isMobile, isTablet } = useDevice();
|
|
388
|
+
|
|
389
|
+
return (
|
|
390
|
+
<MosaicAdaptiveGrid
|
|
391
|
+
mobileColumns={1}
|
|
392
|
+
tabletColumns={2}
|
|
393
|
+
desktopColumns={3}
|
|
394
|
+
gap={isMobile ? "sm" : "md"}
|
|
395
|
+
>
|
|
396
|
+
{agents.map((agent) => (
|
|
397
|
+
<MosaicAgentCard
|
|
398
|
+
key={agent.id}
|
|
399
|
+
agent={agent}
|
|
400
|
+
compact={isMobile}
|
|
401
|
+
/>
|
|
402
|
+
))}
|
|
403
|
+
</MosaicAdaptiveGrid>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export default function AgentsPage({ agents }: { agents: Agent[] }) {
|
|
408
|
+
return (
|
|
409
|
+
<MosaicDeviceProvider>
|
|
410
|
+
<AgentsList agents={agents} />
|
|
411
|
+
</MosaicDeviceProvider>
|
|
412
|
+
);
|
|
413
|
+
}
|
|
167
414
|
```
|
|
168
415
|
|
|
416
|
+
### Auth — Multi-tenant sign-in with Clerk
|
|
417
|
+
|
|
418
|
+
```tsx
|
|
419
|
+
import { ClerkProvider } from "@clerk/nextjs";
|
|
420
|
+
import {
|
|
421
|
+
MosaicMultiTenantProvider,
|
|
422
|
+
MosaicSignInCard,
|
|
423
|
+
} from "@vantageos/mosaic-blocks";
|
|
424
|
+
|
|
425
|
+
export default function AuthLayout({ children }: { children: React.ReactNode }) {
|
|
426
|
+
return (
|
|
427
|
+
<ClerkProvider>
|
|
428
|
+
<MosaicMultiTenantProvider>
|
|
429
|
+
{children}
|
|
430
|
+
</MosaicMultiTenantProvider>
|
|
431
|
+
</ClerkProvider>
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// app/sign-in/page.tsx
|
|
436
|
+
export default function SignInPage() {
|
|
437
|
+
return (
|
|
438
|
+
<div className="min-h-screen flex items-center justify-center">
|
|
439
|
+
<MosaicSignInCard
|
|
440
|
+
redirectUrl="/dashboard"
|
|
441
|
+
locale="fr"
|
|
442
|
+
showSocialLogin
|
|
443
|
+
/>
|
|
444
|
+
</div>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## 13. Browser Support
|
|
452
|
+
|
|
453
|
+
| Browser | Min version |
|
|
454
|
+
|---|---|
|
|
455
|
+
| Chrome / Edge | 111+ (OKLCH support) |
|
|
456
|
+
| Firefox | 113+ |
|
|
457
|
+
| Safari | 15.4+ |
|
|
458
|
+
| Mobile Safari | iOS 15.4+ |
|
|
459
|
+
| Mobile Chrome | Android 111+ |
|
|
460
|
+
|
|
461
|
+
OKLCH color space requires modern browsers. IE is not supported. For older browser support, provide fallback CSS variables.
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## 14. Versioning & Changelog
|
|
466
|
+
|
|
467
|
+
This package follows [Semantic Versioning](https://semver.org/). While in alpha (`0.x.y`), minor versions may contain breaking changes.
|
|
468
|
+
|
|
469
|
+
| Version | Status | Notes |
|
|
470
|
+
|---|---|---|
|
|
471
|
+
| `0.2.0-alpha` | Current | anydebate absorb complete — 85 components, Clerk auth, mobile-first, Storybook 10, 69 stories |
|
|
472
|
+
| `0.1.0-alpha.1` | Previous | Initial alpha publish |
|
|
473
|
+
|
|
474
|
+
Full release history: [CHANGELOG.md](CHANGELOG.md)
|
|
475
|
+
|
|
476
|
+
Pre-stable: we will follow `0.x.y-alpha` until API surface stabilizes. Subscribe to GitHub releases for breaking change notices.
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## 15. Contributing
|
|
481
|
+
|
|
482
|
+
See [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for the full workflow.
|
|
483
|
+
|
|
484
|
+
Quick summary:
|
|
485
|
+
|
|
486
|
+
1. Fork and clone the repo
|
|
487
|
+
2. `pnpm install` at repo root
|
|
488
|
+
3. `pnpm build` — compiles the package
|
|
489
|
+
4. `pnpm test` — runs vitest suite (396 tests)
|
|
490
|
+
5. `pnpm lint` — biome check
|
|
491
|
+
6. `pnpm storybook` — component sandbox at localhost:6006
|
|
492
|
+
7. Open a PR — CI gate has 7 required checks (typecheck, lint, test, build, size, a11y, storybook)
|
|
493
|
+
|
|
494
|
+
All PRs require a passing CI and a review. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for system design and [docs/adr/](docs/adr/) for architecture decisions.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## 16. License
|
|
499
|
+
|
|
500
|
+
`@vantageos/mosaic-blocks` is licensed under the **Functional Source License, Version 1.1, Apache 2.0 Future License** (`FSL-1.1-Apache-2.0`).
|
|
501
|
+
|
|
502
|
+
- Free for non-production use, research, and evaluation
|
|
503
|
+
- Commercial use requires a valid VantageOS license
|
|
504
|
+
- Converts to Apache 2.0 after 2 years from each release
|
|
505
|
+
|
|
506
|
+
Full license: [LICENSE](LICENSE)
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## 17. Credits
|
|
511
|
+
|
|
512
|
+
**Origin**: these components were extracted from **anydebate**, a production multi-tenant debate SaaS. The absorb mission (gamma/anydebate-absorb) ported the shell, auth, mobile-first system, and all wave-1 + wave-2 components into this library under FSL.
|
|
513
|
+
|
|
514
|
+
**Upstream dependencies**:
|
|
515
|
+
|
|
516
|
+
- [`@base-ui/react`](https://base-ui.com/) — headless primitives foundation (ADR: [docs/adr/0001-base-ui-vs-radix.md](docs/adr/0001-base-ui-vs-radix.md))
|
|
517
|
+
- [`@clerk/nextjs`](https://clerk.com/) — authentication and organization management
|
|
518
|
+
- [Convex](https://convex.dev/) — real-time backend (binding patterns in [docs/auth.md](docs/auth.md))
|
|
519
|
+
- [Tailwind CSS](https://tailwindcss.com/) — utility-first CSS v4
|
|
520
|
+
- [VantageOS](https://vantageos.com/) — parent design system (mosaic-tokens, mosaic-i18n)
|
|
521
|
+
|
|
522
|
+
**Design system packages**:
|
|
523
|
+
|
|
524
|
+
- [`@vantageos/mosaic-tokens`](https://www.npmjs.com/package/@vantageos/mosaic-tokens) — OKLCH design tokens (colors, spacing, typography, motion)
|
|
525
|
+
- [`@vantageos/mosaic-i18n`](https://www.npmjs.com/package/@vantageos/mosaic-i18n) — FR+EN locale resources
|
|
526
|
+
|
|
169
527
|
---
|
|
170
528
|
|
|
171
|
-
Orchestrator: Gamma — VantageOS Team | 2026-06-
|
|
529
|
+
*Orchestrator: Gamma — VantageOS Team | 2026-06-27*
|