License headers

This commit is contained in:
Ian MacLeod
2014-11-19 16:45:28 -08:00
parent 945a8883cd
commit befcdedfa2
32 changed files with 445 additions and 191 deletions

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<svg><defs>
<g id="apps"><path d="M4,8h4V4H4V8z M10,20h4v-4h-4V20z M4,20h4v-4H4V20z M4,14h4v-4H4V14z M10,14h4v-4h-4V14z M16,4v4h4V4H16z M10,8h4V4h-4V8z M16,14h4v-4h-4V14z M16,20h4v-4h-4V20z"/></g>
<g id="archive"><path d="M20.5,5.2l-1.4-1.7C18.9,3.2,18.5,3,18,3H6C5.5,3,5.1,3.2,4.8,3.5L3.5,5.2C3.2,5.6,3,6,3,6.5V19c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V6.5C21,6,20.8,5.6,20.5,5.2z M12,17.5L6.5,12H10v-2h4v2h3.5L12,17.5z M5.1,5l0.8-1h12l0.9,1H5.1z"/></g>
@@ -53,4 +62,4 @@
menu: cloneIcon('#menu')
};
</script>
</script>

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -1,2 +1,2 @@
START /B vulcanize polymer.html --inline -output dist/polymer.html
START /B vulcanize data.html --inline -output dist/data.html
START /B vulcanize data.html --inline -output dist/data.html

View File

@@ -1,4 +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/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">
<link rel="import" href="src/features/bind-effects.html">

View File

@@ -1,12 +1,12 @@
<!doctype html>
<!--
@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
@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
-->
<html>
<head>
@@ -14,7 +14,7 @@
<title>x-doc-viewer</title>
<script src="../perf-lib/perf.js"></script>
<link rel="import" href="../x-elements/x-doc-viewer/x-doc-viewer.html">
<link rel="import" href="../assets/icons.html">
@@ -34,9 +34,9 @@
<script>console.perf();</script>
<x-doc-viewer flex sources='[
"src/features/bind.html",
"src/features/published.html",
"src/features/annotations.html",
"src/features/bind.html",
"src/features/published.html",
"src/features/annotations.html",
"../x-elements/x-doc-viewer/x-doc-viewer.html"
]'></x-doc-viewer>

View File

@@ -1,4 +1,13 @@
<!doctype html>
<!--
@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
-->
<html>
<head>
@@ -21,20 +30,20 @@
<script>
Polymer({
name: 'x-custom',
published: {
user: String
},
created: function() {
this.innerHTML = 'Hello World, my user is ' + (this.user || 'nobody') + '.';
}
});
</script>
<x-custom user="Scott"></x-custom>
</body>

View File

