From 4710a5624228003373ef5c609825b06f1bec8c21 Mon Sep 17 00:00:00 2001 From: Maofeng Date: Tue, 29 Sep 2026 20:58:46 +0800 Subject: [PATCH] docs(appearance): document display preferences --- .../en-US/advanced/atomic-composition.mdx | 15 ++++++------- .../appearance/docs/en-US/guide/setup.mdx | 21 ++++++++++++++++--- packages/appearance/docs/en-US/overview.mdx | 11 ++++++++-- .../zh-Hans/advanced/atomic-composition.mdx | 15 ++++++------- .../appearance/docs/zh-Hans/guide/setup.mdx | 21 ++++++++++++++++--- packages/appearance/docs/zh-Hans/overview.mdx | 11 ++++++++-- 6 files changed, 70 insertions(+), 24 deletions(-) diff --git a/packages/appearance/docs/en-US/advanced/atomic-composition.mdx b/packages/appearance/docs/en-US/advanced/atomic-composition.mdx index 2cbcde0..7c7a9f3 100644 --- a/packages/appearance/docs/en-US/advanced/atomic-composition.mdx +++ b/packages/appearance/docs/en-US/advanced/atomic-composition.mdx @@ -15,11 +15,14 @@ toc: ## Controlled atoms {#controlled-atoms} -`ThemeModeField`, `CompactLayoutField`, `ThemeColorPicker`, and `ThemeToggle` are driven by values and callbacks. They do not require preference context, so they can work with forms, preview tools, or another state library. +`ThemeModeField`, `ColorVisionModeField`, `TextScaleField`, `MotionModeField`, `BrightnessField`, `ThemeColorPicker`, and `ThemeToggle` are driven by values and callbacks. They do not require preference context, so they can work with forms, preview tools, or another state library. ```tsx - + + + + ``` ## Compose a theme card {#compose-card} @@ -28,11 +31,9 @@ toc: ```tsx ``` diff --git a/packages/appearance/docs/en-US/guide/setup.mdx b/packages/appearance/docs/en-US/guide/setup.mdx index 38088c5..9a65f73 100644 --- a/packages/appearance/docs/en-US/guide/setup.mdx +++ b/packages/appearance/docs/en-US/guide/setup.mdx @@ -17,6 +17,13 @@ toc: Build one complete preference definition map at the application boundary. Spread definitions from appearance, locale, keyboard, and other feature packages into this map, then create or load the initial values. +Import Appearance after UI in the application stylesheet. No UI component changes are required: + +```css +@import "@workspace/ui/globals.css"; +@import "@workspace/appearance/globals.css"; +``` + ```tsx import { createDefaultPreferences, @@ -54,11 +61,11 @@ export function Root({ children }: { children: React.ReactNode }) { ## Register effects {#effects} -`appearancePreferenceEffect` combines two exported callbacks: `applyAppearancePreferenceEffect` updates document classes and theme variables before paint, while `subscribeSystemThemePreferenceEffect` watches the operating-system theme after paint. Register the composed effect in the stable `effects` array passed to `PreferencesProvider`. +`appearancePreferenceEffect` updates document classes, root attributes, and theme variables before paint, then watches operating-system theme and motion preferences after paint. Register it in the stable `effects` array passed to `PreferencesProvider`. ## Inject theme variables {#theme-style} -Use `buildThemeStyleSheet` to generate the CSS variables for light, dark, and system modes. Keep the stable element ID so the appearance effect can update the same node when color preferences change. +Use `buildThemeStyleSheet` to generate light and dark CSS variables from one base color, one accent color, and a color-vision mode. Keep the stable element ID so the appearance effect can update the same node when preferences change. ```tsx import { @@ -69,11 +76,19 @@ import { ;