react app

This commit is contained in:
Mario Romano
2016-04-06 17:52:19 +01:00
parent f7e6ef55a2
commit 29df96a085
4425 changed files with 446323 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
{
"name": "iron-range-behavior",
"version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors",
"keywords": [
"web-components",
"polymer",
"behavior"
],
"main": [
"iron-range-behavior.html"
],
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-range-behavior.git"
},
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-input": "PolymerElements/iron-input#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/iron-range-behavior",
"_release": "1.0.4",
"_resolution": {
"type": "version",
"tag": "v1.0.4",
"commit": "71774a7d8a8c377496bfe05e60b754e91216e0b9"
},
"_source": "git://github.com/PolymerElements/iron-range-behavior.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-range-behavior"
}

View File

@@ -0,0 +1 @@
bower_components

View File

@@ -0,0 +1,4 @@
iron-range-behavior
==========
`Polymer.IronRangeBehavior` provides the behavior for something with a minimum to maximum range.

View File

@@ -0,0 +1,30 @@
{
"name": "iron-range-behavior",
"version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors",
"keywords": [
"web-components",
"polymer",
"behavior"
],
"main": [
"iron-range-behavior.html"
],
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-range-behavior.git"
},
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-input": "PolymerElements/iron-input#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
}

View File

@@ -0,0 +1,79 @@
<!--
@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
-->
<!doctype html>
<html>
<head>
<title>iron-range-behavior demo</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-range-behavior.html">
<link rel="import" href="../../iron-input/iron-input.html">
<style>
body {
font-family: sans-serif;
}
</style>
</head>
<body unresolved>
<dom-module id="x-progressbar">
<style>
:host {
display: block;
height: 40px;
background-color: #555;
border-radius: 4px;
padding: 8px;
box-shadow: inset 0px 2px 5px rgba(0, 0, 0, 0.5);
}
.progress {
background-color: #999;
height: 100%;
border-radius: 4px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.progress-value {
padding: 0 8px;
font-size: 18px;
color: #fff;
}
</style>
<template>
<div class="progress" horizontal center layout style$="{{_computeStyle(ratio)}}">
<div class="progress-value"><span>{{ratio}}</span>%</div>
</div>
</template>
</dom-module>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'x-progressbar',
behaviors: [Polymer.IronRangeBehavior],
_computeStyle: function(ratio) {
return 'width: ' + ratio + '%;';
}
});
});
</script>
<x-progressbar min="0" max="200" value="120"></x-progressbar>
</body>
</html>

View File

@@ -0,0 +1,24 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.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
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View File

@@ -0,0 +1,112 @@
<!--
@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">
<script>
/**
* `iron-range-behavior` provides the behavior for something with a minimum to maximum range.
*
* @demo demo/index.html
* @polymerBehavior
*/
Polymer.IronRangeBehavior = {
properties: {
/**
* The number that represents the current value.
*/
value: {
type: Number,
value: 0,
notify: true,
reflectToAttribute: true
},
/**
* The number that indicates the minimum value of the range.
*/
min: {
type: Number,
value: 0,
notify: true
},
/**
* The number that indicates the maximum value of the range.
*/
max: {
type: Number,
value: 100,
notify: true
},
/**
* Specifies the value granularity of the range's value.
*/
step: {
type: Number,
value: 1,
notify: true
},
/**
* Returns the ratio of the value.
*/
ratio: {
type: Number,
value: 0,
readOnly: true,
notify: true
},
},
observers: [
'_update(value, min, max, step)'
],
_calcRatio: function(value) {
return (this._clampValue(value) - this.min) / (this.max - this.min);
},
_clampValue: function(value) {
return Math.min(this.max, Math.max(this.min, this._calcStep(value)));
},
_calcStep: function(value) {
/**
* if we calculate the step using
* `Math.round(value / step) * step` we may hit a precision point issue
* eg. 0.1 * 0.2 = 0.020000000000000004
* http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
*
* as a work around we can divide by the reciprocal of `step`
*/
// polymer/issues/2493
value = parseFloat(value);
return this.step ? (Math.round((value + this.min) / this.step) -
(this.min / this.step)) / (1 / this.step) : value;
},
_validateValue: function() {
var v = this._clampValue(this.value);
this.value = this.oldValue = isNaN(v) ? this.oldValue : v;
return this.value !== v;
},
_update: function() {
this._validateValue();
this._setRatio(this._calcRatio(this.value) * 100);
}
};
</script>

View File

@@ -0,0 +1,153 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.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
-->
<html>
<head>
<meta charset="UTF-8">
<title>iron-range-behavior</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="x-progressbar.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
</head>
<body>
<test-fixture id="trivialRange">
<template>
<x-progressbar></x-progressbar>
</template>
</test-fixture>
<script>
suite('<x-progressbar>', function() {
var range;
setup(function() {
range = fixture('trivialRange');
});
test('check default', function() {
assert.equal(range.min, 0);
assert.equal(range.max, 100);
assert.equal(range.value, 0);
});
test('set value', function(done) {
range.value = 50;
flush(function() {
assert.equal(range.value, 50);
// test clamp value
range.value = 60.1;
flush(function() {
assert.equal(range.value, 60);
done();
});
});
});
test('set max', function(done) {
range.max = 10;
range.value = 11;
flush(function() {
assert.equal(range.value, range.max);
done();
});
});
test('test ratio', function(done) {
range.max = 10;
range.value = 5;
flush(function() {
assert.equal(range.ratio, 50);
done();
});
});
test('set min', function(done) {
range.min = 10
range.max = 50;
range.value = 30;
flush(function() {
assert.equal(range.ratio, 50);
range.value = 0;
flush(function() {
assert.equal(range.value, range.min);
done();
});
});
});
test('set step', function(done) {
range.min = 0;
range.max = 10;
range.value = 5.1;
flush(function() {
assert.equal(range.value, 5);
range.step = 0.1;
range.value = 5.1;
flush(function() {
assert.equal(range.value, 5.1);
done();
});
});
});
test('odd values', function(done) {
range.min = 1;
range.max = 7;
range.step = 2;
range.value = 3;
flush(function() {
assert.equal(range.value, 3);
range.value += range.step;
assert.equal(range.value, 5);
range.value += range.step;
assert.equal(range.value, 7);
done();
});
});
test('negative values should round up', function(done) {
range.min = -10;
range.max = 10;
range.step = 0.1;
range.value = -8.4252;
flush(function() {
assert.equal(range.value, -8.4);
done();
});
});
test('positive values should round up', function(done) {
range.min = 10;
range.max = 100;
range.step = 0.25;
range.value = 19.34567;
flush(function() {
assert.equal(range.value, 19.25);
done();
});
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.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
-->
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Tests</title>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'basic.html'
]);
</script>
</body>
</html>

View File

@@ -0,0 +1,18 @@
<!--
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="../iron-range-behavior.html">
<script>
Polymer({
is: 'x-progressbar',
behaviors: [Polymer.IronRangeBehavior]
});
</script>