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"
},
"_source": "git://github.com/desandro/eventie.git",
"_target": "^1",
"_target": "~1.0.3",
"_originalSource": "eventie"
}

View file

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

View file

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

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)
- `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
*
* (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",
"version": "1.0.6",
"version": "1.0.7",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"web-components",
@ -29,14 +29,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
"_release": "1.0.6",
"homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior",
"_release": "1.0.7",
"_resolution": {
"type": "version",
"tag": "v1.0.6",
"commit": "af5c98b1cf9b3d180a6326c99ac9c7057eee647f"
"tag": "v1.0.7",
"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",
"_originalSource": "polymerelements/iron-a11y-keys-behavior"
"_originalSource": "PolymerElements/iron-a11y-keys-behavior"
}

View file

@ -1,6 +1,6 @@
{
"name": "iron-a11y-keys-behavior",
"version": "1.0.6",
"version": "1.0.7",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"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: {
type: Array,
value: function() {
@ -398,6 +407,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_onKeyBindingEvent: function(keyBindings, event) {
if (this.stopKeyboardEventPropagation) {
event.stopPropagation();
}
keyBindings.forEach(function(keyBinding) {
var keyCombo = keyBinding[0];
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>
</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">
<template>
<x-a11y-combo-keys></x-a11y-combo-keys>
@ -161,6 +167,15 @@ suite('Polymer.IronA11yKeysBehavior', function() {
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() {
test('knows that `spacebar` is the same as `space`', function() {
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>
</body>

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "iron-form-element-behavior",
"version": "1.0.4",
"version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt",
"private": true,
"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
* Polymer.IronValidatableBehavior and define a custom validation method.
* Otherwise, a `required` element will always be considered valid.
* It's also strongly recomended to provide a visual style for the element
* when it's value is invalid.
* It's also strongly recommended to provide a visual style for the element
* when its value is invalid.
*/
required: {
type: Boolean,

View file

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

View file

@ -1,7 +1,7 @@
{
"name": "iron-icon",
"private": true,
"version": "1.0.5",
"version": "1.0.7",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "An element that supports displaying an icon",
"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>
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.
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
@ -66,6 +67,8 @@ Custom property | Description | Default
----------------|-------------|----------
`--iron-icon-width` | Width 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
@element iron-icon
@ -84,7 +87,8 @@ Custom property | Description | Default
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);
height: var(--iron-icon-height, 24px);

View file

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

View file

@ -1,7 +1,7 @@
{
"name": "iron-iconset-svg",
"description": "Manages a set of svg icons",
"version": "1.0.6",
"version": "1.0.8",
"keywords": [
"web-components",
"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.
*
* 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
* are resolution independent and should look good on any device. They are
* stylable via css. Icons can be themed, colorized, and even animated.
* bitmap graphics like jpg or png. Icons that use svg are vector based so
* they are resolution independent and should look good on any device. They
* are stylable via css. Icons can be themed, colorized, and even animated.
*
* Example:
*
@ -45,18 +45,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @element iron-iconset-svg
* @demo demo/index.html
* @implements {Polymer.Iconset}
*/
Polymer({
is: 'iron-iconset-svg',
properties: {
/**
* The name of the iconset.
*
* @attribute name
* @type string
*/
name: {
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.
*
* @attribute iconSize
* @type number
* @default 24
*/
size: {
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.
*
@ -98,7 +95,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @method applyIcon
* @param {Element} element Element to which the icon is applied.
* @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) {
// 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);
});
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() {
return loadedPromise;
});
@ -93,6 +99,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
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 () {
expect(div.firstElementChild).to.not.be.ok;
iconset.applyIcon(div, 'circle');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -58,6 +58,7 @@ Or, in a Polymer element, you can include a meta in your template:
// monostate data
var metaDatas = {};
var metaArrays = {};
var singleton = null;
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
* 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`.

View file

@ -179,6 +179,15 @@ suite('<iron-meta>', function () {
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>

View file

@ -34,14 +34,14 @@
"web-component-tester": "*",
"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",
"_resolution": {
"type": "version",
"tag": "v1.0.9",
"commit": "87f7763d323fffa07357a08777ad831b7c2c2fb8"
},
"_source": "git://github.com/PolymerElements/iron-overlay-behavior.git",
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-overlay-behavior"
"_originalSource": "polymerelements/iron-overlay-behavior"
}

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "iron-range-behavior",
"version": "1.0.3",
"version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value",
"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
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() {

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.max = 7;
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;
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",
"commit": "0b2f484ac3b1b03400da2d38b0f543f3688150a4"
},
"_source": "git://github.com/polymerelements/iron-selector.git",
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-selector"
"_originalSource": "PolymerElements/iron-selector"
}

