-
Notifications
You must be signed in to change notification settings - Fork 145
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: update vscode UI toolkit to fast v2 #273
feat: update vscode UI toolkit to fast v2 #273
Conversation
@hawkticehurst I'll look into the build failure. Something is not working with eslint. I'm going to look into that. As I mentioned previously I think, the |
eslint resolved - significant version mismatch between that used by the current FAST eslint rules and the repo. I've resolved to a similar version for now. We've had an rfc out (microsoft/fast#4468) for improving the rules and that would likely include changes to the versions; we can likely prioritize that. Seems like there's been some good improvements to eslint :). The build is related to a type issue that shouldn't be present, so I'll look into that. |
Build resolved! The issue the build was hitting was due to a type conflict for the compose function and its override function. We're tracking an issue for the error, but I was surprised to seeing it error in this context. The delta here is that there is the default definition for Foundation and an Override definition. In one of those, a type can be undefined so there is a mismatch. We just need to do some type work. To accommodate the issue, instead of dropping ALL currently enabled strict modes, I just turned this instance off. |
First off thank you again so much for this PR! 🎉🎊 Your description of changes was also super well written and helpful for understanding some of the major updates from foundation v1 to v2 so thank you for that! |
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.
Looks great thus far! Left a few random comments/questions.
I'll wait for some of the changes discussed in your comments to land and then do a final review/approval.
cf91e39
to
df9b713
Compare
Just an FYI - the reason that typescript needs to be pinned at 4.3.5 is outlined in this issue here: microsoft/TypeScript#46456. |
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.
Looks great to me! I'll defer to Hawk for the final sign off 🤘
@chrisdholt Cloned your PR locally to do some testing and looks like there are a couple of issues. Storybook
Note: We currently use the all-components sample extension to test the toolkit inside a real VS Code environment (we've found there are times when Storybook and Webviews have discrepancies in rendering). We have future plans of creating a proper automated testing pipeline, but for now, we just have to manually build the toolkit
|
I'll dig in and see what's going on here :) |
…rors due to renames
Got these resolved - a couple of type issues and then the Data Grid issue was related to needing to provide a mapping to register the base class. Should be all good! |
Yay! Thank you so much! I'll validate the changes, do a final PR review, and assuming all looks good I'm ready to approve and merge! |
@chrisdholt Looks like there are still issues with the data grid in the sample extension. Did this update change how the data grid should be instantiated? Currently, the default data grid is created with the following code in the sample extension. <vscode-data-grid id="default-grid" grid-template-columns="1fr 1fr 1fr 1fr" aria-label="Default"></vscode-data-grid> const defaultDataGrid = document.getElementById("default-grid");
defaultDataGrid.rowsData = [
{
column1: "Cell Data",
column2: "Cell Data",
column3: "Cell Data",
column4: "Cell Data",
},
{
column1: "Cell Data",
column2: "Cell Data",
column3: "Cell Data",
column4: "Cell Data",
},
{
column1: "Cell Data",
column2: "Cell Data",
column3: "Cell Data",
column4: "Cell Data",
},
]; |
How can I run/test this on my end? I believe what I've added should've addressed this, but would be good to know if I can run locally. |
Oh also as you look at the code inside the
|
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.
Left a few more comments on things to fix/discuss, but beyond that looks fantastic! I'm ready to merge once those are all addressed! 🎉
This is super cool! OK, I know what was causing the data grid issue and I don't know why I didn't think of it. The issue is with the regex for the template, we had to modify it to account for spacing w/r/t attributes/property bindings in templates. If you were to look at the DOM you'd see the Data Grid Cell template being absolutely mangled. I've updated the regex and ran things and everything looks gravy :) |
@@ -30,9 +30,8 @@ | |||
"test": "jest --verbose --coverage" | |||
}, | |||
"dependencies": { | |||
"@microsoft/fast-element": "^1.2.0", | |||
"@microsoft/fast-foundation": "^1.24.7", | |||
"lodash-es": "^4.17.21" |
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.
Bye bye! FYI @connor4312 👍
OK, we're all resolved I think 👍 |
Alright did my final checks and I'm ready to merge! A pleasant surprise is I just realized this update also fixed the bug discussed in #193. 🙂 |
Wooo! We're merged! Once more, thank you so much for your work on this @chrisdholt!!! 🎉🎊 I'll follow up shortly by publishing a new toolkit version to NPM. |
Link to relevant issue
This pull request resolves #261
This pull request resolves #193
Description of changes
This PR updates the VSCode Webview UI Toolkit to leverage FAST Foundation v2. In FAST Foundation v2 there are a number of improvements which add additional ergonomics and support to component libraries and design systems. The following details provide insight into the changes.
Foundation Element
One of the most significant changes for FAST Foundation v2 is the added support of FoundationElement and
Configuration
which provides a method of registration and additional configuration abilities by consumers of design systems and/or component libraries such as this.Templates and styles are functions
One part of this change is that templates and therefore styles in
@microsoft/fast-foundation
are now functions with arguments for a context and definition object.Context
While not a robust accounting of all features available, it may be helpful to know that context enables the easy nesting of components while still enabling the configuration of unique (dynamic) prefixes), providing greater extensibility. This allows FAST (and other DS authors such as vscode) to nest components without needing to know the finale web component prefix. Consider the below template and styles:
When registered by default, the output above will be:
Given a different prefix at registration time, such as
foo
, the button element and it's declaration in the styles file would referencefoo-button
.Definition
Definition provides another layer of customization at configuration time. Currently at the Fast Foundation level, the primary use of
definition
is to enumerate slots which should support "default slotted content". Rather than relying on slotted content to be baked into thefast-foundation
templates, libraries now define the default slotted content during composition. Additionally, users of these libraries/design systems are now able to register the elements with their own instance of default slotted content. Scenarios here may be the desire to swap out the default SVG for dropdown or to include a different SVG for the checkboxchecked
indicator.Registration
Previously, the default export was elements themselves and you would need to import and reference them to prevent tree shaking and ensure that they were available for use. Now, the export here is a registration for the element which enables its use.
More details on registration and configuration can be found here: https://www.fast.design/docs/design-systems/fast-frame#create-a-designsystem
Registration provides an opportunity to add global configurations across an application. Consider a scenario where (for some reason), an extension author needs to run the shadow DOM in
closed
mode - this, as well as template replacement, style changes, updates to default slotted content, etc...are all enable. Find out more about configuration during registration here: https://www.fast.design/docs/design-systems/fast-frame/#configuring-components-during-registrationAs always, CSS can be used to target elements globally, slotted content will project and replace any default slotted content, and everything else about HTML elements continue to work as expected.
Again, this isn't exhaustive, but hopefully this provides context for some clear deltas between v1 and v2.
Link to forked docs site
TBD...
Please see
CONTRIBUTING.md
for directions on how this can be done.