-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redo FluentProvider theme api (#21286)
* fix(react-provider):make the Provider#theme TS API reflect runtime and add warning if there is a violation * fix(react-shared-contexts): make the ThemeContext TS API reflect runtime and remove redundant ThemeContextValue * Change files * fixup! fix(react-shared-contexts): make the ThemeContext TS API reflect runtime and remove redundant ThemeContextValue * fixup! fix(react-provider):make the Provider#theme TS API reflect runtime and add warning if there is a violation * fixup! fixup! fix(react-provider):make the Provider#theme TS API reflect runtime and add warning if there is a violation
- Loading branch information
Showing
13 changed files
with
96 additions
and
36 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-provider-799f4a36-cc2b-48d7-ba65-9b54b83ac24a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "make the FluentProvider#theme TS API reflect runtime and add warning if there is a violation", | ||
"packageName": "@fluentui/react-provider", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-shared-contexts-2267ecce-105d-4bde-b47f-335b56635347.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "make the ThemeContext TS API reflect runtime and remove redundant ThemeContextValue", | ||
"packageName": "@fluentui/react-shared-contexts", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/react-shared-contexts/src/ThemeContext/ThemeContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import * as React from 'react'; | ||
import type { ThemeContextValue } from './ThemeContext.types'; | ||
import type { Theme } from '@fluentui/react-theme'; | ||
|
||
export const ThemeContext = React.createContext((null as unknown) as ThemeContextValue); | ||
export const ThemeContext = React.createContext<Theme | Partial<Theme> | undefined>(undefined); | ||
|
||
export function useTheme(): ThemeContextValue { | ||
export function useTheme(): Theme | Partial<Theme> | undefined { | ||
return React.useContext(ThemeContext); | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/react-shared-contexts/src/ThemeContext/ThemeContext.types.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './ThemeContext'; | ||
export * from './ThemeContext.types'; |