Skip to content
Permalink
Browse files

Merge pull request #1012 from Polymer/0.8-miceplay

0.8 miceplay
  • Loading branch information
kevinpschaaf committed Dec 10, 2014
2 parents 36dd5ee + 2198d4a commit 43f456e600dfbfb8f51322c1c3aa1db38efaa2f7
@@ -1,13 +0,0 @@
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="src/features/bind.html">
<link rel="import" href="src/features/annotations-bind.html">
<link rel="import" href="src/features/computed.html">
<link rel="import" href="src/features/bind-effects.html">
@@ -0,0 +1,75 @@
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="src/polymer.html">
<link rel="import" href="src/features/log.html">
<link rel="import" href="src/features/constructor.html">
<link rel="import" href="src/features/extends.html">
<link rel="import" href="src/features/mixins.html">
<link rel="import" href="src/features/published.html">
<link rel="import" href="src/features/attributes.html">
<link rel="import" href="src/features/template.html">
<link rel="import" href="src/features/content.html">
<link rel="import" href="src/features/annotations.html">
<link rel="import" href="src/features/annotations-nodes.html">
<link rel="import" href="src/features/events.html">
<link rel="import" href="src/features/keys.html">
<link rel="import" href="src/features/annotations-events.html">
<link rel="import" href="src/features/utils.html">
<link rel="import" href="src/features/ready.html">

<link rel="import" href="src/layout.html">

<script>

// TODO(sjmiles): hack
Base.originalInitFeatures = Base.initFeatures;

Base.addFeature({

initFeatures: function() {
// TODO(sjmiles): hack to make sure this feature goes last
this.originalInitFeatures(this);
this.features();
},

features: function() {
this.defaultFeatures();
},

defaultFeatures: function() {
if (this._useContent) {
this.poolContent();
}
if (this._template) {
this.stampTemplate();
this._marshalNodeReferences();
this._marshalAnnotatedNodes();
this._setupAnnotatedListeners();
if (this._setupBindListeners) {
this._setupBindListeners();
}
}
this.listenListeners();
this.listenKeyPresses();
if (this._useContent) {
this.distributeContent();
}
this.takeAttributes();
}

});

Polymer.noFeatures = function() {
};

Polymer.defaultFeatures = Base.defaultFeatures;

</script>

@@ -0,0 +1,13 @@
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="src/data-features/bind.html">
<link rel="import" href="src/data-features/annotations-bind.html">
<link rel="import" href="src/data-features/computed.html">
<link rel="import" href="src/data-features/bind-effects.html">
@@ -7,65 +7,5 @@
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="src/polymer.html">
<link rel="import" href="src/features/log.html">
<link rel="import" href="src/features/published.html">
<link rel="import" href="src/features/attributes.html">
<link rel="import" href="src/features/template.html">
<link rel="import" href="src/features/content.html">
<link rel="import" href="src/features/annotations.html">
<link rel="import" href="src/features/annotations-nodes.html">
<link rel="import" href="src/features/events.html">
<link rel="import" href="src/features/keys.html">
<link rel="import" href="src/features/annotations-events.html">
<link rel="import" href="src/features/utils.html">
<link rel="import" href="src/features/layout.html">
<link rel="import" href="src/features/ready.html">

<script>

// TODO(sjmiles): hack
Base.originalInitFeatures = Base.initFeatures;

Base.addFeature({

initFeatures: function() {
// TODO(sjmiles): hack to make sure this feature goes last
this.originalInitFeatures(this);
this.features();
},

features: function() {
this.defaultFeatures();
},

defaultFeatures: function() {
if (this._useContent) {
this.poolContent();
}
if (this._template) {
this.stampTemplate();
this._marshalNodeReferences();
this._marshalAnnotatedNodes();
this._setupAnnotatedListeners();
if (this._setupBindListeners) {
this._setupBindListeners();
}
}
this.listenListeners();
this.listenKeyPresses();
if (this._useContent) {
this.distributeContent();
}
this.takeAttributes();
}

});

Polymer.noFeatures = function() {
};

Polymer.defaultFeatures = Base.defaultFeatures;

</script>

<link rel="import" href="polymer-core.html">
<link rel="import" href="polymer-data.html">
@@ -67,6 +67,7 @@
},

attachedCallback: function() {
this.isAttached = true;
// reserved for canonical behavior
this.attached();
},
@@ -76,6 +77,7 @@
},

detachedCallback: function() {
this.isAttached = false;
// reserved for canonical behavior
this.detached();
},
@@ -7,7 +7,7 @@
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="annotations.html">
<link rel="import" href="../features/annotations.html">

<script>

@@ -51,11 +51,11 @@
// per prototype

register: function(prototype) {
prototype._bindListeners = [];
prototype._createBindings();
},

_createBindings: function() {
this._bindListeners = [];
var fx$ = this._propertyEffects;
if (fx$) {
//console.group(this.name);
@@ -76,14 +76,13 @@
},

_sortPropertyEffects: function(a, b) {
switch (a.kind) {
case 'compute':
return b.kind === 'compute' ? 0 : -1;
case 'notify':
return b.kind === 'notify' ? 0 : 1;
default:
return 0;
if (a.kind === 'compute' || b.kind === 'notify') {
return -1;
}
if (a.kind === 'notify' || b.kind === 'compute') {
return 1;
}
return 0;
},

_buildEffect: function(property, fx) {
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,76 @@
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="annotations.html">

<script>

/*
* Parses the annotations list created by `annotations` features to perform
* declarative desugaring.
*
* Depends on `annotations` feature and `bind` feature.
*
* Two tasks are supported:
*
* - nodes with 'id' are described in a virtual annotation list at
* registration time. This list is then concretized per instance.
*
* - Simple mustache expressions consisting of a single property name
* in a `textContent` context are bound using `bind` features
* `bindMethod`. In this mode, the bound method is constructed at
* registration time, so marshaling is done done via the concretized
* `_nodes` at every access.
*
* TODO(sjmiles): ph3ar general confusion between registration and
* instance time tasks. Is there a cleaner way to disambiguate?
*/
TemplateBind = {

// construct binding meta-data

_preprocessBindAnnotations: function(prototype, list) {
// create a virtual annotation list, must be concretized at instance time
prototype._nodes = [];
// process annotations that have been parsed from template
list.forEach(function(annotation) {
// where to find the node in the concretized list
var index = prototype._nodes.push(annotation) - 1;
// TODO(sjmiles): we need to support multi-bind, right now you only get
// one (not including kind === `id`)
annotation.bindings.forEach(function(binding) {
prototype._bindAnnotationBinding(binding, index);
});
});
},

// _nodes[index][<binding.name=>]{{binding.value}}
_bindAnnotationBinding: function(binding, index) {
// capture the node index
binding.index = index;
// discover top-level property (model) from path
var path = binding.value;
var i = path.indexOf('.');
// [name=]{{model[.subpath]}}
var model = (i >= 0) ? path.slice(0, i) : path;
// add 'annotation' binding effect for property 'model'
this.addPropertyEffect(model, 'annotation', binding);
}

// concretize `_nodes` map (annotation based)

marshalAnnotatedNodes: function(nodes, root) {
return nodes.map(function(a) {
return Template.findAnnotatedNode(root, a);
};
}

});

</script>

0 comments on commit 43f456e

Please sign in to comment.
You can’t perform that action at this time.