Add arrangement demo site from original project

Copies the multi-page demo app (Providers → Packages → Comparison flow)
with Zustand basket state, URL sync, and per-slice Vite build config.
All pages render correctly on React 19 + MUI v7 with zero code changes needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 14:32:16 +10:00
parent 16dcc4de2e
commit 6ac706f8e7
15 changed files with 1941 additions and 1 deletions

17
src/demo/shared/assets.ts Normal file
View File

@@ -0,0 +1,17 @@
/**
* Resolve a public-asset path against Vite's base URL.
*
* In dev `import.meta.env.BASE_URL === '/'`, so `assetUrl('/images/foo.png')`
* returns `/images/foo.png` unchanged. In production the build sets base to
* `/arrangement/` (or whatever `--mode <slice>` was passed), and the same
* call returns `/arrangement/images/foo.png` so the bundled assets resolve
* correctly under the slice subpath.
*
* Always pass leading-slash paths — they're relative to the publicDir root.
*/
export const assetUrl = (path: string): string => {
const base = import.meta.env.BASE_URL;
const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;
const cleanPath = path.startsWith('/') ? path : `/${path}`;
return `${cleanBase}${cleanPath}`;
};