Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 9497cc1

Browse files
committed
Merge pull request #18 from Polymer/master
8/8 master -> stable
2 parents 30b28ad + 6b08976 commit 9497cc1

12 files changed

Lines changed: 175 additions & 81 deletions

File tree

CONTRIBUTING.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,33 @@ Other projects require a similar agreement: jQuery, Firefox, Apache, Node, and m
2121

2222
Here's an easy guide that should get you up and running:
2323

24-
1. Fork the project on github and pull down your copy.
25-
> replace the {{ username }} with your username and {{ repository }} with the repository name
24+
1. Fork the project on github
25+
2. Pull down the polymer-all project.
2626

27-
git clone git@github.com:{{ username }}/{{ repository }}.git --recursive
27+
git clone git@github.com:Polymer/polymer-all --recursive
2828

29-
Note the `--recursive`. This is necessary for submodules to initialize properly. If you don't do a recursive clone, you'll have to init them manually:
30-
31-
git submodule init
32-
git submodule update
33-
34-
2. Development happens on the `master` branch. Get yourself on it!
29+
3. Go to the polymer-elements directory and switch it to point to your origin.
3530

31+
git remote remove origin
32+
git remote add origin git@github.com:{{ username }}/{{ repository }}
33+
git fetch origin
3634
git checkout master
3735

36+
4. Pull down node dependencies. In your polymer-elements directory run 'npm install' this will pull down the tools used for executing the test.
37+
3838
That's it for the one time setup. Now you're ready to make a change.
3939

40+
## Running the tests
41+
42+
To run the tests make sure you have a webserver running with its docroot pointing to the polymer-all directory. Then navigate to /polymer-elements/test/runner.html
43+
44+
For Example:
45+
46+
cd polymer-all
47+
ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 4000, :DocumentRoot => Dir.pwd).start'
48+
49+
Then in your browser open: http://localhost:4000/polymer-elements/test/runner.html
50+
4051
## Submitting a pull request
4152

4253
We iterate fast! To avoid potential merge conflicts, it's a good idea to pull from the main project before making a change and submitting a pull request. The easiest way to do this is setup a remote called `upstream` and do a pull before working on a change:

gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function(grunt) {
1919
outdir: 'docs',
2020
linkNatives: 'true',
2121
tabtospace: 2,
22-
themedir: 'tools/doc/themes/footstrap'
22+
themedir: 'tools/doc/themes/polymerase'
2323
}
2424
}
2525
}

polymer-flex-layout/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h3>Title</h3>
5454
</script>
5555
</polymer-element>
5656

