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

update components

Conflicts:
	MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/.bower.json
This commit is contained in:
Luke Pulverenti 2016-01-29 21:43:11 -05:00
parent d3f40bd6d9
commit 0c696294ae
42 changed files with 1514 additions and 361 deletions

View file

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.0.23", "version": "1.0.29",
"_release": "1.0.23", "_release": "1.0.29",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.0.23", "tag": "1.0.29",
"commit": "1e7c56cf54a657d72d35d36f37937231942a2685" "commit": "2e60e59d116fee68281235ba19f1e74073565c50"
}, },
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.0.0", "_target": "~1.0.0",

View file

@ -0,0 +1,415 @@
define([], function () {
function autoFocus(view, defaultToFirst) {
var element = view.querySelector('*[autofocus]');
if (element) {
focus(element);
} else if (defaultToFirst !== false) {
element = getFocusableElements(view)[0];
if (element) {
focus(element);
}
}
}
function focus(element) {
var tagName = element.tagName;
if (tagName == 'PAPER-INPUT' || tagName == 'PAPER-DROPDOWN-MENU' || tagName == 'EMBY-DROPDOWN-MENU') {
element = element.querySelector('input');
}
element.focus();
}
var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A', 'PAPER-BUTTON', 'PAPER-INPUT', 'PAPER-TEXTAREA', 'PAPER-ICON-BUTTON', 'PAPER-FAB', 'PAPER-ICON-ITEM', 'PAPER-MENU-ITEM', 'PAPER-DROPDOWN-MENU', 'EMBY-DROPDOWN-MENU'];
var focusableContainerTagNames = ['BODY', 'PAPER-DIALOG'];
var focusableQuery = focusableTagNames.join(',') + ',.focusable';
function isFocusable(elem) {
if (focusableTagNames.indexOf(elem.tagName) != -1) {
return true;
}
if (elem.classList && elem.classList.contains('focusable')) {
return true;
}
return false;
}
function focusableParent(elem) {
while (!isFocusable(elem)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function isFocusableElementValid(elem) {
if (elem.disabled) {
return false;
}
if (elem.getAttribute('tabindex') == "-1") {
return false;
}
// http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
if (elem.offsetParent === null) {
return false;
}
return true;
}
function getFocusableElements(parent) {
var elems = (parent || document).querySelectorAll(focusableQuery);
var focusableElements = [];
for (var i = 0, length = elems.length; i < length; i++) {
var elem = elems[i];
if (isFocusableElementValid(elem)) {
focusableElements.push(elem);
}
}
return focusableElements;
}
function isFocusContainer(elem, direction) {
if (focusableContainerTagNames.indexOf(elem.tagName) != -1) {
return true;
}
if (direction < 2) {
if (elem.classList.contains('focuscontainer-x')) {
return true;
}
}
else if (direction == 3) {
if (elem.classList.contains('focuscontainer-down')) {
return true;
}
}
return false;
}
function getFocusContainer(elem, direction) {
while (!isFocusContainer(elem, direction)) {
elem = elem.parentNode;
if (!elem) {
return document.body;
}
}
return elem;
}
function getOffset(elem, doc) {
var box = { top: 0, left: 0 };
if (!doc) {
return box;
}
var docElem = doc.documentElement;
// Support: BlackBerry 5, iOS 3 (original iPhone)
// If we don't have gBCR, just use 0,0 rather than error
if (elem.getBoundingClientRect) {
box = elem.getBoundingClientRect();
}
var win = doc.defaultView;
return {
top: box.top + win.pageYOffset - docElem.clientTop,
left: box.left + win.pageXOffset - docElem.clientLeft
};
}
function getViewportBoundingClientRect(elem) {
var doc = elem.ownerDocument;
var offset = getOffset(elem, doc);
var win = doc.defaultView;
var posY = offset.top - win.pageXOffset;
var posX = offset.left - win.pageYOffset;
var width = elem.offsetWidth;
var height = elem.offsetHeight;
return {
left: posX,
top: posY,
width: width,
height: height,
right: posX + width,
bottom: posY + height
};
var scrollLeft = (((t = document.documentElement) || (t = document.body.parentNode))
&& typeof t.scrollLeft == 'number' ? t : document.body).scrollLeft;
var scrollTop = (((t = document.documentElement) || (t = document.body.parentNode))
&& typeof t.scrollTop == 'number' ? t : document.body).scrollTop;
}
function nav(activeElement, direction) {
activeElement = activeElement || document.activeElement;
if (activeElement) {
activeElement = focusableParent(activeElement);
}
var container = activeElement ? getFocusContainer(activeElement, direction) : document.body;
if (!activeElement) {
autoFocus(container, true);
return;
}
var focusableContainer = parentWithClass(activeElement, 'focusable');
var rect = getViewportBoundingClientRect(activeElement);
var focusableElements = [];
var focusable = container.querySelectorAll(focusableQuery);
for (var i = 0, length = focusable.length; i < length; i++) {
var curr = focusable[i];
if (curr == activeElement) {
continue;
}
// Don't refocus into the same container
if (curr == focusableContainer) {
continue;
}
if (!isFocusableElementValid(curr)) {
continue;
}
var elementRect = getViewportBoundingClientRect(curr);
switch (direction) {
case 0:
// left
if (elementRect.left >= rect.left) {
continue;
}
if (elementRect.right == rect.right) {
continue;
}
break;
case 1:
// right
if (elementRect.right <= rect.right) {
continue;
}
if (elementRect.left == rect.left) {
continue;
}
break;
case 2:
// up
if (elementRect.top >= rect.top) {
continue;
}
if (elementRect.bottom >= rect.bottom) {
continue;
}
break;
case 3:
// down
if (elementRect.bottom <= rect.bottom) {
continue;
}
if (elementRect.top <= rect.top) {
continue;
}
break;
default:
break;
}
focusableElements.push({
element: curr,
clientRect: elementRect
});
}
var nearest = getNearestElements(focusableElements, rect, direction);
if (nearest.length) {
var nearestElement = nearest[0].node;
// See if there's a focusable container, and if so, send the focus command to that
var nearestElementFocusableParent = parentWithClass(nearestElement, 'focusable');
if (nearestElementFocusableParent && nearestElementFocusableParent != nearestElement && activeElement) {
if (parentWithClass(activeElement, 'focusable') != nearestElementFocusableParent) {
nearestElement = nearestElementFocusableParent;
}
}
focus(nearestElement);
}
}
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function getNearestElements(elementInfos, options, direction) {
// Get elements and work out x/y points
var cache = [],
point1x = parseFloat(options.left) || 0,
point1y = parseFloat(options.top) || 0,
point2x = parseFloat(point1x + options.width - 1) || point1x,
point2y = parseFloat(point1y + options.height - 1) || point1y,
// Shortcuts to help with compression
min = Math.min,
max = Math.max;
var sourceMidX = options.left + (options.width / 2);
var sourceMidY = options.top + (options.height / 2);
// Loop through all elements and check their positions
for (var i = 0, length = elementInfos.length; i < length; i++) {
var elementInfo = elementInfos[i];
var elem = elementInfo.element;
var off = elementInfo.clientRect,
x = off.left,
y = off.top,
x2 = x + off.width - 1,
y2 = y + off.height - 1,
maxX1 = max(x, point1x),
minX2 = min(x2, point2x),
maxY1 = max(y, point1y),
minY2 = min(y2, point2y),
intersectX = minX2 >= maxX1,
intersectY = minY2 >= maxY1;
var midX = off.left + (off.width / 2);
var midY = off.top + (off.height / 2);
var distX;
var distY;
switch (direction) {
case 0:
// left
distX = intersectX ? 0 : Math.abs(point1x - x2);
distY = intersectY ? 0 : Math.abs(sourceMidY - midY);
break;
case 1:
// right
distX = intersectX ? 0 : Math.abs(x - point2x);
distY = intersectY ? 0 : Math.abs(sourceMidY - midY);
break;
case 2:
// up
distY = intersectY ? 0 : Math.abs(point1y - y2);
distX = intersectX ? 0 : Math.abs(sourceMidX - midX);
break;
case 3:
// down
distY = intersectY ? 0 : Math.abs(y - point2y);
distX = intersectX ? 0 : Math.abs(sourceMidX - midX);
break;
default:
break;
}
var distT = Math.sqrt(distX * distX + distY * distY);
cache.push({
node: elem,
distX: distX,
distY: distY,
distT: distT
});
}
cache.sort(sortNodesT);
//if (direction < 2) {
// cache.sort(sortNodesX);
//} else {
// cache.sort(sortNodesY);
//}
return cache;
}
function sortNodesX(a, b) {
var result = a.distX - b.distX;
if (result == 0) {
return a.distY - b.distY;
}
return result;
}
function sortNodesT(a, b) {
return a.distT - b.distT;
}
function sortNodesY(a, b) {
var result = a.distY - b.distY;
if (result == 0) {
return a.distX - b.distX;
}
return result;
}
return {
autoFocus: autoFocus,
focus: focus,
focusableParent: focusableParent,
getFocusableElements: getFocusableElements,
moveLeft: function (sourceElement) {
nav(sourceElement, 0);
},
moveRight: function (sourceElement) {
nav(sourceElement, 1);
},
moveUp: function (sourceElement) {
nav(sourceElement, 2);
},
moveDown: function (sourceElement) {
nav(sourceElement, 3);
}
};
});

View file

@ -0,0 +1,28 @@
.paperDialog {
margin: 0;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: fixed;
max-width: none !important;
max-height: none !important;
display: flex;
align-items: center;
justify-content: center;
}
.paperDialog.scrollY {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overflow-x: hidden;
}
.paperDialog.hiddenScroll::-webkit-scrollbar {
display: none;
}
.paperDialog.hiddenScroll {
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
}

View file

@ -0,0 +1,188 @@
define(['historyManager', 'focusManager', 'performanceManager', 'browser', 'paper-dialog', 'scale-up-animation', 'fade-out-animation', 'fade-in-animation', 'css!./paperdialoghelper.css'], function (historyManager, focusManager, performanceManager, browser) {
function paperDialogHashHandler(dlg, hash, resolve, lockDocumentScroll) {
var self = this;
self.originalUrl = window.location.href;
var activeElement = document.activeElement;
function onHashChange(e) {
var isBack = self.originalUrl == window.location.href;
if (isBack || !dlg.opened) {
window.removeEventListener('popstate', onHashChange);
}
if (isBack) {
self.closedByBack = true;
dlg.close();
}
}
function onDialogClosed() {
if (lockDocumentScroll !== false) {
// TODO
//Dashboard.onPopupClose();
}
window.removeEventListener('popstate', onHashChange);
if (!self.closedByBack) {
var state = history.state || {};
if (state.dialogId == hash) {
history.back();
}
}
activeElement.focus();
if (dlg.getAttribute('data-removeonclose') == 'true') {
dlg.parentNode.removeChild(dlg);
}
//resolve();
// if we just called history.back(), then use a timeout to allow the history events to fire first
setTimeout(function () {
resolve({
element: dlg,
closedByBack: self.closedByBack
});
}, 1);
}
dlg.addEventListener('iron-overlay-closed', onDialogClosed);
dlg.open();
if (lockDocumentScroll !== false) {
// TODO
//Dashboard.onPopupOpen();
}
historyManager.pushState({ dialogId: hash }, "Dialog", hash);
window.addEventListener('popstate', onHashChange);
}
function open(dlg) {
return new Promise(function (resolve, reject) {
new paperDialogHashHandler(dlg, 'dlg' + new Date().getTime(), resolve);
});
}
function close(dlg) {
if (dlg.opened) {
history.back();
}
}
function onDialogOpened(e) {
focusManager.autoFocus(e.target);
}
function createDialog(options) {
options = options || {};
var dlg = document.createElement('paper-dialog');
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
// without this safari will scroll the background instead of the dialog contents
// but not needed here since this is already on top of an existing dialog
// but skip it in IE because it's causing the entire browser to hang
// Also have to disable for firefox because it's causing select elements to not be clickable
if (!browser.msie && !browser.firefox && options.modal !== false) {
dlg.setAttribute('modal', 'modal');
}
// seeing max call stack size exceeded in the debugger with this
dlg.setAttribute('noAutoFocus', 'noAutoFocus');
var defaultEntryAnimation = performanceManager.getAnimationPerformance() <= 1 ? 'fade-in-animation' : 'scale-up-animation';
dlg.entryAnimation = options.entryAnimation || defaultEntryAnimation;
dlg.exitAnimation = 'fade-out-animation';
dlg.animationConfig = {
// scale up
'entry': {
name: options.entryAnimation || 'scale-up-animation',
node: dlg,
timing: { duration: options.entryAnimationDuration || 300, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: options.exitAnimationDuration || 400, easing: 'ease-in' }
}
};
dlg.classList.add('paperDialog');
dlg.classList.add('scrollY');
// TODO: Don't hide for mouse?
dlg.classList.add('hiddenScroll');
if (options.removeOnClose) {
dlg.setAttribute('data-removeonclose', 'true');
}
dlg.addEventListener('iron-overlay-opened', onDialogOpened);
return dlg;
}
function positionTo(dlg, elem) {
var windowHeight = $(window).height();
// If the window height is under a certain amount, don't bother trying to position
// based on an element.
if (windowHeight >= 540) {
var pos = $(elem).offset();
pos.top += elem.offsetHeight / 2;
pos.left += elem.offsetWidth / 2;
// Account for margins
pos.top -= 24;
pos.left -= 24;
// Account for popup size - we can't predict this yet so just estimate
pos.top -= $(dlg).height() / 2;
pos.left -= $(dlg).width() / 2;
// Account for scroll position
pos.top -= $(window).scrollTop();
pos.left -= $(window).scrollLeft();
// Avoid showing too close to the bottom
pos.top = Math.min(pos.top, windowHeight - 300);
pos.left = Math.min(pos.left, $(window).width() - 300);
// Do some boundary checking
pos.top = Math.max(pos.top, 0);
pos.left = Math.max(pos.left, 0);
dlg.style.position = 'fixed';
dlg.style.left = pos.left + 'px';
dlg.style.top = pos.top + 'px';
}
}
return {
open: open,
close: close,
createDialog: createDialog,
positionTo: positionTo
};
});

View file

@ -0,0 +1,15 @@
define(['browser'], function (browser) {
function getAnimationPerformance() {
if (browser.mobile) {
return 1;
}
return 5;
}
return {
getAnimationPerformance: getAnimationPerformance
};
});

View file

@ -29,14 +29,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/PolymerElements/iron-behaviors", "homepage": "https://github.com/polymerelements/iron-behaviors",
"_release": "1.0.12", "_release": "1.0.12",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.12", "tag": "v1.0.12",
"commit": "657f526a2382a659cdf4e13be87ecc89261588a3" "commit": "657f526a2382a659cdf4e13be87ecc89261588a3"
}, },
"_source": "git://github.com/PolymerElements/iron-behaviors.git", "_source": "git://github.com/polymerelements/iron-behaviors.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-behaviors" "_originalSource": "polymerelements/iron-behaviors"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-overlay-behavior", "name": "iron-overlay-behavior",
"version": "1.1.2", "version": "1.2.0",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay", "description": "Provides a behavior for making an element an overlay",
"private": true, "private": true,
@ -29,16 +29,16 @@
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/polymerelements/iron-overlay-behavior", "homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.1.2", "_release": "1.2.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.2", "tag": "v1.2.0",
"commit": "40e39a971474f48f5c2c8ee7b8568a0ad5426bd8" "commit": "1d8e1d29c601add9c135e5103c4d1d0d652dd957"
}, },
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git", "_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,22 +1,25 @@
language: node_js language: node_js
sudo: false sudo: false
before_script: before_script:
- npm install web-component-tester - npm install -g bower polylint web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- bower install - bower install
- polylint
env: env:
global: global:
- secure: H8AA9JkWfG/vc3MiimoIoYi45KD10hKzitLJnExkomgzFI/f5o9SGtwjCii5P8Kvf4xndftDjYwRgbYyJpSg0IJeq8rm1WS89cY8O6/1dlI/tK1j5xbVRrhqmRQncxUb3K4MAT6Z9br1jwEeamRa+NKmq+v+VEpQY5vwuQ/BHJw= - secure: H8AA9JkWfG/vc3MiimoIoYi45KD10hKzitLJnExkomgzFI/f5o9SGtwjCii5P8Kvf4xndftDjYwRgbYyJpSg0IJeq8rm1WS89cY8O6/1dlI/tK1j5xbVRrhqmRQncxUb3K4MAT6Z9br1jwEeamRa+NKmq+v+VEpQY5vwuQ/BHJw=
- secure: EaE1AUVgWyn0Y6kqkb54z5r39RvTJzAOmeM0lRl7wXzr5k0mq3VGlxTksJqCVd1PdJESXEhy8eldBnlkwZir/imDTNQxKm13k7ZiFC0000XAzpLZElkH2cLlYCRWcuM+vS7dA9hytV0UcGK2VGqbxfpcesB20dPSneDEUuc5X64= - secure: EaE1AUVgWyn0Y6kqkb54z5r39RvTJzAOmeM0lRl7wXzr5k0mq3VGlxTksJqCVd1PdJESXEhy8eldBnlkwZir/imDTNQxKm13k7ZiFC0000XAzpLZElkH2cLlYCRWcuM+vS7dA9hytV0UcGK2VGqbxfpcesB20dPSneDEUuc5X64=
node_js: 4 - CXX=g++-4.8
node_js: stable
addons: addons:
firefox: latest firefox: latest
apt: apt:
sources: sources:
- google-chrome - google-chrome
- ubuntu-toolchain-r-test
packages: packages:
- google-chrome-stable - google-chrome-stable
- g++-4.8
sauce_connect: true
script: script:
- xvfb-run wct - xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-overlay-behavior", "name": "iron-overlay-behavior",
"version": "1.1.2", "version": "1.2.0",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay", "description": "Provides a behavior for making an element an overlay",
"private": true, "private": true,
@ -29,7 +29,7 @@
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [] "ignore": []

