@devalok/shilp-sutra 0.37.0 → 0.38.0
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/MIGRATION.md +67 -0
- package/dist/_chunks/tiptap.js +977 -968
- package/dist/_chunks/tiptap.js.map +1 -1
- package/dist/composed/index.d.ts +0 -2
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +5 -6
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js +42 -40
- package/dist/composed/inline-edit.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/test-utils/conformance.d.ts +37 -0
- package/dist/test-utils/conformance.d.ts.map +1 -0
- package/dist/ui/alert.d.ts +1 -2
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +1 -27
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/banner.d.ts +3 -5
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +13 -13
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input.d.ts +1 -9
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +26 -27
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/segmented-control.d.ts +1 -1
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +2 -4
- package/dist/ui/segmented-control.js.map +1 -1
- package/docs/components/_header.md +1 -1
- package/docs/components/composed/activity-feed.md +6 -0
- package/docs/components/composed/avatar-group.md +8 -0
- package/docs/components/composed/bulk-action-bar.md +6 -0
- package/docs/components/composed/command-palette.md +7 -0
- package/docs/components/composed/confirm-dialog.md +6 -0
- package/docs/components/composed/content-card.md +6 -0
- package/docs/components/composed/date-picker.md +10 -0
- package/docs/components/composed/deadline-indicator.md +7 -0
- package/docs/components/composed/emoji-picker.md +8 -0
- package/docs/components/composed/empty-state.md +8 -0
- package/docs/components/composed/error-boundary.md +7 -0
- package/docs/components/composed/file-preview.md +8 -0
- package/docs/components/composed/filter-bar.md +8 -0
- package/docs/components/composed/form-section.md +6 -0
- package/docs/components/composed/global-loading.md +6 -0
- package/docs/components/composed/inline-edit.md +8 -0
- package/docs/components/composed/loading-skeleton.md +7 -0
- package/docs/components/composed/markdown-viewer.md +9 -0
- package/docs/components/composed/master-detail.md +7 -0
- package/docs/components/composed/member-picker.md +7 -0
- package/docs/components/composed/multi-select-popover.md +11 -0
- package/docs/components/composed/page-header.md +7 -0
- package/docs/components/composed/page-skeletons.md +10 -0
- package/docs/components/composed/priority-indicator.md +7 -0
- package/docs/components/composed/rich-chat-input.md +12 -0
- package/docs/components/composed/rich-text-editor.md +9 -0
- package/docs/components/composed/schedule-view.md +8 -0
- package/docs/components/composed/simple-tooltip.md +7 -0
- package/docs/components/composed/status-badge.md +10 -0
- package/docs/components/shell/app-command-palette.md +8 -0
- package/docs/components/shell/bottom-navbar.md +12 -0
- package/docs/components/shell/command-registry.md +7 -0
- package/docs/components/shell/link-context.md +15 -0
- package/docs/components/shell/notification-center.md +10 -0
- package/docs/components/shell/notification-preferences.md +7 -0
- package/docs/components/shell/sidebar.md +11 -0
- package/docs/components/shell/top-bar.md +11 -0
- package/docs/components/ui/accordion.md +10 -0
- package/docs/components/ui/alert-dialog.md +10 -1
- package/docs/components/ui/alert.md +13 -2
- package/docs/components/ui/aspect-ratio.md +7 -0
- package/docs/components/ui/autocomplete.md +7 -0
- package/docs/components/ui/avatar.md +10 -0
- package/docs/components/ui/badge-group.md +7 -0
- package/docs/components/ui/badge-indicator.md +7 -0
- package/docs/components/ui/badge.md +12 -0
- package/docs/components/ui/banner.md +10 -1
- package/docs/components/ui/breadcrumb.md +8 -0
- package/docs/components/ui/button-group.md +24 -4
- package/docs/components/ui/button-processing.md +5 -0
- package/docs/components/ui/button.md +9 -0
- package/docs/components/ui/card.md +16 -4
- package/docs/components/ui/charts.md +9 -0
- package/docs/components/ui/chat.md +9 -0
- package/docs/components/ui/checkbox.md +15 -1
- package/docs/components/ui/chip.md +9 -0
- package/docs/components/ui/code.md +7 -0
- package/docs/components/ui/collapsible.md +9 -0
- package/docs/components/ui/color-input.md +8 -0
- package/docs/components/ui/color-swatch.md +7 -0
- package/docs/components/ui/combobox.md +16 -3
- package/docs/components/ui/container.md +11 -0
- package/docs/components/ui/context-menu.md +8 -0
- package/docs/components/ui/data-table-body.md +4 -0
- package/docs/components/ui/data-table-bulk-actions.md +4 -0
- package/docs/components/ui/data-table-card.md +4 -0
- package/docs/components/ui/data-table-context.md +4 -0
- package/docs/components/ui/data-table-header.md +4 -0
- package/docs/components/ui/data-table-pagination.md +4 -0
- package/docs/components/ui/data-table-toolbar.md +7 -0
- package/docs/components/ui/data-table.md +25 -0
- package/docs/components/ui/devalok-grain.md +8 -0
- package/docs/components/ui/dialog.md +10 -0
- package/docs/components/ui/dropdown-menu.md +10 -0
- package/docs/components/ui/file-upload.md +8 -0
- package/docs/components/ui/form.md +21 -0
- package/docs/components/ui/hover-card.md +9 -0
- package/docs/components/ui/icon-button.md +7 -0
- package/docs/components/ui/icon-context.md +7 -0
- package/docs/components/ui/icon-group.md +9 -0
- package/docs/components/ui/icon.md +7 -0
- package/docs/components/ui/input-otp.md +29 -7
- package/docs/components/ui/input.md +11 -2
- package/docs/components/ui/label.md +7 -1
- package/docs/components/ui/link.md +7 -0
- package/docs/components/ui/menubar.md +9 -0
- package/docs/components/ui/navigation-menu.md +9 -0
- package/docs/components/ui/number-input.md +10 -0
- package/docs/components/ui/pagination.md +10 -0
- package/docs/components/ui/popover.md +9 -0
- package/docs/components/ui/progress-ring.md +7 -0
- package/docs/components/ui/progress.md +7 -0
- package/docs/components/ui/radio.md +27 -2
- package/docs/components/ui/search-input.md +8 -0
- package/docs/components/ui/segmented-control.md +21 -6
- package/docs/components/ui/select.md +14 -3
- package/docs/components/ui/separator.md +7 -0
- package/docs/components/ui/sheet.md +10 -0
- package/docs/components/ui/sidebar.md +30 -0
- package/docs/components/ui/skeleton.md +7 -0
- package/docs/components/ui/slider.md +15 -1
- package/docs/components/ui/spinner.md +7 -0
- package/docs/components/ui/split-button.md +11 -0
- package/docs/components/ui/stack.md +8 -0
- package/docs/components/ui/stat-card.md +9 -0
- package/docs/components/ui/status-dot.md +9 -0
- package/docs/components/ui/stepper.md +8 -0
- package/docs/components/ui/switch.md +8 -0
- package/docs/components/ui/table.md +8 -0
- package/docs/components/ui/tabs.md +10 -2
- package/docs/components/ui/text.md +9 -4
- package/docs/components/ui/textarea.md +7 -1
- package/docs/components/ui/toast.md +9 -0
- package/docs/components/ui/toaster.md +8 -0
- package/docs/components/ui/toggle-group.md +13 -4
- package/docs/components/ui/toggle.md +10 -2
- package/docs/components/ui/tooltip.md +11 -1
- package/docs/components/ui/tree-view.md +12 -0
- package/docs/components/ui/visually-hidden.md +7 -0
- package/docs/recipes/customize-brand.md +216 -0
- package/docs/recipes/index.md +51 -0
- package/docs/recipes/install-astro.md +178 -0
- package/docs/recipes/install-next-app-router.md +230 -0
- package/docs/recipes/install-next-pages.md +123 -0
- package/docs/recipes/install-remix.md +171 -0
- package/docs/recipes/install-tanstack-start.md +143 -0
- package/docs/recipes/install-vite.md +170 -0
- package/docs/recipes/server-components.md +209 -0
- package/docs/recipes/troubleshoot.md +217 -0
- package/llms-full.txt +1133 -88
- package/llms.txt +33 -16
- package/package.json +45 -35
- package/dist/composed/responsive-overlay.d.ts +0 -23
- package/dist/composed/responsive-overlay.d.ts.map +0 -1
- package/dist/composed/responsive-overlay.js +0 -40
- package/dist/composed/responsive-overlay.js.map +0 -1
- package/dist/hooks/use-toast.d.ts +0 -17
- package/dist/hooks/use-toast.d.ts.map +0 -1
- package/dist/hooks/use-toast.js +0 -3
- package/dist/tailwind/index.cjs +0 -41
- package/dist/tailwind/index.d.ts +0 -2
- package/dist/tailwind/index.d.ts.map +0 -1
- package/dist/tailwind/index.js +0 -2
- package/dist/tailwind/preset.d.ts +0 -25
- package/dist/tailwind/preset.d.ts.map +0 -1
- package/dist/tailwind/preset.js +0 -17
- package/dist/tailwind/preset.js.map +0 -1
- package/docs/components/composed/responsive-overlay.md +0 -34
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Server vs Client Components
|
|
2
|
+
|
|
3
|
+
Reference for using `@devalok/shilp-sutra` correctly inside React Server Components (Next.js App Router, TanStack Start, Remix v3+, Astro, future RSC frameworks).
|
|
4
|
+
|
|
5
|
+
## TL;DR
|
|
6
|
+
|
|
7
|
+
- **Always use per-component imports** (`@devalok/shilp-sutra/ui/button`, NOT `@devalok/shilp-sutra/ui`) — barrels drag in client-only siblings and trip the RSC barrel-import error.
|
|
8
|
+
- **Importing a client component into a Server Component is fine.** The client component renders as a client island at that point. The Server Component shell stays server-rendered.
|
|
9
|
+
- **What actually breaks RSC**, in order of frequency: (a) calling a client hook in a server file; (b) passing functions or class instances as props from server → client; (c) reading `window`/`document` in a server module's top-level body.
|
|
10
|
+
- The matrix below tells you which components have NO `"use client"` (so they SSR without hydration cost) vs. which become client islands (still importable, just hydrate).
|
|
11
|
+
|
|
12
|
+
## RSC-safety matrix
|
|
13
|
+
|
|
14
|
+
The list is generated from the `// @server-safe` source annotation. Components without the annotation get `"use client"` injected at build time and ship as client islands.
|
|
15
|
+
|
|
16
|
+
### `@devalok/shilp-sutra/ui`
|
|
17
|
+
|
|
18
|
+
| Server-safe (renders without hydration) | Everything else |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `Text` | All other UI primitives become client islands when rendered |
|
|
21
|
+
| `Stack` | |
|
|
22
|
+
| `Container` | |
|
|
23
|
+
| `Skeleton` | |
|
|
24
|
+
| `Table` (and child components: `TableHeader`, `TableRow`, `TableCell`) | |
|
|
25
|
+
| `Code` | |
|
|
26
|
+
| `VisuallyHidden` | |
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// ✅ Server Component — Text/Stack/Container/etc. SSR with zero hydration cost
|
|
30
|
+
import { Text } from "@devalok/shilp-sutra/ui/text";
|
|
31
|
+
import { Stack } from "@devalok/shilp-sutra/ui/stack";
|
|
32
|
+
|
|
33
|
+
export default function ServerPage() {
|
|
34
|
+
return (
|
|
35
|
+
<Stack className="p-ds-08">
|
|
36
|
+
<Text variant="heading-2xl">Server-rendered</Text>
|
|
37
|
+
</Stack>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
// ✅ Also fine — Button is a client component, but importing one into a Server
|
|
44
|
+
// Component just creates a client island at that boundary. No wrapper needed.
|
|
45
|
+
import { Button } from "@devalok/shilp-sutra/ui/button";
|
|
46
|
+
|
|
47
|
+
export default function ServerPage() {
|
|
48
|
+
return <Button>Click</Button>;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
// ❌ NOT fine — passing a function as a prop from server → client.
|
|
54
|
+
// Functions are not serializable across the RSC boundary.
|
|
55
|
+
import { Button } from "@devalok/shilp-sutra/ui/button";
|
|
56
|
+
|
|
57
|
+
export default function ServerPage() {
|
|
58
|
+
return <Button onClick={() => console.log("hi")}>Click</Button>;
|
|
59
|
+
// ^^^^^^^ — define handler inside a "use client" wrapper instead
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
When you need an event handler, define it inside a client component:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
// app/components/MyButton.tsx
|
|
67
|
+
"use client";
|
|
68
|
+
import { Button } from "@devalok/shilp-sutra/ui/button";
|
|
69
|
+
|
|
70
|
+
export function MyButton() {
|
|
71
|
+
return <Button onClick={() => console.log("hi")}>Click</Button>;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `@devalok/shilp-sutra/composed`
|
|
76
|
+
|
|
77
|
+
| Server-safe (renders without hydration) | Everything else |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `ContentCard` | All other composed components become client islands when rendered |
|
|
80
|
+
| `PageHeader` | |
|
|
81
|
+
| `LoadingSkeleton` | |
|
|
82
|
+
| `PageSkeletons` | |
|
|
83
|
+
|
|
84
|
+
### `@devalok/shilp-sutra/shell`
|
|
85
|
+
|
|
86
|
+
All shell components are client islands. They manage state (open/close, active route, viewport detection) and require hydration.
|
|
87
|
+
|
|
88
|
+
### `@devalok/shilp-sutra/ai`
|
|
89
|
+
|
|
90
|
+
All AI components are client islands. They manage conversation state, streaming responses, and command bar focus.
|
|
91
|
+
|
|
92
|
+
### `@devalok/shilp-sutra/hooks`
|
|
93
|
+
|
|
94
|
+
All hooks (`useColorMode`, `useIsMobile`, etc.) are client-only by definition (React hooks).
|
|
95
|
+
|
|
96
|
+
### `@devalok/shilp-sutra/utils`, `/ui/lib/utils`, `/ui/lib/motion`, `/ui/lib/date-utils`
|
|
97
|
+
|
|
98
|
+
Pure functions. Server-safe.
|
|
99
|
+
|
|
100
|
+
## Why barrel imports break RSC
|
|
101
|
+
|
|
102
|
+
The barrel re-exports every component in a layer. When a Server Component imports anything from `@devalok/shilp-sutra/ui`, the bundler walks the barrel and pulls in code from sibling components. If any sibling has `"use client"`, the bundler complains:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
You're importing a component that needs useState.
|
|
106
|
+
It only works in a Client Component.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Per-component imports avoid this — the bundler only walks the imported file's module graph.
|
|
110
|
+
|
|
111
|
+
This is also why **per-component imports tree-shake better** even in non-RSC frameworks. They're the recommended pattern everywhere.
|
|
112
|
+
|
|
113
|
+
## "use client" propagation
|
|
114
|
+
|
|
115
|
+
A component is server-safe only if:
|
|
116
|
+
|
|
117
|
+
1. It has no `"use client"` directive at the top of its source file
|
|
118
|
+
2. None of its imports have `"use client"` either (transitively)
|
|
119
|
+
|
|
120
|
+
We mark sources `// @server-safe` and a build-time check verifies the import graph stays clean. The `"use client"` directive is injected automatically during the build for components without that annotation.
|
|
121
|
+
|
|
122
|
+
If you fork the source and remove `"use client"` from a component that uses `useState`, the build will still inject it back unless you also remove the React-hook usage. Don't fight the system — wrap in a client component instead.
|
|
123
|
+
|
|
124
|
+
## Streaming and Suspense
|
|
125
|
+
|
|
126
|
+
All shilp-sutra components SSR cleanly. They have no client-only side effects at module top-level — no `window.*`, `document.*`, or `localStorage.*` access during render. Side effects happen in `useEffect`, which runs after hydration.
|
|
127
|
+
|
|
128
|
+
Use `<Suspense>` boundaries normally:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { Suspense } from "react";
|
|
132
|
+
import { LoadingSkeleton } from "@devalok/shilp-sutra/composed/loading-skeleton";
|
|
133
|
+
|
|
134
|
+
export default function Page() {
|
|
135
|
+
return (
|
|
136
|
+
<Suspense fallback={<LoadingSkeleton variant="page" />}>
|
|
137
|
+
<ClientHeavyComponent />
|
|
138
|
+
</Suspense>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Both `<Suspense>` and `<LoadingSkeleton>` are server-safe.
|
|
144
|
+
|
|
145
|
+
## Common RSC mistakes
|
|
146
|
+
|
|
147
|
+
### Mistake 1: Calling a client hook in a Server Component
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
// ❌ — useColorMode is a React hook; hooks only run in client components
|
|
151
|
+
import { useColorMode } from "@devalok/shilp-sutra/hooks/use-color-mode";
|
|
152
|
+
|
|
153
|
+
export default function ServerPage() {
|
|
154
|
+
const { mode } = useColorMode(); // breaks
|
|
155
|
+
return <div>{mode}</div>;
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Fix: use the hook inside a `"use client"` component.
|
|
160
|
+
|
|
161
|
+
### Mistake 2: Reading `window.*` in a server module's top level
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
// ❌ — window is undefined on the server
|
|
165
|
+
const w = window.innerWidth;
|
|
166
|
+
|
|
167
|
+
export default function ServerPage() {
|
|
168
|
+
return <p>{w}px</p>;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Fix: read inside a `useEffect` of a client component, or use `useIsMobile` in a client wrapper.
|
|
173
|
+
|
|
174
|
+
### Mistake 3: Passing functions as props from a Server Component to a client island
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
// ❌ — function props are not serializable across the RSC boundary
|
|
178
|
+
import { Button } from "@devalok/shilp-sutra/ui/button";
|
|
179
|
+
|
|
180
|
+
export default function ServerPage() {
|
|
181
|
+
return <Button onClick={() => console.log("hi")}>Click</Button>;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Fix: define the handler inside the client island, or use a Server Action and pass the action reference (Server Actions ARE serializable).
|
|
186
|
+
|
|
187
|
+
### Mistake 4: Barrel-importing into a Server Component
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// ❌ — pulls every UI primitive's module graph into the server file,
|
|
191
|
+
// and any sibling with "use client" trips the bundler error.
|
|
192
|
+
import { Text } from "@devalok/shilp-sutra/ui";
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Fix: per-component import.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
// ✅
|
|
199
|
+
import { Text } from "@devalok/shilp-sutra/ui/text";
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## When in doubt
|
|
203
|
+
|
|
204
|
+
If you're unsure whether a component is server-safe, look at the source:
|
|
205
|
+
|
|
206
|
+
- `packages/core/src/ui/<name>.tsx` — top of file. The `// @server-safe` annotation marks components that ship without `"use client"`.
|
|
207
|
+
- `packages/core/src/composed/<name>/index.tsx` — same.
|
|
208
|
+
|
|
209
|
+
The matrix in this file is the authoritative public list. If you find a discrepancy, file an issue.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Troubleshoot
|
|
2
|
+
|
|
3
|
+
A decision tree for the most common shilp-sutra setup breakages. Read symptoms top-to-bottom; the first match is usually the right diagnosis.
|
|
4
|
+
|
|
5
|
+
## Symptom: Tailwind utilities don't apply (no styling at all)
|
|
6
|
+
|
|
7
|
+
**Diagnosis:** Tailwind is not detecting design-system source classes, OR the CSS imports are out of order.
|
|
8
|
+
|
|
9
|
+
Check 1 — import order. Open the global CSS file. The order MUST be:
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
@import "tailwindcss"; /* FIRST */
|
|
13
|
+
@import "@devalok/shilp-sutra/css"; /* SECOND */
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
If reversed, swap them.
|
|
17
|
+
|
|
18
|
+
Check 2 — both imports present. Some setups accidentally drop `@import "tailwindcss"` after a refactor. Both imports are required.
|
|
19
|
+
|
|
20
|
+
Check 3 — file is actually loaded. In Next.js, `globals.css` must be imported from `app/layout.tsx` (App Router) or `pages/_app.tsx` (Pages Router). In Vite, from `src/main.tsx`. In Remix, via `links` export. In Astro, from a layout file.
|
|
21
|
+
|
|
22
|
+
## Symptom: Spacing utilities like `p-4` don't work but `p-ds-04` does
|
|
23
|
+
|
|
24
|
+
**Diagnosis:** Working as designed.
|
|
25
|
+
|
|
26
|
+
Shilp Sutra uses the `--spacing-ds-*` namespace to avoid colliding with consumer numeric spacing. Use `p-ds-04`, `gap-ds-03`, `mx-ds-08`, etc. Plain `p-4` is the consumer's own spacing (Tailwind's default scale) — it works but is unrelated to the design system.
|
|
27
|
+
|
|
28
|
+
If `p-ds-*` does NOT work, you have the styling-not-applying issue above.
|
|
29
|
+
|
|
30
|
+
## Symptom: Console error or weird animation glitches involving `MotionConfig`, `LayoutGroup`, or `AnimatePresence`
|
|
31
|
+
|
|
32
|
+
**Diagnosis:** Multiple copies of `framer-motion` are resolved.
|
|
33
|
+
|
|
34
|
+
Run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm why framer-motion
|
|
38
|
+
# or
|
|
39
|
+
npm ls framer-motion
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If more than one version is listed, fix with overrides:
|
|
43
|
+
|
|
44
|
+
**pnpm:**
|
|
45
|
+
```jsonc
|
|
46
|
+
// package.json
|
|
47
|
+
{
|
|
48
|
+
"pnpm": {
|
|
49
|
+
"overrides": {
|
|
50
|
+
"framer-motion": "^12"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**npm:**
|
|
57
|
+
```jsonc
|
|
58
|
+
// package.json
|
|
59
|
+
{
|
|
60
|
+
"overrides": {
|
|
61
|
+
"framer-motion": "^12"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**yarn (berry):**
|
|
67
|
+
```jsonc
|
|
68
|
+
// package.json
|
|
69
|
+
{
|
|
70
|
+
"resolutions": {
|
|
71
|
+
"framer-motion": "^12"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**bun:**
|
|
77
|
+
```jsonc
|
|
78
|
+
// package.json
|
|
79
|
+
{
|
|
80
|
+
"overrides": {
|
|
81
|
+
"framer-motion": "^12"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
After editing, delete the lockfile + `node_modules` and reinstall.
|
|
87
|
+
|
|
88
|
+
## Symptom: Next.js error: `Cannot find module '@devalok/shilp-sutra/...'` or `Module parse failed: Unexpected token`
|
|
89
|
+
|
|
90
|
+
**Diagnosis:** `transpilePackages` is missing from `next.config.{ts,js,mjs}`.
|
|
91
|
+
|
|
92
|
+
Add:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
transpilePackages: ["@devalok/shilp-sutra", "@devalok/shilp-sutra-brand"],
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If `@devalok/shilp-sutra-brand` is not installed, list only `@devalok/shilp-sutra`.
|
|
99
|
+
|
|
100
|
+
## Symptom: Hydration warning on every page load (Next.js)
|
|
101
|
+
|
|
102
|
+
**Diagnosis:** `next-themes` writes the `class` attribute on `<html>` before React hydrates, causing a server/client class mismatch.
|
|
103
|
+
|
|
104
|
+
Add `suppressHydrationWarning` to `<html>` in `app/layout.tsx` (App Router) or `pages/_document.tsx` (Pages Router):
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<html lang="en" suppressHydrationWarning>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This warning is specific to the `class` attribute on `<html>` — it does NOT suppress hydration warnings on other elements.
|
|
111
|
+
|
|
112
|
+
## Symptom: Dark mode toggle does nothing
|
|
113
|
+
|
|
114
|
+
**Diagnosis:** The `.dark` class is not being applied to `<html>` (or any ancestor of the components).
|
|
115
|
+
|
|
116
|
+
Quick verification — open the browser console and run:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
document.documentElement.classList.add("dark");
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If components now render in dark mode, the toggle wiring is broken (not the design system). Check:
|
|
123
|
+
|
|
124
|
+
- `next-themes` is installed and `<ThemeProvider attribute="class">` wraps the app
|
|
125
|
+
- For Vite/Remix/Astro/TanStack: the `theme-bootstrap.js` script runs before any React mount
|
|
126
|
+
|
|
127
|
+
If `.dark` IS on `<html>` and components still look light, the CSS imports are out of order — see the first symptom above.
|
|
128
|
+
|
|
129
|
+
## Symptom: RSC error — `You're importing a component that needs useState. It only works in a Client Component`
|
|
130
|
+
|
|
131
|
+
**Diagnosis:** A client-only shilp-sutra component is being imported into a Server Component via the barrel.
|
|
132
|
+
|
|
133
|
+
Switch to per-component imports:
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
// ❌ pulls client code into RSC
|
|
137
|
+
import { Button } from "@devalok/shilp-sutra/ui";
|
|
138
|
+
|
|
139
|
+
// ✅ component-scoped, declares "use client" only where needed
|
|
140
|
+
import { Button } from "@devalok/shilp-sutra/ui/button";
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For the full RSC-safety matrix, see [server-components.md](./server-components.md).
|
|
144
|
+
|
|
145
|
+
## Symptom: Fonts render in browser default (Times/Arial), not Inter/Ranade
|
|
146
|
+
|
|
147
|
+
**Diagnosis:** Either the CSS import did not load (see first symptom), or the consumer is overriding `--font-sans` / `--font-display` and pointing at a font that isn't loaded.
|
|
148
|
+
|
|
149
|
+
Check the computed value of `--font-sans` on `<html>` in DevTools. It should be `"Inter Variable", system-ui, ...`. If the override variable points at a font that isn't loaded, the browser falls back.
|
|
150
|
+
|
|
151
|
+
The font files ship inside the package — no `next/font` configuration is required for the defaults to work.
|
|
152
|
+
|
|
153
|
+
## Symptom: Bare `shadow` class produces no visible shadow
|
|
154
|
+
|
|
155
|
+
**Diagnosis:** Working as designed. Tailwind 4 has no default `--shadow` token, so the `shadow` utility no longer exists.
|
|
156
|
+
|
|
157
|
+
Use the explicit shadow variants:
|
|
158
|
+
|
|
159
|
+
- `shadow-raised` — cards, buttons
|
|
160
|
+
- `shadow-overlay` — popovers, dropdowns
|
|
161
|
+
- `shadow-floating` — modals, dialogs
|
|
162
|
+
- `shadow-brand` — accent emphasis
|
|
163
|
+
|
|
164
|
+
## Symptom: `<Toaster />` is mounted but `toast()` doesn't show anything
|
|
165
|
+
|
|
166
|
+
**Diagnosis:** Either `sonner` is not installed, or two `<Toaster />` instances are mounted at different positions and they're stacking off-screen.
|
|
167
|
+
|
|
168
|
+
Check 1 — `pnpm list sonner` shows `^2.0.0` or higher.
|
|
169
|
+
|
|
170
|
+
Check 2 — only ONE `<Toaster />` is mounted in the app. Search the project: `grep -r "<Toaster" src/ app/`.
|
|
171
|
+
|
|
172
|
+
In dev mode, calling `toast()` without a mounted `<Toaster />` logs a one-time console warning pointing to the fix (since v0.36.0).
|
|
173
|
+
|
|
174
|
+
## Symptom: Build error mentioning `use-sync-external-store`
|
|
175
|
+
|
|
176
|
+
**Diagnosis:** Should not happen since v0.37.0 — `use-sync-external-store` was moved to runtime dependencies and is auto-installed transitively.
|
|
177
|
+
|
|
178
|
+
If it still happens, install it explicitly:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
pnpm add use-sync-external-store
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
And open an issue at <https://github.com/devalok-design/shilp-sutra/issues> with the resolution graph (`pnpm why use-sync-external-store`) so we can fix the root cause.
|
|
185
|
+
|
|
186
|
+
## Symptom: Storybook MCP server `localhost:6006/mcp` returns 404
|
|
187
|
+
|
|
188
|
+
**Diagnosis:** Storybook dev server isn't running, OR the MCP plugin is not enabled in this Storybook version.
|
|
189
|
+
|
|
190
|
+
Check 1 — `pnpm dev` is running and `http://localhost:6006/` shows the Storybook UI.
|
|
191
|
+
Check 2 — the MCP endpoint requires Storybook 9+ with the MCP plugin enabled. Older versions of this repo's Storybook setup may need an upgrade.
|
|
192
|
+
|
|
193
|
+
The MCP server is a development convenience for AI agents — `llms.txt` and `llms-full.txt` are the authoritative docs and do not require a running server.
|
|
194
|
+
|
|
195
|
+
## Still stuck
|
|
196
|
+
|
|
197
|
+
Open an issue with this template:
|
|
198
|
+
|
|
199
|
+
```md
|
|
200
|
+
## Environment
|
|
201
|
+
- Framework + version (Next.js 15.x / Vite 5.x / Remix 2.x / Astro 5.x / TanStack Start ...)
|
|
202
|
+
- Package manager + version (pnpm 10.x / npm 11.x / yarn / bun)
|
|
203
|
+
- Node version
|
|
204
|
+
- @devalok/shilp-sutra version
|
|
205
|
+
- Other peer deps (framer-motion, sonner, tailwindcss versions)
|
|
206
|
+
|
|
207
|
+
## What I tried
|
|
208
|
+
[Recipe followed, step where it broke]
|
|
209
|
+
|
|
210
|
+
## What happened
|
|
211
|
+
[Exact error message, stack trace, screenshot]
|
|
212
|
+
|
|
213
|
+
## What I expected
|
|
214
|
+
[Behavior described in the recipe]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
File at: <https://github.com/devalok-design/shilp-sutra/issues/new>
|