[dart-announce] New polymer release 0.12.0

383 views
Skip to first unread message

'Siggi Cherem' via Dart Announcements

unread,
Jul 30, 2014, 8:11:34 PM7/30/14
to w...@dartlang.org, anno...@dartlang.org
We just uploaded a new stable version of the polymer, core, and paper packages, bringing us up to date with the latest release of polymer.js and it's related libraries (js version 0.3.4 as of today).

Polymer 0.12.0: here is a highlight of the changes since 0.11.0+5, check out the change log for more details: 
  • Better support for two-way data-binding with Javascript polymer elements. This should make it much easier to use core and paper elements in your apps (example).

  • Change in @published: There is a variation for how to declare @published properties. Instead of:
@published String foo;

we suggest you write:

@published
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);

The old style will continue to work, but the new style has a more predictable timing. In particular, say you use 'foo' in a binding, someone updates that binding, and later you read 'foo'. The old style has no guarantees about what you'll read out of 'foo'. If notifications have been propagated through the system, you'll see the latest value, but if not, you may see the old value. The new style guarantees that you'll see the new value in the binding regardless of the state of the notifications. This also matches how things work in polymer.js elements.
  • @ComputedProperty: A new annotation has been introduced that lets you define a property in terms of other observable properties. For example you can write:
@ComputedProperty('a + b')
String get aPlusB => readValue(#aPlusB);

You can find more details in the dart docs for ComputedProperty
  • PropertyPath: the syntax of property path changed. This is only relevant if you use you are not using polymer expressions, but use template-binding directly with it's default syntax. (see changelog for observe 0.11.0)

  • Many bug fixes, especially around handling 'packages/' URLs, URLs with bindings, sanitizing file names, CSS shim of link-rels, and CSP support.
Core 0.1.0+1, Paper 0.1.0+1: The core and paper packages have been updated too, they now have the Dart API associated with the 0.3.4 js elements. Many of the examples have been updated to use some of the changes above (like the better js-interop features)

Cheers,
The polymer.dart team

--
For more news and information, visit http://news.dartlang.org/
 
To join the conversation, visit https://groups.google.com/a/dartlang.org/

Günter Zöchbauer

unread,
Jul 31, 2014, 12:18:47 AM7/31/14
to mi...@dartlang.org, w...@dartlang.org, anno...@dartlang.org, e...@dartlang.org
Thanks for the great work and for the info!

On Thursday, July 31, 2014 2:11:34 AM UTC+2, 'Siggi Cherem' via Dart Announcements wrote:
We just uploaded a new stable version of the polymer, core, and paper packages, bringing us up to date with the latest release of polymer.js and it's related libraries (js version 0.3.4 as of today).

  • Change in @published: There is a variation for how to declare @published properties. Instead of:
@published String foo;

we suggest you write:

@published
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);


Are the values of such properties reflected to the attribute and is @PublishedProperty(reflect: true) obsolete then or how does this relate to reflected properties?
 

'Kevin Moore' via Dart Announcements

unread,
Jul 31, 2014, 12:47:33 AM7/31/14
to w...@dartlang.org, anno...@dartlang.org
Does the new syntax for @published also apply to @observable?

曹忠

unread,
Jul 31, 2014, 2:10:44 AM7/31/14
to mi...@dartlang.org, w...@dartlang.org, anno...@dartlang.org, e...@dartlang.org
1. @PublishedProperty(reflect: true) in  new syntax?
2. @observable similar behavior of @published in  new syntax?

在 2014年7月31日星期四UTC+8上午8时11分34秒,'Siggi Cherem' via Dart Announcements写道:

Günter Zöchbauer

unread,
Jul 31, 2014, 2:20:43 AM7/31/14
to w...@dartlang.org, mi...@dartlang.org, anno...@dartlang.org, e...@dartlang.org
@PublishedProperty(reflect: true) was introduced here https://groups.google.com/a/dartlang.org/forum/#!search/PublishedProperty(reflect$3A$20true)/web/rzJ9oVUZHTU/pnXQg3hodmMJ