57-
<polymer-element name="flex-container" extends="polymer-flex-panel">
57+
<polymer-element name="flex-container" noscript extends="polymer-flex-panel">
5858
<template>
5959
<style>
6060
div, polymer-flex-panel {
@@ -82,7 +82,7 @@ <h3>Title</h3>
8282
</template>
8383
</polymer-element>
8484

85-
<polymer-element name="flex-nonvisual">
85+
<polymer-element name="flex-nonvisual" noscript>
8686
<template>
8787
<style>
8888
div {

polymer-flex-layout/polymer-flex-panel.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
Use of this source code is governed by a BSD-style
44
license that can be found in the LICENSE file.
55
-->
6-
<polymer-element name="polymer-flex-panel" extends="polymer-flex-layout" isContainer>
6+
<link rel="import" href="polymer-flex-layout.html">
7+
8+
<polymer-element name="polymer-flex-panel" extends="polymer-flex-layout">
79
<template>
810
<shadow></shadow>
911
</template>
12+
<script>
13+
Polymer('polymer-flex-panel', {
14+
isContainer: true
15+
});
16+
</script>
1017
</polymer-element>

polymer-grid-layout/polymer-grid-layout.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,24 @@
136136
var m = 0;
137137

138138
function railize(count, sizeFn) {
139-
// create rails for `count` tracks using `sizeFn(track)`
140-
// tracks are bounded, so for n tracks there are (n+1) rails
139+
//
140+
// create rails for `count` tracks using sizing function `sizeFn(track)`
141+
// for n tracks there are (n+1) rails
141142
//
142143
// |track|track|track|
143144
// 0|->sz0|->sz1|<-sz2|0
144145
//
145146
// |track|track|track|
146147
// 0|->sz0| |<-sz2|0
147148
//
148-
// 0|
149+
// there can be one elastic track per set
150+
//
151+
// |track|track|track|track|
152+
// 0|-->s0|-->s1|<--s1|<--s2|0
153+
//
154+
// sz1 spans two (>1) tracks which makes
155+
// it elastic (it's underconstrained)
156+
//
149157
var rails = [];
150158
var a = 0;
151159
for (var i=0; i<count; i++) {
@@ -170,21 +178,11 @@
170178
return rails;
171179
}
172180

181+
// TODO(sjmiles): this codes tries to preserve actual position,
182+
// so 'unposition' is really 'naturalize' or something
173183
function unposition(box) {
174184
var style = box.style;
175-
//style.left = style.right = style.top = style.bottom = style.width = style.height = '';
176-
// TODO(sjmiles): this codes tries to preserve position,
177-
// so 'unposition' is really 'naturalize' or something
178-
/*
179-
if (style.left && style.right) {
180-
style.left = '';
181-
}
182-
if (style.top && style.bottom) {
183-
style.top = '';
184-
}
185-
*/
186-
style.right = style.bottom = '';
187-
style.width = style.height = '';
185+
style.right = style.bottom = style.width = style.height = '';
188186
style.position = 'absolute';
189187
style.display = 'inline-block';
190188
style.boxSizing = style.mozBoxSizing = 'border-box';

polymer-list/polymer-grid.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
</script>
9595
</polymer-element>
9696

97-
<polymer-element name="polymer-grid">
97+
<polymer-element name="polymer-grid" attributes="items">
9898
<template>
9999
<style>
100100
@host{*{
@@ -113,19 +113,21 @@
113113
items: null,
114114
scrub: 0,
115115
ready: function() {
116-
this.items = [];
117-
for (var i = 0; i < 5000; i++) {
118-
var n = '';
119-
var l = Math.floor(Math.random() * 8) + 2;
120-
for (var j=0; j<l; j++) {
121-
n += String.fromCharCode((j === 0 ? 'A' : 'a').charCodeAt(0) + Math.floor(Math.random()*26));
116+
if (!this.items) {
117+
this.items = [];
118+
for (var i = 0; i < 5000; i++) {
119+
var n = '';
120+
var l = Math.floor(Math.random() * 8) + 2;
121+
for (var j=0; j<l; j++) {
122+
n += String.fromCharCode((j === 0 ? 'A' : 'a').charCodeAt(0) + Math.floor(Math.random()*26));
123+
}
124+
n += ' ';
125+
var l = Math.floor(Math.random() * 8) + 2;
126+
for (var j=0; j<l; j++) {
127+
n += String.fromCharCode((j === 0 ? 'A' : 'a').charCodeAt(0) + Math.floor(Math.random()*26));
128+
}
129+
this.items[i] = n;
122130
}
123-
n += ' ';
124-
var l = Math.floor(Math.random() * 8) + 2;
125-
for (var j=0; j<l; j++) {
126-
n += String.fromCharCode((j === 0 ? 'A' : 'a').charCodeAt(0) + Math.floor(Math.random()*26));
127-
}
128-
this.items[i] = n;
129131
}
130132
},
131133
inserted: function() {

polymer-overlay/index.html

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,39 @@
3737
</style>
3838
</head>
3939
<body>
40+
<polymer-element name="x-dialog" attributes="opened autoCloseDisabled">
41+
<template>
42+
<style>
43+
@host {
44+
:scope {
45+
box-sizing: border-box;
46+
-moz-box-sizing: border-box;
47+
font-family: Arial, Helvetica, sans-serif;
48+
font-size: 13px;
49+
-webkit-user-select: none;
50+
-moz-user-select: none;
51+
overflow: hidden;
52+
background: white;
53+
padding:30px 42px;
54+
outline: 1px solid rgba(0,0,0,0.2);
55+
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
56+
}
57+
}
58+
</style>
59+
<polymer-overlay id="overlay" opened="{{opened}}" autoCloseDisabled="{{autoCloseDisabled}}"></polymer-overlay>
60+
<content></content>
61+
</template>
62+
<script>
63+
Polymer('x-dialog', {
64+
ready: function() {
65+
this.$.overlay.target = this;
66+
},
67+
toggle: function() {
68+
this.$.overlay.toggle();
69+
}
70+
});
71+
</script>
72+
</polymer-element>
4073
<button overlay="#dialog">Toggle Dialog</button>
4174
( open styling:
4275
<select onchange="changeOpening(event)">
@@ -49,51 +82,37 @@
4982
<label>scrim: <input type="checkbox" onchange="scrimChange(event)"></label>
5083
)
5184
<br>
52-
<div id="dialog" class="dialog polymer-overlay-scale-slideup">
53-
<polymer-overlay></polymer-overlay>
85+
<x-dialog id="dialog" class="dialog polymer-overlay-scale-slideup">
5486
<h2>Dialog</h2>
5587
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed fringilla sapien sed enim sollicitudin laoreet. Suspendisse suscipit, metus ac volutpat sodales, libero magna semper lacus, molestie fringilla massa orci ut arcu. Nullam sodales urna sit amet odio vehicula mattis.</div><br><br>
5688
<div>Ut aliquam vulputate congue. Vestibulum pretium pretium nulla quis sollicitudin. Praesent lacinia congue erat nec mattis. Fusce commodo lacus est. Duis turpis eros, ultrices sed aliquet non, blandit egestas velit. Integer a augue nec lorem tristique hendrerit. Curabitur imperdiet risus id enim bibendum vestibulum. Integer id magna at arcu faucibus fermentum vel a augue. Sed fringilla venenatis dolor, in blandit magna molestie luctus. Vestibulum dignissim posuere ultrices. Aenean urna nisl, tincidunt vitae iaculis ut, pharetra nec eros.</div><br><br>
5789
<div>
5890
<input placeholder="say something..." autofocus oninput="somethingCheck()"></input><br>
5991
I agree with this wholeheartedly.
60-
<div id="confirmation" class="dialog">
61-
<polymer-overlay></polymer-overlay>
92+
<x-dialog id="confirmation" class="dialog">
6293
Thank you.
63-
</div>
94+
</x-dialog>
6495
</div><br><br>
6596
<button overlay-toggle>OK</button>
66-
</div>
97+
</x-dialog>
6798

6899
<br><br>
69100

70101
<button overlay="#dialog2">Toggle Dialog 2</button>
71102

72-
<div id="dialog2" class="dialog polymer-overlay-shake" autoCloseDisabled="true">
73-
<polymer-overlay></polymer-overlay>
103+
<x-dialog id="dialog2" class="dialog polymer-overlay-shake" autoCloseDisabled="true">
74104
<div>
75105
<h2>Dialog 2</h2>
76106
I'm dizzy.
77107
</div>
78108
<br><br>
79109
<button overlay-toggle>OK</button>
80-
</div>
110+
</x-dialog>
81111
<script>
82-
setupOverlays = function() {
83-
var overlays = document.querySelectorAll('polymer-overlay');
84-
Array.prototype.forEach.call(overlays, function(o) {
85-
o.target = o.parentNode;
86-
});
87-
}
88-
89-
document.addEventListener('WebComponentsReady', function() {
90-
setupOverlays();
91-
});
92-
93112
$ = document.querySelector.bind(document);
94113

95114
somethingCheck = function() {
96-
$('#confirmation').querySelector('polymer-overlay').opened = (event.target.value == 'something');
115+
$('#confirmation').opened = (event.target.value == 'something');
97116
}
98117

99118
changeOpening = function(e) {
@@ -115,10 +134,7 @@ <h2>Dialog 2</h2>
115134
var overlayButtons = document.querySelectorAll('button[overlay]');
116135
Array.prototype.forEach.call(overlayButtons, function(b) {
117136
b.addEventListener('tap', function(e) {
118-
var overlay = document.querySelector(e.target.getAttribute('overlay'));
119-
if (overlay) {
120-
overlay.querySelector('polymer-overlay').toggle();
121-
}
137+
document.querySelector(e.target.getAttribute('overlay')).toggle();
122138
})
123139
});
124140
</script>

polymer-overlay/polymer-overlay.css

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ http://dev.w3.org/csswg/css3-transforms/#transform-rendering
2828
We address this by using script based positioning =(
2929
*/
3030
@host {
31-
* {
31+
.polymer-overlay {
3232
position: fixed;
3333
z-index: 10;
3434
outline: none;
@@ -129,3 +129,50 @@ We address this by using script based positioning =(
129129
animation-name: polymer-overlay-shakeFadeOut;
130130
}
131131
}
132+
133+
.polymer-overlay {
134+
position: fixed;
135+
z-index: 10;
136+
outline: none;
137+
display: none;
138+
opacity: 0.99;
139+
-webkit-transition: opacity 0.001s;
140+
transition: opacity 0.001s;
141+
}
142+
143+
/*
144+
The revealed class exists because it's necessary to 'show' a node
145+
before applying a transition. When an overlay is opened, it is
146+
immediately revealed (display: block) and then asynchronously the
147+
opened or closing classes are added.
148+
149+
Because we don't want to actually show the node before a transition
150+
or animation is applied, when the node is
151+
revealed, it is made display: block but visibility: hidden.
152+
It is then made visibility: visible when it is opened.
153+
*/
154+
155+
.revealed {
156+
display: block;
157+
visibility: hidden;
158+
}
159+
160+
.revealed.opened {
161+
opacity: 1;
162+
display: block;
163+
visibility: visible;
164+
}
165+
166+
.revealed.closing {
167+
display: block;
168+
visibility: visible;
169+
}
170+
171+
.backdrop {
172+
position: fixed;
173+
left: 0;
174+
top: 0;
175+
bottom: 0;
176+
right: 0;
177+
background: rgba(0, 0, 0, 0.25);
178+
}

polymer-overlay/polymer-overlay.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
-->
7272
<polymer-element name="polymer-overlay" attributes="target opened autoCloseDisabled">
7373
<template>
74+
<link rel="stylesheet" polymer-scope="controller" href="polymer-overlay.css">
7475
<link rel="stylesheet" href="polymer-overlay.css">
75-
<link rel="stylesheet" polymer-scope="global" href="polymer-overlay-global.css">
7676
<polymer-key-helper id="keyHelper"></polymer-key-helper>
7777
</template>
7878
<script>
@@ -163,6 +163,9 @@
163163
}
164164
this.setAttribute('touch-action', 'none');
165165
},
166+
inserted: function() {
167+
this.installControllerStyles();
168+
},
166169
/**
167170
* Toggle the opened state of the overlay.
168171
* @method toggle
@@ -253,10 +256,10 @@
253256
continueRenderOpened: function() {
254257
this.target.classList.toggle('opened', this.opened);
255258
this.target.classList.toggle('closing', !this.opened);
256-
//this.animating = this.asyncMethod('completeOpening', null, this.timeout);
259+
this.animating = this.asyncMethod('completeOpening', null, this.timeout);
257260
},
258261
completeOpening: function() {
259-
//clearTimeout(this.animating);
262+
clearTimeout(this.animating);
260263
this.animating = null;
261264
this.target.classList.remove('closing');
262265
this.target.classList.toggle('revealed', this.opened);

0 commit comments

Comments
 (0)