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

update polymer

This commit is contained in:
Luke Pulverenti 2015-09-14 21:17:19 -04:00
parent 571dd964e6
commit c526176a6a
23 changed files with 707 additions and 243 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.5",
"version": "1.0.6",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",
@ -37,11 +37,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/paper-slider",
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "8672cf9466fe8387f04ef5065ea83a4a18f8b06d"
"tag": "v1.0.6",
"commit": "4ae2e000dcbbfda4e12611f07c21fea3c0a9270d"
},
"_source": "git://github.com/PolymerElements/paper-slider.git",
"_target": "~1.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.5",
"version": "1.0.6",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",

View file

@ -64,7 +64,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<h4>Default</h4>
<div class="vertical-section">
<div>Oxygen</div>
<paper-slider value="21"></paper-slider><br><br>
<paper-slider value="21" id="test"></paper-slider><br><br>
<div>Argon</div>
<paper-slider value="1"></paper-slider><br><br>
<div>Hydrogen</div>
@ -111,6 +111,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
document.querySelector('#ratingsLabel').textContent = ratings.value;
});
test.addEventListener('value-changed', function(e) {
console.log(e);
});
</script>
</body>

View file

@ -17,24 +17,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
:host(:not([disabled])) #sliderBar {
--paper-progress-active-color: var(--paper-slider-active-color, --google-blue-700);
}
:host(:not([disabled])) #sliderBar {
--paper-progress-secondary-color: var(--paper-slider-secondary-color, --google-blue-300);
--paper-progress-disabled-active-color: var(--paper-slider-disabled-active-color, --google-grey-500);
--paper-progress-disabled-secondary-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
}
:host([disabled]) #sliderBar {
--paper-progress-active-color: var(--paper-slider-disabled-active-color, --google-grey-500);
}
:host([disabled]) #sliderBar {
--paper-progress-secondary-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
}
/* focus shows the ripple */
:host(:focus) {
outline: none;
}
@ -83,7 +72,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 0;
margin: -8px 0;
background-color: var(--paper-slider-bar-color, transparent);
--paper-progress-height: 2px;
--paper-progress-height: var(--paper-slider-height, 2px);
}
.ring #sliderBar {
@ -234,7 +223,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
.slider-input {
--paper-input-container-input: {
text-align: center;
text-align: center;
};
}

View file

@ -52,6 +52,7 @@ Custom property | Description | Default
`--paper-slider-knob-start-color` | The fill color of the knob at the far left | `transparent`
`--paper-slider-knob-start-border-color` | The border color of the knob at the far left | `#c8c8c8`
`--paper-slider-pin-start-color` | The color of the pin at the far left | `#c8c8c8`
`--paper-slider-height` | Height of the progress bar | `2px`
@group Paper Elements
@element paper-slider
@ -69,7 +70,7 @@ Custom property | Description | Default
<div class="bar-container">
<paper-progress
class$="[[_getProgressClass(transiting)]]"
disabled$="[[disabled]]"
id="sliderBar"
aria-hidden="true"
min="[[min]]"
@ -103,7 +104,7 @@ Custom property | Description | Default
class="circle"
hidden$="[[!receivedFocusFromKeyboard]]">
</paper-ripple>
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
<div id="sliderKnobInner" value$="[[immediateValue]]"></div>
</div>
</div>
@ -180,7 +181,8 @@ Custom property | Description | Default
immediateValue: {
type: Number,
value: 0,
readOnly: true
readOnly: true,
notify: true
},
/**
@ -311,7 +313,6 @@ Custom property | Description | Default
_positionKnob: function(ratio) {
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
this._setPinValue(this.immediateValue);
this._setRatio(this._calcRatio(this.immediateValue));
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
@ -366,7 +367,6 @@ Custom property | Description | Default
// update knob's position
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
this._setPinValue(immediateValue);
},
_trackEnd: function() {
@ -443,23 +443,15 @@ Custom property | Description | Default
},
_getClassNames: function() {
var classes = {};
classes.disabled = this.disabled;
classes.pin = this.pin;
classes.snaps = this.snaps;
classes.ring = this.immediateValue <= this.min;
classes.expand = this.expand;
classes.dragging = this.dragging;
classes.transiting = this.transiting;
classes.editable = this.editable;
return this._mergeClasses(classes);
},
_getProgressClass: function() {
return this._mergeClasses({
transiting: this.transiting
disabled: this.disabled,
pin: this.pin,
snaps: this.snaps,
ring: this.immediateValue <= this.min,
expand: this.expand,
dragging: this.dragging,
transiting: this.transiting,
editable: this.editable
});
},
@ -479,9 +471,6 @@ Custom property | Description | Default
this.decrement();
}
this.fire('change');
},
_setPinValue: function (value) {
this.pinValue = value;
}
});

View file

@ -178,6 +178,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('value should notify', function(done) {
var targetValue = 10;
slider.addEventListener('value-changed', function(e) {
assert.equal(e.detail.value, targetValue);
done();
});
slider.min = 0;
slider.max = 100;
slider.value = targetValue;
});
test('immediateValue should notify', function(done) {
var targetValue = 50;
slider.addEventListener('immediate-value-changed', function(e) {
assert.equal(e.detail.value, targetValue);
assert.equal(slider.immediateValue, targetValue);
done();
});
var cursor = MockInteractions.topLeftOfNode(slider.$.sliderBar);
cursor.x += slider.$.sliderBar.getBoundingClientRect().width * targetValue/100;
slider.min = 0;
slider.max = 100;
MockInteractions.down(slider.$.sliderBar, cursor);
});
});
</script>