Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Components #31

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@
"paper-checkbox": "PolymerElements/paper-checkbox#^2.0.1",
"paper-dialog": "PolymerElements/paper-dialog#^2.0.0",
"paper-dialog-behavior": "PolymerElements/paper-dialog-behavior#^2.0.1",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^2.1.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^2.2.1",
"paper-drawer-panel": "PolymerElements/paper-drawer-panel#^2.0.0",
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^2.0.0",
"paper-fab": "PolymerElements/paper-fab#^2.0.0",
"paper-fab": "PolymerElements/paper-fab#^2.1.0",
"paper-header-panel": "PolymerElements/paper-header-panel#^2.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^2.0.1",
"paper-input": "PolymerElements/paper-input#^2.0.5",
Expand Down Expand Up @@ -108,6 +108,8 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.20",
"web-component-tester": "^6.4.1",
"iron-form": "PolymerElements/iron-form#^2.2.1",
"paper-alert-dialog": "Collaborne/paper-alert-dialog#^2.0.1"
"paper-alert-dialog": "Collaborne/paper-alert-dialog#^2.0.1",
"paper-dropdown": "pushkar8723/paper-dropdown#^2.0.1",
"highcharts-polymer": "anthfran/highcharts-polymer#^1.0.3"
}
}
17 changes: 10 additions & 7 deletions lib/app-layout/.bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-layout",
"version": "2.1.0",
"version": "2.1.1",
"description": "A set of layout elements for your app",
"authors": [
"The Polymer Authors"
Expand All @@ -11,7 +11,10 @@
"type": "git",
"url": "git://github.com/PolymerElements/app-layout"
},
"main": "app-layout.html",
"main": [
"app-layout.html",
"app-scroll-effects/effects/waterfall.html"
],
"demos": {
"Demos": "demo/index.html"
},
Expand All @@ -23,7 +26,7 @@
"polymer": "Polymer/polymer#1.9 - 2"
},
"devDependencies": {
"es6-promise": "stefanpenner/es6-promise#^4.0.0",
"es6-promise": "stefanpenner/es6-promise#4.1.1",
"font-roboto": "PolymerElements/font-roboto#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
"iron-icon": "PolymerElements/iron-icon#1 - 2",
Expand Down Expand Up @@ -65,13 +68,13 @@
"resolutions": {
"webcomponentsjs": "^1.0.0"
},
"_release": "2.1.0",
"_release": "2.1.1",
"_resolution": {
"type": "version",
"tag": "v2.1.0",
"commit": "934f0d1cd3a635f5d5e2ed07739f217fe9dfc8ec"
"tag": "v2.1.1",
"commit": "b6f8eff8a624220ed78dfca385d8825dba352649"
},
"_source": "https://github.com/PolymerElements/app-layout.git",
"_target": "1 - 2",
"_target": "^2.1.0",
"_originalSource": "PolymerElements/app-layout"
}
3 changes: 3 additions & 0 deletions lib/app-layout/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ before_script:
npm run update-types && git diff --exit-code || (echo -e
'\n\033[31mERROR:\033[0m Typings are stale. Please run "npm run
update-types".' && false)
- >-
npm run format && git diff --exit-code || (echo -e '\n\033[31mERROR:\033[0m
Typings are stale. Please run "npm run format".' && false)
script:
- xvfb-run polymer test
- >-
Expand Down
3 changes: 2 additions & 1 deletion lib/app-layout/app-box/app-box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ interface AppBoxElement extends Polymer.Element, Polymer.AppScrollEffectsBehavio
_debounceRaf(fn: any): void;

/**
* Resets the layout. This method is automatically called when the element is attached to the DOM.
* Resets the layout. This method is automatically called when the element is
* attached to the DOM.
*/
resetLayout(): void;
_getElementTop(): any;
Expand Down
22 changes: 10 additions & 12 deletions lib/app-layout/app-box/app-box.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,9 @@ <h2>Sub title</h2>
Polymer({
is: 'app-box',

behaviors: [
Polymer.AppScrollEffectsBehavior,
Polymer.IronResizableBehavior
],
behaviors: [Polymer.AppScrollEffectsBehavior, Polymer.IronResizableBehavior],

listeners: {
'iron-resize': '_resizeHandler'
},
listeners: {'iron-resize': '_resizeHandler'},

/**
* The current scroll progress.
Expand All @@ -167,7 +162,8 @@ <h2>Sub title</h2>
},

/**
* Resets the layout. This method is automatically called when the element is attached to the DOM.
* Resets the layout. This method is automatically called when the element is
* attached to the DOM.
*
* @method resetLayout
*/
Expand Down Expand Up @@ -205,7 +201,8 @@ <h2>Sub title</h2>
_updateScrollState: function(scrollTop) {
if (this.isOnScreen()) {
var viewportTop = this._elementTop - scrollTop;
this._progress = 1 - (viewportTop + this._elementHeight) / this._cachedScrollTargetHeight;
this._progress = 1 -
(viewportTop + this._elementHeight) / this._cachedScrollTargetHeight;
this._runEffects(this._progress, scrollTop);
}
},
Expand All @@ -218,8 +215,9 @@ <h2>Sub title</h2>
* @return {boolean}
*/
isOnScreen: function() {
return this._elementTop < this._scrollTop + this._cachedScrollTargetHeight
&& this._elementTop + this._elementHeight > this._scrollTop;
return this._elementTop <
this._scrollTop + this._cachedScrollTargetHeight &&
this._elementTop + this._elementHeight > this._scrollTop;
},

_resizeHandler: function() {
Expand All @@ -242,7 +240,7 @@ <h2>Sub title</h2>
* @return {Object}
*/
getScrollState: function() {
return { progress: this._progress };
return {progress: this._progress};
}
});
</script>
Expand Down
8 changes: 4 additions & 4 deletions lib/app-layout/app-drawer-layout/app-drawer-layout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ interface AppDrawerLayoutElement extends Polymer.Element, Polymer.AppLayoutBehav
forceNarrow: boolean|null|undefined;

/**
* If the viewport's width is smaller than this value, the panel will change to narrow
* layout. In the mode the drawer will be closed.
* If the viewport's width is smaller than this value, the panel will change
* to narrow layout. In the mode the drawer will be closed.
*/
responsiveWidth: string|null|undefined;

/**
* Returns true if it is in narrow layout. This is useful if you need to show/hide
* elements based on the layout.
* Returns true if it is in narrow layout. This is useful if you need to
* show/hide elements based on the layout.
*/
readonly narrow: boolean|null|undefined;

Expand Down
56 changes: 19 additions & 37 deletions lib/app-layout/app-drawer-layout/app-drawer-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,59 +184,38 @@
Polymer({
is: 'app-drawer-layout',

behaviors: [
Polymer.AppLayoutBehavior
],
behaviors: [Polymer.AppLayoutBehavior],

properties: {
/**
* If true, ignore `responsiveWidth` setting and force the narrow layout.
*/
forceNarrow: {
type: Boolean,
value: false
},
forceNarrow: {type: Boolean, value: false},

/**
* If the viewport's width is smaller than this value, the panel will change to narrow
* layout. In the mode the drawer will be closed.
* If the viewport's width is smaller than this value, the panel will change
* to narrow layout. In the mode the drawer will be closed.
*/
responsiveWidth: {
type: String,
value: '640px'
},
responsiveWidth: {type: String, value: '640px'},

/**
* Returns true if it is in narrow layout. This is useful if you need to show/hide
* elements based on the layout.
* Returns true if it is in narrow layout. This is useful if you need to
* show/hide elements based on the layout.
*/
narrow: {
type: Boolean,
reflectToAttribute: true,
readOnly: true,
notify: true
},
narrow:
{type: Boolean, reflectToAttribute: true, readOnly: true, notify: true},

/**
* If true, the drawer will initially be opened when in narrow layout mode.
*/
openedWhenNarrow: {
type: Boolean,
value: false
},
openedWhenNarrow: {type: Boolean, value: false},

_drawerPosition: {
type: String
}
_drawerPosition: {type: String}
},

listeners: {
'click': '_clickHandler'
},
listeners: {'click': '_clickHandler'},

observers: [
'_narrowChanged(narrow)'
],
observers: ['_narrowChanged(narrow)'],

/**
* A reference to the app-drawer element.
Expand All @@ -248,7 +227,8 @@
},

attached: function() {
// Disable drawer transitions until after app-drawer-layout sets the initial opened state.
// Disable drawer transitions until after app-drawer-layout sets the initial
// opened state.
var drawer = this.drawer;
if (drawer) {
drawer.setAttribute('no-transition', '');
Expand Down Expand Up @@ -280,7 +260,8 @@
drawer.opened = drawer.persistent = true;
}
if (drawer.hasAttribute('no-transition')) {
// Enable drawer transitions after app-drawer-layout sets the initial opened state.
// Enable drawer transitions after app-drawer-layout sets the initial
// opened state.
Polymer.RenderStatus.afterNextRender(this, function() {
drawer.removeAttribute('no-transition');
});
Expand All @@ -299,7 +280,8 @@
},

_computeMediaQuery: function(forceNarrow, responsiveWidth) {
return forceNarrow ? '(min-width: 0px)' : '(max-width: ' + responsiveWidth + ')';
return forceNarrow ? '(min-width: 0px)' :
'(max-width: ' + responsiveWidth + ')';
}
});
</script>
Expand Down
24 changes: 12 additions & 12 deletions lib/app-layout/app-drawer-layout/test/app-drawer-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@

<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'x-resizeable',
behaviors: [
Polymer.IronResizableBehavior
]
});
Polymer({is: 'x-resizeable', behaviors: [Polymer.IronResizableBehavior]});
});

suite('basic features', function() {
Expand Down Expand Up @@ -114,21 +109,26 @@

test('drawer-toggle', function(done) {
drawerLayout.responsiveWidth = '10000px';

assert.isFalse(drawer.opened);

Polymer.Base.fire('click', null /* detail */, { node: drawerLayout.querySelector('p') });
Polymer.Base.fire(
'click', null /* detail */, {node: drawerLayout.querySelector('p')});

assert.isFalse(drawer.opened);

Polymer.Base.fire('click', null /* detail */, { node: drawerLayout.querySelector('[drawer-toggle]') });
Polymer.Base.fire('click', null /* detail */, {
node: drawerLayout.querySelector('[drawer-toggle]')
});

assert.isTrue(drawer.opened);

drawerLayout.responsiveWidth = '0px';

window.setTimeout(function() {
Polymer.Base.fire('click', null /* detail */, { node: drawerLayout.querySelector('[drawer-toggle]') });
Polymer.Base.fire('click', null /* detail */, {
node: drawerLayout.querySelector('[drawer-toggle]')
});
assert.isTrue(drawer.opened);
done();
}, 150);
Expand Down Expand Up @@ -206,7 +206,8 @@

test('app-drawer appended later', function(done) {
assert.doesNotThrow(function() {
drawerLayout = document.body.appendChild(document.createElement('app-drawer-layout'));
drawerLayout = document.body.appendChild(
document.createElement('app-drawer-layout'));
});
Polymer.dom.flush();

Expand All @@ -232,7 +233,6 @@
}, 100);
});
});

</script>

</body>
Expand Down
9 changes: 5 additions & 4 deletions lib/app-layout/app-drawer/app-drawer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ interface AppDrawerElement extends Polymer.Element {
transitionDuration: number|null|undefined;

/**
* The alignment of the drawer on the screen ('left', 'right', 'start' or 'end').
* 'start' computes to left and 'end' to right in LTR layout and vice versa in RTL
* layout.
* The alignment of the drawer on the screen ('left', 'right', 'start' or
* 'end'). 'start' computes to left and 'end' to right in LTR layout and
* vice versa in RTL layout.
*/
align: string|null|undefined;

/**
* The computed, read-only position of the drawer on the screen ('left' or 'right').
* The computed, read-only position of the drawer on the screen ('left' or
* 'right').
*/
readonly position: string|null|undefined;

Expand Down
Loading