@devalok/shilp-sutra 0.45.1 → 0.47.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/AGENTS.md +13 -1
- package/MIGRATION.md +846 -808
- package/dist/_chunks/chat.js +6 -6
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/document-preview.js +5 -5
- package/dist/_chunks/image-preview.js +7 -7
- package/dist/_chunks/success.js +16 -16
- package/dist/composed/activity-feed.js +19 -19
- package/dist/composed/deadline-indicator.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.js +31 -31
- package/dist/composed/deadline-indicator.js.map +1 -1
- package/dist/composed/emoji-picker.js +15 -15
- package/dist/composed/file-preview.js +18 -18
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.js +1 -1
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/multi-select-popover.js +1 -1
- package/dist/composed/multi-select-popover.js.map +1 -1
- package/dist/tokens/base.css +6 -0
- package/dist/tokens/index.css +1 -1
- package/dist/tokens/semantic.css +1 -1
- package/dist/tokens/typography.css +10 -0
- package/dist/tokens/utilities.css +6 -0
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +57 -56
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge-indicator.js +1 -1
- package/dist/ui/badge-indicator.js.map +1 -1
- package/dist/ui/data-table-body.js +27 -27
- package/dist/ui/data-table-card.js +20 -20
- package/dist/ui/data-table-toolbar.d.ts.map +1 -1
- package/dist/ui/data-table-toolbar.js +40 -36
- package/dist/ui/data-table-toolbar.js.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +37 -36
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/radio.js +1 -1
- package/dist/ui/radio.js.map +1 -1
- package/dist/ui/sidebar.js +7 -7
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +48 -47
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/surface.d.ts +46 -0
- package/dist/ui/surface.d.ts.map +1 -0
- package/dist/ui/surface.js +51 -0
- package/dist/ui/surface.js.map +1 -0
- package/dist/ui/text.js +6 -6
- package/dist/ui/text.js.map +1 -1
- package/docs/components/ui/surface.md +55 -0
- package/docs/recipes/install-tanstack-start.md +91 -44
- package/fonts/Manrope-Variable.woff2 +0 -0
- package/llms.txt +2 -1
- package/make-kit/components/overview.md +7 -3
- package/make-kit/components/surface.md +60 -0
- package/mcp-manifest.json +135 -3
- package/mcp-manifest.schema.json +6 -0
- package/package.json +7 -2
- package/scripts/welcome.mjs +4 -2
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +2 -1
- package/skill/references/setup-tanstack-start.md +91 -44
package/mcp-manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./mcp-manifest.schema.json",
|
|
3
|
-
"manifestVersion": "1.
|
|
3
|
+
"manifestVersion": "1.1.0",
|
|
4
4
|
"package": "@devalok/shilp-sutra",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.47.0",
|
|
6
6
|
"components": {
|
|
7
7
|
"accordion": {
|
|
8
8
|
"displayName": "Accordion",
|
|
@@ -1780,6 +1780,17 @@
|
|
|
1780
1780
|
"version": "0.1.0",
|
|
1781
1781
|
"summary": "**Added** Initial release"
|
|
1782
1782
|
}
|
|
1783
|
+
],
|
|
1784
|
+
"peers": [
|
|
1785
|
+
"d3-array",
|
|
1786
|
+
"d3-axis",
|
|
1787
|
+
"d3-format",
|
|
1788
|
+
"d3-interpolate",
|
|
1789
|
+
"d3-scale",
|
|
1790
|
+
"d3-selection",
|
|
1791
|
+
"d3-shape",
|
|
1792
|
+
"d3-time-format",
|
|
1793
|
+
"d3-transition"
|
|
1783
1794
|
]
|
|
1784
1795
|
},
|
|
1785
1796
|
"chat": {
|
|
@@ -2787,6 +2798,10 @@
|
|
|
2787
2798
|
"version": "0.1.0",
|
|
2788
2799
|
"summary": "**Added** Initial release"
|
|
2789
2800
|
}
|
|
2801
|
+
],
|
|
2802
|
+
"peers": [
|
|
2803
|
+
"@tanstack/react-table",
|
|
2804
|
+
"@tanstack/react-virtual"
|
|
2790
2805
|
]
|
|
2791
2806
|
},
|
|
2792
2807
|
"data-table-body": {
|
|
@@ -3001,6 +3016,10 @@
|
|
|
3001
3016
|
"version": "0.1.0",
|
|
3002
3017
|
"summary": "**Added** Initial release"
|
|
3003
3018
|
}
|
|
3019
|
+
],
|
|
3020
|
+
"peers": [
|
|
3021
|
+
"@tanstack/react-table",
|
|
3022
|
+
"@tanstack/react-virtual"
|
|
3004
3023
|
]
|
|
3005
3024
|
},
|
|
3006
3025
|
"devalok-grain": {
|
|
@@ -4038,6 +4057,9 @@
|
|
|
4038
4057
|
"version": "0.1.0",
|
|
4039
4058
|
"summary": "**Added** Initial release"
|
|
4040
4059
|
}
|
|
4060
|
+
],
|
|
4061
|
+
"peers": [
|
|
4062
|
+
"input-otp"
|
|
4041
4063
|
]
|
|
4042
4064
|
},
|
|
4043
4065
|
"label": {
|
|
@@ -6370,6 +6392,95 @@
|
|
|
6370
6392
|
}
|
|
6371
6393
|
]
|
|
6372
6394
|
},
|
|
6395
|
+
"surface": {
|
|
6396
|
+
"displayName": "Surface",
|
|
6397
|
+
"tier": "ui",
|
|
6398
|
+
"import": "@devalok/shilp-sutra/ui/surface",
|
|
6399
|
+
"serverSafe": true,
|
|
6400
|
+
"description": "The low-level elevated container primitive. Owns background + shadow + radius + optional padding and border — nothing else. Card, Popover, Toast, Sheet, and other surfaces compose it.",
|
|
6401
|
+
"props": {
|
|
6402
|
+
"elevation": {
|
|
6403
|
+
"type": {
|
|
6404
|
+
"name": "enum",
|
|
6405
|
+
"value": [
|
|
6406
|
+
"flat",
|
|
6407
|
+
"raised",
|
|
6408
|
+
"floating",
|
|
6409
|
+
"overlay"
|
|
6410
|
+
]
|
|
6411
|
+
},
|
|
6412
|
+
"required": false,
|
|
6413
|
+
"defaultValue": "raised"
|
|
6414
|
+
},
|
|
6415
|
+
"padding": {
|
|
6416
|
+
"type": {
|
|
6417
|
+
"name": "enum",
|
|
6418
|
+
"value": [
|
|
6419
|
+
"none",
|
|
6420
|
+
"sm",
|
|
6421
|
+
"md",
|
|
6422
|
+
"lg"
|
|
6423
|
+
]
|
|
6424
|
+
},
|
|
6425
|
+
"required": false,
|
|
6426
|
+
"defaultValue": "none"
|
|
6427
|
+
},
|
|
6428
|
+
"radius": {
|
|
6429
|
+
"type": {
|
|
6430
|
+
"name": "enum",
|
|
6431
|
+
"value": [
|
|
6432
|
+
"none",
|
|
6433
|
+
"control",
|
|
6434
|
+
"surface",
|
|
6435
|
+
"overlay",
|
|
6436
|
+
"pill"
|
|
6437
|
+
]
|
|
6438
|
+
},
|
|
6439
|
+
"required": false,
|
|
6440
|
+
"defaultValue": "surface"
|
|
6441
|
+
},
|
|
6442
|
+
"bordered": {
|
|
6443
|
+
"type": {
|
|
6444
|
+
"name": "enum",
|
|
6445
|
+
"value": [
|
|
6446
|
+
"true",
|
|
6447
|
+
"false"
|
|
6448
|
+
]
|
|
6449
|
+
},
|
|
6450
|
+
"required": false,
|
|
6451
|
+
"defaultValue": false
|
|
6452
|
+
},
|
|
6453
|
+
"asChild": {
|
|
6454
|
+
"type": {
|
|
6455
|
+
"name": "object",
|
|
6456
|
+
"raw": "boolean — render as the passed child element (Radix Slot) instead of a div"
|
|
6457
|
+
},
|
|
6458
|
+
"required": false
|
|
6459
|
+
}
|
|
6460
|
+
},
|
|
6461
|
+
"composition": {
|
|
6462
|
+
"notes": [
|
|
6463
|
+
"Server-safe — renders in RSC trees.",
|
|
6464
|
+
"The base layer: `Card` = Surface + gap-model padding + color edge + header/content/footer slots. Reach for Card when you want that slot rhythm; reach for Surface for a plain elevated box.",
|
|
6465
|
+
"`asChild` merges the surface classes onto your own element (a link, section, or `motion.div`) with no extra wrapper node.",
|
|
6466
|
+
"Padding is symmetric all-side. For asymmetric or gap-model spacing, use Card or add your own utilities via `className`."
|
|
6467
|
+
]
|
|
6468
|
+
},
|
|
6469
|
+
"docPath": "docs/components/ui/surface.md",
|
|
6470
|
+
"defaults": {
|
|
6471
|
+
"elevation": "raised",
|
|
6472
|
+
"padding": "none",
|
|
6473
|
+
"radius": "surface",
|
|
6474
|
+
"bordered": false
|
|
6475
|
+
},
|
|
6476
|
+
"examples": [
|
|
6477
|
+
"// Raised panel with padding\n<Surface elevation=\"raised\" padding=\"md\">…</Surface>\n\n// On-page, border-led tile (no shadow)\n<Surface elevation=\"flat\" bordered padding=\"sm\">…</Surface>\n\n// The whole surface is a link\n<Surface asChild elevation=\"raised\" padding=\"sm\">\n <a href=\"/upgrade\">Upgrade to Pro</a>\n</Surface>"
|
|
6478
|
+
],
|
|
6479
|
+
"gotchas": [
|
|
6480
|
+
"**Edge OR elevation, never both.** Combining `bordered` with a shadowed elevation (raised/floating/overlay) is the double-edge anti-pattern and dev-warns. Use `elevation=\"flat\"` with `bordered`, or drop `bordered` and let the shadow be the edge.",
|
|
6481
|
+
"`flat` still uses `bg-surface-raised` (a card without a shadow), not the page background — it is a surface, not a hole."
|
|
6482
|
+
]
|
|
6483
|
+
},
|
|
6373
6484
|
"switch": {
|
|
6374
6485
|
"displayName": "Switch",
|
|
6375
6486
|
"tier": "ui",
|
|
@@ -8498,6 +8609,9 @@
|
|
|
8498
8609
|
"version": "0.1.0",
|
|
8499
8610
|
"summary": "**Added** Initial release"
|
|
8500
8611
|
}
|
|
8612
|
+
],
|
|
8613
|
+
"peers": [
|
|
8614
|
+
"date-fns"
|
|
8501
8615
|
]
|
|
8502
8616
|
},
|
|
8503
8617
|
"deadline-indicator": {
|
|
@@ -8948,6 +9062,10 @@
|
|
|
8948
9062
|
"All types have error fallback with download link",
|
|
8949
9063
|
"Embed URLs auto-converted to embed format",
|
|
8950
9064
|
"Audio player doesn't show separate Download button (integrated in card)"
|
|
9065
|
+
],
|
|
9066
|
+
"peers": [
|
|
9067
|
+
"react-pdf",
|
|
9068
|
+
"react-zoom-pan-pinch"
|
|
8951
9069
|
]
|
|
8952
9070
|
},
|
|
8953
9071
|
"filter-bar": {
|
|
@@ -9398,6 +9516,10 @@
|
|
|
9398
9516
|
"GFM (tables, strikethrough, task lists) is supported via `remark-gfm`",
|
|
9399
9517
|
"Raw HTML is stripped by default — only enable `allowHtml` for trusted content",
|
|
9400
9518
|
"Links open in a new tab by default (`target=\"_blank\"` with `rel=\"noopener noreferrer\"`)"
|
|
9519
|
+
],
|
|
9520
|
+
"peers": [
|
|
9521
|
+
"react-markdown",
|
|
9522
|
+
"react-syntax-highlighter"
|
|
9401
9523
|
]
|
|
9402
9524
|
},
|
|
9403
9525
|
"master-detail": {
|
|
@@ -10103,6 +10225,11 @@
|
|
|
10103
10225
|
"version": "0.32.0",
|
|
10104
10226
|
"summary": "Initial release"
|
|
10105
10227
|
}
|
|
10228
|
+
],
|
|
10229
|
+
"peers": [
|
|
10230
|
+
"@tiptap/react",
|
|
10231
|
+
"@tiptap/starter-kit",
|
|
10232
|
+
"@tiptap/extension-placeholder"
|
|
10106
10233
|
]
|
|
10107
10234
|
},
|
|
10108
10235
|
"rich-text-editor": {
|
|
@@ -10244,6 +10371,11 @@
|
|
|
10244
10371
|
"version": "0.1.1",
|
|
10245
10372
|
"summary": "**Fixed** Added content sync effect so editor updates when `content` prop changes externally"
|
|
10246
10373
|
}
|
|
10374
|
+
],
|
|
10375
|
+
"peers": [
|
|
10376
|
+
"@tiptap/react",
|
|
10377
|
+
"@tiptap/starter-kit",
|
|
10378
|
+
"@tiptap/extension-placeholder"
|
|
10247
10379
|
]
|
|
10248
10380
|
},
|
|
10249
10381
|
"schedule-view": {
|
|
@@ -11924,7 +12056,7 @@
|
|
|
11924
12056
|
},
|
|
11925
12057
|
{
|
|
11926
12058
|
"name": "--font-display",
|
|
11927
|
-
"value": "\"Inter\", system-ui, sans-serif"
|
|
12059
|
+
"value": "\"Manrope\", \"Inter\", system-ui, sans-serif"
|
|
11928
12060
|
},
|
|
11929
12061
|
{
|
|
11930
12062
|
"name": "--font-body",
|
package/mcp-manifest.schema.json
CHANGED
|
@@ -81,6 +81,12 @@
|
|
|
81
81
|
"items": { "type": "string" },
|
|
82
82
|
"description": "Known-misuse bullets, verbatim, DO-NOT phrasing preferred."
|
|
83
83
|
},
|
|
84
|
+
"peers": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": { "type": "string" },
|
|
87
|
+
"description": "Optional peer dependencies this component imports. Absent for core components (no extra install). Importing the component without these installed fails the build with 'Failed to resolve import'. Mirrors the recipe optional-peer table; read by the MCP preflight/verify_setup tools.",
|
|
88
|
+
"examples": [["@tanstack/react-table", "@tanstack/react-virtual"]]
|
|
89
|
+
},
|
|
84
90
|
"changes": {
|
|
85
91
|
"type": "array",
|
|
86
92
|
"items": {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devalok/shilp-sutra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Devalok Design System — accessible React components, OKLCH design tokens, and Tailwind 4 CSS-first setup. Ships with AI-agent setup recipes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Devalok Design & Strategy Studios <shilp-sutra@devalok.in>",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://shilp-sutra.devalok.in",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/devalok-design/shilp-sutra",
|
|
@@ -377,6 +377,11 @@
|
|
|
377
377
|
"import": "./dist/ui/stepper.js",
|
|
378
378
|
"default": "./dist/ui/stepper.js"
|
|
379
379
|
},
|
|
380
|
+
"./ui/surface": {
|
|
381
|
+
"types": "./dist/ui/surface.d.ts",
|
|
382
|
+
"import": "./dist/ui/surface.js",
|
|
383
|
+
"default": "./dist/ui/surface.js"
|
|
384
|
+
},
|
|
380
385
|
"./ui/switch": {
|
|
381
386
|
"types": "./dist/ui/switch.d.ts",
|
|
382
387
|
"import": "./dist/ui/switch.js",
|
package/scripts/welcome.mjs
CHANGED
|
@@ -173,7 +173,7 @@ function buildFullBanner(version, prevVersion) {
|
|
|
173
173
|
lines.push(row(` ${colour('+ docs/recipes/upgrading.md (safe-upgrade procedure)', DIM)}`))
|
|
174
174
|
} else {
|
|
175
175
|
lines.push(row(` ${colour('✦', PINK)} ${colour('@devalok/shilp-sutra', BOLD)} ${version}`))
|
|
176
|
-
lines.push(row(` ${colour('Tailwind 4 design system ·
|
|
176
|
+
lines.push(row(` ${colour('Tailwind 4 design system · 120+ components · RSC-safe', DIM)}`))
|
|
177
177
|
}
|
|
178
178
|
lines.push(colour(EMPTY, PINK_DIM))
|
|
179
179
|
lines.push(row(` ${colour('▸', PINK)} Setup recipe (pick your framework):`))
|
|
@@ -183,7 +183,9 @@ function buildFullBanner(version, prevVersion) {
|
|
|
183
183
|
lines.push(row(` ${colour('https://shilp-sutra.devalok.in/themer', DIM)}`))
|
|
184
184
|
lines.push(colour(EMPTY, PINK_DIM))
|
|
185
185
|
lines.push(row(` ${colour('▸', PINK)} Wire your AI agent (Claude Code / Cursor / Codex):`))
|
|
186
|
-
lines.push(row(` ${colour('
|
|
186
|
+
lines.push(row(` ${colour('connect the live docs MCP → https://shilp-sutra.devalok.in/mcp', DIM)}`))
|
|
187
|
+
lines.push(row(` ${colour('(version-exact setup + peer preflight; beats guessing)', DIM)}`))
|
|
188
|
+
lines.push(row(` ${colour('or copy the skill: cp -r node_modules/@devalok/shilp-sutra/skill \\', DIM)}`))
|
|
187
189
|
lines.push(row(` ${colour('~/.claude/skills/shilp-sutra', DIM)}`))
|
|
188
190
|
lines.push(colour(EMPTY, PINK_DIM))
|
|
189
191
|
lines.push(row(` ${colour('Disable this banner: SHILP_SUTRA_NO_WELCOME=1', DIM)}`))
|
package/skill/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: shilp-sutra
|
|
|
3
3
|
description: Add, configure, and use components from Devalok's shilp-sutra design system (@devalok/shilp-sutra) — a Tailwind 4 + React 19 + CVA library with 110+ accessible components, OKLCH design tokens, framer-motion animations, and per-component RSC-safe entry points. Use this skill whenever the user mentions shilp-sutra, Devalok, the @devalok npm scope, or asks to install/add/style/theme UI in any React project that already depends on the package — even if they don't name it explicitly. Use it instead of generic shadcn/ui, MUI, or Chakra knowledge when shilp-sutra is in the project. Covers Next.js (App + Pages), Vite, Astro, Remix, TanStack Start setup playbooks; component API and variant reference; brand token customization; Server Component import patterns; and a troubleshoot tree for the thirteen most common breakages.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.47.0"
|
|
7
7
|
author: Devalok Design & Strategy Studios
|
|
8
8
|
homepage: https://github.com/devalok-design/shilp-sutra
|
|
9
9
|
npm: https://www.npmjs.com/package/@devalok/shilp-sutra
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @devalok/shilp-sutra
|
|
4
4
|
|
|
5
|
-
> Radix UI + Tailwind 4 (CSS-first) + CVA design system for Devalok apps, v0.
|
|
5
|
+
> Radix UI + Tailwind 4 (CSS-first) + CVA design system for Devalok apps, v0.47.0.
|
|
6
6
|
> Built on the same primitives as shadcn/ui but with DIFFERENT prop APIs — never guess from shadcn knowledge; verify every prop.
|
|
7
7
|
> This file is a ROUTER: it tells you what exists and where to get details. Do not look for prop tables here — fetch them per component (MCP tool or per-component doc file below).
|
|
8
8
|
|
|
@@ -102,6 +102,7 @@ Format: `[name](doc path): summary`. Import paths follow `@devalok/shilp-sutra/<
|
|
|
102
102
|
- [stat-flash](docs/components/ui/stat-flash.md)
|
|
103
103
|
- [status-dot](docs/components/ui/status-dot.md)
|
|
104
104
|
- [stepper](docs/components/ui/stepper.md)
|
|
105
|
+
- [surface](docs/components/ui/surface.md): The low-level elevated container primitive
|
|
105
106
|
- [switch](docs/components/ui/switch.md)
|
|
106
107
|
- [table](docs/components/ui/table.md)
|
|
107
108
|
- [table-row-link](docs/components/ui/table-row-link.md)
|
|
@@ -2,21 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
# Install: TanStack Start
|
|
4
4
|
|
|
5
|
-
> Setup recipe for adding `@devalok/shilp-sutra` to a TanStack Start project (the React full-stack framework built on
|
|
5
|
+
> Setup recipe for adding `@devalok/shilp-sutra` to a TanStack Start project (the React full-stack framework built on Vite).
|
|
6
|
+
|
|
7
|
+
> **Updated 2026-07-10 for the Vite-plugin era.** TanStack Start moved off Vinxi: the package is now `@tanstack/react-start` (not `@tanstack/start`), config lives in `vite.config.ts` (not `app.config.ts`), and the app root is `src/` (not `app/`). If you are on an old Vinxi-based project (`app.config.ts`, `@tanstack/start`), migrate to the Vite plugin first — see the TanStack Start docs.
|
|
6
8
|
|
|
7
9
|
## 1. Detect
|
|
8
10
|
|
|
9
11
|
You are in this recipe if:
|
|
10
12
|
|
|
11
|
-
- `package.json` lists `"@tanstack/start"` and `"@tanstack/react-router"`
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
13
|
+
- `package.json` lists `"@tanstack/react-start"` and `"@tanstack/react-router"`
|
|
14
|
+
- `vite.config.{ts,js}` exists and uses the `tanstackStart` plugin from `@tanstack/react-start/plugin/vite`
|
|
15
|
+
- `src/router.tsx` and `src/routes/__root.tsx` exist (a `src/routeTree.gen.ts` is generated on first run)
|
|
16
|
+
|
|
17
|
+
If instead you see `app.config.ts` + `@tanstack/start`, that is the legacy Vinxi setup — this recipe does not apply until you migrate.
|
|
14
18
|
|
|
15
19
|
## 2. Install
|
|
16
20
|
|
|
17
21
|
```bash
|
|
22
|
+
# pnpm
|
|
18
23
|
pnpm add @devalok/shilp-sutra framer-motion
|
|
19
24
|
pnpm add -D tailwindcss@^4 @tailwindcss/vite
|
|
25
|
+
|
|
26
|
+
# npm
|
|
27
|
+
npm install @devalok/shilp-sutra framer-motion
|
|
28
|
+
npm install -D tailwindcss@^4 @tailwindcss/vite
|
|
20
29
|
```
|
|
21
30
|
|
|
22
31
|
Optional:
|
|
@@ -40,39 +49,79 @@ Some components ship hard peers as optional. **Install BEFORE first import** or
|
|
|
40
49
|
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
41
50
|
| Any `Icon` / `IconButton` with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
42
51
|
|
|
43
|
-
## 3. Wire Tailwind 4 in `
|
|
52
|
+
## 3. Wire Tailwind 4 in `vite.config.ts`
|
|
53
|
+
|
|
54
|
+
Add `@tailwindcss/vite` to the existing plugins array. `tanstackStart()` must come before `viteReact()`; `tailwindcss()` can go first so tokens are processed early.
|
|
44
55
|
|
|
45
56
|
```ts
|
|
46
|
-
import { defineConfig } from "
|
|
57
|
+
import { defineConfig } from "vite";
|
|
58
|
+
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
59
|
+
import viteReact from "@vitejs/plugin-react";
|
|
47
60
|
import tailwindcss from "@tailwindcss/vite";
|
|
48
61
|
|
|
49
62
|
export default defineConfig({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
plugins: [
|
|
64
|
+
tailwindcss(),
|
|
65
|
+
tanstackStart(),
|
|
66
|
+
viteReact(),
|
|
67
|
+
],
|
|
53
68
|
});
|
|
54
69
|
```
|
|
55
70
|
|
|
71
|
+
Do **not** add a `tailwind.config.{ts,js}` — Tailwind 4 is CSS-first.
|
|
72
|
+
|
|
56
73
|
## 4. Wire tokens
|
|
57
74
|
|
|
58
|
-
Create `
|
|
75
|
+
Create `src/styles/globals.css`:
|
|
59
76
|
|
|
60
77
|
```css
|
|
61
78
|
@import "tailwindcss";
|
|
62
79
|
@import "@devalok/shilp-sutra/css";
|
|
63
80
|
```
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
Wire it as an asset-URL stylesheet from the root route's `head` (the TanStack Start idiom — the `?url` suffix emits the file as an asset instead of inlining it):
|
|
66
83
|
|
|
67
84
|
```tsx
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
// src/routes/__root.tsx
|
|
86
|
+
import {
|
|
87
|
+
createRootRoute,
|
|
88
|
+
HeadContent,
|
|
89
|
+
Outlet,
|
|
90
|
+
Scripts,
|
|
91
|
+
} from "@tanstack/react-router";
|
|
92
|
+
import globalsCss from "../styles/globals.css?url";
|
|
70
93
|
|
|
71
|
-
|
|
94
|
+
export const Route = createRootRoute({
|
|
95
|
+
head: () => ({
|
|
96
|
+
meta: [
|
|
97
|
+
{ charSet: "utf-8" },
|
|
98
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
99
|
+
],
|
|
100
|
+
links: [{ rel: "stylesheet", href: globalsCss }],
|
|
101
|
+
}),
|
|
102
|
+
component: RootComponent,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
function RootComponent() {
|
|
106
|
+
return (
|
|
107
|
+
<html lang="en" suppressHydrationWarning>
|
|
108
|
+
<head>
|
|
109
|
+
<HeadContent />
|
|
110
|
+
</head>
|
|
111
|
+
<body>
|
|
112
|
+
<Outlet />
|
|
113
|
+
<Scripts />
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
```
|
|
72
119
|
|
|
73
120
|
## 5. Theme toggle
|
|
74
121
|
|
|
75
|
-
|
|
122
|
+
Add a pre-hydration bootstrap so there is no flash of the wrong theme. The cleanest place is a `scripts` entry on the root route (runs before hydration); a static `public/theme-bootstrap.js` referenced from `<head>` also works and is CSP-friendly.
|
|
123
|
+
|
|
124
|
+
Static-asset approach — create `public/theme-bootstrap.js`:
|
|
76
125
|
|
|
77
126
|
```js
|
|
78
127
|
(function () {
|
|
@@ -86,44 +135,36 @@ Create `public/theme-bootstrap.js` (a static asset served verbatim):
|
|
|
86
135
|
})();
|
|
87
136
|
```
|
|
88
137
|
|
|
89
|
-
Reference it from `
|
|
138
|
+
Reference it from the root route's `head` scripts:
|
|
90
139
|
|
|
91
140
|
```tsx
|
|
92
|
-
import { createRootRoute, Outlet } from "@tanstack/react-router";
|
|
93
|
-
|
|
94
141
|
export const Route = createRootRoute({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<body>
|
|
101
|
-
<Outlet />
|
|
102
|
-
</body>
|
|
103
|
-
</html>
|
|
104
|
-
),
|
|
142
|
+
head: () => ({
|
|
143
|
+
// ...meta, links as above...
|
|
144
|
+
scripts: [{ src: "/theme-bootstrap.js" }],
|
|
145
|
+
}),
|
|
146
|
+
component: RootComponent,
|
|
105
147
|
});
|
|
106
148
|
```
|
|
107
149
|
|
|
108
|
-
For runtime toggling, use the `useColorMode` hook — see [install-vite.md § 5](./install-vite.md#5-theme-toggle-no-next-themes-here).
|
|
150
|
+
For runtime toggling inside components, use the `useColorMode` hook — see [install-vite.md § 5](./install-vite.md#5-theme-toggle-no-next-themes-here).
|
|
109
151
|
|
|
110
152
|
## 6. Toaster (optional)
|
|
111
153
|
|
|
112
|
-
Mount in `__root.tsx` next to `<Outlet />`:
|
|
154
|
+
Mount once in `__root.tsx`'s `RootComponent`, next to `<Outlet />`:
|
|
113
155
|
|
|
114
156
|
```tsx
|
|
115
157
|
import { Toaster } from "@devalok/shilp-sutra/ui/toaster";
|
|
116
158
|
|
|
117
159
|
// inside <body>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</>
|
|
160
|
+
<Outlet />
|
|
161
|
+
<Toaster />
|
|
162
|
+
<Scripts />
|
|
122
163
|
```
|
|
123
164
|
|
|
124
165
|
## 7. Verify
|
|
125
166
|
|
|
126
|
-
Create or replace `
|
|
167
|
+
Create or replace `src/routes/index.tsx`:
|
|
127
168
|
|
|
128
169
|
```tsx
|
|
129
170
|
import { createFileRoute } from "@tanstack/react-router";
|
|
@@ -132,7 +173,11 @@ import { Stack } from "@devalok/shilp-sutra/ui/stack";
|
|
|
132
173
|
import { Text } from "@devalok/shilp-sutra/ui/text";
|
|
133
174
|
|
|
134
175
|
export const Route = createFileRoute("/")({
|
|
135
|
-
component:
|
|
176
|
+
component: Home,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
function Home() {
|
|
180
|
+
return (
|
|
136
181
|
<Stack className="p-ds-08" gap="ds-04">
|
|
137
182
|
<Text variant="heading-2xl">Hello, Shilp Sutra</Text>
|
|
138
183
|
<Stack direction="row" gap="ds-03">
|
|
@@ -140,21 +185,23 @@ export const Route = createFileRoute("/")({
|
|
|
140
185
|
<Button variant="soft">Soft</Button>
|
|
141
186
|
</Stack>
|
|
142
187
|
</Stack>
|
|
143
|
-
)
|
|
144
|
-
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
145
190
|
```
|
|
146
191
|
|
|
147
|
-
Run `pnpm dev` and open the URL.
|
|
192
|
+
Run `pnpm dev` and open the printed URL. Expected output matches [Next App Router § 7](./install-next-app-router.md#7-verify-the-install).
|
|
148
193
|
|
|
149
194
|
## 8. TanStack Start specifics
|
|
150
195
|
|
|
196
|
+
- **No `transpilePackages` equivalent — and you do not need one.** TanStack Start's Vite resolves `@devalok/shilp-sutra` from `node_modules` as native ESM.
|
|
151
197
|
- **Server functions** (`createServerFn`) — do not import shilp-sutra components inside server functions; they run server-only.
|
|
152
|
-
- **Streaming SSR** is the default.
|
|
198
|
+
- **Streaming SSR** is the default. Shilp Sutra components SSR cleanly (no client-only side effects at module top-level).
|
|
153
199
|
- **`framer-motion` SSR** — animations gracefully degrade on the initial render.
|
|
154
|
-
- **
|
|
200
|
+
- **`routeTree.gen.ts` is generated** — do not edit it by hand; it regenerates on dev/build.
|
|
155
201
|
|
|
156
202
|
## 9. What NOT to do
|
|
157
203
|
|
|
158
|
-
- ❌ Add `tailwind.config.{ts,js}` — Tailwind 4 is CSS-first.
|
|
159
|
-
- ❌
|
|
160
|
-
- ❌
|
|
204
|
+
- ❌ Add a `tailwind.config.{ts,js}` — Tailwind 4 is CSS-first.
|
|
205
|
+
- ❌ Use `@tanstack/start` / `app.config.ts` / `@tanstack/start/config` — that is the retired Vinxi setup. Current TanStack Start is `@tanstack/react-start` + `vite.config.ts`.
|
|
206
|
+
- ❌ Mount `<Toaster />` inside route components — it lives once at the `__root`.
|
|
207
|
+
- ❌ Mix `@tailwindcss/postcss` and `@tailwindcss/vite` — pick the Vite plugin.
|