-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(web-components): enabling setting theme on an individual element and unsetting themes #31973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
e5d7891
refactor setTheme() for setting theme on elements
marchbox 3bff695
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 7ecf93d
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 1bcd739
reorg the code
marchbox 964b29d
set local themes
marchbox 41ca177
fix firefox bug
marchbox c20be72
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox cbc6471
improve set theme story
marchbox 694d794
fix story
marchbox 1af991d
fix safari scope bug
marchbox 1f3afa9
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 66a3a60
update api report
marchbox d22c5b4
check themeable element
marchbox 24a1a6a
add change file
marchbox 4b6b1a6
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox b9f3770
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 42a880b
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 3b2f458
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 8761294
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox ded57a8
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 092400c
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 54d056f
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 2aa86bd
Merge branch 'master' of github.com:marchbox/fluentui into users/mach…
marchbox 0cc1a90
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox c25f436
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 651b7e7
update Theme type in story
marchbox 110e03e
wip: add test
marchbox bdbb26e
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox a37ed82
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox cd2e084
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox c0f0348
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 8e064b3
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 35e358f
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 318eb26
fix formatting
marchbox 3cc0a90
Merge branch 'users/machi/setthemefor' of github.com:marchbox/fluentu…
marchbox f3fa397
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 9284219
Merge branch 'master' of github.com:marchbox/fluentui into users/mach…
marchbox 3933664
clean up set theme in storybook and playwright
marchbox 2f090a2
fix formatting
marchbox c915770
unset theme when css scope is not supported
marchbox 97cb258
Merge branch 'microsoft:master' into users/machi/setthemefor
marchbox 64ff7ba
use removeProperty instead
marchbox f0b2565
Merge branch 'master' of github.com:marchbox/fluentui into users/mach…
marchbox 1b9c5d0
revert unwanted change
marchbox be32c93
improve the stories
marchbox 2ec4205
add tests
marchbox 8a6eb15
fix formatting
marchbox 5cd9fa2
enable tests in other engines and fix issues
marchbox 587923b
Merge branch 'master' into users/machi/setthemefor
marchbox dac52c8
fix formatting
marchbox f1802ac
remove use of CSS.registerProperty()
marchbox d461235
allow unset global theme in story
marchbox 28b6bed
Merge branch 'master' into users/machi/setthemefor
marchbox d9b6f83
trim margins
marchbox b133052
fix formatting
marchbox 84fe643
add argument doc
marchbox 2a92a62
add more test
marchbox d82f6a9
update api report
marchbox c679aa5
Merge branch 'master' into users/machi/setthemefor
marchbox aeb64b4
add perf tests for setting themes on light and shadow DOM
marchbox 963ad6c
fix formatting
marchbox b1fefdd
Merge branch 'master' into users/machi/setthemefor
marchbox a6848cb
update change file as per feedback
marchbox 5d6e374
Merge branch 'master' into users/machi/setthemefor
marchbox f148920
revert accidental changes
marchbox f4e65e8
Merge branch 'master' into users/machi/setthemefor
marchbox 94fc7b4
Merge branch 'master' into users/machi/setthemefor
marchbox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-web-components-d74234e0-b903-4c51-af61-599648aee92d.json
This file contains hidden or 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 @@ | ||
| { | ||
marchbox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "type": "prerelease", | ||
| "comment": "feat: enabling setting theme on an individual element and unsetting themes", | ||
| "packageName": "@fluentui/web-components", | ||
| "email": "machi@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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
36 changes: 36 additions & 0 deletions
36
packages/web-components/src/theme/set-theme.local.bench.ts
This file contains hidden or 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,36 @@ | ||
| import { measurePerformance, type TestRenderFunction } from '@tensile-perf/web-components'; | ||
| import { teamsDarkTheme, teamsLightTheme, webDarkTheme, webLightTheme } from '@fluentui/tokens'; | ||
|
|
||
| import { setTheme } from './set-theme.js'; | ||
|
|
||
| const tests: Record<string, TestRenderFunction> = { | ||
| mount: ({ onComplete }) => { | ||
| const { startMeasure, endMeasure } = measurePerformance(); | ||
|
|
||
| const el = document.createElement('div'); | ||
| document.body.append(el); | ||
|
|
||
| startMeasure(); | ||
|
|
||
| // Newly set themes | ||
| setTheme(webLightTheme, el); | ||
| setTheme(webDarkTheme, el); | ||
| setTheme(teamsDarkTheme, el); | ||
| setTheme(teamsLightTheme, el); | ||
|
|
||
| // Cached themes | ||
| setTheme(webLightTheme, el); | ||
| setTheme(webDarkTheme, el); | ||
| setTheme(teamsDarkTheme, el); | ||
| setTheme(teamsLightTheme, el); | ||
|
|
||
| // Unset themes | ||
| setTheme(null, el); | ||
|
|
||
| endMeasure(); | ||
|
|
||
| onComplete(); | ||
| }, | ||
| }; | ||
|
|
||
| export { tests }; |
38 changes: 38 additions & 0 deletions
38
packages/web-components/src/theme/set-theme.shadow.bench.ts
This file contains hidden or 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,38 @@ | ||
| import { measurePerformance, type TestRenderFunction } from '@tensile-perf/web-components'; | ||
| import { teamsDarkTheme, teamsLightTheme, webDarkTheme, webLightTheme } from '@fluentui/tokens'; | ||
|
|
||
| import { setTheme } from './set-theme.js'; | ||
|
|
||
| const tests: Record<string, TestRenderFunction> = { | ||
| mount: ({ onComplete }) => { | ||
| const { startMeasure, endMeasure } = measurePerformance(); | ||
|
|
||
| const el = document.createElement('div'); | ||
| el.attachShadow({ mode: 'open' }); | ||
| el.shadowRoot!.append(document.createElement('span')); | ||
| document.body.append(el); | ||
|
|
||
| startMeasure(); | ||
|
|
||
| // Newly set themes | ||
| setTheme(webLightTheme, el); | ||
| setTheme(webDarkTheme, el); | ||
| setTheme(teamsDarkTheme, el); | ||
| setTheme(teamsLightTheme, el); | ||
|
|
||
| // Cached themes | ||
| setTheme(webLightTheme, el); | ||
| setTheme(webDarkTheme, el); | ||
| setTheme(teamsDarkTheme, el); | ||
| setTheme(teamsLightTheme, el); | ||
|
|
||
| // Unset themes | ||
| setTheme(null, el); | ||
|
|
||
| endMeasure(); | ||
|
|
||
| onComplete(); | ||
| }, | ||
| }; | ||
|
|
||
| export { tests }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.