Skip to content

Commit b3a2725

Browse files
committed
Merge pull request #1 from PolymerElements/0.5-to-0.8-port
Initial port to Polymer 0.8
2 parents 064dfad + a2e74e3 commit b3a2725

17 files changed

+623
-538
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bower_components

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
firebase-element
22
================
33

4-
See the [component page](http://polymer.github.io/firebase-element) for more information.
4+
See the [component page](http://polymerelements.github.io/firebase-element) for more information.
55

6-
firebase-import
7-
===============
6+
firebase.html
7+
=============
88

99
Import files are a new invention, so libraries like [`firebase`](http://firebase.com) do not yet provide them.
1010

11-
`firebase-import` is an intermediary that provides an import file for the `firebase` component. `firebase-import` depends on `firebase`.
11+
`firebase.html` is an intermediary that provides an import file for the `firebase` component. `firebase.html` depends on `firebase`.
1212

13-
Components that want to use `firebase` should depend on `firebase-element` and import `firebase-import` to be safe from library duplication.
13+
Components that want to use `firebase` should depend on `firebase-element` and import `firebase.html` to be safe from library duplication.
1414
Such components need not use Polymer or `firebase-element`, but we put the import and the element in one package for convenience.

bower.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
22
"name": "firebase-element",
3+
"version": "0.8.0",
34
"private": true,
45
"dependencies": {
5-
"polymer": "Polymer/polymer#master",
6-
"firebase": "^2.2"
6+
"polymer": "polymer/polymer#v0.8.0-rc.6",
7+
"firebase": "^2.2.0"
8+
},
9+
"devDependencies": {
10+
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.6.0",
11+
"iron-doc-viewer": "polymerelements/iron-doc-viewer#^0.8.0",
12+
"web-component-tester": "*"
713
}
814
}

demo.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

demo/firebase.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!doctype html>
2+
<!--
3+
@license
4+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8+
Code distributed by Google as part of the polymer project is also
9+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10+
-->
11+
<html>
12+
<head>
13+
14+
<title>firebase-element</title>
15+
16+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
17+
18+
<link rel="import" href="x-firebase.html">
19+
20+
</head>
21+
<body>
22+
23+
<x-firebase></x-firebase>
24+
25+
</body>
26+
</html>

demo/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!--
2+
@license
3+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7+
Code distributed by Google as part of the polymer project is also
8+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9+
-->
10+
<a href="firebase.html">firebase-element</a>
11+
<br>
12+
<a href="login.html">firebase-login</a>
13+
<br>

demo/login.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<!--
3+
@license
4+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8+
Code distributed by Google as part of the polymer project is also
9+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10+
-->
11+
<html>
12+
<head>
13+
14+
<title>firebase-login</title>
15+
16+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
17+
18+
<link rel="import" href="../../polymer/polymer.html">
19+
<link rel="import" href="x-login.html">
20+
21+
<style>
22+
input:not([type]) {
23+
width: 250px;
24+
}
25+
</style>
26+
27+
</head>
28+
<body>
29+
30+
<x-login></x-login>
31+
32+
</body>
33+
</html>

demo/x-firebase.html

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!--
2+
@license
3+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7+
Code distributed by Google as part of the polymer project is also
8+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9+
-->
10+
<link rel="import" href="../../polymer/polymer.html">
11+
<link rel="import" href="../firebase-element.html">
12+
<link rel="import" href="../firebase.html">
13+
<dom-module id="x-firebase">
14+
<template>
15+
<firebase-element id="base" on-data-change="onDataChange" data="{{data}}" location="https://treedata-demo.firebaseio.com/demo" log></firebase-element>
16+
17+
<h3>Top-level properties persist automatically:</h3>
18+
19+
<input value="{{data.name::input}}">
20+
<br>
21+
<input value="{{data.info::input}}">
22+
23+
<hr>
24+
25+
<h3>Nested properties must be persisted manually:</h3>
26+
27+
<input value="{{data.more.color::input}}">
28+
29+
<button on-tap="onCommitMore">Commit data.more</button>
30+
31+
<hr>
32+
33+
<h3>Remote Data</h3>
34+
<pre>{{json}}</pre>
35+
36+
<hr>
37+
38+
<button on-tap="onResetLocal">Reset Local</button>
39+
<button on-tap="onRemoveLocal">Remove Local</button>
40+
<button on-tap="onResetRemote">Reset remote</button>
41+
<button on-tap="onRemoveRemote">Remove Remote</button>
42+
43+
</template>
44+
</dom-module>
45+
<script>
46+
Polymer({
47+
is: 'x-firebase',
48+
49+
properties: {
50+
data: {
51+
type: Object,
52+
notify: true,
53+
observer: 'dataChanged'
54+
},
55+
56+
json: {
57+
type: Object
58+
}
59+
},
60+
61+
onResetLocal: function() {
62+
// direct setting of data is persisted automatically
63+
this.data = {
64+
name: 'anonymous',
65+
info: 'none',
66+
more: {
67+
color: "yellow"
68+
}
69+
};
70+
},
71+
72+
onRemoveLocal: function() {
73+
this.data = null;
74+
},
75+
76+
onResetRemote: function() {
77+
// Simulate other actor setting data to same remote location
78+
new Firebase('https://treedata-demo.firebaseio.com/demo').set({
79+
name: 'anonymous',
80+
info: 'none',
81+
more: {
82+
color: "yellow"
83+
}
84+
});
85+
},
86+
87+
onCommitMore: function() {
88+
this.$.base.commitProperty('more');
89+
},
90+
91+
dataChanged: function() {
92+
this.json = JSON.stringify(this.data, null, ' ');
93+
}
94+
});
95+
</script>

0 commit comments

Comments
 (0)