Added Polymer
This commit is contained in:
21
rpg-docs/public/bower_components/core-selection/.bower.json
vendored
Normal file
21
rpg-docs/public/bower_components/core-selection/.bower.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "core-selection",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.1.0"
|
||||
},
|
||||
"version": "0.5.1",
|
||||
"homepage": "https://github.com/Polymer/core-selection",
|
||||
"_release": "0.5.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "85aaa99453fa5c4474dcb3da9f4c7ded51d316a7"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/core-selection.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/core-selection"
|
||||
}
|
||||
4
rpg-docs/public/bower_components/core-selection/README.md
vendored
Normal file
4
rpg-docs/public/bower_components/core-selection/README.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
core-selection
|
||||
==============
|
||||
|
||||
See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-selection) for more information.
|
||||
11
rpg-docs/public/bower_components/core-selection/bower.json
vendored
Normal file
11
rpg-docs/public/bower_components/core-selection/bower.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "core-selection",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.1.0"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
}
|
||||
149
rpg-docs/public/bower_components/core-selection/core-selection.html
vendored
Normal file
149
rpg-docs/public/bower_components/core-selection/core-selection.html
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<!--
|
||||
Copyright (c) 2014 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
|
||||
-->
|
||||
<!--
|
||||
@group Polymer Core Elements
|
||||
|
||||
The `<core-selection>` element is used to manage selection state. It has no
|
||||
visual appearance and is typically used in conjunction with another element.
|
||||
For example, [core-selector](#core-selector)
|
||||
use a `<core-selection>` to manage selection.
|
||||
|
||||
To mark an item as selected, call the `select(item)` method on
|
||||
`<core-selection>`. The item itself is an argument to this method.
|
||||
|
||||
The `<core-selection>`element manages selection state for any given set of
|
||||
items. When an item is selected, the `core-select` event is fired.
|
||||
|
||||
The attribute `multi` indicates if multiple items can be selected at once.
|
||||
|
||||
Example:
|
||||
|
||||
<polymer-element name="selection-example">
|
||||
<template>
|
||||
<style>
|
||||
polyfill-next-selector { content: ':host > .selected'; }
|
||||
::content > .selected {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
<ul on-tap="{{itemTapAction}}">
|
||||
<content></content>
|
||||
</ul>
|
||||
<core-selection id="selection" multi
|
||||
on-core-select="{{selectAction}}"></core-selection>
|
||||
</template>
|
||||
<script>
|
||||
Polymer('selection-example', {
|
||||
itemTapAction: function(e, detail, sender) {
|
||||
this.$.selection.select(e.target);
|
||||
},
|
||||
selectAction: function(e, detail, sender) {
|
||||
detail.item.classList.toggle('selected', detail.isSelected);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
<selection-example>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</selection-example>
|
||||
|
||||
@element core-selection
|
||||
-->
|
||||
|
||||
<!--
|
||||
Fired when an item's selection state is changed. This event is fired both
|
||||
when an item is selected or deselected. The `isSelected` detail property
|
||||
contains the selection state.
|
||||
|
||||
@event core-select
|
||||
@param {Object} detail
|
||||
@param {boolean} detail.isSelected true for selection and false for de-selection
|
||||
@param {Object} detail.item the item element
|
||||
-->
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
|
||||
<polymer-element name="core-selection" attributes="multi" hidden>
|
||||
<script>
|
||||
Polymer('core-selection', {
|
||||
/**
|
||||
* If true, multiple selections are allowed.
|
||||
*
|
||||
* @attribute multi
|
||||
* @type boolean
|
||||
* @default false
|
||||
*/
|
||||
multi: false,
|
||||
ready: function() {
|
||||
this.clear();
|
||||
},
|
||||
clear: function() {
|
||||
this.selection = [];
|
||||
},
|
||||
/**
|
||||
* Retrieves the selected item(s).
|
||||
* @method getSelection
|
||||
* @returns Returns the selected item(s). If the multi property is true,
|
||||
* getSelection will return an array, otherwise it will return
|
||||
* the selected item or undefined if there is no selection.
|
||||
*/
|
||||
getSelection: function() {
|
||||
return this.multi ? this.selection : this.selection[0];
|
||||
},
|
||||
/**
|
||||
* Indicates if a given item is selected.
|
||||
* @method isSelected
|
||||
* @param {any} item The item whose selection state should be checked.
|
||||
* @returns Returns true if `item` is selected.
|
||||
*/
|
||||
isSelected: function(item) {
|
||||
return this.selection.indexOf(item) >= 0;
|
||||
},
|
||||
setItemSelected: function(item, isSelected) {
|
||||
if (item !== undefined && item !== null) {
|
||||
if (isSelected) {
|
||||
this.selection.push(item);
|
||||
} else {
|
||||
var i = this.selection.indexOf(item);
|
||||
if (i >= 0) {
|
||||
this.selection.splice(i, 1);
|
||||
}
|
||||
}
|
||||
this.fire("core-select", {isSelected: isSelected, item: item});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Set the selection state for a given `item`. If the multi property
|
||||
* is true, then the selected state of `item` will be toggled; otherwise
|
||||
* the `item` will be selected.
|
||||
* @method select
|
||||
* @param {any} item: The item to select.
|
||||
*/
|
||||
select: function(item) {
|
||||
if (this.multi) {
|
||||
this.toggle(item);
|
||||
} else if (this.getSelection() !== item) {
|
||||
this.setItemSelected(this.getSelection(), false);
|
||||
this.setItemSelected(item, true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Toggles the selection state for `item`.
|
||||
* @method toggle
|
||||
* @param {any} item: The item to toggle.
|
||||
*/
|
||||
toggle: function(item) {
|
||||
this.setItemSelected(item, !this.isSelected(item));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
59
rpg-docs/public/bower_components/core-selection/demo.html
vendored
Normal file
59
rpg-docs/public/bower_components/core-selection/demo.html
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2014 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>
|
||||
<title>Selection</title>
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="core-selection.html">
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<polymer-element name="selection-example">
|
||||
<template>
|
||||
<style>
|
||||
polyfill-next-selector { content: 'ul > *'; }
|
||||
::content > * {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
polyfill-next-selector { content: 'ul > .selected'; }
|
||||
::content > .selected {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
<ul on-tap="{{itemTapAction}}">
|
||||
<content></content>
|
||||
</ul>
|
||||
|
||||
<core-selection id="selection" multi on-core-select="{{selectAction}}"></core-selection>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
Polymer('selection-example', {
|
||||
itemTapAction: function(e, detail, sender) {
|
||||
this.$.selection.select(e.target);
|
||||
},
|
||||
selectAction: function(e, detail, sender) {
|
||||
detail.item.classList.toggle('selected', detail.isSelected);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
<selection-example>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</selection-example>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
rpg-docs/public/bower_components/core-selection/index.html
vendored
Normal file
22
rpg-docs/public/bower_components/core-selection/index.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 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
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
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
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../core-component-page/core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
62
rpg-docs/public/bower_components/core-selection/test/basic.html
vendored
Normal file
62
rpg-docs/public/bower_components/core-selection/test/basic.html
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 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>core-selection-basic</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link rel="import" href="../core-selection.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<core-selection></core-selection>
|
||||
|
||||
<script>
|
||||
|
||||
var s = document.querySelector('core-selection');
|
||||
|
||||
suite('basic', function() {
|
||||
|
||||
test('select item', function(done) {
|
||||
var func = function(event) {
|
||||
assert.isTrue(event.detail.isSelected);
|
||||
assert.equal(event.detail.item, '(item)');
|
||||
assert.isTrue(s.isSelected(event.detail.item));
|
||||
assert.isFalse(s.isSelected('(some_item_not_selected)'));
|
||||
s.removeEventListener('core-select', func);
|
||||
done();
|
||||
}
|
||||
s.addEventListener('core-select', func);
|
||||
s.select('(item)');
|
||||
});
|
||||
|
||||
test('select null', function(done) {
|
||||
var func = function(event) {
|
||||
assert.isFalse(event.detail.isSelected);
|
||||
assert.equal(event.detail.item, '(item)');
|
||||
assert.isFalse(s.isSelected(event.detail.item));
|
||||
s.removeEventListener("core-select", func);
|
||||
done();
|
||||
}
|
||||
s.addEventListener("core-select", func);
|
||||
s.select(null);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
rpg-docs/public/bower_components/core-selection/test/index.html
vendored
Normal file
25
rpg-docs/public/bower_components/core-selection/test/index.html
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 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',
|
||||
'multi.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
63
rpg-docs/public/bower_components/core-selection/test/multi.html
vendored
Normal file
63
rpg-docs/public/bower_components/core-selection/test/multi.html
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 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>core-selection-multi</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link rel="import" href="../core-selection.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<core-selection multi></core-selection>
|
||||
|
||||
<script>
|
||||
|
||||
var s = document.querySelector('core-selection');
|
||||
|
||||
suite('basic', function() {
|
||||
|
||||
test('select item', function(done) {
|
||||
var func = function(event) {
|
||||
assert.isTrue(event.detail.isSelected);
|
||||
assert.equal(event.detail.item, '(item1)');
|
||||
assert.isTrue(s.isSelected(event.detail.item));
|
||||
assert.equal(s.getSelection().length, 1);
|
||||
s.removeEventListener('core-select', func);
|
||||
done();
|
||||
}
|
||||
s.addEventListener('core-select', func);
|
||||
s.select('(item1)');
|
||||
});
|
||||
|
||||
test('select null', function(done) {
|
||||
var func = function(event) {
|
||||
assert.isTrue(event.detail.isSelected);
|
||||
assert.equal(event.detail.item, '(item2)');
|
||||
assert.isTrue(s.isSelected(event.detail.item));
|
||||
assert.equal(s.getSelection().length, 2);
|
||||
s.removeEventListener("core-select", func);
|
||||
done();
|
||||
}
|
||||
s.addEventListener("core-select", func);
|
||||
s.select('(item2)');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user