| Filename | Latest commit message | Latest commit date |
|---|---|---|
* feat(web): add View Source toggle to resource preview (closes #1552) Markdown, CSV, and HTML resources render in a way that hides the underlying text (react-markdown, the CSV table, the sandboxed HTML iframe). Add a "View Source" button to the resource preview footer, left of Refresh and styled to match it, that swaps the rendered preview for the raw resource text. In source mode the button reads "View Rendered". - Only shown for markdown/csv/html (other kinds already show their text, or have no meaningful text source). - Source mode forces ContentViewer through its plain-text renderer; the displayed MIME label keeps the resource's real type. - The toggle resets to the rendered view when the previewed resource changes (React's adjust-state-during-render pattern — no effect). Tests cover the toggle round-trip, per-kind visibility, and the reset; a Storybook play function exercises rendered → source → rendered. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(web): address View Source review nits (#1553) - Per-item source gating: in source mode only source-toggleable items switch to plain text, so a mixed multi-part resource doesn't force an image/PDF blob through the text decoder. - Share a FooterButton constant between Refresh and the View Source toggle so the two stay visually identical (per the subcomponent guidance — both had the same two inline props). - Add aria-pressed to the toggle so assistive tech gets explicit on/off state beyond the label flip. Tests added for the aria-pressed state and the mixed multi-part case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
| .. | ||
| .storybook | ||
| public | ||
| server | ||
| src | ||
| static | ||
| .gitignore | ||
| chromatic.config.json | ||
| eslint.config.js | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| tsconfig.storybook.json | ||
| tsconfig.test.json | ||
| tsup.runner.config.ts | ||
| vite.config.ts | ||
| vitest.shims.d.ts | ||
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])