This commit is contained in:
2025-12-27 18:25:15 +03:00
parent 63a9425680
commit fde5f9de58
23 changed files with 688 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Theming (theme/platform/skin)
Tria UI использует три измерения конфигурации:
- `theme`: `light | dark`
- `platform`: `web | vk | tg`
- `skin`: `web | ios | android`
Комбинация управляет *CSS пресетами* и компонентными токенами.
## UIProvider
```tsx
import { UIProvider } from "@tria/ui";
<UIProvider config={{ theme: "dark", platform: "vk", skin: "ios" }}>
...
</UIProvider>
```
UIProvider устанавливает `data-theme`, `data-platform`, `data-skin` на `document.documentElement`
(или на `config.root`), и может применить `config.vars` — набор CSS variables.
## Runtime switching
```tsx
const [theme, setTheme] = useState<"light"|"dark">("dark");
<UIProvider config={{ theme, platform, skin }} />
```
## Which combos matter
- `platform="vk" + skin="ios"` — VK iOSвид (Cupertinoощущение)
- `platform="vk" + skin="android"` — VK Androidвид (Materialощущение)
- `platform="tg"` — более “telegramui” акценты
- `platform="web"` — нейтральный web preset
## Troubleshooting
Если визуально не меняется “skin”, значит компоненты ещё используют жёсткие px.
Нужно заменить размеры на токены (`--btn-*`, `--input-*`, `--cell-*`, `--tabbar-*`) и т.п.