Skip to content
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

feat: add web components to fluent ui as a new package and fix text field styling issue #14203

Merged

Conversation

chrisdholt
Copy link
Member

Pull request checklist

closes #14071

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ yarn change

Description of changes

This PR Closes the RFC to add web components to the repository. A few fixes do accompany this change, but as far as this repo is concerned it is net-new.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 24, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 53edbb8:

Sandbox Source
Fluent UI Button Configuration
microsoft/fluentui: codesandbox-react-template Configuration
microsoft/fluentui: codesandbox-react-next-template Configuration
microsoft/fluentui: codesandbox-react-northstar-template Configuration

@size-auditor
Copy link

size-auditor bot commented Jul 24, 2020

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-next-ExtendedPicker 73.869 kB 73.871 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Slider 51.617 kB 51.619 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-ExtendedPicker 73.869 kB 73.871 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-Shimmer 50.231 kB 50.233 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Shimmer 50.231 kB 50.233 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-Slider 55.702 kB 55.704 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-ToggleButton 21.937 kB 21.939 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-DetailsList 212.587 kB 212.589 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-Callout 82.698 kB 82.7 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-Keytip 77.355 kB 77.357 kB ExceedsBaseline     2 bytes
office-ui-fabric-react office-ui-fabric-react-DetailsList 212.587 kB 212.589 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Checkbox 45.64 kB 45.642 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Callout 81.31 kB 81.312 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Button 20.65 kB 20.652 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-Keytip 77.355 kB 77.357 kB ExceedsBaseline     2 bytes
office-ui-fabric-react fluentui-react-next-ChoiceGroup 59.934 kB 59.935 kB ExceedsBaseline     1 bytes
office-ui-fabric-react office-ui-fabric-react-ChoiceGroup 59.934 kB 59.935 kB ExceedsBaseline     1 bytes
office-ui-fabric-react fluentui-react-next-Toggle 47.24 kB 47.241 kB ExceedsBaseline     1 bytes
office-ui-fabric-react office-ui-fabric-react-Utilities 69.037 kB 69.035 kB BelowBaseline     -2 bytes
office-ui-fabric-react fluentui-react-next-Separator 17.868 kB 17.866 kB BelowBaseline     -2 bytes
office-ui-fabric-react fluentui-react-next-Divider 16.371 kB 16.369 kB BelowBaseline     -2 bytes
office-ui-fabric-react office-ui-fabric-react-List 36.252 kB 36.25 kB BelowBaseline     -2 bytes
office-ui-fabric-react office-ui-fabric-react-Divider 16.371 kB 16.369 kB BelowBaseline     -2 bytes
office-ui-fabric-react fluentui-react-next-List 36.252 kB 36.25 kB BelowBaseline     -2 bytes
office-ui-fabric-react office-ui-fabric-react-Separator 17.868 kB 17.866 kB BelowBaseline     -2 bytes
office-ui-fabric-react office-ui-fabric-react-TextField 73.825 kB 73.822 kB BelowBaseline     -3 bytes
office-ui-fabric-react fluentui-react-next-TextField 73.826 kB 73.823 kB BelowBaseline     -3 bytes
office-ui-fabric-react fluentui-react-next-ColorPicker 84.166 kB 84.162 kB BelowBaseline     -4 bytes
office-ui-fabric-react office-ui-fabric-react-ColorPicker 84.166 kB 84.162 kB BelowBaseline     -4 bytes
office-ui-fabric-react fluentui-react-next-Calendar 112.407 kB 112.402 kB BelowBaseline     -5 bytes
office-ui-fabric-react office-ui-fabric-react-Calendar 136.787 kB 136.782 kB BelowBaseline     -5 bytes
office-ui-fabric-react office-ui-fabric-react-ScrollablePane 51.776 kB 51.769 kB BelowBaseline     -7 bytes
office-ui-fabric-react fluentui-react-next-ScrollablePane 51.776 kB 51.769 kB BelowBaseline     -7 bytes
office-ui-fabric-react fluentui-react-next-DatePicker 176.129 kB 176.118 kB BelowBaseline     -11 bytes
office-ui-fabric-react office-ui-fabric-react-DatePicker 201.019 kB 201.008 kB BelowBaseline     -11 bytes
office-ui-fabric-react fluentui-react-next-KeytipLayer 97.792 kB 97.78 kB BelowBaseline     -12 bytes
office-ui-fabric-react office-ui-fabric-react-KeytipLayer 97.792 kB 97.78 kB BelowBaseline     -12 bytes
office-ui-fabric-react office-ui-fabric-react-ContextualMenu 149.053 kB 148.829 kB BelowBaseline     -224 bytes
office-ui-fabric-react fluentui-react-next-ContextualMenu 149.053 kB 148.829 kB BelowBaseline     -224 bytes
office-ui-fabric-react office-ui-fabric-react-Panel 191.081 kB 190.855 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-Panel 191.081 kB 190.855 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-FloatingPicker 230.091 kB 229.865 kB BelowBaseline     -226 bytes
office-ui-fabric-react office-ui-fabric-react-SelectedItemsList 219.555 kB 219.329 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-SpinButton 183.54 kB 183.314 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-SelectedItemsList 223.408 kB 223.182 kB BelowBaseline     -226 bytes
office-ui-fabric-react office-ui-fabric-react-FloatingPicker 230.091 kB 229.865 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-Pivot 184.398 kB 184.172 kB BelowBaseline     -226 bytes
office-ui-fabric-react office-ui-fabric-react-Nav 179.167 kB 178.941 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-Nav 179.167 kB 178.941 kB BelowBaseline     -226 bytes
office-ui-fabric-react office-ui-fabric-react-SpinButton 183.787 kB 183.561 kB BelowBaseline     -226 bytes
office-ui-fabric-react fluentui-react-next-CommandBar 191.685 kB 191.457 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-Dialog 199.624 kB 199.396 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-CommandBar 191.685 kB 191.457 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-Facepile 200.591 kB 200.363 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-Dialog 199.583 kB 199.355 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-Grid 171.577 kB 171.349 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-SearchBox 177.53 kB 177.302 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-Facepile 200.591 kB 200.363 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-MessageBar 179.86 kB 179.632 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-Pickers 273.279 kB 273.051 kB BelowBaseline     -228 bytes
office-ui-fabric-react fluentui-react-next-Grid 171.577 kB 171.349 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-SearchBox 177.745 kB 177.517 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-Pickers 273.279 kB 273.051 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-MessageBar 179.86 kB 179.632 kB BelowBaseline     -228 bytes
office-ui-fabric-react office-ui-fabric-react-ComboBox 235.378 kB 235.135 kB BelowBaseline     -243 bytes
office-ui-fabric-react fluentui-react-next-ComboBox 235.378 kB 235.135 kB BelowBaseline     -243 bytes
office-ui-fabric-react office-ui-fabric-react-Button 184.039 kB 183.794 kB BelowBaseline     -245 bytes
office-ui-fabric-react office-ui-fabric-react-TeachingBubble 195.944 kB 195.697 kB BelowBaseline     -247 bytes
office-ui-fabric-react office-ui-fabric-react-Breadcrumb 189.699 kB 189.452 kB BelowBaseline     -247 bytes
office-ui-fabric-react fluentui-react-next-Breadcrumb 189.699 kB 189.452 kB BelowBaseline     -247 bytes
office-ui-fabric-react fluentui-react-next-TeachingBubble 195.944 kB 195.697 kB BelowBaseline     -247 bytes
office-ui-fabric-react fluentui-react-next-Dropdown 222.923 kB 222.657 kB BelowBaseline     -266 bytes
office-ui-fabric-react office-ui-fabric-react-SwatchColorPicker 181.982 kB 181.716 kB BelowBaseline     -266 bytes
office-ui-fabric-react office-ui-fabric-react-DocumentCard 205.72 kB 205.454 kB BelowBaseline     -266 bytes
office-ui-fabric-react office-ui-fabric-react-Dropdown 222.923 kB 222.657 kB BelowBaseline     -266 bytes
office-ui-fabric-react fluentui-react-next-SwatchColorPicker 181.986 kB 181.72 kB BelowBaseline     -266 bytes
office-ui-fabric-react fluentui-react-next-DocumentCard 205.72 kB 205.454 kB BelowBaseline     -266 bytes
office-ui-fabric-react office-ui-fabric-react-Pivot 176.93 kB 176.645 kB BelowBaseline     -285 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: 40c70519bffb65b73f84a8e7c6332850aecd3c34 (build)