@@ -1,3 +1,12 @@
<!--
@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/published.html">
@@ -16,7 +25,7 @@
// TODO(sjmiles): hack
Base.originalInitFeatures = Base.initFeatures;
Base.addFeature({
initFeatures: function() {

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
Base = {

View File

@@ -1,3 +1,12 @@
<!--
@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>
@@ -5,22 +14,22 @@
/*
* Parses the annotations map 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 map at
*
* - nodes with 'id' are described in a virtual annotation map at
* registration time. This map 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
* 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?
*
* TODO(sjmiles): ph3ar general confusion between registration and
* instance time tasks. Is there a cleaner way to disambiguate?
*/
Base.addFeature({
@@ -34,13 +43,13 @@
// construct binding meta-data at *registration* time
_preprocessBindAnnotations: function(prototype, map) {
// create a virtual annotation map, must be concretized at instance time
// create a virtual annotation map, must be concretized at instance time
prototype._nodes = [];
// process annotations that have been parsed from template
map.forEach(function(annotation) {
// where to find the node in the concretized map
// where to find the node in the concretized map
var index = prototype._nodes.push(annotation) - 1;
// TODO(sjmiles): we need to support multi-bind, right now you only get
// 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);

View File

@@ -1,3 +1,12 @@
<!--
@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>
@@ -5,14 +14,14 @@
/*
* Parses the annotations map created by `annotations` features to support
* declarative events.
*
*
* Depends on `annotations` and `events` features.
*
*
*/
Base.addFeature({
// instance-time
_setupAnnotatedListeners: function() {
var map = this._template.map;
if (map) {

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
// depends on `annotations` feature
@@ -33,4 +42,4 @@
});
</script>
</script>

View File

@@ -1,39 +1,48 @@
<!--
@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
-->
<script>
/**
* Scans a template (once per prototype) to produce an annotation map that
* stores expression metadata and information to associate the metadata with
* Scans a template (once per prototype) to produce an annotation map that
* stores expression metadata and information to associate the metadata with
* nodes in an instance.
*
* Supported expressions include:
*
* Double-mustache annotations in text content. The annotation must be the only
*
* Double-mustache annotations in text content. The annotation must be the only
* content in the tag, compound expressions are not supported.
*
* <[tag]>{{path.to.host.property}}<[tag]>
*
*
* <[tag]>{{path.to.host.property}}<[tag]>
*
* Double-mustache annotations in an attribute.
*
* <[tag] someAttribute="{{path.to.host.property}}"><[tag]>
*
* Only immediate host properties can automatically trigger side-effects.
*
* <[tag] someAttribute="{{path.to.host.property}}"><[tag]>
*
* Only immediate host properties can automatically trigger side-effects.
* Setting `host.path` in the example above triggers the binding, setting
* `host.path.to.host.property` does not.
*
*
* `on-` style event declarations.
*
* <[tag] on-<event-name>="{{hostMethodName}}"><[tag]>
*
*
* <[tag] on-<event-name>="{{hostMethodName}}"><[tag]>
*
* Note that the `annotations` feature does not actually implement the behaviors
* associated with these expressions, it only captures the data. Other
* `annotations-*` features contain the actual implementations.
*
* @class feature: annotations
* `annotations-*` features contain the actual implementations.
*
* @class feature: annotations
*/
/*
/*
Scans a template to produce an annotation map that stores expression metadata
Scans a template to produce an annotation map that stores expression metadata
and information that associates the metadata to nodes in a template instance.
Supported annotations are:
@@ -56,7 +65,7 @@ Generated data-structure:
id: '<id>',
events: [
{
mode: ['auto'|''],
mode: ['auto'|''],
name: '<name>'
value: '<expression>'
}, ...
@@ -64,7 +73,7 @@ Generated data-structure:
bindings: [
{
kind: ['text'|'attribute'|'property'],
mode: ['auto'|''],
mode: ['auto'|''],
name: '<name>'
value: '<expression>'
}, ...
@@ -73,13 +82,13 @@ Generated data-structure:
parent: <reference to parent annotation>,
index: <integer index in parent's childNodes collection>
},
...
...
]
TODO(sjmiles): this module should produce either syntactic metadata
TODO(sjmiles): this module should produce either syntactic metadata
(e.g. double-mustache, double-bracket, star-attr), or semantic metadata
(e.g. manual-bind, auto-bind, property-bind). Right now it's half and half.
*/
Base.addFeature({
@@ -92,7 +101,7 @@ TODO(sjmiles): this module should produce either syntactic metadata
}
var parent = this.findAnnotatedNode(root, annote.parent);
// enforce locality.
var nodes = (parent === this) ? parent.childNodes :
var nodes = (parent === this) ? parent.childNodes :
(parent.lightChildren || parent.childNodes);
return nodes[annote.index];
},
@@ -116,8 +125,8 @@ TODO(sjmiles): this module should produce either syntactic metadata
},
_parseNodeAnnotations: function(node, map) {
return node.nodeType === Node.TEXT_NODE ?
this._parseTextNodeAnnotation(node, map) :
return node.nodeType === Node.TEXT_NODE ?
this._parseTextNodeAnnotation(node, map) :
this._parseElementAnnotations(node, map);
},
@@ -170,16 +179,16 @@ TODO(sjmiles): this module should produce either syntactic metadata
// id
if (n === 'id') {
annotation.id = v;
}
}
// on-* (event)
else if (n.slice(0, 3) === 'on-') {
i--;
node.removeAttribute(n);
annotation.events.push({
name: n.slice(3),
value: v
value: v
});
}
}
// other attribute
else {
var b = this._parseNodeAttributeAnnotation(node, n, v);
@@ -223,4 +232,4 @@ TODO(sjmiles): this module should produce either syntactic metadata
});
</script>
</script>

View File

@@ -1,16 +1,25 @@
<!--
@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
-->
<script>
/*
* Support for `hostAttributes` property.
*
* `hostAttributes` is a space separated string of attributes to
*
* `hostAttributes` is a space separated string of attributes to
* install on every instance.
*
*
* There is room for addition `attributes` features, namely:
*
*
* - potentially automatic handling of attributeChanged
* - capturing initial configuration values from attributes
*
*
*/
Base.addFeature({
@@ -30,35 +39,35 @@
/*
* Support for `published` property.
*
*
* `published` object maps the names of attributes that the user
* wants mapped as inputs to properties to the data-type of that property.
*
*
* This feature overwrites `attributeChanged` to support automatic
* propagation of attribute values at run-time.
*
* Static values in attributes at creation time can be captured by
*
* Static values in attributes at creation time can be captured by
* `takeAttributes`.
*
* Example:
*
*
* published: {
* // values set to index attribute are converted to Number and propagated
* // to index property
* index: Number,
* // values set to label attribute are propagated to index property
* label: String
* }
*
* }
*
* Supported types:
*
*
* - Number
* - Boolean
* - String
* - Object (JSON)
* - Array (JSON)
* - Date
*
*
*/
Base.addFeature({
@@ -82,16 +91,16 @@
deserialize: function(name, value, type) {
switch(type) {
case Number:
case Number:
value = Number(value);
break;
case Boolean:
case Boolean:
value = this.hasAttribute(name);
break;
case Object:
case Array:
case Object:
case Array:
try {
value = JSON.parse(value);
} catch(x) {
@@ -99,7 +108,7 @@
}
break;
case Date:
case Date:
value = Date.parse(value);
break;
@@ -112,4 +121,4 @@
});
</script>
</script>

View File

@@ -1,9 +1,18 @@
<!--
@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
-->
<script>
Base.addFeature({
// per instance
init: function() {
this._data = Object.create(null);
},
@@ -28,7 +37,7 @@
_telemetry: {
_setDataCalls: 0
},
_setData: function(property, value) {
// TODO(sjmiles): ad-hoc telemetry
Base._telemetry._setDataCalls++;
@@ -40,7 +49,7 @@
},
// per prototype
register: function(prototype) {
prototype._bindListeners = [];
prototype._createBindings();
@@ -130,7 +139,7 @@
// flow-down
//
//console.log('[_bindEffectBuilder]: [%s] %=% [%s].[%s]', hostProperty, id, property);
return 'this.$.' + id + '.' + property + ' = '
return 'this.$.' + id + '.' + property + ' = '
+ 'this._data.' + hostProperty + ';'
},
@@ -139,7 +148,7 @@
},
_computeEffectBuilder: function(source, effect) {
return 'this.' + effect.property
return 'this.' + effect.property
+ ' = this.' + effect.method + '(this._data.' + source + ');';
},
@@ -155,10 +164,10 @@
// flow-down
//
// construct the effect to occur when [property] changes:
// set nodes[index][name] to this[value]
// set nodes[index][name] to this[value]
//
//console.log('[_annotationEffectBuilder]: [%s] %=% [%s].[%s]', info.value, info.index, property);
return 'this._nodes[' + info.index + '].' + property
return 'this._nodes[' + info.index + '].' + property
+ ' = this._data.' + info.value + ';';
},
@@ -172,7 +181,7 @@
},
_bindAnnotationProperty: function(name, path, index) {
return 'this._nodes[' + index + '].' + name
return 'this._nodes[' + index + '].' + name
+ ' = this._data.' + path + ';';
},
@@ -200,14 +209,14 @@
// construct setter body
var body = '\tvar old = this._setData(\'' + property + '\', value);\n'
+ '\tif (value !== old) {\n'
+ '\t\tthis.' + effector + '(old);\n'
+ '\t\tthis.' + effector + '(old);\n'
+ '\t}';
var setter = new Function('value', body);
// ReadOnly properties have a private setter only
if (this.isReadOnlyProperty(property)) {
this['_set_' + property] = setter;
}
// other properties have a proper setter
// other properties have a proper setter
else {
defun.set = setter;
}
@@ -218,4 +227,4 @@
});
</script>
</script>

View File

@@ -1,44 +1,53 @@
<!--
@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
-->
<script>
/**
* Needs new name.
*
*
* Support for the declarative property sugaring via a `bind` object
* on the prototype.
*
* Building applications by hand, a pattern emerges: operations such as
* data propagation need to trigger effects. For example, changes to data
* need to be reflected into DOM, or trigger additional value computations.
*
* This module provides an API for registering effects against properties.
* The effect data is consumed by the `bind-effects` module which compiles
* the effects into efficient JavaScript that is triggered, e.g., when a
* property is set to a new value.
*
* Property effects can be created imperatively, by template-annotations
* (e.g. mustache notation), or by declaration in the `bind` object.
*
* The bind object syntax is as follows:
* Building applications by hand, a pattern emerges: operations such as
* data propagation need to trigger effects. For example, changes to data
* need to be reflected into DOM, or trigger additional value computations.
*
* This module provides an API for registering effects against properties.
* The effect data is consumed by the `bind-effects` module which compiles
* the effects into efficient JavaScript that is triggered, e.g., when a
* property is set to a new value.
*
* Property effects can be created imperatively, by template-annotations
* (e.g. mustache notation), or by declaration in the `bind` object.
*
* The bind object syntax is as follows:
*
* bind {
* // if `method` is the name of a method on the current object, the
* // method is invoked with the property changes. The method is provided
* // arguments as follows: `method(value, oldValue)`
* property: 'method'
*
*
* // if the value is not the name of a method, it's assumed to be a
* // id of an element in the `$` hash. Remember that when using a
* // template, `$` maps element ids to elements. By default, changes in
* // id of an element in the `$` hash. Remember that when using a
* // template, `$` maps element ids to elements. By default, changes in
* // the named property are sent to the target element's `textContent`.
* // In this case, when `property2` changes, it's value is set to
* // `this.$.myId.textContent`.
* property2: 'myId'
*
*
* // A target property other than `textContent` can be specified using
* // dot notation. In this case, when `property3` changes, it's value is
* // dot notation. In this case, when `property3` changes, it's value is
* // set to `this.$.myId.value`.
* property3: 'myId.value'
*
*
* // To have a property modification trigger multiple side effects, use
* // an array.
* property4: [
@@ -47,7 +56,7 @@
* 'otherId.value'
* ]
* }
*
*
* @class feature: bind
*/
Base.addFeature({
@@ -59,21 +68,21 @@
// but these things needs to happen before bind-effects itself initializes.
// We need to factor bind-effects into before and after features instead
// and let this feature be for dealing with `bind` object.
register: function(prototype) {
prototype._addPropertyBindEffects();
},
// TODO(sjmiles): really ad hoc self-modifying code
// to resolve initialization ordering around optional
// module
// module
addPropertyEffect: function(property, kind, effect) {
// prepare storage on first invocation
this._propertyEffects = {};
// add the effect
this._addPropertyEffect(property, kind, effect);
// subsequent invocations skip preparation step implementation
this.addPropertyEffect = this._addPropertyEffect;
this.addPropertyEffect = this._addPropertyEffect;
},
_addPropertyEffect: function(property, kind, effect) {
@@ -112,4 +121,4 @@
});
</script>
</script>

View File

@@ -1,5 +1,14 @@
<!--
@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
-->
<script>
Base.addFeature({
/* computed property feature */
@@ -36,4 +45,4 @@
});
</script>
</script>

View File

@@ -1,21 +1,30 @@
<!--
@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
-->
<script>
Base.addFeature({
// TODO(sjmiles): ad-hoc signal for `ShadowDOM-lite-enhanced` nodes
// TODO(sjmiles): ad-hoc signal for `ShadowDOM-lite-enhanced` nodes
isHost: true,
register: function(prototype) {
var t = prototype._template;
// TODO(sorvell): is qsa is wrong here due to distribution?
// TODO(sjmiles): No element should ever actually stamp a <content> node
// TODO(sjmiles): No element should ever actually stamp a <content> node
// into it's composed tree, so I believe this is actually correct.
// However, I wonder if it's more efficient to capture during annotation
// However, I wonder if it's more efficient to capture during annotation
// parsing, since the parse step does a tree walk in any case, and the
// tree is smaller before element expansion.
prototype._useContent = Boolean(t && t.content.querySelector('content'));
},
poolContent: function() {
// pool the light dom
var pool = document.createDocumentFragment();
@@ -24,10 +33,10 @@
}
this.contentPool = pool;
// capture lightChildren to help reify dom scoping
this.lightChildren =
this.lightChildren =
Array.prototype.slice.call(this.contentPool.childNodes, 0);
},
distributeContent: function() {
var content, pool = this.contentPool;
// replace <content> with nodes teleported from pool
@@ -36,8 +45,8 @@
var frag = pool;
if (select) {
frag = document.createDocumentFragment();
// TODO(sjmiles): diverges from ShadowDOM spec behavior: ShadowDOM
// only selects top level nodes from pool. Iterate children and match
// TODO(sjmiles): diverges from ShadowDOM spec behavior: ShadowDOM
// only selects top level nodes from pool. Iterate children and match
// manually instead.
var nodes = pool.querySelectorAll(select);
for (var i=0, l=nodes.length; i<l; i++) {
@@ -48,7 +57,7 @@
content.parentNode.replaceChild(frag, content);
}
}
});
</script>

View File

@@ -1,5 +1,14 @@
<!--
@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
-->
<script>
Base.addFeature({
listeners: {},
@@ -40,5 +49,5 @@
}
});
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
Base.addFeature({
@@ -27,5 +36,5 @@
}
});
</script>

View File

@@ -1,4 +1,5 @@
<!--
@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
@@ -284,4 +285,4 @@ body[fullbleed] {
border-radius: 5px 5px 5px 5px;
}
</style>
</style>

View File

@@ -1,12 +1,21 @@
<!--
@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
-->
<script>
Base.addFeature({
log: function() {
var args = Array.prototype.slice.call(arguments, 0);
var args = Array.prototype.slice.call(arguments, 0);
args[0] = '[%s]: ' + args[0];
args.splice(1, 0, this.localName);
console.log.apply(console, args);
}
});
</script>
</script>

View File

@@ -1,44 +1,53 @@
<!--
@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
-->
<script>
/**
* Define public property API.
* Define public property API.
*
* published: {
* <property>: <Type || Object>,
* ...
*
* // `foo` property can be assigned via attribute, will be deserialized to
* // the specified data-type. All `published` properties have this behavior.
*
* // `foo` property can be assigned via attribute, will be deserialized to
* // the specified data-type. All `published` properties have this behavior.
* foo: String,
*
* // `bar` property has additional behavior specifiers.
* // type: as above, type for (de-)serialization
* // notify: true to send a signal when a value is set to this property
* // reflect: true to serialize the property to an attribute
* // reflect: true to serialize the property to an attribute
* // readOnly: if true, the property has no setter
* bar: {
* type: Boolean,
* notify: true
* notify: true
* }
* }
*
* By itself the published feature doesn't do anything but provide property
*
* By itself the published feature doesn't do anything but provide property
* information. Other features use this information to control behavior.
*
* The `type` information is used by the `attributes` feature to convert
*
* The `type` information is used by the `attributes` feature to convert
* String values in attributes to properties.
*
*
* The `bind-effects` feature uses property information to control property
* access.
*
* Marking a property as `notify` causes a change in the property to
*
* Marking a property as `notify` causes a change in the property to
* fire a non-bubbling event called `<property>-changed`. Elements that
* have enabled two-way binding to the property use this event to
* observe changes.
*
* have enabled two-way binding to the property use this event to
* observe changes.
*
* `readOnly` properties have a getter, but no setter. To set a read-only
* property, use the private setter method `_set_<property>(value)`.
*
*
* @class feature: published
*/
Base.addFeature({
@@ -58,12 +67,12 @@
}
}
},
getPublishInfo: function(property) {
var p = this.published[property];
if (typeof(p) === 'function') {
p = this.published[property] = {
type: p
type: p
};
}
return p || Base.nob;
@@ -87,4 +96,4 @@
});
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
Base.addFeature({

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
Base.addFeature({
@@ -22,7 +31,7 @@
attributeFollows: function(name, neo, old) {
if (old) {
old.removeAttribute(name);
}
}
if (neo) {
neo.setAttribute(name, '');
}
@@ -33,10 +42,10 @@
},
_queryHost: function(node) {
return node &&
return node &&
(node.host || (node.host = this._queryHost(node.parentNode)));
}
});
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
// a tiny bit of sugar for `document.currentScript.ownerDocument`
@@ -10,7 +19,7 @@
return (document._currentScript || document.currentScript).ownerDocument;
}
});
// copy own properties from 'api' to 'prototype, with name hinting for 'super'
function extend(prototype, api) {
if (prototype && api) {
@@ -38,5 +47,5 @@
ESC_KEY: 27,
ENTER_KEY: 13
};
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
(function() {
@@ -6,7 +15,7 @@
Base.addFeature({
// TODO(sorvell): hax to automate path listener setup; figure out how to
// TODO(sorvell): hax to automate path listener setup; figure out how to
// integrate this better.
_setupBindListeners: function() {
originalSetupBindListeners.call(this);
@@ -27,7 +36,7 @@
var model = modelForPath(info.path);
var event;
// determine if and what event we need to listen on
if (node._isPublishedObject &&
if (node._isPublishedObject &&
node._isPublishedObject(info.property)) {
event = info.property + EVENT_PROP_CHANGED;
} else if (model !== info.path) {
@@ -51,7 +60,7 @@
},
/**
Notify that a property has changed. This method can be used to
Notify that a property has changed. This method can be used to
flow data through the system when a path in an Object valued property
changes. For example:
@@ -64,10 +73,10 @@
},
// Force property side effects.
// 1. calls the _propertyEffector
// 2. for bindings to Object valued properties, we need to cascade
// recursively through dirty check prevention
// (e.g. if foo.item = this.item is dirty checked away, we ensure
// 1. calls the _propertyEffector
// 2. for bindings to Object valued properties, we need to cascade
// recursively through dirty check prevention
// (e.g. if foo.item = this.item is dirty checked away, we ensure
// foo.item's side effects run)
_forcePropertyEffect: function(property) {
this['_' + property + 'Effector']();

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
(function() {

View File

@@ -1,3 +1,12 @@
<!--
@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="../polymer.html">
<link rel="import" href="../features/template.html">
@@ -20,4 +29,4 @@
}
this.defaultFeatures();
}
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
(function() {
@@ -22,8 +31,8 @@
originalAttachedCallback.call(this);
},
// Checks if this element is inside another "readyable" element. If so,
// then pushes this element into an array of `_needsReady` elements; if
// Checks if this element is inside another "readyable" element. If so,
// then pushes this element into an array of `_needsReady` elements; if
// not, starts the ready cascade.
_checkReady: function() {
if (!this._readied) {
@@ -75,7 +84,7 @@
// user extension point.
ready: function() {},
// overridden to allow recording of initial values
_createBindings: function() {
this._recordInitialValues();
@@ -104,7 +113,7 @@
},
/**
Ensures `property` has a value. If it does not, then the property is
Ensures `property` has a value. If it does not, then the property is
set to `defaultValue`.
*/
setDefaultValue: function(property, defaultValue) {

View File

@@ -1,4 +1,5 @@
<!--
@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
@@ -283,4 +284,4 @@ html /deep/ [segment], html /deep/ segment {
border-radius: 5px 5px 5px 5px;
}
</style>
</style>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
/* Configures elemnent styles to stamped into ShadowDOM.
@@ -5,7 +14,7 @@
NOTE: using this feature will currently change all templates to be configured
to be styled for ShadowDOM.
* If an element has a template, style is placed in the template and element
* If an element has a template, style is placed in the template and element
name is replaced with `:host`.
* If an element does not have a template, style remains in place, but rules
are prepended with `html /deep/`.
@@ -19,7 +28,7 @@
register: function(prototype) {
var template = prototype._template;
var hook = template ||
var hook = template ||
(document._currentScript || document.currentScript);
var styles = [];
var prev = hook.previousElementSibling;
@@ -31,7 +40,7 @@
if (!styles.length) {
return;
}
// use :host or /deep/ depending on if the element has a template and
// use :host or /deep/ depending on if the element has a template and
// therefore will have a shadowRoot.
var selector = template ? ':host' : 'html /deep/ $&';
this._processStyles(prototype._styles, prototype.name, selector);
@@ -39,7 +48,7 @@
this.insertStyles(prototype._styles, template.content);
}
},
_processStyles: function(styles, name, selector) {
var re = new RegExp(name, 'g');
for (var i=0, l=styles.length, style; (i<l) && (style=styles[i]); i++) {
@@ -52,12 +61,12 @@
for (var i=0, l=styles.length, style, n; (i<l) && (style=styles[i]); i++) {
n = document.createElement('style');
n.textContent = style.textContent;
ref = root.insertBefore(n,
ref = root.insertBefore(n,
ref.nextElementSibling);
}
}
});
})();
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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
-->
<script>
Base.addFeature({
@@ -5,5 +14,5 @@
this.root = this.createShadowRoot();
}
});
</script>
</script>

View File

@@ -1,3 +1,12 @@
<!--
@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="lang.html">
<link rel="import" href="base.html">
@@ -14,4 +23,4 @@
Polymer.log = {
};
</script>
</script>