forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-components): improve ergonomics of the fluent design system (m…
…icrosoft#19056) * feat(web-components): improve ergonomics of the fluent design system * Change files * fix(web-components): address lint issue * chore(web-components): update api-report Co-authored-by: EisenbergEffect <roeisenb@microsoft.com>
- Loading branch information
1 parent
8c433ef
commit e5adfa3
Showing
6 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-web-components-366f5ffe-df49-4c8d-9348-8218b334dbd1.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": "minor", | ||
"comment": "feat(web-components): improve ergonomics of the fluent design system", | ||
"packageName": "@fluentui/web-components", | ||
"email": "roeisenb@microsoft.com", | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { DesignSystem } from "@microsoft/fast-foundation"; | ||
|
||
/** | ||
* Provides a design system for the specified element either by returning one that was | ||
* already created for that element or creating one. | ||
* @param element - The element to root the design system at. By default, this is the body. | ||
* @returns A Fluent Design System | ||
* @public | ||
*/ | ||
export function provideFluentDesignSystem(element?: HTMLElement): DesignSystem { | ||
return DesignSystem.getOrCreate(element).withPrefix("fluent"); | ||
} |
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,13 +1,14 @@ | ||
// TODO: Is exporting Foundation still necessary with the updated API's? | ||
// export * from "@microsoft/fast-element"; | ||
import { DesignSystem } from '@microsoft/fast-foundation'; | ||
import { allComponents } from './custom-elements'; | ||
import { provideFluentDesignSystem } from './fluent-design-system'; | ||
|
||
export * from './index'; | ||
|
||
/** | ||
* TODO rename this to FluentDesignSystem when {@link @FluentDesignSystem} interface is removed. | ||
/** | ||
* The global Fluent Design System. | ||
* @remarks | ||
* Only available if the components are added through a script tag | ||
* rather than a module/build system. | ||
*/ | ||
export const fluentDesignSystem = DesignSystem.getOrCreate() | ||
.withPrefix('fluent') | ||
.register(...Object.values(allComponents).map(definition => definition())); | ||
export const FluentDesignSystem = provideFluentDesignSystem().register(allComponents); |
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