update components

This commit is contained in:
Luke Pulverenti 2015-11-18 21:35:08 -05:00
parent 8c9287d505
commit aa272fb404
106 changed files with 1733 additions and 554 deletions

View file

@ -1,12 +1,10 @@
{
"name": "iron-overlay-behavior",
"version": "1.0.9",
"version": "1.1.1",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,
"main": [
"iron-overlay-behavior.html"
],
"main": "iron-overlay-behavior.html",
"keywords": [
"web-components",
"polymer",
@ -31,15 +29,16 @@
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.0.9",
"_release": "1.1.1",
"_resolution": {
"type": "version",
"tag": "v1.0.9",
"commit": "87f7763d323fffa07357a08777ad831b7c2c2fb8"
"tag": "v1.1.1",
"commit": "1ed1603ce820456feab3f62ae86f8f3ec801d131"
},
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0",

View file

@ -0,0 +1,22 @@
language: node_js
sudo: false
before_script:
- npm install web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- bower install
env:
global:
- secure: H8AA9JkWfG/vc3MiimoIoYi45KD10hKzitLJnExkomgzFI/f5o9SGtwjCii5P8Kvf4xndftDjYwRgbYyJpSg0IJeq8rm1WS89cY8O6/1dlI/tK1j5xbVRrhqmRQncxUb3K4MAT6Z9br1jwEeamRa+NKmq+v+VEpQY5vwuQ/BHJw=
- secure: EaE1AUVgWyn0Y6kqkb54z5r39RvTJzAOmeM0lRl7wXzr5k0mq3VGlxTksJqCVd1PdJESXEhy8eldBnlkwZir/imDTNQxKm13k7ZiFC0000XAzpLZElkH2cLlYCRWcuM+vS7dA9hytV0UcGK2VGqbxfpcesB20dPSneDEUuc5X64=
node_js: 4
addons:
firefox: '42.0'
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
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,12 +1,10 @@
{
"name": "iron-overlay-behavior",
"version": "1.0.9",
"version": "1.1.1",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,
"main": [
"iron-overlay-behavior.html"
],
"main": "iron-overlay-behavior.html",
"keywords": [
"web-components",
"polymer",
@ -31,7 +29,8 @@
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
},
"ignore": []
}

View file

@ -19,14 +19,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../iron-flex-layout/classes/iron-flex-layout.html">
<!-- <link rel="import" href="../core-transition/core-transition-css.html"> -->
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="simple-overlay.html">
<link rel="import" href="../../paper-styles/paper-styles.html">
<link rel="import" href="../../paper-styles/demo-pages.html">
<style>
<style is="custom-style">
.with-margin {
margin: 24px 40px;
@ -40,6 +37,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overflow: auto;
}
.vertical {
@apply(--layout-vertical);
}
.flex {
@apply(--layout-flex);
}
</style>
</head>
@ -78,7 +82,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<button data-dialog="scrolling-2">scrolling 2</button>
<simple-overlay id="scrolling-2" class="with-margin full-height layout vertical">
<simple-overlay id="scrolling-2" class="with-margin full-height vertical">
<p>This dialog has a scrolling child.</p>
<div class="flex scrollable">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing 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>

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="../iron-overlay-behavior.html">
<dom-module id="simple-overlay">

View file

@ -433,6 +433,12 @@ context. You should place this element as a child of `<body>` whenever possible.
* @event iron-overlay-opened
*/
/**
* Fired when the `iron-overlay` is canceled, but before it is closed.
* Cancel the event to prevent the `iron-overlay` from closing.
* @event iron-overlay-canceled
*/
/**
* Fired after the `iron-overlay` closes.
* @event iron-overlay-closed

View file

@ -12,60 +12,74 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script>
Polymer.IronOverlayManager = (function() {
Polymer.IronOverlayManager = {
var overlays = [];
var DEFAULT_Z = 10;
var backdrops = [];
_overlays: [],
// iframes have a default z-index of 100, so this default should be at least
// that.
_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
function addOverlay(overlay) {
var z0 = currentOverlayZ();
overlays.push(overlay);
var z1 = currentOverlayZ();
if (z1 <= z0) {
applyOverlayZ(overlay, z0);
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);
}
}
},
function removeOverlay(overlay) {
var i = overlays.indexOf(overlay);
removeOverlay: function(overlay) {
var i = this._overlays.indexOf(overlay);
if (i >= 0) {
overlays.splice(i, 1);
setZ(overlay, '');
this._overlays.splice(i, 1);
this._setZ(overlay, '');
}
}
},
function applyOverlayZ(overlay, aboveZ) {
setZ(overlay, aboveZ + 2);
}
function setZ(element, z) {
element.style.zIndex = z;
}
function currentOverlay() {
var i = overlays.length - 1;
while (overlays[i] && !overlays[i].opened) {
currentOverlay: function() {
var i = this._overlays.length - 1;
while (this._overlays[i] && !this._overlays[i].opened) {
--i;
}
return overlays[i];
}
return this._overlays[i];
},
function currentOverlayZ() {
var z;
var current = currentOverlay();
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 || DEFAULT_Z;
}
return z;
},
function focusOverlay() {
var current = 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
*/
ensureMinimumZ: function(minimumZ) {
this._minimumZ = Math.max(this._minimumZ, minimumZ);
},
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
@ -77,35 +91,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (current && !current.transitioning) {
current._applyFocus();
}
}
},
function trackBackdrop(element) {
trackBackdrop: function(element) {
// backdrops contains the overlays with a backdrop that are currently
// visible
if (element.opened) {
backdrops.push(element);
this._backdrops.push(element);
} else {
var index = backdrops.indexOf(element);
var index = this._backdrops.indexOf(element);
if (index >= 0) {
backdrops.splice(index, 1);
this._backdrops.splice(index, 1);
}
}
},
getBackdrops: function() {
return this._backdrops;
}
function getBackdrops() {
return backdrops;
}
return {
addOverlay: addOverlay,
removeOverlay: removeOverlay,
currentOverlay: currentOverlay,
currentOverlayZ: currentOverlayZ,
focusOverlay: focusOverlay,
trackBackdrop: trackBackdrop,
getBackdrops: getBackdrops
};
})();
};
</script>