View file

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

View file

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

View file

@ -14,7 +14,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<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
*

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "neon-animation",
"version": "1.0.4",
"version": "1.0.7",
"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">
<!--
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
children pages should implement `Polymer.NeonAnimatableBehavior` and define `entry` and `exit`
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.cancelAnimation();
this._completeSelectedChanged();
this._squelchNextFinishEvent = false;
}
// configure the animation.

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-behaviors",
"version": "1.0.5",
"version": "1.0.7",
"description": "Common behaviors across the paper elements",
"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,
* create a ripple down effect.
*
* @param {!KeyboardEvent} event .
*/
_spaceKeyDownHandler: function(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,
* create a ripple up effect.
*
* @param {!KeyboardEvent} event .
*/
_spaceKeyUpHandler: function(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: {
type: Boolean,
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
* 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.
*/
ensureRipple: function(triggeringEvent) {
ensureRipple: function(opt_triggeringEvent) {
if (!this.hasRipple()) {
this._ripple = this._createRipple();
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 :
rippleContainer;
if (triggeringEvent && domContainer.contains(triggeringEvent.target)) {
this._ripple.uiDownAction(triggeringEvent);
if (opt_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>`.
* Override this method to customize the ripple element.
* @return {element} Returns a `<paper-ripple>` element.
* @return {!PaperRippleElement} Returns a `<paper-ripple>` element.
*/
_createRipple: function() {
return document.createElement('paper-ripple');
return /** @type {!PaperRippleElement} */ (
document.createElement('paper-ripple'));
},
_noinkChanged: function(noink) {

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-checkbox",
"version": "1.0.12",
"version": "1.0.13",
"description": "A material design checkbox",
"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-checkmark-color` | Checkmark color | `white`
`--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`
@demo demo/index.html
@ -75,7 +76,7 @@ Custom property | Description | Default
background-color: var(--paper-checkbox-unchecked-background-color, transparent);
}
:host #ink {
#ink {
position: absolute;
top: -15px;
left: -15px;
@ -86,11 +87,16 @@ Custom property | Description | Default
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);
}
:host #checkbox {
#checkbox {
position: relative;
box-sizing: border-box;
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);
border-color: var(--paper-checkbox-checked-color, --default-primary-color);
}
:host #checkmark {
#checkmark {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
@ -164,12 +170,17 @@ Custom property | Description | Default
position: relative;
display: inline-block;
vertical-align: middle;
padding-left: 8px;
padding-left: var(--paper-checkbox-label-spacing, 8px);
white-space: normal;
pointer-events: none;
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] {
display: none;
}

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-dropdown-menu",
"version": "1.0.4",
"version": "1.0.5",
"description": "An element that works similarly to a native browser select",
"authors": [
"The Polymer Authors"
@ -28,7 +28,9 @@
"paper-input": "polymerelements/paper-input#^1.0.9",
"paper-menu-button": "polymerelements/paper-menu-button#^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": {
"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-icon/iron-icon.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` works with selectable content. The currently selected
item is displayed in the control. If no item is selected, the `label` is
@ -108,16 +112,17 @@ respectively.
}
paper-ripple {
top: 20px;
left: 8px;
bottom: 16px;
right: 8px;
top: 12px;
left: 0px;
bottom: 8px;
right: 0px;
@apply(--paper-dropdown-menu-ripple);
}
paper-menu-button {
display: block;
padding: 0;
@apply(--paper-dropdown-menu-button);
}
@ -146,6 +151,7 @@ respectively.
<div class="dropdown-trigger">
<paper-ripple></paper-ripple>
<paper-input
invalid="[[invalid]]"
readonly
disabled="[[disabled]]"
value="[[selectedItemLabel]]"
@ -181,7 +187,9 @@ respectively.
behaviors: [
Polymer.IronControlState,
Polymer.IronButtonState
Polymer.IronButtonState,
Polymer.IronFormElementBehavior,
Polymer.IronValidatableBehavior
],
properties: {
@ -193,7 +201,7 @@ respectively.
selectedItemLabel: {
type: String,
notify: true,
computed: '_computeSelectedItemLabel(selectedItem)'
readOnly: true
},
/**
@ -209,6 +217,17 @@ respectively.
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.
*/
@ -275,6 +294,10 @@ respectively.
'aria-haspopup': 'true'
},
observers: [
'_selectedItemChanged(selectedItem)'
],
attached: function() {
// NOTE(cdata): Due to timing, a preselected value in a `IronSelectable`
// 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
* optional `label` property.
*/
_computeSelectedItemLabel: function(selectedItem) {
_selectedItemChanged: function(selectedItem) {
var value = '';
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
// template. The metrics will change depending on whether or not the
// 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);
});
});
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>

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-fab",
"version": "1.0.5",
"version": "1.0.6",
"description": "A material design floating action button",
"authors": [
"The Polymer Authors"
@ -15,24 +15,24 @@
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/paper-fab"
"url": "git://github.com/PolymerElements/paper-fab.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-fab",
"dependencies": {
"paper-ripple": "polymerelements/paper-ripple#^1.0.0",
"paper-material": "polymerelements/paper-material#^1.0.0",
"paper-behaviors": "polymerelements/paper-behaviors#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
"iron-icon": "polymerelements/iron-icon#^1.0.0",
"iron-icons": "polymerelements/iron-icons#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-icon": "PolymerElements/iron-icon#^1.0.0",
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"paper-material": "PolymerElements/paper-material#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"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": "*",
"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="../iron-icon/iron-icon.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="../paper-styles/color.html">
<link rel="import" href="../iron-icon/iron-icon.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-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)
@ -59,7 +59,6 @@ Custom property | Description | Default
<dom-module id="paper-fab">
<template strip-whitespace>
<style include="paper-material">
:host {
display: inline-block;
position: relative;
@ -109,9 +108,11 @@ Custom property | Description | Default
background: var(--paper-fab-keyboard-focus-background, --paper-pink-900);
}
</style>
<iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon>
</template>
</dom-module>
<script>
Polymer({
is: 'paper-fab',
@ -161,6 +162,5 @@ Custom property | Description | Default
reflectToAttribute: true
}
}
});
</script>

View file

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

View file

@ -1,7 +1,7 @@
{
"name": "paper-icon-button",
"private": true,
"version": "1.0.4",
"version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "A material design icon button",
"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 {
margin-left: 0px;
width: 100px;
height: 100px;
width: 116px;
height: 116px;
--paper-icon-button-ink-color: var(--paper-indigo-500);
}
</style>

View file

@ -77,8 +77,13 @@ Custom property | Description | Default
user-select: none;
cursor: pointer;
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);
}

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.15",
"version": "1.0.16",
"description": "Material design text fields",
"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 {
color: var(--paper-red-300);
--paper-icon-button-ink-color: var(--paper-red-a100);
--iron-icon-width: 15px;
--iron-icon-height: 15px;
width: 23px; /* 15px + 2*4px for padding */
height: 23px;
padding: 0px 4px;
}
</style>
@ -59,8 +59,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<div class="vertical-section">
<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 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.
*/
list: {
@ -293,6 +293,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
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: {
type: String,
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-input-color` | Input foreground color | `--primary-text-color`
`--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-focus` | Mixin applied to the label when the input is focused | `{}`
`--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-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-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
`display:inline-block`.
@ -186,6 +186,7 @@ This element is `display:block` by default, but you can set the `inline` attribu
font: inherit;
color: var(--paper-input-container-color, --secondary-text-color);
@apply(--paper-font-common-nowrap);
@apply(--paper-font-subhead);
@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;
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);
}

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">
<!--
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 label="Input label"></paper-input>
@ -35,9 +37,10 @@ for `suffix`).
<paper-icon-button suffix icon="clear"></paper-icon-button>
</paper-input>
A `paper-input` can use the native `type=search` features. However, since
we can't control the native styling of the input, it's recommended to use
a placeholder text, or `always-float-label`, as to not overlap the native search icon.
A `paper-input` can use the native `type=search` or `type=file` features.
However, since we can't control the native styling of the input, in these cases
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"
placeholder="search for cats" autosave="test" results="5">
@ -115,8 +118,10 @@ style this element.
autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]"
on-change="_onChange"
autosave$="[[autosave]]",
results$="[[results]]">
autosave$="[[autosave]]"
results$="[[results]]"
accept$="[[accept]]"
multiple$="[[multiple]]">
<content select="[suffix]"></content>

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-item",
"version": "1.0.3",
"version": "1.0.5",
"description": "A material-design styled list item",
"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:
Custom property | Description | Default
----------------|-------------|----------
`--paper-item-icon-width` | Width of the icon area | `56px`
`--paper-icon-item` | Mixin applied to the item | `{}`
Custom property | Description | Default
------------------------------|------------------------------------------------|----------
`--paper-item-icon-width` | Width of the icon area | `56px`
`--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;
}
:host > ::content > *:not(:first-child):not(:last-child) {
margin-right: 16px;
:host(.iron-selected) {
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>
</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">
<!--
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>Item</paper-item>
@ -34,10 +36,17 @@ items.
The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------|-------------|----------
`--paper-item-min-height` | Minimum height of the item | `48px`
`--paper-item` | Mixin applied to the item | `{}`
Custom property | Description | Default
------------------------------|------------------------------------------------|----------
`--paper-item-min-height` | Minimum height of the item | `48px`
`--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

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "paper-material",
"version": "1.0.2",
"version": "1.0.3",
"description": "A material design container that looks like a lifted sheet of paper",
"private": true,
"authors": [
@ -24,13 +24,13 @@
"homepage": "https://github.com/PolymerElements/paper-material",
"ignore": [],
"dependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0"
"polymer": "Polymer/polymer#^1.1.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"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">
<!--
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
create the effect of a lifted piece of paper.
@ -23,42 +24,42 @@ Example:
</paper-material>
@group Paper Elements
@class paper-material
@demo demo/index.html
-->
<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>
<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>
</template>
</dom-module>
@ -67,7 +68,6 @@ Example:
is: 'paper-material',
properties: {
/**
* 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"

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>
<link href="../../test-fixture/test-fixture.html" rel="import">
<link href="../../layout/layout.html" rel="import">
<link href="../paper-material.html" rel="import">
</head>

View file

@ -1,6 +1,6 @@
{
"name": "paper-radio-button",
"version": "1.0.9",
"version": "1.0.10",
"description": "A material design radio button",
"authors": [
"The Polymer Authors"
@ -20,24 +20,24 @@
"homepage": "https://github.com/PolymerElements/paper-radio-button",
"ignore": [],
"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",
"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"
},
"devDependencies": {
"web-component-tester": "Polymer/web-component-tester#^3.3.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",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.9",
"_release": "1.0.10",
"_resolution": {
"type": "version",
"tag": "v1.0.9",
"commit": "708d1e611ad5a7c9600a128545a88e9991fe789e"
"tag": "v1.0.10",
"commit": "85b9670b23e9fac6f2d728b433d2c1d3f691a656"
},
"_source": "git://github.com/PolymerElements/paper-radio-button.git",
"_target": "~1.0.5",

View file

@ -1,6 +1,6 @@
{
"name": "paper-radio-button",
"version": "1.0.9",
"version": "1.0.10",
"description": "A material design radio button",
"authors": [
"The Polymer Authors"
@ -20,17 +20,17 @@
"homepage": "https://github.com/PolymerElements/paper-radio-button",
"ignore": [],
"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",
"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"
},
"devDependencies": {
"web-component-tester": "Polymer/web-component-tester#^3.3.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",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.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="../paper-behaviors/paper-checked-element-behavior.html">
<link rel="import" href="../paper-ripple/paper-ripple.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)
@ -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-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-spacing` | Spacing between the label and the button | `10px`
@group Paper Elements
@element paper-radio-button
@ -68,7 +69,7 @@ Custom property | Description | Default
vertical-align: middle;
}
:host #ink {
#ink {
position: absolute;
top: -16px;
left: -16px;
@ -79,15 +80,21 @@ Custom property | Description | Default
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);
}
:host #offRadio {
#offRadio {
position: absolute;
box-sizing: content-box;
top: 0px;
left: 0px;
right: 0px;
width: 12px;
height: 12px;
border-radius: 50%;
@ -97,11 +104,12 @@ Custom property | Description | Default
transition: border-color 0.28s;
}
:host #onRadio {
#onRadio {
position: absolute;
box-sizing: content-box;
top: 4px;
left: 4px;
right: 4px;
width: 8px;
height: 8px;
border-radius: 50%;
@ -125,12 +133,17 @@ Custom property | Description | Default
position: relative;
display: inline-block;
vertical-align: middle;
margin-left: 10px;
margin-left: var(--paper-radio-button-label-spacing, 10px);
white-space: normal;
pointer-events: none;
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] {
display: none;
}
@ -162,7 +175,6 @@ Custom property | Description | Default
</div>
<div id="radioLabel"><content></content></div>
</template>
<script>
@ -205,5 +217,4 @@ Custom property | Description | Default
}
})
</script>
</dom-module>

View file

@ -1,6 +1,6 @@
{
"name": "paper-radio-group",
"version": "1.0.5",
"version": "1.0.6",
"description": "A group of material design radio buttons",
"authors": [
"The Polymer Authors"
@ -14,30 +14,30 @@
"private": true,
"repository": {
"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",
"homepage": "https://github.com/PolymerElements/paper-radio-group",
"ignore": [],
"dependencies": {
"iron-selector": "PolymerElements/iron-selector#^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"
},
"devDependencies": {
"web-component-tester": "*",
"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-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"
},
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "cab4056c58d273f0953c70cc070001c97c9950b3"
"tag": "v1.0.6",
"commit": "e52738e71ebb7ec5470de109f4aa7b419f6f72e5"
},
"_source": "git://github.com/PolymerElements/paper-radio-group.git",
"_target": "~1.0.4",

View file

@ -1,6 +1,6 @@
{
"name": "paper-radio-group",
"version": "1.0.5",
"version": "1.0.6",
"description": "A group of material design radio buttons",
"authors": [
"The Polymer Authors"
@ -14,23 +14,23 @@
"private": true,
"repository": {
"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",
"homepage": "https://github.com/PolymerElements/paper-radio-group",
"ignore": [],
"dependencies": {
"iron-selector": "PolymerElements/iron-selector#^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"
},
"devDependencies": {
"web-component-tester": "*",
"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-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"
}
}

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="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.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="../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)

View file

@ -1,6 +1,6 @@
{
"name": "paper-styles",
"version": "1.0.11",
"version": "1.0.12",
"description": "Common (global) styles for Material Design elements.",
"authors": [
"The Polymer Authors"
@ -26,13 +26,14 @@
"polymer": "Polymer/polymer#^1.0.0"
},
"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": {
"type": "version",
"tag": "v1.0.11",
"commit": "347542e9ebe3e6e5f0830ee10e1c20c12956ff2c"
"tag": "v1.0.12",
"commit": "8ac5128a38249982982b3a1b3533d417d2dd7f18"
},
"_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "paper-styles",
"version": "1.0.11",
"version": "1.0.12",
"description": "Common (global) styles for Material Design elements.",
"authors": [
"The Polymer Authors"
@ -26,6 +26,7 @@
"polymer": "Polymer/polymer#^1.0.0"
},
"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="../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>
<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>
<h1>paper-styles</h1>
<!-- FIXME remove when https://github.com/Polymer/polymer/issues/1415 is resolved -->
<dom-module id="x-demo">
<section id="default-theme">
<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 {
@apply(--paper-font-display4);
}
<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>
.paper-font-display3 {
@apply(--paper-font-display3);
}
<h3>Paragraphs</h3>
.paper-font-display2 {
@apply(--paper-font-display2);
}
<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>
.paper-font-display1 {
@apply(--paper-font-display1);
}
<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>
.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-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="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>
<section id="demo-page">
<h2>demo-pages.html</h2>
@ -351,7 +326,6 @@
<div>Calcium</div>
</div>
</div>
</section>
</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/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="default-theme.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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */
white-space: nowrap;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */
white-space: nowrap;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 45px;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 34px;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 24px;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */
white-space: nowrap;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
font-size: 16px;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */
white-space: nowrap;
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) */
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
/* @apply(--paper-font-common-expensive-kerning); */
text-rendering: optimizeLegibility;
/* @apply(--paper-font-common-nowrap); */
white-space: nowrap;
overflow: hidden;

View file

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

View file

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

View file

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

View file

@ -270,61 +270,6 @@ return currentValue === previousValue;
};
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 () {
var escapeAttrRegExp = /[&\u00A0"]/g;
var escapeDataRegExp = /[&\u00A0<>]/g;
@ -463,7 +408,7 @@ insertBefore: function (node, ref_node) {
return this._addNode(node, ref_node);
},
_addNode: function (node, ref_node) {
this._removeNodeFromHost(node, true);
this._removeNodeFromParent(node);
var addedInsertionPoint;
var root = this.getOwnerRoot();
if (root) {
@ -495,6 +440,7 @@ nativeAppendChild.call(container, node);
if (addedInsertionPoint) {
this._updateInsertionPoints(root.host);
}
this.notifyObserver();
return node;
},
removeChild: function (node) {
@ -509,6 +455,7 @@ removeFromComposedParent(container, node);
nativeRemoveChild.call(container, node);
}
}
this.notifyObserver();
return node;
},
replaceChild: function (node, ref_node) {
@ -601,6 +548,13 @@ return Boolean(node._lightChildren !== undefined);
_parentNeedsDistribution: function (parent) {
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) {
var hostNeedsDist;
var root;
@ -612,7 +566,7 @@ if (root) {
root.host._elementRemove(node);
hostNeedsDist = this._removeDistributedChildren(root, node);
}
this._removeLogicalInfo(node, node._lightParent);
this._removeLogicalInfo(node, parent);
}
this._removeOwnerShadyRoot(node);
if (root && hostNeedsDist) {
@ -731,24 +685,29 @@ getDistributedNodes: function () {
return this.node._distributedNodes || [];
},
queryDistributedElements: function (selector) {
var c$ = this.childNodes;
var c$ = this.getEffectiveChildNodes();
var list = [];
this._distributedFilter(selector, c$, list);
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
if (c.localName === CONTENT) {
this._distributedFilter(selector, factory(c).getDistributedNodes(), list);
if (c.nodeType === Node.ELEMENT_NODE && matchesSelector.call(c, selector)) {
list.push(c);
}
}
return list;
},
_distributedFilter: function (selector, list, results) {
results = results || [];
for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) {
if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) {
results.push(d);
getEffectiveChildNodes: function () {
var list = [];
var c$ = this.childNodes;
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
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 () {
while (this.childNodes.length) {
@ -792,36 +751,24 @@ d.appendChild(nc);
}
}
return n;
},
observeNodes: function (callback) {
if (callback) {
if (!this.observer) {
this.observer = this.node.localName === CONTENT ? new DomApi.DistributedNodesObserver(this) : new DomApi.EffectiveNodesObserver(this);
}
};
Object.defineProperty(DomApi.prototype, 'classList', {
get: function () {
if (!this._classList) {
this._classList = new DomApi.ClassList(this);
return this.observer.addListener(callback);
}
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();
unobserveNodes: function (handle) {
if (this.observer) {
this.observer.removeListener(handle);
}
},
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);
notifyObserver: function () {
if (this.observer) {
this.observer.notify();
}
}
};
if (!Settings.useShadow) {
@ -1003,6 +950,17 @@ return n$ ? Array.prototype.slice.call(n$) : [];
};
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, {
childNodes: {
get: function () {
@ -1056,13 +1014,17 @@ configurable: true
});
}
var CONTENT = 'content';
var factory = function (node, patch) {
function factory(node, patch) {
node = node || document;
if (!node.__domApi) {
node.__domApi = new DomApi(node, patch);
}
return node.__domApi;
};
}
;
function hasDomApi(node) {
return Boolean(node.__domApi);
}
Polymer.dom = function (obj, patch) {
if (obj instanceof Event) {
return Polymer.EventApi.factory(obj);
@ -1070,43 +1032,6 @@ return Polymer.EventApi.factory(obj);
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) {
var children = node._lightChildren;
return children ? children : node.childNodes;
@ -1170,10 +1095,399 @@ saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
matchesSelector: matchesSelector,
hasInsertionPoint: hasInsertionPoint,
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 () {
'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({
_prepShady: function () {
this._useContent = this._useContent || Boolean(this._template);
@ -1244,6 +1558,7 @@ if (this._useContent) {
this.shadyRoot._distributionClean = true;
if (hasInsertionPoint(this.shadyRoot)) {
this._composeTree();
notifyContentObservers(this.shadyRoot);
} else {
if (!this.shadyRoot._hasDistributed) {
this.textContent = '';
@ -1254,6 +1569,9 @@ var children = this._composeNode(this);
this._updateChildNodes(this, children);
}
}
if (!this.shadyRoot._hasDistributed) {
notifyInitialDistribution(this);
}
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;
function upgradeLightChildren(children) {
if (needsUpgrade && children) {

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long

View file

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

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