1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update polymer

This commit is contained in:
Luke Pulverenti 2015-10-27 10:58:38 -04:00
parent 6825ae319e
commit 2d53ff29c5
106 changed files with 3070 additions and 1567 deletions

View file

@ -30,6 +30,6 @@
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa" "commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
}, },
"_source": "git://github.com/desandro/eventie.git", "_source": "git://github.com/desandro/eventie.git",
"_target": "^1", "_target": "~1.0.3",
"_originalSource": "eventie" "_originalSource": "eventie"
} }

View file

@ -31,6 +31,6 @@
"commit": "34fc5e4a0f252964ed2790138b8d7d30d04b55c1" "commit": "34fc5e4a0f252964ed2790138b8d7d30d04b55c1"
}, },
"_source": "git://github.com/desandro/get-style-property.git", "_source": "git://github.com/desandro/get-style-property.git",
"_target": "~1.0.4", "_target": "1.x",
"_originalSource": "get-style-property" "_originalSource": "get-style-property"
} }

View file

@ -1,17 +1,16 @@
{ {
"name": "howler.js", "name": "howler.js",
"version": "1.1.27", "version": "1.1.28",
"description": "Javascript audio library for the modern web.", "description": "Javascript audio library for the modern web.",
"main": "howler.js", "main": "howler.js",
"homepage": "https://github.com/goldfire/howler.js", "homepage": "https://github.com/goldfire/howler.js",
"_release": "1.1.27", "_release": "1.1.28",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.27", "tag": "v1.1.28",
"commit": "70cbd7af0e3e7ced5a825fff8d297b7710835f6d" "commit": "34c22ab507f847bba7bd2eb2b003197cfc54f274"
}, },
"_source": "git://github.com/goldfire/howler.js.git", "_source": "git://github.com/goldfire/howler.js.git",
"_target": "~1.1.27", "_target": "~1.1.27",
"_originalSource": "howler", "_originalSource": "howler"
"_direct": true
} }

View file

@ -1,3 +1,6 @@
## 1.1.28 (October 22, 2015)
- `FIXED`: Fixed typo with iOS enabler that was preventing it from working.
## 1.1.27 (October 2, 2015) ## 1.1.27 (October 2, 2015)
- `FIXED`: Fixed automatic audio unlocking on iOS 9 by switching to `touchend` from `touchstart`. - `FIXED`: Fixed automatic audio unlocking on iOS 9 by switching to `touchend` from `touchstart`.

View file

@ -1,5 +1,5 @@
/*! /*!
* howler.js v1.1.27 * howler.js v1.1.28
* howlerjs.com * howlerjs.com
* *
* (c) 2013-2015, James Simpson of GoldFire Studios * (c) 2013-2015, James Simpson of GoldFire Studios

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-a11y-keys-behavior", "name": "iron-a11y-keys-behavior",
"version": "1.0.6", "version": "1.0.7",
"description": "A behavior that enables keybindings for greater a11y.", "description": "A behavior that enables keybindings for greater a11y.",
"keywords": [ "keywords": [
"web-components", "web-components",
@ -29,14 +29,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior", "homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior",
"_release": "1.0.6", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.6", "tag": "v1.0.7",
"commit": "af5c98b1cf9b3d180a6326c99ac9c7057eee647f" "commit": "4dfdd8cca76eabe12245e86deb9d5da3cd717460"
}, },
"_source": "git://github.com/polymerelements/iron-a11y-keys-behavior.git", "_source": "git://github.com/PolymerElements/iron-a11y-keys-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-a11y-keys-behavior" "_originalSource": "PolymerElements/iron-a11y-keys-behavior"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-a11y-keys-behavior", "name": "iron-a11y-keys-behavior",
"version": "1.0.6", "version": "1.0.7",
"description": "A behavior that enables keybindings for greater a11y.", "description": "A behavior that enables keybindings for greater a11y.",
"keywords": [ "keywords": [
"web-components", "web-components",

View file

@ -255,6 +255,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
}, },
/**
* If true, this property will cause the implementing element to
* automatically stop propagation on any handled KeyboardEvents.
*/
stopKeyboardEventPropagation: {
type: Boolean,
value: false
},
_boundKeyHandlers: { _boundKeyHandlers: {
type: Array, type: Array,
value: function() { value: function() {
@ -398,6 +407,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
_onKeyBindingEvent: function(keyBindings, event) { _onKeyBindingEvent: function(keyBindings, event) {
if (this.stopKeyboardEventPropagation) {
event.stopPropagation();
}
keyBindings.forEach(function(keyBinding) { keyBindings.forEach(function(keyBinding) {
var keyCombo = keyBinding[0]; var keyCombo = keyBinding[0];
var handlerName = keyBinding[1]; var handlerName = keyBinding[1];

View file

@ -30,6 +30,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template> </template>
</test-fixture> </test-fixture>
<test-fixture id="NonPropagatingKeys">
<template>
<x-a11y-basic-keys stop-keyboard-event-propagation></x-a11y-basic-keys>
</template>
</test-fixture>
<test-fixture id="ComboKeys"> <test-fixture id="ComboKeys">
<template> <template>
<x-a11y-combo-keys></x-a11y-combo-keys> <x-a11y-combo-keys></x-a11y-combo-keys>
@ -161,6 +167,15 @@ suite('Polymer.IronA11yKeysBehavior', function() {
expect(keys.keyCount).to.be.equal(1); expect(keys.keyCount).to.be.equal(1);
}); });
test('allows propagation beyond the key combo handler', function() {
var keySpy = sinon.spy();
document.addEventListener('keydown', keySpy);
MockInteractions.pressEnter(keys);
expect(keySpy.callCount).to.be.equal(1);
});
suite('edge cases', function() { suite('edge cases', function() {
test('knows that `spacebar` is the same as `space`', function() { test('knows that `spacebar` is the same as `space`', function() {
var event = new CustomEvent('keydown'); var event = new CustomEvent('keydown');
@ -242,6 +257,22 @@ suite('Polymer.IronA11yKeysBehavior', function() {
}); });
}); });
suite('stopping propagation automatically', function() {
setup(function() {
keys = fixture('NonPropagatingKeys');
});
test('does not propagate key events beyond the combo handler', function() {
var keySpy = sinon.spy();
document.addEventListener('keydown', keySpy);
MockInteractions.pressEnter(keys);
expect(keySpy.callCount).to.be.equal(0);
});
});
}); });
</script> </script>
</body> </body>

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-form-element-behavior", "name": "iron-form-element-behavior",
"version": "1.0.4", "version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"private": true, "private": true,
"main": [ "main": [
@ -30,11 +30,11 @@
"paper-styles": "PolymerElements/paper-styles#^1.0.0" "paper-styles": "PolymerElements/paper-styles#^1.0.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-form-element-behavior", "homepage": "https://github.com/PolymerElements/iron-form-element-behavior",
"_release": "1.0.4", "_release": "1.0.5",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.4", "tag": "v1.0.5",
"commit": "d5b296d63fa65cc3870c50801e37ffc08fe2d5e3" "commit": "52b16e14511a4b659658da705f5f4b2b45131941"
}, },
"_source": "git://github.com/PolymerElements/iron-form-element-behavior.git", "_source": "git://github.com/PolymerElements/iron-form-element-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-form-element-behavior", "name": "iron-form-element-behavior",
"version": "1.0.4", "version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"private": true, "private": true,
"main": [ "main": [

View file

@ -53,8 +53,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* custom element that uses this behavior should also use * custom element that uses this behavior should also use
* Polymer.IronValidatableBehavior and define a custom validation method. * Polymer.IronValidatableBehavior and define a custom validation method.
* Otherwise, a `required` element will always be considered valid. * Otherwise, a `required` element will always be considered valid.
* It's also strongly recomended to provide a visual style for the element * It's also strongly recommended to provide a visual style for the element
* when it's value is invalid. * when its value is invalid.
*/ */
required: { required: {
type: Boolean, type: Boolean,

View file

@ -1,7 +1,7 @@
{ {
"name": "iron-icon", "name": "iron-icon",
"private": true, "private": true,
"version": "1.0.5", "version": "1.0.7",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "An element that supports displaying an icon", "description": "An element that supports displaying an icon",
"main": "iron-icon.html", "main": "iron-icon.html",
@ -32,11 +32,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-icon", "homepage": "https://github.com/polymerelements/iron-icon",
"_release": "1.0.5", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.5", "tag": "v1.0.7",
"commit": "5217361e21016b3ca52b7bbf5ba2ad56b3301486" "commit": "6f4d152dc3998a6cc12a5a585a654f893dc99381"
}, },
"_source": "git://github.com/polymerelements/iron-icon.git", "_source": "git://github.com/polymerelements/iron-icon.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,7 +1,7 @@
{ {
"name": "iron-icon", "name": "iron-icon",
"private": true, "private": true,
"version": "1.0.5", "version": "1.0.7",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "An element that supports displaying an icon", "description": "An element that supports displaying an icon",
"main": "iron-icon.html", "main": "iron-icon.html",

View file

@ -52,10 +52,11 @@ Example of using an icon named `cherry` from a custom iconset with the ID `fruit
<iron-icon icon="fruit:cherry"></iron-icon> <iron-icon icon="fruit:cherry"></iron-icon>
See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for more information about See [iron-iconset](iron-iconset) and [iron-iconset-svg](iron-iconset-svg) for more information about
how to create a custom iconset. how to create a custom iconset.
See [iron-icons](https://elements.polymer-project.org/elements/iron-icons?view=demo:demo/index.html) for the default set of icons. See the [iron-icons demo](iron-icons?view=demo:demo/index.html) to see the icons available
in the various iconsets.
### Styling ### Styling
@ -66,6 +67,8 @@ Custom property | Description | Default
----------------|-------------|---------- ----------------|-------------|----------
`--iron-icon-width` | Width of the icon | `24px` `--iron-icon-width` | Width of the icon | `24px`
`--iron-icon-height` | Height of the icon | `24px` `--iron-icon-height` | Height of the icon | `24px`
`--iron-icon-fill-color` | Fill color of the svg icon | `currentcolor`
`--iron-icon-stroke-color` | Stroke color of the svg icon | none
@group Iron Elements @group Iron Elements
@element iron-icon @element iron-icon
@ -84,7 +87,8 @@ Custom property | Description | Default
vertical-align: middle; vertical-align: middle;
fill: currentcolor; fill: var(--iron-icon-fill-color, currentcolor);
stroke: var(--iron-icon-stroke-color, none);
width: var(--iron-icon-width, 24px); width: var(--iron-icon-width, 24px);
height: var(--iron-icon-height, 24px); height: var(--iron-icon-height, 24px);

View file

@ -1,7 +1,7 @@
{ {
"name": "iron-iconset-svg", "name": "iron-iconset-svg",
"description": "Manages a set of svg icons", "description": "Manages a set of svg icons",
"version": "1.0.6", "version": "1.0.8",
"keywords": [ "keywords": [
"web-components", "web-components",
"polymer", "polymer",
@ -30,11 +30,11 @@
"web-component-tester": "*" "web-component-tester": "*"
}, },
"homepage": "https://github.com/polymerelements/iron-iconset-svg", "homepage": "https://github.com/polymerelements/iron-iconset-svg",
"_release": "1.0.6", "_release": "1.0.8",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.6", "tag": "v1.0.8",
"commit": "ebd17924942abe6110aa0fe81b1b31e1fcc34a9f" "commit": "7f8b0a5800254247cb518356aee983155374f519"
}, },
"_source": "git://github.com/polymerelements/iron-iconset-svg.git", "_source": "git://github.com/polymerelements/iron-iconset-svg.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,7 +1,7 @@
{ {
"name": "iron-iconset-svg", "name": "iron-iconset-svg",
"description": "Manages a set of svg icons", "description": "Manages a set of svg icons",
"version": "1.0.6", "version": "1.0.8",
"keywords": [ "keywords": [
"web-components", "web-components",
"polymer", "polymer",

View file

@ -18,9 +18,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `iron-iconset-svg` element. Multiple icons should be given distinct id's. * `iron-iconset-svg` element. Multiple icons should be given distinct id's.
* *
* Using svg elements to create icons has a few advantages over traditional * Using svg elements to create icons has a few advantages over traditional
* bitmap graphics like jpg or png. Icons that use svg are vector based so they * bitmap graphics like jpg or png. Icons that use svg are vector based so
* are resolution independent and should look good on any device. They are * they are resolution independent and should look good on any device. They
* stylable via css. Icons can be themed, colorized, and even animated. * are stylable via css. Icons can be themed, colorized, and even animated.
* *
* Example: * Example:
* *
@ -45,18 +45,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @element iron-iconset-svg * @element iron-iconset-svg
* @demo demo/index.html * @demo demo/index.html
* @implements {Polymer.Iconset}
*/ */
Polymer({ Polymer({
is: 'iron-iconset-svg', is: 'iron-iconset-svg',
properties: { properties: {
/** /**
* The name of the iconset. * The name of the iconset.
*
* @attribute name
* @type string
*/ */
name: { name: {
type: String, type: String,
@ -65,10 +62,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* The size of an individual icon. Note that icons must be square. * The size of an individual icon. Note that icons must be square.
*
* @attribute iconSize
* @type number
* @default 24
*/ */
size: { size: {
type: Number, type: Number,
@ -77,6 +70,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
attached: function() {
this.style.display = 'none';
},
/** /**
* Construct an array of all icon names in this iconset. * Construct an array of all icon names in this iconset.
* *
@ -98,7 +95,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @method applyIcon * @method applyIcon
* @param {Element} element Element to which the icon is applied. * @param {Element} element Element to which the icon is applied.
* @param {string} iconName Name of the icon to apply. * @param {string} iconName Name of the icon to apply.
* @return {Element} The svg element which renders the icon. * @return {?Element} The svg element which renders the icon.
*/ */
applyIcon: function(element, iconName) { applyIcon: function(element, iconName) {
// insert svg element into shadow root, if it exists // insert svg element into shadow root, if it exists

View file

@ -78,6 +78,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
expect(meta.byKey('foo')).to.be.equal(iconset); expect(meta.byKey('foo')).to.be.equal(iconset);
}); });
test('it does not have a size', function () {
var rect = iconset.getBoundingClientRect();
expect(rect.width).to.be.equal(0);
expect(rect.height).to.be.equal(0);
});
test('it fires an iron-iconset-added event on the window', function() { test('it fires an iron-iconset-added event on the window', function() {
return loadedPromise; return loadedPromise;
}); });
@ -93,6 +99,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
div = elements[1]; div = elements[1];
}); });
test('it does not have a size', function () {
var rect = iconset.getBoundingClientRect();
expect(rect.width).to.be.equal(0);
expect(rect.height).to.be.equal(0);
});
test('appends a child to the target element', function () { test('appends a child to the target element', function () {
expect(div.firstElementChild).to.not.be.ok; expect(div.firstElementChild).to.not.be.ok;
iconset.applyIcon(div, 'circle'); iconset.applyIcon(div, 'circle');

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-media-query", "name": "iron-media-query",
"version": "1.0.3", "version": "1.0.4",
"description": "Lets you bind to a CSS media query", "description": "Lets you bind to a CSS media query",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -28,11 +28,11 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.3", "_release": "1.0.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.4",
"commit": "80e921f58e7688a840a0cf29e9e2aaaee72a66b2" "commit": "a9dd58cd50bb9f203a7beef15282bf74e48563a8"
}, },
"_source": "git://github.com/PolymerElements/iron-media-query.git", "_source": "git://github.com/PolymerElements/iron-media-query.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-media-query", "name": "iron-media-query",
"version": "1.0.3", "version": "1.0.4",
"description": "Lets you bind to a CSS media query", "description": "Lets you bind to a CSS media query",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -50,10 +50,20 @@ Example:
observer: 'queryChanged' observer: 'queryChanged'
}, },
/**
* @type {function(MediaQueryList)}
*/
_boundMQHandler: { _boundMQHandler: {
value: function() { value: function() {
return this.queryHandler.bind(this); return this.queryHandler.bind(this);
} }
},
/**
* @type {MediaQueryList}
*/
_mq: {
value: null
} }
}, },

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-meta", "name": "iron-meta",
"version": "1.0.3", "version": "1.1.0",
"keywords": [ "keywords": [
"web-components", "web-components",
"polymer" "polymer"
@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-meta", "homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3", "_release": "1.1.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.1.0",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "be7ccf8df650aef1446a4e23af33f5d4e9f3000f"
}, },
"_source": "git://github.com/polymerelements/iron-meta.git", "_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta" "_originalSource": "PolymerElements/iron-meta"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-meta", "name": "iron-meta",
"version": "1.0.3", "version": "1.1.0",
"keywords": [ "keywords": [
"web-components", "web-components",
"polymer" "polymer"

View file

@ -58,6 +58,7 @@ Or, in a Polymer element, you can include a meta in your template:
// monostate data // monostate data
var metaDatas = {}; var metaDatas = {};
var metaArrays = {}; var metaArrays = {};
var singleton = null;
Polymer.IronMeta = Polymer({ Polymer.IronMeta = Polymer({
@ -110,6 +111,10 @@ Or, in a Polymer element, you can include a meta in your template:
}, },
hostAttributes: {
hidden: true
},
/** /**
* Only runs if someone invokes the factory/constructor directly * Only runs if someone invokes the factory/constructor directly
* e.g. `new Polymer.IronMeta()` * e.g. `new Polymer.IronMeta()`
@ -204,6 +209,13 @@ Or, in a Polymer element, you can include a meta in your template:
}); });
Polymer.IronMeta.getIronMeta = function getIronMeta() {
if (singleton === null) {
singleton = new Polymer.IronMeta();
}
return singleton;
};
/** /**
`iron-meta-query` can be used to access infomation stored in `iron-meta`. `iron-meta-query` can be used to access infomation stored in `iron-meta`.

View file

@ -179,6 +179,15 @@ suite('<iron-meta>', function () {
expect(registeredValue).to.be.equal(secondValue); expect(registeredValue).to.be.equal(secondValue);
}); });
}); });
suite('singleton', function () {
test('only one ironmeta created', function () {
var first = Polymer.IronMeta.getIronMeta();
var second = Polymer.IronMeta.getIronMeta();
expect(first).to.be.equal(second);
});
});
}); });
</script> </script>

View file

@ -34,14 +34,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-overlay-behavior", "homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.0.9", "_release": "1.0.9",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.9", "tag": "v1.0.9",
"commit": "87f7763d323fffa07357a08777ad831b7c2c2fb8" "commit": "87f7763d323fffa07357a08777ad831b7c2c2fb8"
}, },
"_source": "git://github.com/PolymerElements/iron-overlay-behavior.git", "_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-overlay-behavior" "_originalSource": "polymerelements/iron-overlay-behavior"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-range-behavior", "name": "iron-range-behavior",
"version": "1.0.3", "version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value", "description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
@ -28,11 +28,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-range-behavior", "homepage": "https://github.com/PolymerElements/iron-range-behavior",
"_release": "1.0.3", "_release": "1.0.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.4",
"commit": "3ed9a372778e31e62477666b313155c581a7dfe6" "commit": "71774a7d8a8c377496bfe05e60b754e91216e0b9"
}, },
"_source": "git://github.com/PolymerElements/iron-range-behavior.git", "_source": "git://github.com/PolymerElements/iron-range-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-range-behavior", "name": "iron-range-behavior",
"version": "1.0.3", "version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value", "description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",

View file

@ -93,7 +93,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/ */
// polymer/issues/2493 // polymer/issues/2493
value = parseFloat(value); value = parseFloat(value);
return this.step ? (Math.round((value + this.min) / this.step) / (1 / this.step)) - this.min : value; return this.step ? (Math.round((value + this.min) / this.step) -
(this.min / this.step)) / (1 / this.step) : value;
}, },
_validateValue: function() { _validateValue: function() {

View file

@ -103,7 +103,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('odd values', function() { test('odd values', function(done) {
range.min = 1; range.min = 1;
range.max = 7; range.max = 7;
range.step = 2; range.step = 2;
@ -117,6 +117,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
range.value += range.step; range.value += range.step;
assert.equal(range.value, 7); assert.equal(range.value, 7);
done();
});
});
test('negative values should round up', function(done) {
range.min = -10;
range.max = 10;
range.step = 0.1;
range.value = -8.4252;
flush(function() {
assert.equal(range.value, -8.4);
done();
});
});
test('positive values should round up', function(done) {
range.min = 10;
range.max = 100;
range.step = 0.25;
range.value = 19.34567;
flush(function() {
assert.equal(range.value, 19.25);
done();
}); });
}); });

View file

@ -38,7 +38,7 @@
"tag": "v1.0.7", "tag": "v1.0.7",
"commit": "0b2f484ac3b1b03400da2d38b0f543f3688150a4" "commit": "0b2f484ac3b1b03400da2d38b0f543f3688150a4"
}, },
"_source": "git://github.com/polymerelements/iron-selector.git", "_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-selector" "_originalSource": "PolymerElements/iron-selector"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-validatable-behavior", "name": "iron-validatable-behavior",
"version": "1.0.4", "version": "1.0.5",
"description": "Provides a behavior for an element that validates user input", "description": "Provides a behavior for an element that validates user input",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [
@ -32,11 +32,11 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.4", "_release": "1.0.5",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.4", "tag": "v1.0.5",
"commit": "ff267b561b032608755d705c1a7e346454b0aee4" "commit": "c1334b835892b3d7a329a8e6b8741d4be3a8d99c"
}, },
"_source": "git://github.com/PolymerElements/iron-validatable-behavior.git", "_source": "git://github.com/PolymerElements/iron-validatable-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-validatable-behavior", "name": "iron-validatable-behavior",
"version": "1.0.4", "version": "1.0.5",
"description": "Provides a behavior for an element that validates user input", "description": "Provides a behavior for an element that validates user input",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [

View file

@ -14,7 +14,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script> <script>
/** /**
* Use `Polymer.IronValidatableBehavior` to implement an element that validates user input. * `Use Polymer.IronValidatableBehavior` to implement an element that validates user input.
* Use the related `Polymer.IronValidatorBehavior` to add custom validation logic to an iron-input.
*
* By default, an `<iron-form>` element validates its fields when the user presses the submit button.
* To validate a form imperatively, call the form's `validate()` method, which in turn will
* call `validate()` on all its children. By using `Polymer.IronValidatableBehavior`, your
* custom element will get a public `validate()`, which
* will return the validity of the element, and a corresponding `invalid` attribute,
* which can be used for styling.
*
* To implement the custom validation logic of your element, you must override
* the protected `_getValidity()` method of this behaviour, rather than `validate()`.
* See [this](https://github.com/PolymerElements/iron-form/blob/master/demo/simple-element.html)
* for an example.
* *
* ### Accessibility * ### Accessibility
* *

View file

@ -1,6 +1,6 @@
{ {
"name": "neon-animation", "name": "neon-animation",
"version": "1.0.6", "version": "1.0.7",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
], ],
@ -48,13 +48,13 @@
"iron-icons": "PolymerElements/iron-icons#^1.0.0", "iron-icons": "PolymerElements/iron-icons#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0" "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0"
}, },
"_release": "1.0.6", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.6", "tag": "v1.0.7",
"commit": "ec51bf68f05c40373536cc726ca674e4549b7db2" "commit": "02daf22e000ed6afeecf6ae0291ae11e6eebbfcf"
}, },
"_source": "git://github.com/PolymerElements/neon-animation.git", "_source": "git://github.com/polymerelements/neon-animation.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/neon-animation" "_originalSource": "polymerelements/neon-animation"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "neon-animation", "name": "neon-animation",
"version": "1.0.4", "version": "1.0.7",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
], ],

View file

@ -13,6 +13,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="animations/opaque-animation.html"> <link rel="import" href="animations/opaque-animation.html">
<!-- <!--
Material design: [Meaningful transitions](https://www.google.com/design/spec/animation/meaningful-transitions.html)
`neon-animated-pages` manages a set of pages and runs an animation when switching between them. Its `neon-animated-pages` manages a set of pages and runs an animation when switching between them. Its
children pages should implement `Polymer.NeonAnimatableBehavior` and define `entry` and `exit` children pages should implement `Polymer.NeonAnimatableBehavior` and define `entry` and `exit`
animations to be run when switching to or switching out of the page. animations to be run when switching to or switching out of the page.
@ -133,6 +135,7 @@ animations to be run when switching to or switching out of the page.
this._squelchNextFinishEvent = true; this._squelchNextFinishEvent = true;
this.cancelAnimation(); this.cancelAnimation();
this._completeSelectedChanged(); this._completeSelectedChanged();
this._squelchNextFinishEvent = false;
} }
// configure the animation. // configure the animation.

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-behaviors", "name": "paper-behaviors",
"version": "1.0.5", "version": "1.0.7",
"description": "Common behaviors across the paper elements", "description": "Common behaviors across the paper elements",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -37,13 +37,13 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.5", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.5", "tag": "v1.0.7",
"commit": "57b4ddedf6fa54171d0c9d078f340399724bfe4e" "commit": "7a674a3635fcb6db4842d16d3fd768ab07d638a8"
}, },
"_source": "git://github.com/polymerelements/paper-behaviors.git", "_source": "git://github.com/PolymerElements/paper-behaviors.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/paper-behaviors" "_originalSource": "PolymerElements/paper-behaviors"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-behaviors", "name": "paper-behaviors",
"version": "1.0.5", "version": "1.0.7",
"description": "Common behaviors across the paper elements", "description": "Common behaviors across the paper elements",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -66,6 +66,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* In addition to `IronButtonState` behavior, when space key goes down, * In addition to `IronButtonState` behavior, when space key goes down,
* create a ripple down effect. * create a ripple down effect.
*
* @param {!KeyboardEvent} event .
*/ */
_spaceKeyDownHandler: function(event) { _spaceKeyDownHandler: function(event) {
Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event); Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event);
@ -77,6 +79,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* In addition to `IronButtonState` behavior, when space key goes up, * In addition to `IronButtonState` behavior, when space key goes up,
* create a ripple up effect. * create a ripple up effect.
*
* @param {!KeyboardEvent} event .
*/ */
_spaceKeyUpHandler: function(event) { _spaceKeyUpHandler: function(event) {
Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this, event); Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this, event);

View file

@ -32,6 +32,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
noink: { noink: {
type: Boolean, type: Boolean,
observer: '_noinkChanged' observer: '_noinkChanged'
},
/**
* @type {Element|undefined}
*/
_rippleContainer: {
type: Object,
} }
}, },
@ -59,10 +66,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* Ensures this element contains a ripple effect. For startup efficiency * Ensures this element contains a ripple effect. For startup efficiency
* the ripple effect is dynamically on demand when needed. * the ripple effect is dynamically on demand when needed.
* @param {event} triggeringEvent (optional) event that triggered the * @param {!Event=} opt_triggeringEvent (optional) event that triggered the
* ripple. * ripple.
*/ */
ensureRipple: function(triggeringEvent) { ensureRipple: function(opt_triggeringEvent) {
if (!this.hasRipple()) { if (!this.hasRipple()) {
this._ripple = this._createRipple(); this._ripple = this._createRipple();
this._ripple.noink = this.noink; this._ripple.noink = this.noink;
@ -72,8 +79,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
var domContainer = rippleContainer === this.shadyRoot ? this : var domContainer = rippleContainer === this.shadyRoot ? this :
rippleContainer; rippleContainer;
if (triggeringEvent && domContainer.contains(triggeringEvent.target)) { if (opt_triggeringEvent) {
this._ripple.uiDownAction(triggeringEvent); var target = opt_triggeringEvent.target;
if (domContainer.contains(/** @type {Node} */(target))) {
this._ripple.uiDownAction(opt_triggeringEvent);
}
} }
} }
}, },
@ -100,10 +110,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* Create the element's ripple effect via creating a `<paper-ripple>`. * Create the element's ripple effect via creating a `<paper-ripple>`.
* Override this method to customize the ripple element. * Override this method to customize the ripple element.
* @return {element} Returns a `<paper-ripple>` element. * @return {!PaperRippleElement} Returns a `<paper-ripple>` element.
*/ */
_createRipple: function() { _createRipple: function() {
return document.createElement('paper-ripple'); return /** @type {!PaperRippleElement} */ (
document.createElement('paper-ripple'));
}, },
_noinkChanged: function(noink) { _noinkChanged: function(noink) {

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-checkbox", "name": "paper-checkbox",
"version": "1.0.12", "version": "1.0.13",
"description": "A material design checkbox", "description": "A material design checkbox",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -35,11 +35,11 @@
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0" "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
}, },
"_release": "1.0.12", "_release": "1.0.13",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.12", "tag": "v1.0.13",
"commit": "04fefb44a6e93bcee030f892694663f8d7fd0365" "commit": "33f38432fb26fe5638ecce44fbe10a794f4bdff4"
}, },
"_source": "git://github.com/PolymerElements/paper-checkbox.git", "_source": "git://github.com/PolymerElements/paper-checkbox.git",
"_target": "~1.0.5", "_target": "~1.0.5",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-checkbox", "name": "paper-checkbox",
"version": "1.0.12", "version": "1.0.13",
"description": "A material design checkbox", "description": "A material design checkbox",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -42,6 +42,7 @@ Custom property | Description | Default
`--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color` `--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
`--paper-checkbox-checkmark-color` | Checkmark color | `white` `--paper-checkbox-checkmark-color` | Checkmark color | `white`
`--paper-checkbox-label-color` | Label color | `--primary-text-color` `--paper-checkbox-label-color` | Label color | `--primary-text-color`
`--paper-checkbox-label-spacing` | Spacing between the label and the checkbox | `8px`
`--paper-checkbox-error-color` | Checkbox color when invalid | `--google-red-500` `--paper-checkbox-error-color` | Checkbox color when invalid | `--google-red-500`
@demo demo/index.html @demo demo/index.html
@ -75,7 +76,7 @@ Custom property | Description | Default
background-color: var(--paper-checkbox-unchecked-background-color, transparent); background-color: var(--paper-checkbox-unchecked-background-color, transparent);
} }
:host #ink { #ink {
position: absolute; position: absolute;
top: -15px; top: -15px;
left: -15px; left: -15px;
@ -86,11 +87,16 @@ Custom property | Description | Default
pointer-events: none; pointer-events: none;
} }
:host #ink[checked] { :host-context([dir="rtl"]) #ink {
right: -15px;
left: auto;
}
#ink[checked] {
color: var(--paper-checkbox-checked-ink-color, --default-primary-color); color: var(--paper-checkbox-checked-ink-color, --default-primary-color);
} }
:host #checkbox { #checkbox {
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
@ -138,12 +144,12 @@ Custom property | Description | Default
} }
} }
:host #checkbox.checked { #checkbox.checked {
background-color: var(--paper-checkbox-checked-color, --default-primary-color); background-color: var(--paper-checkbox-checked-color, --default-primary-color);
border-color: var(--paper-checkbox-checked-color, --default-primary-color); border-color: var(--paper-checkbox-checked-color, --default-primary-color);
} }
:host #checkmark { #checkmark {
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
transform: rotate(45deg); transform: rotate(45deg);
position: absolute; position: absolute;
@ -164,12 +170,17 @@ Custom property | Description | Default
position: relative; position: relative;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
padding-left: 8px; padding-left: var(--paper-checkbox-label-spacing, 8px);
white-space: normal; white-space: normal;
pointer-events: none; pointer-events: none;
color: var(--paper-checkbox-label-color, --primary-text-color); color: var(--paper-checkbox-label-color, --primary-text-color);
} }
:host-context([dir="rtl"]) #checkboxLabel {
padding-right: var(--paper-checkbox-label-spacing, 8px);
padding-left: 0;
}
#checkboxLabel[hidden] { #checkboxLabel[hidden] {
display: none; display: none;
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-dropdown-menu", "name": "paper-dropdown-menu",
"version": "1.0.4", "version": "1.0.5",
"description": "An element that works similarly to a native browser select", "description": "An element that works similarly to a native browser select",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -28,7 +28,9 @@
"paper-input": "polymerelements/paper-input#^1.0.9", "paper-input": "polymerelements/paper-input#^1.0.9",
"paper-menu-button": "polymerelements/paper-menu-button#^1.0.0", "paper-menu-button": "polymerelements/paper-menu-button#^1.0.0",
"paper-ripple": "polymerelements/paper-ripple#^1.0.0", "paper-ripple": "polymerelements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0" "paper-styles": "polymerelements/paper-styles#^1.0.0",
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0", "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
@ -40,11 +42,11 @@
"web-component-tester": "*", "web-component-tester": "*",
"paper-tabs": "polymerelements/paper-tabs#^1.0.0" "paper-tabs": "polymerelements/paper-tabs#^1.0.0"
}, },
"_release": "1.0.4", "_release": "1.0.5",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.4", "tag": "v1.0.5",
"commit": "b278c9ea1b3642c77bd4597a28b39a61996a5a9e" "commit": "63b8200dc68ce297dcf2000a60587f3f68464f31"
}, },
"_source": "git://github.com/PolymerElements/paper-dropdown-menu.git", "_source": "git://github.com/PolymerElements/paper-dropdown-menu.git",
"_target": "~1.0.1", "_target": "~1.0.1",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-dropdown-menu", "name": "paper-dropdown-menu",
"version": "1.0.4", "version": "1.0.5",
"description": "An element that works similarly to a native browser select", "description": "An element that works similarly to a native browser select",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -28,7 +28,9 @@
"paper-input": "polymerelements/paper-input#^1.0.9", "paper-input": "polymerelements/paper-input#^1.0.9",
"paper-menu-button": "polymerelements/paper-menu-button#^1.0.0", "paper-menu-button": "polymerelements/paper-menu-button#^1.0.0",
"paper-ripple": "polymerelements/paper-ripple#^1.0.0", "paper-ripple": "polymerelements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0" "paper-styles": "polymerelements/paper-styles#^1.0.0",
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0", "iron-component-page": "polymerelements/iron-component-page#^1.0.0",

View file

