mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update polymer
This commit is contained in:
parent
8119b930e4
commit
cbb6337b41
74 changed files with 2195 additions and 1393 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-ripple",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"description": "Adds a material design ripple to any container",
|
||||
"private": true,
|
||||
|
@ -28,14 +28,15 @@
|
|||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polymerelements/paper-ripple",
|
||||
"_release": "1.0.2",
|
||||
"_release": "1.0.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.2",
|
||||
"commit": "b546dbe6ad0b1f58cac80caec3136cf3232e12fc"
|
||||
"tag": "v1.0.3",
|
||||
"commit": "c6e9664ca79c74bbd4219077438c4d163d6be962"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-ripple",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"description": "Adds a material design ripple to any container",
|
||||
"private": true,
|
||||
|
@ -28,6 +28,7 @@
|
|||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,6 +250,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<paper-ripple></paper-ripple>
|
||||
</div>
|
||||
|
||||
<div class="button raised" noink>
|
||||
<div class="center" fit>NO INK</div>
|
||||
<paper-ripple noink></paper-ripple>
|
||||
</div>
|
||||
|
||||
<div class="button raised grey">
|
||||
<div class="center" fit>CANCEL</div>
|
||||
<paper-ripple></paper-ripple>
|
||||
|
|
|
@ -11,19 +11,26 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
|
||||
<!--
|
||||
Material design: [Surface reaction](https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-surface-reaction)
|
||||
|
||||
`paper-ripple` provides a visual effect that other paper elements can
|
||||
use to simulate a rippling effect emanating from the point of contact. The
|
||||
effect can be visualized as a concentric circle with motion.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-ripple></paper-ripple>
|
||||
<div style="position:relative">
|
||||
<paper-ripple></paper-ripple>
|
||||
</div>
|
||||
|
||||
Note, it's important that the parent container of the ripple be relative position, otherwise
|
||||
the ripple will emanate outside of the desired container.
|
||||
|
||||
`paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple
|
||||
effect when touches on it. You can also defeat the default behavior and
|
||||
manually route the down and up actions to the ripple element. Note that it is
|
||||
important if you call downAction() you will have to make sure to call
|
||||
upAction() so that `paper-ripple` would end the animation loop.
|
||||
important if you call `downAction()` you will have to make sure to call
|
||||
`upAction()` so that `paper-ripple` would end the animation loop.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -526,6 +533,17 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
observer: '_holdDownChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the ripple will not generate a ripple effect
|
||||
* via pointer interaction.
|
||||
* Calling ripple's imperative api like `simulatedRipple` will
|
||||
* still generate the ripple effect.
|
||||
*/
|
||||
noink: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
_animating: {
|
||||
type: Boolean
|
||||
},
|
||||
|
@ -538,6 +556,10 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
}
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_noinkChanged(noink, isAttached)'
|
||||
],
|
||||
|
||||
get target () {
|
||||
var ownerRoot = Polymer.dom(this).getOwnerRoot();
|
||||
var target;
|
||||
|
@ -558,12 +580,13 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
},
|
||||
|
||||
attached: function() {
|
||||
this.listen(this.target, 'up', 'upAction');
|
||||
this.listen(this.target, 'down', 'downAction');
|
||||
this.listen(this.target, 'up', 'uiUpAction');
|
||||
this.listen(this.target, 'down', 'uiDownAction');
|
||||
},
|
||||
|
||||
if (!this.target.hasAttribute('noink')) {
|
||||
this.keyEventTarget = this.target;
|
||||
}
|
||||
detached: function() {
|
||||
this.unlisten(this.target, 'up', 'uiUpAction');
|
||||
this.unlisten(this.target, 'down', 'uiDownAction');
|
||||
},
|
||||
|
||||
get shouldKeepAnimating () {
|
||||
|
@ -585,7 +608,22 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
}, 1);
|
||||
},
|
||||
|
||||
/** @param {Event=} event */
|
||||
/**
|
||||
* Provokes a ripple down effect via a UI event,
|
||||
* respecting the `noink` property.
|
||||
* @param {Event=} event
|
||||
*/
|
||||
uiDownAction: function(event) {
|
||||
if (!this.noink) {
|
||||
this.downAction(event);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Provokes a ripple down effect via a UI event,
|
||||
* *not* respecting the `noink` property.
|
||||
* @param {Event=} event
|
||||
*/
|
||||
downAction: function(event) {
|
||||
if (this.holdDown && this.ripples.length > 0) {
|
||||
return;
|
||||
|
@ -600,7 +638,22 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
}
|
||||
},
|
||||
|
||||
/** @param {Event=} event */
|
||||
/**
|
||||
* Provokes a ripple up effect via a UI event,
|
||||
* respecting the `noink` property.
|
||||
* @param {Event=} event
|
||||
*/
|
||||
uiUpAction: function(event) {
|
||||
if (!this.noink) {
|
||||
this.upAction(event);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Provokes a ripple up effect via a UI event,
|
||||
* *not* respecting the `noink` property.
|
||||
* @param {Event=} event
|
||||
*/
|
||||
upAction: function(event) {
|
||||
if (this.holdDown) {
|
||||
return;
|
||||
|
@ -673,24 +726,35 @@ Apply `circle` class to make the rippling effect within a circle.
|
|||
},
|
||||
|
||||
_onEnterKeydown: function() {
|
||||
this.downAction();
|
||||
this.async(this.upAction, 1);
|
||||
this.uiDownAction();
|
||||
this.async(this.uiUpAction, 1);
|
||||
},
|
||||
|
||||
_onSpaceKeydown: function() {
|
||||
this.downAction();
|
||||
this.uiDownAction();
|
||||
},
|
||||
|
||||
_onSpaceKeyup: function() {
|
||||
this.upAction();
|
||||
this.uiUpAction();
|
||||
},
|
||||
|
||||
_holdDownChanged: function(holdDown) {
|
||||
if (holdDown) {
|
||||
// note: holdDown does not respect noink since it can be a focus based
|
||||
// effect.
|
||||
_holdDownChanged: function(newVal, oldVal) {
|
||||
if (oldVal === undefined) {
|
||||
return;
|
||||
}
|
||||
if (newVal) {
|
||||
this.downAction();
|
||||
} else {
|
||||
this.upAction();
|
||||
}
|
||||
},
|
||||
|
||||
_noinkChanged: function(noink, attached) {
|
||||
if (attached) {
|
||||
this.keyEventTarget = noink ? this : this.target;
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -18,6 +18,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/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../paper-ripple.html">
|
||||
|
@ -56,18 +57,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="NoinkTarget">
|
||||
<template>
|
||||
<div id="RippleContainer">
|
||||
<paper-ripple noink></paper-ripple>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
function FakeMouseEvent (target, relativeX, relativeX) {
|
||||
var rect = target.getBoundingClientRect();
|
||||
|
||||
return {
|
||||
detail: {
|
||||
x: rect.left + relativeX,
|
||||
y: rect.top + relativeX
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
suite('<paper-ripple>', function () {
|
||||
var mouseEvent;
|
||||
var rippleContainer;
|
||||
|
@ -77,13 +75,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
setup(function () {
|
||||
rippleContainer = fixture('TrivialRipple');
|
||||
ripple = rippleContainer.firstElementChild;
|
||||
|
||||
mouseEvent = new FakeMouseEvent(ripple, 10, 10);
|
||||
});
|
||||
|
||||
test('creates a ripple', function () {
|
||||
expect(ripple.ripples.length).to.be.eql(0);
|
||||
ripple.downAction(mouseEvent);
|
||||
MockInteractions.down(ripple);
|
||||
expect(ripple.ripples.length).to.be.eql(1);
|
||||
});
|
||||
|
||||
|
@ -91,18 +87,58 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
expect(ripple.ripples.length).to.be.eql(0);
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
ripple.downAction(mouseEvent);
|
||||
MockInteractions.down(ripple);
|
||||
expect(ripple.ripples.length).to.be.eql(i + 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
suite('when holdDown is togggled', function() {
|
||||
setup(function () {
|
||||
rippleContainer = fixture('TrivialRipple');
|
||||
ripple = rippleContainer.firstElementChild;
|
||||
});
|
||||
|
||||
test('generates a ripple', function() {
|
||||
ripple.holdDown = true;
|
||||
expect(ripple.ripples.length).to.be.eql(1);
|
||||
});
|
||||
|
||||
test('generates a ripple when noink', function() {
|
||||
ripple.noink = true;
|
||||
ripple.holdDown = true;
|
||||
expect(ripple.ripples.length).to.be.eql(1);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('when target is noink', function () {
|
||||
setup(function () {
|
||||
rippleContainer = fixture('NoinkTarget');
|
||||
ripple = rippleContainer.firstElementChild;
|
||||
});
|
||||
|
||||
test('tapping does not create a ripple', function () {
|
||||
expect(ripple.keyEventTarget).to.be.equal(ripple);
|
||||
expect(ripple.ripples.length).to.be.eql(0);
|
||||
MockInteractions.down(ripple);
|
||||
expect(ripple.ripples.length).to.be.eql(0);
|
||||
});
|
||||
|
||||
test('ripples can be manually created', function () {
|
||||
expect(ripple.ripples.length).to.be.eql(0);
|
||||
ripple.simulatedRipple()
|
||||
expect(ripple.ripples.length).to.be.eql(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
suite('with the `center` attribute set to true', function () {
|
||||
setup(function () {
|
||||
rippleContainer = fixture('CenteringRipple');
|
||||
ripple = rippleContainer.firstElementChild;
|
||||
|
||||
mouseEvent = new FakeMouseEvent(ripple, 10, 10);
|
||||
});
|
||||
|
||||
test('ripples will center', function (done) {
|
||||
|
@ -112,11 +148,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
div.style.webkitTransform = 'translate3d(0px, 0px, 0px)';
|
||||
div.style.transform = 'translate3d(0px, 0px, 0)';
|
||||
|
||||
ripple.downAction(mouseEvent);
|
||||
MockInteractions.down(ripple);
|
||||
|
||||
waveContainerElement = ripple.ripples[0].waveContainer;
|
||||
|
||||
ripple.upAction(mouseEvent);
|
||||
MockInteractions.up(ripple);
|
||||
|
||||
window.requestAnimationFrame(function () {
|
||||
var currentTransform = waveContainerElement.style.transform;
|
||||
|
@ -137,15 +173,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
setup(function () {
|
||||
rippleContainer = fixture('RecenteringRipple');
|
||||
ripple = rippleContainer.firstElementChild;
|
||||
mouseEvent = new FakeMouseEvent(ripple, 10, 10);
|
||||
});
|
||||
test('ripples will gravitate towards the center', function (done) {
|
||||
var waveContainerElement;
|
||||
var waveTranslateString;
|
||||
ripple.downAction(mouseEvent);
|
||||
MockInteractions.down(ripple, {x: 10, y: 10});
|
||||
waveContainerElement = ripple.ripples[0].waveContainer;
|
||||
waveTranslateString = waveContainerElement.style.transform;
|
||||
ripple.upAction(mouseEvent);
|
||||
MockInteractions.up(ripple);
|
||||
window.requestAnimationFrame(function () {
|
||||
try {
|
||||
expect(waveTranslateString).to.be.ok;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue