Methane Architecture
Methane separates pure-CSS layouts from interactive custom elements and enforces a strictly layered dependency graph (verified statically by @methane-ui/lint-plugin) so packages stay modular and tree-shakeable.
Layered Package Graph
- Layer 0a — @methane-ui/tokens
- W3C DTCG JSON compiled into
--mth-*CSS custom properties usingoklch(),light-dark(), density scaling, andforced-colors. - Layer 0b — @methane-ui/css
- Pure-CSS layout, prose, form, and marketing classes wrapped in
@layer mth.primitivesusing CSS Logical Properties only. - Layer 0c — @methane-ui/sanitize
- Native
Element.prototype.setHTML()with bundled DOMPurify parity fallback and Trusted Types support (ADR-012). - Layer 1a — @methane-ui/core
- Lit 3 + human-owned
UIElementbase class, versionedglobalThis[Symbol.for('@methane-ui/runtime')]singleton, i18n message catalog, and Community Context Protocol. - Layer 1b — @methane-ui/primitives
- Shared behavioral controllers, headless cores (
TableCore,CalendarCore), stores, and accessibility utilities. - Layer 2 — @methane-ui/ui
- Declarative-first core UI custom elements exported as per-tag subpaths and side-effect-free element classes.
- Layer 3a — Domain Kits
- Composite domain elements across
@methane-ui/ai,auth,admin,chat, andcommerce. - Layer 3b — Satellites
- Wrap-first heavy packages (TanStack Table/Virtual, Apache ECharts, ProseMirror, CodeMirror 6, MapLibre, pdf.js, Three.js) with lazy client engines.
Quality Gates
- Machine-readable
<tag>.spec.tsauthored before implementation (ADR-014). - 5 Class Conformance Suites +
SatelliteEngineSuite+HydrationPuritySuite. - Mechanical ESLint + Stylelint invariants via
@methane-ui/lint-plugin.
See ADRs 001–015 for full architectural decision rationale.