Skip to content

Feat/theming on docs and lib#49

Merged
gitsad merged 10 commits into
mainfrom
feat/theming-on-docs-and-lib
Jul 9, 2026
Merged

Feat/theming on docs and lib#49
gitsad merged 10 commits into
mainfrom
feat/theming-on-docs-and-lib

Conversation

@gitsad

@gitsad gitsad commented Jul 9, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds a first-class, opt-in theming system shared across the web and React Native renderers, and makes the demo app fully themeable and mobile-responsive.

Library

  • New theme prop on MdmaDocument (both renderers): "light" | "dark" | "auto" (follows the OS) or a full MdmaTheme token object. Omit it for the unchanged default light look — fully backward compatible.
  • Web renderer: styles.css is now driven by --mdma-* CSS variables; built-in palettes apply via data-theme, custom themes via inline variables (and are overridable directly in CSS). Exposes MdmaThemeProvider, useMdmaTheme, lightTheme, darkTheme, and helpers. A themeless MdmaDocument inherits an ancestor MdmaThemeProvider's theme.
  • Web renderer polish: a custom dark theme now picks the correct light/dark base (by background luminance) so internal colors (headings, code) stay readable; button hover + input focus ring derive from the accent via color-mix.
  • React Native renderer: theme="auto" via useColorScheme(); the built-in lightTheme/darkTheme palettes are unified with the web renderer's so MDMA content looks identical across platforms; fixed TableRenderer/ChartRenderer whose bodies had no themed background (rows showed through on dark).
  • Both renderers share the same MdmaTheme shape, so a theme object is portable.

Demo app

  • Header light/dark/auto toggle that themes the whole app (chrome, nav bar, docs side nav, and all live examples).
  • New Theming docs page with a live theme editor (5 color pickers — accent/background/text/muted/border — re-rendering components instantly).
  • Docs restructure: Renderers (React, React Native) and Integrations nav groups; generalized the Components catalog; removed the renderer package from the Packages list.
  • Mobile responsive across every route, with a hamburger nav drawer + breadcrumb trail on mobile, and thinner theme-aware scrollbars.

Docs: new docs/guides/theming.md; README + RN package README updated.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation

Packages Affected

  • @mobile-reality/mdma-renderer-react
  • @mobile-reality/mdma-renderer-react-native
  • Demo app (@mobile-reality/mdma-demo) + docs

Checklist

  • I have read the CONTRIBUTING guide.
  • My code follows the existing code style (pnpm format and pnpm lint pass).
  • I have added or updated tests that cover my changes.
  • All tests pass (pnpm test).
  • Type-checking passes (pnpm typecheck).
  • I have added a changeset (pnpm changeset) if this change affects published packages.
  • New or changed MDMA schemas are backwards-compatible (or marked as breaking). — N/A, no schema changes
  • Sensitive fields are marked with sensitive: true where appropriate. — N/A

How to Test

  1. pnpm install && pnpm demo, open the demo.
  2. Use the ☀️ / 🌙 / 🖥️ toggle in the header — the whole app (chrome + all live examples) switches theme.
  3. Go to Docs → Theming and use the live editor: change the 5 color pickers and watch the components (and their hover/focus states) update; toggle light/dark to reset.
  4. Visit Docs → React Native — the RN preview (via react-native-web) uses the same unified palette; try dark mode and the Adoption table example (body themes correctly).
  5. Custom theme in code: <MdmaDocument ast={ast} store={store} theme={myTheme} /> (spread lightTheme/darkTheme and override tokens); or set --mdma-* CSS variables directly.
  6. Resize to a phone width (~390px): docs side nav becomes a hamburger drawer + breadcrumb; all routes stack with no horizontal scroll.
  7. pnpm typecheck && pnpm test && pnpm lint — all green.

@gitsad gitsad merged commit 1e6887e into main Jul 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants