Skip to content

Commit 80bf14d

Browse files
authored
Consolidate getCurrentAppearance, isHighContrast and setHighContrast in design package (#4155)
* move theming types into a subdirectory * remove caching from prebuild step * add theming platform utilities to the design package * switch usage of theming utilities to the design package * add changeset * update dead links and add instructions to fix links
1 parent e49f0b7 commit 80bf14d

81 files changed

Lines changed: 201 additions & 233 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/odd-taxis-do.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@uifabricshared/theming-ramp": patch
3+
"@fluentui-react-native/android-theme": patch
4+
"@fluentui-react-native/default-theme": patch
5+
"@fluentui-react-native/theming-utils": patch
6+
"@fluentui-react-native/experimental-shimmer": patch
7+
"@fluentui-react-native/theme-tokens": patch
8+
"@fluentui-react-native/checkbox": patch
9+
"@fluentui-react-native/apple-theme": patch
10+
"@fluentui-react-native/theme-types": patch
11+
"@fluentui-react-native/tablist": patch
12+
"@fluentui-react-native/avatar": patch
13+
"@fluentui-react-native/button": patch
14+
"@fluentui-react-native/switch": patch
15+
"@fluentui-react-native/badge": patch
16+
"@fluentui-react-native/menu": patch
17+
"@fluentui-react-native/theme": patch
18+
"@fluentui-react-native/design": patch
19+
---
20+
21+
Move platform theming utilities into the design package, update usage in the repo to use the new source"

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ yarn format:check # Check formatting without writing
7171
```bash
7272
yarn lint-repo # Repo-wide structural lint (scripts/src/tasks/lintRepo.ts)
7373
yarn lint-lockfile # Validate the Yarn lockfile
74+
yarn lage test-links # Validate links in repository Markdown files
7475
yarn check-publishing # Validate package publishing configuration
7576
yarn change # Create a change file for the current branch
7677
yarn change:check # Verify required change files exist
@@ -85,6 +86,7 @@ The task pipeline is defined in `lage.config.mjs`:
8586
- `buildci` is the aggregate CI alias (lint-repo, check-publishing, build, test, lint)
8687
- Lage caches task outputs; add `--no-cache` to bypass caching and `--verbose` for detailed output
8788
- After a major rework (e.g. moving packages, large refactors, or renaming exports), run `yarn lage test --no-cache` from the root once to force every test to re-run without relying on stale cached results. This also resets the Lage cache, so subsequent plain `yarn lage test` runs will work incrementally again.
89+
- Before checking in moved or renamed files, run `yarn lage test-links` and update any repository links that still reference the old paths.
8890

8991
### Package-Level Commands
9092

apps/tester-core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"@fluentui-react-native/theme": "workspace:*",
7474
"@fluentui-react-native/theme-tokens": "workspace:*",
7575
"@fluentui-react-native/themed-stylesheet": "workspace:*",
76-
"@fluentui-react-native/theming-utils": "workspace:*",
7776
"@fluentui-react-native/tooltip": "workspace:*",
7877
"@fluentui-react-native/vibrancy-view": "workspace:*",
7978
"@fluentui-react-native/win32-theme": "workspace:*",

apps/tester-core/src/TestComponents/ColorTokens/ColorTokenTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { globalTokens } from '@fluentui-react-native/theme-tokens';
1010
import type { Theme } from '@fluentui-react-native/design/theming';
1111
import { useTheme } from '@fluentui-react-native/design/theming';
1212
import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
13-
import { getCurrentAppearance } from '@fluentui-react-native/theming-utils';
13+
import { getCurrentAppearance } from '@fluentui-react-native/design/theming';
1414
import { createOfficeAliasTokens } from '@fluentui-react-native/win32-theme';
1515
import type { SvgProps } from 'react-native-svg';
1616
import Svg, { G, Path } from 'react-native-svg';

apps/tester-core/src/TestComponents/CornerRadius/CornerRadiusTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Text } from '@fluentui/react-native';
1616
import { HOMEPAGE_CORNERRADIUS_TESTPAGE } from '@fluentui-react-native/e2e-testing';
1717
import { useFluentTheme } from '@fluentui-react-native/framework';
1818
import { Stack } from '@fluentui-react-native/stack';
19-
import { getCurrentAppearance } from '@fluentui-react-native/theming-utils';
19+
import { getCurrentAppearance } from '@fluentui-react-native/design/theming';
2020

2121
import { stackStyle } from '../Common/styles';
2222
import type { TestSection, PlatformStatus } from '../Test';

apps/tester-core/src/TestComponents/StrokeWidth/StrokeWidthTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { Theme } from '@fluentui-react-native/framework';
1919
import { useFluentTheme } from '@fluentui-react-native/framework';
2020
import { Stack } from '@fluentui-react-native/stack';
2121
import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
22-
import { getCurrentAppearance } from '@fluentui-react-native/theming-utils';
22+
import { getCurrentAppearance } from '@fluentui-react-native/design/theming';
2323

2424
import { stackStyle } from '../Common/styles';
2525
import type { TestSection, PlatformStatus } from '../Test';

apps/tester-core/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@
145145
{
146146
"path": "../../packages/framework/themed-stylesheet/tsconfig.json"
147147
},
148-
{
149-
"path": "../../packages/theming/theming-utils/tsconfig.json"
150-
},
151148
{
152149
"path": "../../packages/experimental/Tooltip/tsconfig.json"
153150
},

docs/pages/Theming/CustomTheme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ There are two ways to make a custom theme: you can tack onto an existing one usi
88

99
### Extending an existing `ThemeReference`
1010

11-
We have a concept of `ThemeRecipes` which allow for layering of partial theme objects to create the ultimately desired theme. `ThemeRecipes` are functions which take a `Theme` and spit out a [`PartialTheme`](../../../packages/agentic-design/src/theming/Theme.types.ts), which is then deep merged into the base theme object.
11+
We have a concept of `ThemeRecipes` which allow for layering of partial theme objects to create the ultimately desired theme. `ThemeRecipes` are functions which take a `Theme` and spit out a [`PartialTheme`](../../../packages/agentic-design/src/theming/types/Theme.types.ts), which is then deep merged into the base theme object.
1212

1313
You can extend one of our default themes by creating a `ThemeReference` using the default theme as the base theme, and then add your customization as a `ThemeRecipe`:
1414

@@ -46,7 +46,7 @@ There's two ways to customize a FURN theme's properties:
4646

4747
### Changing theme tokens directly
4848

49-
Theme tokens can be overridden directly. You can specify different values for theme entries and add to the set of colors. You can see what can be overridden by looking at the [Theme type definition](../../../packages/agentic-design/src/theming/Theme.types.ts).
49+
Theme tokens can be overridden directly. You can specify different values for theme entries and add to the set of colors. You can see what can be overridden by looking at the [Theme type definition](../../../packages/agentic-design/src/theming/types/Theme.types.ts).
5050

5151
This approach is useful if you need the customizations to be applied to all components.
5252

@@ -161,7 +161,7 @@ interface Theme {
161161
}
162162
```
163163

164-
<font size=1>(Taken from the [`Theme` type definition](../../../packages/agentic-design/src/theming/Theme.types.ts).)</font>
164+
<font size=1>(Taken from the [`Theme` type definition](../../../packages/agentic-design/src/theming/types/Theme.types.ts).)</font>
165165

166166
NOTE: If you would prefer to customize one instance of a FURN component instead, use [the customize API](../../../packages/framework/composition/README.md).
167167

docs/pages/Theming/Tokens/Basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const defaultNotificationTokens: TokenSettings<NotificationTokens, Theme>
7474

7575
Notes about alias color tokens:
7676

77-
- Different platforms can have different sets of alias tokens; however, the entire set of alias tokens are all defined in the same interface. See [Color.types.ts](https://github.com/microsoft/fluentui-react-native/blob/main/packages/agentic-design/src/theming/Color.types.ts#L861) for this interface and which platforms define which alias tokens.
77+
- Different platforms can have different sets of alias tokens; however, the entire set of alias tokens are all defined in the same interface. See [Color.types.ts](../../../../packages/agentic-design/src/theming/types/Color.types.ts#L861) for this interface and which platforms define which alias tokens.
7878
- As a result, if an alias token is referenced that does not exist for that platform, there won't be any compile-time or run-time errors. Instead, the color shown will default to black.
7979

8080
Special case: if accessing a specific color, you can find it in the `globalTokens.color` property.

lage.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ const config = {
4949
* Prebuild is a pre-build step that can either modify the source code or generate additional files in the project.
5050
*/
5151
dependsOn: ['^prebuild'],
52-
inputs: ['**/*', '!node_modules/**/*', '!dist/**/*', '!lib/**/*', '!lib-commonjs/**/*'],
53-
outputs: ['lib/**/*', 'src/**/*'],
52+
cache: false,
5453
},
5554
'root-prebuild': {
5655
cache: false,

0 commit comments

Comments
 (0)