@ -19,8 +19,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../iron-icons/iron-icons.html"> <link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-icon/iron-icon.html"> <link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../iron-selector/iron-selectable.html"> <link rel="import" href="../iron-selector/iron-selectable.html">
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
<link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.html">
<!-- <!--
Material design: [Dropdown menus](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons)
`paper-dropdown-menu` is similar to a native browser select element. `paper-dropdown-menu` is similar to a native browser select element.
`paper-dropdown-menu` works with selectable content. The currently selected `paper-dropdown-menu` works with selectable content. The currently selected
item is displayed in the control. If no item is selected, the `label` is item is displayed in the control. If no item is selected, the `label` is
@ -108,16 +112,17 @@ respectively.
} }
paper-ripple { paper-ripple {
top: 20px; top: 12px;
left: 8px; left: 0px;
bottom: 16px; bottom: 8px;
right: 8px; right: 0px;
@apply(--paper-dropdown-menu-ripple); @apply(--paper-dropdown-menu-ripple);
} }
paper-menu-button { paper-menu-button {
display: block; display: block;
padding: 0;
@apply(--paper-dropdown-menu-button); @apply(--paper-dropdown-menu-button);
} }
@ -146,6 +151,7 @@ respectively.
<div class="dropdown-trigger"> <div class="dropdown-trigger">
<paper-ripple></paper-ripple> <paper-ripple></paper-ripple>
<paper-input <paper-input
invalid="[[invalid]]"
readonly readonly
disabled="[[disabled]]" disabled="[[disabled]]"
value="[[selectedItemLabel]]" value="[[selectedItemLabel]]"
@ -181,7 +187,9 @@ respectively.
behaviors: [ behaviors: [
Polymer.IronControlState, Polymer.IronControlState,
Polymer.IronButtonState Polymer.IronButtonState,
Polymer.IronFormElementBehavior,
Polymer.IronValidatableBehavior
], ],
properties: { properties: {
@ -193,7 +201,7 @@ respectively.
selectedItemLabel: { selectedItemLabel: {
type: String, type: String,
notify: true, notify: true,
computed: '_computeSelectedItemLabel(selectedItem)' readOnly: true
}, },
/** /**
@ -209,6 +217,17 @@ respectively.
readOnly: true readOnly: true
}, },
/**
* The value for this element that will be used when submitting in
* a form. It is read only, and will always have the same value
* as `selectedItemLabel`.
*/
value: {
type: String,
notify: true,
readOnly: true
},
/** /**
* The label for the dropdown. * The label for the dropdown.
*/ */
@ -275,6 +294,10 @@ respectively.
'aria-haspopup': 'true' 'aria-haspopup': 'true'
}, },
observers: [
'_selectedItemChanged(selectedItem)'
],
attached: function() { attached: function() {
// NOTE(cdata): Due to timing, a preselected value in a `IronSelectable` // NOTE(cdata): Due to timing, a preselected value in a `IronSelectable`
// child will cause an `iron-select` event to fire while the element is // child will cause an `iron-select` event to fire while the element is
@ -342,12 +365,16 @@ respectively.
* @param {Element} selectedItem A selected Element item, with an * @param {Element} selectedItem A selected Element item, with an
* optional `label` property. * optional `label` property.
*/ */
_computeSelectedItemLabel: function(selectedItem) { _selectedItemChanged: function(selectedItem) {
var value = '';
if (!selectedItem) { if (!selectedItem) {
return ''; value = '';
} else {
value = selectedItem.label || selectedItem.textContent.trim();
} }
return selectedItem.label || selectedItem.textContent.trim(); this._setValue(value);
this._setSelectedItemLabel(value);
}, },
/** /**
@ -362,7 +389,17 @@ respectively.
// derived from the metrics of elements internal to `paper-input`'s // derived from the metrics of elements internal to `paper-input`'s
// template. The metrics will change depending on whether or not the // template. The metrics will change depending on whether or not the
// input has a floating label. // input has a floating label.
return noLabelFloat ? -4 : 16; return noLabelFloat ? -4 : 8;
},
/**
* Returns false if the element is required and does not have a selection,
* and true otherwise.
* @return {Boolean} true if `required` is false, or if `required` is true
* and the element has a valid selection.
*/
_getValidity: function() {
return this.disabled || !this.required || (this.required && this.value);
} }
}); });
})(); })();

View file

@ -133,6 +133,43 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
expect(dropdownMenu.selectedItem).to.be.equal(null); expect(dropdownMenu.selectedItem).to.be.equal(null);
}); });
}); });
suite('validation', function() {
test('a non required dropdown is valid regardless of its selection', function() {
var dropdownMenu = fixture('TrivialDropdownMenu');
menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
// no selection.
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.not.be.ok;
// some selection.
menu.selected = 1;
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.be.equal('Bar');
});
test('a required dropdown is invalid without a selection', function() {
var dropdownMenu = fixture('TrivialDropdownMenu');
dropdownMenu.required = true;
// no selection.
expect(dropdownMenu.validate()).to.be.false;
expect(dropdownMenu.invalid).to.be.true;
expect(dropdownMenu.value).to.not.be.ok;
});
test('a required dropdown is valid with a selection', function() {
var dropdownMenu = fixture('PreselectedDropdownMenu');
dropdownMenu.required = true;
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.be.equal('Bar');
});
});
}); });
</script> </script>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-fab", "name": "paper-fab",
"version": "1.0.5", "version": "1.0.6",
"description": "A material design floating action button", "description": "A material design floating action button",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -15,32 +15,32 @@
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/PolymerElements/paper-fab" "url": "git://github.com/PolymerElements/paper-fab.git"
}, },
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-fab", "homepage": "https://github.com/PolymerElements/paper-fab",
"dependencies": { "dependencies": {
"paper-ripple": "polymerelements/paper-ripple#^1.0.0", "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"paper-material": "polymerelements/paper-material#^1.0.0", "iron-icon": "PolymerElements/iron-icon#^1.0.0",
"paper-behaviors": "polymerelements/paper-behaviors#^1.0.0", "iron-icons": "PolymerElements/iron-icons#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0", "paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"iron-icon": "polymerelements/iron-icon#^1.0.0", "paper-material": "PolymerElements/paper-material#^1.0.0",
"iron-icons": "polymerelements/iron-icons#^1.0.0", "paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.5", "_release": "1.0.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.5", "tag": "v1.0.6",
"commit": "2f1cebbceeb76b5f48f2d82ea02001e0725d2d6e" "commit": "d9d70a86af8464f880d3022bedc08845c3bf2d1d"
}, },
"_source": "git://github.com/PolymerElements/paper-fab.git", "_source": "git://github.com/PolymerElements/paper-fab.git",
"_target": "~1.0.2", "_target": "~1.0.2",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-fab", "name": "paper-fab",
"version": "1.0.5", "version": "1.0.6",
"description": "A material design floating action button", "description": "A material design floating action button",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -15,24 +15,24 @@
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/PolymerElements/paper-fab" "url": "git://github.com/PolymerElements/paper-fab.git"
}, },
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-fab", "homepage": "https://github.com/PolymerElements/paper-fab",
"dependencies": { "dependencies": {
"paper-ripple": "polymerelements/paper-ripple#^1.0.0", "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"paper-material": "polymerelements/paper-material#^1.0.0", "iron-icon": "PolymerElements/iron-icon#^1.0.0",
"paper-behaviors": "polymerelements/paper-behaviors#^1.0.0", "iron-icons": "PolymerElements/iron-icons#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0", "paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"iron-icon": "polymerelements/iron-icon#^1.0.0", "paper-material": "PolymerElements/paper-material#^1.0.0",
"iron-icons": "polymerelements/iron-icons#^1.0.0", "paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
} }

View file

@ -9,13 +9,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
--> -->
<link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="../paper-styles/default-theme.html"> <link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../paper-styles/color.html"> <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
<link rel="import" href="../paper-material/paper-material.html"> <link rel="import" href="../paper-material/paper-material.html">
<link rel="import" href="../paper-ripple/paper-ripple.html"> <link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-behaviors/paper-button-behavior.html"> <link rel="import" href="../paper-styles/color.html">
<link rel="import" href="../paper-styles/default-theme.html">
<!-- <!--
Material design: [Floating Action Button](https://www.google.com/design/spec/components/buttons-floating-action-button.html) Material design: [Floating Action Button](https://www.google.com/design/spec/components/buttons-floating-action-button.html)
@ -59,7 +59,6 @@ Custom property | Description | Default
<dom-module id="paper-fab"> <dom-module id="paper-fab">
<template strip-whitespace> <template strip-whitespace>
<style include="paper-material"> <style include="paper-material">
:host { :host {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -109,9 +108,11 @@ Custom property | Description | Default
background: var(--paper-fab-keyboard-focus-background, --paper-pink-900); background: var(--paper-fab-keyboard-focus-background, --paper-pink-900);
} }
</style> </style>
<iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon>
</template> </template>
</dom-module> </dom-module>
<script> <script>
Polymer({ Polymer({
is: 'paper-fab', is: 'paper-fab',
@ -161,6 +162,5 @@ Custom property | Description | Default
reflectToAttribute: true reflectToAttribute: true
} }
} }
}); });
</script> </script>

View file

@ -1,7 +1,7 @@
{ {
"name": "paper-icon-button", "name": "paper-icon-button",
"private": true, "private": true,
"version": "1.0.4", "version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "A material design icon button", "description": "A material design icon button",
"main": "paper-icon-button.html", "main": "paper-icon-button.html",
@ -35,11 +35,11 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0" "iron-component-page": "PolymerElements/iron-component-page#^1.0.0"
}, },
"homepage": "https://github.com/PolymerElements/paper-icon-button", "homepage": "https://github.com/PolymerElements/paper-icon-button",
"_release": "1.0.4", "_release": "1.0.5",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.4", "tag": "v1.0.5",
"commit": "50cef0a41abe586110ee0ac9720cea70f0b2f5e1" "commit": "15e9bd571ef8e77da8c58fb5f447fe7cc7c0c9f1"
}, },
"_source": "git://github.com/PolymerElements/paper-icon-button.git", "_source": "git://github.com/PolymerElements/paper-icon-button.git",
"_target": "~1.0.2", "_target": "~1.0.2",

View file

@ -1,7 +1,7 @@
{ {
"name": "paper-icon-button", "name": "paper-icon-button",
"private": true, "private": true,
"version": "1.0.4", "version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "A material design icon button", "description": "A material design icon button",
"main": "paper-icon-button.html", "main": "paper-icon-button.html",

View file

@ -68,8 +68,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
paper-icon-button.huge { paper-icon-button.huge {
margin-left: 0px; margin-left: 0px;
width: 100px; width: 116px;
height: 100px; height: 116px;
--paper-icon-button-ink-color: var(--paper-indigo-500); --paper-icon-button-ink-color: var(--paper-indigo-500);
} }
</style> </style>

View file

@ -77,8 +77,13 @@ Custom property | Description | Default
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
z-index: 0; z-index: 0;
line-height: 1;
width: 24px; width: 40px;
height: 40px;
/* Because of polymer/2558, this style has lower specificity than * */
box-sizing: border-box !important;
@apply(--paper-icon-button); @apply(--paper-icon-button);
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.15", "version": "1.0.16",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -44,13 +44,13 @@
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0", "iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0" "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0"
}, },
"_release": "1.0.15", "_release": "1.0.16",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.15", "tag": "v1.0.16",
"commit": "34d19454e0ea13b1a809add8c87fba128fbc9940" "commit": "98a5b3a01ecfcdd85d9dccf6d3d708813fe1dfec"
}, },
"_source": "git://github.com/PolymerElements/paper-input.git", "_source": "git://github.com/polymerelements/paper-input.git",
"_target": "^1.0.0", "_target": "^1.0.9",
"_originalSource": "PolymerElements/paper-input" "_originalSource": "polymerelements/paper-input"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.15", "version": "1.0.16",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -45,8 +45,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
paper-icon-button { paper-icon-button {
color: var(--paper-red-300); color: var(--paper-red-300);
--paper-icon-button-ink-color: var(--paper-red-a100); --paper-icon-button-ink-color: var(--paper-red-a100);
--iron-icon-width: 15px; width: 23px; /* 15px + 2*4px for padding */
--iron-icon-height: 15px; height: 23px;
padding: 0px 4px; padding: 0px 4px;
} }
</style> </style>
@ -59,8 +59,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<div class="vertical-section"> <div class="vertical-section">
<paper-input label="label"></paper-input> <paper-input label="label"></paper-input>
<paper-input label="search" type="search" placeholder="type='search' should use placeholders instead of labels" autosave="test" results="5"></paper-input>
<paper-input label="password" type="password"></paper-input> <paper-input label="password" type="password"></paper-input>
<paper-input no-label-float label="label (no-label-float)"></paper-input> <paper-input no-label-float label="label (no-label-float)"></paper-input>

View file

@ -91,7 +91,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
/** /**
* The datalist of the input (if any). This should match the id of an existing <datalist>. Bind this * The datalist of the input (if any). This should match the id of an existing `<datalist>`. Bind this
* to the `<input is="iron-input">`'s `list` property. * to the `<input is="iron-input">`'s `list` property.
*/ */
list: { list: {
@ -293,6 +293,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
type: Number type: Number
}, },
/**
* Bind this to the `<input is="iron-input">`'s `accept` property, , used with type=file.
*/
accept: {
type: String
},
/**
* Bind this to the `<input is="iron-input">`'s `multiple` property, , used with type=file.
*/
multiple: {
type: Boolean
},
_ariaDescribedBy: { _ariaDescribedBy: {
type: String, type: String,
value: '' value: ''

View file

@ -75,15 +75,15 @@ Custom property | Description | Default
`--paper-input-container-invalid-color` | Label and underline color when the input is is invalid | `--google-red-500` `--paper-input-container-invalid-color` | Label and underline color when the input is is invalid | `--google-red-500`
`--paper-input-container-input-color` | Input foreground color | `--primary-text-color` `--paper-input-container-input-color` | Input foreground color | `--primary-text-color`
`--paper-input-container` | Mixin applied to the container | `{}` `--paper-input-container` | Mixin applied to the container | `{}`
`--paper-input-container-disabled` | Mixin applied to the container when it's disabled | `{}`
`--paper-input-container-label` | Mixin applied to the label | `{}` `--paper-input-container-label` | Mixin applied to the label | `{}`
`--paper-input-container-label-focus` | Mixin applied to the label when the input is focused | `{}` `--paper-input-container-label-focus` | Mixin applied to the label when the input is focused | `{}`
`--paper-input-container-input` | Mixin applied to the input | `{}` `--paper-input-container-input` | Mixin applied to the input | `{}`
`--paper-input-container-input-disabled` | Mixin applied to the input when it's disabled | `{}`
`--paper-input-container-prefix` | Mixin applied to the input prefix | `{}`
`--paper-input-container-suffix` | Mixin applied to the input suffix | `{}`
`--paper-input-container-underline` | Mixin applied to the underline | `{}` `--paper-input-container-underline` | Mixin applied to the underline | `{}`
`--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}` `--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}`
`--paper-input-container-underline-disabled` | Mixin applied to the underline when the input is disabled | `{}` `--paper-input-container-underline-disabled` | Mixin applied to the underline when the input is disabled | `{}`
`--paper-input-prefix` | Mixin applied to the input prefix | `{}`
`--paper-input-suffix` | Mixin applied to the input suffix | `{}`
This element is `display:block` by default, but you can set the `inline` attribute to make it This element is `display:block` by default, but you can set the `inline` attribute to make it
`display:inline-block`. `display:inline-block`.
@ -186,6 +186,7 @@ This element is `display:block` by default, but you can set the `inline` attribu
font: inherit; font: inherit;
color: var(--paper-input-container-color, --secondary-text-color); color: var(--paper-input-container-color, --secondary-text-color);
@apply(--paper-font-common-nowrap);
@apply(--paper-font-subhead); @apply(--paper-font-subhead);
@apply(--paper-input-container-label); @apply(--paper-input-container-label);
} }
@ -199,6 +200,10 @@ This element is `display:block` by default, but you can set the `inline` attribu
-webkit-transition: -webkit-transform 0.25s; -webkit-transition: -webkit-transform 0.25s;
transition: transform 0.25s; transition: transform 0.25s;
/* Since we scale to 75/100 of the size, we actually have 100/75 of the
original space now available */
width: 133%;
@apply(--paper-transition-easing); @apply(--paper-transition-easing);
} }

View file

@ -16,6 +16,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="paper-input-char-counter.html"> <link rel="import" href="paper-input-char-counter.html">
<!-- <!--
Material design: [Text fields](https://www.google.com/design/spec/components/text-fields.html)
`<paper-input>` is a single-line text field with Material Design styling. `<paper-input>` is a single-line text field with Material Design styling.
<paper-input label="Input label"></paper-input> <paper-input label="Input label"></paper-input>
@ -35,9 +37,10 @@ for `suffix`).
<paper-icon-button suffix icon="clear"></paper-icon-button> <paper-icon-button suffix icon="clear"></paper-icon-button>
</paper-input> </paper-input>
A `paper-input` can use the native `type=search` features. However, since A `paper-input` can use the native `type=search` or `type=file` features.
we can't control the native styling of the input, it's recommended to use However, since we can't control the native styling of the input, in these cases
a placeholder text, or `always-float-label`, as to not overlap the native search icon. it's recommended to use a placeholder text, or `always-float-label`,
as to not overlap the native UI (search icon, file button, etc.).
<paper-input label="search!" type="search" <paper-input label="search!" type="search"
placeholder="search for cats" autosave="test" results="5"> placeholder="search for cats" autosave="test" results="5">
@ -115,8 +118,10 @@ style this element.
autocapitalize$="[[autocapitalize]]" autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]" autocorrect$="[[autocorrect]]"
on-change="_onChange" on-change="_onChange"
autosave$="[[autosave]]", autosave$="[[autosave]]"
results$="[[results]]"> results$="[[results]]"
accept$="[[accept]]"
multiple$="[[multiple]]">
<content select="[suffix]"></content> <content select="[suffix]"></content>

View file