View file

@ -20,10 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="../../iron-test-helpers/test-helpers.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="test-overlay.html">
</head>
@ -287,6 +284,52 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
suite('z-ordering', function() {
var overlays;
var originalMinimumZ;
setup(function() {
overlays = fixture('multiple');
originalMinimumZ = Polymer.IronOverlayManager._minimumZ;
});
teardown(function() {
Polymer.IronOverlayManager._minimumZ = originalMinimumZ;
});
// for iframes
test('default z-index is greater than 100', function(done) {
runAfterOpen(overlays[0], function() {
var styleZ = parseInt(window.getComputedStyle(overlays[0]).zIndex, 10);
assert.isTrue(styleZ > 100, 'overlays[0] z-index is <= 100');
done();
});
});
test('ensureMinimumZ() effects z-index', function(done) {
Polymer.IronOverlayManager.ensureMinimumZ(1000);
runAfterOpen(overlays[0], function() {
var styleZ = parseInt(window.getComputedStyle(overlays[0]).zIndex, 10);
assert.isTrue(styleZ > 1000, 'overlays[0] z-index is <= 1000');
done();
});
});
test('ensureMinimumZ() never decreases the minimum z-index', function(done) {
Polymer.IronOverlayManager.ensureMinimumZ(1000);
Polymer.IronOverlayManager.ensureMinimumZ(500);
runAfterOpen(overlays[0], function() {
var styleZ = parseInt(window.getComputedStyle(overlays[0]).zIndex, 10);
assert.isTrue(styleZ > 1000, 'overlays[0] z-index is <= 1000');
done();
});
});
});
suite('overlays with backdrop', function() {
var overlays;