View file

@ -85,13 +85,18 @@ Custom property | Description | Default
}, },
listeners: {
'transitionend' : '_onTransitionend'
},
/** /**
* Appends the backdrop to document body and sets its `z-index` to be below the latest overlay. * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
*/ */
prepare: function() { prepare: function() {
// Always update z-index
this.style.zIndex = this._manager.backdropZ();
if (!this.parentNode) { if (!this.parentNode) {
Polymer.dom(document.body).appendChild(this); Polymer.dom(document.body).appendChild(this);
this.style.zIndex = this._manager.currentOverlayZ() - 1;
} }
}, },
@ -109,9 +114,14 @@ Custom property | Description | Default
* Hides the backdrop if needed. * Hides the backdrop if needed.
*/ */
close: function() { close: function() {
// only need to make the backdrop invisible if this is called by the last overlay with a backdrop // Always update z-index
if (this._manager.getBackdrops().length < 2) { this.style.zIndex = this._manager.backdropZ();
// close only if no element with backdrop is left
if (this._manager.getBackdrops().length === 0) {
this._setOpened(false); this._setOpened(false);
// complete() will be called after the transition is done.
// If animations are disabled via custom-styles, user is expected to call
// complete() after close()
} }
}, },
@ -123,6 +133,12 @@ Custom property | Description | Default
if (this._manager.getBackdrops().length === 0 && this.parentNode) { if (this._manager.getBackdrops().length === 0 && this.parentNode) {
Polymer.dom(this.parentNode).removeChild(this); Polymer.dom(this.parentNode).removeChild(this);
} }
},
_onTransitionend: function (event) {
if (event && event.target === this) {
this.complete();
}
} }
}); });