I don't understand what you mean by 2.

Siggi Cherem

unread,
Jul 31, 2014, 1:16:14 PM7/31/14
to w...@dartlang.org, General Dart Discussion, anno...@dartlang.org, e...@dartlang.org
@publishedProperty(reflect: true) is still needed if you want to make it reflected as an attribute. Both annotations work the same way in terms of timing, so you can do:

@PublishedProperty(reflect: true)
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/672fa515-4b73-41b8-b21c-b0c95dfb43aa%40dartlang.org.

Seth Ladd

unread,
Jul 31, 2014, 1:21:13 PM7/31/14
to w...@dartlang.org, General Dart Discussion, anno...@dartlang.org, e...@dartlang.org
On Thu, Jul 31, 2014 at 10:15 AM, 'Siggi Cherem' via Dart Web Development <w...@dartlang.org> wrote:



On Wed, Jul 30, 2014 at 9:18 PM, Günter Zöchbauer <gzo...@gmail.com> wrote:
Thanks for the great work and for the info!

On Thursday, July 31, 2014 2:11:34 AM UTC+2, 'Siggi Cherem' via Dart Announcements wrote:
We just uploaded a new stable version of the polymer, core, and paper packages, bringing us up to date with the latest release of polymer.js and it's related libraries (js version 0.3.4 as of today).


  • Change in @published: There is a variation for how to declare @published properties. Instead of:
@published String foo;

we suggest you write:

@published
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);


Are the values of such properties reflected to the attribute and is @PublishedProperty(reflect: true) obsolete then or how does this relate to reflected properties?

@publishedProperty(reflect: true) is still needed if you want to make it reflected as an attribute.

The intent isn't very clear in this annotation. Any more thoughts on calling this @attribute ? That's a lot more clear, at least to me :)  And then if it matters (for performance?)  @attribute(two-way: false)  (where two-way is the default)


"reflect" is an overloaded term, especially with mirrors.


 
Both annotations work the same way in terms of timing, so you can do:

@PublishedProperty(reflect: true)
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/672fa515-4b73-41b8-b21c-b0c95dfb43aa%40dartlang.org.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

Siggi Cherem

unread,
Jul 31, 2014, 1:21:21 PM7/31/14
to w...@dartlang.org, General Dart Discussion
On Wed, Jul 30, 2014 at 11:10 PM, 曹忠 <joo....@gmail.com> wrote:
1. @PublishedProperty(reflect: true) in  new syntax?

You can use this similar to @published. For example, you can do:

@PublishedProperty(reflect: true)
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);
 
however, if you have no issues with the current timing of your property, you can feel free to leave it as it was.

2. @observable similar behavior of @published in  new syntax?

@observable stays as it was before.
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

George Moschovitis

unread,
Jul 31, 2014, 1:25:55 PM7/31/14
to mi...@dartlang.org, w...@dartlang.org, anno...@dartlang.org, e...@dartlang.org
Core 0.1.0+1, Paper 0.1.0+1: The core and paper packages have been updated too, they now have the Dart API associated with the 0.3.4 js elements. Many of the examples have been updated to use some of the changes above (like the better js-interop features)

