diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md new file mode 100644 index 00000000..e77c0f2e --- /dev/null +++ b/docs/MIGRATION.md @@ -0,0 +1,111 @@ +# Migration Guide + +Human-readable migration instructions for Stellar Dev Dashboard component library changes. +The interactive version with before/after code examples lives in Storybook: +**Design System / Migration**. + +Full changelog: `docs/api/CHANGELOG.md`. + +--- + +## Version History + +### v0.1.0 (June 2025) — Initial Release + +First public release. No migration required. + +**Added:** +- Dashboard shell: Sidebar, MobileHeader, MobileSidebar, DashboardGrid +- Core components: Card, StatCard, CopyableValue, ThemeToggle +- Chart suite: NetworkMetricsChart, BalanceHistoryChart, AccountActivityChart +- Accessibility: AccessibilitySettings, ScreenReaderAnnouncer, KeyboardNavigation +- Network: NetworkIndicator, OfflineBanner, RetryButton +- Assets: AssetCard, AssetDiscovery +- Forms: ValidatedInput +- Design system: tokens, colors, spacing, typography, variants +- Storybook 8.5 with a11y, viewport addons, and dark/light theme toolbar + +--- + +## Breaking Changes + +No breaking changes in v0.1.0. + +Future breaking changes will be documented here with migration steps and, where possible, +a codemod command. + +--- + +## Active Migration Tracks + +### JavaScript → TypeScript + +The codebase is migrating from `.jsx` to `.tsx`. New components **must** be TypeScript. + +**Steps for converting an existing component:** + +1. Rename the file from `.jsx` to `.tsx`. +2. Add prop types using interfaces from `src/types/components.ts` where they exist. +3. Run `npm run type-check` to surface type errors. +4. Fix errors — the `tsconfig.json` has `allowJs: true` so no config changes are needed. +5. Update any `.stories.tsx` imports if the file extension changed. + +```ts +// src/types/components.ts — add your interface +export interface MyComponentProps { + title: string; + onAction?: () => void; +} + +// src/components/dashboard/MyComponent.tsx +import type { MyComponentProps } from '../../types/components'; + +export default function MyComponent({ title, onAction }: MyComponentProps) { … } +``` + +--- + +### Inline Styles → CSS Custom Properties + +Components should use `var(--token)` rather than hard-coded hex values. + +```jsx +// ❌ Before +
{name}
+ {value}
+
+ Import from{' '}
+
+ src/design-system/colors
+ {' '}
+ or access via CSS custom properties (
+ var(--cyan),{' '}
+ var(--bg-card),
+ etc.) in inline styles.
+
+ These are the CSS variables set in{' '}
+ src/styles/globals.css{' '}
+ and switched by the{' '}
+ data-theme attribute.
+
+ {token}
+
+ {desc}
+
+ Import from{' '}
+ src/design-system/spacing.
+ Use the scale keys (xs → xxl) in component styles. Prefer tokens over arbitrary pixel values.
+
+ {key}
+
+
+
+ {value}
+
+
+ Import from{' '}
+ src/design-system/typography.
+
+ typography.fontFamily.{key}
+
+ {value}
+ {key}
+ Aa
+ {value}
+ {key}
+
+ The quick brown fox
+
+ {value}
+
+ Use via{' '}
+ tokens.radii.* or
+ CSS variables{' '}
+ var(--radius-sm),{' '}
+ var(--radius-md),
+ etc.
+
{key}
+ {value}
+
+ Use these values for consistent animation durations and easing. Respect{' '}
+ prefers-reduced-motion —
+ disable or simplify transitions when this media query is active.
+
+ Defined in{' '}
+ src/design-system/variants.ts.
+ Variants are composed from token references so they stay in sync when tokens change.
+
+ {token}
+
+ ))}
+ + The dashboard targets WCAG 2.1 AA. These guidelines apply to all new components. + Full validation requires manual testing with assistive technologies and expert review. +
+ + {[ + { + title: 'Keyboard Navigation', + items: [ + 'All interactive elements are reachable by Tab.', + 'Enter / Space activate buttons and links.', + 'Escape closes modals, sheets, and dropdowns.', + 'Arrow keys navigate lists, menus, and grids.', + 'Ctrl+K opens the command palette from anywhere.', + ], + }, + { + title: 'Screen Reader Support', + items: [ + 'Meaningful aria-label on icon-only buttons.', + 'aria-live="polite" for async state changes (loading, errors, success).', + 'Landmark regions:+
A real-time, open-source developer dashboard for the Stellar network. + Stack: React 18 · Vite 5 · TypeScript · Zustand · Recharts · Storybook 8.5 +
++ Components use CSS custom properties for theming — switch Dark/Light with the toolbar above. + axe-core accessibility checks run automatically on every story.
| Group | +Story Group | Components | +Source |
|---|---|---|---|
| {group} | {components} | +{source} |
{code}
+
+ {code}
+
+);
+
+// ─── Version History ──────────────────────────────────────────────────────────
+
+export const VersionHistory: StoryObj = {
+ name: 'Version History',
+ render: () => {
+ const versions = [
+ {
+ version: '0.1.0',
+ date: 'Jun 2025',
+ summary: 'Initial release — dashboard shell, layout system, core components.',
+ changes: [
+ { type: 'new' as const, description: 'Dashboard shell: Sidebar, MobileHeader, MobileSidebar, DashboardGrid' },
+ { type: 'new' as const, description: 'Core components: Card, StatCard, CopyableValue, ThemeToggle' },
+ { type: 'new' as const, description: 'Chart suite: NetworkMetricsChart, BalanceHistoryChart, AccountActivityChart' },
+ { type: 'new' as const, description: 'Accessibility: AccessibilitySettings, ScreenReaderAnnouncer, KeyboardNavigation' },
+ { type: 'new' as const, description: 'Network: NetworkIndicator, OfflineBanner, RetryButton' },
+ { type: 'new' as const, description: 'Assets: AssetCard, AssetDiscovery' },
+ { type: 'new' as const, description: 'Forms: ValidatedInput (D-027)' },
+ { type: 'new' as const, description: 'Design system: tokens, colors, spacing, typography, variants' },
+ { type: 'new' as const, description: 'Storybook 8.5 with a11y, viewport addons and dark/light theme toolbar' },
+ ],
+ },
+ ];
+
+ const typeChip = (t: 'new' | 'break' | 'fix' | 'dep') => {
+ const map = { new: ['green', 'New'], break: ['red', 'Breaking'], fix: ['cyan', 'Fix'], dep: ['amber', 'Deprecated'] } as const;
+ return
+ Full changelog is also available at{' '}
+ docs/api/CHANGELOG.md.
+
+ v{v.version}
+
+ {v.date}
+ {v.summary}
+ + This section documents breaking changes that require code changes in consuming code. + Follow the migration steps below each entry before upgrading. +
+ + {/* Placeholder for future breaking changes — shown as "no breaking changes yet" */} +
+ v0.2.0 · Card
+
+ glow prop
+ on Card will be renamed to{' '}
+ highlighted.
+
+ npx codemod stellar-card-glow-to-highlighted
+ {' '}
+ to automate the rename.
+ + {description} +
+
+ The overall build target is 500 KB gzipped (enforced in CI via{' '}
+ scripts/check-coverage.mjs).
+ Large components are code-split with{' '}
+ React.lazy().
+ Sizes below are per-component estimates excluding shared chunks (Recharts, stellar-sdk, etc. are bundled once).
+
+ {row.component}
+
+
+ {row.gzip}
+
+
+ {row.status}
+
+ {row.note}
+
+ Measured with{' '}
+ React.Profiler{' '}
+ in development builds on a mid-range device. Production builds are faster due to minification and
+ disabled dev warnings. Run{' '}
+ npm run test:lighthouse for
+ full Lighthouse metrics.
+
+ {budget}
+
+
+ {ex}
+
+ ))}
+
+ {code}
+
+