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 fast-components-msft as a new package #3096

Merged
merged 39 commits into from
May 15, 2020

Conversation

chrisdholt
Copy link
Member

@chrisdholt chrisdholt commented May 9, 2020

Description

This PR is the initial work for closes #3088. This PR creates a new package for fast-components-msft. The rewrite of existing styles for the FAST design system is not included as part of this PR. has been completed and a new package for fast-foundation was created to hold the templates, classes, and utilities needed to compose web components with FAST.

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@chrisdholt chrisdholt self-assigned this May 9, 2020
@chrisdholt chrisdholt changed the base branch from master to features/fast-components-msft May 9, 2020 18:59
@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-components-msft-package branch 3 times, most recently from 43bd04a to 268ff8f Compare May 10, 2020 00:46
Comment on lines 12 to 21
export class MSFTBadge extends Badge {
@attr
public fill: BadgeFill = "lightweight";
private fillChanged(oldValue: BadgeFill, newValue: BadgeFill): void {
if (oldValue !== newValue) {
this.classList.add(newValue);
this.classList.remove(oldValue);
}
}

// Can we remove this and circular as attrs if we don't want to leverage them?
// Can I set this internally only in this implementation?
@attr({ mode: "fromView" })
public color: string = "value";
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@microsoft/fast-dna-collaborators my thoughts on the implementation of Badge here was to tighten up the implementation to better align with the MSFT badge requirements. Ideally I'd like to not provide the color value here and just have things work as expected. Since we cannot remove or delete attributes from the classes here, I'm trying to consider how to manage the mappings.

It seems like having defaults for both fill and color make sense; while not illustrated above we could also ensure the extensibility by also supporting a string:

export type BadgeFill = "accent" | "lightweight" | "neutral" | string;

I'm not sure what to do with the color attribute in those scenarios though if we elect to handle them in the stylesheet.

Copy link
Contributor

Choose a reason for hiding this comment

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

The fast-components api would remain the same?

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 think this is part of the question...since we can't pull off existing attrs, extending from the Badge would expose all of those values - so yes, the API would stay the same. I think providing some default "named" configurations is helpful here, but wondering what our language/naming should align to. Recipes?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the naming seems right to me. It aligns with what we do elsewhere.

Copy link
Contributor

@eljefe223 eljefe223 May 11, 2020

Choose a reason for hiding this comment

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

The one thing about our react badge is that the filled version was yellow and not aligned with the accent color. So might want @bheston to chime in here.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I'd like some thoughts on the defaults - we can still keep things extensible. My concern with the yellow is that it won't respond to dark mode unless we leverage the provider which seems heavy-handed for a default value.

Bigger question in my mind is what to do with the color value (if anything)...do we provide it but not include a default value b/c the fill defaults will be recipe associated?

Copy link
Contributor

Choose a reason for hiding this comment

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

One option might be to move color so that it's defined on FASTBadge rather than Badge.

Copy link
Member Author

Choose a reason for hiding this comment

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

@EisenbergEffect there would be changes to the template as well I think - those values are set in a nested div as they are setting style attributes. I wonder if the deltas here are worth different API's or if we should keep consistent for the time being.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. Well, then it becomes a matter of what is worse, having some properties that don't apply vs. writing a whole new component.

<fast-divider></fast-divider>

<h4>Presentation</h4>
<fast-divider role="presentation"></fast-divider>
Copy link
Member Author

Choose a reason for hiding this comment

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

@microsoft/fast-dna-collaborators We've talked about having two different recipes based on whether this needs to be accessible to a screen reader. In the event that the divider is only for presentation, the recipe would not need to meet contrast requirements. In the event that it is exposed to AT, the recipe would meet contrast requirements. I think we should consider adding this for the MSFT implementation here. @bheston - thoughts on the recipe to use for the contrast requirement implementation?

@chrisdholt chrisdholt marked this pull request as ready for review May 11, 2020 16:34
Comment on lines 1 to 7
import {
designSystemProvider,
FASTDesignSystemProvider,
} from "@microsoft/fast-components";

@designSystemProvider("msft-design-system-provider")
export class MSFTDesignSystemProvider extends FASTDesignSystemProvider {}
Copy link
Member Author

Choose a reason for hiding this comment

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

@nicholasrice does this map to what you might expect here? I'd expect the default values to change here once we create the FAST system.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep

@eljefe223
Copy link
Contributor

Smoked to ensure everything is working properly

Copy link
Contributor

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

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

Main feedback to change the import format so that it adds the .js file extension for internal module imports.

@@ -0,0 +1,14 @@
import { customElement } from "@microsoft/fast-element";
import { Anchor, AnchorTemplate as template } from "@microsoft/fast-components";
import { AnchorStyles as styles } from "./anchor.styles";
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to prep for the new build setup, let's start this new package with file extension in imports. So, change to this:

import { AnchorStyles as styles } from "./anchor.styles.js";

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I wanted to do that work in a separate branch as part of the feature branch work. I can do in this package, but we'll need both packages to be touched prior to the feature branch merging in

Comment on lines 12 to 21
export class MSFTBadge extends Badge {
@attr
public fill: BadgeFill = "lightweight";
private fillChanged(oldValue: BadgeFill, newValue: BadgeFill): void {
if (oldValue !== newValue) {
this.classList.add(newValue);
this.classList.remove(oldValue);
}
}

// Can we remove this and circular as attrs if we don't want to leverage them?
// Can I set this internally only in this implementation?
@attr({ mode: "fromView" })
public color: string = "value";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

One option might be to move color so that it's defined on FASTBadge rather than Badge.

@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-components-msft-package branch from 268ff8f to 6169d67 Compare May 12, 2020 17:46
@EisenbergEffect EisenbergEffect self-requested a review May 12, 2020 17:57
@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-components-msft-package branch from aaa91e7 to d460759 Compare May 12, 2020 18:20
Copy link
Contributor

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

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

One thing I've been wondering about...should we use a different element prefix for each design system or not?

We've got "fast-" and now "msft-" for the element names. This will make it hard for people to switch out design systems. They'll have to re-write all their html. Also, the scenario where somebody builds a single UI and then just dynamically loads different design systems based on platform (ios, vs. material vs. msft) isn't really possible because the element names are different. If the element names were the same, then the design language and implementation could simply be switched at load.

Also, with different element names, it feels a bit more like different components as apposed to the same components with a different design system, at least to me.

In any case, I wanted to bring this up as I'm not sure if we've thought through these scenarios.

@chrisdholt
Copy link
Member Author

chrisdholt commented May 12, 2020

One thing I've been wondering about...should we use a different element prefix for each design system or not?

We've got "fast-" and now "msft-" for the element names. This will make it hard for people to switch out design systems. They'll have to re-write all their html. Also, the scenario where somebody builds a single UI and then just dynamically loads different design systems based on platform (ios, vs. material vs. msft) isn't really possible because the element names are different. If the element names were the same, then the design language and implementation could simply be switched at load.

Also, with different element names, it feels a bit more like different components as apposed to the same components with a different design system, at least to me.

In any case, I wanted to bring this up as I'm not sure if we've thought through these scenarios.

I think there are different ways to accomplish this. It really depends. The underlying intent here is that these are intended to be different stylesheets for the design systems. There will be different design system values as well between the FAST implementation and the MSFT implementation. This is not simply a configuration change at this point where we're swapping out the design system values - the entire system may be different for certain folks' implementations. Further, design systems apply values (such as corner radius) in different ways and based on different principles. Something like elevated-corner-radius isn't actually something that exists currently in the FAST design system. We simply have a corner-radius. Where we may want to make FAST extremely flexible and robust, it's quite possible that the MSFT design system will tighten up a bit more in an attempt to provide greater alignment with something like Fluent. It's possible over time that we will gain insight that will help us better support endless configuration of design systems easily, but we aren't there yet and I don't think it's wise for us to try and force alignment out of the gate.

I'm fine keeping this prefixed with fast-, but I'm curious if you think there are concerns with naming collision. Additional concerns are that the design systems and their default values are different, but we now have alignment in name.

To your last point - I think it's extremely important to be clear - these are different custom elements and not just a different design system configuration. If we swap the default stylesheet to align with the FAST, we cannot create exactly the MSFT styled components. Currently we would need class overrides to ensure that the components look exactly like we currently expect the MSFT components to look. There are certain things which are just going to be different, like the thumb on slider. To accomplish that with the design system, we would need to elevate a value or principle to the design system that currently doesn't really exist. That's just one example. Over time, there may be greater divergence here between systems as well.

RESOLVED: For interoperability and to ensure that there is clarity that while these may be styled differently they are a single set of components, we'll prefix with FAST.

@@ -0,0 +1,47 @@
{
"name": "@microsoft/fast-components-msft",
"description": "A library of Web Components",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we specify these are Microsoft styles?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-components-msft-package branch 3 times, most recently from 7085a9e to d464ed3 Compare May 15, 2020 00:13
@chrisdholt chrisdholt requested a review from bheston as a code owner May 15, 2020 00:13
@chrisdholt chrisdholt changed the base branch from features/fast-components-msft to master May 15, 2020 00:13
@chrisdholt chrisdholt force-pushed the users/chhol/add-fast-components-msft-package branch from d464ed3 to 53b16c0 Compare May 15, 2020 02:00
})
public backgroundColor: string;

@attr({ attribute: "accent-base-color", ...fromView })
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for the @attr or @observable anymore - see the fast-components version

@eljefe223
Copy link
Contributor

Smoked both packages, There seems to be a small amount of visual issues especially around focus. But I think all these issues were already there.

The only big issue I see is the tabbing behavior on the MSFT Text Field. You need to tab twice on each control, once to focus the container and again to be able to start typing

@chrisdholt
Copy link
Member Author

Smoked both packages, There seems to be a small amount of visual issues especially around focus. But I think all these issues were already there.

The only big issue I see is the tabbing behavior on the MSFT Text Field. You need to tab twice on each control, once to focus the container and again to be able to start typing

Great catch - missing delegate focus. We'll do another run on any remaining visual issues. Well done!

@chrisdholt chrisdholt merged commit 0165009 into master May 15, 2020
@chrisdholt chrisdholt deleted the users/chhol/add-fast-components-msft-package branch May 15, 2020 03:39
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
chrisdholt added a commit that referenced this pull request May 18, 2020
* initial work to create fast-components-msft

* add styles packages for patterns

* add msft anchor

* add msft button

* add msft badge - outstanding issues

* add msft card

* add msft checkbox

* add msft dialog

* add msft divider

* add msft flipper

* add msft progress - do we want to narrow support to align with guidance?

* add msft radio

* add MSFT radio group

* add msft slider and slider-label

* add msft switch

* add msft tabs - need to ensure alignment of tab panel with tabs

* add msft text area

* add msft text field

* export all components from root

* fix eslint errors

* update imports from fast-components

* add .js extension to anything distributed

* update readme to include install instructions

* update prefix to align with fast

* update package.json description

* update tsconfig

* add dependency for fast-components-styles-msft

* update design system provider to use MSFT design system

* remove js extensions for the time being

* update imports for fast-foundation

* update behavior imports to correct internal path

* update pathing for forcedColors behavior

* fix order of imports

* update system-colors path

* update imports for  shared utils added to foundation

* fix design system signature and update to new textarea api with default slot for label

* remove unused behavior and fix color on text field

* update design system values and remove unused vars

* fix text field focus bug
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.

[Intent to implement] Change default styles for fast-components and create a new MSFT package
5 participants