热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CSSbackgroundcolor,CSScolor,andlayerrecipesintheDesignSystemProvider

Problem:WhenusingtheDesignSystemProviderthereexistse


Problem:

When using the DesignSystemProvider there exist several disconnects that make the implementation difficult to use:

  1. The provider does not apply a CSS
    1
    background-color

    to the element aligning to the designSystem.backgroundColor property


  2. The provider does not apply a CSS
    1
    color

    to the element aligning to the designSystem.backgroundColor property


  3. The provider's
    1
    backgroundColor

    property cannot be assigned a recipe.


1 and 2 make the out-of-box experience bad because the color of non-FAST content will be inaccessible and obviously incorrect.

3 is more of an interop problem within the FAST system. The FAST system provides and encourages use of the "layer" recipes to be used as app-region background colors but this implementation of the DesignSystemProvider does not facilitate doing so.

Proposal


1. and 2. - CSS color & background-color

1 and 2 can be remedied rather simply. When the

1
backgroundColor

property of the provider is explicitly set, the provider should attach the following stylesheet:

1
2
3
4
5
6
7
8
9
jsx

css`

:host {

    background-color: var(--background-color);

    color: var(--neutral-foreground-rest);

}

`.attachBehavior(

    neutralForegroundRestBehavior

);

While generally desired, I can imagine cases where a user may not want this behavior so we would want a mechanism to disable attachment. This could be done with a boolean attribute:

1
2
3
jsx




or with a property:

1
2
jsx

FASTDesignSystemProvider.drawBackgroundDisabled = true;


3. - Recipe backgrounds

Another commonly desired cases is to set the value of the

1
DesignSystem.backgroundColor

to the product of a recipe. This often crops up in cases where the layer recipes are used -

1
neutralLayerL1

,

1
neutralLayerL2

, etc.

We could enable the following:

1
2
jsx

FASTDesignSystemProvider.backgroundColor = neutralLayerL1;

When assigned a recipe / fn, the provider would evaluate the recipe when setting

1
FASTDesignSystemProvider.designSystem.backgroundColor

and which would in turn assign the

1
--background-color

CSS Custom Property to the product of the recipe.

A question arises from the above of which

1
designSystem

object the above resolution function should be generated with. There are three viable options:

  1. The parent provider's design system
    1. The downside to this approach is that a user could not set the
      1
      baseLayerLuminosity

      and the background color on one provider to achieve a light/dark mode change. In fact, the recipe would not see any

      1
      designSystem

      changes on the element with the background change. I think this is a big enough miss that this option should not be selected but it is included for completeness.



  2. The local design system
    1. This option would invoke the recipe to resolve the background color with the local design system object. This facilitates cases like light/dark mode switching using a single node, because the recipe would see the designSystem changes applied to the node.

    2. The only reasonable down-side or disconnect I see to this is that it could create recursive behavior that would likely be undesirable. Because this recipe sets a property on the
      1
      designSystem

      (

      1
      designSystem.backgroundColor

      ), if the recipe uses

      1
      designSystem.backgroundColor

      in determining the color product then each invocation will be relying on the previous invocations product - recursive color resolution. This would likely be an unintuitive and undesired behavior.



  3. The hybrid design system
    1. To address the issue described by 2.2, we could supply the fn a hybrid design system, where every property besides the property being set is derived from the local designSystem object, and the property being set (
      1
      backgroundColor

      ) is derived from the parent design system.


    2. Another solution would be to omit the color from the invocation of the recipe so that it cannot be relied upon.


该提问来源于开源项目:microsoft/fast

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


推荐阅读
  • WPF之Binding初探
      初学wpf,经常被Binding搞晕,以下记录写Binding的基础。首先,盗用张图。这图形象的说明了Binding的机理。对于Binding,意思是数据绑定,基本用法是:1、 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • java布尔字段用is前缀_POJO类中布尔类型的变量都不要加is前缀详解
    前言对应阿里巴巴开发手册第一章的命名风格的第八条。【强制】POJO类中布尔类型的变量都不要加is前缀,否则部分框架解析会引起序列化错误。反例:定义为基本 ... [详细]
  • Highcharts翻译系列之二十:曲线图例子(二)
    Highcharts翻译系列之二十:曲线图例子(二)代码 ... [详细]
  • POJ 1046 Color Me Less
    ColorMeLessTimeLimit: 1000MS MemoryLimit: 10000KTotalSubmissions: 31449 Accept ... [详细]
  • PS网页设计教程VIII——在Photoshop中设计不同寻常布局
    作为编码者,美工基础是偏弱的。我们可以参考一些成熟的网页PS教程,提高自身的设计能力。套用一句话,“熟读唐诗三百首,不会作诗也会吟”。本系列的教程来源于网上的PS教程,都是国外的,全英文的。本人尝 ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • Java实战之电影在线观看系统的实现
    本文介绍了Java实战之电影在线观看系统的实现过程。首先对项目进行了简述,然后展示了系统的效果图。接着介绍了系统的核心代码,包括后台用户管理控制器、电影管理控制器和前台电影控制器。最后对项目的环境配置和使用的技术进行了说明,包括JSP、Spring、SpringMVC、MyBatis、html、css、JavaScript、JQuery、Ajax、layui和maven等。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • skia~setDIBitsToDevice~Windows
    问题:skia是一个图形库,本身没有在设备上作图的能力,可以通过提供的SkView类,参考实现对不同平台设备上作画。SkOsWindow_Win.cpp:onPaint方法中提供了 ... [详细]
  • 记录一些 Latex 的技巧
    Latex一些技巧:1.如何创建不浮动的的figure和table\makeatletter\newcommand{\figcaption}{\def\captyp ... [详细]
  • 我正在使用ChemDoodleWebComponents在网页上显示分子。基本上,我可以在我的页面中插入以下脚本,它将创建一个HTML5canvas元素来显示分子。vartrans ... [详细]
author-avatar
头都大了66
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有