Skip to content

Design: isolate Flex palettes and resolve system-aware defaults - #4452

Merged
Jason Morse (JasonVMo) merged 1 commit into
mainfrom
user/jasonvmo/flex-defaults
Nov 6, 2026
Merged

Jason Morse (JasonVMo) merged 1 commit into
mainfrom
user/jasonvmo/flex-defaults

Conversation

@JasonVMo

Copy link
Copy Markdown
Contributor

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

  • Split generated Flex defaults into shared, cool-only, and warm-only modules. Export flexCoolTheme and keep flexWarmTheme independent of the opposite palette.
  • Allow FlexThemeDescription.tokens to resolve a complete description from the appearance. flexTheme remains a reference base and switches palettes with appearance.colorTone.
  • Use flexCoolTheme for the provider-free hook fallback and an outermost ThemedRoot without an explicit theme. Lazily sample the system light/dark appearance once for the hook fallback, sharing its state, appearance, and style registry.
  • Add palette-isolation bundle assertions, dynamic switching and fallback tests, updated documentation, and patch changesets.

Verification

Passed in packages/agentic/design:

  • yarn format
  • yarn lint
  • yarn build
  • yarn test — 537 tests and 34 snapshots.
  • yarn check:mappings
  • yarn gen:flex-defaults --check

Passed at the repository root:

  • yarn change:check
  • yarn bundle-size — macOS and Windows consumer bundles; fixed themes exclude the opposite palette and the dynamic theme retains both.
  • yarn clean-lage-cache followed by yarn lage buildci — all 176 tasks passed on committed HEAD.
  • yarn markdown-link-check -c .github/markdown-link-check-config.json packages/agentic/design/README.md packages/agentic/design/references/theming.md packages/agentic/design/references/tokens.md packages/agentic/design/references/entry-points.md packages/agentic/design/references/contributing.md

Native runtime, screen-reader, and manual UI qualification were not run. No native implementation changed.

Before After
The fixed Flex theme imports shared a module containing both palettes; flexTheme was fixed to cool. Fixed cool and warm descriptions retain only their palette and common tokens; flexTheme selects by resolved tone.
Provider-free hooks always used a light default. The fallback uses the system light/dark choice on first use and retains one shared cool-theme state.

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Bundle size report

Tree-shaken, minified production esbuild bundles with React and React Native runtimes externalized.

Scenario Modules-Mac (Δ) Modules-Win (Δ) Size-Mac (Δ) Size-Win (Δ)
components-button 79 (+1) 80 (+1) 72.78k (-842b) 72.71k (-842b)
components-catalog 228 (+1) 229 (+1) 228.46k (-855b) 228.38k (-855b)
design-themed-root 55 (+4) 56 (+4) 56.26k (+998b) 56.18k (+998b)
design-color-lib 6 (+0) 6 (+0) 6.27k (+0b) 6.27k (+0b)
design-theme-state-legacy-source 49 (+1) 50 (+1) 52.96k (-841b) 52.89k (-841b)
design-legacy-theme 42 (+0) 42 (+0) 39.11k (+0b) 42.91k (+0b)
design-legacy-theme-from-flex 58 (+4) 58 (+4) 60.70k (+824b) 64.51k (+822b)
design-fluent-light-theme 7 (+0) 7 (+0) 18.74k (+0b) 22.59k (+0b)
design-fluent-theme 35 (+0) 35 (+0) 27.46k (+4b) 31.25k (-1b)
design-fluent-hc-theme 32 (+0) 32 (+0) 27.34k (+0b) 31.13k (+0b)
design-flex-theme 29 (-4) 29 (-4) 14.30k (-9.07k) 14.29k (-9.07k)
design-flex-cool-theme 26 (New) 26 (New) 12.51k (New) 12.50k (New)
design-flex-warm-theme 26 (-7) 26 (-7) 12.28k (-11.15k) 12.27k (-11.15k)

The job is advisory: size changes are reported but do not fail the pull request. Bundle or analysis errors still fail.


View bundle-size workflow run

@JasonVMo
Jason Morse (JasonVMo) merged commit ccb458e into main Nov 6, 2026
18 checks passed
@JasonVMo
Jason Morse (JasonVMo) deleted the user/jasonvmo/flex-defaults branch November 6, 2026 07:58
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