Any chance you will also convert/wrap Googlewebcomponents (http://googlewebcomponents.github.io/) ?

-g.

'Siggi Cherem' via Dart Announcements

unread,
Jul 31, 2014, 4:09:42 PM7/31/14
to anno...@dartlang.org
To avoid spamming this list I've removed this list from the discussion about @published that started from this initial announcement. You can follow the discussion in the w...@dartlang.org mailing list here: https://groups.google.com/a/dartlang.org/d/msgid/web/CAPD5VRuTDpnAfaDG8rriE2Cn8QWcBBkunrF%2B07SM%2BO8mfLhZSw%40mail.gmail.com?utm_medium=email&utm_source=footer

Cheers,
Siggi

Seth Ladd

unread,
Jul 31, 2014, 4:09:51 PM7/31/14
to w...@dartlang.org, General Dart Discussion
- announce,eng


On Thu, Jul 31, 2014 at 10:25 AM, George Moschovitis <george.mo...@gmail.com> wrote:
Core 0.1.0+1, Paper 0.1.0+1: The core and paper packages have been updated too, they now have the Dart API associated with the 0.3.4 js elements. Many of the examples have been updated to use some of the changes above (like the better js-interop features)

Any chance you will also convert/wrap Googlewebcomponents (http://googlewebcomponents.github.io/) ?

Hi George,

I'm under the impression that they should "just work". Did you run into a bug when you tried them?
 

-g.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

Siggi Cherem

unread,
Jul 31, 2014, 4:23:09 PM7/31/14
to w...@dartlang.org, General Dart Discussion
On Thu, Jul 31, 2014 at 10:20 AM, 'Seth Ladd' via Dart Announcements <anno...@dartlang.org> wrote:



On Thu, Jul 31, 2014 at 10:15 AM, 'Siggi Cherem' via Dart Web Development <w...@dartlang.org> wrote:



On Wed, Jul 30, 2014 at 9:18 PM, Günter Zöchbauer <gzo...@gmail.com> wrote:
Thanks for the great work and for the info!

On Thursday, July 31, 2014 2:11:34 AM UTC+2, 'Siggi Cherem' via Dart Announcements wrote:
We just uploaded a new stable version of the polymer, core, and paper packages, bringing us up to date with the latest release of polymer.js and it's related libraries (js version 0.3.4 as of today).


  • Change in @published: There is a variation for how to declare @published properties. Instead of:
@published String foo;

we suggest you write:

@published
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);


Are the values of such properties reflected to the attribute and is @PublishedProperty(reflect: true) obsolete then or how does this relate to reflected properties?

@publishedProperty(reflect: true) is still needed if you want to make it reflected as an attribute.

The intent isn't very clear in this annotation. Any more thoughts on calling this @attribute ? That's a lot more clear, at least to me :)  And then if it matters (for performance?)  @attribute(two-way: false)  (where two-way is the default)

I should clarify here: published properties are always two-way. What's changing is whether the property value is also visible as an attribute if you look at the element and read the attribute either in code or through css selectors. For example:

If you have:
  <x-foo bar="{{e}}"></x-foo>

You get a 2-way binding between e and XFoo.bar, even when 'reflect' is false. However, if you do:

var x = querySelector('x-foo');
x.bar = "hi";
...
print(x.attributes["bar"]);

this prints 'hi' if only if 'reflect' is true.



"reflect" is an overloaded term, especially with mirrors.

We've been trying to keep the declarations and defaults consistent between polymer.dart and polymer.js. In polymer.js they use the term `published` when declaring published properties in code, and by default the value is not reflected back in the corresponding HTML attribute (details here).  My understanding is that this was for performance reasons - it's too expensive to reflect all properties back to attributes, when only a few are used. So they wanted to make this opt-in.

It's unfortunate that the term 'reflect' conflicts with Dart's notion of mirrors and reflection, but we want to make sure that the concepts in polymer.js are easy to translate to a polymer.dart app. One option here is to make it more verbose, for example `reflectBack` or `reflectInAttribute`.

Thoughts?
Siggi


 


 
Both annotations work the same way in terms of timing, so you can do:

@PublishedProperty(reflect: true)
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/672fa515-4b73-41b8-b21c-b0c95dfb43aa%40dartlang.org.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/CAJmP2_qDou3Bz9fwewG4CkiCaWKjXoWZWY8y8dp2r5emgs5E-A%40mail.gmail.com.

--
For more news and information, visit http://news.dartlang.org/
 
To join the conversation, visit https://groups.google.com/a/dartlang.org/

To unsubscribe from this group and stop receiving emails from it, send an email to announce+u...@dartlang.org.

Siggi Cherem

unread,
Jul 31, 2014, 4:37:40 PM7/31/14
to w...@dartlang.org, General Dart Discussion
On Thu, Jul 31, 2014 at 1:09 PM, 'Seth Ladd' via Dart Web Development <w...@dartlang.org> wrote:
- announce,eng


