aboutsummaryrefslogtreecommitdiff
path: root/catapult/third_party/polymer/components/iron-meta
diff options
context:
space:
mode:
Diffstat (limited to 'catapult/third_party/polymer/components/iron-meta')
-rw-r--r--catapult/third_party/polymer/components/iron-meta/.bower.json40
-rw-r--r--catapult/third_party/polymer/components/iron-meta/.github/ISSUE_TEMPLATE.md33
-rw-r--r--catapult/third_party/polymer/components/iron-meta/.gitignore1
-rw-r--r--catapult/third_party/polymer/components/iron-meta/.travis.yml24
-rw-r--r--catapult/third_party/polymer/components/iron-meta/CONTRIBUTING.md77
-rw-r--r--catapult/third_party/polymer/components/iron-meta/README.md110
-rw-r--r--catapult/third_party/polymer/components/iron-meta/bower.json30
-rw-r--r--catapult/third_party/polymer/components/iron-meta/demo/index.html76
-rwxr-xr-xcatapult/third_party/polymer/components/iron-meta/hero.svg33
-rw-r--r--catapult/third_party/polymer/components/iron-meta/index.html27
-rw-r--r--catapult/third_party/polymer/components/iron-meta/iron-meta.html333
-rw-r--r--catapult/third_party/polymer/components/iron-meta/test/basic.html48
-rw-r--r--catapult/third_party/polymer/components/iron-meta/test/index.html29
-rw-r--r--catapult/third_party/polymer/components/iron-meta/test/iron-meta.html195
14 files changed, 1056 insertions, 0 deletions
diff --git a/catapult/third_party/polymer/components/iron-meta/.bower.json b/catapult/third_party/polymer/components/iron-meta/.bower.json
new file mode 100644
index 00000000..b8b8970a
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/.bower.json
@@ -0,0 +1,40 @@
+{
+ "name": "iron-meta",
+ "version": "1.1.3",
+ "keywords": [
+ "web-components",
+ "polymer"
+ ],
+ "license": "http://polymer.github.io/LICENSE.txt",
+ "description": "Useful for sharing information across a DOM tree",
+ "private": true,
+ "authors": [
+ "The Polymer Authors"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/PolymerElements/iron-meta.git"
+ },
+ "dependencies": {
+ "polymer": "Polymer/polymer#^1.0.0"
+ },
+ "devDependencies": {
+ "paper-styles": "polymerelements/paper-styles#^1.0.4",
+ "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
+ "test-fixture": "polymerelements/test-fixture#^1.0.0",
+ "web-component-tester": "^4.0.0",
+ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
+ },
+ "main": "iron-meta.html",
+ "ignore": [],
+ "homepage": "https://github.com/polymerelements/iron-meta",
+ "_release": "1.1.3",
+ "_resolution": {
+ "type": "version",
+ "tag": "v1.1.3",
+ "commit": "ec0afd727a0af36509264a78b691484123dc7bf6"
+ },
+ "_source": "https://github.com/polymerelements/iron-meta.git",
+ "_target": "^1.0.0",
+ "_originalSource": "polymerelements/iron-meta"
+} \ No newline at end of file
diff --git a/catapult/third_party/polymer/components/iron-meta/.github/ISSUE_TEMPLATE.md b/catapult/third_party/polymer/components/iron-meta/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..2e817113
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,33 @@
+<!-- Instructions: https://github.com/PolymerElements/iron-meta/CONTRIBUTING.md#filing-issues -->
+### Description
+<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
+
+### Expected outcome
+
+<!-- Example: The page stays the same color. -->
+
+### Actual outcome
+
+<!-- Example: The page turns pink. -->
+
+### Live Demo
+<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
+
+### Steps to reproduce
+
+<!-- Example
+1. Put a `paper-foo` element in the page.
+2. Open the page in a web browser.
+3. Click the `paper-foo` element.
+-->
+
+### Browsers Affected
+<!-- Check all that apply -->
+- [ ] Chrome
+- [ ] Firefox
+- [ ] Safari 9
+- [ ] Safari 8
+- [ ] Safari 7
+- [ ] Edge
+- [ ] IE 11
+- [ ] IE 10
diff --git a/catapult/third_party/polymer/components/iron-meta/.gitignore b/catapult/third_party/polymer/components/iron-meta/.gitignore
new file mode 100644
index 00000000..8d4ae253
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/.gitignore
@@ -0,0 +1 @@
+bower_components
diff --git a/catapult/third_party/polymer/components/iron-meta/.travis.yml b/catapult/third_party/polymer/components/iron-meta/.travis.yml
new file mode 100644
index 00000000..0ee194ad
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/.travis.yml
@@ -0,0 +1,24 @@
+language: node_js
+sudo: required
+before_script:
+ - npm install -g bower polylint web-component-tester
+ - bower install
+ - polylint
+env:
+ global:
+ - secure: >-
+ mjikUCoN+UpTbFHwbGXUoKp4vtZ2qNN1JYW79WcOik7fCFmvdFzfYQPDa6y9aJvU3kgkDndGdR/ynLG4kejZjmqTS5fYtdHEwpPVPapbVYnquJvCJKbMN4S2QpGCoq51pjKQ8U3Ys6G5HkmdcDfw3SKk1uMgVzKV7fEI+6WnZ/M=
+ - secure: >-
+ LHDnBtwK7yO2X4GNmIaAl7t85WWc1U189OiPqemD27+jTcKml0by1n9Mu/yrg94jYgeXab9mHgU3uMtIdQstNNwTDu8CgmmIP4H2EWopHrTi3KM7Z7aeofPgMJsVFXwg+WhNlcCfhEsygHZWTxjJXM4fcGOrFPDa4+BTgRa2hEE=
+node_js: '6'
+addons:
+ firefox: latest
+ apt:
+ sources:
+ - google-chrome
+ packages:
+ - google-chrome-stable
+script:
+ - xvfb-run wct
+ - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct -s ''default''; fi'
+dist: trusty
diff --git a/catapult/third_party/polymer/components/iron-meta/CONTRIBUTING.md b/catapult/third_party/polymer/components/iron-meta/CONTRIBUTING.md
new file mode 100644
index 00000000..093090d4
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/CONTRIBUTING.md
@@ -0,0 +1,77 @@
+<!--
+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 :)
+
+You can however override the jsbin link with one that's customized to this
+specific element:
+
+jsbin=https://jsbin.com/cagaye/edit?html,output
+-->
+
+# 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 user’s 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: [https://jsbin.com/cagaye/edit?html,output](https://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 in the pull request description using the following syntax:
+
+ ```markdown
+ (For a single issue)
+ Fixes #20
+
+ (For multiple issues)
+ Fixes #32, fixes #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 don’t be afraid to ask us if you need help with that!
diff --git a/catapult/third_party/polymer/components/iron-meta/README.md b/catapult/third_party/polymer/components/iron-meta/README.md
new file mode 100644
index 00000000..3f2ebb32
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/README.md
@@ -0,0 +1,110 @@
+
+<!---
+
+This README is automatically generated from the comments in these files:
+iron-meta.html
+
+Edit those files, and our readme bot will duplicate them over here!
+Edit this file, and the bot will squash your changes :)
+
+The bot does some handling of markdown. Please file a bug if it does the wrong
+thing! https://github.com/PolymerLabs/tedium/issues
+
+-->
+
+[![Build status](https://travis-ci.org/PolymerElements/iron-meta.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-meta)
+
+_[Demo and API docs](https://elements.polymer-project.org/elements/iron-meta)_
+
+
+##&lt;iron-meta&gt;
+
+`iron-meta` is a generic element you can use for sharing information across the DOM tree.
+It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that any
+instance of iron-meta has access to the shared
+information. You can use `iron-meta` to share whatever you want (or create an extension
+[like x-meta] for enhancements).
+
+The `iron-meta` instances containing your actual data can be loaded in an import,
+or constructed in any way you see fit. The only requirement is that you create them
+before you try to access them.
+
+Examples:
+
+If I create an instance like this:
+
+```html
+<iron-meta key="info" value="foo/bar"></iron-meta>
+```
+
+Note that value="foo/bar" is the metadata I've defined. I could define more
+attributes or use child nodes to define additional metadata.
+
+Now I can access that element (and it's metadata) from any iron-meta instance
+via the byKey method, e.g.
+
+```javascript
+meta.byKey('info');
+```
+
+Pure imperative form would be like:
+
+```javascript
+document.createElement('iron-meta').byKey('info');
+```
+
+Or, in a Polymer element, you can include a meta in your template:
+
+```html
+<iron-meta id="meta"></iron-meta>
+...
+this.$.meta.byKey('info');
+```
+
+
+
+##&lt;iron-meta-query&gt;
+
+`iron-meta` is a generic element you can use for sharing information across the DOM tree.
+It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that any
+instance of iron-meta has access to the shared
+information. You can use `iron-meta` to share whatever you want (or create an extension
+[like x-meta] for enhancements).
+
+The `iron-meta` instances containing your actual data can be loaded in an import,
+or constructed in any way you see fit. The only requirement is that you create them
+before you try to access them.
+
+Examples:
+
+If I create an instance like this:
+
+```html
+<iron-meta key="info" value="foo/bar"></iron-meta>
+```
+
+Note that value="foo/bar" is the metadata I've defined. I could define more
+attributes or use child nodes to define additional metadata.
+
+Now I can access that element (and it's metadata) from any iron-meta instance
+via the byKey method, e.g.
+
+```javascript
+meta.byKey('info');
+```
+
+Pure imperative form would be like:
+
+```javascript
+document.createElement('iron-meta').byKey('info');
+```
+
+Or, in a Polymer element, you can include a meta in your template:
+
+```html
+<iron-meta id="meta"></iron-meta>
+...
+this.$.meta.byKey('info');
+```
+
+
diff --git a/catapult/third_party/polymer/components/iron-meta/bower.json b/catapult/third_party/polymer/components/iron-meta/bower.json
new file mode 100644
index 00000000..5ab0c849
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/bower.json
@@ -0,0 +1,30 @@
+{
+ "name": "iron-meta",
+ "version": "1.1.3",
+ "keywords": [
+ "web-components",
+ "polymer"
+ ],
+ "license": "http://polymer.github.io/LICENSE.txt",
+ "description": "Useful for sharing information across a DOM tree",
+ "private": true,
+ "authors": [
+ "The Polymer Authors"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/PolymerElements/iron-meta.git"
+ },
+ "dependencies": {
+ "polymer": "Polymer/polymer#^1.0.0"
+ },
+ "devDependencies": {
+ "paper-styles": "polymerelements/paper-styles#^1.0.4",
+ "iron-component-page": "polymerelements/iron-component-page#^1.0.0",
+ "test-fixture": "polymerelements/test-fixture#^1.0.0",
+ "web-component-tester": "^4.0.0",
+ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
+ },
+ "main": "iron-meta.html",
+ "ignore": []
+}
diff --git a/catapult/third_party/polymer/components/iron-meta/demo/index.html b/catapult/third_party/polymer/components/iron-meta/demo/index.html
new file mode 100644
index 00000000..0fc39e30
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/demo/index.html
@@ -0,0 +1,76 @@
+<!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">
+
+ <title>iron-meta</title>
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <link rel="import" href="../../paper-styles/demo-pages.html">
+ <link rel="import" href="../iron-meta.html">
+</head>
+<body>
+
+ <div class="vertical-section centered">
+ <h1>&lt;iron-meta&gt;</h1>
+ <h2>Key Query</h2>
+
+ <iron-meta key="info" value="foo/bar"></iron-meta>
+
+ The <code>value</code> stored at <code>key="info"</code> is <code><meta-test></meta-test></code>.
+ </div>
+
+ <div class="vertical-section centered">
+ <h2>Type Query</h2>
+
+ <iron-meta type="type1" key="a" value="Polymer"></iron-meta>
+ <iron-meta type="type1" key="b" value="is"></iron-meta>
+ <iron-meta type="type2" key="a" value="wonderful"></iron-meta>
+ <iron-meta type="type2" key="b" value="<3"></iron-meta>
+
+ The <code>value(s)</code> stored at <code>type="type1"</code> are:<br><code><type-one></type-one></code>.<br><br>The <code>value(s)</code> stored at <code>type="type2"</code> are:<br><code><type-two></type-two></code>.
+ </div>
+
+ <script>
+ document.addEventListener('WebComponentsReady', function() {
+ Polymer({
+ is: 'meta-test',
+ ready: function() {
+ this.textContent = new Polymer.IronMetaQuery({key: 'info'}).value;
+ }
+ });
+ });
+
+ Polymer({
+ is: 'type-one',
+
+ ready: function() {
+ var resultList = new Polymer.IronMetaQuery({type: "type1"}).list;
+ this.textContent = JSON.stringify(resultList);
+ }
+ });
+
+ Polymer({
+ is: 'type-two',
+
+ ready: function() {
+ var resultList = new Polymer.IronMetaQuery({type: "type2"}).list;
+ this.textContent = JSON.stringify(resultList);
+ }
+ });
+
+ </script>
+
+</body>
+</html>
diff --git a/catapult/third_party/polymer/components/iron-meta/hero.svg b/catapult/third_party/polymer/components/iron-meta/hero.svg
new file mode 100755
index 00000000..8d36c506
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/hero.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
+<g id="background" display="none">
+ <rect display="inline" fill="#B0BEC5" width="225" height="126"/>
+</g>
+<g id="label">
+</g>
+<g id="art">
+ <circle cx="22" cy="85" r="4"/>
+ <circle cx="88" cy="98" r="4"/>
+ <path d="M87.5,100c-3.8-0.3-5.5-2.8-7-5c-1.4-2.1-2.7-3.9-5.5-4.2c-2.8-0.3-4.4,1.3-6.2,3.1c-1.9,1.9-4,4-7.8,3.7
+ c-3.8-0.3-5.5-2.8-7-5c-1.4-2.1-2.7-3.9-5.5-4.2c-2.8-0.3-4.4,1.3-6.2,3.1c-1.9,1.9-4,4-7.8,3.7c-3.8-0.3-5.5-2.8-7-5
+ c-1.4-2.1-2.7-3.9-5.5-4.2l0.2-2c3.8,0.3,5.5,2.8,7,5c1.4,2.1,2.7,3.9,5.5,4.2c2.8,0.3,4.4-1.3,6.2-3.1c1.9-1.9,4-4,7.8-3.7
+ c3.8,0.3,5.5,2.8,7,5c1.4,2.1,2.7,3.9,5.5,4.2c2.8,0.3,4.4-1.3,6.2-3.1c1.9-1.9,4-4,7.8-3.7c3.8,0.3,5.5,2.8,7,5
+ c1.4,2.1,2.7,3.9,5.5,4.2L87.5,100z"/>
+ <circle cx="96" cy="86" r="4"/>
+ <circle cx="162" cy="98" r="4"/>
+ <rect x="95.5" y="91" transform="matrix(0.9839 0.1789 -0.1789 0.9839 18.5382 -21.5923)" width="67.1" height="2"/>
+ <g>
+ <path d="M27,41.5l4.5,13.4l4.9-13.4h5.4v32h-4.4V61l0.4-13.4l-5.4,14.5h-2L25.6,48L26,61v12.5h-4.4v-32H27z"/>
+ <path d="M67.5,58.7H53.4V70h16.4v3.5H49v-32h20.6V45H53.4v10.2h14.2V58.7z"/>
+ <path d="M98.5,45H88.3v28.5h-4.4V45H73.6v-3.5h24.9V45z"/>
+ <path d="M116.2,65.3H105l-2.6,8.2h-4.5l10.9-32h3.8l10.6,32h-4.5L116.2,65.3z M106.2,61.6h8.9l-4.4-14.2L106.2,61.6z"/>
+ </g>
+ <g id="ic_x5F_add_x0D_">
+ </g>
+</g>
+<g id="Guides">
+</g>
+</svg>
diff --git a/catapult/third_party/polymer/components/iron-meta/index.html b/catapult/third_party/polymer/components/iron-meta/index.html
new file mode 100644
index 00000000..dce83623
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/index.html
@@ -0,0 +1,27 @@
+<!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">
+ <title>iron-meta</title>
+
+ <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>
diff --git a/catapult/third_party/polymer/components/iron-meta/iron-meta.html b/catapult/third_party/polymer/components/iron-meta/iron-meta.html
new file mode 100644
index 00000000..73d66ccc
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/iron-meta.html
@@ -0,0 +1,333 @@
+<!--
+@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">
+
+<!--
+`iron-meta` is a generic element you can use for sharing information across the DOM tree.
+It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that any
+instance of iron-meta has access to the shared
+information. You can use `iron-meta` to share whatever you want (or create an extension
+[like x-meta] for enhancements).
+
+The `iron-meta` instances containing your actual data can be loaded in an import,
+or constructed in any way you see fit. The only requirement is that you create them
+before you try to access them.
+
+Examples:
+
+If I create an instance like this:
+
+ <iron-meta key="info" value="foo/bar"></iron-meta>
+
+Note that value="foo/bar" is the metadata I've defined. I could define more
+attributes or use child nodes to define additional metadata.
+
+Now I can access that element (and it's metadata) from any iron-meta instance
+via the byKey method, e.g.
+
+ meta.byKey('info');
+
+Pure imperative form would be like:
+
+ document.createElement('iron-meta').byKey('info');
+
+Or, in a Polymer element, you can include a meta in your template:
+
+ <iron-meta id="meta"></iron-meta>
+ ...
+ this.$.meta.byKey('info');
+
+@group Iron Elements
+@demo demo/index.html
+@hero hero.svg
+@element iron-meta
+-->
+
+<script>
+
+ (function() {
+
+ // monostate data
+ var metaDatas = {};
+ var metaArrays = {};
+ var singleton = null;
+
+ Polymer.IronMeta = Polymer({
+
+ is: 'iron-meta',
+
+ properties: {
+
+ /**
+ * The type of meta-data. All meta-data of the same type is stored
+ * together.
+ */
+ type: {
+ type: String,
+ value: 'default',
+ observer: '_typeChanged'
+ },
+
+ /**
+ * The key used to store `value` under the `type` namespace.
+ */
+ key: {
+ type: String,
+ observer: '_keyChanged'
+ },
+
+ /**
+ * The meta-data to store or retrieve.
+ */
+ value: {
+ type: Object,
+ notify: true,
+ observer: '_valueChanged'
+ },
+
+ /**
+ * If true, `value` is set to the iron-meta instance itself.
+ */
+ self: {
+ type: Boolean,
+ observer: '_selfChanged'
+ },
+
+ /**
+ * Array of all meta-data values for the given type.
+ */
+ list: {
+ type: Array,
+ notify: true
+ }
+
+ },
+
+ hostAttributes: {
+ hidden: true
+ },
+
+ /**
+ * Only runs if someone invokes the factory/constructor directly
+ * e.g. `new Polymer.IronMeta()`
+ *
+ * @param {{type: (string|undefined), key: (string|undefined), value}=} config
+ */
+ factoryImpl: function(config) {
+ if (config) {
+ for (var n in config) {
+ switch(n) {
+ case 'type':
+ case 'key':
+ case 'value':
+ this[n] = config[n];
+ break;
+ }
+ }
+ }
+ },
+
+ created: function() {
+ // TODO(sjmiles): good for debugging?
+ this._metaDatas = metaDatas;
+ this._metaArrays = metaArrays;
+ },
+
+ _keyChanged: function(key, old) {
+ this._resetRegistration(old);
+ },
+
+ _valueChanged: function(value) {
+ this._resetRegistration(this.key);
+ },
+
+ _selfChanged: function(self) {
+ if (self) {
+ this.value = this;
+ }
+ },
+
+ _typeChanged: function(type) {
+ this._unregisterKey(this.key);
+ if (!metaDatas[type]) {
+ metaDatas[type] = {};
+ }
+ this._metaData = metaDatas[type];
+ if (!metaArrays[type]) {
+ metaArrays[type] = [];
+ }
+ this.list = metaArrays[type];
+ this._registerKeyValue(this.key, this.value);
+ },
+
+ /**
+ * Retrieves meta data value by key.
+ *
+ * @method byKey
+ * @param {string} key The key of the meta-data to be returned.
+ * @return {*}
+ */
+ byKey: function(key) {
+ return this._metaData && this._metaData[key];
+ },
+
+ _resetRegistration: function(oldKey) {
+ this._unregisterKey(oldKey);
+ this._registerKeyValue(this.key, this.value);
+ },
+
+ _unregisterKey: function(key) {
+ this._unregister(key, this._metaData, this.list);
+ },
+
+ _registerKeyValue: function(key, value) {
+ this._register(key, value, this._metaData, this.list);
+ },
+
+ _register: function(key, value, data, list) {
+ if (key && data && value !== undefined) {
+ data[key] = value;
+ list.push(value);
+ }
+ },
+
+ _unregister: function(key, data, list) {
+ if (key && data) {
+ if (key in data) {
+ var value = data[key];
+ delete data[key];
+ this.arrayDelete(list, value);
+ }
+ }
+ }
+
+ });
+
+ Polymer.IronMeta.getIronMeta = function getIronMeta() {
+ if (singleton === null) {
+ singleton = new Polymer.IronMeta();
+ }
+ return singleton;
+ };
+
+ /**
+ `iron-meta-query` can be used to access infomation stored in `iron-meta`.
+
+ Examples:
+
+ If I create an instance like this:
+
+ <iron-meta key="info" value="foo/bar"></iron-meta>
+
+ Note that value="foo/bar" is the metadata I've defined. I could define more
+ attributes or use child nodes to define additional metadata.
+
+ Now I can access that element (and it's metadata) from any `iron-meta-query` instance:
+
+ var value = new Polymer.IronMetaQuery({key: 'info'}).value;
+
+ @group Polymer Iron Elements
+ @element iron-meta-query
+ */
+ Polymer.IronMetaQuery = Polymer({
+
+ is: 'iron-meta-query',
+
+ properties: {
+
+ /**
+ * The type of meta-data. All meta-data of the same type is stored
+ * together.
+ */
+ type: {
+ type: String,
+ value: 'default',
+ observer: '_typeChanged'
+ },
+
+ /**
+ * Specifies a key to use for retrieving `value` from the `type`
+ * namespace.
+ */
+ key: {
+ type: String,
+ observer: '_keyChanged'
+ },
+
+ /**
+ * The meta-data to store or retrieve.
+ */
+ value: {
+ type: Object,
+ notify: true,
+ readOnly: true
+ },
+
+ /**
+ * Array of all meta-data values for the given type.
+ */
+ list: {
+ type: Array,
+ notify: true
+ }
+
+ },
+
+ /**
+ * Actually a factory method, not a true constructor. Only runs if
+ * someone invokes it directly (via `new Polymer.IronMeta()`);
+ *
+ * @param {{type: (string|undefined), key: (string|undefined)}=} config
+ */
+ factoryImpl: function(config) {
+ if (config) {
+ for (var n in config) {
+ switch(n) {
+ case 'type':
+ case 'key':
+ this[n] = config[n];
+ break;
+ }
+ }
+ }
+ },
+
+ created: function() {
+ // TODO(sjmiles): good for debugging?
+ this._metaDatas = metaDatas;
+ this._metaArrays = metaArrays;
+ },
+
+ _keyChanged: function(key) {
+ this._setValue(this._metaData && this._metaData[key]);
+ },
+
+ _typeChanged: function(type) {
+ this._metaData = metaDatas[type];
+ this.list = metaArrays[type];
+ if (this.key) {
+ this._keyChanged(this.key);
+ }
+ },
+
+ /**
+ * Retrieves meta data value by key.
+ * @param {string} key The key of the meta-data to be returned.
+ * @return {*}
+ */
+ byKey: function(key) {
+ return this._metaData && this._metaData[key];
+ }
+
+ });
+
+ })();
+</script>
diff --git a/catapult/third_party/polymer/components/iron-meta/test/basic.html b/catapult/third_party/polymer/components/iron-meta/test/basic.html
new file mode 100644
index 00000000..c561dc3c
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/test/basic.html
@@ -0,0 +1,48 @@
+<!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>
+
+ <title>iron-meta-basic</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+
+ <link rel="import" href="../iron-meta.html">
+
+</head>
+<body>
+
+ <iron-meta key="info" value="foo/bar"></iron-meta>
+
+ <script>
+
+ suite('basic', function() {
+
+ test('byKey', function() {
+ var meta = document.createElement('iron-meta');
+ assert.equal(meta.byKey('info'), 'foo/bar');
+ });
+
+ test('list', function() {
+ var meta = document.createElement('iron-meta');
+ assert.equal(meta.list.length, 1);
+ });
+
+ });
+
+ </script>
+
+</body>
+</html>
diff --git a/catapult/third_party/polymer/components/iron-meta/test/index.html b/catapult/third_party/polymer/components/iron-meta/test/index.html
new file mode 100644
index 00000000..2fb0d690
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/test/index.html
@@ -0,0 +1,29 @@
+<!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>Tests</title>
+ <script src="../../web-component-tester/browser.js"></script>
+
+</head>
+<body>
+
+ <script>
+ WCT.loadSuites([
+ 'basic.html',
+ 'iron-meta.html',
+ 'basic.html?dom=shadow',
+ 'iron-meta.html?dom=shadow'
+ ]);
+ </script>
+
+
+
+</body></html>
diff --git a/catapult/third_party/polymer/components/iron-meta/test/iron-meta.html b/catapult/third_party/polymer/components/iron-meta/test/iron-meta.html
new file mode 100644
index 00000000..c4dc2500
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-meta/test/iron-meta.html
@@ -0,0 +1,195 @@
+<!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>
+
+ <title>iron-meta</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-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="../iron-meta.html">
+ <link rel="import" href="../../test-fixture/test-fixture.html">
+
+ </head>
+ <body>
+
+ <test-fixture id="TrivialMeta">
+ <template>
+ <iron-meta self key="info"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="ManyMetas">
+ <template>
+ <iron-meta self key="default1"></iron-meta>
+ <iron-meta self key="default2"></iron-meta>
+ <iron-meta self key="default3"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="DifferentTypedMetas">
+ <template>
+ <iron-meta self type="foo" key="foobarKey"></iron-meta>
+ <iron-meta self type="bar" key="foobarKey"></iron-meta>
+ <iron-meta self key="defaultKey"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="ClashingMetas">
+ <template>
+ <iron-meta self key="baz"></iron-meta>
+ <iron-meta self key="baz"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <script>
+suite('<iron-meta>', function () {
+ suite('basic behavior', function () {
+ var meta;
+
+ setup(function () {
+ meta = fixture('TrivialMeta');
+ });
+
+ teardown(function () {
+ meta.key = null;
+ });
+
+ test('uses itself as the default value', function () {
+ expect(meta.value).to.be.equal(meta);
+ });
+
+ test('can be assigned alternative values', function () {
+ meta.value = 'foobar';
+
+ expect(meta.list[0]).to.be.equal('foobar');
+ });
+
+ test('can access same-type meta values by key', function () {
+ expect(meta.byKey(meta.key)).to.be.equal(meta.value);
+ });
+
+ test('yields a list of same-type meta data', function () {
+ expect(meta.list).to.be.ok;
+ expect(meta.list.length).to.be.equal(1);
+ expect(meta.list[0]).to.be.equal(meta);
+ });
+ });
+
+ suite('many same-typed metas', function () {
+ var metas;
+
+ setup(function () {
+ metas = fixture('ManyMetas');
+ });
+
+ teardown(function () {
+ metas.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('all cache all meta values', function () {
+ metas.forEach(function (meta, index) {
+ expect(meta.list.length).to.be.equal(metas.length);
+ expect(meta.list[index].value).to.be.equal(meta.value);
+ });
+ });
+
+ test('can be unregistered individually', function () {
+ metas[0].key = null;
+
+ expect(metas[0].list.length).to.be.equal(2);
+ expect(metas[0].list).to.be.deep.equal([metas[1], metas[2]])
+ });
+
+ test('can access each others value by key', function () {
+ expect(metas[0].byKey('default2')).to.be.equal(metas[1].value);
+ });
+ });
+
+ suite('different-typed metas', function () {
+ var metas;
+
+ setup(function () {
+ metas = fixture('DifferentTypedMetas');
+ });
+
+ teardown(function () {
+ metas.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('cache their values separately', function () {
+ var fooMeta = metas[0];
+ var barMeta = metas[1];
+
+ expect(fooMeta.value).to.not.be.equal(barMeta.value);
+ expect(fooMeta.byKey('foobarKey')).to.be.equal(fooMeta.value);
+ expect(barMeta.byKey('foobarKey')).to.be.equal(barMeta.value);
+ });
+
+ test('cannot access values of other types', function () {
+ var defaultMeta = metas[2];
+
+ expect(defaultMeta.byKey('foobarKey')).to.be.equal(undefined);
+ });
+
+ test('only list values of their type', function () {
+ metas.forEach(function (meta) {
+ expect(meta.list.length).to.be.equal(1);
+ expect(meta.list[0]).to.be.equal(meta.value);
+ })
+ });
+ });
+
+ suite('metas with clashing keys', function () {
+ var metaPair;
+
+ setup(function () {
+ metaPair = fixture('ClashingMetas');
+ });
+
+ teardown(function () {
+ metaPair.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('let the last value win registration against the key', function () {
+ var registeredValue = metaPair[0].byKey(metaPair[0].key);
+ var firstValue = metaPair[0].value;
+ var secondValue = metaPair[1].value;
+
+ expect(registeredValue).to.not.be.equal(firstValue);
+ expect(registeredValue).to.be.equal(secondValue);
+ });
+ });
+
+ suite('singleton', function () {
+
+ test('only one ironmeta created', function () {
+ var first = Polymer.IronMeta.getIronMeta();
+ var second = Polymer.IronMeta.getIronMeta();
+ expect(first).to.be.equal(second);
+ });
+ });
+});
+ </script>
+
+ </body>
+</html>