@ -45,6 +45,7 @@ style this element.
<iron-autogrow-textarea id="input" class="paper-input-input" <iron-autogrow-textarea id="input" class="paper-input-input"
bind-value="{{value}}" bind-value="{{value}}"
disabled$="[[disabled]]"
autocomplete$="[[autocomplete]]" autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]" autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]" inputmode$="[[inputmode]]"

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-item", "name": "paper-item",
"version": "1.0.3", "version": "1.0.5",
"description": "A material-design styled list item", "description": "A material-design styled list item",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -39,11 +39,11 @@
"web-component-tester": "Polymer/web-component-tester#^3.3.0", "web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.3", "_release": "1.0.5",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.5",
"commit": "52ca8cf95ed34f265a6208def81dae9189330ad6" "commit": "a292fb913d0e9f1e7b9bb46d2af60dc8c7a05dc3"
}, },
"_source": "git://github.com/PolymerElements/paper-item.git", "_source": "git://github.com/PolymerElements/paper-item.git",
"_target": "~1.0.2", "_target": "~1.0.2",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-item", "name": "paper-item",
"version": "1.0.3", "version": "1.0.5",
"description": "A material-design styled list item", "description": "A material-design styled list item",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -33,10 +33,16 @@ node with the attribute `item-icon` is placed in the icon area.
The following custom properties and mixins are available for styling: The following custom properties and mixins are available for styling:
Custom property | Description | Default Custom property | Description | Default
----------------|-------------|---------- ------------------------------|------------------------------------------------|----------
`--paper-item-icon-width` | Width of the icon area | `56px` `--paper-item-icon-width` | Width of the icon area | `56px`
`--paper-icon-item` | Mixin applied to the item | `{}` `--paper-icon-item` | Mixin applied to the item | `{}`
`--paper-item-selected-weight`| The font weight of a selected item | `bold`
`--paper-item-selected` | Mixin applied to selected paper-items | `{}`
`--paper-item-disabled-color` | The color for disabled paper-items | `--disabled-text-color`
`--paper-item-disabled` | Mixin applied to disabled paper-items | `{}`
`--paper-item-focused` | Mixin applied to focused paper-items | `{}`
`--paper-item-focused-before` | Mixin applied to :before focused paper-items | `{}`
--> -->

View file

@ -17,8 +17,29 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 0px 16px; padding: 0px 16px;
} }
:host > ::content > *:not(:first-child):not(:last-child) { :host(.iron-selected) {
margin-right: 16px; font-weight: var(--paper-item-selected-weight, bold);
@apply(--paper-item-selected);
}
:host([disabled]) {
color: var(--paper-item-disabled-color, --disabled-text-color);
@apply(--paper-item-disabled);
}
:host(:focus) {
position: relative;
outline: 0;
@apply(--paper-item-focused);
}
:host(:focus):before {
@apply(--layout-fit);
content: '';
background: currentColor;
opacity: var(--dark-divider-opacity);
@apply(--paper-item-focused-before);
} }
</style> </style>
</template> </template>

View file

@ -15,6 +15,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="paper-item-shared-styles.html"> <link rel="import" href="paper-item-shared-styles.html">
<!-- <!--
Material design: [Lists](https://www.google.com/design/spec/components/lists.html)
`<paper-item>` is a non-interactive list item. By default, it is a horizontal flexbox. `<paper-item>` is a non-interactive list item. By default, it is a horizontal flexbox.
<paper-item>Item</paper-item> <paper-item>Item</paper-item>
@ -34,10 +36,17 @@ items.
The following custom properties and mixins are available for styling: The following custom properties and mixins are available for styling:
Custom property | Description | Default Custom property | Description | Default
----------------|-------------|---------- ------------------------------|------------------------------------------------|----------
`--paper-item-min-height` | Minimum height of the item | `48px` `--paper-item-min-height` | Minimum height of the item | `48px`
`--paper-item` | Mixin applied to the item | `{}` `--paper-item` | Mixin applied to the item | `{}`
`--paper-item-selected-weight`| The font weight of a selected item | `bold`
`--paper-item-selected` | Mixin applied to selected paper-items | `{}`
`--paper-item-disabled-color` | The color for disabled paper-items | `--disabled-text-color`
`--paper-item-disabled` | Mixin applied to disabled paper-items | `{}`
`--paper-item-focused` | Mixin applied to focused paper-items | `{}`
`--paper-item-focused-before` | Mixin applied to :before focused paper-items | `{}`
### Accessibility ### Accessibility

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-material", "name": "paper-material",
"version": "1.0.2", "version": "1.0.3",
"description": "A material design container that looks like a lifted sheet of paper", "description": "A material design container that looks like a lifted sheet of paper",
"private": true, "private": true,
"authors": [ "authors": [
@ -24,20 +24,20 @@
"homepage": "https://github.com/PolymerElements/paper-material", "homepage": "https://github.com/PolymerElements/paper-material",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.0", "polymer": "Polymer/polymer#^1.1.0",
"polymer": "Polymer/polymer#^1.0.0" "paper-styles": "polymerelements/paper-styles#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "test-fixture": "polymerelements/test-fixture#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0"
}, },
"_release": "1.0.2", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.2", "tag": "v1.0.3",
"commit": "3f41d6dd776cf5bb35d29b44d1cce4981b791188" "commit": "2e99c0754edb817518f59313d2533ccc2e1ab82a"
}, },
"_source": "git://github.com/polymerelements/paper-material.git", "_source": "git://github.com/polymerelements/paper-material.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-material", "name": "paper-material",
"version": "1.0.2", "version": "1.0.3",
"description": "A material design container that looks like a lifted sheet of paper", "description": "A material design container that looks like a lifted sheet of paper",
"private": true, "private": true,
"authors": [ "authors": [
@ -24,13 +24,13 @@
"homepage": "https://github.com/PolymerElements/paper-material", "homepage": "https://github.com/PolymerElements/paper-material",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.0", "polymer": "Polymer/polymer#^1.1.0",
"polymer": "Polymer/polymer#^1.0.0" "paper-styles": "polymerelements/paper-styles#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "test-fixture": "polymerelements/test-fixture#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0"
} }
} }

View file

@ -12,6 +12,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../paper-styles/shadow.html"> <link rel="import" href="../paper-styles/shadow.html">
<!-- <!--
Material design: [Cards](https://www.google.com/design/spec/components/cards.html)
`paper-material` is a container that renders two shadows on top of each other to `paper-material` is a container that renders two shadows on top of each other to
create the effect of a lifted piece of paper. create the effect of a lifted piece of paper.
@ -23,42 +24,42 @@ Example:
</paper-material> </paper-material>
@group Paper Elements @group Paper Elements
@class paper-material
@demo demo/index.html @demo demo/index.html
--> -->
<dom-module id="paper-material"> <dom-module id="paper-material">
<style>
:host {
display: block;
position: relative;
}
:host([animated]) {
@apply(--shadow-transition);
}
:host([elevation="1"]) {
@apply(--shadow-elevation-2dp);
}
:host([elevation="2"]) {
@apply(--shadow-elevation-4dp);
}
:host([elevation="3"]) {
@apply(--shadow-elevation-6dp);
}
:host([elevation="4"]) {
@apply(--shadow-elevation-8dp);
}
:host([elevation="5"]) {
@apply(--shadow-elevation-16dp);
}
</style>
<template> <template>
<style>
:host {
display: block;
position: relative;
}
:host([animated]) {
@apply(--shadow-transition);
}
:host([elevation="1"]) {
@apply(--shadow-elevation-2dp);
}
:host([elevation="2"]) {
@apply(--shadow-elevation-4dp);
}
:host([elevation="3"]) {
@apply(--shadow-elevation-6dp);
}
:host([elevation="4"]) {
@apply(--shadow-elevation-8dp);
}
:host([elevation="5"]) {
@apply(--shadow-elevation-16dp);
}
</style>
<content></content> <content></content>
</template> </template>
</dom-module> </dom-module>
@ -67,7 +68,6 @@ Example:
is: 'paper-material', is: 'paper-material',
properties: { properties: {
/** /**
* The z-depth of this element, from 0-5. Setting to 0 will remove the * The z-depth of this element, from 0-5. Setting to 0 will remove the
* shadow, and each increasing number greater than 0 will be "deeper" * shadow, and each increasing number greater than 0 will be "deeper"

View file

@ -19,7 +19,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../test-fixture/test-fixture-mocha.js"></script> <script src="../../test-fixture/test-fixture-mocha.js"></script>
<link href="../../test-fixture/test-fixture.html" rel="import"> <link href="../../test-fixture/test-fixture.html" rel="import">
<link href="../../layout/layout.html" rel="import">
<link href="../paper-material.html" rel="import"> <link href="../paper-material.html" rel="import">
</head> </head>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-radio-button", "name": "paper-radio-button",
"version": "1.0.9", "version": "1.0.10",
"description": "A material design radio button", "description": "A material design radio button",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -20,24 +20,24 @@
"homepage": "https://github.com/PolymerElements/paper-radio-button", "homepage": "https://github.com/PolymerElements/paper-radio-button",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerLabs/paper-styles#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0", "iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.1.0" "polymer": "Polymer/polymer#^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.9", "_release": "1.0.10",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.9", "tag": "v1.0.10",
"commit": "708d1e611ad5a7c9600a128545a88e9991fe789e" "commit": "85b9670b23e9fac6f2d728b433d2c1d3f691a656"
}, },
"_source": "git://github.com/PolymerElements/paper-radio-button.git", "_source": "git://github.com/PolymerElements/paper-radio-button.git",
"_target": "~1.0.5", "_target": "~1.0.5",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-radio-button", "name": "paper-radio-button",
"version": "1.0.9", "version": "1.0.10",
"description": "A material design radio button", "description": "A material design radio button",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -20,17 +20,17 @@
"homepage": "https://github.com/PolymerElements/paper-radio-button", "homepage": "https://github.com/PolymerElements/paper-radio-button",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerLabs/paper-styles#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0", "iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.1.0" "polymer": "Polymer/polymer#^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
} }
} }

View file

@ -9,9 +9,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
--> -->
<link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html">
<link rel="import" href="../paper-ripple/paper-ripple.html"> <link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-styles/default-theme.html"> <link rel="import" href="../paper-styles/default-theme.html">
<link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html">
<!-- <!--
Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button) Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button)
@ -40,6 +40,7 @@ Custom property | Description | Default
`--paper-radio-button-checked-color` | Radio button color when the input is checked | `--default-primary-color` `--paper-radio-button-checked-color` | Radio button color when the input is checked | `--default-primary-color`
`--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color` `--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
`--paper-radio-button-label-color` | Label color | `--primary-text-color` `--paper-radio-button-label-color` | Label color | `--primary-text-color`
`--paper-radio-button-label-spacing` | Spacing between the label and the button | `10px`
@group Paper Elements @group Paper Elements
@element paper-radio-button @element paper-radio-button
@ -68,7 +69,7 @@ Custom property | Description | Default
vertical-align: middle; vertical-align: middle;
} }
:host #ink { #ink {
position: absolute; position: absolute;
top: -16px; top: -16px;
left: -16px; left: -16px;
@ -79,15 +80,21 @@ Custom property | Description | Default
pointer-events: none; pointer-events: none;
} }
:host #ink[checked] { :host-context([dir="rtl"]) #ink {
right: -15px;
left: auto;
}
#ink[checked] {
color: var(--paper-radio-button-checked-ink-color, --default-primary-color); color: var(--paper-radio-button-checked-ink-color, --default-primary-color);
} }
:host #offRadio { #offRadio {
position: absolute; position: absolute;
box-sizing: content-box; box-sizing: content-box;
top: 0px; top: 0px;
left: 0px; left: 0px;
right: 0px;
width: 12px; width: 12px;
height: 12px; height: 12px;
border-radius: 50%; border-radius: 50%;
@ -97,11 +104,12 @@ Custom property | Description | Default
transition: border-color 0.28s; transition: border-color 0.28s;
} }
:host #onRadio { #onRadio {
position: absolute; position: absolute;
box-sizing: content-box; box-sizing: content-box;
top: 4px; top: 4px;
left: 4px; left: 4px;
right: 4px;
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
@ -125,12 +133,17 @@ Custom property | Description | Default
position: relative; position: relative;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-left: 10px; margin-left: var(--paper-radio-button-label-spacing, 10px);
white-space: normal; white-space: normal;
pointer-events: none; pointer-events: none;
color: var(--paper-radio-button-label-color, --primary-text-color); color: var(--paper-radio-button-label-color, --primary-text-color);
} }
:host-context([dir="rtl"]) #radioLabel {
margin-left: 0px;
margin-right: var(--paper-radio-button-label-spacing, 10px);
}
#radioLabel[hidden] { #radioLabel[hidden] {
display: none; display: none;
} }
@ -162,7 +175,6 @@ Custom property | Description | Default
</div> </div>
<div id="radioLabel"><content></content></div> <div id="radioLabel"><content></content></div>
</template> </template>
<script> <script>
@ -205,5 +217,4 @@ Custom property | Description | Default
} }
}) })
</script> </script>
</dom-module> </dom-module>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-radio-group", "name": "paper-radio-group",
"version": "1.0.5", "version": "1.0.6",
"description": "A group of material design radio buttons", "description": "A group of material design radio buttons",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -14,30 +14,30 @@
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/PolymerElements/paper-radio-group" "url": "git://github.com/PolymerElements/paper-radio-group.git"
}, },
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-radio-group", "homepage": "https://github.com/PolymerElements/paper-radio-group",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0", "iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "*",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0", "paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.5", "_release": "1.0.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.5", "tag": "v1.0.6",
"commit": "cab4056c58d273f0953c70cc070001c97c9950b3" "commit": "e52738e71ebb7ec5470de109f4aa7b419f6f72e5"
}, },
"_source": "git://github.com/PolymerElements/paper-radio-group.git", "_source": "git://github.com/PolymerElements/paper-radio-group.git",
"_target": "~1.0.4", "_target": "~1.0.4",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-radio-group", "name": "paper-radio-group",
"version": "1.0.5", "version": "1.0.6",
"description": "A group of material design radio buttons", "description": "A group of material design radio buttons",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -14,23 +14,23 @@
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/PolymerElements/paper-radio-group" "url": "git://github.com/PolymerElements/paper-radio-group.git"
}, },
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-radio-group", "homepage": "https://github.com/PolymerElements/paper-radio-group",
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0", "iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "*",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0", "paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
} }
} }

View file

@ -9,9 +9,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
--> -->
<link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="../iron-selector/iron-selectable.html"> <link rel="import" href="../iron-selector/iron-selectable.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html"> <link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<!-- <!--
Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button) Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button)

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-styles", "name": "paper-styles",
"version": "1.0.11", "version": "1.0.12",
"description": "Common (global) styles for Material Design elements.", "description": "Common (global) styles for Material Design elements.",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -26,13 +26,14 @@
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0"
}, },
"_release": "1.0.11", "_release": "1.0.12",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.11", "tag": "v1.0.12",
"commit": "347542e9ebe3e6e5f0830ee10e1c20c12956ff2c" "commit": "8ac5128a38249982982b3a1b3533d417d2dd7f18"
}, },
"_source": "git://github.com/PolymerElements/paper-styles.git", "_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-styles", "name": "paper-styles",
"version": "1.0.11", "version": "1.0.12",
"description": "Common (global) styles for Material Design elements.", "description": "Common (global) styles for Material Design elements.",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -26,6 +26,7 @@
"polymer": "Polymer/polymer#^1.0.0" "polymer": "Polymer/polymer#^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0"
} }
} }

View file

@ -22,271 +22,246 @@
<link rel="import" href="../paper-styles.html"> <link rel="import" href="../paper-styles.html">
<link rel="import" href="../demo-pages.html"> <link rel="import" href="../demo-pages.html">
<style>
.redlines {
background: linear-gradient(0deg, transparent, transparent 3.5px, rgba(255,0,0,0.2) 3.5px, rgba(255,0,0,0.2) 4px);
background-size: 100% 4px;
}
.paragraph {
margin-bottom: 20px;
}
</style>
</head> </head>
<style>
.redlines {
background: linear-gradient(0deg, transparent, transparent 3.5px, rgba(255,0,0,0.2) 3.5px, rgba(255,0,0,0.2) 4px);
background-size: 100% 4px;
}
.paragraph {
margin-bottom: 20px;
}
</style>
<style is="custom-style">
.paper-font-display4 {
@apply(--paper-font-display4);
}
.paper-font-display3 {
@apply(--paper-font-display3);
}
.paper-font-display2 {
@apply(--paper-font-display2);
}
.paper-font-display1 {
@apply(--paper-font-display1);
}
.paper-font-headline {
@apply(--paper-font-headline);
}
.paper-font-title {
@apply(--paper-font-title);
}
.paper-font-subhead {
@apply(--paper-font-subhead);
}
.paper-font-body2 {
@apply(--paper-font-body2);
}
.paper-font-body1 {
@apply(--paper-font-body1);
}
.paper-font-caption {
@apply(--paper-font-caption);
}
.paper-font-menu {
@apply(--paper-font-menu);
}
.paper-font-button {
@apply(--paper-font-button);
}
.mobile-app {
max-width: 320px;
}
.toolbar {
height: 144px;
padding: 16px;
background: var(--default-primary-color);
color: var(--text-primary-color);
@apply(--paper-font-display1);
}
.item, .disabled-item {
position: relative;
padding: 8px;
border: 1px solid;
border-color: var(--divider-color);
border-top: 0;
}
.item .primary {
color: var(--primary-text-color);
@apply(--paper-font-body2);
}
.item .secondary {
color: var(--secondary-text-color);
@apply(--paper-font-body1);
}
.disabled-item {
color: var(--disabled-text-color);
@apply(--paper-font-body2);
}
.fab {
position: absolute;
box-sizing: border-box;
padding: 8px;
width: 56px;
height: 56px;
right: 16px;
top: -28px;
border-radius: 50%;
text-align: center;
background: var(--accent-color);
color: var(--text-primary-color);
@apply(--paper-font-display1);
}
.shadow {
display: inline-block;
padding: 8px;
margin: 16px;
height: 50px;
width: 50px;
}
.shadow-2dp {
@apply(--shadow-elevation-2dp);
}
.shadow-3dp {
@apply(--shadow-elevation-3dp);
}
.shadow-4dp {
@apply(--shadow-elevation-4dp);
}
.shadow-6dp {
@apply(--shadow-elevation-6dp);
}
.shadow-8dp {
@apply(--shadow-elevation-8dp);
}
.shadow-16dp {
@apply(--shadow-elevation-16dp);
}
</style>
<body unresolved> <body unresolved>
<h1>paper-styles</h1>
<!-- FIXME remove when https://github.com/Polymer/polymer/issues/1415 is resolved --> <section id="default-theme">
<dom-module id="x-demo"> <h2>default-theme.html</h2>
<style> <section class="mobile-app">
<div class="toolbar">
Title
</div>
<div class="item">
<div class="fab">+</div>
<div class="primary">Primary text</div>
<div class="secondary">Secondary text</div>
</div>
<div class="disabled-item">
Disabled
</div>
</section>
</section>
.paper-font-display4 { <section id="typography">
@apply(--paper-font-display4); <h2>typography.html</h2>
} <p>
Grumpy wizards make toxic brew for the evil Queen and Jack.
</p>
<section class="redlines paragraph">
<div class="paper-font-display4">Display 4</div>
<div class="paper-font-display3">Display 3</div>
<div class="paper-font-display2">Display 2</div>
<div class="paper-font-display1">Display 1</div>
<div class="paper-font-headline">Headline</div>
<div class="paper-font-title">Title</div>
<div class="paper-font-subhead">Subhead</div>
<div class="paper-font-body2">Body 2</div>
<div class="paper-font-body1">Body 1</div>
<div class="paper-font-caption">Caption</div>
<div class="paper-font-menu">Menu</div>
<div class="paper-font-button">Button</div>
</section>
.paper-font-display3 { <h3>Paragraphs</h3>
@apply(--paper-font-display3);
}
.paper-font-display2 { <h4>body2</h4>
@apply(--paper-font-display2); <section class="paper-font-body2 redlines">
} <p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis
purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis
dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id
egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet,
faucibus in leo.
</p>
<p>
Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus
interdum neque magna, eget dapibus est auctor et. Donec accumsan
libero nec augue scelerisque, ac egestas ante tincidunt. Proin
sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a
sollicitudin tellus quam non sapien.
</p>
</section>
.paper-font-display1 { <h4>body1</h4>
@apply(--paper-font-display1); <section class="paper-font-body1 redlines">
} <p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis
purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis
dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id
egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet,
faucibus in leo.
</p>
<p>
Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus
interdum neque magna, eget dapibus est auctor et. Donec accumsan
libero nec augue scelerisque, ac egestas ante tincidunt. Proin
sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a
sollicitudin tellus quam non sapien.
</p>
</section>
</section>
.paper-font-headline { <section id="shadow">
@apply(--paper-font-headline); <h2>shadow.html</h2>
} <div class="shadow shadow-2dp">2dp</div>
<div class="shadow shadow-3dp">3dp</div>
.paper-font-title { <div class="shadow shadow-4dp">4dp</div>
@apply(--paper-font-title); <div class="shadow shadow-6dp">6dp</div>
} <div class="shadow shadow-8dp">8dp</div>
<div class="shadow shadow-16dp">16dp</div>
.paper-font-subhead { </section>
@apply(--paper-font-subhead);
}
.paper-font-body2 {
@apply(--paper-font-body1);
}
.paper-font-body1 {
@apply(--paper-font-body1);
}
.paper-font-caption {
@apply(--paper-font-caption);
}
.paper-font-menu {
@apply(--paper-font-menu);
}
.paper-font-button {
@apply(--paper-font-button);
}
.mobile-app {
max-width: 320px;
}
.toolbar {
height: 144px;
padding: 16px;
background: var(--default-primary-color);
color: var(--text-primary-color);
@apply(--paper-font-display1);
}
.item, .disabled-item {
position: relative;
padding: 8px;
border: 1px solid;
border-color: var(--divider-color);
border-top: 0;
}
.item .primary {
color: var(--primary-text-color);
@apply(--paper-font-body2);
}
.item .secondary {
color: var(--secondary-text-color);
@apply(--paper-font-body1);
}
.disabled-item {
color: var(--disabled-text-color);
@apply(--paper-font-body2);
}
.fab {
position: absolute;
box-sizing: border-box;
padding: 8px;
width: 56px;
height: 56px;
right: 16px;
top: -28px;
border-radius: 50%;
text-align: center;
background: var(--accent-color);
color: var(--text-primary-color);
@apply(--paper-font-display1);
}
.shadow {
display: inline-block;
padding: 8px;
margin: 16px;
height: 50px;
width: 50px;
}
.shadow-2dp {
@apply(--shadow-elevation-2dp);
}
.shadow-3dp {
@apply(--shadow-elevation-3dp);
}
.shadow-4dp {
@apply(--shadow-elevation-4dp);
}
.shadow-6dp {
@apply(--shadow-elevation-6dp);
}
.shadow-8dp {
@apply(--shadow-elevation-8dp);
}
.shadow-16dp {
@apply(--shadow-elevation-16dp);
}
</style>
<template>
<h1>paper-styles</h1>
<section id="default-theme">
<h2>default-theme.html</h2>
<section class="mobile-app">
<div class="toolbar">
Title
</div>
<div class="item">
<div class="fab">+</div>
<div class="primary">Primary text</div>
<div class="secondary">Secondary text</div>
</div>
<div class="disabled-item">
Disabled
</div>
</section>
</section>
<section id="typography">
<h2>typography.html</h2>
<p>
Grumpy wizards make toxic brew for the evil Queen and Jack.
</p>
<section class="redlines paragraph">
<div class="paper-font-display4">Display 4</div>
<div class="paper-font-display3">Display 3</div>
<div class="paper-font-display2">Display 2</div>
<div class="paper-font-display1">Display 1</div>
<div class="paper-font-headline">Headline</div>
<div class="paper-font-title">Title</div>
<div class="paper-font-subhead">Subhead</div>
<div class="paper-font-body2">Body 2</div>
<div class="paper-font-body1">Body 1</div>
<div class="paper-font-caption">Caption</div>
<div class="paper-font-menu">Menu</div>
<div class="paper-font-button">Button</div>
</section>
<h3>Paragraphs</h3>
<h4>body2</h4>
<section class="paper-font-body2 redlines">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis
purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis
dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id
egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet,
faucibus in leo.
</p>
<p>
Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus
interdum neque magna, eget dapibus est auctor et. Donec accumsan
libero nec augue scelerisque, ac egestas ante tincidunt. Proin
sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a
sollicitudin tellus quam non sapien.
</p>
</section>
<h4>body1</h4>
<section class="paper-font-body1 redlines">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis
purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis
dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id
egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet,
faucibus in leo.
</p>
<p>
Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus
interdum neque magna, eget dapibus est auctor et. Donec accumsan
libero nec augue scelerisque, ac egestas ante tincidunt. Proin
sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a
sollicitudin tellus quam non sapien.
</p>
</section>
</section>
<section id="shadow">
<h2>shadow.html</h2>
<div class="shadow shadow-2dp">2dp</div>
<div class="shadow shadow-3dp">3dp</div>
<div class="shadow shadow-4dp">4dp</div>
<div class="shadow shadow-6dp">6dp</div>
<div class="shadow shadow-8dp">8dp</div>
<div class="shadow shadow-16dp">16dp</div>
</section>
</template>
</dom-module>
<script>
document.addEventListener('HTMLImportsLoaded', function() {
Polymer({
is: 'x-demo',
enableCustomStyleProperties: true
});
});
</script>
<x-demo></x-demo>
<section id="demo-page"> <section id="demo-page">
<h2>demo-pages.html</h2> <h2>demo-pages.html</h2>
@ -351,7 +326,6 @@
<div>Calcium</div> <div>Calcium</div>
</div> </div>
</div> </div>
</section> </section>
</body> </body>

View file

@ -0,0 +1,24 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 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
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
-->
<html>
<head>
<title>paper-styles</title>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View file

@ -11,6 +11,30 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html">
<!--
The `<paper-styles>` component provides simple ways to use Material Design CSS styles
in your application. The following imports are available:
1. [color.html](https://github.com/PolymerElements/paper-styles/blob/master/color.html):
a complete list of the colors defined in the Material Design [palette](https://www.google.com/design/spec/style/color.html)
2. [default-theme.html](https://github.com/PolymerElements/paper-styles/blob/master/default-theme.html): text,
background and accent colors that match the default Material Design theme
3. [shadow.html](https://github.com/PolymerElements/paper-styles/blob/master/shadow.html): Material Design
[elevation](https://www.google.com/design/spec/what-is-material/elevation-shadows.html) and shadow styles
4. [typography.html](https://github.com/PolymerElements/paper-styles/blob/master/typography.html):
Material Design [font](http://www.google.com/design/spec/style/typography.html#typography-styles) styles and sizes
5. [demo-pages.html](https://github.com/PolymerElements/paper-styles/blob/master/demo-pages.html): generic styles
used in the PolymerElements demo pages
@group Iron Elements
@pseudoElement paper-styles
@demo demo/index.html
-->
<link rel="import" href="color.html"> <link rel="import" href="color.html">
<link rel="import" href="default-theme.html"> <link rel="import" href="default-theme.html">
<link rel="import" href="shadow.html"> <link rel="import" href="shadow.html">

View file

@ -47,8 +47,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */ /* @apply(--paper-font-common-nowrap); */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -64,8 +63,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */ /* @apply(--paper-font-common-nowrap); */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -81,8 +79,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 45px; font-size: 45px;
font-weight: 400; font-weight: 400;
@ -94,8 +91,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 34px; font-size: 34px;
font-weight: 400; font-weight: 400;
@ -107,8 +103,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 24px; font-size: 24px;
font-weight: 400; font-weight: 400;
@ -120,8 +115,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */ /* @apply(--paper-font-common-nowrap); */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -136,8 +130,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
@ -183,8 +176,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */ /* @apply(--paper-font-common-nowrap); */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -199,8 +191,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* @apply(--paper-font-common-base) */ /* @apply(--paper-font-common-base) */
font-family: 'Roboto', 'Noto', sans-serif; font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */ /* @apply(--paper-font-common-nowrap); */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View file

@ -1,6 +1,6 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.1.5", "version": "1.2.0",
"main": [ "main": [
"polymer.html" "polymer.html"
], ],
@ -25,11 +25,11 @@
}, },
"private": true, "private": true,
"homepage": "https://github.com/Polymer/polymer", "homepage": "https://github.com/Polymer/polymer",
"_release": "1.1.5", "_release": "1.2.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.5", "tag": "v1.2.0",
"commit": "4c94736fac6681e84ec8c00da53484c5d3c2226b" "commit": "84d211624cffd04d6894ec90713c2029732e8bb5"
}, },
"_source": "git://github.com/Polymer/polymer.git", "_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.1.5", "version": "1.2.0",
"main": [ "main": [
"polymer.html" "polymer.html"
], ],

