Skip to content

Commit 273f6aa

Browse files
authored
feat(web-components): relax setTheme() argument type to allow custom tokens (#32087)
1 parent e55fceb commit 273f6aa

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "feat(web-components): relax setTheme() argument type to allow custom tokens",
4+
"packageName": "@fluentui/web-components",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/web-components/docs/api-report.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import type { HostController } from '@microsoft/fast-element';
1717
import { HTMLDirective } from '@microsoft/fast-element';
1818
import { Orientation } from '@microsoft/fast-web-utilities';
1919
import type { SyntheticViewTemplate } from '@microsoft/fast-element';
20-
import type { Theme } from '@fluentui/tokens';
2120
import { ViewTemplate } from '@microsoft/fast-element';
2221

2322
// @public
@@ -3541,6 +3540,11 @@ export const TextWeight: {
35413540
// @public
35423541
export type TextWeight = ValuesOf<typeof TextWeight>;
35433542

3543+
// Warning: (ae-internal-missing-underscore) The name "Theme" should be prefixed with an underscore because the declaration is marked as @internal
3544+
//
3545+
// @internal
3546+
export type Theme = Record<string, string | number>;
3547+
35443548
// @public
35453549
export class ToggleButton extends Button {
35463550
// (undocumented)

packages/web-components/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export {
244244
TextWeight,
245245
} from './text/index.js';
246246
export * from './theme/design-tokens.js';
247-
export { setTheme, setThemeFor } from './theme/index.js';
247+
export { setTheme, setThemeFor, type Theme } from './theme/index.js';
248248
export {
249249
ToggleButton,
250250
ToggleButtonAppearance,

packages/web-components/src/theme/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,4 @@ export {
384384
shadow28Brand,
385385
shadow64Brand,
386386
} from './design-tokens.js';
387-
export { setTheme, setThemeFor } from './set-theme.js';
387+
export { setTheme, setThemeFor, type Theme } from './set-theme.js';

packages/web-components/src/theme/set-theme.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import type { Theme } from '@fluentui/tokens';
21
import * as tokens from './design-tokens.js';
32

3+
/**
4+
* Not using the `Theme` type from `@fluentui/tokens` package to allow custom
5+
* tokens to be added.
6+
* @internal
7+
*/
8+
export type Theme = Record<string, string | number>;
9+
410
const tokenNames = Object.keys(tokens) as (keyof Theme)[];
511

612
const SUPPORTS_REGISTER_PROPERTY = 'registerProperty' in CSS;

0 commit comments

Comments
 (0)