1-1 Introducing Polymer 1.0 介绍Polymer1.0

layout: default
type: about
title: Introducing Polymer 1.0
subtitle: About this release
shortname: Introducing
布局:默认
类型:关于
标题:引入Polymer 1.0
字幕:关于本次发行
简称:介绍

The 1.0 release of the Polymer core library is now out.
Polymer核心库1.0现在已经发布。
This release is optimized for performance and size. We're working hard on filling out the feature set. See the roadmap for more detailed timelines.
此发行版对性能和尺寸进行了优化。我们正在努力填写功能集。参看路线图有更详细的时间表。
<strong>BREAKING CHANGES.</strong>
This release is <strong>not compatible with the 0.5 APIs.</strong>
此版不兼容0.5版

Highlights

要点

  • Dramatically faster startup time and runtime performance than 0.5, even in Chrome where web components are natively supported.
  • Significantly smaller payload than 0.5.
  • Completely refactored internally to be clearly layered and much less complex.
  • Brand new data-binding system that is simpler, faster, offers tighter control, and is easier to debug.
  • Brand new, lightweight shadow DOM shim called shady DOM, that lets you avoid the complexity, size, performance penalty, and invasiveness of the shadow DOM polyfill.
  • Upper bound and lower bound scoped styling, even without native shadow DOM: scoped styles don’t bleed out, and children in their own roots are protected from descendant selectors in a shadow root.
  • 超过0.5版显著更快的启动时间和运行时性能,即使在Chrome Web组件的原生支持。
  • 显着较小的有效载荷比0.5。
  • 完全重构内部可分层更复杂。
  • 新的数据绑定系统更简单,速度更快,提供了更严格的控制,而且更容易调试。
  • 全新的,轻量级的DOM的垫片称为shady DOM,让你避免复杂性,尺寸,性能损失,而阴影DOM polyfill侵袭。
  • 上限和下限范围的造型,即使没有native shadow DOM:范围的风格不流血,和孩子们在自己的根是从保护后代选择器在阴影的根。
    There's a lot more to 1.0—check out the Developer guide for
    the run-down of all the features.