View file

@ -264,7 +264,7 @@ document.registerElement('dom-module', DomModule);
function forceDocumentUpgrade() { function forceDocumentUpgrade() {
if (cePolyfill) { if (cePolyfill) {
var script = document._currentScript || document.currentScript; var script = document._currentScript || document.currentScript;
var doc = script && script.ownerDocument; var doc = script && script.ownerDocument || document;
if (doc) { if (doc) {
CustomElements.upgradeAll(doc); CustomElements.upgradeAll(doc);
} }
@ -576,7 +576,7 @@ debouncer.stop();
} }
} }
}); });
Polymer.version = '1.1.5'; Polymer.version = '1.2.0';
Polymer.Base._addFeature({ Polymer.Base._addFeature({
_registerFeatures: function () { _registerFeatures: function () {
this._prepIs(); this._prepIs();

View file

@ -270,61 +270,6 @@ return currentValue === previousValue;
}; };
return new ArraySplice(); return new ArraySplice();
}(); }();
Polymer.EventApi = function () {
var Settings = Polymer.Settings;
var EventApi = function (event) {
this.event = event;
};
if (Settings.useShadow) {
EventApi.prototype = {
get rootTarget() {
return this.event.path[0];
},
get localTarget() {
return this.event.target;
},
get path() {
return this.event.path;
}
};
} else {
EventApi.prototype = {
get rootTarget() {
return this.event.target;
},
get localTarget() {
var current = this.event.currentTarget;
var currentRoot = current && Polymer.dom(current).getOwnerRoot();
var p$ = this.path;
for (var i = 0; i < p$.length; i++) {
if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
return p$[i];
}
}
},
get path() {
if (!this.event._path) {
var path = [];
var o = this.rootTarget;
while (o) {
path.push(o);
o = Polymer.dom(o).parentNode || o.host;
}
path.push(window);
this.event._path = path;
}
return this.event._path;
}
};
}
var factory = function (event) {
if (!event.__eventApi) {
event.__eventApi = new EventApi(event);
}
return event.__eventApi;
};
return { factory: factory };
}();
Polymer.domInnerHTML = function () { Polymer.domInnerHTML = function () {
var escapeAttrRegExp = /[&\u00A0"]/g; var escapeAttrRegExp = /[&\u00A0"]/g;
var escapeDataRegExp = /[&\u00A0<>]/g; var escapeDataRegExp = /[&\u00A0<>]/g;
@ -463,7 +408,7 @@ insertBefore: function (node, ref_node) {
return this._addNode(node, ref_node); return this._addNode(node, ref_node);
}, },
_addNode: function (node, ref_node) { _addNode: function (node, ref_node) {
this._removeNodeFromHost(node, true); this._removeNodeFromParent(node);
var addedInsertionPoint; var addedInsertionPoint;
var root = this.getOwnerRoot(); var root = this.getOwnerRoot();
if (root) { if (root) {
@ -495,6 +440,7 @@ nativeAppendChild.call(container, node);
if (addedInsertionPoint) { if (addedInsertionPoint) {
this._updateInsertionPoints(root.host); this._updateInsertionPoints(root.host);
} }
this.notifyObserver();
return node; return node;
}, },
removeChild: function (node) { removeChild: function (node) {
@ -509,6 +455,7 @@ removeFromComposedParent(container, node);
nativeRemoveChild.call(container, node); nativeRemoveChild.call(container, node);
} }
} }
this.notifyObserver();
return node; return node;
}, },
replaceChild: function (node, ref_node) { replaceChild: function (node, ref_node) {
@ -601,6 +548,13 @@ return Boolean(node._lightChildren !== undefined);
_parentNeedsDistribution: function (parent) { _parentNeedsDistribution: function (parent) {
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot); return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
}, },
_removeNodeFromParent: function (node) {
var parent = node._lightParent || node.parentNode;
if (parent && hasDomApi(parent)) {
factory(parent).notifyObserver();
}
this._removeNodeFromHost(node, true);
},
_removeNodeFromHost: function (node, ensureComposedRemoval) { _removeNodeFromHost: function (node, ensureComposedRemoval) {
var hostNeedsDist; var hostNeedsDist;
var root; var root;
@ -612,7 +566,7 @@ if (root) {
root.host._elementRemove(node); root.host._elementRemove(node);
hostNeedsDist = this._removeDistributedChildren(root, node); hostNeedsDist = this._removeDistributedChildren(root, node);
} }
this._removeLogicalInfo(node, node._lightParent); this._removeLogicalInfo(node, parent);
} }
this._removeOwnerShadyRoot(node); this._removeOwnerShadyRoot(node);
if (root && hostNeedsDist) { if (root && hostNeedsDist) {
@ -731,24 +685,29 @@ getDistributedNodes: function () {
return this.node._distributedNodes || []; return this.node._distributedNodes || [];
}, },
queryDistributedElements: function (selector) { queryDistributedElements: function (selector) {
var c$ = this.childNodes; var c$ = this.getEffectiveChildNodes();
var list = []; var list = [];
this._distributedFilter(selector, c$, list);
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) { for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
if (c.localName === CONTENT) { if (c.nodeType === Node.ELEMENT_NODE && matchesSelector.call(c, selector)) {
this._distributedFilter(selector, factory(c).getDistributedNodes(), list); list.push(c);
} }
} }
return list; return list;
}, },
_distributedFilter: function (selector, list, results) { getEffectiveChildNodes: function () {
results = results || []; var list = [];
for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) { var c$ = this.childNodes;
if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) { for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
results.push(d); if (c.localName === CONTENT) {
var d$ = factory(c).getDistributedNodes();
for (var j = 0; j < d$.length; j++) {
list.push(d$[j]);
}
} else {
list.push(c);
} }
} }
return results; return list;
}, },
_clear: function () { _clear: function () {
while (this.childNodes.length) { while (this.childNodes.length) {
@ -792,36 +751,24 @@ d.appendChild(nc);
} }
} }
return n; return n;
},
observeNodes: function (callback) {
if (callback) {
if (!this.observer) {
this.observer = this.node.localName === CONTENT ? new DomApi.DistributedNodesObserver(this) : new DomApi.EffectiveNodesObserver(this);
} }
}; return this.observer.addListener(callback);
Object.defineProperty(DomApi.prototype, 'classList', {
get: function () {
if (!this._classList) {
this._classList = new DomApi.ClassList(this);
} }
return this._classList;
}, },
configurable: true unobserveNodes: function (handle) {
}); if (this.observer) {
DomApi.ClassList = function (host) { this.observer.removeListener(handle);
this.domApi = host; }
this.node = host.node;
};
DomApi.ClassList.prototype = {
add: function () {
this.node.classList.add.apply(this.node.classList, arguments);
this.domApi._distributeParent();
}, },
remove: function () { notifyObserver: function () {
this.node.classList.remove.apply(this.node.classList, arguments); if (this.observer) {
this.domApi._distributeParent(); this.observer.notify();
}, }
toggle: function () {
this.node.classList.toggle.apply(this.node.classList, arguments);
this.domApi._distributeParent();
},
contains: function () {
return this.node.classList.contains.apply(this.node.classList, arguments);
} }
}; };
if (!Settings.useShadow) { if (!Settings.useShadow) {
@ -1003,6 +950,17 @@ return n$ ? Array.prototype.slice.call(n$) : [];
}; };
DomApi.prototype._distributeParent = function () { DomApi.prototype._distributeParent = function () {
}; };
var nativeForwards = [
'appendChild',
'insertBefore',
'removeChild',
'replaceChild'
];
nativeForwards.forEach(function (forward) {
DomApi.prototype[forward] = function () {
return this.node[forward].apply(this.node, arguments);
};
});
Object.defineProperties(DomApi.prototype, { Object.defineProperties(DomApi.prototype, {
childNodes: { childNodes: {
get: function () { get: function () {
@ -1056,13 +1014,17 @@ configurable: true
}); });
} }
var CONTENT = 'content'; var CONTENT = 'content';
var factory = function (node, patch) { function factory(node, patch) {
node = node || document; node = node || document;
if (!node.__domApi) { if (!node.__domApi) {
node.__domApi = new DomApi(node, patch); node.__domApi = new DomApi(node, patch);
} }
return node.__domApi; return node.__domApi;
}; }
;
function hasDomApi(node) {
return Boolean(node.__domApi);
}
Polymer.dom = function (obj, patch) { Polymer.dom = function (obj, patch) {
if (obj instanceof Event) { if (obj instanceof Event) {
return Polymer.EventApi.factory(obj); return Polymer.EventApi.factory(obj);
@ -1070,43 +1032,6 @@ return Polymer.EventApi.factory(obj);
return factory(obj, patch); return factory(obj, patch);
} }
}; };
Polymer.Base.extend(Polymer.dom, {
_flushGuard: 0,
_FLUSH_MAX: 100,
_needsTakeRecords: !Polymer.Settings.useNativeCustomElements,
_debouncers: [],
_finishDebouncer: null,
flush: function () {
for (var i = 0; i < this._debouncers.length; i++) {
this._debouncers[i].complete();
}
if (this._finishDebouncer) {
this._finishDebouncer.complete();
}
this._flushPolyfills();
if (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) {
this._flushGuard++;
this.flush();
} else {
if (this._flushGuard >= this._FLUSH_MAX) {
console.warn('Polymer.dom.flush aborted. Flush may not be complete.');
}
this._flushGuard = 0;
}
},
_flushPolyfills: function () {
if (this._needsTakeRecords) {
CustomElements.takeRecords();
}
},
addDebouncer: function (debouncer) {
this._debouncers.push(debouncer);
this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush);
},
_finishFlush: function () {
Polymer.dom._debouncers = [];
}
});
function getLightChildren(node) { function getLightChildren(node) {
var children = node._lightChildren; var children = node._lightChildren;
return children ? children : node.childNodes; return children ? children : node.childNodes;
@ -1170,10 +1095,399 @@ saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
matchesSelector: matchesSelector, matchesSelector: matchesSelector,
hasInsertionPoint: hasInsertionPoint, hasInsertionPoint: hasInsertionPoint,
ctor: DomApi, ctor: DomApi,
factory: factory factory: factory,
hasDomApi: hasDomApi
}; };
}(); }();
Polymer.Base.extend(Polymer.dom, {
_flushGuard: 0,
_FLUSH_MAX: 100,
_needsTakeRecords: !Polymer.Settings.useNativeCustomElements,
_debouncers: [],
_staticFlushList: [],
_finishDebouncer: null,
flush: function () {
this._flushGuard = 0;
this._prepareFlush();
while (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) {
for (var i = 0; i < this._debouncers.length; i++) {
this._debouncers[i].complete();
}
if (this._finishDebouncer) {
this._finishDebouncer.complete();
}
this._prepareFlush();
this._flushGuard++;
}
if (this._flushGuard >= this._FLUSH_MAX) {
console.warn('Polymer.dom.flush aborted. Flush may not be complete.');
}
},
_prepareFlush: function () {
if (this._needsTakeRecords) {
CustomElements.takeRecords();
}
for (var i = 0; i < this._staticFlushList.length; i++) {
this._staticFlushList[i]();
}
},
addStaticFlush: function (fn) {
this._staticFlushList.push(fn);
},
removeStaticFlush: function (fn) {
var i = this._staticFlushList.indexOf(fn);
if (i >= 0) {
this._staticFlushList.splice(i, 1);
}
},
addDebouncer: function (debouncer) {
this._debouncers.push(debouncer);
this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush);
},
_finishFlush: function () {
Polymer.dom._debouncers = [];
}
});
Polymer.EventApi = function () {
'use strict';
var DomApi = Polymer.DomApi.ctor;
var Settings = Polymer.Settings;
DomApi.Event = function (event) {
this.event = event;
};
if (Settings.useShadow) {
DomApi.Event.prototype = {
get rootTarget() {
return this.event.path[0];
},
get localTarget() {
return this.event.target;
},
get path() {
return this.event.path;
}
};
} else {
DomApi.Event.prototype = {
get rootTarget() {
return this.event.target;
},
get localTarget() {
var current = this.event.currentTarget;
var currentRoot = current && Polymer.dom(current).getOwnerRoot();
var p$ = this.path;
for (var i = 0; i < p$.length; i++) {
if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
return p$[i];
}
}
},
get path() {
if (!this.event._path) {
var path = [];
var o = this.rootTarget;
while (o) {
path.push(o);
o = Polymer.dom(o).parentNode || o.host;
}
path.push(window);
this.event._path = path;
}
return this.event._path;
}
};
}
var factory = function (event) {
if (!event.__eventApi) {
event.__eventApi = new DomApi.Event(event);
}
return event.__eventApi;
};
return { factory: factory };
}();
(function () { (function () {
'use strict';
var DomApi = Polymer.DomApi.ctor;
Object.defineProperty(DomApi.prototype, 'classList', {
get: function () {
if (!this._classList) {
this._classList = new DomApi.ClassList(this);
}
return this._classList;
},
configurable: true
});
DomApi.ClassList = function (host) {
this.domApi = host;
this.node = host.node;
};
DomApi.ClassList.prototype = {
add: function () {
this.node.classList.add.apply(this.node.classList, arguments);
this.domApi._distributeParent();
},
remove: function () {
this.node.classList.remove.apply(this.node.classList, arguments);
this.domApi._distributeParent();
},
toggle: function () {
this.node.classList.toggle.apply(this.node.classList, arguments);
this.domApi._distributeParent();
},
contains: function () {
return this.node.classList.contains.apply(this.node.classList, arguments);
}
};
}());
(function () {
'use strict';
var DomApi = Polymer.DomApi.ctor;
var Settings = Polymer.Settings;
var hasDomApi = Polymer.DomApi.hasDomApi;
DomApi.EffectiveNodesObserver = function (domApi) {
this.domApi = domApi;
this.node = this.domApi.node;
this._listeners = [];
};
DomApi.EffectiveNodesObserver.prototype = {
addListener: function (callback) {
if (!this._isSetup) {
this._setup();
this._isSetup = true;
}
var listener = {
fn: callback,
_nodes: []
};
this._listeners.push(listener);
this._scheduleNotify();
return listener;
},
removeListener: function (handle) {
var i = this._listeners.indexOf(handle);
if (i >= 0) {
this._listeners.splice(i, 1);
handle._nodes = [];
}
if (!this._hasListeners()) {
this._cleanup();
this._isSetup = false;
}
},
_setup: function () {
this._observeContentElements(this.domApi.childNodes);
},
_cleanup: function () {
this._unobserveContentElements(this.domApi.childNodes);
},
_hasListeners: function () {
return Boolean(this._listeners.length);
},
_scheduleNotify: function () {
if (this._debouncer) {
this._debouncer.stop();
}
this._debouncer = Polymer.Debounce(this._debouncer, this._notify);
this._debouncer.context = this;
Polymer.dom.addDebouncer(this._debouncer);
},
notify: function () {
if (this._hasListeners()) {
this._scheduleNotify();
}
},
_notify: function (mxns) {
this._beforeCallListeners();
this._callListeners();
},
_beforeCallListeners: function () {
this._updateContentElements();
},
_updateContentElements: function () {
this._observeContentElements(this.domApi.childNodes);
},
_observeContentElements: function (elements) {
for (var i = 0, n; i < elements.length && (n = elements[i]); i++) {
if (this._isContent(n)) {
n.__observeNodesMap = n.__observeNodesMap || new WeakMap();
if (!n.__observeNodesMap.has(this)) {
n.__observeNodesMap.set(this, this._observeContent(n));
}
}
}
},
_observeContent: function (content) {
var h = Polymer.dom(content).observeNodes(this._scheduleNotify.bind(this));
h._avoidChangeCalculation = true;
return h;
},
_unobserveContentElements: function (elements) {
for (var i = 0, n, h; i < elements.length && (n = elements[i]); i++) {
if (this._isContent(n)) {
h = n.__observeNodesMap.get(this);
if (h) {
Polymer.dom(n).unobserveNodes(h);
n.__observeNodesMap.delete(this);
}
}
}
},
_isContent: function (node) {
return node.localName === 'content';
},
_callListeners: function () {
var o$ = this._listeners;
var nodes = this._getEffectiveNodes();
for (var i = 0, o; i < o$.length && (o = o$[i]); i++) {
var info = this._generateListenerInfo(o, nodes);
if (info || o._alwaysNotify) {
this._callListener(o, info);
}
}
},
_getEffectiveNodes: function () {
return this.domApi.getEffectiveChildNodes();
},
_generateListenerInfo: function (listener, newNodes) {
if (listener._avoidChangeCalculation) {
return true;
}
var oldNodes = listener._nodes;
var info = {
target: this.node,
addedNodes: [],
removedNodes: []
};
var splices = Polymer.ArraySplice.calculateSplices(newNodes, oldNodes);
for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
info.removedNodes.push(n);
}
}
for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
for (var j = s.index; j < s.index + s.addedCount; j++) {
info.addedNodes.push(newNodes[j]);
}
}
listener._nodes = newNodes;
if (info.addedNodes.length || info.removedNodes.length) {
return info;
}
},
_callListener: function (listener, info) {
return listener.fn.call(this.node, info);
},
enableShadowAttributeTracking: function () {
}
};
if (Settings.useShadow) {
var baseSetup = DomApi.EffectiveNodesObserver.prototype._setup;
var baseCleanup = DomApi.EffectiveNodesObserver.prototype._cleanup;
var beforeCallListeners = DomApi.EffectiveNodesObserver.prototype._beforeCallListeners;
Polymer.Base.extend(DomApi.EffectiveNodesObserver.prototype, {
_setup: function () {
if (!this._observer) {
var self = this;
this._mutationHandler = function (mxns) {
if (mxns && mxns.length) {
self._scheduleNotify();
}
};
this._observer = new MutationObserver(this._mutationHandler);
this._boundFlush = this._flush.bind(this);
Polymer.dom.addStaticFlush(this._boundFlush);
this._observer.observe(this.node, { childList: true });
}
baseSetup.call(this);
},
_cleanup: function () {
this._observer.disconnect();
this._observer = null;
this._mutationHandler = null;
Polymer.dom.removeStaticFlush(this._boundFlush);
baseCleanup.call(this);
},
_flush: function () {
if (this._observer) {
this._mutationHandler(this._observer.takeRecords());
}
},
enableShadowAttributeTracking: function () {
if (this._observer) {
this._makeContentListenersAlwaysNotify();
this._observer.disconnect();
this._observer.observe(this.node, {
childList: true,
attributes: true,
subtree: true
});
var root = this.domApi.getOwnerRoot();
var host = root && root.host;
if (host && Polymer.dom(host).observer) {
Polymer.dom(host).observer.enableShadowAttributeTracking();
}
}
},
_makeContentListenersAlwaysNotify: function () {
for (var i = 0, h; i < this._listeners.length; i++) {
h = this._listeners[i];
h._alwaysNotify = h._isContentListener;
}
}
});
}
}());
(function () {
'use strict';
var DomApi = Polymer.DomApi.ctor;
var Settings = Polymer.Settings;
DomApi.DistributedNodesObserver = function (domApi) {
DomApi.EffectiveNodesObserver.call(this, domApi);
};
DomApi.DistributedNodesObserver.prototype = Object.create(DomApi.EffectiveNodesObserver.prototype);
Polymer.Base.extend(DomApi.DistributedNodesObserver.prototype, {
_setup: function () {
},
_cleanup: function () {
},
_beforeCallListeners: function () {
},
_getEffectiveNodes: function () {
return this.domApi.getDistributedNodes();
}
});
if (Settings.useShadow) {
Polymer.Base.extend(DomApi.DistributedNodesObserver.prototype, {
_setup: function () {
if (!this._observer) {
var root = this.domApi.getOwnerRoot();
var host = root && root.host;
if (host) {
this._observer = Polymer.dom(host).observeNodes(this._scheduleNotify.bind(this));
this._observer._isContentListener = true;
if (this._hasAttrSelect()) {
Polymer.dom(host).observer.enableShadowAttributeTracking();
}
}
}
},
_hasAttrSelect: function () {
var select = this.node.getAttribute('select');
return select && select.match(/[[.]+/);
},
_cleanup: function () {
var root = this.domApi.getOwnerRoot();
var host = root && root.host;
if (host) {
Polymer.dom(host).unobserveNodes(this._observer);
}
this._observer = null;
}
});
}
}());
(function () {
var hasDomApi = Polymer.DomApi.hasDomApi;
Polymer.Base._addFeature({ Polymer.Base._addFeature({
_prepShady: function () { _prepShady: function () {
this._useContent = this._useContent || Boolean(this._template); this._useContent = this._useContent || Boolean(this._template);
@ -1244,6 +1558,7 @@ if (this._useContent) {
this.shadyRoot._distributionClean = true; this.shadyRoot._distributionClean = true;
if (hasInsertionPoint(this.shadyRoot)) { if (hasInsertionPoint(this.shadyRoot)) {
this._composeTree(); this._composeTree();
notifyContentObservers(this.shadyRoot);
} else { } else {
if (!this.shadyRoot._hasDistributed) { if (!this.shadyRoot._hasDistributed) {
this.textContent = ''; this.textContent = '';
@ -1254,6 +1569,9 @@ var children = this._composeNode(this);
this._updateChildNodes(this, children); this._updateChildNodes(this, children);
} }
} }
if (!this.shadyRoot._hasDistributed) {
notifyInitialDistribution(this);
}
this.shadyRoot._hasDistributed = true; this.shadyRoot._hasDistributed = true;
} }
}, },
@ -1471,6 +1789,19 @@ return host.domHost;
} }
} }
} }
function notifyContentObservers(root) {
for (var i = 0, c; i < root._insertionPoints.length; i++) {
c = root._insertionPoints[i];
if (hasDomApi(c)) {
Polymer.dom(c).notifyObserver();
}
}
}
function notifyInitialDistribution(host) {
if (hasDomApi(host)) {
Polymer.dom(host).notifyObserver();
}
}
var needsUpgrade = window.CustomElements && !CustomElements.useNative; var needsUpgrade = window.CustomElements && !CustomElements.useNative;
function upgradeLightChildren(children) { function upgradeLightChildren(children) {
if (needsUpgrade && children) { if (needsUpgrade && children) {

View file

@ -27,22 +27,66 @@ return list;
_parseNodeAnnotations: function (node, list) { _parseNodeAnnotations: function (node, list) {
return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list); return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list);
}, },
_testEscape: function (value) { _bindingRegex: /([^{[]*)({{|\[\[)([^}\]]*)(?:]]|}})/g,
var escape = value.slice(0, 2); _parseBindings: function (text) {
if (escape === '{{' || escape === '[[') { var re = this._bindingRegex;
return escape; var parts = [];
var m, lastIndex;
while ((m = re.exec(text)) !== null) {
if (m[1]) {
parts.push({ literal: m[1] });
}
var mode = m[2][0];
var value = m[3].trim();
var negate = false;
if (value[0] == '!') {
negate = true;
value = value.substring(1).trim();
}
var customEvent, notifyEvent, colon;
if (mode == '{' && (colon = value.indexOf('::')) > 0) {
notifyEvent = value.substring(colon + 2);
value = value.substring(0, colon);
customEvent = true;
}
parts.push({
compoundIndex: parts.length,
value: value,
mode: mode,
negate: negate,
event: notifyEvent,
customEvent: customEvent
});
lastIndex = re.lastIndex;
}
if (lastIndex && lastIndex < text.length) {
var literal = text.substring(lastIndex);
if (literal) {
parts.push({ literal: literal });
}
}
if (parts.length) {
return parts;
} }
}, },
_literalFromParts: function (parts) {
var s = '';
for (var i = 0; i < parts.length; i++) {
var literal = parts[i].literal;
s += literal || '';
}
return s;
},
_parseTextNodeAnnotation: function (node, list) { _parseTextNodeAnnotation: function (node, list) {
var v = node.textContent; var parts = this._parseBindings(node.textContent);
var escape = this._testEscape(v); if (parts) {
if (escape) { node.textContent = this._literalFromParts(parts) || ' ';
node.textContent = ' ';
var annote = { var annote = {
bindings: [{ bindings: [{
kind: 'text', kind: 'text',
mode: escape[0], name: 'textContent',
value: v.slice(2, -2).trim() parts: parts,
isCompound: parts.length !== 1
}] }]
}; };
list.push(annote); list.push(annote);
@ -104,62 +148,50 @@ index: index
}); });
}, },
_parseNodeAttributeAnnotations: function (node, annotation) { _parseNodeAttributeAnnotations: function (node, annotation) {
for (var i = node.attributes.length - 1, a; a = node.attributes[i]; i--) { var attrs = Array.prototype.slice.call(node.attributes);
var n = a.name, v = a.value; for (var i = attrs.length - 1, a; a = attrs[i]; i--) {
if (n === 'id' && !this._testEscape(v)) { var n = a.name;
annotation.id = v; var v = a.value;
} else if (n.slice(0, 3) === 'on-') { var b;
if (n.slice(0, 3) === 'on-') {
node.removeAttribute(n); node.removeAttribute(n);
annotation.events.push({ annotation.events.push({
name: n.slice(3), name: n.slice(3),
value: v value: v
}); });
} else { } else if (b = this._parseNodeAttributeAnnotation(node, n, v)) {
var b = this._parseNodeAttributeAnnotation(node, n, v);
if (b) {
annotation.bindings.push(b); annotation.bindings.push(b);
} } else if (n === 'id') {
annotation.id = v;
} }
} }
}, },
_parseNodeAttributeAnnotation: function (node, n, v) { _parseNodeAttributeAnnotation: function (node, name, value) {
var escape = this._testEscape(v); var parts = this._parseBindings(value);
if (escape) { if (parts) {
var customEvent; var origName = name;
var name = n;
var mode = escape[0];
v = v.slice(2, -2).trim();
var not = false;
if (v[0] == '!') {
v = v.substring(1);
not = true;
}
var kind = 'property'; var kind = 'property';
if (n[n.length - 1] == '$') { if (name[name.length - 1] == '$') {
name = n.slice(0, -1); name = name.slice(0, -1);
kind = 'attribute'; kind = 'attribute';
} }
var notifyEvent, colon; var literal = this._literalFromParts(parts);
if (mode == '{' && (colon = v.indexOf('::')) > 0) { if (literal && kind == 'attribute') {
notifyEvent = v.substring(colon + 2); node.setAttribute(name, literal);
v = v.substring(0, colon);
customEvent = true;
} }
if (node.localName == 'input' && n == 'value') { if (node.localName == 'input' && name == 'value') {
node.setAttribute(n, ''); node.setAttribute(origName, '');
} }
node.removeAttribute(n); node.removeAttribute(origName);
if (kind === 'property') { if (kind === 'property') {
name = Polymer.CaseMap.dashToCamelCase(name); name = Polymer.CaseMap.dashToCamelCase(name);
} }
return { return {
kind: kind, kind: kind,
mode: mode,
name: name, name: name,
value: v, parts: parts,
negate: not, literal: literal,
event: notifyEvent, isCompound: parts.length !== 1
customEvent: customEvent
}; };
} }
}, },
@ -250,9 +282,14 @@ for (var i = 0; i < notes.length; i++) {
var note = notes[i]; var note = notes[i];
for (var j = 0; j < note.bindings.length; j++) { for (var j = 0; j < note.bindings.length; j++) {
var b = note.bindings[j]; var b = note.bindings[j];
b.signature = this._parseMethod(b.value); for (var k = 0; k < b.parts.length; k++) {
if (!b.signature) { var p = b.parts[k];
b.model = this._modelForPath(b.value); if (!p.literal) {
p.signature = this._parseMethod(p.value);
if (!p.signature) {
p.model = this._modelForPath(p.value);
}
}
} }
} }
if (note.templateContent) { if (note.templateContent) {
@ -263,10 +300,12 @@ for (var prop in pp) {
bindings.push({ bindings.push({
index: note.index, index: note.index,
kind: 'property', kind: 'property',
mode: '{',
name: '_parent_' + prop, name: '_parent_' + prop,
parts: [{
mode: '{',
model: prop, model: prop,
value: prop value: prop
}]
}); });
} }
note.bindings = note.bindings.concat(bindings); note.bindings = note.bindings.concat(bindings);
@ -277,15 +316,17 @@ _discoverTemplateParentProps: function (notes) {
var pp = {}; var pp = {};
notes.forEach(function (n) { notes.forEach(function (n) {
n.bindings.forEach(function (b) { n.bindings.forEach(function (b) {
if (b.signature) { b.parts.forEach(function (p) {
var args = b.signature.args; if (p.signature) {
var args = p.signature.args;
for (var k = 0; k < args.length; k++) { for (var k = 0; k < args.length; k++) {
pp[args[k].model] = true; pp[args[k].model] = true;
} }
} else { } else {
pp[b.model] = true; pp[p.model] = true;
} }
}); });
});
if (n.templateContent) { if (n.templateContent) {
var tpp = n.templateContent._parentProps; var tpp = n.templateContent._parentProps;
Polymer.Base.mixin(pp, tpp); Polymer.Base.mixin(pp, tpp);
@ -304,15 +345,43 @@ this._marshalAnnotatedNodes();
this._marshalAnnotatedListeners(); this._marshalAnnotatedListeners();
} }
}, },
_configureAnnotationReferences: function () { _configureAnnotationReferences: function (config) {
this._configureTemplateContent(); var notes = this._notes;
}, var nodes = this._nodes;
_configureTemplateContent: function () { for (var i = 0; i < notes.length; i++) {
this._notes.forEach(function (note, i) { var note = notes[i];
if (note.templateContent) { var node = nodes[i];
this._nodes[i]._content = note.templateContent; this._configureTemplateContent(note, node);
this._configureCompoundBindings(note, node);
}
},
_configureTemplateContent: function (note, node) {
if (note.templateContent) {
node._content = note.templateContent;
}
},
_configureCompoundBindings: function (note, node) {
var bindings = note.bindings;
for (var i = 0; i < bindings.length; i++) {
var binding = bindings[i];
if (binding.isCompound) {
var storage = node.__compoundStorage__ || (node.__compoundStorage__ = {});
var parts = binding.parts;
var literals = new Array(parts.length);
for (var j = 0; j < parts.length; j++) {
literals[j] = parts[j].literal;
}
var name = binding.name;
storage[name] = literals;
if (binding.literal && binding.kind == 'property') {
if (node._configValue) {
node._configValue(name, binding.literal);
} else {
node[name] = binding.literal;
}
}
}
} }
}, this);
}, },
_marshalIdNodes: function () { _marshalIdNodes: function () {
this.$ = {}; this.$ = {};
@ -651,7 +720,7 @@ prevent = dy > dx;
prevent = dx > dy; prevent = dx > dy;
} }
if (prevent) { if (prevent) {
//ev.preventDefault(); ev.preventDefault();
} else { } else {
Gestures.prevent('track'); Gestures.prevent('track');
} }
@ -1104,7 +1173,9 @@ this._callbacks.splice(0, len);
this._lastVal += len; this._lastVal += len;
} }
}; };
new (window.MutationObserver || JsMutationObserver)(Polymer.Async._atEndOfMicrotask.bind(Polymer.Async)).observe(Polymer.Async._twiddle, { characterData: true }); new window.MutationObserver(function () {
Polymer.Async._atEndOfMicrotask();
}).observe(Polymer.Async._twiddle, { characterData: true });
Polymer.Debounce = function () { Polymer.Debounce = function () {
var Async = Polymer.Async; var Async = Polymer.Async;
var Debouncer = function (context) { var Debouncer = function (context) {
@ -1186,6 +1257,32 @@ if (toElement) {
Polymer.dom(toElement).setAttribute(name, ''); Polymer.dom(toElement).setAttribute(name, '');
} }
}, },
getEffectiveChildNodes: function () {
return Polymer.dom(this).getEffectiveChildNodes();
},
getEffectiveChildren: function () {
var list = Polymer.dom(this).getEffectiveChildNodes();
return list.filter(function (n) {
return n.nodeType === Node.ELEMENT_NODE;
});
},
getEffectiveTextContent: function () {
var cn = this.getEffectiveChildNodes();
var tc = [];
for (var i = 0, c; c = cn[i]; i++) {
if (c.nodeType !== Node.COMMENT_NODE) {
tc.push(Polymer.dom(c).textContent);
}
}
return tc.join('');
},
queryEffectiveChildren: function (slctr) {
var e$ = Polymer.dom(this).queryDistributedElements(slctr);
return e$ && e$[0];
},
queryAllEffectiveChildren: function (slctr) {
return Polymer.dom(this).queryAllDistributedElements(slctr);
},
getContentChildNodes: function (slctr) { getContentChildNodes: function (slctr) {
var content = Polymer.dom(this.root).querySelector(slctr || 'content'); var content = Polymer.dom(this.root).querySelector(slctr || 'content');
return content ? Polymer.dom(content).getDistributedNodes() : []; return content ? Polymer.dom(content).getDistributedNodes() : [];
@ -1223,7 +1320,7 @@ if (index >= 0) {
return path.splice(index, 1); return path.splice(index, 1);
} }
} else { } else {
var arr = this.get(path); var arr = this._get(path);
index = arr.indexOf(item); index = arr.indexOf(item);
if (index >= 0) { if (index >= 0) {
return this.splice(path, index, 1); return this.splice(path, index, 1);
@ -1405,7 +1502,7 @@ _notedListenerFactory: function (property, path, isStructured, bogusTest) {
return function (e, target) { return function (e, target) {
if (!bogusTest(e, target)) { if (!bogusTest(e, target)) {
if (e.detail && e.detail.path) { if (e.detail && e.detail.path) {
this.notifyPath(this._fixPath(path, property, e.detail.path), e.detail.value); this._notifyPath(this._fixPath(path, property, e.detail.path), e.detail.value);
} else { } else {
var value = target[property]; var value = target[property];
if (!isStructured) { if (!isStructured) {
@ -1431,16 +1528,16 @@ node.addEventListener(info.event, inst._notifyListener.bind(inst, info.changedFn
}; };
Polymer.Base.extend(Polymer.Bind, { Polymer.Base.extend(Polymer.Bind, {
_shouldAddListener: function (effect) { _shouldAddListener: function (effect) {
return effect.name && effect.mode === '{' && !effect.negate && effect.kind != 'attribute'; return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !effect.isCompound && effect.parts[0].mode === '{' && !effect.parts[0].negate;
}, },
_annotationEffect: function (source, value, effect) { _annotationEffect: function (source, value, effect) {
if (source != effect.value) { if (source != effect.value) {
value = this.get(effect.value); value = this._get(effect.value);
this.__data__[effect.value] = value; this.__data__[effect.value] = value;
} }
var calc = effect.negate ? !value : value; var calc = effect.negate ? !value : value;
if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) { if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) {
return this._applyEffectValue(calc, effect); return this._applyEffectValue(effect, calc);
} }
}, },
_reflectEffect: function (source) { _reflectEffect: function (source) {
@ -1478,7 +1575,7 @@ var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
if (args) { if (args) {
var fn = this[effect.method]; var fn = this[effect.method];
if (fn) { if (fn) {
this.__setProperty(effect.property, fn.apply(this, args)); this.__setProperty(effect.name, fn.apply(this, args));
} else { } else {
this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined')); this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
} }
@ -1494,7 +1591,7 @@ var computedvalue = fn.apply(computedHost, args);
if (effect.negate) { if (effect.negate) {
computedvalue = !computedvalue; computedvalue = !computedvalue;
} }
this._applyEffectValue(computedvalue, effect); this._applyEffectValue(effect, computedvalue);
} }
} else { } else {
computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined')); computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined'));
@ -1510,7 +1607,7 @@ var v;
if (arg.literal) { if (arg.literal) {
v = arg.value; v = arg.value;
} else if (arg.structured) { } else if (arg.structured) {
v = Polymer.Base.get(name, model); v = Polymer.Base._get(name, model);
} else { } else {
v = model[name]; v = model[name];
} }
@ -1573,7 +1670,7 @@ this._addPropertyEffect(arg.model, 'compute', {
method: sig.method, method: sig.method,
args: sig.args, args: sig.args,
trigger: arg, trigger: arg,
property: name name: name
}); });
}, this); }, this);
}, },
@ -1611,35 +1708,49 @@ this._addAnnotationEffect(binding, index);
}, },
_addAnnotationEffect: function (note, index) { _addAnnotationEffect: function (note, index) {
if (Polymer.Bind._shouldAddListener(note)) { if (Polymer.Bind._shouldAddListener(note)) {
Polymer.Bind._addAnnotatedListener(this, index, note.name, note.value, note.event); Polymer.Bind._addAnnotatedListener(this, index, note.name, note.parts[0].value, note.parts[0].event);
}
for (var i = 0; i < note.parts.length; i++) {
var part = note.parts[i];
if (part.signature) {
this._addAnnotatedComputationEffect(note, part, index);
} else if (!part.literal) {
this._addPropertyEffect(part.model, 'annotation', {
kind: note.kind,
index: index,
name: note.name,
value: part.value,
isCompound: note.isCompound,
compoundIndex: part.compoundIndex,
event: part.event,
customEvent: part.customEvent,
negate: part.negate
});
} }
if (note.signature) {
this._addAnnotatedComputationEffect(note, index);
} else {
note.index = index;
this._addPropertyEffect(note.model, 'annotation', note);
} }
}, },
_addAnnotatedComputationEffect: function (note, index) { _addAnnotatedComputationEffect: function (note, part, index) {
var sig = note.signature; var sig = part.signature;
if (sig.static) { if (sig.static) {
this.__addAnnotatedComputationEffect('__static__', index, note, sig, null); this.__addAnnotatedComputationEffect('__static__', index, note, part, null);
} else { } else {
sig.args.forEach(function (arg) { sig.args.forEach(function (arg) {
if (!arg.literal) { if (!arg.literal) {
this.__addAnnotatedComputationEffect(arg.model, index, note, sig, arg); this.__addAnnotatedComputationEffect(arg.model, index, note, part, arg);
} }
}, this); }, this);
} }
}, },
__addAnnotatedComputationEffect: function (property, index, note, sig, trigger) { __addAnnotatedComputationEffect: function (property, index, note, part, trigger) {
this._addPropertyEffect(property, 'annotatedComputation', { this._addPropertyEffect(property, 'annotatedComputation', {
index: index, index: index,
isCompound: note.isCompound,
compoundIndex: part.compoundIndex,
kind: note.kind, kind: note.kind,
property: note.name, name: note.name,
negate: note.negate, negate: part.negate,
method: sig.method, method: part.signature.method,
args: sig.args, args: part.signature.args,
trigger: trigger trigger: trigger
}); });
}, },
@ -1708,9 +1819,14 @@ _marshalInstanceEffects: function () {
Polymer.Bind.prepareInstance(this); Polymer.Bind.prepareInstance(this);
Polymer.Bind.setupBindListeners(this); Polymer.Bind.setupBindListeners(this);
}, },
_applyEffectValue: function (value, info) { _applyEffectValue: function (info, value) {
var node = this._nodes[info.index]; var node = this._nodes[info.index];
var property = info.property || info.name || 'textContent'; var property = info.name;
if (info.isCompound) {
var storage = node.__compoundStorage__[property];
storage[info.compoundIndex] = value;
value = storage.join('');
}
if (info.kind == 'attribute') { if (info.kind == 'attribute') {
this.serializeValueToAttribute(value, property, node); this.serializeValueToAttribute(value, property, node);
} else { } else {
@ -1790,10 +1906,10 @@ for (var p in config) {
var fx = fx$[p]; var fx = fx$[p];
if (fx) { if (fx) {
for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) { for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
if (x.kind === 'annotation') { if (x.kind === 'annotation' && !x.isCompound) {
var node = this._nodes[x.effect.index]; var node = this._nodes[x.effect.index];
if (node._configValue) { if (node._configValue) {
var value = p === x.effect.value ? config[p] : this.get(x.effect.value, config); var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config);
node._configValue(x.effect.name, value); node._configValue(x.effect.name, value);
} }
} }
@ -1840,11 +1956,16 @@ this._handlers = [];
'use strict'; 'use strict';
Polymer.Base._addFeature({ Polymer.Base._addFeature({
notifyPath: function (path, value, fromAbove) { notifyPath: function (path, value, fromAbove) {
var info = {};
path = this._get(path, this, info);
this._notifyPath(info.path, value, fromAbove);
},
_notifyPath: function (path, value, fromAbove) {
var old = this._propertySetter(path, value); var old = this._propertySetter(path, value);
if (old !== value && (old === old || value === value)) { if (old !== value && (old === old || value === value)) {
this._pathEffector(path, value); this._pathEffector(path, value);
if (!fromAbove) { if (!fromAbove) {
this._notifyPath(path, value); this._notifyPathUp(path, value);
} }
return true; return true;
} }
@ -1871,41 +1992,67 @@ var last = parts[parts.length - 1];
if (parts.length > 1) { if (parts.length > 1) {
for (var i = 0; i < parts.length - 1; i++) { for (var i = 0; i < parts.length - 1; i++) {
var part = parts[i]; var part = parts[i];
if (array && part[0] == '#') {
prop = Polymer.Collection.get(array).getItem(part);
} else {
prop = prop[part]; prop = prop[part];
if (array && parseInt(part) == part) { if (array && parseInt(part, 10) == part) {
parts[i] = Polymer.Collection.get(array).getKey(prop); parts[i] = Polymer.Collection.get(array).getKey(prop);
} }
}
if (!prop) { if (!prop) {
return; return;
} }
array = Array.isArray(prop) ? prop : null; array = Array.isArray(prop) ? prop : null;
} }
if (array && parseInt(last) == last) { if (array) {
var coll = Polymer.Collection.get(array); var coll = Polymer.Collection.get(array);
if (last[0] == '#') {
var key = last;
var old = coll.getItem(key);
last = array.indexOf(old);
coll.setItem(key, value);
} else if (parseInt(last, 10) == last) {
var old = prop[last]; var old = prop[last];
var key = coll.getKey(old); var key = coll.getKey(old);
parts[i] = key; parts[i] = key;
coll.setItem(key, value); coll.setItem(key, value);
} }
}
prop[last] = value; prop[last] = value;
if (!root) { if (!root) {
this.notifyPath(parts.join('.'), value); this._notifyPath(parts.join('.'), value);
} }
} else { } else {
prop[path] = value; prop[path] = value;
} }
}, },
get: function (path, root) { get: function (path, root) {
return this._get(path, root);
},
_get: function (path, root, info) {
var prop = root || this; var prop = root || this;
var parts = this._getPathParts(path); var parts = this._getPathParts(path);
var last = parts.pop(); var array;
while (parts.length) { for (var i = 0; i < parts.length; i++) {
prop = prop[parts.shift()];
if (!prop) { if (!prop) {
return; return;
} }
var part = parts[i];
if (array && part[0] == '#') {
prop = Polymer.Collection.get(array).getItem(part);
} else {
prop = prop[part];
if (info && array && parseInt(part, 10) == part) {
parts[i] = Polymer.Collection.get(array).getKey(prop);
} }
return prop[last]; }
array = Array.isArray(prop) ? prop : null;
}
if (info) {
info.path = parts.join('.');
}
return prop;
}, },
_pathEffector: function (path, value) { _pathEffector: function (path, value) {
var model = this._modelForPath(path); var model = this._modelForPath(path);
@ -1978,7 +2125,7 @@ this.notifyPath(this._fixPath(a, b, path), value);
_fixPath: function (property, root, path) { _fixPath: function (property, root, path) {
return property + path.slice(root.length); return property + path.slice(root.length);
}, },
_notifyPath: function (path, value) { _notifyPathUp: function (path, value) {
var rootName = this._modelForPath(path); var rootName = this._modelForPath(path);
var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName); var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
var eventName = dashCaseName + this._EVENT_CHANGED; var eventName = dashCaseName + this._EVENT_CHANGED;
@ -1992,47 +2139,62 @@ var dot = path.indexOf('.');
return dot < 0 ? path : path.slice(0, dot); return dot < 0 ? path : path.slice(0, dot);
}, },
_EVENT_CHANGED: '-changed', _EVENT_CHANGED: '-changed',
notifySplices: function (path, splices) {
var info = {};
var array = this._get(path, this, info);
this._notifySplices(array, info.path, splices);
},
_notifySplices: function (array, path, splices) {
var change = {
keySplices: Polymer.Collection.applySplices(array, splices),
indexSplices: splices
};
if (!array.hasOwnProperty('splices')) {
Object.defineProperty(array, 'splices', {
configurable: true,
writable: true
});
}
array.splices = change;
this._notifyPath(path + '.splices', change);
this._notifyPath(path + '.length', array.length);
change.keySplices = null;
change.indexSplices = null;
},
_notifySplice: function (array, path, index, added, removed) { _notifySplice: function (array, path, index, added, removed) {
var splices = [{ this._notifySplices(array, path, [{
index: index, index: index,
addedCount: added, addedCount: added,
removed: removed, removed: removed,
object: array, object: array,
type: 'splice' type: 'splice'
}]; }]);
var change = {
keySplices: Polymer.Collection.applySplices(array, splices),
indexSplices: splices
};
this.set(path + '.splices', change);
if (added != removed.length) {
this.notifyPath(path + '.length', array.length);
}
change.keySplices = null;
change.indexSplices = null;
}, },
push: function (path) { push: function (path) {
var array = this.get(path); var info = {};
var array = this._get(path, this, info);
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
var len = array.length; var len = array.length;
var ret = array.push.apply(array, args); var ret = array.push.apply(array, args);
if (args.length) { if (args.length) {
this._notifySplice(array, path, len, args.length, []); this._notifySplice(array, info.path, len, args.length, []);
} }
return ret; return ret;
}, },
pop: function (path) { pop: function (path) {
var array = this.get(path); var info = {};
var array = this._get(path, this, info);
var hadLength = Boolean(array.length); var hadLength = Boolean(array.length);
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
var ret = array.pop.apply(array, args); var ret = array.pop.apply(array, args);
if (hadLength) { if (hadLength) {
this._notifySplice(array, path, array.length, 0, [ret]); this._notifySplice(array, info.path, array.length, 0, [ret]);
} }
return ret; return ret;
}, },
splice: function (path, start, deleteCount) { splice: function (path, start, deleteCount) {
var array = this.get(path); var info = {};
var array = this._get(path, this, info);
if (start < 0) { if (start < 0) {
start = array.length - Math.floor(-start); start = array.length - Math.floor(-start);
} else { } else {
@ -2045,26 +2207,28 @@ var args = Array.prototype.slice.call(arguments, 1);
var ret = array.splice.apply(array, args); var ret = array.splice.apply(array, args);
var addedCount = Math.max(args.length - 2, 0); var addedCount = Math.max(args.length - 2, 0);
if (addedCount || ret.length) { if (addedCount || ret.length) {
this._notifySplice(array, path, start, addedCount, ret); this._notifySplice(array, info.path, start, addedCount, ret);
} }
return ret; return ret;
}, },
shift: function (path) { shift: function (path) {
var array = this.get(path); var info = {};
var array = this._get(path, this, info);
var hadLength = Boolean(array.length); var hadLength = Boolean(array.length);
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
var ret = array.shift.apply(array, args); var ret = array.shift.apply(array, args);
if (hadLength) { if (hadLength) {
this._notifySplice(array, path, 0, 0, [ret]); this._notifySplice(array, info.path, 0, 0, [ret]);
} }
return ret; return ret;
}, },
unshift: function (path) { unshift: function (path) {
var array = this.get(path); var info = {};
var array = this._get(path, this, info);
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
var ret = array.unshift.apply(array, args); var ret = array.unshift.apply(array, args);
if (args.length) { if (args.length) {
this._notifySplice(array, path, 0, args.length, []); this._notifySplice(array, info.path, 0, args.length, []);
} }
return ret; return ret;
}, },
@ -2072,8 +2236,10 @@ prepareModelNotifyPath: function (model) {
this.mixin(model, { this.mixin(model, {
fire: Polymer.Base.fire, fire: Polymer.Base.fire,
notifyPath: Polymer.Base.notifyPath, notifyPath: Polymer.Base.notifyPath,
_get: Polymer.Base._get,
_EVENT_CHANGED: Polymer.Base._EVENT_CHANGED, _EVENT_CHANGED: Polymer.Base._EVENT_CHANGED,
_notifyPath: Polymer.Base._notifyPath, _notifyPath: Polymer.Base._notifyPath,
_notifyPathUp: Polymer.Base._notifyPathUp,
_pathEffector: Polymer.Base._pathEffector, _pathEffector: Polymer.Base._pathEffector,
_annotationPathEffect: Polymer.Base._annotationPathEffect, _annotationPathEffect: Polymer.Base._annotationPathEffect,
_complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect,
@ -2081,7 +2247,8 @@ _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect,
_computePathEffect: Polymer.Base._computePathEffect, _computePathEffect: Polymer.Base._computePathEffect,
_modelForPath: Polymer.Base._modelForPath, _modelForPath: Polymer.Base._modelForPath,
_pathMatchesEffect: Polymer.Base._pathMatchesEffect, _pathMatchesEffect: Polymer.Base._pathMatchesEffect,
_notifyBoundPaths: Polymer.Base._notifyBoundPaths _notifyBoundPaths: Polymer.Base._notifyBoundPaths,
_getPathParts: Polymer.Base._getPathParts
}); });
} }
}); });
@ -3306,7 +3473,7 @@ archetype._prepEffects();
this._customPrepEffects(archetype); this._customPrepEffects(archetype);
archetype._prepBehaviors(); archetype._prepBehaviors();
archetype._prepBindings(); archetype._prepBindings();
archetype._notifyPath = this._notifyPathImpl; archetype._notifyPathUp = this._notifyPathUpImpl;
archetype._scopeElementClass = this._scopeElementClassImpl; archetype._scopeElementClass = this._scopeElementClassImpl;
archetype.listen = this._listenImpl; archetype.listen = this._listenImpl;
archetype._showHideChildren = this._showHideChildrenImpl; archetype._showHideChildren = this._showHideChildrenImpl;
@ -3444,7 +3611,7 @@ _forwardInstancePath: function (inst, path, value) {
}, },
_forwardInstanceProp: function (inst, prop, value) { _forwardInstanceProp: function (inst, prop, value) {
}, },
_notifyPathImpl: function (path, value) { _notifyPathUpImpl: function (path, value) {
var dataHost = this.dataHost; var dataHost = this.dataHost;
var dot = path.indexOf('.'); var dot = path.indexOf('.');
var root = dot < 0 ? path : path.slice(0, dot); var root = dot < 0 ? path : path.slice(0, dot);
@ -3562,9 +3729,10 @@ this.omap.set(item, key);
} else { } else {
this.pmap[item] = key; this.pmap[item] = key;
} }
return key; return '#' + key;
}, },
removeKey: function (key) { removeKey: function (key) {
key = this._parseKey(key);
this._removeFromMap(this.store[key]); this._removeFromMap(this.store[key]);
delete this.store[key]; delete this.store[key];
}, },
@ -3581,16 +3749,29 @@ this.removeKey(key);
return key; return key;
}, },
getKey: function (item) { getKey: function (item) {
var key;
if (item && typeof item == 'object') { if (item && typeof item == 'object') {
return this.omap.get(item); key = this.omap.get(item);
} else { } else {
return this.pmap[item]; key = this.pmap[item];
}
if (key != undefined) {
return '#' + key;
} }
}, },
getKeys: function () { getKeys: function () {
return Object.keys(this.store); return Object.keys(this.store).map(function (key) {
return '#' + key;
});
},
_parseKey: function (key) {
if (key[0] == '#') {
return key.slice(1);
}
throw new Error('unexpected key ' + key);
}, },
setItem: function (key, item) { setItem: function (key, item) {
key = this._parseKey(key);
var old = this.store[key]; var old = this.store[key];
if (old) { if (old) {
this._removeFromMap(old); this._removeFromMap(old);
@ -3603,6 +3784,7 @@ this.pmap[item] = key;
this.store[key] = item; this.store[key] = item;
}, },
getItem: function (key) { getItem: function (key) {
key = this._parseKey(key);
return this.store[key]; return this.store[key];
}, },
getItems: function () { getItems: function () {
@ -3996,7 +4178,7 @@ this.set('items.' + idx, value);
}, },
_forwardInstancePath: function (inst, path, value) { _forwardInstancePath: function (inst, path, value) {
if (path.indexOf(this.as + '.') === 0) { if (path.indexOf(this.as + '.') === 0) {
this.notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value); this._notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
} }
}, },
_forwardParentProp: function (prop, value) { _forwardParentProp: function (prop, value) {
@ -4006,7 +4188,7 @@ inst.__setProperty(prop, value, true);
}, },
_forwardParentPath: function (path, value) { _forwardParentPath: function (path, value) {
this._instances.forEach(function (inst) { this._instances.forEach(function (inst) {
inst.notifyPath(path, value, true); inst._notifyPath(path, value, true);
}, this); }, this);
}, },
_forwardItemPath: function (path, value) { _forwardItemPath: function (path, value) {
@ -4018,7 +4200,7 @@ var inst = this._instances[idx];
if (inst) { if (inst) {
if (dot >= 0) { if (dot >= 0) {
path = this.as + '.' + path.substring(dot + 1); path = this.as + '.' + path.substring(dot + 1);
inst.notifyPath(path, value, true); inst._notifyPath(path, value, true);
} else { } else {
inst.__setProperty(this.as, value, true); inst.__setProperty(this.as, value, true);
} }
@ -4070,6 +4252,7 @@ this.unlinkPaths('selected.' + i);
} }
} else { } else {
this.unlinkPaths('selected'); this.unlinkPaths('selected');
this.unlinkPaths('selectedItem');
} }
if (this.multi) { if (this.multi) {
if (!this.selected || this.selected.length) { if (!this.selected || this.selected.length) {
@ -4209,7 +4392,7 @@ this._instance[prop] = value;
}, },
_forwardParentPath: function (path, value) { _forwardParentPath: function (path, value) {
if (this._instance) { if (this._instance) {
this._instance.notifyPath(path, value, true); this._instance._notifyPath(path, value, true);
} }
} }
}); });

View file

@ -1,7 +1,7 @@
{ {
"name": "webcomponentsjs", "name": "webcomponentsjs",
"main": "webcomponents.js", "main": "webcomponents.js",
"version": "0.7.14", "version": "0.7.15",
"homepage": "http://webcomponents.org", "homepage": "http://webcomponents.org",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -15,11 +15,11 @@
], ],
"license": "BSD", "license": "BSD",
"ignore": [], "ignore": [],
"_release": "0.7.14", "_release": "0.7.15",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v0.7.14", "tag": "v0.7.15",
"commit": "48194e673b7a0a8810b32320e0444b512e5a7557" "commit": "d90a442cdf31ae10a7b5b62e667cc749a2a6da61"
}, },
"_source": "git://github.com/Polymer/webcomponentsjs.git", "_source": "git://github.com/Polymer/webcomponentsjs.git",
"_target": "^0.7.2", "_target": "^0.7.2",

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also * 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 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/ */
// @version 0.7.14 // @version 0.7.15
if (typeof WeakMap === "undefined") { if (typeof WeakMap === "undefined") {
(function() { (function() {
var defineProperty = Object.defineProperty; var defineProperty = Object.defineProperty;
@ -45,6 +45,9 @@ if (typeof WeakMap === "undefined") {
} }
(function(global) { (function(global) {
if (global.JsMutationObserver) {
return;
}
var registrationsTable = new WeakMap(); var registrationsTable = new WeakMap();
var setImmediate; var setImmediate;
if (/Trident|Edge/.test(navigator.userAgent)) { if (/Trident|Edge/.test(navigator.userAgent)) {
@ -340,7 +343,10 @@ if (typeof WeakMap === "undefined") {
} }
}; };
global.JsMutationObserver = JsMutationObserver; global.JsMutationObserver = JsMutationObserver;
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver; if (!global.MutationObserver) {
global.MutationObserver = JsMutationObserver;
JsMutationObserver._isPolyfilled = true;
}
})(self); })(self);
window.CustomElements = window.CustomElements || { window.CustomElements = window.CustomElements || {
@ -442,8 +448,9 @@ window.CustomElements.addModule(function(scope) {
} }
}); });
} }
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver; var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"];
scope.hasPolyfillMutations = hasPolyfillMutations; scope.hasPolyfillMutations = hasThrottledAttached;
scope.hasThrottledAttached = hasThrottledAttached;
var isPendingMutations = false; var isPendingMutations = false;
var pendingMutations = []; var pendingMutations = [];
function deferMutation(fn) { function deferMutation(fn) {
@ -462,7 +469,7 @@ window.CustomElements.addModule(function(scope) {
pendingMutations = []; pendingMutations = [];
} }
function attached(element) { function attached(element) {
if (hasPolyfillMutations) { if (hasThrottledAttached) {
deferMutation(function() { deferMutation(function() {
_attached(element); _attached(element);
}); });
@ -485,7 +492,7 @@ window.CustomElements.addModule(function(scope) {
}); });
} }
function detached(element) { function detached(element) {
if (hasPolyfillMutations) { if (hasThrottledAttached) {
deferMutation(function() { deferMutation(function() {
_detached(element); _detached(element);
}); });

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also * 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 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/ */
// @version 0.7.14 // @version 0.7.15
if (typeof WeakMap === "undefined") { if (typeof WeakMap === "undefined") {
(function() { (function() {
var defineProperty = Object.defineProperty; var defineProperty = Object.defineProperty;
@ -45,6 +45,9 @@ if (typeof WeakMap === "undefined") {
} }
(function(global) { (function(global) {
if (global.JsMutationObserver) {
return;
}
var registrationsTable = new WeakMap(); var registrationsTable = new WeakMap();
var setImmediate; var setImmediate;
if (/Trident|Edge/.test(navigator.userAgent)) { if (/Trident|Edge/.test(navigator.userAgent)) {
@ -340,7 +343,10 @@ if (typeof WeakMap === "undefined") {
} }
}; };
global.JsMutationObserver = JsMutationObserver; global.JsMutationObserver = JsMutationObserver;
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver; if (!global.MutationObserver) {
global.MutationObserver = JsMutationObserver;
JsMutationObserver._isPolyfilled = true;
}
})(self); })(self);
window.HTMLImports = window.HTMLImports || { window.HTMLImports = window.HTMLImports || {

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also * 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 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/ */
// @version 0.7.14 // @version 0.7.15
if (typeof WeakMap === "undefined") { if (typeof WeakMap === "undefined") {
(function() { (function() {
var defineProperty = Object.defineProperty; var defineProperty = Object.defineProperty;
@ -45,6 +45,9 @@ if (typeof WeakMap === "undefined") {
} }
(function(global) { (function(global) {
if (global.JsMutationObserver) {
return;
}
var registrationsTable = new WeakMap(); var registrationsTable = new WeakMap();
var setImmediate; var setImmediate;
if (/Trident|Edge/.test(navigator.userAgent)) { if (/Trident|Edge/.test(navigator.userAgent)) {
@ -340,5 +343,8 @@ if (typeof WeakMap === "undefined") {
} }
}; };
global.JsMutationObserver = JsMutationObserver; global.JsMutationObserver = JsMutationObserver;
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver; if (!global.MutationObserver) {
global.MutationObserver = JsMutationObserver;
JsMutationObserver._isPolyfilled = true;
}
})(self); })(self);

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also * 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 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/ */
// @version 0.7.14 // @version 0.7.15
if (typeof WeakMap === "undefined") { if (typeof WeakMap === "undefined") {
(function() { (function() {
var defineProperty = Object.defineProperty; var defineProperty = Object.defineProperty;

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{ {
"name": "webcomponentsjs", "name": "webcomponentsjs",
"main": "webcomponents.js", "main": "webcomponents.js",
"version": "0.7.14", "version": "0.7.15",
"homepage": "http://webcomponents.org", "homepage": "http://webcomponents.org",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

Some files were not shown because too many files have changed in this diff Show more