Skip to content

Commit faf2517

Browse files
author
Arthur Evans
authored
Merge pull request Polymer#8 from Polymer/3.x
3.x
2 parents fe5cfae + ee4714f commit faf2517

25 files changed

+12505
-13008
lines changed

app.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ libraries:
1010

1111
handlers:
1212

13-
- url: /bower_components
14-
static_dir: bower_components
13+
- url: /webcomponentsjs
14+
static_dir: webcomponentsjs
1515
secure: always
1616

1717
- url: /css

app/3.0/samples/about/starter/likeable-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {PolymerElement, html} from '@polymer/polymer';
77
// Define an element class
88
class LikeableElement extends PolymerElement {
99

10-
// Define publc API properties
10+
// Define public API properties
1111
static get properties() { return { liked: Boolean }}
1212

1313
// Define the element's template

app/elements/demo-tabs.html renamed to app/elements/demo-tabs.js

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
<!--
2-
@license
3-
Copyright (c) 2016 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="../bower_components/paper-tabs/paper-tabs.html">
11-
<link rel="import" href="../bower_components/paper-tabs/paper-tab.html">
12-
<link rel="import" href="../bower_components/paper-button/paper-button.html">
13-
<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
14-
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
15-
16-
<dom-module id='demo-tabs'>
17-
<template>
1+
/*
2+
* @license
3+
* Copyright (c) 2018 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+
11+
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
12+
import '@polymer/iron-pages/iron-pages.js';
13+
import '@polymer/iron-selector/iron-selector.js';
14+
import '@polymer/paper-button/paper-button.js';
15+
import '@polymer/paper-tabs/paper-tabs.js';
16+
import '@polymer/paper-tabs/paper-tab.js';
17+
18+
class DemoTabs extends PolymerElement {
19+
static get template() {
20+
return html`
1821
<style include="iron-flex">
1922
:host {
2023
display: block;
@@ -102,13 +105,11 @@
102105
project-path="[[projectPath]]">
103106
</stack-blitz>
104107
</iron-pages>
105-
</template>
108+
`;
109+
}
106110

107-
<script>
108-
Polymer({
109-
is: 'demo-tabs',
110-
111-
properties: {
111+
static get properties() {
112+
return {
112113
/**
113114
* URL of the Plunker demo
114115
*/
@@ -149,54 +150,54 @@
149150
_hideEditorButton: {
150151
type: Boolean,
151152
},
152-
},
153-
154-
observers: ['_srcProjectPathChanged(src, projectPath)'],
155-
156-
attached: function() {
157-
this._selected = 0;
158-
},
159-
160-
_srcProjectPathChanged: function(src, projectPath) {
161-
const isPlunkr = !!this.src;
162-
const isStackBlitz = !!this.projectPath;
163-
this._iframeHidden = !isPlunkr;
164-
this._hideEditorButton = !isPlunkr && !isStackBlitz;
165-
},
166-
167-
_launchEditor() {
168-
if (!!this.projectPath) {
169-
this._launchInlineEditor();
170-
} else if (!!this.src) {
171-
this._launchPlunkr();
172-
}
173-
},
153+
};
154+
}
155+
156+
static get observers() {
157+
return ['_srcProjectPathChanged(src, projectPath)'];
158+
}
159+
160+
connectedCallback() {
161+
super.connectedCallback();
162+
this._selected = 0;
163+
}
164+
165+
_srcProjectPathChanged(src, projectPath) {
166+
const isPlunkr = !!this.src;
167+
const isStackBlitz = !!this.projectPath;
168+
this._iframeHidden = !isPlunkr;
169+
this._hideEditorButton = !isPlunkr && !isStackBlitz;
170+
}
171+
172+
_launchEditor() {
173+
if (!!this.projectPath) {
174+
this._launchInlineEditor();
175+
} else if (!!this.src) {
176+
this._launchPlunkr();
177+
}
178+
}
174179

