An open source design system that's fully customizable and agent ready
TypeScript
build(sandbox): migrate static export from Next to Vite (#6627)
Cindy Zhang7210f0dc49cb
diff --git a/apps/docsite/e2e/playground-preview-isolation.spec.ts b/apps/docsite/e2e/playground-preview-isolation.spec.tsindex e3672a7b69..2c0891b5b5 100644--- a/apps/docsite/e2e/playground-preview-isolation.spec.ts+++ b/apps/docsite/e2e/playground-preview-isolation.spec.ts@@ -198,12 +198,19 @@ test.describe('playground preview isolation', () => {setTimeout(() => location.reload(), 0);});- // The playground notices the second load, tears the frame down and mounts- // a fresh one under a new nonce …+ // The detached-frame gap must not count as recovery: `null !== old URL`+ // was true before a replacement iframe had even been attached. Wait for a+ // live frame with a new trusted nonce, then for its current content below.await expect- .poll(() => previewFrame(page)?.url() ?? null, POLL)- .not.toBe(replacedUrl);- expect(currentPreviewFrame(page).url()).toContain(PREVIEW_URL_MARK);+ .poll(() => {+ const nextUrl = previewFrame(page)?.url();+ return Boolean(+ nextUrl &&+ nextUrl !== replacedUrl &&+ nextUrl.includes(PREVIEW_URL_MARK),+ );+ }, POLL)+ .toBe(true);// … and the new document renders the current code with the active theme// and mode, with no edit needed to wake it up.diff --git a/apps/sandbox/README.md b/apps/sandbox/README.mdindex 0a1ae6f20f..9b46394a69 100644--- a/apps/sandbox/README.md+++ b/apps/sandbox/README.md@@ -1,102 +1,41 @@-# /apps/sandbox+# Astryx Sandbox-Astryx component sandbox for designer exploration and vibe testing. Deployed alongside Storybook on every PR.+The component sandbox is an adapter-free Vite app. Its route manifest discovers authored page modules and the wrappers generated from the CLI template catalog. A production build prerenders each page and its route-group layout into a real `index.html` at **every** trailing-slash route, then hydrates it in the browser. Unknown routes have a static `404.html`, not an SPA catch-all.<!-- SYNC: When files in this directory change, update this document. -->-## Setup+## Setup and development-Before writing any code, install dependencies:--```bash-npm install-```--This automatically generates `AGENTS.md` with the Astryx component index via `astryx init --features agents`. **Read `AGENTS.md` for all Astryx component documentation**: it contains CLI commands to browse components, tokens, themes, and design rules.--If `AGENTS.md` is missing, regenerate it:--```bash-npx @astryxdesign/cli init --features agents-```--## How it works--The sandbox is a Next.js app configured for static export (`output: 'export'`). On PRs, the CI workflow builds it and deploys to GitHub Pages at a versioned URL:--```-https://facebook.github.io/astryx/{commit}/sandbox/-```--## Adding a new page--1. Create `src/app/pages/<name>/page.tsx`:--```tsx-'use client';--import {VStack, Heading, Text} from '@astryxdesign/core';--export default function MyPage() {- return (- <VStack gap={4}>- <Heading level={1}>My Page</Heading>- <Text type="body">Content here</Text>- </VStack>- );-}-```--2. Add an entry to the `pages` array in `src/app/Sidebar.tsx`--The page will appear in the sidebar and get its own URL in the PR deployment.--## Development--Three ways to run the sandbox locally, depending on what you're iterating on:--### Quick start (build once, then dev)+From the repository root, install dependencies with pnpm and build the workspace first:```bash+pnpm install+pnpm buildpnpm dev:sandbox```-Builds `@astryxdesign/core` once, then starts the sandbox. Edits to `packages/core/src/` require a manual rebuild (`pnpm build`). Good for working on sandbox pages themselves without touching core components.+`dev:sandbox` builds core once, runs Sandbox generators, and starts Vite. The `AGENTS.md` file is generated at postinstall by `astryx init --features agents` and contains the component-authoring guidance. For core source hot reload, use `pnpm dev:sandbox:source` (the `source` condition, without guaranteed theme layers); for compiled CSS layers and near-hot reload, run `pnpm -F @astryxdesign/core dev` in a second terminal alongside `pnpm -F @astryxdesign/sandbox dev`.-### Source mode (fast hot reload, no theming)+## Build and routes```bash-pnpm dev:sandbox:source+pnpm -F @astryxdesign/sandbox build+pnpm -F @astryxdesign/sandbox typecheck+pnpm -F @astryxdesign/sandbox test```-Resolves `@astryxdesign/core` from TypeScript source directly via the `"source"` exports condition. Edits to component source hot-reload instantly (~200ms). **Theming and CSS layers don't work** in this mode because the CSS `@layer` wrapping only exists in the built dist output. Use for layout and behavior iteration only.--### Watch mode (correct theming, near-hot-reload)+The build first runs `sync-templates`, changelog, CLI/foundation docs, XLE, score-ledger, motion-audit, and theme-family generators. The score-ledger generator attempts a public wiki snapshot with a five-second timeout; its browser page refreshes with a `no-store` fetch and falls back to that snapshot or TBD. No backend or credential is involved. Then Vite compiles StyleX with `@astryxdesign/build/vite`, `scripts/prerender.mjs` renders each page and layout into `out/`, and `scripts/verify-export.mjs` checks **every** page body, HTML route and asset against `scripts/next-export-routes.json` (the preserved Next 15 export oracle).-Run in two terminals:+Root-local development uses `/`. For staging under the docsite, run `SANDBOX_BASE_PATH=/sandbox pnpm -F @astryxdesign/sandbox build`; the emitted HTML, JS, CSS, template assets, tokenizer and navigation then use `/sandbox/`. `SANDBOX_TEMPLATE_ASSETS_BASE_PATH` can override the image location when a host requires it. This framework change does **not** move any production or PR deployment or modify Vercel configuration; current Pages links remain in place.-```bash-# Terminal 1: watch core for changes, rebuild dist incrementally-pnpm -F @astryxdesign/core dev--# Terminal 2: start sandbox (uses dist with correct CSS layers)-pnpm -F @astryxdesign/sandbox dev-```+### Adding a page-Edits trigger incremental dist rebuilds via Babel CLI (a few seconds), and CSS layer ordering is correct. Theming works properly.+Add `src/app/(sandbox)/pages/<slug>/page.tsx` for a sidebar-framed page, `(fullscreen)` for a template/preview shell, or `(raw)` for an unframed page. Add the navigation entry to `src/app/sandboxPages.ts` when the page belongs in the catalog. The route manifest discovers the page automatically. Generated template wrappers are owned by `scripts/sync-templates.js`, not hand-authored. When adding or intentionally removing a public deep link, review and update the checked `scripts/next-export-routes.json` route list along with the change; the contract test fails until the difference is accounted for.-## File manifest+## Key files-| File | Purpose |-| -------------------------- | ------------------------------------------------------------------------ |-| `package.json` | Dependencies; uses PostCSS path for StyleX |-| `babel.config.js` | StyleX babel plugin config (as plugin, not preset) |-| `postcss.config.js` | StyleX PostCSS plugin: extracts CSS from `@stylex;` directive |-| `next.config.mjs` | Static export, basePath for GitHub Pages, webpack alias for theme tokens |-| `tsconfig.json` | TypeScript config with workspace path aliases |-| `src/app/globals.css` | `@stylex;` injection point: PostCSS replaces this with extracted CSS |-| `src/app/providers.tsx` | Client-side theme provider wrapper |-| `src/app/layout.tsx` | Root layout with sidebar navigation |-| `src/app/Sidebar.tsx` | Sidebar navigation component |-| `src/app/page.tsx` | Home page |-| `src/app/pages/*/page.tsx` | Example sandbox pages |+- `vite.config.mts`, `src/main.tsx`, `src/route-entry.tsx`, `src/RouteView.tsx`, `src/entry-server.tsx`, `src/router.tsx`: prerendered routes, matching hydration, group layouts, navigation and base paths.+- `index.html`, `src/app/globals.css`, `src/app/layers.css`: metadata, fonts, global CSS and theme layers.+- `src/app/providers.tsx`: theme and mode state (including embed sync).+- `scripts/route-manifest.mjs`, `scripts/prerender.mjs`, `scripts/verify-export.mjs`, `src/route-manifest.test.ts`: exact-path export contract and 404 behavior.+- `src/generated/`, `src/app/(fullscreen)/templates/`, `public/template-assets/`: generated registries, wrappers and mirrored public images (ignored by git).diff --git a/apps/sandbox/babel.config.js b/apps/sandbox/babel.config.jsdeleted file mode 100644index 03175a37f2..0000000000--- a/apps/sandbox/babel.config.js+++ /dev/null@@ -1,22 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--/* global module, __dirname */-const path = require('node:path');-const {babel} = require('@astryxdesign/build');--// Use the dist build pattern: library files keep default 'x' prefix (matching-// the pre-built astryx.css), product files use 'p' prefix to avoid collisions.-const config = babel(path.resolve(__dirname, '../..'), {- libraryPrefix: 'x',- classNamePrefix: 'p',-});--// Template source stays portable with /template-assets/* URLs. Hosted sandbox-// builds rewrite only executable string literals to their deployed asset path;-// sourceRegistry's embedded code samples remain unchanged.-config.plugins.push([- path.resolve(__dirname, 'scripts/rewrite-template-asset-paths.cjs'),- {basePath: process.env.SANDBOX_TEMPLATE_ASSETS_BASE_PATH || ''},-]);--module.exports = config;diff --git a/apps/sandbox/css.d.ts b/apps/sandbox/css.d.tsindex 11740a9c39..35c441192e 100644--- a/apps/sandbox/css.d.ts+++ b/apps/sandbox/css.d.ts@@ -1,5 +1,4 @@// Copyright (c) Meta Platforms, Inc. and affiliates.-// TypeScript 6 requires type declarations for CSS side-effect imports.-// This must be in a separate file from next-env.d.ts (which Next.js regenerates).+// TypeScript requires a declaration for global CSS side-effect imports.declare module '*.css';diff --git a/apps/sandbox/index.html b/apps/sandbox/index.htmlnew file mode 100644index 0000000000..ec35087af2--- /dev/null+++ b/apps/sandbox/index.html@@ -0,0 +1,33 @@+<!-- Copyright (c) Meta Platforms, Inc. and affiliates. -->++<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <meta name="description" content="Astryx component testing sandbox" />+ <title>Astryx Sandbox</title>+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link+ rel="stylesheet"+ href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Fustat:wght@400;500;600;700&family=Manufacturing+Consent&family=Outfit:wght@400;500;600;700&family=Sarina&family=JetBrains+Mono:wght@400;500;600;700&display=swap" />+ <script>+ try {+ if (window.self !== window.top)+ document.documentElement.classList.add('astryx-embed');+ } catch (e) {+ document.documentElement.classList.add('astryx-embed');+ }+ </script>+ <style>+ html.astryx-embed [data-preview-shell] {+ display: none !important;+ }+ </style>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/main.tsx"></script>+ </body>+</html>diff --git a/apps/sandbox/next-env.d.ts b/apps/sandbox/next-env.d.tsdeleted file mode 100644index 830fb594ca..0000000000--- a/apps/sandbox/next-env.d.ts+++ /dev/null@@ -1,6 +0,0 @@-/// <reference types="next" />-/// <reference types="next/image-types/global" />-/// <reference path="./.next/types/routes.d.ts" />--// NOTE: This file should not be edited-// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.diff --git a/apps/sandbox/next.config.mjs b/apps/sandbox/next.config.mjsdeleted file mode 100644index c475b31bf9..0000000000--- a/apps/sandbox/next.config.mjs+++ /dev/null@@ -1,82 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--import {createRequire} from 'node:module';-import path from 'node:path';--import {withAstryx} from '@astryxdesign/build/next';--const require = createRequire(import.meta.url);--/**- * Locate lexical's built ESM entry for the alias below. `require.resolve`- * lands on the CJS entry inside dist/, so walk up to the package root rather- * than resolving `lexical/package.json` (not export-mapped). Returns null when- * lexical isn't installed so the alias is simply omitted.- */-function resolveLexicalDist() {- try {- let dir = path.dirname(require.resolve('lexical'));- while (path.basename(dir) !== 'lexical') {- dir = path.dirname(dir);- }- return path.join(dir, 'dist', 'Lexical.mjs');- } catch {- return null;- }-}--/** @type {import('next').NextConfig} */-const nextConfig = {- output: process.env.NODE_ENV === 'production' ? 'export' : undefined,- reactStrictMode: false,- trailingSlash: true,- basePath: process.env.SANDBOX_BASE_PATH || '',- env: {- NEXT_PUBLIC_BASE_PATH: process.env.SANDBOX_BASE_PATH || '',- },- images: {- unoptimized: true,- },- typescript: {- ignoreBuildErrors: false,- },- webpack(config, {dev}) {- // withAstryx resolves requests issued FROM @astryxdesign modules with the- // `source` condition so astryx packages build from TS source. lexical also- // ships a `source` export, so lab's bare runtime `import ... from- // 'lexical'` (RichTextEditor keyboard commands) would resolve to lexical's- // raw TS — whose `declare` class fields this app's Babel pipeline rejects.- // Pin bare `lexical` to its built ESM entry (an env-switching wrapper, so- // dev/prod selection is preserved). App-local on purpose: lab is a private- // package, so no external withAstryx consumer can hit this — the shared- // build package stays agnostic to non-core libraries.- // Scoped by issuer (same shape as withAstryx's source-condition rule) so- // only astryx-issued requests are pinned — everything else keeps normal- // export-map resolution (e.g. Lexical.node.mjs in the server bundle).- const lexicalDist = resolveLexicalDist();- if (lexicalDist != null) {- config.module = config.module || {};- config.module.rules = config.module.rules || [];- config.module.rules.unshift({- test: /[\\/]node_modules[\\/]@astryxdesign[\\/]/,- resolve: {alias: {lexical$: lexicalDist}},- });- }-- // Workarounds for Node v24+ where webpack's hashing/caching feeds- // `undefined` to Hash.update and crashes the dev server.- config.output = config.output || {};- // Use a Node-crypto JS hash instead of the bundled WASM xxhash64.- config.output.hashFunction = 'sha512';- if (dev) {- // Disable the persistent filesystem cache in dev — its async pack/unpack- // queue is the source of the recurring `Hash.update(undefined)` crash- // on Node 24+. Cold rebuilds are slightly slower, but the server stays- // alive across requests.- config.cache = false;- }- return config;- },-};--export default withAstryx(nextConfig);diff --git a/apps/sandbox/package.json b/apps/sandbox/package.jsonindex f0b40b7af8..2816d5bb17 100644--- a/apps/sandbox/package.json+++ b/apps/sandbox/package.json@@ -12,41 +12,43 @@"generate:xle": "node scripts/generate-xle-registry.mjs && node scripts/generate-xle-tokenizer.mjs","generate:scores": "node scripts/generate-score-ledger.mjs","generate": "node ../../scripts/sync-templates.js && pnpm generate:changelog && pnpm generate:cli && node scripts/generate-foundation-docs.mjs && pnpm generate:xle && pnpm generate:scores && pnpm generate:motion-audit && pnpm generate:theme-family",- "dev": "pnpm generate && (node ../../scripts/sync-templates.js --watch & next dev)",- "build": "pnpm generate && next build",- "start": "next start",+ "dev": "pnpm generate && (node ../../scripts/sync-templates.js --watch & vite)",+ "build": "pnpm generate && vite build && node scripts/prerender.mjs && node scripts/verify-export.mjs",+ "start": "vite preview",+ "typecheck": "tsc --noEmit","postinstall": "astryx init --features agents"},"dependencies": {- "@heroicons/react": "^2.2.0",- "@stylexjs/stylex": "catalog:","@astryxdesign/charts": "*","@astryxdesign/cli": "*","@astryxdesign/core": "*","@astryxdesign/lab": "*",- "@astryxdesign/theme-neutral": "*",+ "@astryxdesign/theme-butter": "*",+ "@astryxdesign/theme-chocolate": "*",+ "@astryxdesign/theme-gothic": "*","@astryxdesign/theme-matcha": "*",- "next": "^15.5.21",- "react": "^19.2.7",- "react-dom": "^19.2.7",- "recharts": "^3.9.2",+ "@astryxdesign/theme-neutral": "*","@astryxdesign/theme-stone": "*",- "@astryxdesign/theme-gothic": "*",- "@astryxdesign/theme-chocolate": "*","@astryxdesign/theme-y2k": "*",- "@astryxdesign/theme-butter": "*"+ "@heroicons/react": "^2.2.0",+ "@stylexjs/stylex": "catalog:",+ "react": "^19.2.7",+ "react-dom": "^19.2.7",+ "react-router-dom": "^7.18.4",+ "recharts": "^3.9.2"},"devDependencies": {- "@babel/preset-react": "catalog:",- "@babel/preset-typescript": "catalog:",+ "@astryxdesign/build": "*",+ "@babel/runtime": "^7.29.7","@stylexjs/babel-plugin": "catalog:",- "@stylexjs/postcss-plugin": "catalog:",+ "@stylexjs/unplugin": "^0.19.0","@types/node": "^25.9.3","@types/react": "^19.2.17","@types/react-dom": "^19.2.3",+ "@vitejs/plugin-react": "^5.2.0","commander": "^12.1.0","typescript": "^6.0.3",- "@astryxdesign/build": "*",+ "vite": "catalog:","vitest": "^4.1.9"}}diff --git a/apps/sandbox/postcss.config.js b/apps/sandbox/postcss.config.jsdeleted file mode 100644index 6303d2cde0..0000000000--- a/apps/sandbox/postcss.config.js+++ /dev/null@@ -1,16 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--/* global module, __dirname */-const path = require('node:path');-const {postcss} = require('@astryxdesign/build');--const rootDir = path.resolve(__dirname, '../..');--// Use 'p' prefix for product-level StyleX classes. Library styles come from-// the pre-built @astryxdesign/core/astryx.css (which uses 'x' prefix), so the PostCSS-// plugin only needs to handle product code here.-module.exports = postcss(rootDir, {- appDir: path.relative(rootDir, path.resolve(__dirname, 'src')),- extraInclude: ['packages/cli/assets/templates/**/*.{ts,tsx}'],- classNamePrefix: 'p',-});diff --git a/apps/sandbox/scripts/generate-foundation-docs.mjs b/apps/sandbox/scripts/generate-foundation-docs.mjsindex 4cd3d34af4..6fa244bab7 100644--- a/apps/sandbox/scripts/generate-foundation-docs.mjs+++ b/apps/sandbox/scripts/generate-foundation-docs.mjs@@ -1,12 +1,11 @@#!/usr/bin/env node// Copyright (c) Meta Platforms, Inc. and affiliates.-/*** Pre-generate resolved foundation docs as a JSON file for the sandbox.** The CLI docs API uses dynamic imports and filesystem operations that- * can't run in a webpack/Next.js client bundle. This script resolves+ * can't run in a browser bundle. This script resolves* token-refs at build time and writes a static JSON file.** Run: node apps/sandbox/scripts/generate-foundation-docs.mjs@@ -20,7 +19,14 @@ import {docs as docsApi} from '../../../packages/cli/api/docs/docs.mjs';const __dirname = dirname(fileURLToPath(import.meta.url));const OUTPUT = resolve(__dirname, '../src/generated/foundationDocs.json');-const TOPICS = ['color', 'spacing', 'typography', 'elevation', 'shape', 'motion'];+const TOPICS = [+ 'color',+ 'spacing',+ 'typography',+ 'elevation',+ 'shape',+ 'motion',+];async function main() {const result = {};diff --git a/apps/sandbox/scripts/generate-xle-tokenizer.mjs b/apps/sandbox/scripts/generate-xle-tokenizer.mjsindex c5ddca4df2..a41b1cef15 100644--- a/apps/sandbox/scripts/generate-xle-tokenizer.mjs+++ b/apps/sandbox/scripts/generate-xle-tokenizer.mjs@@ -4,13 +4,11 @@/*** Generates apps/sandbox/public/xle-tokenizer.mjs*- * The Layout DSL page counts tokens CLIENT-SIDE. Rather than bundle- * gpt-tokenizer through webpack (which hard-fails the whole build if the- * package isn't installed), we esbuild-bundle its o200k_base encoding into a- * single self-contained ESM module here, served from public/ and loaded via a- * `webpackIgnore` dynamic import. If esbuild or gpt-tokenizer are unavailable,- * we emit a heuristic module with the same export shape — so the sandbox- * always builds and the page always has a counter.+ * The Layout DSL page counts tokens CLIENT-SIDE. gpt-tokenizer is optional, so+ * a self-contained ESM module is generated under public/ rather than making the+ * Vite bundle depend on it. The browser imports that module by URL. If esbuild+ * or gpt-tokenizer is unavailable, a heuristic module with the same export+ * shape is written instead, so the page always has a counter.** Runs in the sandbox `generate` chain.*/@@ -53,7 +51,9 @@ try {`✓ xle-tokenizer.mjs: gpt-tokenizer o200k_base (${(out.length / 1024 / 1024).toFixed(1)} MB bundled)`,);} catch {- console.warn('xle-tokenizer.mjs: gpt-tokenizer/esbuild unavailable — wrote heuristic fallback');+ console.warn(+ 'xle-tokenizer.mjs: gpt-tokenizer/esbuild unavailable — wrote heuristic fallback',+ );}mkdirSync(dirname(OUT), {recursive: true});diff --git a/apps/sandbox/scripts/next-export-routes.json b/apps/sandbox/scripts/next-export-routes.jsonnew file mode 100644index 0000000000..38b4aaa876--- /dev/null+++ b/apps/sandbox/scripts/next-export-routes.json@@ -0,0 +1,774 @@+{+ "oracle": "Next.js 15 static export",+ "baseCommit": "34b4692a3a9aea6ce9a9a387a894830720518a02",+ "routes": [+ "/",+ "/404/",+ "/components-patterns/",+ "/pages/butter-palette/",+ "/pages/codeblock-perf/",+ "/pages/color-studio/",+ "/pages/component-scores/",+ "/pages/dictation-lab/",+ "/pages/doc-discover/",+ "/pages/doc-docs/",+ "/pages/doc-home/",+ "/pages/doc-preview/",+ "/pages/documentation/",+ "/pages/example-cards/",+ "/pages/example/",+ "/pages/gothic-palette/",+ "/pages/layout-dsl/",+ "/pages/markdown-perf/",+ "/pages/media-mode/",+ "/pages/mega-menu/",+ "/pages/mobile-prototypes/",+ "/pages/mobile-spacing/",+ "/pages/mobile-type/",+ "/pages/motion-examples/",+ "/pages/motion-lab/",+ "/pages/motion-lab/bugs/",+ "/pages/motion-lab/exit-gap/",+ "/pages/motion-lab/export/",+ "/pages/motion-lab/js-mirror/",+ "/pages/motion-lab/library/",+ "/pages/motion-lab/plan/",+ "/pages/motion-lab/preview-plan/",+ "/pages/motion-lab/previews/",+ "/pages/motion-lab/published/",+ "/pages/motion-lab/reduced-motion/",+ "/pages/motion-lab/rubric/",+ "/pages/motion-lab/springs/",+ "/pages/motion-lab/tokens/",+ "/pages/motion-lab/violations/",+ "/pages/navigation/",+ "/pages/neutral-palette/",+ "/pages/palette-generator/",+ "/pages/polymorphic-link/",+ "/pages/shell-lab/",+ "/pages/showcase-components/",+ "/pages/showcase-header/",+ "/pages/stone-palette/",+ "/pages/table-lab/",+ "/pages/table-overview/",+ "/pages/tap-targets/",+ "/pages/textarea-counter/",+ "/pages/theme-family/",+ "/pages/topnav-menu/",+ "/pages/y2k-palette/",+ "/templates/",+ "/templates/AlertDialogAsyncAction/",+ "/templates/AlertDialogDeleteConfirmation/",+ "/templates/AppShellContentOnly/",+ "/templates/AppShellMobileHookUsage/",+ "/templates/AppShellShowcase/",+ "/templates/AppShellSideNavOnly/",+ "/templates/AppShellTopNavOnly/",+ "/templates/AppShellTopNavWithSideNav/",+ "/templates/AppShellWithBanner/",+ "/templates/AspectRatioCircleImage/",+ "/templates/AspectRatioImageGallery/",+ "/templates/AspectRatioShowcase/",+ "/templates/AspectRatioSquareImage/",+ "/templates/AspectRatioWidescreen/",+ "/templates/AspectRatioWithSkeleton/",+ "/templates/AvatarFallbackChain/",+ "/templates/AvatarGroup/",+ "/templates/AvatarGroupInteractive/",+ "/templates/AvatarGroupOverflowCustomText/",+ "/templates/AvatarGroupOverflowDefault/",+ "/templates/AvatarGroupOverflowShowcase/",+ "/templates/AvatarGroupShowcase/",+ "/templates/AvatarInitialsFallback/",+ "/templates/AvatarInteractive/",+ "/templates/AvatarShowcase/",+ "/templates/AvatarStatusDotShowcase/",+ "/templates/AvatarStatusDotVariants/",+ "/templates/AvatarTooltip/",+ "/templates/AvatarUserCard/",+ "/templates/AvatarWithImage/",+ "/templates/AvatarWithStatus/",+ "/templates/BadgeCategoryTags/",+ "/templates/BadgeCountBadges/",+ "/templates/BadgeShowcase/",+ "/templates/BadgeStatusLabels/",+ "/templates/BannerCollapsibleContent/",+ "/templates/BannerDismissable/",+ "/templates/BannerFloating/",+ "/templates/BannerSectionVariant/",+ "/templates/BannerShowcase/",+ "/templates/BannerStatuses/",+ "/templates/BannerWithActionButton/",+ "/templates/BaseTypeaheadCustomSearch/",+ "/templates/BaseTypeaheadShowcase/",+ "/templates/BlockquoteShowcase/",+ "/templates/BlockquoteTestimonials/",+ "/templates/BlockquoteWithCite/",+ "/templates/BottomSheetHeights/",+ "/templates/BottomSheetMobileKeyboard/",+ "/templates/BottomSheetNoScrim/",+ "/templates/BottomSheetShowcase/",+ "/templates/BottomSheetSnapPoints/",+ "/templates/BottomSheetSwitcherReviewFlow/",+ "/templates/BottomSheetSwitcherShowcase/",+ "/templates/BreadcrumbItemBasic/",+ "/templates/BreadcrumbItemShowcase/",+ "/templates/BreadcrumbsCustomSeparator/",+ "/templates/BreadcrumbsDeepHierarchy/",+ "/templates/BreadcrumbsMenuItem/",+ "/templates/BreadcrumbsShowcase/",+ "/templates/BreadcrumbsSupportingVariant/",+ "/templates/BreadcrumbsWithIcons/",+ "/templates/ButtonFloating/",+ "/templates/ButtonGroupBasic/",+ "/templates/ButtonGroupFloating/",+ "/templates/ButtonGroupShowcase/",+ "/templates/ButtonShowcase/",+ "/templates/ButtonSizeVariants/",+ "/templates/ButtonVariants/",+ "/templates/ButtonWithEndSlot/",+ "/templates/ButtonWithIcon/",+ "/templates/CalendarConstraints/",+ "/templates/CalendarRangeWithValue/",+ "/templates/CalendarShowcase/",+ "/templates/CalendarSingle/",+ "/templates/CalendarTwoMonths/",+ "/templates/CardCallout/",+ "/templates/CardElevations/",+ "/templates/CardShowcase/",+ "/templates/CardVariants/",+ "/templates/CardWithInnerLayout/",+ "/templates/CardWithSimpleContent/",+ "/templates/CarouselCards/",+ "/templates/CarouselShowcase/",+ "/templates/CarouselSnap/",+ "/templates/CenterHorizontal/",+ "/templates/CenterInsideACard/",+ "/templates/CenterShowcase/",+ "/templates/ChatComposerAttachments/",+ "/templates/ChatComposerDrawerAttachments/",+ "/templates/ChatComposerDrawerCollapsible/",+ "/templates/ChatComposerDrawerFeedback/",+ "/templates/ChatComposerDrawerShowcase/",+ "/templates/ChatComposerDrawerWithProgress/",+ "/templates/ChatComposerFlat/",+ "/templates/ChatComposerFooterActions/",+ "/templates/ChatComposerFullFeatured/",+ "/templates/ChatComposerInputControlledInput/",+ "/templates/ChatComposerInputDisabled/",+ "/templates/ChatComposerInputMentionTrigger/",+ "/templates/ChatComposerInputMultipleTriggers/",+ "/templates/ChatComposerInputShowcase/",+ "/templates/ChatComposerInputSlashCommands/",+ "/templates/ChatComposerShowcase/",+ "/templates/ChatComposerSimple/",+ "/templates/ChatComposerStreaming/",+ "/templates/ChatComposerValidation/",+ "/templates/ChatDictationButtonBasic/",+ "/templates/ChatDictationButtonShowcase/",+ "/templates/ChatDictationDictationInComposer/",+ "/templates/ChatDictationDictationStates/",+ "/templates/ChatDictationSizes/",+ "/templates/ChatLayoutPanelChat/",+ "/templates/ChatLayoutScrollButtonLabels/",+ "/templates/ChatLayoutScrollButtonStates/",+ "/templates/ChatLayoutShowcase/",+ "/templates/ChatMessageAvatarName/",+ "/templates/ChatMessageBubbleCustomContent/",+ "/templates/ChatMessageBubbleDensity/",+ "/templates/ChatMessageBubbleGrouping/",+ "/templates/ChatMessageBubbleMetadata/",+ "/templates/ChatMessageBubbleShowcase/",+ "/templates/ChatMessageBubbleVariants/",+ "/templates/ChatMessageGhost/",+ "/templates/ChatMessageListDensity/",+ "/templates/ChatMessageListFullFeatured/",+ "/templates/ChatMessageListShowcase/",+ "/templates/ChatMessageMetadataFooter/",+ "/templates/ChatMessageMetadataShowcase/",+ "/templates/ChatMessageMetadataStatus/",+ "/templates/ChatMessageMetadataTimestamp/",+ "/templates/ChatMessageMultiBubble/",+ "/templates/ChatMessageShowcase/",+ "/templates/ChatSendButtonCustomIcon/",+ "/templates/ChatSendButtonInComposer/",+ "/templates/ChatSendButtonShowcase/",+ "/templates/ChatSendButtonStates/",+ "/templates/ChatSystemMessageShowcase/",+ "/templates/ChatSystemMessageStatusUpdates/",+ "/templates/ChatSystemMessageVariants/",+ "/templates/ChatSystemMessageWithIcon/",+ "/templates/ChatTokenizedTextBasic/",+ "/templates/ChatTokenizedTextColors/",+ "/templates/ChatTokenizedTextShowcase/",+ "/templates/ChatToolCallsInteractiveToolCalls/",+ "/templates/ChatToolCallsShowcase/",+ "/templates/ChatToolCallsStatuses/",+ "/templates/ChatToolCallsToolCallsWithNodes/",+ "/templates/CheckboxInputBasic/",+ "/templates/CheckboxInputIndeterminateState/",+ "/templates/CheckboxInputShowcase/",+ "/templates/CheckboxInputStatusVariations/",+ "/templates/CheckboxListItemBasic/",+ "/templates/CheckboxListItemShowcase/",+ "/templates/CheckboxListSelectAllPattern/",+ "/templates/CheckboxListShowcase/",+ "/templates/CheckboxListWithEndContent/",+ "/templates/CitationInlineText/",+ "/templates/CitationShowcase/",+ "/templates/CitationSourceList/",+ "/templates/ClickableCardElevated/",+ "/templates/ClickableCardShowcase/",+ "/templates/ClickableCardWithNestedButton/",+ "/templates/CodeAcrossTextSizes/",+ "/templates/CodeBlockBashCommand/",+ "/templates/CodeBlockHighlightedLines/",+ "/templates/CodeBlockJSONConfig/",+ "/templates/CodeBlockScrollableBlock/",+ "/templates/CodeBlockShowcase/",+ "/templates/CodeBlockTerminal/",+ "/templates/CodeInlineInParagraph/",+ "/templates/CodeShowcase/",+ "/templates/CodeVariousContent/",+ "/templates/CollapsibleControlledAccordion/",+ "/templates/CollapsibleDividedAccordion/",+ "/templates/CollapsibleGroupAccordion/",+ "/templates/CollapsibleGroupShowcase/",+ "/templates/CollapsibleHookUsage/",+ "/templates/CollapsibleMultipleAccordion/",+ "/templates/CollapsibleShowcase/",+ "/templates/CollapsibleSingleAccordion/",+ "/templates/CollapsibleWithoutCard/",+ "/templates/ColumnResizeHookUsage/",+ "/templates/CommandPaletteAsyncSearch/",+ "/templates/CommandPaletteAutoGrouped/",+ "/templates/CommandPaletteCustomFooter/",+ "/templates/CommandPaletteEmptyBasic/",+ "/templates/CommandPaletteEmptyShowcase/",+ "/templates/CommandPaletteFooterBasic/",+ "/templates/CommandPaletteFooterShowcase/",+ "/templates/CommandPaletteGroupBasic/",+ "/templates/CommandPaletteGroupShowcase/",+ "/templates/CommandPaletteInputBasic/",+ "/templates/CommandPaletteInputShowcase/",+ "/templates/CommandPaletteItemBasic/",+ "/templates/CommandPaletteItemShowcase/",+ "/templates/CommandPaletteListBasic/",+ "/templates/CommandPaletteListShowcase/",+ "/templates/CommandPalettePickerMode/",+ "/templates/CommandPaletteRichItems/",+ "/templates/CommandPaletteShowcase/",+ "/templates/ComplexSelectorDeadlinePicker/",+ "/templates/ComplexSelectorShowcase/",+ "/templates/ComplexSelectorTreeSearch/",+ "/templates/ContextMenuBasic/",+ "/templates/ContextMenuBottomSheet/",+ "/templates/ContextMenuItemBasic/",+ "/templates/ContextMenuItemShowcase/",+ "/templates/ContextMenuShowcase/",+ "/templates/DateInputClearable/",+ "/templates/DateInputDateRange/",+ "/templates/DateInputFormats/",+ "/templates/DateInputShowcase/",+ "/templates/DateInputWithDescription/",+ "/templates/DateInputWithValidation/",+ "/templates/DateRangeInputShowcase/",+ "/templates/DateRangeInputWithPresets/",+ "/templates/DateRangeInputWithValidation/",+ "/templates/DateTimeInputShowcase/",+ "/templates/DateTimeInputWithValidation/",+ "/templates/DialogAdaptivePresentation/",+ "/templates/DialogConfirmationDialog/",+ "/templates/DialogFormDialog/",+ "/templates/DialogFullscreenDialog/",+ "/templates/DialogHeaderBasic/",+ "/templates/DialogHeaderShowcase/",+ "/templates/DialogScrollingContent/",+ "/templates/DialogShowcase/",+ "/templates/DialogWithSubtitle/",+ "/templates/DividerFullBleed/",+ "/templates/DividerShowcase/",+ "/templates/DividerVariants/",+ "/templates/DividerVertical/",+ "/templates/DropdownMenuActions/",+ "/templates/DropdownMenuBottomSheet/",+ "/templates/DropdownMenuItemBasic/",+ "/templates/DropdownMenuItemShowcase/",+ "/templates/DropdownMenuNoChevron/",+ "/templates/DropdownMenuShowcase/",+ "/templates/DropdownMenuWithDisabledItems/",+ "/templates/DropdownMenuWithSections/",+ "/templates/DropdownMenuWithSubmenu/",+ "/templates/EmptyStateActions/",+ "/templates/EmptyStateCompact/",+ "/templates/EmptyStateContainer/",+ "/templates/EmptyStateShowcase/",+ "/templates/FieldLabelBasic/",+ "/templates/FieldLabelShowcase/",+ "/templates/FieldRequired/",+ "/templates/FieldShowcase/",+ "/templates/FieldStatusBasic/",+ "/templates/FieldStatusShowcase/",+ "/templates/FieldStatusVariants/",+ "/templates/FieldWithDescription/",+ "/templates/FileInputBasic/",+ "/templates/FileInputShowcase/",+ "/templates/FormLayoutHorizontal/",+ "/templates/FormLayoutHorizontalLabels/",+ "/templates/FormLayoutMixedControls/",+ "/templates/FormLayoutNested/",+ "/templates/FormLayoutShowcase/",+ "/templates/GridDashboardLayout/",+ "/templates/GridGalleryExample/",+ "/templates/GridResponsiveAutoFit/",+ "/templates/GridShowcase/",+ "/templates/GridSpanColumns/",+ "/templates/GridSpanShowcase/",+ "/templates/GridWithGridSpan/",+ "/templates/HStackBasic/",+ "/templates/HStackShowcase/",+ "/templates/HeadingCardGrid/",+ "/templates/HeadingPageLayout/",+ "/templates/HeadingShowcase/",+ "/templates/HeadingTruncation/",+ "/templates/HoverCardHookUsage/",+ "/templates/HoverCardInlineTextHoverCard/",+ "/templates/HoverCardInteractiveContent/",+ "/templates/HoverCardProfileHoverCard/",+ "/templates/HoverCardShowcase/",+ "/templates/IconButtonActionBar/",+ "/templates/IconButtonFloating/",+ "/templates/IconButtonLoadingToggle/",+ "/templates/IconButtonShowcase/",+ "/templates/IconButtonTooltipIconButton/",+ "/templates/IconNonSemanticColors/",+ "/templates/IconSemanticColors/",+ "/templates/IconShowcase/",+ "/templates/IconSizes/",+ "/templates/IconStatusIcons/",+ "/templates/InputGroupBasic/",+ "/templates/InputGroupShowcase/",+ "/templates/InternationalizationProvider01ShippedLocale/",+ "/templates/InternationalizationProvider02Overrides/",+ "/templates/InternationalizationProvider03RtlDirection/",+ "/templates/ItemBasicItem/",+ "/templates/ItemShowcase/",+ "/templates/ItemWithMedia/",+ "/templates/ItemWithMetadata/",+ "/templates/KbdInlineInstructions/",+ "/templates/KbdMenuShortcuts/",+ "/templates/KbdModifierCombos/",+ "/templates/KbdShowcase/",+ "/templates/LayerHookUsage/",+ "/templates/LayoutBasicCardLayout/",+ "/templates/LayoutContentBasic/",+ "/templates/LayoutContentOnlyLayout/",+ "/templates/LayoutContentShowcase/",+ "/templates/LayoutContentWidth/",+ "/templates/LayoutDualPanelLayout/",+ "/templates/LayoutFooterActions/",+ "/templates/LayoutFooterShowcase/",+ "/templates/LayoutFullBleedContent/",+ "/templates/LayoutHeaderShowcase/",+ "/templates/LayoutHeaderWithActions/",+ "/templates/LayoutPanelNavigation/",+ "/templates/LayoutPanelShowcase/",+ "/templates/LayoutShowcase/",+ "/templates/LayoutSidebarLayout/",+ "/templates/LightboxGallery/",+ "/templates/LightboxShowcase/",+ "/templates/LightboxVideo/",+ "/templates/LightboxZoom/",+ "/templates/LinkExternalLinks/",+ "/templates/LinkInlineLink/",+ "/templates/LinkProviderCustomLink/",+ "/templates/LinkShowcase/",+ "/templates/LinksWithTooltips/",+ "/templates/ListBasicList/",+ "/templates/ListBulletedFeatures/",+ "/templates/ListItemBasicItem/",+ "/templates/ListItemShowcase/",+ "/templates/ListItemWithMedia/",+ "/templates/ListItemWithMetadata/",+ "/templates/ListMessageList/",+ "/templates/ListOrderedSteps/",+ "/templates/ListShowcase/",+ "/templates/MarkdownCitedContent/",+ "/templates/MarkdownCompactAIResponse/",+ "/templates/MarkdownDataTable/",+ "/templates/MarkdownRichContent/",+ "/templates/MarkdownShowcase/",+ "/templates/MediaThemeImageOverlay/",+ "/templates/MediaThemeLightScrim/",+ "/templates/MediaThemeShowcase/",+ "/templates/MetadataListBasicMetadata/",+ "/templates/MetadataListCollapsibleMetadata/",+ "/templates/MetadataListHorizontalMetadata/",+ "/templates/MetadataListItemBasic/",+ "/templates/MetadataListItemShowcase/",+ "/templates/MetadataListMultiColumnMetadata/",+ "/templates/MetadataListShowcase/",+ "/templates/MobileNavBasicMobileNav/",+ "/templates/MobileNavEndSideMobileNav/",+ "/templates/MobileNavShowcase/",+ "/templates/MobileNavToggleBasic/",+ "/templates/MobileNavToggleShowcase/",+ "/templates/MobileNavWithoutTitleMobileNav/",+ "/templates/MoreMenuBottomSheet/",+ "/templates/MoreMenuDefaultMoreMenu/",+ "/templates/MoreMenuShowcase/",+ "/templates/MoreMenuWithDividers/",+ "/templates/MoreMenuWithSections/",+ "/templates/MultiSelectorBottomSheet/",+ "/templates/MultiSelectorColumnVisibilitySelector/",+ "/templates/MultiSelectorForm/",+ "/templates/MultiSelectorGhostToolbar/",+ "/templates/MultiSelectorSearchableMultiSelector/",+ "/templates/MultiSelectorSectionedMultiSelector/",+ "/templates/MultiSelectorShowcase/",+ "/templates/NavHeadingMenuShowcase/",+ "/templates/NavIconBasic/",+ "/templates/NavIconShowcase/",+ "/templates/NumberInputClearableNumberInput/",+ "/templates/NumberInputRangeNumberInput/",+ "/templates/NumberInputShowcase/",+ "/templates/NumberInputStatuses/",+ "/templates/NumberInputWithUnits/",+ "/templates/OutlineControlled/",+ "/templates/OutlineDeepNesting/",+ "/templates/OutlineDensity/",+ "/templates/OutlineShowcase/",+ "/templates/OverflowListCappedToolbar/",+ "/templates/OverflowListCollapseFromStartList/",+ "/templates/OverflowListMultiRowTags/",+ "/templates/OverflowListOverflowBadges/",+ "/templates/OverflowListOverflowDropdownActions/",+ "/templates/OverflowListShowcase/",+ "/templates/OverlayBottomStrip/",+ "/templates/OverlayHoverReveal/",+ "/templates/OverlayShowcase/",+ "/templates/PaginationDotsCarousel/",+ "/templates/PaginationPageSize/",+ "/templates/PaginationVariants/",+ "/templates/PaginationWithTable/",+ "/templates/PopoverBottomSheetAlternative/",+ "/templates/PopoverConfirmAction/",+ "/templates/PopoverFilterPanel/",+ "/templates/PopoverHookUsage/",+ "/templates/PopoverKeyboardShortcuts/",+ "/templates/PopoverSettingsPanel/",+ "/templates/PopoverShowcase/",+ "/templates/PowerSearchContentSearch/",+ "/templates/PowerSearchFullFeatured/",+ "/templates/PowerSearchPresetFilters/",+ "/templates/PowerSearchSearchWithTable/",+ "/templates/PowerSearchShowcase/",+ "/templates/ProgressBarCustomFormat/",+ "/templates/ProgressBarIndeterminate/",+ "/templates/ProgressBarSemanticVariants/",+ "/templates/ProgressBarShowcase/",+ "/templates/ProgressBarWithValueLabel/",+ "/templates/RadioListHorizontalLayout/",+ "/templates/RadioListItemBasic/",+ "/templates/RadioListItemShowcase/",+ "/templates/RadioListPricingTier/",+ "/templates/RadioListShowcase/",+ "/templates/RadioListWithDescriptions/",+ "/templates/RadioListWithValidation/",+ "/templates/ResizableShowcase/",+ "/templates/ResizableSidebar/",+ "/templates/ScrollableAreaInlineRail/",+ "/templates/ScrollableAreaOverscrollChaining/",+ "/templates/ScrollableAreaShowcase/",+ "/templates/ScrollableAreaStickyGroupHeaders/",+ "/templates/ScrollableAreaStickyPassthrough/",+ "/templates/ScrollableAreaTwoAxisBoard/",+ "/templates/SectionVariants/",+ "/templates/SectionWashHighlight/",+ "/templates/SectionWithDividers/",+ "/templates/SegmentedControlDisabledItem/",+ "/templates/SegmentedControlFillLayout/",+ "/templates/SegmentedControlIconOnly/",+ "/templates/SegmentedControlItemBasic/",+ "/templates/SegmentedControlItemShowcase/",+ "/templates/SegmentedControlShowcase/",+ "/templates/SegmentedControlWithIcons/",+ "/templates/SelectableCardElevated/",+ "/templates/SelectableCardMulti/",+ "/templates/SelectableCardShowcase/",+ "/templates/SelectorBottomSheet/",+ "/templates/SelectorClearable/",+ "/templates/SelectorGhostToolbar/",+ "/templates/SelectorOptionBasic/",+ "/templates/SelectorOptionDescriptions/",+ "/templates/SelectorOptionShowcase/",+ "/templates/SelectorShowcase/",+ "/templates/SelectorWithSections/",+ "/templates/SelectorWithStatus/",+ "/templates/SideNavCollapseButtonBasic/",+ "/templates/SideNavCollapseButtonShowcase/",+ "/templates/SideNavEndContent/",+ "/templates/SideNavHeadingBasic/",+ "/templates/SideNavHeadingShowcase/",+ "/templates/SideNavItemBasic/",+ "/templates/SideNavItemShowcase/",+ "/templates/SideNavNestedItems/",+ "/templates/SideNavSectionBasic/",+ "/templates/SideNavSectionShowcase/",+ "/templates/SideNavShowcase/",+ "/templates/SideNavWithHeaderMenu/",+ "/templates/SkeletonCardSkeleton/",+ "/templates/SkeletonShowcase/",+ "/templates/SkeletonStaggeredList/",+ "/templates/SkeletonTableRowSkeleton/",+ "/templates/SliderFormattedValue/",+ "/templates/SliderRangeSlider/",+ "/templates/SliderShowcase/",+ "/templates/SliderWithMarks/",+ "/templates/SliderWithStatus/",+ "/templates/SpinnerOnMedia/",+ "/templates/SpinnerShowcase/",+ "/templates/SpinnerSizes/",+ "/templates/SpinnerWithLabel/",+ "/templates/StackAlignment/",+ "/templates/StackDirections/",+ "/templates/StackFillItem/",+ "/templates/StackItemFill/",+ "/templates/StackItemShowcase/",+ "/templates/StatusDotPulsing/",+ "/templates/StatusDotShowcase/",+ "/templates/StatusDotStatusIndicators/",+ "/templates/StatusDotVariants/",+ "/templates/StepContent/",+ "/templates/StepIndicator/",+ "/templates/StepShowcase/",+ "/templates/StepStates/",+ "/templates/StepperCustomContent/",+ "/templates/StepperIndicatorModes/",+ "/templates/StepperOnTrackHorizontal/",+ "/templates/StepperOnTrackVertical/",+ "/templates/StepperShowcase/",+ "/templates/StepperStatus/",+ "/templates/StepperWidthResponsiveCollapse/",+ "/templates/StickyColumnsHookUsage/",+ "/templates/SwitchDisabled/",+ "/templates/SwitchSettingsPanel/",+ "/templates/SwitchShowcase/",+ "/templates/SwitchWithDescription/",+ "/templates/SwitchWithStatus/",+ "/templates/SyntaxThemeDarkPreset/",+ "/templates/SyntaxThemeLightPreset/",+ "/templates/SyntaxThemeShowcase/",+ "/templates/TabListShowcase/",+ "/templates/TabListTabsFillLayout/",+ "/templates/TabListTabsWithActions/",+ "/templates/TabListTabsWithBadge/",+ "/templates/TabListTabsWithIcons/",+ "/templates/TabListTabsWithMenu/",+ "/templates/TabListTabsWithStatusDot/",+ "/templates/TabMenuBasic/",+ "/templates/TabMenuShowcase/",+ "/templates/TabShowcase/",+ "/templates/TabWithSelectedIcon/",+ "/templates/TableColumnSettingsTable/",+ "/templates/TableFilterableTable/",+ "/templates/TableGridDividersTable/",+ "/templates/TableGroupedRowsTable/",+ "/templates/TableInCard/",+ "/templates/TableInlineFilterTable/",+ "/templates/TablePaginatedTable/",+ "/templates/TableResizableTable/",+ "/templates/TableRichCellTable/",+ "/templates/TableRowExpansionTable/",+ "/templates/TableRowIndexTable/",+ "/templates/TableRowStatusTable/",+ "/templates/TableSelectableTable/",+ "/templates/TableShowcase/",+ "/templates/TableSortableTable/",+ "/templates/TableStripedTable/",+ "/templates/TableTreeTable/",+ "/templates/TextAreaCharacterCount/",+ "/templates/TextAreaShowcase/",+ "/templates/TextAreaStates/",+ "/templates/TextAreaValidation/",+ "/templates/TextAreaWithIcon/",+ "/templates/TextColors/",+ "/templates/TextHeadingLevels/",+ "/templates/TextInline/",+ "/templates/TextInputIcon/",+ "/templates/TextInputSearch/",+ "/templates/TextInputShowcase/",+ "/templates/TextInputSizes/",+ "/templates/TextInputStates/",+ "/templates/TextInputStatusVariant/",+ "/templates/TextInputTypes/",+ "/templates/TextShowcase/",+ "/templates/TextTruncation/",+ "/templates/TextTypes/",+ "/templates/TextWeight/",+ "/templates/TextWordBreak/",+ "/templates/TextWrap/",+ "/templates/ThemeApply/",+ "/templates/ThemeNested/",+ "/templates/ThemeShowcase/",+ "/templates/ThemeSwitcher/",+ "/templates/ThumbnailDisabled/",+ "/templates/ThumbnailGallery/",+ "/templates/ThumbnailRemovable/",+ "/templates/ThumbnailShowcase/",+ "/templates/ThumbnailStates/",+ "/templates/TimeInputConstrained/",+ "/templates/TimeInputFormats/",+ "/templates/TimeInputIncrement/",+ "/templates/TimeInputShowcase/",+ "/templates/TimeInputStates/",+ "/templates/TimerFormats/",+ "/templates/TimerInline/",+ "/templates/TimerShowcase/",+ "/templates/TimerTypography/",+ "/templates/TimestampAutoFormat/",+ "/templates/TimestampColors/",+ "/templates/TimestampFormats/",+ "/templates/TimestampRelativeFormat/",+ "/templates/TimestampShowcase/",+ "/templates/TimestampTimezone/",+ "/templates/TimestampTooltipTimezones/",+ "/templates/ToastAction/",+ "/templates/ToastDeduplication/",+ "/templates/ToastDismiss/",+ "/templates/ToastShowcase/",+ "/templates/ToastStacking/",+ "/templates/ToastTypes/",+ "/templates/ToggleButtonColor/",+ "/templates/ToggleButtonGroup/",+ "/templates/ToggleButtonGroupShowcase/",+ "/templates/ToggleButtonGroupVertical/",+ "/templates/ToggleButtonIconSwap/",+ "/templates/ToggleButtonLabel/",+ "/templates/ToggleButtonShowcase/",+ "/templates/ToggleButtonStates/",+ "/templates/TokenClickable/",+ "/templates/TokenColors/",+ "/templates/TokenEndContent/",+ "/templates/TokenIcon/",+ "/templates/TokenRemovable/",+ "/templates/TokenShowcase/",+ "/templates/TokenizerClear/",+ "/templates/TokenizerCreatable/",+ "/templates/TokenizerEndContent/",+ "/templates/TokenizerIcon/",+ "/templates/TokenizerMaxEntries/",+ "/templates/TokenizerOverflow/",+ "/templates/TokenizerShowcase/",+ "/templates/TokenizerStates/",+ "/templates/ToolbarBulkActions/",+ "/templates/ToolbarCardHeader/",+ "/templates/ToolbarSizes/",+ "/templates/ToolbarTableFilter/",+ "/templates/ToolbarThreeSlot/",+ "/templates/ToolbarWithTabs/",+ "/templates/TooltipActionBarTooltips/",+ "/templates/TooltipHookUsage/",+ "/templates/TooltipInlineTextTooltips/",+ "/templates/TooltipShowcase/",+ "/templates/TopNavCenteredNavigation/",+ "/templates/TopNavEnterpriseDashboard/",+ "/templates/TopNavHeadingBasic/",+ "/templates/TopNavHeadingShowcase/",+ "/templates/TopNavHoverMenu/",+ "/templates/TopNavItemBasic/",+ "/templates/TopNavItemShowcase/",+ "/templates/TopNavMegaMenu/",+ "/templates/TopNavMegaMenuBasic/",+ "/templates/TopNavMegaMenuFeaturedCardBasic/",+ "/templates/TopNavMegaMenuFeaturedCardShowcase/",+ "/templates/TopNavMegaMenuItemBasic/",+ "/templates/TopNavMegaMenuItemShowcase/",+ "/templates/TopNavMegaMenuShowcase/",+ "/templates/TopNavMenuBasic/",+ "/templates/TopNavMenuShowcase/",+ "/templates/TopNavMultipleDropdowns/",+ "/templates/TopNavShowcase/",+ "/templates/TopNavWithLogo/",+ "/templates/TreeListFileTreeWithIcons/",+ "/templates/TreeListInteractiveSettings/",+ "/templates/TreeListMailboxTree/",+ "/templates/TreeListNavigationTree/",+ "/templates/TreeListShowcase/",+ "/templates/TreeListVariants/",+ "/templates/TypeaheadItemBasic/",+ "/templates/TypeaheadItemShowcase/",+ "/templates/TypeaheadLimitedResults/",+ "/templates/TypeaheadSearchField/",+ "/templates/TypeaheadShowcase/",+ "/templates/TypeaheadWithHelperText/",+ "/templates/TypeaheadWithValidation/",+ "/templates/VStackBasic/",+ "/templates/VStackShowcase/",+ "/templates/VisuallyHiddenLiveRegion/",+ "/templates/VisuallyHiddenShowcase/",+ "/templates/VisuallyHiddenStructuralHeading/",+ "/templates/VisuallyHiddenSupplementaryContext/",+ "/templates/ai-chat-landing/",+ "/templates/ai-chat/",+ "/templates/blank/",+ "/templates/canvas-editor/",+ "/templates/centered-hero/",+ "/templates/checkout-wizard/",+ "/templates/classic-gallery/",+ "/templates/contact-form/",+ "/templates/dashboard-alert-rail/",+ "/templates/dashboard-cohort-funnel/",+ "/templates/dashboard-comparison/",+ "/templates/dashboard-composition/",+ "/templates/dashboard-progress/",+ "/templates/dashboard-scorecard/",+ "/templates/dashboard/",+ "/templates/detail-page/",+ "/templates/documentation-design/",+ "/templates/documentation-technical/",+ "/templates/documentation/",+ "/templates/editor/",+ "/templates/file-explorer/",+ "/templates/form-two-column/",+ "/templates/form-wizard-dialog/",+ "/templates/form-wizard-inline/",+ "/templates/form-wizard-vertical/",+ "/templates/form-wizard/",+ "/templates/gallery-hero/",+ "/templates/ide/",+ "/templates/incident-console/",+ "/templates/kanban-board/",+ "/templates/library/",+ "/templates/login-card/",+ "/templates/login-split/",+ "/templates/login-sso/",+ "/templates/login/",+ "/templates/messaging-shell/",+ "/templates/mixed-gallery/",+ "/templates/payment-form/",+ "/templates/product-detail/",+ "/templates/product-gallery/",+ "/templates/settings-dialog/",+ "/templates/settings-sidebar/",+ "/templates/settings/",+ "/templates/shell-nav/",+ "/templates/shell-side-nav/",+ "/templates/shell-top-nav/",+ "/templates/side-gallery/",+ "/templates/table-filter/",+ "/templates/table-grouped/",+ "/templates/table-inbox/",+ "/templates/table-page/",+ "/templates/table-tree/",+ "/templates/table/",+ "/templates/theme-showcase/",+ "/templates/useContainerRevealHookUsage/",+ "/templates/useKeyboardHintHookUsage/",+ "/templates/useStreamingTextHookUsage/",+ "/templates/useThemeHookUsage/",+ "/templates/work-item-detail/",+ "/themes/",+ "/tools/"+ ]+}diff --git a/apps/sandbox/scripts/prerender.mjs b/apps/sandbox/scripts/prerender.mjsnew file mode 100644index 0000000000..3d6baab167--- /dev/null+++ b/apps/sandbox/scripts/prerender.mjs@@ -0,0 +1,102 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Prerender every exported Sandbox route into its physical HTML file.+ * @input Vite client build, generated route modules, checked Next path contract.+ * @output Visible route-specific content before JS, hydratable by src/main.tsx.+ * @position Build-time static generation; no server runs in deployment.+ */++import fs from 'node:fs';+import path from 'node:path';+import {fileURLToPath} from 'node:url';++// The SSR transform must use the production StyleX class names used by the+// already built browser bundle. Set this before loading the Vite config.+process.env.NODE_ENV = 'production';+const {createServer} = await import('vite');+const appDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const out = path.join(appDir, 'out');+const index = fs.readFileSync(path.join(out, 'index.html'), 'utf8');+const marker = '<div id="root"></div>';+if (!index.includes(marker))+ throw new Error('Vite index is missing the hydration root');+const {routes} = JSON.parse(+ fs.readFileSync(path.join(appDir, 'scripts/next-export-routes.json'), 'utf8'),+);+const sample = process.argv.find(arg => arg.startsWith('--sample='))?.slice(9);+const basePath = (process.env.SANDBOX_BASE_PATH || '').replace(/\/$/, '');+const server = await createServer({+ configFile: path.join(appDir, 'vite.config.mts'),+ root: appDir,+ mode: 'production',+ appType: 'custom',+ server: {middlewareMode: true, hmr: false},+ logLevel: 'error',+});+try {+ const {render, needsEmbed} = await server.ssrLoadModule(+ '/src/entry-server.tsx',+ );+ let embeddedCount = 0;+ const selected = sample+ ? [sample]+ : routes.filter(route => route !== '/404/');+ for (const route of selected) {+ if (!routes.includes(route) || route === '/404/') {+ throw new Error(`Unknown prerender sample ${route}`);+ }+ const content = await render(route, basePath);+ const embedded = needsEmbed(route)+ ? await render(route, basePath, true)+ : null;+ if (+ !content ||+ content.length < 100 ||+ (embedded != null && embedded.length < 100)+ ) {+ throw new Error(`Empty prerendered route ${route}`);+ }+ if (sample) {+ console.log(+ `${route}: ${content.length} HTML bytes; embed ${embedded?.length ?? 0} bytes; ${embedded?.slice(0, 180) ?? content.slice(0, 180)}`,+ );+ continue;+ }+ const file = path.join(out, route.slice(1), 'index.html');+ fs.writeFileSync(+ file,+ index.replace(+ marker,+ `<div id="root" data-route="${route}">${content}</div>`,+ ),+ );+ if (embedded != null) {+ embeddedCount++;+ fs.writeFileSync(+ path.join(out, route.slice(1), 'embed.html'),+ index.replace(+ marker,+ `<div id="root" data-route="${route}embed.html">${embedded}</div>`,+ ),+ );+ }+ }+ if (!sample) {+ console.log(+ `Prerendered ${selected.length} pages and ${embeddedCount} embed documents`,+ );+ }+} catch (error) {+ console.error(error);+ process.exitCode = 1;+} finally {+ const closed = await Promise.race([+ server.close().then(() => true),+ new Promise(resolve => setTimeout(() => resolve(false), 10_000)),+ ]);+ if (!closed) console.warn('Vite SSR server did not close in 10s');+ // Vite's background optimizer/watch handles can outlive close() on this+ // large source graph; all pages have already been written or an error set.+ process.exit(process.exitCode || 0);+}diff --git a/apps/sandbox/scripts/route-manifest.mjs b/apps/sandbox/scripts/route-manifest.mjsnew file mode 100644index 0000000000..a5c07f9ade--- /dev/null+++ b/apps/sandbox/scripts/route-manifest.mjs@@ -0,0 +1,81 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Static route inventory shared by Vite's module graph and HTML exporter.+ * @input Authored page.tsx files, generated template wrappers, category slugs.+ * @output Exact trailing-slash route manifest; no SPA fallback or unknown routes.+ * @position Build-time counterpart of Sandbox's former Next static route tree.+ */++import fs from 'node:fs';+import path from 'node:path';++const GROUPS = new Set(['(sandbox)', '(fullscreen)', '(raw)']);++export function routeForPage(relativeFile) {+ const parts = relativeFile.split(/[\\/]/);+ if (!GROUPS.has(parts[0]) || parts.at(-1) !== 'page.tsx') {+ throw new Error(`Unexpected Sandbox page: ${relativeFile}`);+ }+ const segments = parts.slice(1, -1);+ if (+ segments.some(segment => segment.startsWith('[') || segment.startsWith('('))+ ) {+ throw new Error(`Unexpanded dynamic route: ${relativeFile}`);+ }+ return `/${segments.length ? `${segments.join('/')}/` : ''}`;+}++/** Scan only the app's page tree (including ignored, freshly generated wrappers). */+export function discoverRoutes(appDir, categories) {+ const routes = new Map();+ function add(route, file, group, slug) {+ if (routes.has(route)) {+ throw new Error(+ `Duplicate Sandbox route ${route}: ${file} and ${routes.get(route).file}`,+ );+ }+ routes.set(route, {route, file, group, ...(slug && {slug})});+ }+ function visit(directory, relative = '') {+ for (const entry of fs.readdirSync(directory, {withFileTypes: true})) {+ const next = path.join(relative, entry.name);+ if (entry.isDirectory()) {+ if (entry.name === 'node_modules' || entry.name === '__generated__')+ continue;+ visit(path.join(directory, entry.name), next);+ } else if (entry.name === 'page.tsx') {+ if (next.includes('[category]')) continue;+ const group = next.split(path.sep)[0].slice(1, -1);+ add(routeForPage(next), path.join(appDir, next), group);+ }+ }+ }+ visit(appDir);+ for (const slug of categories) {+ if (slug === 'templates') continue;+ if (!/^[a-z0-9-]+$/.test(slug))+ throw new Error(`Invalid category slug: ${slug}`);+ add(+ `/${slug}/`,+ path.join(appDir, '(sandbox)/[category]/CategoryContent.tsx'),+ 'sandbox',+ slug,+ );+ }+ if (!routes.has('/')) throw new Error('Sandbox home route is missing');+ return [...routes.values()].sort((a, b) =>+ a.route < b.route ? -1 : a.route > b.route ? 1 : 0,+ );+}++export function templateAssetBase(basePath, override = '') {+ return override || (basePath ? `${basePath}/template-assets` : '');+}++export function exportedHtmlPath(route) {+ if (!/^\/(?:[A-Za-z0-9_-]+\/)*$/.test(route)) {+ throw new Error(`Invalid static export route: ${route}`);+ }+ return route === '/' ? 'index.html' : `${route.slice(1)}index.html`;+}diff --git a/apps/sandbox/scripts/verify-export.mjs b/apps/sandbox/scripts/verify-export.mjsnew file mode 100644index 0000000000..ea4b4004b4--- /dev/null+++ b/apps/sandbox/scripts/verify-export.mjs@@ -0,0 +1,112 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Post-build check against the complete original Next export.+ * @input Vite out/, checked Next path manifest, optional SANDBOX_BASE_PATH.+ * @output Nonzero exit if HTML routes, page bodies, links, metadata, assets or 404 diverge.+ * @position Sandbox build contract; runs after every production Vite build.+ */++import fs from 'node:fs';+import path from 'node:path';+import {fileURLToPath} from 'node:url';++const appDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const out = path.join(appDir, 'out');+const oracle = JSON.parse(+ fs.readFileSync(path.join(appDir, 'scripts/next-export-routes.json'), 'utf8'),+);+const base = `${(process.env.SANDBOX_BASE_PATH || '').replace(/\/$/, '')}/`;+const htmlRoutes = [];+let embedDocuments = 0;+function visit(dir) {+ for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {+ const file = path.join(dir, entry.name);+ if (entry.isDirectory()) visit(file);+ else if (entry.name === 'index.html') {+ const rel = path.relative(out, path.dirname(file));+ htmlRoutes.push(rel ? `/${rel.split(path.sep).join('/')}/` : '/');+ }+ }+}+visit(out);+htmlRoutes.sort();+if (JSON.stringify(htmlRoutes) !== JSON.stringify(oracle.routes)) {+ const missing = oracle.routes.filter(route => !htmlRoutes.includes(route));+ const extra = htmlRoutes.filter(route => !oracle.routes.includes(route));+ throw new Error(+ `Static route mismatch: missing ${missing.join(', ')}, extra ${extra.join(', ')}`,+ );+}+for (const route of oracle.routes) {+ if (route === '/404/') continue;+ const html = fs.readFileSync(+ path.join(out, route.slice(1), 'index.html'),+ 'utf8',+ );+ if (+ !html.includes('<title>Astryx Sandbox</title>') ||+ !html.includes('Astryx component testing sandbox')+ ) {+ throw new Error(`Missing public metadata at ${route}`);+ }+ // A copied Vite shell is not an export: every deep link must have its own+ // prerendered page and layout, even if JavaScript never runs.+ if (+ !html.includes(`<div id="root" data-route="${route}">`) ||+ html.length < 300+ ) {+ throw new Error(`Missing prerendered page body at ${route}`);+ }+ if (route === '/' && !html.includes('Astryx Sandbox</h1>')) {+ throw new Error('Home heading missing from static HTML');+ }+ if (+ route === '/pages/component-scores/' &&+ !html.includes('component-audit-details')+ ) {+ throw new Error('Component audit page missing from static HTML');+ }+ if (+ route === '/templates/login-sso/' &&+ !html.includes('embed.html?embed=1')+ ) {+ throw new Error('Login template lost its static iframe document');+ }+ if (html.includes('embed.html?embed=1')) {+ embedDocuments++;+ const embedPath = path.join(out, route.slice(1), 'embed.html');+ if (!fs.existsSync(embedPath)) {+ throw new Error(`Fullscreen preview has no static embed at ${route}`);+ }+ const embed = fs.readFileSync(embedPath, 'utf8');+ if (+ !embed.includes(`<div id="root" data-route="${route}embed.html">`) ||+ embed.length < 300 ||+ embed.includes(`<iframe src="${base}${route.slice(1)}embed.html?embed=1`)+ ) {+ throw new Error(`Fullscreen embed is empty or recursive at ${route}`);+ }+ if (route === '/templates/login-sso/' && !embed.includes('Welcome back')) {+ throw new Error('Login template lacks its page content in static HTML');+ }+ }+ for (const match of html.matchAll(+ /(?:src|href)="([^"#]+\.(?:js|css))(?:\?[^\"]*)?"/g,+ )) {+ const asset = match[1];+ if (!asset.startsWith(base))+ throw new Error(`Wrong asset base at ${route}: ${asset}`);+ if (!fs.existsSync(path.join(out, asset.slice(base.length))))+ throw new Error(`Missing asset at ${route}: ${asset}`);+ }+}+if (+ !fs.existsSync(path.join(out, '404.html')) ||+ !fs.existsSync(path.join(out, 'template-assets'))+) {+ throw new Error('404 or template assets missing');+}+console.log(+ `Verified ${htmlRoutes.length} HTML routes, ${embedDocuments} fullscreen embeds, and their JS/CSS links against the Next export (${base})`,+);diff --git a/apps/sandbox/src/RouteView.tsx b/apps/sandbox/src/RouteView.tsxnew file mode 100644index 0000000000..4cf1b7ec50--- /dev/null+++ b/apps/sandbox/src/RouteView.tsx@@ -0,0 +1,53 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Shared Sandbox route-group rendering for the server and browser.+ * @input Resolved page component and generated route metadata.+ * @output Identical providers, nested Motion Lab, sandbox/fullscreen/raw layouts.+ * @position Preserves Next route-group behavior in static HTML and hydration.+ */++import {Suspense, type ComponentType} from 'react';+import {LinkProvider} from '@astryxdesign/core/Link';+import type {SandboxRoute} from 'virtual:sandbox-routes';+import {Providers} from './app/providers';+import SandboxLayout from './app/(sandbox)/layout';+import FullscreenLayout from './app/(fullscreen)/layout';+import RawLayout from './app/(raw)/layout';+import MotionLabLayout from './app/(sandbox)/pages/motion-lab/layout';+import {SandboxLink} from './router';++export function RouteView({+ entry,+ Page,+ embed = false,+}: {+ entry: SandboxRoute;+ Page: ComponentType;+ embed?: boolean;+}) {+ const page = (+ <Suspense fallback={null}>+ <Page />+ </Suspense>+ );+ const group =+ entry.group === 'fullscreen' ? (+ <FullscreenLayout forceEmbed={embed}>{page}</FullscreenLayout>+ ) : entry.group === 'sandbox' ? (+ <SandboxLayout>+ {entry.route.startsWith('/pages/motion-lab/') ? (+ <MotionLabLayout>{page}</MotionLabLayout>+ ) : (+ page+ )}+ </SandboxLayout>+ ) : (+ <RawLayout>{page}</RawLayout>+ );+ return (+ <Providers>+ <LinkProvider component={SandboxLink}>{group}</LinkProvider>+ </Providers>+ );+}diff --git a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsxindex 0accfa76da..ba5ba9e27b 100644--- a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx+++ b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx@@ -3,7 +3,7 @@'use client';import {useState, useCallback, useEffect, useMemo, useRef} from 'react';-import {usePathname, useRouter} from 'next/navigation';+import {usePathname, useRouter, basePath} from '../../router';import {Text} from '@astryxdesign/core/Text';import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';import {Button} from '@astryxdesign/core/Button';@@ -23,7 +23,6 @@ import {templates} from '../../generated/templateRegistry';import {blocks} from '../../generated/blockRegistry';const blocksByHref = new Map(blocks.map(b => [b.href.replace(/\/$/, ''), b]));-const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';function buildNavTree(currentPath: string): TreeListItemData[] {const norm = currentPath.replace(/\/$/, '');@@ -31,7 +30,7 @@ function buildNavTree(currentPath: string): TreeListItemData[] {const pageItems: TreeListItemData[] = templates.map(t => ({id: t.href,label: t.name,- href: basePath + t.href,+ href: t.href,isSelected: t.href.replace(/\/$/, '') === norm,}));@@ -49,7 +48,7 @@ function buildNavTree(currentPath: string): TreeListItemData[] {items.push({id: b.href,label: shortName,- href: basePath + b.href,+ href: b.href,isSelected: b.href.replace(/\/$/, '') === norm,});}@@ -267,13 +266,19 @@ const viewportWidths: Record<ViewportSize, string> = {mobile: '375px',};-export function PreviewShell({children}: {children: React.ReactNode}) {+export function PreviewShell({+ children,+ forceEmbed = false,+}: {+ children: React.ReactNode;+ forceEmbed?: boolean;+}) {const pathname = usePathname();const router = useRouter();const searchParams = new URLSearchParams(typeof window !== 'undefined' ? window.location.search : '',);- const isEmbed = searchParams.get('embed') === '1';+ const isEmbed = forceEmbed || searchParams.get('embed') === '1';if (isEmbed) {// Embedded template previews need a full-height chain so page roots sized// with min-height:100% (e.g. centered login pages) fill the frame instead of@@ -282,7 +287,7 @@ export function PreviewShell({children}: {children: React.ReactNode}) {// <head>) so it applies reliably in the embed context.return (<>- <style>{`html,body{height:100%}body>[data-astryx-theme]{height:100%}`}</style>+ <style>{`html,body,#root,#root>[data-astryx-theme]{height:100%}`}</style>{children}</>);@@ -299,7 +304,8 @@ export function PreviewShell({children}: {children: React.ReactNode}) {// on initial load. Only recomputes when pathname changes — theme/mode changes// are synced to the iframe via postMessage to avoid triggering a reload.const iframeSrc = useMemo(- () => `${basePath}${pathname}?embed=1&theme=${themeName}&mode=${mode}`,+ () =>+ `${basePath}${pathname.endsWith('/') ? pathname : `${pathname}/`}embed.html?embed=1&theme=${themeName}&mode=${mode}`,[pathname], // intentionally excludes themeName/mode — live updates use postMessage);diff --git a/apps/sandbox/src/app/(fullscreen)/layout.tsx b/apps/sandbox/src/app/(fullscreen)/layout.tsxindex 408b5ee9dd..2f9e116d73 100644--- a/apps/sandbox/src/app/(fullscreen)/layout.tsx+++ b/apps/sandbox/src/app/(fullscreen)/layout.tsx@@ -4,8 +4,10 @@ import {PreviewShell} from './PreviewShell';export default function FullscreenLayout({children,+ forceEmbed = false,}: {children: React.ReactNode;+ forceEmbed?: boolean;}) {- return <PreviewShell>{children}</PreviewShell>;+ return <PreviewShell forceEmbed={forceEmbed}>{children}</PreviewShell>;}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/doc-nav/DocTopNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/doc-nav/DocTopNav.tsxindex 3f194bfc9d..cd36fd749b 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/doc-nav/DocTopNav.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/doc-nav/DocTopNav.tsx@@ -2,8 +2,8 @@'use client';-import {usePathname} from 'next/navigation';-import Link from 'next/link';+import {usePathname} from '../../../../router';+import Link from '../../../../router';import {TopNav, TopNavHeading, TopNavItem} from '@astryxdesign/core/TopNav';const NAV_ITEMS = [diff --git a/apps/sandbox/src/app/(raw)/pages/shell-lab/page.tsx b/apps/sandbox/src/app/(raw)/pages/shell-lab/page.tsxindex 1357978366..80a03c3dfa 100644--- a/apps/sandbox/src/app/(raw)/pages/shell-lab/page.tsx+++ b/apps/sandbox/src/app/(raw)/pages/shell-lab/page.tsx@@ -3,7 +3,7 @@'use client';import {Suspense, useState, useCallback, useEffect, useMemo} from 'react';-import {useSearchParams} from 'next/navigation';+import {useSearchParams} from 'react-router-dom';import * as stylex from '@stylexjs/stylex';import {AppShell} from '@astryxdesign/core/AppShell';@@ -981,7 +981,7 @@ export default function ShellLabPage() {}function ShellLabContent() {- const searchParams = useSearchParams();+ const [searchParams] = useSearchParams();// Initialize config from URL params on mountconst initialConfig = useMemo(diff --git a/apps/sandbox/src/app/(sandbox)/[category]/page.tsx b/apps/sandbox/src/app/(sandbox)/[category]/page.tsxdeleted file mode 100644index 92e15e7a92..0000000000--- a/apps/sandbox/src/app/(sandbox)/[category]/page.tsx+++ /dev/null@@ -1,20 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--import {categories} from '../../sandboxPages';-import {CategoryContent} from './CategoryContent';--// Required for static export — pre-generate all category pages-export function generateStaticParams() {- return categories- .filter(c => c.slug !== 'templates')- .map(c => ({category: c.slug}));-}--export default async function CategoryPage({- params,-}: {- params: Promise<{category: string}>;-}) {- const {category: slug} = await params;- return <CategoryContent slug={slug} />;-}diff --git a/apps/sandbox/src/app/(sandbox)/pages/layout-dsl/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/layout-dsl/page.tsxindex b1d670e794..a9cc54883d 100644--- a/apps/sandbox/src/app/(sandbox)/pages/layout-dsl/page.tsx+++ b/apps/sandbox/src/app/(sandbox)/pages/layout-dsl/page.tsx@@ -45,20 +45,20 @@ function heuristicTokens(src: string): number {/*** Loads the build-time tokenizer module from public/xle-tokenizer.mjs* (esbuild-bundled gpt-tokenizer o200k_base, or a heuristic fallback — see- * scripts/generate-xle-tokenizer.mjs). Loaded client-side via a webpackIgnore- * runtime import so the sandbox build never depends on gpt-tokenizer resolving- * through webpack. Falls back to the inline heuristic until it's ready. The- * basePath prefix keeps the asset reachable under the GitHub Pages deployment.+ * scripts/generate-xle-tokenizer.mjs). Loaded by URL with Vite's dynamic+ * import analysis disabled; the build never needs gpt-tokenizer installed.+ * The inline heuristic runs until that module loads. The Vite base path keeps+ * the asset reachable at /sandbox/ and during root-local development.*/type TokenizerModule = {countTokens: (s: string) => number; ENCODER: string};-const TOKENIZER_URL = `${process.env.NEXT_PUBLIC_BASE_PATH || ''}/xle-tokenizer.mjs`;+const TOKENIZER_URL = `${import.meta.env.BASE_URL}xle-tokenizer.mjs`;function useTokenCounter() {const [bpe, setBpe] = useState<((s: string) => number) | null>(null);const [encoder, setEncoder] = useState('est.');useEffect(() => {let alive = true;- (import(/* webpackIgnore: true */ TOKENIZER_URL) as Promise<TokenizerModule>)+ (import(/* @vite-ignore */ TOKENIZER_URL) as Promise<TokenizerModule>).then(m => {if (!alive) {return;@@ -206,7 +206,8 @@ const s = stylex.create({borderBottomColor: 'var(--color-border-subtle, var(--color-border))',},rowActive: {- backgroundColor: 'var(--color-background-active, var(--color-background-muted))',+ backgroundColor:+ 'var(--color-background-active, var(--color-background-muted))',},rowLabel: {fontSize: 'var(--text-sm, 13px)', fontWeight: 600},rowExpr: {@@ -227,7 +228,15 @@ const s = stylex.create({min0: {minWidth: 0},});-function Metric({label, value, sub}: {label: string; value: string; sub?: string}) {+function Metric({+ label,+ value,+ sub,+}: {+ label: string;+ value: string;+ sub?: string;+}) {return (<div {...stylex.props(s.metric)}><Text type="supporting">{label}</Text>@@ -329,9 +338,9 @@ export default function LayoutDSLPage() {<Heading level={2}>Layout DSL</Heading><Text type="supporting">Write a compressed layout expression (compact XLE or indented outline- XLO). It is validated live against @astryxdesign/core; the expanded TSX- and token counts update below. The whole pipeline runs in-browser via- the @astryxdesign/cli/xle barrel.+ XLO). It is validated live against @astryxdesign/core; the expanded+ TSX and token counts update below. The whole pipeline runs in-browser+ via the @astryxdesign/cli/xle barrel.</Text></VStack>@@ -390,7 +399,11 @@ export default function LayoutDSLPage() {/><Metriclabel="Expansion"- value={inTokens > 0 && outTokens > 0 ? `${(outTokens / inTokens).toFixed(1)}×` : '—'}+ value={+ inTokens > 0 && outTokens > 0+ ? `${(outTokens / inTokens).toFixed(1)}×`+ : '—'+ }sub="output ÷ input"/></div>@@ -422,7 +435,9 @@ export default function LayoutDSLPage() {<Text type="supporting">{expanded.componentsUsed.length} components{expanded.states ? ` · ${expanded.states} state hooks` : ''}- {expanded.todos.length ? ` · ${expanded.todos.length} TODO` : ''}+ {expanded.todos.length+ ? ` · ${expanded.todos.length} TODO`+ : ''}</Text>)}</HStack>@@ -433,7 +448,10 @@ export default function LayoutDSLPage() {{valid && (<VStack gap={1}><Text type="label">Canonical forms</Text>- <pre {...stylex.props(s.echo)}>{`compact:\n${check.compact}\n\noutline:\n${check.outline}`}</pre>+ <pre+ {...stylex.props(+ s.echo,+ )}>{`compact:\n${check.compact}\n\noutline:\n${check.outline}`}</pre></VStack>)}@@ -466,7 +484,10 @@ export default function LayoutDSLPage() {<buttonkey={ex.label}type="button"- {...stylex.props(s.row, ex.label === activeLabel && s.rowActive)}+ {...stylex.props(+ s.row,+ ex.label === activeLabel && s.rowActive,+ )}onClick={() => pick(ex.label, ex.expr)}><VStack gap={0} xstyle={s.min0}><span {...stylex.props(s.rowLabel)}>{ex.label}</span>@@ -474,7 +495,9 @@ export default function LayoutDSLPage() {{ex.expr.replace(/\n/g, ' ⏎ ')}</span></VStack>- <span {...stylex.props(s.rowTok)}>{countTokens(ex.expr)} tok</span>+ <span {...stylex.props(s.rowTok)}>+ {countTokens(ex.expr)} tok+ </span></button>))}</div>diff --git a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLabShell.tsx b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLabShell.tsxindex 26d8259408..cfd224f9df 100644--- a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLabShell.tsx+++ b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLabShell.tsx@@ -21,7 +21,7 @@* which is the order they are meant to be read in.*/-import {usePathname} from 'next/navigation';+import {usePathname} from '../../../../router';import {useEffect, useRef, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import {@@ -56,16 +56,9 @@ const sx = stylex.create({});/**- * Hrefs here are written WITHOUT the deployed basePath, and must stay that way.- *- * The sandbox deploys under a prefix (`/astryx/pr/<n>/sandbox` on a preview),- * and `next/link` prepends it exactly once. LinkProvider in layout.tsx routes- * every Astryx `Link` and `ListItem` in this section through `next/link`, so- * the prefix is already handled — applying it here as well produces a- * double-prefixed URL that 404s, which is how this was found.- *- * `usePathname()` also returns the path without the prefix, so the- * current-page comparison below matches these hrefs directly.+ * Hrefs stay unprefixed: SandboxLink applies the Vite base path once in the+ * LinkProvider, and usePathname() returns the path within that base path.+ * A second prefix here would break navigation on the staged /sandbox/ build.*//** The export sets `trailingSlash: true`, so normalise before comparing. */diff --git a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/layout.tsx b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/layout.tsxindex 98c42d5b96..5875f29708 100644--- a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/layout.tsx+++ b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/layout.tsx@@ -4,32 +4,20 @@* @file layout.tsx* @input The Motion Lab provider, the link provider, and the shell* @output The /pages/motion-lab section frame- * @position Next.js segment layout+ * @position Motion Lab route-group layout (shared by every Vite page in the section)** Every lab page reads its durations, curves and springs from one store, so the- * provider wraps the whole section rather than each page — that is what lets a- * slider on the tokens page change a demo on the rubric page. It also has to be- * a layout rather than a per-page wrapper because the sandbox is a static- * export: each route is prerendered on its own, and a page whose hook has no- * provider above it fails the build rather than the browser.+ * provider wraps the whole section rather than each page. The Vite route+ * manifest preserves this shared layout across navigation.*- * LinkProvider is here for a subtler reason. The sandbox deploys under a- * basePath (`/astryx/pr/<n>/sandbox` on a PR preview, `/astryx/sandbox` on- * main), and `next/link` prepends it automatically — which is why the rest of- * the app links correctly. Astryx's own `Link` renders a plain anchor, so a- * root-absolute `href="/pages/motion-lab/..."` written by hand escapes the- * basePath entirely and lands on the org's root site. Pointing LinkProvider at- * `next/link` makes every Astryx `Link` in this section route through Next and- * pick the prefix up.- *- * `ListItem` routes through the same provider, so the nav panel is covered- * too. Nothing in this section should prepend the basePath by hand: Next does- * it exactly once, and doing it again yields a double-prefixed URL that 404s.+ * LinkProvider routes Astryx Link and ListItem through the Sandbox router,+ * which applies the configured base path exactly once. Keep authored links+ * unprefixed for both root-local and /sandbox/ deployments.*/'use client';-import NextLink from 'next/link';+import NextLink from '../../../../router';import type {ReactNode} from 'react';import {LinkProvider} from '@astryxdesign/core/Link';import {MotionLabProvider} from './MotionLabStore';diff --git a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/page.tsxindex a77bee4f37..3974ec3984 100644--- a/apps/sandbox/src/app/(sandbox)/pages/motion-lab/page.tsx+++ b/apps/sandbox/src/app/(sandbox)/pages/motion-lab/page.tsx@@ -15,7 +15,7 @@*/import * as stylex from '@stylexjs/stylex';-import Link from 'next/link';+import Link from '../../../../router';import {Banner} from '@astryxdesign/core/Banner';import {Badge} from '@astryxdesign/core/Badge';import {Card} from '@astryxdesign/core/Card';diff --git a/apps/sandbox/src/app/(sandbox)/templates/page.tsx b/apps/sandbox/src/app/(sandbox)/templates/page.tsxindex ee8ec51180..bdc8488f95 100644--- a/apps/sandbox/src/app/(sandbox)/templates/page.tsx+++ b/apps/sandbox/src/app/(sandbox)/templates/page.tsx@@ -11,7 +11,7 @@import {useCallback, useEffect, useMemo, useRef, useState} from 'react';import * as stylex from '@stylexjs/stylex';-import NextLink from 'next/link';+import NextLink from '../../../router';import {Badge} from '@astryxdesign/core/Badge';import type {BadgeVariant} from '@astryxdesign/core/Badge';diff --git a/apps/sandbox/src/app/ProjectCard.tsx b/apps/sandbox/src/app/ProjectCard.tsxindex fb6a0db627..38ba850360 100644--- a/apps/sandbox/src/app/ProjectCard.tsx+++ b/apps/sandbox/src/app/ProjectCard.tsx@@ -2,7 +2,7 @@'use client';-import Link from 'next/link';+import Link from '../router';import * as stylex from '@stylexjs/stylex';import {Heading, Text} from '@astryxdesign/core/Text';import {Card} from '@astryxdesign/core/Card';diff --git a/apps/sandbox/src/app/SandboxNav.tsx b/apps/sandbox/src/app/SandboxNav.tsxindex 97925fd315..476d8d817a 100644--- a/apps/sandbox/src/app/SandboxNav.tsx+++ b/apps/sandbox/src/app/SandboxNav.tsx@@ -11,8 +11,8 @@import {useEffect, useRef, useState} from 'react';import * as stylex from '@stylexjs/stylex';-import {usePathname} from 'next/navigation';-import Link from 'next/link';+import {usePathname} from '../router';+import Link from '../router';import {SideNav,SideNavHeading,diff --git a/apps/sandbox/src/app/SandboxShell.tsx b/apps/sandbox/src/app/SandboxShell.tsxindex 2a71724954..186c947b0c 100644--- a/apps/sandbox/src/app/SandboxShell.tsx+++ b/apps/sandbox/src/app/SandboxShell.tsx@@ -2,7 +2,7 @@'use client';-import {usePathname} from 'next/navigation';+import {usePathname} from '../router';import {AppShell} from '@astryxdesign/core/AppShell';import {SandboxNav} from './SandboxNav';diff --git a/apps/sandbox/src/app/layers.css b/apps/sandbox/src/app/layers.cssindex 2dc38878ab..fdc1f4fcfd 100644--- a/apps/sandbox/src/app/layers.css+++ b/apps/sandbox/src/app/layers.css@@ -1,7 +1,6 @@/* Copyright (c) Meta Platforms, Inc. and affiliates. */-/* Layer order declaration — must be the first CSS in the bundle.- Separate file because webpack hoists @import content above inline- CSS, so an inline @layer statement in globals.css would appear- after reset.css and theme.css content in the output. */+/* Declare layer precedence before importing reset, library, themes and+ Sandbox CSS. The Vite StyleX plugin also prepends the same declaration to+ index.html so these layers precede every bundle stylesheet. */@layer reset, astryx-base, astryx-theme, product;diff --git a/apps/sandbox/src/app/layout.tsx b/apps/sandbox/src/app/layout.tsxdeleted file mode 100644index 97ac8f2300..0000000000--- a/apps/sandbox/src/app/layout.tsx+++ /dev/null@@ -1,44 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--import type {Metadata} from 'next';-import './globals.css';-import {Providers} from './providers';--export const metadata: Metadata = {- title: 'Astryx Sandbox',- description: 'Astryx component testing sandbox',-};--export default function RootLayout({children}: {children: React.ReactNode}) {- return (- <html lang="en">- <head>- <link rel="preconnect" href="https://fonts.googleapis.com" />- <link- rel="preconnect"- href="https://fonts.gstatic.com"- crossOrigin=""- />- <link- rel="stylesheet"- href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Fustat:wght@400;500;600;700&family=Manufacturing+Consent&family=Outfit:wght@400;500;600;700&family=Sarina&family=JetBrains+Mono:wght@400;500;600;700&display=swap"- />- {/* Prevent PreviewShell toolbar flash when loaded inside an iframe.- Runs before paint so the toolbar is never visible in embed contexts. */}- <script- dangerouslySetInnerHTML={{- __html: `try{if(window.self!==window.top)document.documentElement.classList.add('astryx-embed')}catch(e){document.documentElement.classList.add('astryx-embed')}`,- }}- />- <style- dangerouslySetInnerHTML={{- __html: `html.astryx-embed [data-preview-shell]{display:none!important}`,- }}- />- </head>- <body>- <Providers>{children}</Providers>- </body>- </html>- );-}diff --git a/apps/sandbox/src/app/providers.tsx b/apps/sandbox/src/app/providers.tsxindex 3763531a19..1c9fc51e18 100644--- a/apps/sandbox/src/app/providers.tsx+++ b/apps/sandbox/src/app/providers.tsx@@ -62,8 +62,8 @@ const MODE_STORAGE_KEY = 'astryx-sandbox-mode';* useSearchParams in the root Providers component.** For non-embed contexts, localStorage hydration is handled via useEffect in- * Providers so the initial server render matches the client (avoiding hydration- * mismatches on Next.js SSR).+ * Providers so the default theme appears immediately before a saved preference+ * replaces it. Embeds take their initial theme from the URL instead.*/function getEmbedThemeParams(): {initialTheme: string;diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.tsindex 458b8ab151..af3f7580c5 100644--- a/apps/sandbox/src/app/sandboxPages.ts+++ b/apps/sandbox/src/app/sandboxPages.ts@@ -20,8 +20,8 @@* 1. Create the page under the appropriate route group* 2. Add an entry to the appropriate category below*- * Note: hrefs use trailing slashes because the sandbox is a static export- * with `trailingSlash: true` in next.config.mjs.+ * Note: hrefs use trailing slashes because the Vite build writes a physical+ * index.html for each route; static hosts redirect /route to /route/.*/import {templates as autoDiscoveredTemplates} from '../generated/templateRegistry';diff --git a/apps/sandbox/src/entry-server.tsx b/apps/sandbox/src/entry-server.tsxnew file mode 100644index 0000000000..a65b99dc21--- /dev/null+++ b/apps/sandbox/src/entry-server.tsx@@ -0,0 +1,43 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Build-only HTML prerender entry for all Sandbox deep links.+ * @input Generated route modules and their shared layouts/providers.+ * @output React HTML at each route without needing JavaScript to see content.+ * @position Loaded by scripts/prerender.mjs through Vite SSR, never deployed.+ */++import {renderToString} from 'react-dom/server';+import {StaticRouter} from 'react-router-dom';+import {findRoute, loadPage} from './route-entry';+import {blocks} from './generated/blockRegistry';+import {RouteView} from './RouteView';++const blockRoutes = new Set(blocks.map(block => block.href));++/** Blocks render inline; other fullscreen routes need a standalone iframe document. */+export function needsEmbed(route: string): boolean {+ const entry = findRoute(route);+ return entry?.group === 'fullscreen' && !blockRoutes.has(entry.route);+}++export async function render(+ route: string,+ basePath = '',+ embed = false,+): Promise<string> {+ const entry = findRoute(route);+ if (!entry) {+ throw new Error(`Cannot prerender unknown route ${route}`);+ }+ const Page = await loadPage(entry);+ if (embed && !needsEmbed(route)) {+ throw new Error(`Route does not need an embed document: ${route}`);+ }+ const location = `${basePath}${route}${embed ? 'embed.html?embed=1' : ''}`;+ return renderToString(+ <StaticRouter basename={`${basePath}/`} location={location}>+ <RouteView entry={entry} Page={Page} embed={embed} />+ </StaticRouter>,+ );+}diff --git a/apps/sandbox/src/hydration-policy.ts b/apps/sandbox/src/hydration-policy.tsnew file mode 100644index 0000000000..f7d52dc506--- /dev/null+++ b/apps/sandbox/src/hydration-policy.ts@@ -0,0 +1,16 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Decide whether the default static HTML matches the incoming query.+ * @input Route and URL search string.+ * @output Whether React can safely hydrate instead of client-rendering.+ * @position Prevents mismatches for iframe themes and Shell Lab URL controls.+ */++export function canHydrate(route: string | undefined, search: string): boolean {+ const params = new URLSearchParams(search);+ return (+ params.get('embed') !== '1' &&+ !(route === '/pages/shell-lab/' && search.length > 0)+ );+}diff --git a/apps/sandbox/src/main.tsx b/apps/sandbox/src/main.tsxnew file mode 100644index 0000000000..050c1840ad--- /dev/null+++ b/apps/sandbox/src/main.tsx@@ -0,0 +1,77 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Browser entry for the generated Sandbox route tree.+ * @input Vite's route manifest, prerendered HTML, and browser URL.+ * @output Hydrated route-group layout plus lazy navigation to other pages.+ * @position Client entry; scripts/prerender.mjs emits HTML for every route.+ */++'use client';++import {lazy, useMemo, type ComponentType} from 'react';+import {createRoot, hydrateRoot} from 'react-dom/client';+import {BrowserRouter, useLocation} from 'react-router-dom';+import {findRoute, loadPage} from './route-entry';+import {RouteView} from './RouteView';+import {SandboxLink, basePath} from './router';+import {canHydrate} from './hydration-policy';+import './app/globals.css';++const loadedPages = new Map<string, ComponentType>();++function App() {+ const {pathname} = useLocation();+ const entry = findRoute(pathname);+ const Page = useMemo(() => {+ if (!entry) {+ return null;+ }+ const loaded = loadedPages.get(entry.route);+ if (loaded) {+ return loaded;+ }+ return lazy(async () => {+ const component = await loadPage(entry);+ loadedPages.set(entry.route, component);+ return {default: component};+ });+ }, [entry]);++ if (!entry || !Page) {+ return (+ <main>+ <h1>Page not found</h1>+ <SandboxLink href="/">Sandbox home</SandboxLink>+ </main>+ );+ }+ return <RouteView entry={entry} Page={Page} />;+}++async function start() {+ const root = document.getElementById('root');+ if (!root) {+ throw new Error('Sandbox root element is missing');+ }+ const pathname = window.location.pathname.slice(basePath.length) || '/';+ const entry = findRoute(pathname);+ if (entry) {+ loadedPages.set(entry.route, await loadPage(entry));+ }+ const app = (+ <BrowserRouter basename={import.meta.env.BASE_URL}>+ <App />+ </BrowserRouter>+ );+ // Embeds change the theme and shell; Shell Lab reads query params in its+ // first render. Their static HTML reflects the default route, so client-+ // render query-dependent visits rather than hydrating mismatched markup.+ if (root.hasChildNodes() && canHydrate(entry?.route, location.search)) {+ hydrateRoot(root, app);+ } else {+ createRoot(root).render(app);+ }+}++void start();diff --git a/apps/sandbox/src/route-entry.tsx b/apps/sandbox/src/route-entry.tsxnew file mode 100644index 0000000000..b2139007c8--- /dev/null+++ b/apps/sandbox/src/route-entry.tsx@@ -0,0 +1,35 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Shared route inventory and page loader for prerender and hydration.+ * @input Vite's generated route-module manifest.+ * @output Exact route lookup and resolved React page components.+ * @position Single source of truth for client navigation and static HTML.+ */++import type {ComponentType} from 'react';+import {routes, type SandboxRoute} from 'virtual:sandbox-routes';++export function findRoute(pathname: string): SandboxRoute | undefined {+ const normalized = pathname.endsWith('/embed.html')+ ? pathname.slice(0, -'embed.html'.length)+ : pathname.endsWith('/')+ ? pathname+ : `${pathname}/`;+ return routes.find(item => item.route === normalized);+}++export async function loadPage(entry: SandboxRoute): Promise<ComponentType> {+ const module = await entry.load();+ if (entry.slug && module.CategoryContent) {+ const Category = module.CategoryContent;+ const slug = entry.slug;+ return function CategoryPage() {+ return <Category slug={slug} />;+ };+ }+ if (!module.default) {+ throw new Error(`No page component for ${entry.route}`);+ }+ return module.default;+}diff --git a/apps/sandbox/src/route-manifest.test.ts b/apps/sandbox/src/route-manifest.test.tsnew file mode 100644index 0000000000..456f70bc2c--- /dev/null+++ b/apps/sandbox/src/route-manifest.test.ts@@ -0,0 +1,119 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Contract for every path in the original Next static export.+ * @input Checked Next HTML manifest, authored pages, and generated template+ * registry/wrappers (materialized by the Node project's global setup).+ * @output Fails if a deep link, typed template route, layout group, or+ * trailing slash disappears.+ * @position Collected by the repository's node Vitest project.+ */++import fs from 'node:fs';+import path from 'node:path';+import {fileURLToPath} from 'node:url';+import {describe, expect, it} from 'vitest';+import {categories} from './app/sandboxPages';+import {blocks} from './generated/blockRegistry';+import {templates} from './generated/templateRegistry';+import {canHydrate} from './hydration-policy';+import {+ discoverRoutes,+ exportedHtmlPath,+ templateAssetBase,+} from '../scripts/route-manifest.mjs';+import oracle from '../scripts/next-export-routes.json';++const app = path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'app');+const routes = discoverRoutes(+ app,+ categories.map(category => category.slug),+);++// The former Next export also emitted a synthetic /404/ page. The Vite exporter+// emits it separately from the application routes, alongside 404.html.+describe('Sandbox static export contract', () => {+ it('materializes every authored template as a physical Vite route before tests', () => {+ const generated = [...templates, ...blocks];+ expect(generated.length).toBeGreaterThan(0);+ const templateRoutes = routes.filter(item =>+ item.route.startsWith('/templates/'),+ );+ // Besides /templates/ itself, every generated route comes from an authored+ // page/block descriptor rather than a stale checked-in list or SPA fallback.+ expect(templateRoutes.length).toBe(generated.length + 1);+ expect(new Set(generated.map(item => item.slug)).size).toBe(+ generated.length,+ );+ for (const item of generated) {+ const wrapper = path.join(+ app,+ '(fullscreen)',+ 'templates',+ item.slug,+ 'page.tsx',+ );+ expect(fs.statSync(wrapper).isFile()).toBe(true);+ expect(+ templateRoutes.find(route => route.route === item.href)?.file,+ ).toBe(wrapper);+ }+ });++ it('matches every Next HTML route rather than just representative samples', () => {+ expect([...routes.map(item => item.route), '/404/'].sort()).toEqual(+ oracle.routes,+ );+ expect(routes.length).toBe(oracle.routes.length - 1);+ });++ it('preserves nested, fullscreen, raw, category, and audit layouts', () => {+ expect(routes.find(item => item.route === '/')).toMatchObject({+ group: 'sandbox',+ });+ expect(+ routes.find(item => item.route === '/pages/motion-lab/bugs/'),+ ).toMatchObject({group: 'sandbox'});+ expect(+ routes.find(item => item.route === '/pages/component-scores/'),+ ).toMatchObject({group: 'sandbox'});+ expect(+ routes.find(item => item.route === '/pages/mobile-prototypes/'),+ ).toMatchObject({group: 'raw'});+ expect(+ routes.find(item => item.route === '/templates/work-item-detail/'),+ ).toMatchObject({group: 'fullscreen'});+ expect(+ routes.find(item => item.route === '/components-patterns/'),+ ).toMatchObject({slug: 'components-patterns'});+ expect(exportedHtmlPath('/templates/TopNavHeadingShowcase/')).toBe(+ 'templates/TopNavHeadingShowcase/index.html',+ );+ expect(exportedHtmlPath('/')).toBe('index.html');+ });++ it('prefixes template images exactly once for /sandbox/ while leaving local paths portable', () => {+ expect(templateAssetBase('')).toBe('');+ expect(templateAssetBase('/sandbox')).toBe('/sandbox/template-assets');+ expect(+ templateAssetBase('/sandbox', '/preview/sandbox/template-assets'),+ ).toBe('/preview/sandbox/template-assets');+ });++ it('avoids mismatched hydration for query-dependent Shell Lab and embed URLs', () => {+ expect(canHydrate('/pages/shell-lab/', '?variant=wash')).toBe(false);+ expect(canHydrate('/templates/login-sso/', '?embed=1&theme=stone')).toBe(+ false,+ );+ expect(canHydrate('/pages/component-scores/', '?filter=all')).toBe(true);+ expect(canHydrate('/pages/shell-lab/', '')).toBe(true);+ });++ it('does not turn unknown URLs, dynamic segments or traversal into a 200 fallback', () => {+ expect(routes.some(item => item.route === '/pages/does-not-exist/')).toBe(+ false,+ );+ expect(() => exportedHtmlPath('/../outside/')).toThrow();+ expect(() => exportedHtmlPath('/pages/no-slash')).toThrow();+ });+});diff --git a/apps/sandbox/src/router.tsx b/apps/sandbox/src/router.tsxnew file mode 100644index 0000000000..08ada2cdf3--- /dev/null+++ b/apps/sandbox/src/router.tsx@@ -0,0 +1,42 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Browser router facade for Sandbox navigation and Astryx LinkProvider.+ * @input React Router basename and relative pathname.+ * @output Base-path-aware href links and pathname/navigation hooks.+ * @position Keeps authored pages base-path-agnostic under root and /sandbox/.+ */++'use client';++import {forwardRef, type ComponentPropsWithoutRef} from 'react';+import {Link, useLocation, useNavigate} from 'react-router-dom';++export const basePath = (import.meta.env.BASE_URL as string).replace(/\/$/, '');++function isExternal(href: string) {+ return /^(?:[a-z][a-z\d+.-]*:|\/\/|#)/i.test(href);+}++export const SandboxLink = forwardRef<+ HTMLAnchorElement,+ Omit<ComponentPropsWithoutRef<'a'>, 'href'> & {href: string}+>(function SandboxLink({href, ...props}, ref) {+ if (isExternal(href)) {+ return <a ref={ref} href={href} {...props} />;+ }+ // React Router prepends the BrowserRouter basename exactly once. Keep+ // authored hrefs unprefixed; native external/hash links remain untouched.+ return <Link ref={ref} to={href} {...props} />;+});++export default SandboxLink;++export function usePathname() {+ return useLocation().pathname;+}++export function useRouter() {+ const navigate = useNavigate();+ return {push: (href: string) => navigate(href)};+}diff --git a/apps/sandbox/src/virtual-routes.d.ts b/apps/sandbox/src/virtual-routes.d.tsnew file mode 100644index 0000000000..5efd938048--- /dev/null+++ b/apps/sandbox/src/virtual-routes.d.ts@@ -0,0 +1,17 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/// <reference types="vite/client" />++declare module 'virtual:sandbox-routes' {+ import type {ComponentType} from 'react';+ export interface SandboxRoute {+ route: string;+ group: 'sandbox' | 'fullscreen' | 'raw';+ slug?: string;+ load: () => Promise<{+ default?: ComponentType;+ CategoryContent?: ComponentType<{slug: string}>;+ }>;+ }+ export const routes: SandboxRoute[];+}diff --git a/apps/sandbox/tsconfig.json b/apps/sandbox/tsconfig.jsonindex 04410735c2..0186bc3564 100644--- a/apps/sandbox/tsconfig.json+++ b/apps/sandbox/tsconfig.json@@ -1,11 +1,7 @@{"compilerOptions": {- "target": "ES2017",- "lib": [- "dom",- "dom.iterable",- "esnext"- ],+ "target": "ES2022",+ "lib": ["dom", "dom.iterable", "esnext"],"allowJs": true,"skipLibCheck": true,"strict": true,@@ -15,26 +11,13 @@"moduleResolution": "bundler","resolveJsonModule": true,"isolatedModules": true,- "jsx": "preserve",+ "jsx": "react-jsx","incremental": true,- "plugins": [- {- "name": "next"- }- ],+ "types": ["vite/client"],"paths": {- "@/*": [- "./src/*"- ]+ "@/*": ["./src/*"]}},- "include": [- "next-env.d.ts",- "**/*.ts",- "**/*.tsx",- ".next/types/**/*.ts"- ],- "exclude": [- "node_modules"- ]-}\ No newline at end of file+ "include": ["src/**/*.ts", "src/**/*.tsx", "vite.config.mts"],+ "exclude": ["node_modules", "out"]+}diff --git a/apps/sandbox/vite.config.mts b/apps/sandbox/vite.config.mtsnew file mode 100644index 0000000000..c7c39b619c--- /dev/null+++ b/apps/sandbox/vite.config.mts@@ -0,0 +1,231 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Adapter-free Vite build for Sandbox, with a physical HTML export per route.+ * @input Generated templates, authored pages, optional SANDBOX_BASE_PATH.+ * @output out/ with trailing-slash deep links and base-path-correct assets.+ * @position Replaces the Next static-export build, not the deployment wiring.+ */++import {defineConfig, type Plugin} from 'vite';+import react from '@vitejs/plugin-react';+import {astryxStylex} from '@astryxdesign/build/vite';+import fs from 'node:fs';+import path from 'node:path';+import {fileURLToPath} from 'node:url';+import {createRequire} from 'node:module';+import {categories} from './src/app/sandboxPages';+import {+ discoverRoutes,+ exportedHtmlPath,+ templateAssetBase,+} from './scripts/route-manifest.mjs';++const appDir = path.dirname(fileURLToPath(import.meta.url));+const basePath = (process.env.SANDBOX_BASE_PATH || '').replace(/\/$/, '');+if (basePath && !/^\/(?:[a-zA-Z0-9_-]+\/?)+$/.test(basePath)) {+ throw new Error(`Invalid SANDBOX_BASE_PATH: ${basePath}`);+}+const base = `${basePath}/`;+let routes = discoverRoutes(+ path.join(appDir, 'src/app'),+ categories.map(category => category.slug),+);++function staticRoutes(): Plugin {+ const id = '\0virtual:sandbox-routes';+ let failed = false;+ let exported = false;+ let isBuild = false;+ return {+ name: 'sandbox-static-routes',+ enforce: 'post',+ configResolved(config) {+ isBuild = config.command === 'build' && !config.build.ssr;+ },+ configureServer(server) {+ // sync-templates --watch recreates the generated wrappers. Refresh the+ // virtual manifest once after the batch, including newly added routes.+ let pending: ReturnType<typeof setTimeout> | undefined;+ const refresh = (file: string) => {+ if (!file.includes('/src/app/') || !file.endsWith('/page.tsx')) return;+ if (pending) clearTimeout(pending);+ pending = setTimeout(() => {+ routes = discoverRoutes(+ path.join(appDir, 'src/app'),+ categories.map(category => category.slug),+ );+ const module = server.moduleGraph.getModuleById(id);+ if (module) server.moduleGraph.invalidateModule(module);+ server.ws.send({type: 'full-reload'});+ }, 500);+ };+ server.watcher.on('add', refresh);+ server.watcher.on('unlink', refresh);+ // Vite's MPA mode refuses unknown URLs instead of serving an SPA+ // catch-all. During development, serve the entry only for the exact+ // generated routes (production has physical HTML for each one).+ server.middlewares.use((req, _res, next) => {+ const request = new URL(req.url || '/', 'http://localhost');+ if (basePath && !request.pathname.startsWith(`${basePath}/`)) {+ return next();+ }+ const pathname = basePath+ ? request.pathname.slice(basePath.length)+ : request.pathname;+ const route = pathname.endsWith('/') ? pathname : `${pathname}/`;+ if (routes.some(entry => entry.route === route)) {+ req.url = `${base}index.html${request.search}`;+ }+ next();+ });+ },+ configurePreviewServer(server) {+ // Vite's MPA preview returns an empty 404 by default. Serve the same+ // document that a static host serves for an unknown deep link.+ server.middlewares.use((req, res, next) => {+ if (req.method !== 'GET') return next();+ const pathname = new URL(req.url || '/', 'http://localhost').pathname;+ if (!pathname.startsWith(base)) return next();+ const output = path.join(appDir, 'out');+ const file = path.resolve(output, pathname.slice(base.length));+ if (file !== output && !file.startsWith(`${output}${path.sep}`)) {+ return next();+ }+ if (fs.existsSync(file)) {+ const stat = fs.statSync(file);+ if (+ stat.isFile() ||+ (stat.isDirectory() && fs.existsSync(path.join(file, 'index.html')))+ ) {+ return next();+ }+ }+ res.statusCode = 404;+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');+ res.end(fs.readFileSync(path.join(output, '404.html')));+ });+ },+ buildEnd(error) {+ if (error) failed = true;+ },+ resolveId(source) {+ if (source === 'virtual:sandbox-routes') return id;+ },+ load(source) {+ if (source !== id) return;+ return `export const routes = [\n${routes+ .map(+ ({route, group, file, slug}) =>+ `{route:${JSON.stringify(route)},group:${JSON.stringify(group)},${slug ? `slug:${JSON.stringify(slug)},` : ''}load:()=>import(${JSON.stringify(file)})}`,+ )+ .join(',\n')}\n];`;+ },+ closeBundle() {+ if (!isBuild || failed || exported) return;+ const output = path.join(appDir, 'out');+ const index = fs.readFileSync(path.join(output, 'index.html'), 'utf8');+ if (!index.includes('<div id="root"></div>')) {+ throw new Error(+ 'Refusing to export routes from a stale/non-Vite index.html',+ );+ }+ exported = true;+ for (const {route} of routes) {+ if (route === '/') continue;+ const destination = path.join(output, exportedHtmlPath(route));+ fs.mkdirSync(path.dirname(destination), {recursive: true});+ fs.writeFileSync(destination, index);+ }+ // GitHub Pages serves this on unknown paths with HTTP 404; no unknown+ // route is exported and there is no catch-all to turn failures into 200s.+ const notFound = `<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>404: Page not found</title></head><body><h1>Page not found</h1><a href="${base}">Sandbox home</a></body></html>`;+ fs.writeFileSync(path.join(output, '404.html'), notFound);+ fs.mkdirSync(path.join(output, '404'), {recursive: true});+ fs.writeFileSync(path.join(output, '404/index.html'), notFound);+ console.log(+ `Exported ${routes.length} Sandbox HTML routes plus /404/ (${base})`,+ );+ },+ };+}++// Lexical's source export contains declare fields; use the built ESM entry+// for browser builds while preserving its environment-selecting wrapper.+const require = createRequire(import.meta.url);+function lexicalDist(): string | undefined {+ try {+ let directory = path.dirname(require.resolve('lexical'));+ while (path.basename(directory) !== 'lexical') {+ const parent = path.dirname(directory);+ if (parent === directory) return;+ directory = parent;+ }+ return path.join(directory, 'dist/Lexical.mjs');+ } catch {+ return;+ }+}++export default defineConfig({+ base,+ appType: 'mpa',+ plugins: [+ ...astryxStylex({+ // Use built Astryx packages, as the Next export did: library CSS already+ // carries its compiled atoms and theme layers. Compile only Sandbox and+ // template source with StyleX; don't alias package CSS/locales into src/.+ stylexOptions: {+ dev: process.env.NODE_ENV !== 'production',+ runtimeInjection: false,+ treeshakeCompensation: true,+ classNamePrefix: 'p',+ aliases: {+ '@astryxdesign/core/theme/tokens.stylex': [+ path.join(+ appDir,+ 'node_modules/@astryxdesign/core/src/theme/tokens.stylex.ts',+ ),+ ],+ },+ unstable_moduleResolution: {type: 'commonJS', rootDir: appDir},+ },+ stylexPrefix: 'x',+ }),+ react({+ babel: {+ // Never inherit the app's old Next Babel preset while Vite is+ // compiling templates and built packages.+ babelrc: false,+ configFile: false,+ plugins: [+ [+ path.join(appDir, 'scripts/rewrite-template-asset-paths.cjs'),+ {+ basePath: templateAssetBase(+ basePath,+ process.env.SANDBOX_TEMPLATE_ASSETS_BASE_PATH,+ ),+ },+ ],+ ],+ },+ }),+ staticRoutes(),+ ],+ resolve: {+ ...(process.env.ASTRYX_SOURCE === '1' ? {conditions: ['source']} : {}),+ alias: {+ '@': path.join(appDir, 'src'),+ // The app owns the Babel helpers emitted while compiling its template+ // modules; pnpm does not hoist them to each sibling workspace package.+ '@babel/runtime': path.join(appDir, 'node_modules/@babel/runtime'),+ ...(lexicalDist() ? {lexical: lexicalDist()} : {}),+ },+ },+ build: {+ outDir: 'out',+ emptyOutDir: true,+ cssCodeSplit: false,+ },+});diff --git a/packages/cli/test/doc-routes.ids.json b/packages/cli/test/doc-routes.ids.jsonindex fde577ab42..e854074acb 100644--- a/packages/cli/test/doc-routes.ids.json+++ b/packages/cli/test/doc-routes.ids.json@@ -723,6 +723,12 @@"RadioListWithValidation","ResizableShowcase","ResizableSidebar",+ "ScrollableAreaInlineRail",+ "ScrollableAreaOverscrollChaining",+ "ScrollableAreaShowcase",+ "ScrollableAreaStickyGroupHeaders",+ "ScrollableAreaStickyPassthrough",+ "ScrollableAreaTwoAxisBoard","SectionVariants","SectionWashHighlight","SectionWithDividers",diff --git a/packages/cli/test/doc-routes.json b/packages/cli/test/doc-routes.jsonindex 216a2b8e96..c00598ddfc 100644--- a/packages/cli/test/doc-routes.json+++ b/packages/cli/test/doc-routes.json@@ -3026,7 +3026,7 @@"kind": "block","id": "@astryxdesign/core/block","provider": "@astryxdesign/core",- "count": 650,+ "count": 656,"oldCliRoute": "astryx template <id> --type block","oldDocsiteUrl": null,"placement": "generated:@astryxdesign/core/block",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a6f8a0d608..b5c0a7a532 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -351,15 +351,15 @@ importers:'@stylexjs/stylex':specifier: 'catalog:'version: 0.19.0- next:- specifier: ^15.5.21- version: 15.5.22(@babel/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])react:specifier: ^19.2.7version: 19.2.7react-dom:specifier: ^19.2.7version: 19.2.7([email protected])+ react-router-dom:+ specifier: ^7.18.4recharts:specifier: ^3.9.2version: 3.9.2(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])@@ -367,18 +367,15 @@ importers:'@astryxdesign/build':specifier: '*'version: link:../../packages/build- '@babel/preset-react':- specifier: 'catalog:'- version: 7.29.7(@babel/[email protected])- '@babel/preset-typescript':- specifier: 'catalog:'- version: 7.29.7(@babel/[email protected])+ '@babel/runtime':+ specifier: ^7.29.7+ version: 7.29.7'@stylexjs/babel-plugin':specifier: 'catalog:'version: 0.19.0- '@stylexjs/postcss-plugin':- specifier: 'catalog:'- version: 0.19.0+ '@stylexjs/unplugin':+ specifier: ^0.19.0+ version: 0.19.0([email protected]([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))'@types/node':specifier: ^25.9.3version: 25.9.4@@ -388,12 +385,18 @@ importers:'@types/react-dom':specifier: ^19.2.3version: 19.2.3(@types/[email protected])+ '@vitejs/plugin-react':+ specifier: ^5.2.0+ version: 5.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))commander:specifier: ^12.1.0version: 12.1.0typescript:specifier: ^6.0.3version: 6.0.3+ vite:+ specifier: 'catalog:'+ version: 8.1.3(@types/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: ^4.1.9version: 4.1.10(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))@@ -2323,43 +2326,21 @@ packages:'@emnapi/core': ^1.7.1'@emnapi/runtime': ^1.7.1- '@next/[email protected]':- resolution: {integrity: sha512-O5BlKb3KtsHkvO0gjjV66PuJnAgCtIEIzwkt50HRAHsQkU1t77eksIXSZV84/WMtZJjWrnDUPKHVRi0D62nSAA==}-'@next/[email protected]':resolution: {integrity: sha512-XqdVR0utAWMsVc1OIyO48D32vrdmC4/uAgI3Ds088YlOO4vfGKXXVyvkGFkOZkOK0xg7bNYNfJAarX4A0tYqGg==}- '@next/[email protected]':- resolution: {integrity: sha512-/VISwtffSg8+fVvBbXdglsvruCsdbBC4dG25iU6xascKVqfQKsj/OtjGnOEkIS7pX5GB9e9/r5QprpicsGL3gw==}- engines: {node: '>= 10'}- cpu: [arm64]- os: [darwin]-'@next/[email protected]':resolution: {integrity: sha512-PPWAJGoIkzVpz5hOD9V/qGNdkBuWj3QXhjQU8BQ1FXlMy6xsy4+aD/3UoasKy/HYInW4h1LqdQtDhiQkLYrrMA==}engines: {node: '>= 10'}cpu: [arm64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-NiA9ve8hbiuhG/Q17a2mZDRVxMTtg3rTOgjLnDaLlE+AEPAQlkkuKrfePEbeOrgYmX0U2KGX4EVEn09hXU5GlQ==}- engines: {node: '>= 10'}- cpu: [x64]- os: [darwin]-'@next/[email protected]':resolution: {integrity: sha512-UPN/RS1H+kr9fgJrbFoH7bs1b9q2/G5cFe+uUf0nP4Hlgfl8NzfTBHEJKTfLAGqi1Qemwuyd29pvRy2vwEjL5g==}engines: {node: '>= 10'}cpu: [x64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-vAPa9vltW+UW/KWtjXeSUFgV3wb1x9d/BeyC6WFI6eBpL0D2f70oGwtOp6193mNW3qusrpgBzMQferPf+Zh8Dw==}- engines: {node: '>= 10'}- cpu: [arm64]- os: [linux]- libc: [glibc]-'@next/[email protected]':resolution: {integrity: sha512-kh+bKgk9ZIlmxMkEPnQZXtKc7/AyUyIS9jXgbKt4hWyxXEEZVDmXhiU2bh1zZpthMr/l09wz9z6CvfXtCWUJBA==}engines: {node: '>= 10'}@@ -2367,13 +2348,6 @@ packages:os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-iknK80pWlNDnkdSr13bd8mMuG3Z2oTxODwsZHvuMY7caMk77+rBLdHVWsy8v2EVa3ZojJ/+wJX5fnq8va6Gv8A==}- engines: {node: '>= 10'}- cpu: [arm64]- os: [linux]- libc: [musl]-'@next/[email protected]':resolution: {integrity: sha512-m09/acXFGhlp+U6m7Wn0AqsmLqars3qI9eBXDpPJm4h/XVS9HPHNzWGy2BI7F1iLoFX59Uy0tcau9ey7JVud3w==}engines: {node: '>= 10'}@@ -2381,13 +2355,6 @@ packages:os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-penuEdkwU2OOAiS+n4LE8T/VIoCfAI01QcLZTJ2xc3+l4Q22L/DzURocmI2LU1b+8BMQoLAP1Sze3uYAZT05Bg==}- engines: {node: '>= 10'}- cpu: [x64]- os: [linux]- libc: [glibc]-'@next/[email protected]':resolution: {integrity: sha512-/EBiqRjLZJWJo6Keq9upJfhrP+tNpePy1beBfOL+tUn68inwNiJEjx+0Lgve99Zur8kSk9TgSmDmwgQxX4iM+g==}engines: {node: '>= 10'}@@ -2395,13 +2362,6 @@ packages:os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-ZM0BKJm3FZ+guG6WT6PcyOLtp6paZ5tngcJC/uUKvLW4Y0TQnnVi1+UGdo8Q6Yxp5gaS82pmC1rD/oFlhkWB3g==}- engines: {node: '>= 10'}- cpu: [x64]- os: [linux]- libc: [musl]-'@next/[email protected]':resolution: {integrity: sha512-lUCiPFoecSGkM8aeY6UAgQDiJjR3DhPsI036mznlHFg89ZLoeRdo521N4nmk6EpbPpNzRujgiboBkbuyexDgCg==}engines: {node: '>= 10'}@@ -2409,24 +2369,12 @@ packages:os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-rY/YaumrZaS0//94BnHLF5VSRp0GFUO4GvXNuoCBb0cGSci96yO+p1JaNL2aq9YZAYv9cuZRziV02x5IQH/wjg==}- engines: {node: '>= 10'}- cpu: [arm64]- os: [win32]-'@next/[email protected]':resolution: {integrity: sha512-Nr4e3dRB86gElIgysL/L7dr9tuRLIq3looK8hLxnYDLUvLza2Tu/7Ik/X6DSRGejIrbZsYjnH3S4xYeAAf7Prw==}engines: {node: '>= 10'}cpu: [arm64]os: [win32]- '@next/[email protected]':- resolution: {integrity: sha512-s5IA4cyrbR2XK/5NWcu5dp8CfPBiKME+UhvNperia7uQybEgg5+LIhGMiY37WQE4rcI4owsDcU4IVUjLoTuDkA==}- engines: {node: '>= 10'}- cpu: [x64]- os: [win32]-'@next/[email protected]':resolution: {integrity: sha512-Svg+VCRUbyNsBuh96hN+1ael8dNXqVQVZqOe9tqFlF4mUzIk5CQFcn5VsZPrz8GNP9HCxJfrfy3PM0cXoSXliw==}engines: {node: '>= 10'}@@ -4347,6 +4295,10 @@ packages:resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==}engines: {node: '>= 0.10'}@@ -5495,10 +5447,6 @@ packages:resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==}- resolution: {integrity: sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==}- engines: {node: 20 || >=22}-resolution: {integrity: sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==}engines: {node: 20 || >=22}@@ -5645,27 +5593,6 @@ packages:resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}- resolution: {integrity: sha512-mrtal1sRxO4YrlDS98sDuIvGZivKbFix8w7oAL9ZynfOgc3cADQOQgvwtMooc18Qr8bKzvQAcHwHZ0mbJ7zcfQ==}- engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}- hasBin: true- peerDependencies:- '@opentelemetry/api': ^1.1.0- '@playwright/test': ^1.51.1- babel-plugin-react-compiler: '*'- react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0- react-dom: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0- sass: ^1.3.0- peerDependenciesMeta:- '@opentelemetry/api':- optional: true- '@playwright/test':- optional: true- babel-plugin-react-compiler:- optional: true- sass:- optional: true-resolution: {integrity: sha512-I5rVC4VcvAL1FPr6AY5WEQUSe6o1Bt0Oa/qH5hfPhci4FRMCPeAQ95tgxFOgJDk2wME1K009k0bjS17nQ0Bq1w==}engines: {node: '>=20.9.0'}@@ -6064,6 +5991,23 @@ packages:'@types/react':optional: true+ resolution: {integrity: sha512-yrfmJHIpDG7taCpqKjT1G5B6q3O2K+RN8/fgNf0lTjCwiPbQ0ei6vXX9ZjQR+7ld8Tr7Z5xmyMnZ8YJrphWQUw==}+ engines: {node: '>=20.0.0'}+ peerDependencies:+ react: '>=18'+ react-dom: '>=18'++ resolution: {integrity: sha512-PUPQcMhMGRAslLcvtlPz/kmzBEWPhLdgLFrL7pLNepBL6dX0lWj4WD2cUYVgYCuT3jxvghYFg81cDTj44DhetQ==}+ engines: {node: '>=20.0.0'}+ peerDependencies:+ react: '>=18'+ react-dom: '>=18'+ peerDependenciesMeta:+ react-dom:+ optional: true+resolution: {integrity: sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==}engines: {node: '>=10'}@@ -6213,6 +6157,9 @@ packages:resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==}engines: {node: '>= 18'}+ resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==}+resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}@@ -7084,7 +7031,7 @@ snapshots:bidi-js: 1.0.3css-tree: 3.2.1is-potential-custom-element-name: 1.0.1- lru-cache: 11.5.1+ lru-cache: 11.5.2'@asamuzakjp/[email protected]': {}@@ -8384,55 +8331,29 @@ snapshots:'@tybys/wasm-util': 0.10.3optional: true- '@next/[email protected]': {}-'@next/[email protected]': {}- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true- '@next/[email protected]':- optional: true-'@next/[email protected]':optional: true@@ -10148,6 +10069,8 @@ snapshots:+ [email protected]: {}+dependencies:object-assign: 4.1.1@@ -10184,7 +10107,7 @@ snapshots:'@asamuzakjp/css-color': 4.1.2'@csstools/css-syntax-patches-for-csstree': 1.1.6([email protected])css-tree: 3.2.1- lru-cache: 11.5.1+ lru-cache: 11.5.2@@ -11325,8 +11248,6 @@ snapshots:- [email protected]: {}-@@ -11454,31 +11375,6 @@ snapshots:- [email protected](@babel/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]):- dependencies:- '@next/env': 15.5.22- '@swc/helpers': 0.5.15- caniuse-lite: 1.0.30001800- postcss: 8.5.25- react: 19.2.7- react-dom: 19.2.7([email protected])- styled-jsx: 5.1.6(@babel/[email protected])([email protected])- optionalDependencies:- '@next/swc-darwin-arm64': 15.5.22- '@next/swc-darwin-x64': 15.5.22- '@next/swc-linux-arm64-gnu': 15.5.22- '@next/swc-linux-arm64-musl': 15.5.22- '@next/swc-linux-x64-gnu': 15.5.22- '@next/swc-linux-x64-musl': 15.5.22- '@next/swc-win32-arm64-msvc': 15.5.22- '@next/swc-win32-x64-msvc': 15.5.22- '@playwright/test': 1.61.1- sharp: 0.35.3(@types/[email protected])- transitivePeerDependencies:- - '@babel/core'- - '@types/node'- - babel-plugin-macros-[email protected](@babel/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]):dependencies:'@next/env': 16.3.0-preview.5@@ -11885,6 +11781,20 @@ snapshots:optionalDependencies:'@types/react': 19.2.17+ dependencies:+ react: 19.2.7+ react-dom: 19.2.7([email protected])++ dependencies:+ cookie: 1.1.1+ react: 19.2.7+ set-cookie-parser: 2.7.2+ optionalDependencies:+ react-dom: 19.2.7([email protected])+dependencies:get-nonce: 1.0.1@@ -12104,6 +12014,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+diff --git a/vitest.global-setup.node.mjs b/vitest.global-setup.node.mjsindex 92740b40a1..8c9dbf89ff 100644--- a/vitest.global-setup.node.mjs+++ b/vitest.global-setup.node.mjs@@ -2,21 +2,33 @@/*** @file globalSetup for the `node` test project.- * @input Uses the shared ensureCoreBuilt helper.- * @output Builds @astryxdesign/core once, before any test worker forks.+ * @input Shared ensureCoreBuilt helper and authored Sandbox template descriptors.+ * @output Builds Core and regenerates the Sandbox template registry and route+ * wrappers once, before any test worker forks.* @position Referenced by vitest.config.ts's `node` project. The build-theme- * suites need a compiled @astryxdesign/core (`astryx theme build` imports its- * compiled theme entry). Building here — once, in the main process, before- * Vitest spawns parallel workers — means every suite's beforeAll sees dist- * already present and short-circuits, so no two workers ever clean and build- * core concurrently. That collision is what nondeterministically broke a- * build-theme suite under Vitest 4's reworked pool scheduling ("Could not resolve dist/index.js").+ * suites need a compiled Core; the Sandbox route contract imports generated+ * template metadata and scans ignored wrappers that do not exist in a fresh+ * checkout. Run both prerequisites here, serially and before the test workers,+ * rather than depending on an unrelated build job or local generated files.** SYNC: When modified, update this header.*/+import {execFileSync} from 'node:child_process';+import {fileURLToPath} from 'node:url';import {ensureCoreBuilt} from './packages/cli/clients/cli/commands/ensure-core-built.mjs';export default function setup() {ensureCoreBuilt();+ // The ignored registry and ~700 physical page wrappers are build outputs,+ // not fixtures to check in. The route-manifest test must see the same inputs+ // as `pnpm -F @astryxdesign/sandbox build` on a clean CI checkout.+ execFileSync(+ process.execPath,+ [fileURLToPath(new URL('./scripts/sync-templates.js', import.meta.url))],+ {+ cwd: fileURLToPath(new URL('.', import.meta.url)),+ maxBuffer: 32 * 1024 * 1024,+ },+ );}