View file

@ -80,8 +80,8 @@ context. You should place this element as a child of `<body>` whenever possible.
* Set to true to display a backdrop behind the overlay. * Set to true to display a backdrop behind the overlay.
*/ */
withBackdrop: { withBackdrop: {
type: Boolean, observer: '_withBackdropChanged',
value: false type: Boolean
}, },
/** /**
@ -148,17 +148,13 @@ context. You should place this element as a child of `<body>` whenever possible.
* @type Node * @type Node
*/ */
get backdropElement() { get backdropElement() {
return this._backdrop; return this._manager.backdropElement;
}, },
get _focusNode() { get _focusNode() {
return Polymer.dom(this).querySelector('[autofocus]') || this; return Polymer.dom(this).querySelector('[autofocus]') || this;
}, },
registered: function() {
this._backdrop = document.createElement('iron-overlay-backdrop');
},
ready: function() { ready: function() {
this._ensureSetup(); this._ensureSetup();
}, },
@ -172,7 +168,7 @@ context. You should place this element as a child of `<body>` whenever possible.
detached: function() { detached: function() {
this.opened = false; this.opened = false;
this._completeBackdrop(); this._manager.trackBackdrop(this);
this._manager.removeOverlay(this); this._manager.removeOverlay(this);
}, },
@ -180,6 +176,7 @@ context. You should place this element as a child of `<body>` whenever possible.
* Toggle the opened state of the overlay. * Toggle the opened state of the overlay.
*/ */
toggle: function() { toggle: function() {
this._setCanceled(false);
this.opened = !this.opened; this.opened = !this.opened;
}, },
@ -187,16 +184,16 @@ context. You should place this element as a child of `<body>` whenever possible.
* Open the overlay. * Open the overlay.
*/ */
open: function() { open: function() {
this._setCanceled(false);
this.opened = true; this.opened = true;
this.closingReason = {canceled: false};
}, },
/** /**
* Close the overlay. * Close the overlay.
*/ */
close: function() { close: function() {
this.opened = false;
this._setCanceled(false); this._setCanceled(false);
this.opened = false;
}, },
/** /**
@ -208,8 +205,8 @@ context. You should place this element as a child of `<body>` whenever possible.
return; return;
} }
this.opened = false;
this._setCanceled(true); this._setCanceled(true);
this.opened = false;
}, },
_ensureSetup: function() { _ensureSetup: function() {
@ -226,6 +223,7 @@ context. You should place this element as a child of `<body>` whenever possible.
this.removeAttribute('aria-hidden'); this.removeAttribute('aria-hidden');
} else { } else {
this.setAttribute('aria-hidden', 'true'); this.setAttribute('aria-hidden', 'true');
Polymer.dom(this).unobserveNodes(this._observer);
} }
// wait to call after ready only if we're initially open // wait to call after ready only if we're initially open
@ -233,30 +231,32 @@ context. You should place this element as a child of `<body>` whenever possible.
this._callOpenedWhenReady = this.opened; this._callOpenedWhenReady = this.opened;
return; return;
} }
if (this._openChangedAsync) {
this.cancelAsync(this._openChangedAsync);
}
this._toggleListeners(); this._manager.trackBackdrop(this);
if (this.opened) { if (this.opened) {
this._prepareRenderOpened(); this._prepareRenderOpened();
} }
// async here to allow overlay layer to become visible. if (this._openChangedAsync) {
this.cancelAsync(this._openChangedAsync);
}
// Async here to allow overlay layer to become visible, and to avoid
// listeners to immediately close via a click.
this._openChangedAsync = this.async(function() { this._openChangedAsync = this.async(function() {
// overlay becomes visible here // overlay becomes visible here
this.style.display = ''; this.style.display = '';
// force layout to ensure transitions will go // Force layout to ensure transition will go. Set offsetWidth to itself
/** @suppress {suspiciousCode} */ this.offsetWidth; // so that compilers won't remove it.
this.offsetWidth = this.offsetWidth;
if (this.opened) { if (this.opened) {
this._renderOpened(); this._renderOpened();
} else { } else {
this._renderClosed(); this._renderClosed();
} }
this._toggleListeners();
this._openChangedAsync = null; this._openChangedAsync = null;
}); }, 1);
}, },
_canceledChanged: function() { _canceledChanged: function() {
@ -264,6 +264,21 @@ context. You should place this element as a child of `<body>` whenever possible.
this.closingReason.canceled = this.canceled; this.closingReason.canceled = this.canceled;
}, },
_withBackdropChanged: function() {
if (this.opened) {
this._manager.trackBackdrop(this);
if (this.withBackdrop) {
this.backdropElement.prepare();
// Give time to be added to document.
this.async(function(){
this.backdropElement.open();
}, 1);
} else {
this.backdropElement.close();
}
}
},
_toggleListener: function(enable, node, event, boundListener, capture) { _toggleListener: function(enable, node, event, boundListener, capture) {
if (enable) { if (enable) {
// enable document-wide tap recognizer // enable document-wide tap recognizer
@ -280,30 +295,22 @@ context. You should place this element as a child of `<body>` whenever possible.
} }
}, },
_toggleListeners: function() { _toggleListeners: function () {
if (this._toggleListenersAsync) { this._toggleListener(this.opened, document, 'tap', this._boundOnCaptureClick, true);
this.cancelAsync(this._toggleListenersAsync); this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true);
}
// async so we don't auto-close immediately via a click.
this._toggleListenersAsync = this.async(function() {
this._toggleListener(this.opened, document, 'tap', this._boundOnCaptureClick, true);
this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true);
this._toggleListenersAsync = null;
}, 1);
}, },
// tasks which must occur before opening; e.g. making the element visible // tasks which must occur before opening; e.g. making the element visible
_prepareRenderOpened: function() { _prepareRenderOpened: function() {
this._manager.addOverlay(this); this._manager.addOverlay(this);
if (this.withBackdrop) {
this.backdropElement.prepare();
this._manager.trackBackdrop(this);
}
this._preparePositioning(); this._preparePositioning();
this.fit(); this.fit();
this._finishPositioning(); this._finishPositioning();
if (this.withBackdrop) {
this.backdropElement.prepare();
}
}, },
// tasks which cause the overlay to actually open; typically play an // tasks which cause the overlay to actually open; typically play an
@ -322,52 +329,24 @@ context. You should place this element as a child of `<body>` whenever possible.
this._finishRenderClosed(); this._finishRenderClosed();
}, },
_onTransitionend: function(event) {
// make sure this is our transition event.
if (event && event.target !== this) {
return;
}
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
},
_finishRenderOpened: function() { _finishRenderOpened: function() {
// focus the child node with [autofocus] // focus the child node with [autofocus]
if (!this.noAutoFocus) { this._applyFocus();
this._focusNode.focus();
}
this._observer = Polymer.dom(this).observeNodes(this.notifyResize);
this.fire('iron-overlay-opened'); this.fire('iron-overlay-opened');
this._squelchNextResize = true;
this.async(this.notifyResize);
}, },
_finishRenderClosed: function() { _finishRenderClosed: function() {
// hide the overlay and remove the backdrop // hide the overlay and remove the backdrop
this.resetFit(); this.resetFit();
this.style.display = 'none'; this.style.display = 'none';
this._completeBackdrop();
this._manager.removeOverlay(this); this._manager.removeOverlay(this);
this._focusNode.blur(); this._applyFocus();
// focus the next overlay, if there is one
this._manager.focusOverlay();
this.notifyResize();
this.fire('iron-overlay-closed', this.closingReason); this.fire('iron-overlay-closed', this.closingReason);
this._squelchNextResize = true;
this.async(this.notifyResize);
},
_completeBackdrop: function() {
if (this.withBackdrop) {
this._manager.trackBackdrop(this);
this.backdropElement.complete();
}
}, },
_preparePositioning: function() { _preparePositioning: function() {
@ -396,8 +375,8 @@ context. You should place this element as a child of `<body>` whenever possible.
}, },
_onCaptureClick: function(event) { _onCaptureClick: function(event) {
if (!this.noCancelOnOutsideClick && if (this._manager.currentOverlay() === this &&
this._manager.currentOverlay() === this && !this.noCancelOnOutsideClick &&
Polymer.dom(event).path.indexOf(this) === -1) { Polymer.dom(event).path.indexOf(this) === -1) {
this.cancel(); this.cancel();
} }
@ -405,18 +384,14 @@ context. You should place this element as a child of `<body>` whenever possible.
_onCaptureKeydown: function(event) { _onCaptureKeydown: function(event) {
var ESC = 27; var ESC = 27;
if (!this.noCancelOnEscKey && (event.keyCode === ESC)) { if (this._manager.currentOverlay() === this &&
!this.noCancelOnEscKey &&
event.keyCode === ESC) {
this.cancel(); this.cancel();
event.stopPropagation();
event.stopImmediatePropagation();
} }
}, },
_onIronResize: function() { _onIronResize: function() {
if (this._squelchNextResize) {
this._squelchNextResize = false;
return;
}
if (this.opened) { if (this.opened) {
this.refit(); this.refit();
} }

View file

@ -12,104 +12,148 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script> <script>
Polymer.IronOverlayManager = { /**
* @struct
_overlays: [], * @constructor
*/
// iframes have a default z-index of 100, so this default should be at least Polymer.IronOverlayManagerClass = function() {
// that. this._overlays = [];
_minimumZ: 101,
_backdrops: [],
_applyOverlayZ: function(overlay, aboveZ) {
this._setZ(overlay, aboveZ + 2);
},
_setZ: function(element, z) {
element.style.zIndex = z;
},
// track overlays for z-index and focus managemant
addOverlay: function(overlay) {
var minimumZ = Math.max(this.currentOverlayZ(), this._minimumZ);
this._overlays.push(overlay);
var newZ = this.currentOverlayZ();
if (newZ <= minimumZ) {
this._applyOverlayZ(overlay, minimumZ);
}
},
removeOverlay: function(overlay) {
var i = this._overlays.indexOf(overlay);
if (i >= 0) {
this._overlays.splice(i, 1);
this._setZ(overlay, '');
}
},
currentOverlay: function() {
var i = this._overlays.length - 1;
while (this._overlays[i] && !this._overlays[i].opened) {
--i;
}
return this._overlays[i];
},
currentOverlayZ: function() {
var z = this._minimumZ;
var current = this.currentOverlay();
if (current) {
var z1 = window.getComputedStyle(current).zIndex;
if (!isNaN(z1)) {
z = Number(z1);
}
}
return z;
},
/** /**
* Ensures that the minimum z-index of new overlays is at least `minimumZ`. * iframes have a default z-index of 100, so this default should be at least
* This does not effect the z-index of any existing overlays. * that.
* * @private {number}
* @param {number} minimumZ
*/ */
ensureMinimumZ: function(minimumZ) { this._minimumZ = 101;
this._minimumZ = Math.max(this._minimumZ, minimumZ);
},
focusOverlay: function() { this._backdrops = [];
var current = this.currentOverlay(); }
// We have to be careful to focus the next overlay _after_ any current
// transitions are complete (due to the state being toggled prior to the
// transition). Otherwise, we risk infinite recursion when a transitioning
// (closed) overlay becomes the current overlay.
//
// NOTE: We make the assumption that any overlay that completes a transition
// will call into focusOverlay to kick the process back off. Currently:
// transitionend -> _applyFocus -> focusOverlay.
if (current && !current.transitioning) {
current._applyFocus();
}
},
trackBackdrop: function(element) {
// backdrops contains the overlays with a backdrop that are currently
// visible
if (element.opened) {
this._backdrops.push(element);
} else {
var index = this._backdrops.indexOf(element);
if (index >= 0) {
this._backdrops.splice(index, 1);
}
}
},
getBackdrops: function() {
return this._backdrops;
}
Polymer.IronOverlayManagerClass.prototype._applyOverlayZ = function(overlay, aboveZ) {
this._setZ(overlay, aboveZ + 2);
}; };
Polymer.IronOverlayManagerClass.prototype._setZ = function(element, z) {
element.style.zIndex = z;
};
/**
* track overlays for z-index and focus managemant
*/
Polymer.IronOverlayManagerClass.prototype.addOverlay = function(overlay) {
var minimumZ = Math.max(this.currentOverlayZ(), this._minimumZ);
this._overlays.push(overlay);
var newZ = this.currentOverlayZ();
if (newZ <= minimumZ) {
this._applyOverlayZ(overlay, minimumZ);
}
};
Polymer.IronOverlayManagerClass.prototype.removeOverlay = function(overlay) {
var i = this._overlays.indexOf(overlay);
if (i >= 0) {
this._overlays.splice(i, 1);
this._setZ(overlay, '');
}
};
Polymer.IronOverlayManagerClass.prototype.currentOverlay = function() {
var i = this._overlays.length - 1;
while (this._overlays[i] && !this._overlays[i].opened) {
--i;
}
return this._overlays[i];
};
Polymer.IronOverlayManagerClass.prototype.currentOverlayZ = function() {
return this._getOverlayZ(this.currentOverlay());
};
/**
* Ensures that the minimum z-index of new overlays is at least `minimumZ`.
* This does not effect the z-index of any existing overlays.
*
* @param {number} minimumZ
*/
Polymer.IronOverlayManagerClass.prototype.ensureMinimumZ = function(minimumZ) {
this._minimumZ = Math.max(this._minimumZ, minimumZ);
};
Polymer.IronOverlayManagerClass.prototype.focusOverlay = function() {
var current = this.currentOverlay();
// We have to be careful to focus the next overlay _after_ any current
// transitions are complete (due to the state being toggled prior to the
// transition). Otherwise, we risk infinite recursion when a transitioning
// (closed) overlay becomes the current overlay.
//
// NOTE: We make the assumption that any overlay that completes a transition
// will call into focusOverlay to kick the process back off. Currently:
// transitionend -> _applyFocus -> focusOverlay.
if (current && !current.transitioning) {
current._applyFocus();
}
};
Polymer.IronOverlayManagerClass.prototype.trackBackdrop = function(element) {
// backdrops contains the overlays with a backdrop that are currently
// visible
var index = this._backdrops.indexOf(element);
if (element.opened && element.withBackdrop) {
// no duplicates
if (index === -1) {
this._backdrops.push(element);
}
} else if (index >= 0) {
this._backdrops.splice(index, 1);
}
};
Object.defineProperty(Polymer.IronOverlayManagerClass.prototype, "backdropElement", {
get: function() {
if (!this._backdropElement) {
this._backdropElement = document.createElement('iron-overlay-backdrop');
}
return this._backdropElement;
}
});
Polymer.IronOverlayManagerClass.prototype.getBackdrops = function() {
return this._backdrops;
};
/**
* Returns the z-index for the backdrop.
*/
Polymer.IronOverlayManagerClass.prototype.backdropZ = function() {
return this._getOverlayZ(this._overlayWithBackdrop()) - 1;
};
/**
* Returns the first opened overlay that has a backdrop.
*/
Polymer.IronOverlayManagerClass.prototype._overlayWithBackdrop = function() {
for (var i = 0; i < this._overlays.length; i++) {
if (this._overlays[i].opened && this._overlays[i].withBackdrop) {
return this._overlays[i];
}
}
};
/**
* Calculates the minimum z-index for the overlay.
*/
Polymer.IronOverlayManagerClass.prototype._getOverlayZ = function(overlay) {
var z = this._minimumZ;
if (overlay) {
var z1 = Number(window.getComputedStyle(overlay).zIndex);
// Check if is a number
// Number.isNaN not supported in IE 10+
if (z1 === z1) {
z = z1;
}
}
return z;
};
Polymer.IronOverlayManager = new Polymer.IronOverlayManagerClass();
</script> </script>

View file

@ -1,5 +1,4 @@
<!doctype html> <!DOCTYPE html><!--
<!--
@license @license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 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.txt This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
@ -7,9 +6,7 @@ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--> --><html><head>
<html>
<head>
<title>iron-overlay-behavior tests</title> <title>iron-overlay-behavior tests</title>
@ -23,12 +20,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body> <body>
<script> <script>
WCT.loadSuites([ WCT.loadSuites([
'iron-overlay-behavior.html', 'iron-overlay-behavior.html',
'iron-overlay-behavior.html?dom=shadow'
]); ]);
</script> </script>
</body>
</html>
</body></html>

View file

@ -22,6 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../web-component-tester/browser.js"></script> <script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html"> <link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
<link rel="import" href="test-overlay.html"> <link rel="import" href="test-overlay.html">
<link rel="import" href="test-overlay2.html">
</head> </head>
<body> <body>
@ -79,6 +80,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template> </template>
</test-fixture> </test-fixture>
<test-fixture id="backdrop-different-elements">
<template>
<test-overlay with-backdrop class="overlay-1">
Overlay 1 with backdrop
</test-overlay>
<test-overlay2 with-backdrop class="overlay-2">
Overlay 2 with backdrop
</test-overlay2>
</template>
</test-fixture>
<script> <script>
function runAfterOpen(overlay, cb) { function runAfterOpen(overlay, cb) {
@ -113,8 +125,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlay = fixture('opened'); overlay = fixture('opened');
overlay.addEventListener('iron-overlay-opened', function() { overlay.addEventListener('iron-overlay-opened', function() {
var s = getComputedStyle(overlay); var s = getComputedStyle(overlay);
assert.isTrue(parseFloat(s.left) === (window.innerWidth - overlay.offsetWidth)/2, 'centered horizontally'); assert.equal(parseFloat(s.left), (window.innerWidth - overlay.offsetWidth)/2, 'centered horizontally');
assert.isTrue(parseFloat(s.top) === (window.innerHeight - overlay.offsetHeight)/2, 'centered vertically'); assert.equal(parseFloat(s.top), (window.innerHeight - overlay.offsetHeight)/2, 'centered vertically');
done(); done();
}); });
}); });
@ -136,6 +148,60 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlay.opened = true; overlay.opened = true;
}); });
test('open overlay refits on iron-resize', function() {
var overlay = fixture('opened');
var spy = sinon.spy(overlay, 'refit');
overlay.fire('iron-resize');
assert.isTrue(spy.called, 'overlay should refit');
});
test('closed overlay does not refit on iron-resize', function() {
var spy = sinon.spy(overlay, 'refit');
overlay.fire('iron-resize');
assert.isFalse(spy.called, 'overlay should not refit');
});
test('open() triggers iron-resize', function(done) {
// Ignore iron-resize triggered by window resize.
var callCount = 0;
window.addEventListener('resize', function() { callCount--; }, true);
overlay.addEventListener('iron-resize', function () { callCount++; });
runAfterOpen(overlay, function () {
assert.equal(callCount, 1, 'iron-resize should be called once');
done();
});
});
test('closed overlay does not trigger iron-resize when its content changes', function(done) {
// Ignore iron-resize triggered by window resize.
var callCount = 0;
window.addEventListener('resize', function() { callCount--; }, true);
overlay.addEventListener('iron-resize', function () { callCount++; });
var child = document.createElement('div');
child.innerHTML = 'hi';
Polymer.dom(overlay).appendChild(child);
overlay.async(function () {
assert.equal(callCount, 0, 'iron-resize should not be called');
done();
}, 10);
});
test('open overlay triggers iron-resize when its content changes', function(done) {
runAfterOpen(overlay, function () {
// Ignore iron-resize triggered by window resize.
var callCount = 0;
window.addEventListener('resize', function() { callCount--; }, true);
overlay.addEventListener('iron-resize', function () { callCount++; });
var child = document.createElement('div');
child.innerHTML = 'hi';
Polymer.dom(overlay).appendChild(child);
overlay.async(function () {
assert.equal(callCount, 1, 'iron-resize should be called once');
done();
}, 10);
});
});
test('close an overlay quickly after open', function(done) { test('close an overlay quickly after open', function(done) {
// first, open the overlay // first, open the overlay
overlay.open(); overlay.open();
@ -169,11 +235,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('clicking an overlay does not close it', function(done) { test('clicking an overlay does not close it', function(done) {
runAfterOpen(overlay, function() { runAfterOpen(overlay, function() {
overlay.addEventListener('iron-overlay-closed', function() { var spy = sinon.stub();
assert('iron-overlay-closed should not fire'); overlay.addEventListener('iron-overlay-closed', spy);
});
overlay.fire('click'); overlay.fire('click');
setTimeout(function() { setTimeout(function() {
assert.isFalse(spy.called, 'iron-overlay-closed should not fire');
done(); done();
}, 10); }, 10);
}); });
@ -211,13 +277,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlay.addEventListener('iron-overlay-canceled', function(event) { overlay.addEventListener('iron-overlay-canceled', function(event) {
event.preventDefault(); event.preventDefault();
}); });
var closedListener = function(event) { var spy = sinon.stub();
throw new Error('iron-overlay-closed should not fire'); overlay.addEventListener('iron-overlay-closed', spy);
};
overlay.addEventListener('iron-overlay-closed', closedListener);
MockInteractions.tap(document.body); MockInteractions.tap(document.body);
setTimeout(function() { setTimeout(function() {
overlay.removeEventListener('iron-overlay-closed', closedListener); assert.isFalse(spy.called, 'iron-overlay-closed should not fire');
done(); done();
}, 10); }, 10);
}); });
@ -249,11 +313,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('no-cancel-on-outside-click property', function(done) { test('no-cancel-on-outside-click property', function(done) {
overlay.noCancelOnOutsideClick = true; overlay.noCancelOnOutsideClick = true;
runAfterOpen(overlay, function() { runAfterOpen(overlay, function() {
overlay.addEventListener('iron-overlay-closed', function() { var spy = sinon.stub();
assert('iron-overlay-closed should not fire'); overlay.addEventListener('iron-overlay-closed', spy);
});
MockInteractions.tap(document.body); MockInteractions.tap(document.body);
setTimeout(function() { setTimeout(function() {
assert.isFalse(spy.called, 'iron-overlay-closed should not fire');
done(); done();
}, 10); }, 10);
}); });
@ -262,13 +326,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('no-cancel-on-esc-key property', function(done) { test('no-cancel-on-esc-key property', function(done) {
overlay.noCancelOnEscKey = true; overlay.noCancelOnEscKey = true;
runAfterOpen(overlay, function() { runAfterOpen(overlay, function() {
overlay.addEventListener('iron-overlay-closed', function() { var spy = sinon.stub();
assert('iron-overlay-cancel should not fire'); overlay.addEventListener('iron-overlay-closed', spy);
});
fireEvent('keydown', { fireEvent('keydown', {
keyCode: 27 keyCode: 27
}, document); }, document);
setTimeout(function() { setTimeout(function() {
assert.isFalse(spy.called, 'iron-overlay-cancel should not fire');
done(); done();
}, 10); }, 10);
}); });
@ -383,6 +447,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
Polymer.dom(backdrop.parentNode).removeChild(backdrop); Polymer.dom(backdrop.parentNode).removeChild(backdrop);
Polymer.dom.flush(); Polymer.dom.flush();
assert.isNull(backdrop.parentNode, 'backdrop is removed from DOM'); assert.isNull(backdrop.parentNode, 'backdrop is removed from DOM');
assert.lengthOf(document.querySelectorAll('iron-overlay-backdrop'), (0));
done(); done();
}); });
}); });
@ -393,6 +458,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
done(); done();
}); });
}); });
test('manager backdrops immediately updated on opened changes', function() {
overlays[0].opened = true;
assert.equal(overlays[0]._manager.getBackdrops().length, 1, 'overlay added to manager backdrops');
overlays[0].opened = false;
assert.equal(overlays[0]._manager.getBackdrops().length, 0, 'overlay removed from manager backdrops');
});
}); });
suite('multiple overlays with backdrop', function() { suite('multiple overlays with backdrop', function() {
@ -419,8 +491,72 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('updating with-backdrop to false closes backdrop', function(done) {
runAfterOpen(overlays[0], function() {
overlays[0].withBackdrop = false;
// Don't wait for animations.
overlays[0].backdropElement.complete();
assert.isFalse(overlays[0].backdropElement.opened, 'backdrop is closed');
assert.isNotObject(overlays[0].backdropElement.parentNode, 'backdrop is removed from document');
done();
});
});
test('updating with-backdrop updates z-index', function(done) {
runAfterOpen(overlays[0], function() {
runAfterOpen(overlays[1], function() {
overlays[0].withBackdrop = false;
var styleZ = parseInt(window.getComputedStyle(overlays[0]).zIndex, 10);
var style1Z = parseInt(window.getComputedStyle(overlays[1]).zIndex, 10);
var bgStyleZ = parseInt(window.getComputedStyle(overlays[0].backdropElement).zIndex, 10);
assert.isTrue(style1Z > bgStyleZ, 'overlays[1] has higher z-index than backdrop');
assert.isTrue(styleZ < bgStyleZ, 'overlays[0] has lower z-index than backdrop');
done();
});
});
});
}); });
suite('multiple overlays with backdrop implemented in different elements', function () {
var overlays;
setup(function() {
overlays = fixture('backdrop-different-elements');
});
test('multiple overlays share the same backdrop', function() {
assert.equal(overlays[0].backdropElement, overlays[1].backdropElement);
});
test('when overlays close, the backdrop is closed', function(done) {
runAfterOpen(overlays[0], function () {
assert.lengthOf(document.querySelectorAll('iron-overlay-backdrop'), 1);
// After second overlay is closed, both backdrops should be hidden
overlays[1].addEventListener('iron-overlay-closed', function() {
Polymer.Base.async(function () {
assert.isFalse(overlays[1].backdropElement.opened, 'second overlay backdrop is closed');
assert.isFalse(overlays[0].backdropElement.opened, 'first overlay backdrop is closed');
done();
}, 1);
});
// After second overlay is opened, immediately close it
overlays[1].addEventListener('iron-overlay-opened', function() {
Polymer.Base.async(function () {
overlays[1].close();
}, 1);
});
// Immediately close first overlay and open the other one
overlays[0].close();
overlays[1].open();
});
});
})
suite('a11y', function() { suite('a11y', function() {
test('overlay has aria-hidden=true when opened', function() { test('overlay has aria-hidden=true when opened', function() {

View file

@ -0,0 +1,49 @@
<!--
@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.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-overlay-behavior.html">
<dom-module id="test-overlay2">
<style>
:host {
background: white;
color: black;
border: 1px solid black;
}
</style>
<template>
<content></content>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'test-overlay2',
behaviors: [
Polymer.IronOverlayBehavior
]
});
})();
</script>

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-selector", "name": "iron-selector",
"version": "1.0.8", "version": "1.1.0",
"description": "Manages a set of elements that can be selected", "description": "Manages a set of elements that can be selected",
"private": true, "private": true,
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
@ -27,16 +27,16 @@
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0", "iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4", "paper-styles": "PolymerElements/paper-styles#^1.0.4",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.8", "_release": "1.1.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.8", "tag": "v1.1.0",
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff" "commit": "abd9ee7c29f0aae7b583abfe0af9db7f2555eabf"
}, },
"_source": "git://github.com/polymerelements/iron-selector.git", "_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-selector" "_originalSource": "PolymerElements/iron-selector"
} }