Benchmarks {#benchmarks}

As a sample of the performance difference between 0.5 and 1.0,
the results from our medium-list benchmark was that {{site.project_title}} 1.0 was about 3x faster on Chrome and 4x faster on Safari. The benchmark measures time to first
paint for an application with a few thousand nested custom elements, with data
binding.

You can find the benchmark code on
GitHub
. As with all benchmarks, your
mileage may vary. Please try it out or create your own tests—we'd love
to see them.

Roadmap {#roadmap}

The following is a high-level outline of our plans for the library post-1.0.

Gestures

{{site.project_title}} 0.5 had a fairly robust gesture recognition system—1.0 includes basic gestures as part of the core library. More sophisticated gestures may be added in a future release as an optional components.

Shady DOM Interoperability

The shady DOM system is new to Polymer in 1.0, and radically improves
performance and decreases the size of the polyfill needed to run on browsers
that don’t support shadow DOM natively. The shadow DOM polyfill was optimized
for correctness, though it remained impossible to perfectly polyfill shadow DOM.
Shady DOM is optimized for speed.

If you're curious about the motivation behind creating shady DOM, see What is shady dom?.

In the immediate future we’ll be exploring improvements to the shady DOM system to improve interoperability with other frameworks. Shadow DOM is of course the ultimate primitive to allow for interoperability, but with shady DOM we may be able to shim such interoperability to a significant degree, focusing on common interoperability use cases.

Cross-scope styling

The "theming problem"—you want to be able to easily style Polymer
elements from the outside, but ::shadow and /deep/ proved to be a poor solution and are slated to be removed from the Shadow DOM spec. This release includes a robust system for ergonomic cross-scope styling
inspired by and based on [CSS Custom Properties](http://dev.w3.org/csswg/css-
variables/).

We’ll continue to refine and improve the performance of this system. We’ll also be exploring new features around mixing in bags of properties to be redistributed to individual child elements, as well as passing arguments to mixins.

Binding features

There are a few binding and template features we’ll be working on.

We’ll explore growing support for parser-challenged elements like <table> in <dom-repeat>’s.

We’ll also be adding in support for compound binding and string interpolation in bindings:

    {%raw%}<div>Dear {{ title }} {{ lastName }},</div>{%endraw%}

Finally, we’ll be exploring adding in a layer for using Object.observe to power the data-binding system.

Contributing shady DOM to web components polyfills

We’d like to explore modularizing the shady DOM shim to be able to utilize its manipulation of scoped DOM sub-trees outside of Polymer. We’d love to be able to add this very lightweight and performant system to the broader set of web component polyfills as an alternative to the shadow DOM polyfill.

Pre-processing stylesheets

Currently Polymer uses a run-time shim for CSS custom properties to enable theming and styling elements. If you know that your styles won’t change dynamically, there is a potential performance improvement to realize by calculating all the resulting styles in advance.

We’re working on building a tool—either as an extension to vulcanize or as a separate package—that will allow you to generate all the cross-scope styling at build-time, and bump performance a bit.

Tooling

The {{site.project_title}} team is devoting a lot of work to tooling. There are four tools in our immediate sights to work on post-1.0:

  • Stylesheet preprocessor.
  • {{site.project_title}} linter to help catch common errors that come up when developing with {{site.project_title}}.
  • “Data explorer” to help visualize data flow within a {{site.project_title}} application.
  • A tool to help teams manage releases for large numbers of inter-dependent elements—we certainly are in dire need of this ourselves!

Inheritance

Inheritance is a great feature introduced with native Custom Elements. 1.0
supports extending native HTML elements using the is attribute, but doesn’t
yet support extending custom elements. There are two main reasons that this has
so far landed outside the 1.0 scope:

  1. it is a more complex problem to solve than it was in 0.5 given some of the performance optimizations we have made.
  2. from building lots and lots of elements, we've found that you can get nearly 100% of the way using Polymer’s “behaviors” mechanism and composition.

That said, there are certainly some legitimate use-cases for true custom element
inheritance, and we fully plan to support inheritance to the extent that it
existed in 0.5.

FAQ's

We'll update this section as asked-questions become frequently-asked.

Where did the elements go?

Not all elements have been ported to the current release, but we're porting them
as fast as we can. You can find the updated elements on the all-new Element catalog.

The elements are being reorganized into more consistent product lines, including:

  • Iron elements. Basic elements that don't express a visual style.
    Most of the old core- elements are being renamed to iron-.
    Some former core- elements that implemented material design (such as core-toolbar,
    core-menu, core-header-panel) are being migrated to paper-.

  • Paper elements. Material design elements. All of the old paper- elements,
    plus a few of the old core- elements.

  • Neon elements. Animation elements.

Will you continue to support Polymer 0.5?

We recognize that many projects rely on 0.5, and won’t be able to switch to the
new codebase until the elements are ready. We’ll continue viewing and merging PR’s until the
elements are ported. We intend for 1.0 to be the new baseline though, and to
work within this high-performance, production-ready mindset going forward. Any
incremental 0.5 releases, if needed, will be available in a branch.

Where and how can I give feedback on this release?

Checkout our contributing guide
for the full rundown of how to contribute. The best place for feedback is on Github, by filing an
issue
, adding to an existing one, or
submitting a pull request. Feedback and contributions are critical to
keeping {{site.project_title}} successful.

Pull requests tend to be the clearest way of
expressing an idea or change, but short of a pull request, as much detail as you
can add around your use-case will help us and the broader community better
understand the question or suggestion.

Next steps

Continue on to the {{site.project_title}} docs:

<div layout horizontal wrap>
<p><a href="start/quick-tour.html">
<paper-button raised><core-icon icon="arrow-forward"></core-icon>Quick tour of {{site.project_title}}</paper-button>
</a></p>

<p><a href="devguide/feature-overview.html">
<paper-button raised><core-icon icon="arrow-forward"></core-icon>Developer guide</paper-button>
</a></p>

<p><a href="migration.html">
<paper-button raised><core-icon icon="arrow-forward"></core-icon>Migration guide</paper-button>
</a></p>
<div>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 200,961评论 5 473
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,444评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 148,009评论 0 333
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,082评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,101评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,271评论 1 278
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,738评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,395评论 0 255
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,539评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,434评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,481评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,160评论 3 317
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,749评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,816评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,038评论 1 256
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,548评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,140评论 2 341

推荐阅读更多精彩内容