Copy link
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great to see (one Microsoft!), but there are some build/config issues that will need to be resolved.

lerna.json Outdated Show resolved Hide resolved
packages/web-components/.gitignore Outdated Show resolved Hide resolved
@@ -0,0 +1,11 @@
module.exports = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Longer-term, if this package is going to live in the Fluent UI repo, it would probably be better if it followed the same lint rules as the rest of the packages. However I know that can be a bit contentious and doesn't necessarily have to be resolved right now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd tend to generally agree, I'm happy to create a follow-up issue to reconcile this, though some of it may be contentious depending on the rules 😆

packages/web-components/.npmrc Outdated Show resolved Hide resolved
packages/web-components/.prettierignore Outdated Show resolved Hide resolved
@@ -0,0 +1,100 @@
{
"name": "@microsoft/fast-components-msft",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to keep the @microsoft/fast-components-msft name when published from this repo, or rename to @fluentui/web-components (or something else)? I don't think we currently have permissions set up in our release job to publish to @microsoft. Also, as a convention, we typically try to have package folder names match the unscoped part of the package name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, per the issue in reference this package has been published already and there are projects which depend on this both internally at Microsoft and externally, so we can't change the name without consequence. The long term plan is to have this live under the fluent namespace, but that will require planning and some coordination. While I agree in principle of having the name match the package, that's really only possible if we want to leverage the fast namespace here; though, I think that would cause more confusion. I'll ping @levithomason as FYI here as we discussed the organization under "web-components" the other day.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecraig12345 I think we need to work on integrating releases. We will likely need to prioritize that discussion, but in the meantime - are we able to release manually within the scope of the package? I have permissions to publish to this package at that namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question here - if we need to publish separately from the current system, do I need to opt out of the change requests to pass the build? If so, is that acceptable to do as part of this PR?

"test-firefox:verbose": "karma start karma.conf.js --browsers=FirefoxHeadless --single-run --coverage --reporter=mocha"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.7.13",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having different versions of build and types dependencies between this package and the rest of the repo is going to cause some headaches:

  • We use syncpack to validate that all packages have matching dependency versions (otherwise we're relying on people noticing duplicates in yarn.lock, and things regularly used to sneak through that way and cause problems later). Unfortunately, syncpack currently has no option to ignore a particular package or allow multiple versions for certain deps, so we'll need to either find a different tool, or add this feature to syncpack (original or fork).
  • Largely due to the common practice of type packages using * as the version spec when depending on other type packages, if multiple versions of the same types are installed, it can be unpredictable which one will be picked up
  • I think having multiple versions of typescript or other dependencies around can also cause problems (don't remember specifics as I haven't had to deal with this for awhile)

In some cases, we may be able to resolve the dependency mismatches without too much trouble, but in other cases it will require work in either web-components or the entire repo to handle a nontrivial upgrade or downgrade.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to reconcile these, but one we won't be able to reconcile is Typescript. There are ways to prevent hoisting of certain packages to the root which in the case of Typescript may be beneficial for the short term.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of these have been reconciled. I did add a flag to prevent hoisting of the TS related dependencies here, so that should leave everything else undisturbed and install those locally for use in this package: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/

packages/web-components/package.json Outdated Show resolved Hide resolved
"main": "dist/esm/index.js",
"types": "dist/fast-components-msft.d.ts",
"unpkg": "dist/fast-components-msft.min.js",
"scripts": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this package to build properly with the rest of the repo, there may be some modifications needed to the scripts and/or to the CI job.

We use lerna run to run the following scripts in each package:

  • clean
  • build: core build stuff, usually running TS but not bundling (though this could vary by package)
  • bundle: runs webpack if appropriate (not all packages have this)
  • lint: runs eslint
  • prettier: runs prettier (without --write option by default)
  • test: runs tests (mostly unit tests)

If there are any other scripts that you need run as part of the PR/CI job, azure-pipelines.yml will need to be modified to handle that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the task to clean from clean:dist and eslint to lint. I've dropped prettier as it doesn't seem to be defined for any of the other packages and running at the root accomplishes what's needed. While we have several tests denoted in here, the primary task is labelled test. Hopefully that reconciles where need be!

packages/web-components/package.json Show resolved Hide resolved
@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-web-components branch from a338632 to e4341aa Compare July 24, 2020 23:13
@@ -81,6 +81,12 @@
"packages/fluentui/*"
]
},
"nohoist": [
"packages/web-components/typescript",
"packages/web-components/tsconfig-path",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one it should be okay to update the version in scripts to match yours.

package.json Outdated
"packages/web-components/typescript",
"packages/web-components/tsconfig-path",
"packages/web-components/ts-loader",
"packages/web-components/ts-node"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing anywhere obvious that you're using ts-node? Unless it's a peer dep of something.

@EisenbergEffect
Copy link
Contributor

While I appreciate the desire to fully align all deps, linting, etc. I don't think that should be a requirement in the short-term (and for some things, perhaps never). It's important to note that we're building a tech stack from the ground up, with no dependency on React. As such, we have different patterns than would be expressed in React components.

A few examples:

  • Some of our lint rules are configured to facilitate FASTElement patterns, because the way we implement components is significantly different from React.
  • The web components community uses different libraries and patterns for testing than React. For example, Jest is not typically used.
  • I'm working with tc39 and TypeScript on new JS language features, some of which are based on web components patterns. So, I want to be free to leverage a particular version of TS and particular settings of the compiler based on that for our work on FASTElement, which will trickle down to the Fluent web components.

yarn.lock Outdated
Comment on lines 5121 to 4964
ansi-align@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb"
integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==
dependencies:
string-width "^3.0.0"

ansi-colors@3.2.3:
ansi-align@^3.0.0, ansi-colors@3.2.3:
name ansi-align
Copy link
Member Author

@chrisdholt chrisdholt Jul 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecraig12345 If this was a manual change I believe it's broken the repo from being able to be built. I'll need to try and revert (at least) this change. Were there any other manual changes to the lockfile being made as part of this? Is manually modifying the yarn.lock file a common practice? My concern would be the introduction of breaks fairly easily by messing with how yarn resolves and manages dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah...that part was a mistake, sorry. Yarn probably warned about it but it got lost in the sea of spurious missing peer dependency warnings. I just pushed a fix. (The fix process is to delete the invalid entry and run yarn to let it be regenerated.)

To the other part of your question, there were quite a few manual changes because yarn tends to resolve new dependencies in a way that results in often-unnecessary duplicates (like we saw with babel and storybook), and I'm not sure how to completely work around it without manual changes.

For example, say you have some existing (probably indirect) dependency on foo@^1.1.0 which yarn resolved to foo@1.1.0 and put in the lockfile. Then something else adds a dependency (again, probably indirect) on foo@^1.2.0 . Instead of changing both to resolve to foo@1.2.0, which satisfies both semver specs, it adds a separate entry/resolution just for the new spec. (IIRC this can even happen with older semver specs: a new indirect dep on foo@^1.0.0 will also result in a separate resolution being added to the newer foo@1.2.0.)

I'm pretty sure this is an intentional behavior done for safety purposes (at least avoiding the implicit upgrade of the original foo@^1.1.0 to foo@1.2.0...adding a separate resolution to a newer version for foo@^1.0.0 just seems weird) but is less than ideal from an install time/size perspective--especially in cases like babel or storybook stuff that has a bunch of dependencies and you get a cascading effect.

Regarding how to validate manual changes, yarn does warn on blatantly invalid things like this, so I should have looked more closely through the sea of peer dep errors to check for any real issues. Beyond that, generally as long as the repo builds and tests pass afterwards, it's probably fine. Also I try and avoid messing with direct dependencies where version upgrades may be particularly impactful, but we usually try and lock those down to a pretty specific version (~ or exact) to begin with.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably possible to resolve some of this without manual changes using yarn upgrade or yarn upgrade-interactive, and maybe I should try that first in the future instead. Both take an optional package name or scope, so it may be possible to do something similar to what I was doing manually with yarn upgrade-interactive.

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Jul 28, 2020

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 1006 985 5000
ButtonNext mount 660 598 5000
Checkbox mount 1994 1806 5000
CheckboxBase mount 1546 1643 5000
CheckboxNext mount 1819 1896 5000
ChoiceGroup mount 5334 5707 5000
ComboBox mount 918 915 1000
CommandBar mount 7181 7278 1000
ContextualMenu mount 12100 11983 1000
DefaultButton mount 1053 1078 5000
DetailsRow mount 3461 3448 5000
DetailsRowFast mount 3612 3418 5000
DetailsRowNoStyles mount 3306 3258 5000
Dialog mount 1450 1443 1000
DocumentCardTitle mount 1688 1645 1000
Dropdown mount 2378 2403 5000
FocusZone mount 1655 1699 5000
IconButton mount 1736 1640 5000
Label mount 313 335 5000
Link mount 455 464 5000
LinkNext mount 433 476 5000
MenuButton mount 1374 1513 5000
Nav mount 3088 3039 1000
Panel mount 1374 1429 1000
Persona mount 792 799 1000
Pivot mount 1267 1263 1000
PivotNext mount 1224 1315 1000
PrimaryButton mount 1181 1181 5000
SearchBox mount 1284 1352 5000
SearchBoxNext mount 1302 1292 5000
Slider mount 1446 1463 5000
SliderNext mount 1798 1770 5000
SpinButton mount 4734 4653 5000
SpinButtonNext mount 4851 4822 5000
Spinner mount 413 385 5000
SplitButton mount 3013 2924 5000
Stack mount 497 497 5000
StackWithIntrinsicChildren mount 1787 1807 5000
StackWithTextChildren mount 4995 4919 5000
TagPicker mount 2606 2607 5000
Text mount 391 413 5000
TextField mount 1262 1360 5000
ThemeProvider mount 2766 2712 5000
ThemeProvider virtual-rerender 462 497 5000
Toggle mount 832 831 5000
ToggleNext mount 804 781 5000
button mount 112 112 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🎯 Avatar.Fluent 0.43 0.46 0.93:1 2000 859
🦄 Button.Fluent 0.11 0.18 0.61:1 5000 546
🔧 Checkbox.Fluent 0.6 0.35 1.71:1 1000 599
🎯 Dialog.Fluent 0.15 0.21 0.71:1 5000 741
🔧 Dropdown.Fluent 2.79 0.48 5.81:1 1000 2794
🔧 Icon.Fluent 0.14 0.05 2.8:1 5000 714
🎯 Image.Fluent 0.07 0.1 0.7:1 5000 360
🔧 Slider.Fluent 1.51 0.34 4.44:1 1000 1507
🔧 Text.Fluent 0.07 0.02 3.5:1 5000 356
🦄 Tooltip.Fluent 0.1 14.38 0.01:1 5000 504

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
ButtonMinimalPerf.default 180 161 1.12:1
BoxMinimalPerf.default 344 319 1.08:1
VideoMinimalPerf.default 641 595 1.08:1
PortalMinimalPerf.default 123 115 1.07:1
TreeWith60ListItems.default 220 205 1.07:1
Icon.Fluent 714 669 1.07:1
DropdownManyItemsPerf.default 764 722 1.06:1
HierarchicalTreeMinimalPerf.default 433 407 1.06:1
AccordionMinimalPerf.default 147 140 1.05:1
AttachmentMinimalPerf.default 162 154 1.05:1
ListWith60ListItems.default 1090 1042 1.05:1
Text.Fluent 356 338 1.05:1
Tooltip.Fluent 504 478 1.05:1
FormMinimalPerf.default 407 390 1.04:1
GridMinimalPerf.default 347 334 1.04:1
TableMinimalPerf.default 398 382 1.04:1
AvatarMinimalPerf.default 464 450 1.03:1
ListCommonPerf.default 953 925 1.03:1
RadioGroupMinimalPerf.default 420 408 1.03:1
IconMinimalPerf.default 655 639 1.03:1
TextMinimalPerf.default 334 325 1.03:1
Avatar.Fluent 859 835 1.03:1
Button.Fluent 546 528 1.03:1
CarouselMinimalPerf.default 441 433 1.02:1
LayoutMinimalPerf.default 395 388 1.02:1
MenuButtonMinimalPerf.default 1531 1506 1.02:1
ProviderMergeThemesPerf.default 1833 1800 1.02:1
ProviderMinimalPerf.default 874 854 1.02:1
SegmentMinimalPerf.default 342 334 1.02:1
SplitButtonMinimalPerf.default 3657 3583 1.02:1
StatusMinimalPerf.default 681 668 1.02:1
TableManyItemsPerf.default 2246 2208 1.02:1
TextAreaMinimalPerf.default 483 472 1.02:1
ToolbarMinimalPerf.default 926 904 1.02:1
TooltipMinimalPerf.default 751 736 1.02:1
Dialog.Fluent 741 727 1.02:1
Image.Fluent 360 353 1.02:1
AnimationMinimalPerf.default 378 374 1.01:1
CardMinimalPerf.default 538 533 1.01:1
CheckboxMinimalPerf.default 2754 2730 1.01:1
DividerMinimalPerf.default 367 364 1.01:1
DropdownMinimalPerf.default 2755 2734 1.01:1
InputMinimalPerf.default 1271 1260 1.01:1
LabelMinimalPerf.default 404 399 1.01:1
ListNestedPerf.default 876 870 1.01:1
RefMinimalPerf.default 190 188 1.01:1
TreeMinimalPerf.default 855 849 1.01:1
Dropdown.Fluent 2794 2775 1.01:1
ChatMinimalPerf.default 582 583 1:1
DialogMinimalPerf.default 729 726 1:1
EmbedMinimalPerf.default 1890 1889 1:1
HeaderMinimalPerf.default 346 347 1:1
ItemLayoutMinimalPerf.default 1273 1276 1:1
LoaderMinimalPerf.default 708 707 1:1
MenuMinimalPerf.default 841 838 1:1
SliderMinimalPerf.default 1522 1520 1:1
CustomToolbarPrototype.default 3497 3493 1:1
AttachmentSlotsPerf.default 1145 1152 0.99:1
ChatDuplicateMessagesPerf.default 405 411 0.99:1
Slider.Fluent 1507 1520 0.99:1
ButtonSlotsPerf.default 569 583 0.98:1
HeaderSlotsPerf.default 766 781 0.98:1
ListMinimalPerf.default 453 462 0.98:1
PopupMinimalPerf.default 631 641 0.98:1
ChatWithPopoverPerf.default 450 466 0.97:1
FlexMinimalPerf.default 254 262 0.97:1
ReactionMinimalPerf.default 390 403 0.97:1
AlertMinimalPerf.default 292 303 0.96:1
ImageMinimalPerf.default 381 396 0.96:1
Checkbox.Fluent 599 623 0.96:1

@ecraig12345
Copy link
Member

While I appreciate the desire to fully align all deps, linting, etc. I don't think that should be a requirement in the short-term (and for some things, perhaps never). It's important to note that we're building a tech stack from the ground up, with no dependency on React. As such, we have different patterns than would be expressed in React components.

Chris and I have been talking about this and resolved or worked around most of the issues for now.

There are a few different reasons for wanting dependency alignment where reasonable, primarily revolving around maintainability. (You have some good points about exceptions, which I responded to below.)

  • When something breaks and blocks everyone's PRs, who's responsible for fixing it? At the moment in this repo, that often falls to me. Adding yet another build stack (especially one which the primary repo owners are less familiar with) increases the possibility of breaks and complexity of fixing them. We need to at least have a clearly communicated plan for addressing this situation, with backups in case the primary person is OOF.

  • I've seen instances in the past where having different tool versions in the same repo causes hard-to-diagnose issues. One place I know this can come up is with type packages, since they typically use a * version spec when depending on other type packages. Pretty sure I've seen other issues like this too (including maybe with typescript), but unfortunately it's been long enough that I don't remember specifics--hopefully the nohoist settings Chris added for particular dependencies will help avoid this.

  • We use syncpack to avoid accidentally having multiple versions of the same dependency, since that's been a problem in the past. However it's not very configurable currently: either on or off per package; can't vary only some of the deps. For now we fixed some of the mismatches but temporarily turned off syncpack checks for web-components. (I also made a feature request to enable varying individual deps, and might help implement since it would be useful to us in various scenarios.

  • Trying to keep install time (and size) from getting even worse

Regarding the specific cases you mentioned where not aligning dependencies may make sense:

  • Some of our lint rules are configured to facilitate FASTElement patterns, because the way we implement components is significantly different from React.

This is a good point, but I do still think that long-term, it would be nice to align our non-stack-specific rules if possible (definitely not blocking on that now). Having significantly different rules within the same repo could be confusing to contributors, unless there's no overlap between who's contributing to which packages. Though I guess you could also argue that having different rules in the web components package and the main FAST repo would confuse developers moving between the two of those, so maybe the question is where there will be more overlap.

  • The web components community uses different libraries and patterns for testing than React. For example, Jest is not typically used.

Agreed, this is an area where aligning is not really necessary.

  • I'm working with tc39 and TypeScript on new JS language features, some of which are based on web components patterns. So, I want to be free to leverage a particular version of TS and particular settings of the compiler based on that for our work on FASTElement, which will trickle down to the Fluent web components.

I definitely understand wanting to be able to pick up new features in a way that suits your requirements, as well as sometimes wanting to experiment with new versions in selective packages (could see us wanting that with react components sometimes too). But if we do start sharing code between web component and React packages, any package with shared code will always have to use the "lowest common denominator" TS version to avoid breaks. (There's also the potential for other breaks due to multiple TS versions, which I really wish I remembered the details of better...)

@chrisdholt
Copy link
Member Author

I definitely understand wanting to be able to pick up new features in a way that suits your requirements, as well as sometimes wanting to experiment with new versions in selective packages (could see us wanting that with react components sometimes too). But if we do start sharing code between web component and React packages, any package with shared code will always have to use the "lowest common denominator" TS version to avoid breaks. (There's also the potential for other breaks due to multiple TS versions, which I really wish I remembered the details of better...)

@ecraig12345 Thanks for the response above. I won't speak to everything there, but I do want to zero in on this specific final paragraph.

While I understand the goals of keeping dependencies shared in an effort to minimize conflicts, keep build times down, etc - we can't move forward under the premise of using the "lowest common denominator". Web components have a specific browser matrix which doesn't include many of the down-level browsers which need to be supported by Fluent React. The requirements are fundamentally different and in order to offer the best possible web component solution, we can't build for the lowest common denominator. In many cases, these are browsers which will never have support for custom elements, decorators, css custom properties, etc. Ultimately, to provide the best possible web component experience, I don't think we can have a requirement that we share code with other packages in this repo. I'm totally on board with a goal of shared code, but that can't eclipse the goals of the Web Component package. Again, I totally understand the goals and intent with sharing dependencies and code across the mono repo - but from a core requirement standpoint, the WC's need to be able to stand alone. Ultimately, the web component work can't be held back for the lowest common denominator.

@ecraig12345
Copy link
Member

One quick clarification is that the "lowest common denominator" comment only applies to the TS version of any hypothetical future packages which contain code shared between different tech stacks (if/when we reach that point), not really anything about browser support, and wouldn't be a concern if there are never shared-code packages.

@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-web-components branch from 2031f78 to 5783b63 Compare July 29, 2020 21:55
@chrisdholt
Copy link
Member Author

@ecraig12345 super odd - but the test failures I saw in master on my mac don't repro when pushing :). Looks like all checks passed if you want to take another look. + @dzearing as FYI.

@ecraig12345 ecraig12345 merged commit a7bc9aa into microsoft:master Jul 30, 2020
@dzearing
Copy link
Member

Woohoo!

@BrunoBlanes
Copy link
Contributor

Now that the web components have been moved here, I was wondering if there is going to be an in-depth documentation for how to properly use it as with all the other Fluent UI packages. The FAST documentation isn't really as explanatory as Fluent's.

@chrisdholt
Copy link
Member Author

Hey @BrunoBlanes - thanks for this. We're working with the team to coordinate a shared documentation story for these. I'll also write up an issue here as I think we'll need a temporary solution as well. Are there specific things you would like to see prioritized while we work to coordinate the docs story with the existing Fluent solutions?

@BrunoBlanes
Copy link
Contributor

BrunoBlanes commented Jul 30, 2020

Yes, it is a bit hard to use JavaScript with Blazor, so it makes it even harder to apply custom styling to components. For example, Fluent UI React allows me to set a custom theme, using the Theme Designer and the createTheme() function, to all my components:

const myTheme = createTheme({
  palette: {
    themePrimary: '#0078d4',
    [...]
  }});

With FAST Design I haven't yet figured out how to do customizations on a general level.

Blazor also doesn't support NPM so we have to rely on CDN scripts and I couldn't get it to work with FAST Design using TypeScript. The compiled JS version of Fluent UI's tutorials is much less complex then FAST Design.

Also I've been using codepen.io to better understand what I have to do to use Fluent UI in Blazor and the direct demo links just saves a lot of time, those aren't available on FAST Design's documentation.

I think improving the Blazor specific documentation of both FAST Design and Fluent UI is very important given how much Blazor is expected to grow and also taking into consideration that there aren't many UI libraries available to use with Blazor right now let alone consistent ones like Fluent.

Quick note about using Fluent UI React with Blazor, before I knew about FAST I was trying to create Razor Components for every Fluent UI component I would be using, but I have been advised against it because of possible conflicts between React and Blazor. So FAST is the one and only option to use Fluent in this case that I know of.

tmaster628 pushed a commit to tmaster628/fluentui that referenced this pull request Aug 12, 2020
…ield styling issue (microsoft#14203)

* feat: add web components to fluent ui as a new package

* yarn lockfile

* Fix dependency versions and scripts

* Exclude web-components from publishing

* fix invalid dep

* do not hoist types in web components

* update repo url to package location

Co-authored-by: Elizabeth Craig <elcraig@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Intent to contribute FAST web components for FluentUI
7 participants