96 lines
3.1 KiB
HTML
96 lines
3.1 KiB
HTML
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
|
|
<link rel="import" href="../../bower_components/app-layout/app-header-layout/app-header-layout.html">
|
|
<!--
|
|
@license
|
|
Copyright (c) 2015 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
|
|
-->
|
|
|
|
<!--
|
|
This code is copied from app-header-layout.
|
|
'fullbleed' support is removed as Home Assisstant doesn't use it.
|
|
transform: translate(0) is added.
|
|
-->
|
|
|
|
<dom-module id="ha-app-layout">
|
|
<template>
|
|
<style>
|
|
:host {
|
|
display: block;
|
|
/**
|
|
* Force app-header-layout to have its own stacking context so that its parent can
|
|
* control the stacking of it relative to other elements (e.g. app-drawer-layout).
|
|
* This could be done using `isolation: isolate`, but that's not well supported
|
|
* across browsers.
|
|
*/
|
|
position: relative;
|
|
z-index: 0;
|
|
}
|
|
#wrapper ::slotted([slot=header]) {
|
|
@apply --layout-fixed-top;
|
|
z-index: 1;
|
|
}
|
|
#wrapper.initializing ::slotted([slot=header]) {
|
|
position: relative;
|
|
}
|
|
:host([has-scrolling-region]) {
|
|
height: 100%;
|
|
}
|
|
:host([has-scrolling-region]) #wrapper ::slotted([slot=header]) {
|
|
position: absolute;
|
|
}
|
|
:host([has-scrolling-region]) #wrapper.initializing ::slotted([slot=header]) {
|
|
position: relative;
|
|
}
|
|
:host([has-scrolling-region]) #wrapper #contentContainer {
|
|
@apply --layout-fit;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
:host([has-scrolling-region]) #wrapper.initializing #contentContainer {
|
|
position: relative;
|
|
}
|
|
#contentContainer {
|
|
/* Create a stacking context here so that all children appear below the header. */
|
|
position: relative;
|
|
z-index: 0;
|
|
}
|
|
.scroll-limiter {
|
|
/* Using 'transform' will cause 'position: fixed' elements to behave like
|
|
'position: absolute' relative to this element. */
|
|
transform: translate(0);
|
|
}
|
|
:host([has-scrolling-region]) .scroll-limiter {
|
|
overflow-y: auto;
|
|
height: 100%
|
|
}
|
|
@media print {
|
|
:host([has-scrolling-region]) .scroll-limiter {
|
|
overflow-y: visible;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<div id="wrapper" class="initializing">
|
|
<slot id="headerSlot" name="header"></slot>
|
|
|
|
<div id="contentContainer">
|
|
<div class="scroll-limiter">
|
|
<slot></slot>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</template>
|
|
</dom-module>
|
|
|
|
<script>
|
|
class HaAppLayout extends customElements.get('app-header-layout') {
|
|
static get is() { return 'ha-app-layout'; }
|
|
}
|
|
customElements.define(HaAppLayout.is, HaAppLayout);
|
|
</script>
|