View file

@ -1,28 +1,25 @@
language: node_js language: node_js
sudo: false sudo: false
matrix:
include:
- node_js: stable
script: xvfb-run wct
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
- node_js: node
script:
- |
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
wct -s 'default'
fi
before_script: before_script:
- npm install web-component-tester - npm install -g bower polylint web-component-tester
- npm install bower - bower install
- export PATH=$PWD/node_modules/.bin:$PATH - polylint
- bower install
env: env:
global: global:
- secure: ltCkwJM0nkTS9WjikyjqBsB5J2hQon4UnVVrINk4y+Vq4v9PQJH3+83nya0jnxilKaeAJs4d2/OS02F9GkqYpsSmDz7OgXPfk0hrHA8UksvvpSALfnukleIAN2YTOcxXJKeNHcfpqCKPk1dGeNQOEM61H+QgTBIyFB3sMugygqs= - secure: ltCkwJM0nkTS9WjikyjqBsB5J2hQon4UnVVrINk4y+Vq4v9PQJH3+83nya0jnxilKaeAJs4d2/OS02F9GkqYpsSmDz7OgXPfk0hrHA8UksvvpSALfnukleIAN2YTOcxXJKeNHcfpqCKPk1dGeNQOEM61H+QgTBIyFB3sMugygqs=
- secure: TJuu1WdpFLTaBN/prBafm8Pld/BQCySNuuG1nATbF3fqiOpgehXu8Z5URAz5syUhqZAyEmuRMxvXpEVD/t1jrtaXVwkdCFkkQ4ckkP4gTIeSGA/Puw8sveB2q7QAqXyTmeFkocNlh8fxV+B07o0SPWdhcvdZnDVU9VrpSqL+92M= - secure: TJuu1WdpFLTaBN/prBafm8Pld/BQCySNuuG1nATbF3fqiOpgehXu8Z5URAz5syUhqZAyEmuRMxvXpEVD/t1jrtaXVwkdCFkkQ4ckkP4gTIeSGA/Puw8sveB2q7QAqXyTmeFkocNlh8fxV+B07o0SPWdhcvdZnDVU9VrpSqL+92M=
- CXX=g++-4.8
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -0,0 +1,72 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
-->
# Polymer Elements
## Guide for Contributors
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
### Filing Issues
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
1. **Who will use the feature?** _“As someone filling out a form…”_
2. **When will they use the feature?** _“When I enter an invalid value…”_
3. **What is the users goal?** _“I want to be visually notified that the value needs to be corrected…”_
**If you are filing an issue to report a bug**, please provide:
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
```markdown
The `paper-foo` element causes the page to turn pink when clicked.
## Expected outcome
The page stays the same color.
## Actual outcome
The page turns pink.
## Steps to reproduce
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
### Submitting Pull Requests
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, #40
```
2. **A succinct description of the design** used to fix any related issues. For example:
```markdown
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
```
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so dont be afraid to ask us if you need help with that!

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-selector", "name": "iron-selector",
"version": "1.0.8", "version": "1.1.0",
"description": "Manages a set of elements that can be selected", "description": "Manages a set of elements that can be selected",
"private": true, "private": true,
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
@ -27,7 +27,7 @@
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0", "iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4", "paper-styles": "PolymerElements/paper-styles#^1.0.4",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
} }
} }

