-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: prefer resizable Fluent icons #36705
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
Draft
Martin Hochel (Hotell)
wants to merge
15
commits into
microsoft:master
Choose a base branch
from
Hotell:feat/prefer-resizable-icons
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e7a7aab
feat: prefer resizable icons
Hotell a03981f
chore: add missing change files
Hotell 8385e17
chore: format visual regression stories
Hotell 63f563c
test: update BreadcrumbButton icon snapshot
Hotell f474144
feat: add atomic icon Storybook builds
Hotell e95cfab
fix: type Storybook webpack entries
Hotell 0ab0dad
chore: type-check icon webpack config
Hotell 1d85f2d
fix: keep Markdown action icon on SVG
Hotell 825ab76
revert: remove Markdown SVG fallback
Hotell eee7729
fix: prevent synthetic bold font icons
Hotell 0a10906
test: update snapshots for react-icons bump
Hotell 3e2e202
chore: dedupe Griffel dependencies
Hotell 9151962
chore: fully dedupe dependencies
Hotell 86477d2
chore(migration-v0-v9): udpate api.md
Hotell 3e6df36
refactor: simplify font icon selectors
Hotell 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
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,6 @@ | ||
| /* Prevent inherited text weight from synthetically bolding font icons. | ||
| * TODO: Remove when https://github.com/microsoft/fluentui-system-icons/issues/1235 is fixed. | ||
| */ | ||
| :where([data-fui-icon]) { | ||
| font-weight: normal; | ||
| } |
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,108 @@ | ||
| // @ts-check | ||
|
|
||
| const FluentUIReactIconsFontSubsettingPlugin = require('@fluentui/react-icons-font-subsetting-webpack-plugin').default; | ||
|
|
||
| const FONT_ICON_VARIANT = 'fonts'; | ||
| const iconLoader = require.resolve('@fluentui/react-icons-atomic-webpack-loader'); | ||
| const headlessBaseStyles = require.resolve('@fluentui/react-icons/headless/styles.css'); | ||
| const headlessFontStyles = require.resolve('@fluentui/react-icons/headless/fonts/styles.css'); | ||
| const fontIconStyles = require.resolve('./react-icons-font.css'); | ||
|
|
||
| /** @typedef {string | string[] | import('webpack').EntryObject} ResolvedEntry */ | ||
|
|
||
| /** | ||
| * @param {ResolvedEntry} entry | ||
| * @param {string[]} imports | ||
| * @returns {ResolvedEntry} | ||
| */ | ||
| function prependEntryImports(entry, imports) { | ||
| if (typeof entry === 'string') { | ||
| return [...imports, entry]; | ||
| } | ||
|
|
||
| if (Array.isArray(entry)) { | ||
| return [...imports, ...entry]; | ||
| } | ||
|
|
||
| if (entry && typeof entry === 'object') { | ||
| return Object.fromEntries( | ||
| Object.entries(entry).map(([name, value]) => { | ||
| if (typeof value === 'string' || Array.isArray(value)) { | ||
| return [name, prependEntryImports(value, imports)]; | ||
| } | ||
|
|
||
| if (value && typeof value === 'object') { | ||
| return [name, { ...value, import: prependEntryImports(value.import ?? [], imports) }]; | ||
| } | ||
|
|
||
| return [name, value]; | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| return entry; | ||
| } | ||
|
|
||
| /** | ||
| * Configures atomic Fluent icon imports for Storybook. | ||
| * Set FLUENTUI_ICON_VARIANT=fonts to use subsetted font icons; SVG atoms are the default. | ||
| * | ||
| * @see https://github.com/microsoft/fluentui-system-icons/blob/main/packages/react-icons-atomic-webpack-loader/README.md | ||
| * @see https://github.com/microsoft/fluentui-system-icons/tree/main/packages/react-icons-font-subsetting-webpack-plugin | ||
| * | ||
| * @param {{ config: import('webpack').Configuration; headless?: boolean }} options | ||
| */ | ||
| function configureReactIcons(options) { | ||
| const { config, headless = false } = options; | ||
| const useFontIcons = process.env.FLUENTUI_ICON_VARIANT === FONT_ICON_VARIANT; | ||
|
|
||
| config.module ??= {}; | ||
| config.module.rules ??= []; | ||
| config.module.rules.push({ | ||
| test: /\.[mc]?[jt]sx?$/, | ||
| enforce: 'pre', | ||
| use: [ | ||
| { | ||
| loader: iconLoader, | ||
| options: { | ||
| iconVariant: useFontIcons ? 'fonts' : 'svg', | ||
| fallbackVariant: 'svg', | ||
| headless, | ||
| }, | ||
| }, | ||
| ], | ||
| }); | ||
|
|
||
| if (useFontIcons) { | ||
| config.module.rules.push({ | ||
| test: /\.(ttf|woff2?)$/, | ||
| type: 'asset', | ||
| }); | ||
| config.plugins ??= []; | ||
| config.plugins.push(new FluentUIReactIconsFontSubsettingPlugin()); | ||
| } | ||
|
|
||
| const styleImports = []; | ||
| if (headless) { | ||
| styleImports.push(headlessBaseStyles); | ||
| } | ||
| if (useFontIcons) { | ||
| if (headless) { | ||
| styleImports.push(headlessFontStyles); | ||
| } | ||
| styleImports.push(fontIconStyles); | ||
| } | ||
|
|
||
| if (styleImports.length > 0) { | ||
| const originalEntry = config.entry; | ||
|
|
||
| config.entry = async () => { | ||
| const entry = typeof originalEntry === 'function' ? await originalEntry() : originalEntry; | ||
| return prependEntryImports(entry ?? [], styleImports); | ||
| }; | ||
| } | ||
|
|
||
| return config; | ||
| } | ||
|
|
||
| module.exports = { configureReactIcons }; |
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 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 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
13 changes: 4 additions & 9 deletions
13
apps/vr-tests-react-components/src/stories/Breadcrumb/utils.tsx
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Avatar Converged 6 screenshots
vr-tests-react-components/Card Converged 5 screenshots
vr-tests-react-components/Card Converged - Disabled 2 screenshots
vr-tests-react-components/Card Converged - Selectable 2 screenshots
vr-tests-react-components/Checkbox Converged 6 screenshots
vr-tests-react-components/Combobox Converged 1 screenshots
vr-tests-react-components/Dialog 7 screenshots
vr-tests-react-components/Drawer 6 screenshots
vr-tests-react-components/Field 13 screenshots
vr-tests-react-components/InfoLabel 5 screenshots
vr-tests-react-components/Menu Converged - selection 2 screenshots
vr-tests-react-components/Menu Converged - selection groups 1 screenshots
vr-tests-react-components/MessageBar 6 screenshots
vr-tests-react-components/Persona Converged 6 screenshots
vr-tests-react-components/Positioning 2 screenshots
vr-tests-react-components/PresenceBadge Converged - OOF status 1 screenshots
vr-tests-react-components/PresenceBadge Converged - inverted background 3 screenshots
vr-tests-react-components/PresenceBadge Converged - sizes 1 screenshots
vr-tests-react-components/PresenceBadge Converged - status 1 screenshots
vr-tests-react-components/ProgressBar converged 2 screenshots
vr-tests-react-components/SearchBox Converged 6 screenshots
vr-tests-react-components/SpinButton Converged 42 screenshots
vr-tests-react-components/SwatchPicker Converged 3 screenshots
vr-tests-react-components/Table layout table 4 screenshots
vr-tests-react-components/TagPicker 3 screenshots
vr-tests-react-components/Toast 6 screenshots
vr-tests-react-components/Toolbar Converged 15 screenshots
vr-tests-react-components/Tree 34 screenshots
vr-tests-web-components/Badge 1 screenshots
There were 562 duplicate changes discarded. Check the build logs for more information.