adding yatta-element
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
core-component-page
|
||||||
|
===================
|
||||||
|
|
||||||
|
See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-component-page) for more information.
|
||||||
|
|
||||||
|
Note: this is the vulcanized version of [`core-component-page-dev`](https://github.com/Polymer/core-component-page-dev) (the source).
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "core-component-page",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0",
|
||||||
|
"polymer": "Polymer/polymer#^0.5.0"
|
||||||
|
},
|
||||||
|
"version": "0.5.2"
|
||||||
|
}
|
||||||
+37
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
|
|||||||
|
<!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="../polymer/polymer.html">
|
||||||
|
<link rel="import" href="core-component-page.html">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body unresolved>
|
||||||
|
|
||||||
|
<core-component-page></core-component-page>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# bower-peerjs
|
||||||
|
|
||||||
|
Install with `bower`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bower install peerjs
|
||||||
|
```
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="/bower_components/peerjs/peer.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Documentation is available [here](http://peerjs.com/docs).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2010-2013 Michelle Bu and Eric Zhang. http://peerjs.com/
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "peerjs",
|
||||||
|
"version": "0.3.14",
|
||||||
|
"homepage": "http://peerjs.com",
|
||||||
|
"authors": [
|
||||||
|
"Michelle Bu <michelle@michellebu.com>"
|
||||||
|
],
|
||||||
|
"description": "Simple peer-to-peer data and media using WebRTC.",
|
||||||
|
"main": "peer.js",
|
||||||
|
"keywords": [
|
||||||
|
"WebRTC",
|
||||||
|
"peer",
|
||||||
|
"peerjs",
|
||||||
|
"p2p"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
|||||||
|
# Polymer
|
||||||
|
|
||||||
|
[](http://build.chromium.org/p/client.polymer/waterfall)
|
||||||
|
|
||||||
|
## Brief Overview
|
||||||
|
|
||||||
|
For more detailed info goto [http://polymer-project.org/](http://polymer-project.org/).
|
||||||
|
|
||||||
|
Polymer is a new type of library for the web, designed to leverage the existing browser infrastructure to provide the encapsulation and extendability currently only available in JS libraries.
|
||||||
|
|
||||||
|
Polymer is based on a set of future technologies, including [Shadow DOM](http://w3c.github.io/webcomponents/spec/shadow/), [Custom Elements](http://w3c.github.io/webcomponents/spec/custom/) and Model Driven Views. Currently these technologies are implemented as polyfills or shims, but as browsers adopt these features natively, the platform code that drives Polymer evacipates, leaving only the value-adds.
|
||||||
|
|
||||||
|
## Tools & Testing
|
||||||
|
|
||||||
|
For running tests or building minified files, consult the [tooling information](https://www.polymer-project.org/resources/tooling-strategy.html).
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
[Release (tagged) versions](https://github.com/Polymer/polymer/releases) of Polymer include concatenated and minified sources for your convenience.
|
||||||
|
|
||||||
|
[](https://github.com/igrigorik/ga-beacon)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "polymer",
|
||||||
|
"description": "Polymer is a new type of library for the web, built on top of Web Components, and designed to leverage the evolving web platform on modern browsers.",
|
||||||
|
"homepage": "http://www.polymer-project.org/",
|
||||||
|
"keywords": [
|
||||||
|
"util",
|
||||||
|
"client",
|
||||||
|
"browser",
|
||||||
|
"web components",
|
||||||
|
"web-components"
|
||||||
|
],
|
||||||
|
"author": "Polymer Authors <polymer-dev@googlegroups.com>",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core-component-page": "Polymer/core-component-page#^0.5.0",
|
||||||
|
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"tools": "Polymer/tools#master",
|
||||||
|
"web-component-tester": "Polymer/web-component-tester#^1.4.2"
|
||||||
|
},
|
||||||
|
"version": "0.5.2"
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
BUILD LOG
|
||||||
|
---------
|
||||||
|
Build Time: 2014-12-11T12:46:30
|
||||||
|
|
||||||
|
NODEJS INFORMATION
|
||||||
|
==================
|
||||||
|
nodejs: v0.10.33
|
||||||
|
grunt: 0.4.5
|
||||||
|
grunt-audit: 1.0.0
|
||||||
|
grunt-contrib-concat: 0.5.0
|
||||||
|
grunt-contrib-copy: 0.7.0
|
||||||
|
grunt-contrib-uglify: 0.6.0
|
||||||
|
grunt-string-replace: 1.0.0
|
||||||
|
|
||||||
|
REPO REVISIONS
|
||||||
|
==============
|
||||||
|
polymer-expressions: 197c3a0150e7a13374cfcc72e7066113723a623d
|
||||||
|
polymer-gestures: 17a6304916521be39409af292e8adf899bae0ce7
|
||||||
|
polymer: a74e9f36526361dccb6df91be439ff9c3e043f41
|
||||||
|
|
||||||
|
BUILD HASHES
|
||||||
|
============
|
||||||
|
dist/polymer.js: b9ad4c86af79c748cf4ea722f6d56671079fadf7
|
||||||
|
dist/polymer.min.js: 2f2021ba9682b0bb702ee7fb68fb6fbfd288eac2
|
||||||
|
dist/layout.html: 348d358a91712ecc2f8811efa430fcd954b4590c
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
<!--
|
||||||
|
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
|
||||||
|
-->
|
||||||
|
<style shim-shadowdom>
|
||||||
|
/*******************************
|
||||||
|
Flex Layout
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
html /deep/ [layout][horizontal], html /deep/ [layout][vertical] {
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][horizontal][inline], html /deep/ [layout][vertical][inline] {
|
||||||
|
display: -ms-inline-flexbox;
|
||||||
|
display: -webkit-inline-flex;
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][horizontal] {
|
||||||
|
-ms-flex-direction: row;
|
||||||
|
-webkit-flex-direction: row;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][horizontal][reverse] {
|
||||||
|
-ms-flex-direction: row-reverse;
|
||||||
|
-webkit-flex-direction: row-reverse;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][vertical] {
|
||||||
|
-ms-flex-direction: column;
|
||||||
|
-webkit-flex-direction: column;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][vertical][reverse] {
|
||||||
|
-ms-flex-direction: column-reverse;
|
||||||
|
-webkit-flex-direction: column-reverse;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][wrap] {
|
||||||
|
-ms-flex-wrap: wrap;
|
||||||
|
-webkit-flex-wrap: wrap;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][wrap-reverse] {
|
||||||
|
-ms-flex-wrap: wrap-reverse;
|
||||||
|
-webkit-flex-wrap: wrap-reverse;
|
||||||
|
flex-wrap: wrap-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex] {
|
||||||
|
-ms-flex: 1 1 0.000000001px;
|
||||||
|
-webkit-flex: 1;
|
||||||
|
flex: 1;
|
||||||
|
-webkit-flex-basis: 0.000000001px;
|
||||||
|
flex-basis: 0.000000001px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [vertical][layout] > [flex][auto-vertical], html /deep/ [vertical][layout]::shadow [flex][auto-vertical] {
|
||||||
|
-ms-flex: 1 1 auto;
|
||||||
|
-webkit-flex-basis: auto;
|
||||||
|
flex-basis: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][auto] {
|
||||||
|
-ms-flex: 1 1 auto;
|
||||||
|
-webkit-flex-basis: auto;
|
||||||
|
flex-basis: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][none] {
|
||||||
|
-ms-flex: none;
|
||||||
|
-webkit-flex: none;
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][one] {
|
||||||
|
-ms-flex: 1;
|
||||||
|
-webkit-flex: 1;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][two] {
|
||||||
|
-ms-flex: 2;
|
||||||
|
-webkit-flex: 2;
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][three] {
|
||||||
|
-ms-flex: 3;
|
||||||
|
-webkit-flex: 3;
|
||||||
|
flex: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][four] {
|
||||||
|
-ms-flex: 4;
|
||||||
|
-webkit-flex: 4;
|
||||||
|
flex: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][five] {
|
||||||
|
-ms-flex: 5;
|
||||||
|
-webkit-flex: 5;
|
||||||
|
flex: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][six] {
|
||||||
|
-ms-flex: 6;
|
||||||
|
-webkit-flex: 6;
|
||||||
|
flex: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][seven] {
|
||||||
|
-ms-flex: 7;
|
||||||
|
-webkit-flex: 7;
|
||||||
|
flex: 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][eight] {
|
||||||
|
-ms-flex: 8;
|
||||||
|
-webkit-flex: 8;
|
||||||
|
flex: 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][nine] {
|
||||||
|
-ms-flex: 9;
|
||||||
|
-webkit-flex: 9;
|
||||||
|
flex: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][ten] {
|
||||||
|
-ms-flex: 10;
|
||||||
|
-webkit-flex: 10;
|
||||||
|
flex: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][eleven] {
|
||||||
|
-ms-flex: 11;
|
||||||
|
-webkit-flex: 11;
|
||||||
|
flex: 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [flex][twelve] {
|
||||||
|
-ms-flex: 12;
|
||||||
|
-webkit-flex: 12;
|
||||||
|
flex: 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* alignment in cross axis */
|
||||||
|
|
||||||
|
html /deep/ [layout][start] {
|
||||||
|
-ms-flex-align: start;
|
||||||
|
-webkit-align-items: flex-start;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][center], html /deep/ [layout][center-center] {
|
||||||
|
-ms-flex-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][end] {
|
||||||
|
-ms-flex-align: end;
|
||||||
|
-webkit-align-items: flex-end;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* alignment in main axis */
|
||||||
|
|
||||||
|
html /deep/ [layout][start-justified] {
|
||||||
|
-ms-flex-pack: start;
|
||||||
|
-webkit-justify-content: flex-start;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][center-justified], html /deep/ [layout][center-center] {
|
||||||
|
-ms-flex-pack: center;
|
||||||
|
-webkit-justify-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][end-justified] {
|
||||||
|
-ms-flex-pack: end;
|
||||||
|
-webkit-justify-content: flex-end;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][around-justified] {
|
||||||
|
-ms-flex-pack: distribute;
|
||||||
|
-webkit-justify-content: space-around;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [layout][justified] {
|
||||||
|
-ms-flex-pack: justify;
|
||||||
|
-webkit-justify-content: space-between;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* self alignment */
|
||||||
|
|
||||||
|
html /deep/ [self-start] {
|
||||||
|
-ms-align-self: flex-start;
|
||||||
|
-webkit-align-self: flex-start;
|
||||||
|
align-self: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [self-center] {
|
||||||
|
-ms-align-self: center;
|
||||||
|
-webkit-align-self: center;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [self-end] {
|
||||||
|
-ms-align-self: flex-end;
|
||||||
|
-webkit-align-self: flex-end;
|
||||||
|
align-self: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [self-stretch] {
|
||||||
|
-ms-align-self: stretch;
|
||||||
|
-webkit-align-self: stretch;
|
||||||
|
align-self: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
Other Layout
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
html /deep/ [block] {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ie support for hidden */
|
||||||
|
html /deep/ [hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [relative] {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
html /deep/ [fit] {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body[fullbleed] {
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
Other
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
html /deep/ [segment], html /deep/ segment {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-ms-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 1em 0.5em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: white;
|
||||||
|
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
|
||||||
|
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 5px 5px 5px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!--
|
||||||
|
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
|
||||||
|
-->
|
||||||
|
|
||||||
|
<link rel="import" href="layout.html">
|
||||||
|
|
||||||
|
<script src="polymer.js"></script>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+932
@@ -0,0 +1,932 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
// @version 0.5.1-1
|
||||||
|
if (typeof WeakMap === "undefined") {
|
||||||
|
(function() {
|
||||||
|
var defineProperty = Object.defineProperty;
|
||||||
|
var counter = Date.now() % 1e9;
|
||||||
|
var WeakMap = function() {
|
||||||
|
this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
|
||||||
|
};
|
||||||
|
WeakMap.prototype = {
|
||||||
|
set: function(key, value) {
|
||||||
|
var entry = key[this.name];
|
||||||
|
if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
|
||||||
|
value: [ key, value ],
|
||||||
|
writable: true
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
get: function(key) {
|
||||||
|
var entry;
|
||||||
|
return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
|
||||||
|
},
|
||||||
|
"delete": function(key) {
|
||||||
|
var entry = key[this.name];
|
||||||
|
if (!entry || entry[0] !== key) return false;
|
||||||
|
entry[0] = entry[1] = undefined;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
has: function(key) {
|
||||||
|
var entry = key[this.name];
|
||||||
|
if (!entry) return false;
|
||||||
|
return entry[0] === key;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.WeakMap = WeakMap;
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
(function(global) {
|
||||||
|
var registrationsTable = new WeakMap();
|
||||||
|
var setImmediate;
|
||||||
|
if (/Trident|Edge/.test(navigator.userAgent)) {
|
||||||
|
setImmediate = setTimeout;
|
||||||
|
} else if (window.setImmediate) {
|
||||||
|
setImmediate = window.setImmediate;
|
||||||
|
} else {
|
||||||
|
var setImmediateQueue = [];
|
||||||
|
var sentinel = String(Math.random());
|
||||||
|
window.addEventListener("message", function(e) {
|
||||||
|
if (e.data === sentinel) {
|
||||||
|
var queue = setImmediateQueue;
|
||||||
|
setImmediateQueue = [];
|
||||||
|
queue.forEach(function(func) {
|
||||||
|
func();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setImmediate = function(func) {
|
||||||
|
setImmediateQueue.push(func);
|
||||||
|
window.postMessage(sentinel, "*");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var isScheduled = false;
|
||||||
|
var scheduledObservers = [];
|
||||||
|
function scheduleCallback(observer) {
|
||||||
|
scheduledObservers.push(observer);
|
||||||
|
if (!isScheduled) {
|
||||||
|
isScheduled = true;
|
||||||
|
setImmediate(dispatchCallbacks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function wrapIfNeeded(node) {
|
||||||
|
return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
|
||||||
|
}
|
||||||
|
function dispatchCallbacks() {
|
||||||
|
isScheduled = false;
|
||||||
|
var observers = scheduledObservers;
|
||||||
|
scheduledObservers = [];
|
||||||
|
observers.sort(function(o1, o2) {
|
||||||
|
return o1.uid_ - o2.uid_;
|
||||||
|
});
|
||||||
|
var anyNonEmpty = false;
|
||||||
|
observers.forEach(function(observer) {
|
||||||
|
var queue = observer.takeRecords();
|
||||||
|
removeTransientObserversFor(observer);
|
||||||
|
if (queue.length) {
|
||||||
|
observer.callback_(queue, observer);
|
||||||
|
anyNonEmpty = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (anyNonEmpty) dispatchCallbacks();
|
||||||
|
}
|
||||||
|
function removeTransientObserversFor(observer) {
|
||||||
|
observer.nodes_.forEach(function(node) {
|
||||||
|
var registrations = registrationsTable.get(node);
|
||||||
|
if (!registrations) return;
|
||||||
|
registrations.forEach(function(registration) {
|
||||||
|
if (registration.observer === observer) registration.removeTransientObservers();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function forEachAncestorAndObserverEnqueueRecord(target, callback) {
|
||||||
|
for (var node = target; node; node = node.parentNode) {
|
||||||
|
var registrations = registrationsTable.get(node);
|
||||||
|
if (registrations) {
|
||||||
|
for (var j = 0; j < registrations.length; j++) {
|
||||||
|
var registration = registrations[j];
|
||||||
|
var options = registration.options;
|
||||||
|
if (node !== target && !options.subtree) continue;
|
||||||
|
var record = callback(options);
|
||||||
|
if (record) registration.enqueue(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var uidCounter = 0;
|
||||||
|
function JsMutationObserver(callback) {
|
||||||
|
this.callback_ = callback;
|
||||||
|
this.nodes_ = [];
|
||||||
|
this.records_ = [];
|
||||||
|
this.uid_ = ++uidCounter;
|
||||||
|
}
|
||||||
|
JsMutationObserver.prototype = {
|
||||||
|
observe: function(target, options) {
|
||||||
|
target = wrapIfNeeded(target);
|
||||||
|
if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
|
||||||
|
throw new SyntaxError();
|
||||||
|
}
|
||||||
|
var registrations = registrationsTable.get(target);
|
||||||
|
if (!registrations) registrationsTable.set(target, registrations = []);
|
||||||
|
var registration;
|
||||||
|
for (var i = 0; i < registrations.length; i++) {
|
||||||
|
if (registrations[i].observer === this) {
|
||||||
|
registration = registrations[i];
|
||||||
|
registration.removeListeners();
|
||||||
|
registration.options = options;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!registration) {
|
||||||
|
registration = new Registration(this, target, options);
|
||||||
|
registrations.push(registration);
|
||||||
|
this.nodes_.push(target);
|
||||||
|
}
|
||||||
|
registration.addListeners();
|
||||||
|
},
|
||||||
|
disconnect: function() {
|
||||||
|
this.nodes_.forEach(function(node) {
|
||||||
|
var registrations = registrationsTable.get(node);
|
||||||
|
for (var i = 0; i < registrations.length; i++) {
|
||||||
|
var registration = registrations[i];
|
||||||
|
if (registration.observer === this) {
|
||||||
|
registration.removeListeners();
|
||||||
|
registrations.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
this.records_ = [];
|
||||||
|
},
|
||||||
|
takeRecords: function() {
|
||||||
|
var copyOfRecords = this.records_;
|
||||||
|
this.records_ = [];
|
||||||
|
return copyOfRecords;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function MutationRecord(type, target) {
|
||||||
|
this.type = type;
|
||||||
|
this.target = target;
|
||||||
|
this.addedNodes = [];
|
||||||
|
this.removedNodes = [];
|
||||||
|
this.previousSibling = null;
|
||||||
|
this.nextSibling = null;
|
||||||
|
this.attributeName = null;
|
||||||
|
this.attributeNamespace = null;
|
||||||
|
this.oldValue = null;
|
||||||
|
}
|
||||||
|
function copyMutationRecord(original) {
|
||||||
|
var record = new MutationRecord(original.type, original.target);
|
||||||
|
record.addedNodes = original.addedNodes.slice();
|
||||||
|
record.removedNodes = original.removedNodes.slice();
|
||||||
|
record.previousSibling = original.previousSibling;
|
||||||
|
record.nextSibling = original.nextSibling;
|
||||||
|
record.attributeName = original.attributeName;
|
||||||
|
record.attributeNamespace = original.attributeNamespace;
|
||||||
|
record.oldValue = original.oldValue;
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
var currentRecord, recordWithOldValue;
|
||||||
|
function getRecord(type, target) {
|
||||||
|
return currentRecord = new MutationRecord(type, target);
|
||||||
|
}
|
||||||
|
function getRecordWithOldValue(oldValue) {
|
||||||
|
if (recordWithOldValue) return recordWithOldValue;
|
||||||
|
recordWithOldValue = copyMutationRecord(currentRecord);
|
||||||
|
recordWithOldValue.oldValue = oldValue;
|
||||||
|
return recordWithOldValue;
|
||||||
|
}
|
||||||
|
function clearRecords() {
|
||||||
|
currentRecord = recordWithOldValue = undefined;
|
||||||
|
}
|
||||||
|
function recordRepresentsCurrentMutation(record) {
|
||||||
|
return record === recordWithOldValue || record === currentRecord;
|
||||||
|
}
|
||||||
|
function selectRecord(lastRecord, newRecord) {
|
||||||
|
if (lastRecord === newRecord) return lastRecord;
|
||||||
|
if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function Registration(observer, target, options) {
|
||||||
|
this.observer = observer;
|
||||||
|
this.target = target;
|
||||||
|
this.options = options;
|
||||||
|
this.transientObservedNodes = [];
|
||||||
|
}
|
||||||
|
Registration.prototype = {
|
||||||
|
enqueue: function(record) {
|
||||||
|
var records = this.observer.records_;
|
||||||
|
var length = records.length;
|
||||||
|
if (records.length > 0) {
|
||||||
|
var lastRecord = records[length - 1];
|
||||||
|
var recordToReplaceLast = selectRecord(lastRecord, record);
|
||||||
|
if (recordToReplaceLast) {
|
||||||
|
records[length - 1] = recordToReplaceLast;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scheduleCallback(this.observer);
|
||||||
|
}
|
||||||
|
records[length] = record;
|
||||||
|
},
|
||||||
|
addListeners: function() {
|
||||||
|
this.addListeners_(this.target);
|
||||||
|
},
|
||||||
|
addListeners_: function(node) {
|
||||||
|
var options = this.options;
|
||||||
|
if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
|
||||||
|
if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
|
||||||
|
if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
|
||||||
|
if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
|
||||||
|
},
|
||||||
|
removeListeners: function() {
|
||||||
|
this.removeListeners_(this.target);
|
||||||
|
},
|
||||||
|
removeListeners_: function(node) {
|
||||||
|
var options = this.options;
|
||||||
|
if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
|
||||||
|
if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
|
||||||
|
if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
|
||||||
|
if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
|
||||||
|
},
|
||||||
|
addTransientObserver: function(node) {
|
||||||
|
if (node === this.target) return;
|
||||||
|
this.addListeners_(node);
|
||||||
|
this.transientObservedNodes.push(node);
|
||||||
|
var registrations = registrationsTable.get(node);
|
||||||
|
if (!registrations) registrationsTable.set(node, registrations = []);
|
||||||
|
registrations.push(this);
|
||||||
|
},
|
||||||
|
removeTransientObservers: function() {
|
||||||
|
var transientObservedNodes = this.transientObservedNodes;
|
||||||
|
this.transientObservedNodes = [];
|
||||||
|
transientObservedNodes.forEach(function(node) {
|
||||||
|
this.removeListeners_(node);
|
||||||
|
var registrations = registrationsTable.get(node);
|
||||||
|
for (var i = 0; i < registrations.length; i++) {
|
||||||
|
if (registrations[i] === this) {
|
||||||
|
registrations.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
handleEvent: function(e) {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
switch (e.type) {
|
||||||
|
case "DOMAttrModified":
|
||||||
|
var name = e.attrName;
|
||||||
|
var namespace = e.relatedNode.namespaceURI;
|
||||||
|
var target = e.target;
|
||||||
|
var record = new getRecord("attributes", target);
|
||||||
|
record.attributeName = name;
|
||||||
|
record.attributeNamespace = namespace;
|
||||||
|
var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
|
||||||
|
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||||
|
if (!options.attributes) return;
|
||||||
|
if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
|
||||||
|
return record;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DOMCharacterDataModified":
|
||||||
|
var target = e.target;
|
||||||
|
var record = getRecord("characterData", target);
|
||||||
|
var oldValue = e.prevValue;
|
||||||
|
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||||
|
if (!options.characterData) return;
|
||||||
|
if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
|
||||||
|
return record;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DOMNodeRemoved":
|
||||||
|
this.addTransientObserver(e.target);
|
||||||
|
|
||||||
|
case "DOMNodeInserted":
|
||||||
|
var target = e.relatedNode;
|
||||||
|
var changedNode = e.target;
|
||||||
|
var addedNodes, removedNodes;
|
||||||
|
if (e.type === "DOMNodeInserted") {
|
||||||
|
addedNodes = [ changedNode ];
|
||||||
|
removedNodes = [];
|
||||||
|
} else {
|
||||||
|
addedNodes = [];
|
||||||
|
removedNodes = [ changedNode ];
|
||||||
|
}
|
||||||
|
var previousSibling = changedNode.previousSibling;
|
||||||
|
var nextSibling = changedNode.nextSibling;
|
||||||
|
var record = getRecord("childList", target);
|
||||||
|
record.addedNodes = addedNodes;
|
||||||
|
record.removedNodes = removedNodes;
|
||||||
|
record.previousSibling = previousSibling;
|
||||||
|
record.nextSibling = nextSibling;
|
||||||
|
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||||
|
if (!options.childList) return;
|
||||||
|
return record;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
clearRecords();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
global.JsMutationObserver = JsMutationObserver;
|
||||||
|
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
|
||||||
|
})(this);
|
||||||
|
|
||||||
|
window.CustomElements = window.CustomElements || {
|
||||||
|
flags: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function(scope) {
|
||||||
|
var flags = scope.flags;
|
||||||
|
var modules = [];
|
||||||
|
var addModule = function(module) {
|
||||||
|
modules.push(module);
|
||||||
|
};
|
||||||
|
var initializeModules = function() {
|
||||||
|
modules.forEach(function(module) {
|
||||||
|
module(scope);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
scope.addModule = addModule;
|
||||||
|
scope.initializeModules = initializeModules;
|
||||||
|
scope.hasNative = Boolean(document.registerElement);
|
||||||
|
scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
|
||||||
|
})(CustomElements);
|
||||||
|
|
||||||
|
CustomElements.addModule(function(scope) {
|
||||||
|
var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
|
||||||
|
function forSubtree(node, cb) {
|
||||||
|
findAllElements(node, function(e) {
|
||||||
|
if (cb(e)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
forRoots(e, cb);
|
||||||
|
});
|
||||||
|
forRoots(node, cb);
|
||||||
|
}
|
||||||
|
function findAllElements(node, find, data) {
|
||||||
|
var e = node.firstElementChild;
|
||||||
|
if (!e) {
|
||||||
|
e = node.firstChild;
|
||||||
|
while (e && e.nodeType !== Node.ELEMENT_NODE) {
|
||||||
|
e = e.nextSibling;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (e) {
|
||||||
|
if (find(e, data) !== true) {
|
||||||
|
findAllElements(e, find, data);
|
||||||
|
}
|
||||||
|
e = e.nextElementSibling;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function forRoots(node, cb) {
|
||||||
|
var root = node.shadowRoot;
|
||||||
|
while (root) {
|
||||||
|
forSubtree(root, cb);
|
||||||
|
root = root.olderShadowRoot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var processingDocuments;
|
||||||
|
function forDocumentTree(doc, cb) {
|
||||||
|
processingDocuments = [];
|
||||||
|
_forDocumentTree(doc, cb);
|
||||||
|
processingDocuments = null;
|
||||||
|
}
|
||||||
|
function _forDocumentTree(doc, cb) {
|
||||||
|
doc = wrap(doc);
|
||||||
|
if (processingDocuments.indexOf(doc) >= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
processingDocuments.push(doc);
|
||||||
|
var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
|
||||||
|
for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
|
||||||
|
if (n.import) {
|
||||||
|
_forDocumentTree(n.import, cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(doc);
|
||||||
|
}
|
||||||
|
scope.forDocumentTree = forDocumentTree;
|
||||||
|
scope.forSubtree = forSubtree;
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomElements.addModule(function(scope) {
|
||||||
|
var flags = scope.flags;
|
||||||
|
var forSubtree = scope.forSubtree;
|
||||||
|
var forDocumentTree = scope.forDocumentTree;
|
||||||
|
function addedNode(node) {
|
||||||
|
return added(node) || addedSubtree(node);
|
||||||
|
}
|
||||||
|
function added(node) {
|
||||||
|
if (scope.upgrade(node)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
attached(node);
|
||||||
|
}
|
||||||
|
function addedSubtree(node) {
|
||||||
|
forSubtree(node, function(e) {
|
||||||
|
if (added(e)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function attachedNode(node) {
|
||||||
|
attached(node);
|
||||||
|
if (inDocument(node)) {
|
||||||
|
forSubtree(node, function(e) {
|
||||||
|
attached(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
|
||||||
|
scope.hasPolyfillMutations = hasPolyfillMutations;
|
||||||
|
var isPendingMutations = false;
|
||||||
|
var pendingMutations = [];
|
||||||
|
function deferMutation(fn) {
|
||||||
|
pendingMutations.push(fn);
|
||||||
|
if (!isPendingMutations) {
|
||||||
|
isPendingMutations = true;
|
||||||
|
setTimeout(takeMutations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function takeMutations() {
|
||||||
|
isPendingMutations = false;
|
||||||
|
var $p = pendingMutations;
|
||||||
|
for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
|
||||||
|
p();
|
||||||
|
}
|
||||||
|
pendingMutations = [];
|
||||||
|
}
|
||||||
|
function attached(element) {
|
||||||
|
if (hasPolyfillMutations) {
|
||||||
|
deferMutation(function() {
|
||||||
|
_attached(element);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_attached(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function _attached(element) {
|
||||||
|
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
||||||
|
if (!element.__attached && inDocument(element)) {
|
||||||
|
element.__attached = true;
|
||||||
|
if (element.attachedCallback) {
|
||||||
|
element.attachedCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function detachedNode(node) {
|
||||||
|
detached(node);
|
||||||
|
forSubtree(node, function(e) {
|
||||||
|
detached(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function detached(element) {
|
||||||
|
if (hasPolyfillMutations) {
|
||||||
|
deferMutation(function() {
|
||||||
|
_detached(element);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_detached(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function _detached(element) {
|
||||||
|
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
||||||
|
if (element.__attached && !inDocument(element)) {
|
||||||
|
element.__attached = false;
|
||||||
|
if (element.detachedCallback) {
|
||||||
|
element.detachedCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function inDocument(element) {
|
||||||
|
var p = element;
|
||||||
|
var doc = wrap(document);
|
||||||
|
while (p) {
|
||||||
|
if (p == doc) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
p = p.parentNode || p.host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function watchShadow(node) {
|
||||||
|
if (node.shadowRoot && !node.shadowRoot.__watched) {
|
||||||
|
flags.dom && console.log("watching shadow-root for: ", node.localName);
|
||||||
|
var root = node.shadowRoot;
|
||||||
|
while (root) {
|
||||||
|
observe(root);
|
||||||
|
root = root.olderShadowRoot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handler(mutations) {
|
||||||
|
if (flags.dom) {
|
||||||
|
var mx = mutations[0];
|
||||||
|
if (mx && mx.type === "childList" && mx.addedNodes) {
|
||||||
|
if (mx.addedNodes) {
|
||||||
|
var d = mx.addedNodes[0];
|
||||||
|
while (d && d !== document && !d.host) {
|
||||||
|
d = d.parentNode;
|
||||||
|
}
|
||||||
|
var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
|
||||||
|
u = u.split("/?").shift().split("/").pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.group("mutations (%d) [%s]", mutations.length, u || "");
|
||||||
|
}
|
||||||
|
mutations.forEach(function(mx) {
|
||||||
|
if (mx.type === "childList") {
|
||||||
|
forEach(mx.addedNodes, function(n) {
|
||||||
|
if (!n.localName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
addedNode(n);
|
||||||
|
});
|
||||||
|
forEach(mx.removedNodes, function(n) {
|
||||||
|
if (!n.localName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detachedNode(n);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
flags.dom && console.groupEnd();
|
||||||
|
}
|
||||||
|
function takeRecords(node) {
|
||||||
|
node = wrap(node);
|
||||||
|
if (!node) {
|
||||||
|
node = wrap(document);
|
||||||
|
}
|
||||||
|
while (node.parentNode) {
|
||||||
|
node = node.parentNode;
|
||||||
|
}
|
||||||
|
var observer = node.__observer;
|
||||||
|
if (observer) {
|
||||||
|
handler(observer.takeRecords());
|
||||||
|
takeMutations();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
||||||
|
function observe(inRoot) {
|
||||||
|
if (inRoot.__observer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var observer = new MutationObserver(handler);
|
||||||
|
observer.observe(inRoot, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
inRoot.__observer = observer;
|
||||||
|
}
|
||||||
|
function upgradeDocument(doc) {
|
||||||
|
doc = wrap(doc);
|
||||||
|
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
|
||||||
|
addedNode(doc);
|
||||||
|
observe(doc);
|
||||||
|
flags.dom && console.groupEnd();
|
||||||
|
}
|
||||||
|
function upgradeDocumentTree(doc) {
|
||||||
|
forDocumentTree(doc, upgradeDocument);
|
||||||
|
}
|
||||||
|
var originalCreateShadowRoot = Element.prototype.createShadowRoot;
|
||||||
|
Element.prototype.createShadowRoot = function() {
|
||||||
|
var root = originalCreateShadowRoot.call(this);
|
||||||
|
CustomElements.watchShadow(this);
|
||||||
|
return root;
|
||||||
|
};
|
||||||
|
scope.watchShadow = watchShadow;
|
||||||
|
scope.upgradeDocumentTree = upgradeDocumentTree;
|
||||||
|
scope.upgradeSubtree = addedSubtree;
|
||||||
|
scope.upgradeAll = addedNode;
|
||||||
|
scope.attachedNode = attachedNode;
|
||||||
|
scope.takeRecords = takeRecords;
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomElements.addModule(function(scope) {
|
||||||
|
var flags = scope.flags;
|
||||||
|
function upgrade(node) {
|
||||||
|
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
||||||
|
var is = node.getAttribute("is");
|
||||||
|
var definition = scope.getRegisteredDefinition(is || node.localName);
|
||||||
|
if (definition) {
|
||||||
|
if (is && definition.tag == node.localName) {
|
||||||
|
return upgradeWithDefinition(node, definition);
|
||||||
|
} else if (!is && !definition.extends) {
|
||||||
|
return upgradeWithDefinition(node, definition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function upgradeWithDefinition(element, definition) {
|
||||||
|
flags.upgrade && console.group("upgrade:", element.localName);
|
||||||
|
if (definition.is) {
|
||||||
|
element.setAttribute("is", definition.is);
|
||||||
|
}
|
||||||
|
implementPrototype(element, definition);
|
||||||
|
element.__upgraded__ = true;
|
||||||
|
created(element);
|
||||||
|
scope.attachedNode(element);
|
||||||
|
scope.upgradeSubtree(element);
|
||||||
|
flags.upgrade && console.groupEnd();
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
function implementPrototype(element, definition) {
|
||||||
|
if (Object.__proto__) {
|
||||||
|
element.__proto__ = definition.prototype;
|
||||||
|
} else {
|
||||||
|
customMixin(element, definition.prototype, definition.native);
|
||||||
|
element.__proto__ = definition.prototype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function customMixin(inTarget, inSrc, inNative) {
|
||||||
|
var used = {};
|
||||||
|
var p = inSrc;
|
||||||
|
while (p !== inNative && p !== HTMLElement.prototype) {
|
||||||
|
var keys = Object.getOwnPropertyNames(p);
|
||||||
|
for (var i = 0, k; k = keys[i]; i++) {
|
||||||
|
if (!used[k]) {
|
||||||
|
Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
|
||||||
|
used[k] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = Object.getPrototypeOf(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function created(element) {
|
||||||
|
if (element.createdCallback) {
|
||||||
|
element.createdCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scope.upgrade = upgrade;
|
||||||
|
scope.upgradeWithDefinition = upgradeWithDefinition;
|
||||||
|
scope.implementPrototype = implementPrototype;
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomElements.addModule(function(scope) {
|
||||||
|
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
||||||
|
var upgrade = scope.upgrade;
|
||||||
|
var upgradeWithDefinition = scope.upgradeWithDefinition;
|
||||||
|
var implementPrototype = scope.implementPrototype;
|
||||||
|
var useNative = scope.useNative;
|
||||||
|
function register(name, options) {
|
||||||
|
var definition = options || {};
|
||||||
|
if (!name) {
|
||||||
|
throw new Error("document.registerElement: first argument `name` must not be empty");
|
||||||
|
}
|
||||||
|
if (name.indexOf("-") < 0) {
|
||||||
|
throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
|
||||||
|
}
|
||||||
|
if (isReservedTag(name)) {
|
||||||
|
throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
|
||||||
|
}
|
||||||
|
if (getRegisteredDefinition(name)) {
|
||||||
|
throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
|
||||||
|
}
|
||||||
|
if (!definition.prototype) {
|
||||||
|
definition.prototype = Object.create(HTMLElement.prototype);
|
||||||
|
}
|
||||||
|
definition.__name = name.toLowerCase();
|
||||||
|
definition.lifecycle = definition.lifecycle || {};
|
||||||
|
definition.ancestry = ancestry(definition.extends);
|
||||||
|
resolveTagName(definition);
|
||||||
|
resolvePrototypeChain(definition);
|
||||||
|
overrideAttributeApi(definition.prototype);
|
||||||
|
registerDefinition(definition.__name, definition);
|
||||||
|
definition.ctor = generateConstructor(definition);
|
||||||
|
definition.ctor.prototype = definition.prototype;
|
||||||
|
definition.prototype.constructor = definition.ctor;
|
||||||
|
if (scope.ready) {
|
||||||
|
upgradeDocumentTree(document);
|
||||||
|
}
|
||||||
|
return definition.ctor;
|
||||||
|
}
|
||||||
|
function overrideAttributeApi(prototype) {
|
||||||
|
if (prototype.setAttribute._polyfilled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var setAttribute = prototype.setAttribute;
|
||||||
|
prototype.setAttribute = function(name, value) {
|
||||||
|
changeAttribute.call(this, name, value, setAttribute);
|
||||||
|
};
|
||||||
|
var removeAttribute = prototype.removeAttribute;
|
||||||
|
prototype.removeAttribute = function(name) {
|
||||||
|
changeAttribute.call(this, name, null, removeAttribute);
|
||||||
|
};
|
||||||
|
prototype.setAttribute._polyfilled = true;
|
||||||
|
}
|
||||||
|
function changeAttribute(name, value, operation) {
|
||||||
|
name = name.toLowerCase();
|
||||||
|
var oldValue = this.getAttribute(name);
|
||||||
|
operation.apply(this, arguments);
|
||||||
|
var newValue = this.getAttribute(name);
|
||||||
|
if (this.attributeChangedCallback && newValue !== oldValue) {
|
||||||
|
this.attributeChangedCallback(name, oldValue, newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isReservedTag(name) {
|
||||||
|
for (var i = 0; i < reservedTagList.length; i++) {
|
||||||
|
if (name === reservedTagList[i]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
|
||||||
|
function ancestry(extnds) {
|
||||||
|
var extendee = getRegisteredDefinition(extnds);
|
||||||
|
if (extendee) {
|
||||||
|
return ancestry(extendee.extends).concat([ extendee ]);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
function resolveTagName(definition) {
|
||||||
|
var baseTag = definition.extends;
|
||||||
|
for (var i = 0, a; a = definition.ancestry[i]; i++) {
|
||||||
|
baseTag = a.is && a.tag;
|
||||||
|
}
|
||||||
|
definition.tag = baseTag || definition.__name;
|
||||||
|
if (baseTag) {
|
||||||
|
definition.is = definition.__name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function resolvePrototypeChain(definition) {
|
||||||
|
if (!Object.__proto__) {
|
||||||
|
var nativePrototype = HTMLElement.prototype;
|
||||||
|
if (definition.is) {
|
||||||
|
var inst = document.createElement(definition.tag);
|
||||||
|
var expectedPrototype = Object.getPrototypeOf(inst);
|
||||||
|
if (expectedPrototype === definition.prototype) {
|
||||||
|
nativePrototype = expectedPrototype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var proto = definition.prototype, ancestor;
|
||||||
|
while (proto && proto !== nativePrototype) {
|
||||||
|
ancestor = Object.getPrototypeOf(proto);
|
||||||
|
proto.__proto__ = ancestor;
|
||||||
|
proto = ancestor;
|
||||||
|
}
|
||||||
|
definition.native = nativePrototype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function instantiate(definition) {
|
||||||
|
return upgradeWithDefinition(domCreateElement(definition.tag), definition);
|
||||||
|
}
|
||||||
|
var registry = {};
|
||||||
|
function getRegisteredDefinition(name) {
|
||||||
|
if (name) {
|
||||||
|
return registry[name.toLowerCase()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function registerDefinition(name, definition) {
|
||||||
|
registry[name] = definition;
|
||||||
|
}
|
||||||
|
function generateConstructor(definition) {
|
||||||
|
return function() {
|
||||||
|
return instantiate(definition);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
||||||
|
function createElementNS(namespace, tag, typeExtension) {
|
||||||
|
if (namespace === HTML_NAMESPACE) {
|
||||||
|
return createElement(tag, typeExtension);
|
||||||
|
} else {
|
||||||
|
return domCreateElementNS(namespace, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createElement(tag, typeExtension) {
|
||||||
|
var definition = getRegisteredDefinition(typeExtension || tag);
|
||||||
|
if (definition) {
|
||||||
|
if (tag == definition.tag && typeExtension == definition.is) {
|
||||||
|
return new definition.ctor();
|
||||||
|
}
|
||||||
|
if (!typeExtension && !definition.is) {
|
||||||
|
return new definition.ctor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var element;
|
||||||
|
if (typeExtension) {
|
||||||
|
element = createElement(tag);
|
||||||
|
element.setAttribute("is", typeExtension);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
element = domCreateElement(tag);
|
||||||
|
if (tag.indexOf("-") >= 0) {
|
||||||
|
implementPrototype(element, HTMLElement);
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
function cloneNode(deep) {
|
||||||
|
var n = domCloneNode.call(this, deep);
|
||||||
|
upgrade(n);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
var domCreateElement = document.createElement.bind(document);
|
||||||
|
var domCreateElementNS = document.createElementNS.bind(document);
|
||||||
|
var domCloneNode = Node.prototype.cloneNode;
|
||||||
|
var isInstance;
|
||||||
|
if (!Object.__proto__ && !useNative) {
|
||||||
|
isInstance = function(obj, ctor) {
|
||||||
|
var p = obj;
|
||||||
|
while (p) {
|
||||||
|
if (p === ctor.prototype) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
p = p.__proto__;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
isInstance = function(obj, base) {
|
||||||
|
return obj instanceof base;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
document.registerElement = register;
|
||||||
|
document.createElement = createElement;
|
||||||
|
document.createElementNS = createElementNS;
|
||||||
|
Node.prototype.cloneNode = cloneNode;
|
||||||
|
scope.registry = registry;
|
||||||
|
scope.instanceof = isInstance;
|
||||||
|
scope.reservedTagList = reservedTagList;
|
||||||
|
scope.getRegisteredDefinition = getRegisteredDefinition;
|
||||||
|
document.register = document.registerElement;
|
||||||
|
});
|
||||||
|
|
||||||
|
(function(scope) {
|
||||||
|
var useNative = scope.useNative;
|
||||||
|
var initializeModules = scope.initializeModules;
|
||||||
|
var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
||||||
|
if (useNative) {
|
||||||
|
var nop = function() {};
|
||||||
|
scope.watchShadow = nop;
|
||||||
|
scope.upgrade = nop;
|
||||||
|
scope.upgradeAll = nop;
|
||||||
|
scope.upgradeDocumentTree = nop;
|
||||||
|
scope.upgradeSubtree = nop;
|
||||||
|
scope.takeRecords = nop;
|
||||||
|
scope.instanceof = function(obj, base) {
|
||||||
|
return obj instanceof base;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
initializeModules();
|
||||||
|
}
|
||||||
|
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
||||||
|
if (!window.wrap) {
|
||||||
|
if (window.ShadowDOMPolyfill) {
|
||||||
|
window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
|
||||||
|
window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
|
||||||
|
} else {
|
||||||
|
window.wrap = window.unwrap = function(node) {
|
||||||
|
return node;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function bootstrap() {
|
||||||
|
upgradeDocumentTree(wrap(document));
|
||||||
|
if (window.HTMLImports) {
|
||||||
|
HTMLImports.__importsParsingHook = function(elt) {
|
||||||
|
upgradeDocumentTree(wrap(elt.import));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
CustomElements.ready = true;
|
||||||
|
setTimeout(function() {
|
||||||
|
CustomElements.readyTime = Date.now();
|
||||||
|
if (window.HTMLImports) {
|
||||||
|
CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
|
||||||
|
}
|
||||||
|
document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
||||||
|
bubbles: true
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
||||||
|
window.CustomEvent = function(inType, params) {
|
||||||
|
params = params || {};
|
||||||
|
var e = document.createEvent("CustomEvent");
|
||||||
|
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
||||||
|
return e;
|
||||||
|
};
|
||||||
|
window.CustomEvent.prototype = window.Event.prototype;
|
||||||
|
}
|
||||||
|
if (document.readyState === "complete" || scope.flags.eager) {
|
||||||
|
bootstrap();
|
||||||
|
} else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
|
||||||
|
bootstrap();
|
||||||
|
} else {
|
||||||
|
var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
||||||
|
window.addEventListener(loadEvent, bootstrap);
|
||||||
|
}
|
||||||
|
})(window.CustomElements);
|
||||||
+11
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+11
File diff suppressed because one or more lines are too long
@@ -0,0 +1,44 @@
|
|||||||
|
webcomponents.js
|
||||||
|
================
|
||||||
|
|
||||||
|
A suite of polyfills supporting the [Web Components](http://webcomponents.org) specs:
|
||||||
|
|
||||||
|
**Custom Elements**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/)).
|
||||||
|
|
||||||
|
**HTML Imports**: a way to include and reuse HTML documents via other HTML documents ([spec](https://w3c.github.io/webcomponents/spec/imports/)).
|
||||||
|
|
||||||
|
**Shadow DOM**: provides encapsulation by hiding DOM subtrees under shadow roots ([spec](https://w3c.github.io/webcomponents/spec/shadow/)).
|
||||||
|
|
||||||
|
This also folds in polyfills for `MutationObserver` and `WeakMap`.
|
||||||
|
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/webcomponents/webcomponentsjs/releases) of this repo. There are two variants:
|
||||||
|
|
||||||
|
`webcomponents.js` includes all of the polyfills.
|
||||||
|
|
||||||
|
`webcomponents-lite.js` includes all polyfills except for shadow DOM.
|
||||||
|
|
||||||
|
|
||||||
|
### Manually Building
|
||||||
|
|
||||||
|
If you wish to build the polyfills yourself, you'll need `node` and `gulp` on your system:
|
||||||
|
|
||||||
|
* install [node.js](http://nodejs.org/) using the instructions on their website
|
||||||
|
* use `npm` to install [gulp.js](http://gulpjs.com/): `npm install -g gulp`
|
||||||
|
|
||||||
|
Now you are ready to build the polyfills with:
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
npm install
|
||||||
|
# build
|
||||||
|
gulp build
|
||||||
|
|
||||||
|
The builds will be placed into the `dist/` directory.
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
See the [contributing guide](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "webcomponentsjs",
|
||||||
|
"main": "webcomponents.js",
|
||||||
|
"version": "0.5.2",
|
||||||
|
"homepage": "http://webcomponents.org",
|
||||||
|
"authors": [
|
||||||
|
"The Polymer Authors"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"webcomponents"
|
||||||
|
],
|
||||||
|
"license": "BSD",
|
||||||
|
"ignore": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
BUILD LOG
|
||||||
|
---------
|
||||||
|
Build Time: 2014-12-11T12:45:39-0800
|
||||||
|
|
||||||
|
NODEJS INFORMATION
|
||||||
|
==================
|
||||||
|
nodejs: v0.10.33
|
||||||
|
gulp: 3.8.10
|
||||||
|
gulp-audit: 1.0.0
|
||||||
|
gulp-concat: 2.4.2
|
||||||
|
gulp-header: 1.2.2
|
||||||
|
gulp-uglify: 1.0.2
|
||||||
|
run-sequence: 1.0.2
|
||||||
|
web-component-tester: 2.0.1
|
||||||
|
|
||||||
|
REPO REVISIONS
|
||||||
|
==============
|
||||||
|
webcomponentsjs: d83cc676df65dc61db22bca47d33da679391f5a0
|
||||||
|
|
||||||
|
BUILD HASHES
|
||||||
|
============
|
||||||
|
CustomElements.js: b221f7741515b570df70fd1c50b398bb8f731b81
|
||||||
|
CustomElements.min.js: 6a55999d9f4895525d35c5248e2f409f176162a6
|
||||||
|
HTMLImports.js: 72dd4ea891dc3c5256c569992288eca9f5c5e450
|
||||||
|
HTMLImports.min.js: 1677819e83722c7d163a571598d8d36cdc8ae690
|
||||||
|
ShadowDOM.js: a1cce2304031d5acb440978761b346b98d06e1a4
|
||||||
|
ShadowDOM.min.js: 9371908d889872eb7e8e320e8877c394eb906732
|
||||||
|
webcomponents-lite.js: 7b6c8fbd7f67a2bd04b797a72e808b16ab54518f
|
||||||
|
webcomponents-lite.min.js: 41b033fa7e52bf612686f222d5a496d48bd2909c
|
||||||
|
webcomponents.js: 523f45c65c94d71543729f7e3d32ec4b7a48ae5b
|
||||||
|
webcomponents.min.js: 645b22d4c22bf6eaf470bc03d819d396661ac439
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "webcomponents.js",
|
||||||
|
"version": "0.5.1-1",
|
||||||
|
"description": "webcomponents.js",
|
||||||
|
"main": "gulpfile.js",
|
||||||
|
"directories": {
|
||||||
|
"test": "tests"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/webcomponents/webcomponentsjs.git"
|
||||||
|
},
|
||||||
|
"author": "The Polymer Authors",
|
||||||
|
"license": {
|
||||||
|
"type": "BSD-3-Clause",
|
||||||
|
"url": "http://polymer.github.io/LICENSE.txt"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/webcomponents/webcomponentsjs/issues"
|
||||||
|
},
|
||||||
|
"homepage": "http://webcomponents.org",
|
||||||
|
"devDependencies": {
|
||||||
|
"gulp": "^3.8.8",
|
||||||
|
"gulp-audit": "^1.0.0",
|
||||||
|
"gulp-concat": "^2.4.1",
|
||||||
|
"gulp-header": "^1.1.1",
|
||||||
|
"gulp-uglify": "^1.0.1",
|
||||||
|
"run-sequence": "^1.0.1",
|
||||||
|
"web-component-tester": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
+1719
File diff suppressed because it is too large
Load Diff
+11
File diff suppressed because one or more lines are too long
+6375
File diff suppressed because it is too large
Load Diff
+14
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset=utf-8 />
|
||||||
|
<title>Yatta+Polymer Example</title>
|
||||||
|
<script src="../../bower_components/webcomponentsjs/webcomponents.min.js"></script>
|
||||||
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||||
|
|
||||||
|
<link rel="import" href="yatta-test.html">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<yatta-test></yatta-test>
|
||||||
|
<script src="./index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
window.onload = function(){
|
||||||
|
window.x = document.querySelector("yatta-test");
|
||||||
|
x.yatta.val("stuff",{otherstuff:{nostuff:"this is no stuff"}})
|
||||||
|
setTimeout(function(){
|
||||||
|
var res = x.yatta.val("stuff");
|
||||||
|
if(!(x.nostuff.val() === "this is no stuff")){
|
||||||
|
console.log("Deep inherit doesn't work")
|
||||||
|
}
|
||||||
|
window.y_stuff_property.val = {nostuff: "this is also no stuff"};
|
||||||
|
setTimeout(function(){
|
||||||
|
if(!(x.nostuff.val() === "this is also no stuff")){
|
||||||
|
console.log("Element val overwrite doesn't work")
|
||||||
|
}
|
||||||
|
console.log("res");
|
||||||
|
},500)
|
||||||
|
},500);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<link rel="import" href="../../yatta-element.html">
|
||||||
|
|
||||||
|
<link rel="import" href="../../bower_components/connector/peerjs-connector/peerjs-connector.html">
|
||||||
|
|
||||||
|
<polymer-element name="yatta-test" attributes="yatta connector stuff">
|
||||||
|
<template>
|
||||||
|
<peerjs-connector id="connector" conn_id="1234" key="h7nlefbgavh1tt9" connector={{connector}}></peerjs-connector>
|
||||||
|
<yatta-element connector={{connector}} val={{yatta}}>
|
||||||
|
<yatta-property name="stuff" val={{stuff}}>
|
||||||
|
<yatta-property id="otherstuff" name="otherstuff" val={{otherstuff}}>
|
||||||
|
</yatta-property>
|
||||||
|
</yatta-property>
|
||||||
|
</yatta-element>
|
||||||
|
<yatta-element val={{otherstuff}}>
|
||||||
|
<yatta-property name="nostuff" val={{nostuff}}>
|
||||||
|
</yatta-property>
|
||||||
|
</yatta-element>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
Polymer({
|
||||||
|
ready: function(){
|
||||||
|
window.y_stuff_property = this.$.otherstuff;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</polymer-element>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
Yatta = require './yatta'
|
||||||
|
|
||||||
|
bindToChildren = (that)->
|
||||||
|
for i in [0...that.children.length]
|
||||||
|
attr = that.children.item(i)
|
||||||
|
if attr.name?
|
||||||
|
attr.val = that.val.val(attr.name)
|
||||||
|
that.val.observe (events)->
|
||||||
|
for event in events
|
||||||
|
if event.name?
|
||||||
|
for i in [0...that.children.length]
|
||||||
|
attr = that.children.item(i)
|
||||||
|
if attr.name? and attr.name is event.name
|
||||||
|
newVal = that.val.val(attr.name)
|
||||||
|
if attr.val isnt newVal
|
||||||
|
attr.val = newVal
|
||||||
|
|
||||||
|
Polymer "yatta-element",
|
||||||
|
ready: ()->
|
||||||
|
if @connector?
|
||||||
|
@val = new Yatta @connector
|
||||||
|
bindToChildren @
|
||||||
|
else if @val?
|
||||||
|
bindToChildren @
|
||||||
|
|
||||||
|
valChanged: ()->
|
||||||
|
if @val? and @val.type is "JsonType"
|
||||||
|
bindToChildren @
|
||||||
|
|
||||||
|
Polymer "yatta-property",
|
||||||
|
ready: ()->
|
||||||
|
if @val? and @name?
|
||||||
|
if @val.constructor is Object
|
||||||
|
@val = @parentElement.val(@name,@val).val(@name)
|
||||||
|
# TODO: please use instanceof instead of .type,
|
||||||
|
# since it is more safe (consider someone putting a custom Object type here)
|
||||||
|
else if typeof @val is "string"
|
||||||
|
@parentElement.val(@name,@val)
|
||||||
|
if @val.type is "JsonType"
|
||||||
|
bindToChildren @
|
||||||
|
|
||||||
|
valChanged: ()->
|
||||||
|
if @val? and @name?
|
||||||
|
if @val.constructor is Object
|
||||||
|
@val = @parentElement.val.val(@name,@val).val(@name)
|
||||||
|
# TODO: please use instanceof instead of .type,
|
||||||
|
# since it is more safe (consider someone putting a custom Object type here)
|
||||||
|
if @val.type is "JsonType"
|
||||||
|
bindToChildren @
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
json_types_uninitialized = require "./Types/JsonTypes"
|
||||||
|
HistoryBuffer = require "./HistoryBuffer"
|
||||||
|
Engine = require "./Engine"
|
||||||
|
adaptConnector = require "./ConnectorAdapter"
|
||||||
|
|
||||||
|
createYatta = (connector)->
|
||||||
|
user_id = connector.id # TODO: change to getUniqueId()
|
||||||
|
HB = new HistoryBuffer user_id
|
||||||
|
type_manager = json_types_uninitialized HB
|
||||||
|
types = type_manager.types
|
||||||
|
|
||||||
|
#
|
||||||
|
# Framework for Json data-structures.
|
||||||
|
# Known values that are supported:
|
||||||
|
# * String
|
||||||
|
# * Integer
|
||||||
|
# * Array
|
||||||
|
#
|
||||||
|
class Yatta extends types.JsonType
|
||||||
|
|
||||||
|
#
|
||||||
|
# @param {String} user_id Unique id of the peer.
|
||||||
|
# @param {Connector} Connector the connector class.
|
||||||
|
#
|
||||||
|
constructor: ()->
|
||||||
|
@connector = connector
|
||||||
|
@HB = HB
|
||||||
|
@types = types
|
||||||
|
@engine = new Engine @HB, type_manager.parser
|
||||||
|
adaptConnector @connector, @engine, @HB, type_manager.execution_listener
|
||||||
|
super
|
||||||
|
|
||||||
|
getConnector: ()->
|
||||||
|
@connector
|
||||||
|
|
||||||
|
return new Yatta(HB.getReservedUniqueIdentifier()).execute()
|
||||||
|
|
||||||
|
module.exports = createYatta
|
||||||
|
if window? and not window.Yatta?
|
||||||
|
window.Yatta = createYatta
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<polymer-element name="yatta-element" hidden attributes="val connector">
|
||||||
|
</polymer-element>
|
||||||
|
<polymer-element name="yatta-property" hidden attributes="val name">
|
||||||
|
</polymer-element>
|
||||||
|
|
||||||
|
<script src="./build/browser/yatta-element.js"></script>
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user