View file

@ -54,7 +54,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `value` will be toggled; otherwise the `value` will be selected. * `value` will be toggled; otherwise the `value` will be selected.
* *
* @method select * @method select
* @param {string} value the value to select. * @param {string|number} value the value to select.
*/ */
select: function(value) { select: function(value) {
if (this.multi) { if (this.multi) {

View file

@ -56,6 +56,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* Gets or sets the selected element. The default is to use the index of the item. * Gets or sets the selected element. The default is to use the index of the item.
* @type {string|number}
*/ */
selected: { selected: {
type: String, type: String,
@ -173,7 +174,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Selects the given value. * Selects the given value.
* *
* @method select * @method select
* @param {string} value the value to select. * @param {string|number} value the value to select.
*/ */
select: function(value) { select: function(value) {
this.selected = value; this.selected = value;

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-behaviors", "name": "paper-behaviors",
"version": "1.0.10", "version": "1.0.11",
"description": "Common behaviors across the paper elements", "description": "Common behaviors across the paper elements",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -27,23 +27,23 @@
"dependencies": { "dependencies": {
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0", "iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0", "iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"polymer": "Polymer/polymer#^1.2.1" "polymer": "Polymer/polymer#^1.2.1"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0", "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0", "iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"paper-material": "PolymerElements/paper-material#^1.0.0", "paper-material": "PolymerElements/paper-material#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "^3.4.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"_release": "1.0.10", "_release": "1.0.11",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.10", "tag": "v1.0.11",
"commit": "4b244a542af2c6c271498dfb98b00ed284df1d6a" "commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5"
}, },
"_source": "git://github.com/PolymerElements/paper-behaviors.git", "_source": "git://github.com/PolymerElements/paper-behaviors.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,22 +1,25 @@
language: node_js language: node_js
sudo: false sudo: false
before_script: before_script:
- npm install web-component-tester - npm install -g bower polylint web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- bower install - bower install
- polylint
env: env:
global: global:
- secure: Mni8srJPpo7GAk5wCLTiqqVqAJxxKMpGuxYxooqIAuc050n26KkHfDWLPY69taFY9WYjU3pzVEwrYX3HqSbib1CTlcfeATGs1+q2rXKZKmBAnKKPi12CEEXOcbMoVgzVQs7rzr8MQF9LR2TLtBuMQEoAimebA7uQcYGXcSWKJR4= - secure: Mni8srJPpo7GAk5wCLTiqqVqAJxxKMpGuxYxooqIAuc050n26KkHfDWLPY69taFY9WYjU3pzVEwrYX3HqSbib1CTlcfeATGs1+q2rXKZKmBAnKKPi12CEEXOcbMoVgzVQs7rzr8MQF9LR2TLtBuMQEoAimebA7uQcYGXcSWKJR4=
- secure: LYF3qBtJ6zZcf9dsSJ9t/My4Cne5ieI6RkHFj/0MBcy0vMbUazTH38vuy+FILYlrzbaxkVs36lPQFBXH83Ue3TxjdfjeNvK8YiuEcFjE5lQi2u7+x54eSV3myp2SIdtBLGE7rqmY0zj/Oeg91fV22OdfSHhJxuV/RxFFZIuZtHY= - secure: LYF3qBtJ6zZcf9dsSJ9t/My4Cne5ieI6RkHFj/0MBcy0vMbUazTH38vuy+FILYlrzbaxkVs36lPQFBXH83Ue3TxjdfjeNvK8YiuEcFjE5lQi2u7+x54eSV3myp2SIdtBLGE7rqmY0zj/Oeg91fV22OdfSHhJxuV/RxFFZIuZtHY=
node_js: 4 - CXX=g++-4.8
node_js: stable
addons: addons:
firefox: latest firefox: latest
apt: apt:
sources: sources:
- google-chrome - google-chrome
- ubuntu-toolchain-r-test
packages: packages:
- google-chrome-stable - google-chrome-stable
- g++-4.8
sauce_connect: true
script: script:
- xvfb-run wct - xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-behaviors", "name": "paper-behaviors",
"version": "1.0.10", "version": "1.0.11",
"description": "Common behaviors across the paper elements", "description": "Common behaviors across the paper elements",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -27,15 +27,15 @@
"dependencies": { "dependencies": {
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0", "iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0", "iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"polymer": "Polymer/polymer#^1.2.1" "polymer": "Polymer/polymer#^1.2.1"
}, },
"devDependencies": { "devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0", "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0", "iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"paper-material": "PolymerElements/paper-material#^1.0.0", "paper-material": "PolymerElements/paper-material#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "^3.4.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [] "ignore": []

View file

@ -9,7 +9,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
--> -->
<link rel="import" href="../../polymer/polymer.html"> <link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-checked-element-behavior.html"> <link rel="import" href="../paper-checked-element-behavior.html">
<dom-module id="paper-radio-button"> <dom-module id="paper-radio-button">

View file

@ -60,7 +60,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
_computeKeyboardClass: function(receivedFocusFromKeyboard) { _computeKeyboardClass: function(receivedFocusFromKeyboard) {
this.classList.toggle('keyboard-focus', receivedFocusFromKeyboard); this.toggleClass('keyboard-focus', receivedFocusFromKeyboard);
}, },
/** /**
@ -71,7 +71,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/ */
_spaceKeyDownHandler: function(event) { _spaceKeyDownHandler: function(event) {
Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event); Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event);
if (this.hasRipple()) { // Ensure that there is at most one ripple when the space key is held down.
if (this.hasRipple() && this.getRipple().ripples.length < 1) {
this._ripple.uiDownAction(); this._ripple.uiDownAction();
} }
}, },

View file

@ -78,6 +78,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(button.elevation, 3); assert.equal(button.elevation, 3);
assert.ok(button.hasRipple()); assert.ok(button.hasRipple());
}); });
test('space key', function(done) {
const SPACE_KEY_CODE = 32;
var ripple;
MockInteractions.focus(button);
assert.ok(button.hasRipple());
ripple = button.getRipple();
MockInteractions.keyDownOn(button, SPACE_KEY_CODE);
assert.equal(ripple.ripples.length, 1);
MockInteractions.keyDownOn(button, SPACE_KEY_CODE);
assert.equal(ripple.ripples.length, 1);
MockInteractions.keyUpOn(button, SPACE_KEY_CODE);
var transitionEndCalled = false;
ripple.addEventListener('transitionend', function() {
if (!transitionEndCalled) {
transitionEndCalled = true;
assert.equal(ripple.ripples.length, 0);
done();
}
});
});
}); });
</script> </script>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-dialog-behavior", "name": "paper-dialog-behavior",
"version": "1.1.0", "version": "1.1.1",
"description": "Implements a behavior used for material design dialogs", "description": "Implements a behavior used for material design dialogs",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [
@ -21,7 +21,7 @@
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0", "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4", "paper-styles": "PolymerElements/paper-styles#^1.1.0",
"polymer": "Polymer/polymer#^1.1.0" "polymer": "Polymer/polymer#^1.1.0"
}, },
"devDependencies": { "devDependencies": {
@ -29,14 +29,14 @@
"paper-button": "PolymerElements/paper-button#^1.0.0", "paper-button": "PolymerElements/paper-button#^1.0.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0", "paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.1.0", "_release": "1.1.1",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.0", "tag": "v1.1.1",
"commit": "e41d36a798df2ee2f9f49fb27dd7712e55366595" "commit": "5831039e9f878c63478064abed115c98992b5504"
}, },
"_source": "git://github.com/PolymerElements/paper-dialog-behavior.git", "_source": "git://github.com/PolymerElements/paper-dialog-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,28 +1,26 @@
language: node_js language: node_js
sudo: false sudo: false
matrix:
include:
- node_js: stable
script: xvfb-run wct
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
- node_js: node
script:
- |
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
wct -s 'default'
fi
before_script: before_script:
- npm install web-component-tester - npm install -g bower polylint web-component-tester
- npm install bower - bower install
- export PATH=$PWD/node_modules/.bin:$PATH - polylint
- bower install
env: env:
global: global:
- secure: ZBrrZGA8OWY95x8yHSsKUNrQfowhRe/s/pMZhHgnoppnZ1+bDfpoms+ggOdvH0TgURAAdF+1Wq1mTCgNp0FYLJ3Oe34XseDIxiA3wXSQO/E2m4Cfj/w4fRvaSy8ikdz5urQJET33SjDKdggm1FmWmnt6vSVgW/mg8M7AW2KWDcE= - secure: ZBrrZGA8OWY95x8yHSsKUNrQfowhRe/s/pMZhHgnoppnZ1+bDfpoms+ggOdvH0TgURAAdF+1Wq1mTCgNp0FYLJ3Oe34XseDIxiA3wXSQO/E2m4Cfj/w4fRvaSy8ikdz5urQJET33SjDKdggm1FmWmnt6vSVgW/mg8M7AW2KWDcE=
- secure: P5UKkTar39Q1k0VwtF5LhOphqNiW3r+DSnN1vRNA4oKZPrt6l3dJE1hpA9+1x1m6SryG856lLekPM6/fVZuC7nyDKFLz4vU/EWhiGdyWN1lHhE2MDh281TsCtzK56S0uJxdmlIpSiWTFWIrrEiiewN2b8dXy3FSPfy0Fo1sGn54= - secure: P5UKkTar39Q1k0VwtF5LhOphqNiW3r+DSnN1vRNA4oKZPrt6l3dJE1hpA9+1x1m6SryG856lLekPM6/fVZuC7nyDKFLz4vU/EWhiGdyWN1lHhE2MDh281TsCtzK56S0uJxdmlIpSiWTFWIrrEiiewN2b8dXy3FSPfy0Fo1sGn54=
- CXX=g++-4.8
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
script:
- xvfb-run wct -l chrome
- xvfb-run wct -l firefox
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-dialog-behavior", "name": "paper-dialog-behavior",
"version": "1.1.0", "version": "1.1.1",
"description": "Implements a behavior used for material design dialogs", "description": "Implements a behavior used for material design dialogs",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [
@ -21,7 +21,7 @@
"ignore": [], "ignore": [],
"dependencies": { "dependencies": {
"iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0", "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4", "paper-styles": "PolymerElements/paper-styles#^1.1.0",
"polymer": "Polymer/polymer#^1.1.0" "polymer": "Polymer/polymer#^1.1.0"
}, },
"devDependencies": { "devDependencies": {
@ -29,7 +29,7 @@
"paper-button": "PolymerElements/paper-button#^1.0.0", "paper-button": "PolymerElements/paper-button#^1.0.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0", "paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0", "test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
} }
} }

