weex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hanks Zhang <zhanghan...@gmail.com>
Subject [Proposal] Enhance and standardize Weex's style ability with CSSOM
Date Thu, 30 May 2019 08:42:13 GMT
## Background

To improve the development experience should be the priority of Weex and
Weex's style ability often be criticized by developers, it's not competent
enough and hasn't been improved for a long time.

I think we should take more efforts to improve our css features.

## What CSSOM can do?

CSSOM (CSS Object Module) is a specification in W3C which defines a group
of APIs for managing CSS, such as StyleSheet, CSSRule, Selectors, etc.

In particular, CSSOM can bring more css selector support for Weex, the
performance will be improved as well. Moreover, CSSOM is a standard way to
implement css features, just as browsers do.

For example, the following css will be supported with CSSOM:

```css
/* @media rule */
@media screen and (min-width: 900px) {

  /* complex css selector */
  #root div text.title {
    padding: 1vw 3vh;  /* css shorthand */
    border: 2px dotted rgba(0, 24, 133, .2); /* compound values */
  }
}
```

## Implementation

I have already written a standalone C++ library to implement a lite version
of CSSOM, which only supports a subset of specs. It can be integrated into
Weex directly.

The following parts should be modified to achieve the goal:

* DSL Frameworks: Adjust the style management API and update the compilers.
* JS Framework: Sending the original class list to native, stop merging
them into inline styles.
* Weex Core: Integrate the cssom library, use it to store and query styles.

I'll share more technical details about it later. Looking forward to your
opinions.

Best Regards,
Hanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message