On Thu, Jul 31, 2014 at 10:25 AM, George Moschovitis <george.mo...@gmail.com> wrote:
Core 0.1.0+1, Paper 0.1.0+1: The core and paper packages have been updated too, they now have the Dart API associated with the 0.3.4 js elements. Many of the examples have been updated to use some of the changes above (like the better js-interop features)

Any chance you will also convert/wrap Googlewebcomponents (http://googlewebcomponents.github.io/) ?

Hi George,

I'm under the impression that they should "just work". Did you run into a bug when you tried them?

The elements should "just work" without any modification to their code, but until we get a better bower integration with pub, there are changes you need to do after doing a `bower install` to get everything actually working.

The main issue is that we need to load any shared code from a single place. So common imports, like 'polymer.html', needs to be adjusted. This includes common components that are packaged for Dart (for example if they use a core or paper element, you'll need some extra fixes.)

That being said, it should be simple to make this process automatic. We do so in the core- and paper- packages with a script here:

That script rewrites the bower polymer.html to import polymer.dart's copy of polymer.html. The code we have is the same, but this way polymer is always loaded from the same place and therefore only loaded once:

The script also rewrites elements for which we have 2 copies, and pick the one in our packages. For instance 'core-input' is defined in core_elements, so we override the code to import it from there:

The tool uses a configuration file to figure out what to generate, for example this is where we specify that:

The sources for this script are available for you to use. They live today in the core_elements package, but we'd like to move it out into it's own repo soon.

Cheers,
Siggi

 

-g.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/27b6b7ad-4906-41c0-b914-d2425ef4c720%40dartlang.org.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

Seth Ladd

unread,
Jul 31, 2014, 4:38:56 PM7/31/14
to General Dart Discussion, w...@dartlang.org
+1 to using the word "attribute" somehow.

Thanks for the explanation!
 

Thoughts?
Siggi


 


 
Both annotations work the same way in terms of timing, so you can do:

@PublishedProperty(reflect: true)
String get foo => readValue(#foo);
set foo(String value) => writeValue(#foo, value);
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/672fa515-4b73-41b8-b21c-b0c95dfb43aa%40dartlang.org.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/web/CAJmP2_qDou3Bz9fwewG4CkiCaWKjXoWZWY8y8dp2r5emgs5E-A%40mail.gmail.com.

--
For more news and information, visit http://news.dartlang.org/
 
To join the conversation, visit https://groups.google.com/a/dartlang.org/

To unsubscribe from this group and stop receiving emails from it, send an email to announce+u...@dartlang.org.

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

George Moschovitis

unread,
Aug 1, 2014, 2:27:07 PM8/1/14
to mi...@dartlang.org, w...@dartlang.org
I'm under the impression that they should "just work". Did you run into a bug when you tried them?

Maybe we have a  different interpretation of 'just work'. I would like to do just a 'pub get' and be ready to add html imports to my page.
In other words, I am looking for a pub package similar to core_elements and paper_elements.

Seth Ladd

unread,
Aug 1, 2014, 2:46:41 PM8/1/14
to w...@dartlang.org, General Dart Discussion
Gotcha, thanks. I think the plan is to integrate Bower with Pub somehow, or let them play nicely together: https://code.google.com/p/dart/issues/detail?id=19354

unfortunately, it's not scalable to put every web component into pub. We'll need a way to work with Bower.

Glad to see the interest in the google-components!
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

Sergey Shevchenko

unread,
Aug 9, 2014, 1:51:30 AM8/9/14
to w...@dartlang.org, mi...@dartlang.org
We handle both Bower and Pub packages in Chrome Dev Editor, so if we could have a formalized, step-by-step, guaranteed-to-work description of what needs to be done, we could do it.

Also, several thoughts on @PublishedProperty(reflect: true) and the new boilerplate with readValue/writeValue:

* First of all, if you're writing a library of reusable elements, you can't possibly know how they will be used on the other end. That means that the whole thing is a must: otherwise, your end users are bound to run into and give you a headache with bizarre timing issues (we've have more that a fair share of those with our own widgets in CDE).
* Second, among the possible solutions that Siggi has suggested under 'Are we willing to always require a transformation step?', quite a few might not work with Chrome apps (e.g. a server proxying requests). Just something to keep in mind.
* Third, at least speaking of @PublishedProperty(reflect: true) vs. @attribute debate, I've added the following in a common source included by all the widgets in CDE:

const attribute = const PublishedProperty(reflect: true);

...and use it as:

@attribute foo;

Question is, is it possible to expand that to auto-generate the entire readValue/writeValue boilerplate? Does Dart's annotations allow that?

Siggi Cherem

unread,
Aug 12, 2014, 10:13:39 PM8/12/14
to w...@dartlang.org, General Dart Discussion
On Fri, Aug 8, 2014 at 10:51 PM, Sergey Shevchenko <serg...@google.com> wrote:
We handle both Bower and Pub packages in Chrome Dev Editor, so if we could have a formalized, step-by-step, guaranteed-to-work description of what needs to be done, we could do it.

Also, several thoughts on @PublishedProperty(reflect: true) and the new boilerplate with readValue/writeValue:

* First of all, if you're writing a library of reusable elements, you can't possibly know how they will be used on the other end. That means that the whole thing is a must: otherwise, your end users are bound to run into and give you a headache with bizarre timing issues (we've have more that a fair share of those with our own widgets in CDE).
* Second, among the possible solutions that Siggi has suggested under 'Are we willing to always require a transformation step?', quite a few might not work with Chrome apps (e.g. a server proxying requests). Just something to keep in mind.
* Third, at least speaking of @PublishedProperty(reflect: true) vs. @attribute debate, I've added the following in a common source included by all the widgets in CDE:

const attribute = const PublishedProperty(reflect: true);

...and use it as:

@attribute foo;

Question is, is it possible to expand that to auto-generate the entire readValue/writeValue boilerplate? Does Dart's annotations allow that?

Unfortunately annotations can't do that. However, to follow up on the feedback and discussions we had here, last week we've started some discussions with the language designers to see if we can pursue some new language feature in this direction. 
 

On Friday, August 1, 2014 11:46:37 AM UTC-7, sethladd wrote:



On Fri, Aug 1, 2014 at 11:27 AM, George Moschovitis <george.mo...@gmail.com> wrote:
I'm under the impression that they should "just work". Did you run into a bug when you tried them?

Maybe we have a  different interpretation of 'just work'. I would like to do just a 'pub get' and be ready to add html imports to my page.
In other words, I am looking for a pub package similar to core_elements and paper_elements.

Gotcha, thanks. I think the plan is to integrate Bower with Pub somehow, or let them play nicely together: https://code.google.com/p/dart/issues/detail?id=19354

unfortunately, it's not scalable to put every web component into pub. We'll need a way to work with Bower.

Glad to see the interest in the google-components!
 

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.

--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.

tomasz.kubacki

unread,
Dec 30, 2014, 6:09:16 AM12/30/14
to w...@dartlang.org, mi...@dartlang.org

On Wednesday, August 13, 2014 4:13:36 AM UTC+2, sigmund wrote:


Question is, is it possible to expand that to auto-generate the entire readValue/writeValue boilerplate? Does Dart's annotations allow that?

Unfortunately annotations can't do that. However, to follow up on the feedback and discussions we had here, last week we've started some discussions with the language designers to see if we can pursue some new language feature in this direction. 
 

Any news on @PublishedProperty boilerplate ?

Did you manage to find a path Dart/Polymer team will follow to resolve the issue?




Siggi Cherem

unread,
Jan 2, 2015, 6:44:34 PM1/2/15
to w...@dartlang.org, General Dart Discussion
Hi Tomasz,

Thanks for following up. Sorry I don't have a more definite update - we are still in the process of resolving this. We have had many discussions about language changes to support this and made great progress though. I'll make sure to keep you posted here when I have more details.

Cheers,
Siggi





--
You received this message because you are subscribed to the Google Groups "Dart Web Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web+uns...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web/.
Reply all
Reply to author
Forward
0 new messages