175-
_launchPlunkr: function() {
176-
if (window.recordPlunker) {
177-
window.recordPlunker(this.name);
178-
}
179-
},
180-
181-
// Call out to a global method defined by app.js
182-
_launchInlineEditor: function() {
183-
this._displaySelected = 'loading';
184-
185-
const onError = function() {
186-
this.$.editButton.disabled = true;
187-
this.$.editButton.innerText = 'Error loading editor';
188-
this._displaySelected = 'static';
189-
}.bind(this);
190-
191-
const onLoad = function() {
192-
this.$.editor.embed()
193-
.then(function(){
194-
this._displaySelected = 'editor';
195-
}.bind(this)).catch(onError);
196-
}.bind(this);
197-
198-
this.importHref('/elements/stack-blitz.html', onLoad, onError, true);
180+
_launchPlunkr() {
181+
if (window.recordPlunker) {
182+
window.recordPlunker(this.name);
199183
}
200-
});
201-
</script>
202-
</dom-module>
184+
}
185+
186+
// Call out to a global method defined by app.js
187+
_launchInlineEditor() {
188+
this._displaySelected = 'loading';
189+
190+
// Ignore jshint for dynamic import().
191+
import('./stack-blitz.js').then(() => { // jshint ignore:line
192+
return this.$.editor.embed().then(() => {
193+
this._displaySelected = 'editor';
194+
});
195+
}).catch(() => {
196+
this.$.editButton.disabled = true;
197+
this.$.editButton.innerText = 'Error loading editor';
198+
this._displaySelected = 'static';
199+
});
200+
}
201+
}
202+
203+
customElements.define('demo-tabs', DemoTabs);

app/elements/google-youtube.html

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

app/elements/google-youtube.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* @license
3+
* Copyright (c) 2018 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+
11+
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
12+
13+
/**
14+
* This element supports a subset of the features of the google-map element v2.x.
15+
* Namely, the fluid attribute and videoId/list properties are supported.
16+
*/
17+
18+
class GoogleYoutube extends PolymerElement {
19+
static get template() {
20+
return html`
21+
<style>
22+
:host {
23+
display: block;
24+
}
25+
26+
:host([fluid]) {
27+
width: 100%;
28+
max-width: 100%;
29+
position: relative;
30+
}
31+
32+
#container {
33+
width: 480px;
34+
height: 270px;
35+
max-width: 100%;
36+
max-height: 100%;
37+
}
38+
39+
:host([fluid]) #container {
40+
width: 100%;
41+
height: auto;
42+
padding-top: 56.25%;
43+
}
44+
45+
#iframe {
46+
width: 100%;
47+
height: 100%;
48+
}
49+
50+
:host([fluid]) #iframe {
51+
vertical-align: bottom;
52+
position: absolute;
53+
top: 0px;
54+
left: 0px;
55+
}
56+
</style>
57+
<div id="container">
58+
<iframe id="iframe" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
59+
</div>
60+
`;
61+
}
62+
63+
static get properties() {
64+
return {
65+
videoId: {
66+
type: String,
67+
},
68+
69+
list: {
70+
type: String,
71+
}
72+
};
73+
}
74+
75+
static get observers() {
76+
return ['_updateIframeSrc(videoId, list)'];
77+
}
78+
79+
_updateIframeSrc(videoId, list) {
80+
if (list) {
81+
this.$.iframe.src = `https://www.youtube.com/embed/${videoId || ''}?list=${list}`;
82+
} else if (videoId) {
83+
this.$.iframe.src = `https://www.youtube.com/embed/${videoId}`;
84+
}
85+
}
86+
}
87+
88+
customElements.define('google-youtube', GoogleYoutube);

app/elements/icons.html renamed to app/elements/icons.js

Lines changed: 18 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/elements/iron-doc-viewer.html

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

app/elements/iron-doc-viewer.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* @license
3+
* Copyright (c) 2018 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+
11+
import '@polymer/iron-doc-viewer/default-theme.js';
12+
import '@polymer/iron-doc-viewer/iron-doc-element.js';
13+
import '@polymer/iron-doc-viewer/iron-doc-class.js';
14+
import '@polymer/iron-doc-viewer/iron-doc-mixin.js';
15+
import '@polymer/iron-doc-viewer/iron-doc-namespace.js';
16+
import '@polymer/iron-doc-viewer/iron-doc-module.js';
17+
import '@polymer/iron-doc-viewer/iron-doc-behavior.js';
18+
const $_documentContainer = document.createElement('template');
19+
$_documentContainer.setAttribute('style', 'display: none;');
20+
21+
$_documentContainer.innerHTML = `<style is="custom-style" include="iron-doc-default-theme"></style>`;
22+
23+
document.head.appendChild($_documentContainer.content);

app/elements/lazy-elements.html

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

0 commit comments

Comments
 (0)