mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
typescript 7.0.2 is the native compiler and exports no JavaScript API, so next, ts-jest and typescript-eslint cannot read it. It comes in aliased as tsgo and does the typechecking; typescript stays on the 6 line for those tools. Four settings the native compiler removed move with it. baseUrl is gone, so every tsconfig that used it spells its own root as a "*" path; the shared base config's @safe-global/* paths were only correct because baseUrl re-rooted them, and now name the real directories from where they are written. moduleResolution node10 becomes bundler, downlevelIteration goes (it was a no-op at target esnext), and apps/web declares '*.css' and '*.md'. Two sources follow: the faker import drops its trailing '/.', and the IntersectionObserver mock gains scrollMargin. All eight packages report 0 diagnostics before and after, identical on 6.0.3 and 7.0.2. Co-authored-by: Hanzo Dev <[email protected]>
@safe-global/theme
Unified theme package for Safe Wallet web and mobile applications.
Overview
This package provides a single source of truth for all design tokens (colors, spacing, typography, etc.) used across the Safe Wallet monorepo. It exports platform-specific theme generators for:
- Web: MUI themes and CSS custom properties
- Mobile: Tamagui tokens and themes
Installation
This is a workspace package used internally by the monorepo:
{
"dependencies": {
"@safe-global/theme": "workspace:^"
}
}
Usage
Web (MUI + CSS vars)
import { generateMuiTheme } from '@safe-global/theme'
const theme = generateMuiTheme('light')
// or
const darkTheme = generateMuiTheme('dark')
Mobile (Tamagui)
import { generateTamaguiColorTokens, generateTamaguiFontSizes } from '@safe-global/theme'
const colorTokens = generateTamaguiColorTokens()
const fontSizes = generateTamaguiFontSizes()
Direct Token Access
import { spacingMobile, spacingWeb, radius, typography } from '@safe-global/theme/tokens'
Design Tokens
Colors
Unified color palette with light and dark modes:
- Semantic colors: text, primary, secondary, border, error, success, info, warning
- Background colors with variants
- Static colors (theme-independent)
Spacing
Two spacing systems for platform compatibility:
- Mobile: 4px base ($1=4px, $2=8px, $3=12px, ...)
- Web: 8px base (space-1=8px, space-2=16px, space-3=24px, ...)
- Where values overlap, same variable name is used
Typography
- Font family: DM Sans
- Font sizes: 1-16 (11px to 134px)
- Typography variants: h1-h5, body1/body2, caption, overline
Border Radius
Radius scale from 0-12 (0px to 50px)
Development
# Run tests
yarn test
# Type check
yarn type-check
# Lint
yarn lint
yarn lint:fix
# Format
yarn prettier
yarn prettier:fix
Architecture
src/palettes/- Color palette definitionssrc/tokens/- Design token definitions (spacing, typography, etc.)src/generators/- Platform-specific theme generatorssrc/utils/- Utility functions
For more details, see the implementation plan and source code.