View file

@ -24,7 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../paper-styles/demo-pages.html"> <link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../../paper-button/paper-button.html"> <link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html"> <link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html">
<style is="custom-style"> <style is="custom-style">
.centered { .centered {
text-align: center; text-align: center;
@ -48,11 +48,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<h2>Alert</h2> <h2>Alert</h2>
<p>Discard draft?</p> <p>Discard draft?</p>
<div class="buttons"> <div class="buttons">
<paper-button data-dialog="multiple">More details</paper-button>
<paper-button dialog-dismiss>Cancel</paper-button> <paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm autofocus>Discard</paper-button> <paper-button dialog-confirm autofocus>Discard</paper-button>
</div> </div>
</simple-dialog> </simple-dialog>
<simple-dialog id="multiple" modal>
<h2>Details</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<paper-button dialog-confirm autofocus>OK</paper-button>
</simple-dialog>
<button data-dialog="scrolling">scrolling</button> <button data-dialog="scrolling">scrolling</button>
<simple-dialog id="scrolling"> <simple-dialog id="scrolling">

View file

@ -113,25 +113,13 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
}, },
attached: function() { attached: function() {
this._observer = this._observe(this); // this._observer is used by iron-overlay-behavior
this._ariaObserver = Polymer.dom(this).observeNodes(this._updateAriaLabelledBy);
this._updateAriaLabelledBy(); this._updateAriaLabelledBy();
}, },
detached: function() { detached: function() {
if (this._observer) { Polymer.dom(this).unobserveNodes(this._ariaObserver);
this._observer.disconnect();
}
},
_observe: function(node) {
var observer = new MutationObserver(function() {
this._updateAriaLabelledBy();
}.bind(this));
observer.observe(node, {
childList: true,
subtree: true
});
return observer;
}, },
_modalChanged: function() { _modalChanged: function() {
@ -175,57 +163,52 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
}, },
_onDialogClick: function(event) { _onDialogClick: function(event) {
var target = event.target; var target = Polymer.dom(event).rootTarget;
while (target && target !== this) { while (target && target !== this) {
if (target.hasAttribute) { if (target.hasAttribute) {
if (target.hasAttribute('dialog-dismiss')) { if (target.hasAttribute('dialog-dismiss')) {
this._updateClosingReasonConfirmed(false); this._updateClosingReasonConfirmed(false);
this.close(); this.close();
event.stopPropagation();
break; break;
} else if (target.hasAttribute('dialog-confirm')) { } else if (target.hasAttribute('dialog-confirm')) {
this._updateClosingReasonConfirmed(true); this._updateClosingReasonConfirmed(true);
this.close(); this.close();
event.stopPropagation();
break; break;
} }
} }
target = target.parentNode; target = Polymer.dom(target).parentNode;
} }
}, },
_onIronOverlayOpened: function() { _onIronOverlayOpened: function() {
if (this.modal) { if (this.modal) {
document.body.addEventListener('focus', this._boundOnFocus, true); document.body.addEventListener('focus', this._boundOnFocus, true);
this.backdropElement.addEventListener('click', this._boundOnBackdropClick); document.body.addEventListener('click', this._boundOnBackdropClick, true);
} }
}, },
_onIronOverlayClosed: function() { _onIronOverlayClosed: function() {
this._lastFocusedElement = null;
document.body.removeEventListener('focus', this._boundOnFocus, true); document.body.removeEventListener('focus', this._boundOnFocus, true);
this.backdropElement.removeEventListener('click', this._boundOnBackdropClick); document.body.removeEventListener('click', this._boundOnBackdropClick, true);
}, },
_onFocus: function(event) { _onFocus: function(event) {
if (this.modal) { if (this.modal && this._manager.currentOverlay() === this) {
var target = event.target; if (Polymer.dom(event).path.indexOf(this) !== -1) {
while (target && target !== this && target !== document.body) { this._lastFocusedElement = event.target;
target = target.parentNode; } else if (this._lastFocusedElement) {
} this._lastFocusedElement.focus();
if (target) { } else {
if (target === document.body) { this._focusNode.focus();
if (this._lastFocusedElement) {
this._lastFocusedElement.focus();
} else {
this._focusNode.focus();
}
} else {
this._lastFocusedElement = event.target;
}
} }
} }
}, },
_onBackdropClick: function() { _onBackdropClick: function(event) {
if (this.modal) { if (this.modal && this._manager.currentOverlay() === this && Polymer.dom(event).path.indexOf(this) === -1) {
if (this._lastFocusedElement) { if (this._lastFocusedElement) {
this._lastFocusedElement.focus(); this._lastFocusedElement.focus();
} else { } else {

View file

@ -51,7 +51,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 8px 8px 24px; padding: 8px 8px 8px 24px;
margin: 0; margin: 0;
color: var(--paper-dialog-button-color, --default-primary-color); color: var(--paper-dialog-button-color, --primary-color);
@apply(--layout-horizontal); @apply(--layout-horizontal);
@apply(--layout-end-justified); @apply(--layout-end-justified);

View file

@ -54,7 +54,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 8px 8px 24px; padding: 8px 8px 8px 24px;
margin: 0; margin: 0;
color: var(--paper-dialog-button-color, --default-primary-color); color: var(--paper-dialog-button-color, --primary-color);
@apply(--layout-horizontal); @apply(--layout-horizontal);
@apply(--layout-end-justified); @apply(--layout-end-justified);

View file

@ -1,5 +1,4 @@
<!doctype html> <!DOCTYPE html><!--
<!--
@license @license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 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.txt This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
@ -7,9 +6,7 @@ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--> --><html><head>
<html>
<head>
<title>paper-dialog tests</title> <title>paper-dialog tests</title>
@ -23,12 +20,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body> <body>
<script> <script>
WCT.loadSuites([ WCT.loadSuites([
'paper-dialog-behavior.html' 'paper-dialog-behavior.html',
'paper-dialog-behavior.html?dom=shadow'
]); ]);
</script> </script>
</body>
</html>
</body></html>

View file

@ -24,6 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../test-fixture/test-fixture.html"> <link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="test-dialog.html"> <link rel="import" href="test-dialog.html">
<link rel="import" href="test-buttons.html">
</head> </head>
<body> <body>
@ -41,6 +42,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template> </template>
</test-fixture> </test-fixture>
<test-fixture id="buttons">
<template>
<test-dialog>
<p>Dialog with test-buttons</p>
<test-buttons class="buttons"></test-buttons>
</test-dialog>
</template>
</test-fixture>
<test-fixture id="modal"> <test-fixture id="modal">
<template> <template>
<test-dialog modal> <test-dialog modal>
@ -89,6 +99,37 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template> </template>
</test-fixture> </test-fixture>
<test-fixture id="multiple">
<template>
<test-dialog modal id="dialog1">
<p>Dialog 1</p>
</test-dialog>
<test-dialog modal id="dialog2">
<p>Dialog 2</p>
</test-dialog>
</template>
</test-fixture>
<test-fixture id="nestedmodals">
<template>
<test-dialog modal opened>
<p>Dialog 1</p>
<div class="buttons">
<button dialog-dismiss>dismiss</button>
<button dialog-confirm autofocus>confirm</button>
</div>
<test-dialog modal opened>
<p>Dialog 2</p>
<div class="buttons">
<button dialog-dismiss>dismiss</button>
<button dialog-confirm autofocus>confirm</button>
</div>
</test-dialog>
</test-dialog>
</template>
</test-fixture>
<script> <script>
function runAfterOpen(dialog, cb) { function runAfterOpen(dialog, cb) {
@ -125,6 +166,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('dialog-dismiss button inside a custom element is handled', function(done) {
var dialog = fixture('buttons');
runAfterOpen(dialog, function() {
dialog.addEventListener('iron-overlay-closed', function(event) {
assert.isFalse(event.detail.canceled, 'dialog is not canceled');
assert.isFalse(event.detail.confirmed, 'dialog is not confirmed');
done();
});
Polymer.dom(dialog).querySelector('test-buttons').$.dismiss.click();
// We don't wait too long to fail.
setTimeout(function didNotClose() {
done(new Error('dialog-dismiss click did not close overlay'));
}, 20);
});
});
test('clicking dialog-confirm button closes the dialog with confirmation', function(done) { test('clicking dialog-confirm button closes the dialog with confirmation', function(done) {
var dialog = fixture('basic'); var dialog = fixture('basic');
runAfterOpen(dialog, function() { runAfterOpen(dialog, function() {
@ -137,13 +194,44 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('with-backdrop works', function() { test('dialog-confirm button inside a custom element is handled', function(done) {
var dialog = fixture('backdrop'); var dialog = fixture('buttons');
runAfterOpen(dialog, function() { runAfterOpen(dialog, function() {
assert.isTrue(dialog.backdropElement.opened, 'backdrop is open'); dialog.addEventListener('iron-overlay-closed', function(event) {
assert.isFalse(event.detail.canceled, 'dialog is not canceled');
assert.isTrue(event.detail.confirmed, 'dialog is confirmed');
done();
});
Polymer.dom(dialog).querySelector('test-buttons').$.confirm.click();
// We don't wait too long to fail.
setTimeout(function didNotClose() {
done(new Error('dialog-confirm click did not close overlay'));
}, 20);
}); });
}); });
test('clicking dialog-dismiss button closes only the dialog where is contained', function(done) {
var dialog = fixture('nestedmodals');
var innerDialog = Polymer.dom(dialog).querySelector('test-dialog');
Polymer.dom(innerDialog).querySelector('[dialog-dismiss]').click();
setTimeout(function() {
assert.isFalse(innerDialog.opened, 'inner dialog is closed');
assert.isTrue(dialog.opened, 'dialog is still open');
done();
}, 10);
});
test('clicking dialog-confirm button closes only the dialog where is contained', function(done) {
var dialog = fixture('nestedmodals');
var innerDialog = Polymer.dom(dialog).querySelector('test-dialog');
Polymer.dom(innerDialog).querySelector('[dialog-confirm]').click();
setTimeout(function() {
assert.isFalse(innerDialog.opened, 'inner dialog is closed');
assert.isTrue(dialog.opened, 'dialog is still open');
done();
}, 10);
});
test('modal dialog has backdrop', function() { test('modal dialog has backdrop', function() {
var dialog = fixture('modal'); var dialog = fixture('modal');
assert.isTrue(dialog.withBackdrop, 'withBackdrop is true'); assert.isTrue(dialog.withBackdrop, 'withBackdrop is true');
@ -157,7 +245,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('clicking outside a modal dialog does not move focus from dialog', function(done) { test('clicking outside a modal dialog does not move focus from dialog', function(done) {
var dialog = fixture('modal'); var dialog = fixture('modal');
runAfterOpen(dialog, function() { runAfterOpen(dialog, function() {
dialog.backdropElement.click(); document.body.click();
setTimeout(function() { setTimeout(function() {
assert.equal(document.activeElement, Polymer.dom(dialog).querySelector('[autofocus]'), 'document.activeElement is the autofocused button'); assert.equal(document.activeElement, Polymer.dom(dialog).querySelector('[autofocus]'), 'document.activeElement is the autofocused button');
done(); done();
@ -178,6 +266,76 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('multiple modal dialogs opened, handle focus change', function(done) {
var dialogs = fixture('multiple');
var focusChange = sinon.stub();
document.body.addEventListener('focus', focusChange, true);
runAfterOpen(dialogs[0], function() {
// Wait 10ms to allow focus changes
dialogs[1].async(dialogs[1].open, 10);
dialogs[1].addEventListener('iron-overlay-opened', function() {
// Wait 10ms to allow focus changes
setTimeout(function() {
// Should not enter in an infinite loop.
assert.equal(focusChange.callCount, 2, 'focus change count');
done();
}, 10);
});
});
});
test('multiple modal dialogs opened, handle backdrop click', function(done) {
var dialogs = fixture('multiple');
var focusChange = sinon.stub();
document.body.addEventListener('focus', focusChange, true);
runAfterOpen(dialogs[0], function() {
// Wait 10ms to allow focus changes
dialogs[1].async(dialogs[1].open, 10);
dialogs[1].addEventListener('iron-overlay-opened', function() {
// This will trigger click listener for both dialogs.
document.body.click();
// Wait 10ms to allow focus changes
setTimeout(function() {
// Should not enter in an infinite loop.
assert.equal(focusChange.callCount, 2, 'focus change count');
done();
}, 10);
});
});
});
test('focus is given to the autofocus element when clicking on backdrop', function(done) {
var dialog = fixture('modal');
dialog.addEventListener('iron-overlay-opened', onFirstOpen);
dialog.open();
function onFirstOpen() {
dialog.removeEventListener('iron-overlay-opened', onFirstOpen);
dialog.addEventListener('iron-overlay-closed', onFirstClose);
// Set the focus on dismiss button
// Calling .focus() won't trigger the dialog._onFocus
Polymer.dom(dialog).querySelector('[dialog-dismiss]').dispatchEvent(new Event('focus'));
// Close the dialog
dialog.close();
}
function onFirstClose() {
dialog.removeEventListener('iron-overlay-closed', onFirstClose);
dialog.addEventListener('iron-overlay-opened', onSecondOpen);
dialog.open();
}
function onSecondOpen() {
document.body.click();
setTimeout(function() {
assert.equal(document.activeElement, Polymer.dom(dialog).querySelector('[autofocus]'), 'document.activeElement is the autofocused button');
done();
}, 10);
}
});
}); });
suite('a11y', function() { suite('a11y', function() {

View file

@ -0,0 +1,30 @@
<!--
@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.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<dom-module id="test-buttons">
<template>
<button dialog-dismiss id="dismiss">dismiss</button>
<button dialog-confirm id="confirm">confirm</button>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'test-buttons'
});
})();
</script>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-styles", "name": "paper-styles",
"version": "1.1.2", "version": "1.1.3",
"description": "Common (global) styles for Material Design elements.", "description": "Common (global) styles for Material Design elements.",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -27,13 +27,14 @@
}, },
"devDependencies": { "devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0" "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"web-component-tester": "^4.0.0"
}, },
"_release": "1.1.2", "_release": "1.1.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.2", "tag": "v1.1.3",
"commit": "7b97fa9d2c190bec9ef2d771d91f47b40a27f3be" "commit": "6239484bc25ca1f56e7263ac952c63edd8298853"
}, },
"_source": "git://github.com/PolymerElements/paper-styles.git", "_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

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

View file

@ -168,6 +168,10 @@
@apply(--shadow-elevation-8dp); @apply(--shadow-elevation-8dp);
} }
.shadow-12dp {
@apply(--shadow-elevation-12dp);
}
.shadow-16dp { .shadow-16dp {
@apply(--shadow-elevation-16dp); @apply(--shadow-elevation-16dp);
} }
@ -262,6 +266,7 @@
<div class="shadow shadow-4dp">4dp</div> <div class="shadow shadow-4dp">4dp</div>
<div class="shadow shadow-6dp">6dp</div> <div class="shadow shadow-6dp">6dp</div>
<div class="shadow shadow-8dp">8dp</div> <div class="shadow shadow-8dp">8dp</div>
<div class="shadow shadow-12dp">12dp</div>
<div class="shadow shadow-16dp">16dp</div> <div class="shadow shadow-16dp">16dp</div>
</section> </section>

View file

@ -54,6 +54,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
0 5px 5px -3px rgba(0, 0, 0, 0.4); 0 5px 5px -3px rgba(0, 0, 0, 0.4);
}; };
--shadow-elevation-12dp: {
box-shadow: 0 12px 16px 1px rgba(0, 0, 0, 0.14),
0 4px 22px 3px rgba(0, 0, 0, 0.12),
0 6px 7px -4px rgba(0, 0, 0, 0.4);
};
--shadow-elevation-16dp: { --shadow-elevation-16dp: {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14),
0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 6px 30px 5px rgba(0, 0, 0, 0.12),

View file

@ -26,14 +26,14 @@
"web-component-tester": "*" "web-component-tester": "*"
}, },
"private": true, "private": true,
"homepage": "https://github.com/Polymer/polymer", "homepage": "https://github.com/polymer/polymer",
"_release": "1.2.4", "_release": "1.2.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.2.4", "tag": "v1.2.4",
"commit": "284332a905ddd60eab11901a82ac037976175cf8" "commit": "284332a905ddd60eab11901a82ac037976175cf8"
}, },
"_source": "git://github.com/Polymer/polymer.git", "_source": "git://github.com/polymer/polymer.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "Polymer/polymer" "_originalSource": "polymer/polymer"
} }