@vaadin/app-layout 25.2.0-alpha6 → 25.2.0-alpha8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1 -1
- package/package.json +10 -10
- package/src/styles/vaadin-app-layout-base-styles.js +17 -33
- package/src/vaadin-app-layout-mixin.js +71 -79
- package/src/vaadin-app-layout.d.ts +3 -2
- package/src/vaadin-app-layout.js +4 -3
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"declarations": [
|
|
180
180
|
{
|
|
181
181
|
"kind": "class",
|
|
182
|
-
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat
|
|
182
|
+
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n`content` | Container for the content area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat makes the content part of App Layout scrollable.\nIn that case, the toolbars on mobile device won't collapse.",
|
|
183
183
|
"name": "AppLayout",
|
|
184
184
|
"members": [
|
|
185
185
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/app-layout",
|
|
3
|
-
"version": "25.2.0-
|
|
3
|
+
"version": "25.2.0-alpha8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.2.0-
|
|
39
|
-
"@vaadin/button": "25.2.0-
|
|
40
|
-
"@vaadin/component-base": "25.2.0-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "25.2.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.2.0-alpha8",
|
|
39
|
+
"@vaadin/button": "25.2.0-alpha8",
|
|
40
|
+
"@vaadin/component-base": "25.2.0-alpha8",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.2.0-alpha8",
|
|
42
42
|
"lit": "^3.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@vaadin/aura": "25.2.0-
|
|
46
|
-
"@vaadin/chai-plugins": "25.2.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "25.2.0-
|
|
45
|
+
"@vaadin/aura": "25.2.0-alpha8",
|
|
46
|
+
"@vaadin/chai-plugins": "25.2.0-alpha8",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.2.0-alpha8",
|
|
48
48
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "25.2.0-
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "25.2.0-alpha8",
|
|
50
50
|
"sinon": "^21.0.2"
|
|
51
51
|
},
|
|
52
52
|
"customElements": "custom-elements.json",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2b82e20cdfc605b1187e9a24ae42869e1500ab68"
|
|
58
58
|
}
|
|
@@ -17,18 +17,10 @@ export const appLayoutStyles = css`
|
|
|
17
17
|
--vaadin-app-layout-touch-optimized: false;
|
|
18
18
|
--vaadin-app-layout-navbar-offset-top: var(--_vaadin-app-layout-navbar-offset-size);
|
|
19
19
|
--vaadin-app-layout-navbar-offset-bottom: var(--_vaadin-app-layout-navbar-offset-size-bottom);
|
|
20
|
-
|
|
21
|
-
padding-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:host(:dir(ltr)) [content] {
|
|
25
|
-
padding-left: max(var(--vaadin-app-layout-drawer-offset-left), var(--safe-area-inset-left));
|
|
26
|
-
padding-right: var(--safe-area-inset-right);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
:host(:dir(rtl)) [content] {
|
|
30
|
-
padding-left: var(--safe-area-inset-left);
|
|
31
|
-
padding-right: max(var(--vaadin-app-layout-drawer-offset-left), var(--safe-area-inset-right));
|
|
20
|
+
--vaadin-app-layout-drawer-offset-left: 0px;
|
|
21
|
+
padding-top: var(--vaadin-app-layout-navbar-offset-top);
|
|
22
|
+
padding-bottom: var(--vaadin-app-layout-navbar-offset-bottom);
|
|
23
|
+
padding-inline-start: var(--vaadin-app-layout-drawer-offset-left);
|
|
32
24
|
}
|
|
33
25
|
|
|
34
26
|
:host([hidden]),
|
|
@@ -50,13 +42,21 @@ export const appLayoutStyles = css`
|
|
|
50
42
|
--vaadin-app-layout-drawer-offset-left: 0px;
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
:host(:not([no-scroll])) [content] {
|
|
45
|
+
:host(:not([no-scroll])) [part~='content'] {
|
|
54
46
|
overflow: auto;
|
|
55
47
|
}
|
|
56
48
|
|
|
57
|
-
[content] {
|
|
49
|
+
[part~='content'] {
|
|
58
50
|
height: 100%;
|
|
59
51
|
transition: inherit;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
padding-top: max(0px, var(--safe-area-inset-top) - var(--vaadin-app-layout-navbar-offset-top));
|
|
54
|
+
padding-bottom: max(0px, var(--safe-area-inset-bottom) - var(--vaadin-app-layout-navbar-offset-bottom));
|
|
55
|
+
padding-inline: var(--safe-area-inset-inline-start) var(--safe-area-inset-inline-end);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([drawer-opened]:not([overlay])) [part~='content'] {
|
|
59
|
+
padding-inline-start: 0;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
@media (pointer: coarse) and (max-width: 800px) and (min-height: 500px) {
|
|
@@ -121,6 +121,7 @@ export const appLayoutStyles = css`
|
|
|
121
121
|
width: var(--_vaadin-app-layout-drawer-width);
|
|
122
122
|
box-sizing: border-box;
|
|
123
123
|
padding-block: var(--safe-area-inset-top) var(--safe-area-inset-bottom);
|
|
124
|
+
padding-inline-start: var(--safe-area-inset-inline-start);
|
|
124
125
|
outline: none;
|
|
125
126
|
/* The drawer should be inaccessible by the tabbing navigation when it is closed. */
|
|
126
127
|
visibility: hidden;
|
|
@@ -129,29 +130,11 @@ export const appLayoutStyles = css`
|
|
|
129
130
|
background: var(--vaadin-app-layout-drawer-background, transparent);
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
[part='drawer']:dir(ltr) {
|
|
133
|
-
padding-left: var(--safe-area-inset-left);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
[part='drawer']:dir(rtl) {
|
|
137
|
-
padding-right: var(--safe-area-inset-right);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
133
|
:host([has-navbar]:not([overlay])) [part='drawer'],
|
|
141
|
-
:host([has-navbar]) [content] {
|
|
134
|
+
:host([has-navbar]) [part='content'] {
|
|
142
135
|
--safe-area-inset-top: 0px;
|
|
143
136
|
}
|
|
144
137
|
|
|
145
|
-
:host([has-drawer]:not([overlay])[drawer-opened]) [content] {
|
|
146
|
-
&:dir(ltr) {
|
|
147
|
-
--safe-area-inset-left: 0px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&:dir(rtl) {
|
|
151
|
-
--safe-area-inset-right: 0px;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
138
|
:host([drawer-opened]) [part='drawer'] {
|
|
156
139
|
/* The drawer should be accessible by the tabbing navigation when it is opened. */
|
|
157
140
|
visibility: visible;
|
|
@@ -209,6 +192,7 @@ export const appLayoutStyles = css`
|
|
|
209
192
|
}
|
|
210
193
|
|
|
211
194
|
/* If a vaadin-scroller is used in the drawer, allow it to take all remaining space and contain scrolling */
|
|
195
|
+
|
|
212
196
|
[part='drawer'] ::slotted(vaadin-scroller) {
|
|
213
197
|
flex: 1;
|
|
214
198
|
overscroll-behavior: contain;
|
|
@@ -120,7 +120,6 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
120
120
|
constructor() {
|
|
121
121
|
super();
|
|
122
122
|
// TODO(jouni): might want to debounce
|
|
123
|
-
this.__boundResizeListener = this._resize.bind(this);
|
|
124
123
|
this.__drawerToggleClickListener = this._drawerToggleClick.bind(this);
|
|
125
124
|
this.__onDrawerKeyDown = this.__onDrawerKeyDown.bind(this);
|
|
126
125
|
this.__closeOverlayDrawerListener = this.__closeOverlayDrawer.bind(this);
|
|
@@ -138,34 +137,13 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
138
137
|
connectedCallback() {
|
|
139
138
|
super.connectedCallback();
|
|
140
139
|
|
|
141
|
-
this.
|
|
140
|
+
this.__resizeObserver = new ResizeObserver((entries) => this.__onResize(entries));
|
|
141
|
+
this.__resizeObserver.observe(this);
|
|
142
|
+
this.__resizeObserver.observe(this.$.drawer);
|
|
143
|
+
this.__resizeObserver.observe(this.$.navbarTop);
|
|
144
|
+
this.__resizeObserver.observe(this.$.navbarBottom);
|
|
142
145
|
|
|
143
|
-
window.addEventListener('resize', this.__boundResizeListener);
|
|
144
146
|
this.addEventListener('drawer-toggle-click', this.__drawerToggleClickListener);
|
|
145
|
-
|
|
146
|
-
requestAnimationFrame(() => {
|
|
147
|
-
this._updateOffsetSize();
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
this._updateTouchOptimizedMode();
|
|
151
|
-
this._updateDrawerSize();
|
|
152
|
-
this._updateOverlayMode();
|
|
153
|
-
|
|
154
|
-
this._navbarSizeObserver = new ResizeObserver(() => {
|
|
155
|
-
requestAnimationFrame(() => {
|
|
156
|
-
// Prevent updating offset size multiple times
|
|
157
|
-
// during the drawer open / close transition.
|
|
158
|
-
if (this.__isDrawerAnimating) {
|
|
159
|
-
this.__updateOffsetSizePending = true;
|
|
160
|
-
} else {
|
|
161
|
-
this._updateOffsetSize();
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
this._navbarSizeObserver.observe(this.$.navbarTop);
|
|
166
|
-
this._navbarSizeObserver.observe(this.$.navbarBottom);
|
|
167
|
-
this._navbarSizeObserver.observe(this.$.drawer);
|
|
168
|
-
|
|
169
147
|
window.addEventListener('close-overlay-drawer', this.__closeOverlayDrawerListener);
|
|
170
148
|
window.addEventListener('keydown', this.__onDrawerKeyDown);
|
|
171
149
|
}
|
|
@@ -181,25 +159,15 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
181
159
|
});
|
|
182
160
|
|
|
183
161
|
this.$.drawer.addEventListener('transitionend', () => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.__updateOffsetSizePending = false;
|
|
187
|
-
this._updateOffsetSize();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Delay resetting the flag until animation frame
|
|
191
|
-
// to avoid updating offset size again on resize.
|
|
192
|
-
requestAnimationFrame(() => {
|
|
193
|
-
this.__isDrawerAnimating = false;
|
|
194
|
-
});
|
|
162
|
+
this.__isDrawerAnimating = false;
|
|
163
|
+
this.__scheduleResize(this.$.drawer);
|
|
195
164
|
});
|
|
196
165
|
}
|
|
197
166
|
|
|
198
167
|
/** @protected */
|
|
199
168
|
disconnectedCallback() {
|
|
200
169
|
super.disconnectedCallback();
|
|
201
|
-
|
|
202
|
-
window.removeEventListener('resize', this.__boundResizeListener);
|
|
170
|
+
this.__resizeObserver.disconnect();
|
|
203
171
|
this.removeEventListener('drawer-toggle-click', this.__drawerToggleClickListener);
|
|
204
172
|
window.removeEventListener('close-overlay-drawer', this.__drawerToggleClickListener);
|
|
205
173
|
window.removeEventListener('keydown', this.__onDrawerKeyDown);
|
|
@@ -207,16 +175,54 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
207
175
|
|
|
208
176
|
/** @private */
|
|
209
177
|
__onNavbarSlotChange() {
|
|
210
|
-
this.
|
|
178
|
+
this.__scheduleResize(this.$.navbarTop);
|
|
179
|
+
this.__scheduleResize(this.$.navbarBottom);
|
|
211
180
|
this.toggleAttribute('has-navbar', !!this.querySelector('[slot="navbar"]'));
|
|
212
181
|
}
|
|
213
182
|
|
|
214
183
|
/** @private */
|
|
215
184
|
__onDrawerSlotChange() {
|
|
216
|
-
this.
|
|
185
|
+
this.__scheduleResize(this.$.drawer);
|
|
186
|
+
this.__updateDrawerSize();
|
|
217
187
|
this.toggleAttribute('has-drawer', !!this.querySelector('[slot="drawer"]'));
|
|
218
188
|
}
|
|
219
189
|
|
|
190
|
+
/** @private */
|
|
191
|
+
__onResize(entries) {
|
|
192
|
+
cancelAnimationFrame(this.__resizeRaf);
|
|
193
|
+
|
|
194
|
+
const isHostResized = entries.some(({ target }) => target === this);
|
|
195
|
+
const isNavbarResized = entries.some(({ target }) => [this.$.navbarTop, this.$.navbarBottom].includes(target));
|
|
196
|
+
|
|
197
|
+
const overlayMode = this._getCustomPropertyValue('--vaadin-app-layout-drawer-overlay') === 'true';
|
|
198
|
+
const touchOptimized = this._getCustomPropertyValue('--vaadin-app-layout-touch-optimized') === 'true';
|
|
199
|
+
|
|
200
|
+
const drawerRect = this.$.drawer.getBoundingClientRect();
|
|
201
|
+
const navbarTopRect = this.$.navbarTop.getBoundingClientRect();
|
|
202
|
+
const navbarBottomRect = this.$.navbarBottom.getBoundingClientRect();
|
|
203
|
+
|
|
204
|
+
const isDrawerAnimating = this.__isDrawerAnimating;
|
|
205
|
+
|
|
206
|
+
this.__resizeRaf = requestAnimationFrame(() => {
|
|
207
|
+
if (isHostResized) {
|
|
208
|
+
this._blockAnimationUntilAfterNextRender();
|
|
209
|
+
this.__setOverlayMode(overlayMode);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (isHostResized || isNavbarResized) {
|
|
213
|
+
this.__setTouchOptimized(touchOptimized);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (!isDrawerAnimating) {
|
|
217
|
+
this.__setOffsetSize({
|
|
218
|
+
drawerRect,
|
|
219
|
+
navbarTopRect,
|
|
220
|
+
navbarBottomRect,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
220
226
|
/**
|
|
221
227
|
* A callback for the `primarySection` property observer.
|
|
222
228
|
*
|
|
@@ -306,48 +312,27 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
306
312
|
}
|
|
307
313
|
}
|
|
308
314
|
|
|
309
|
-
/** @
|
|
310
|
-
|
|
315
|
+
/** @private */
|
|
316
|
+
__updateDrawerSize() {
|
|
311
317
|
const childCount = this.querySelectorAll('[slot=drawer]').length;
|
|
312
|
-
const drawer = this.$.drawer;
|
|
313
|
-
|
|
314
318
|
if (childCount === 0) {
|
|
315
|
-
drawer.setAttribute('hidden', '');
|
|
319
|
+
this.$.drawer.setAttribute('hidden', '');
|
|
316
320
|
this.style.setProperty('--_vaadin-app-layout-drawer-width', 0);
|
|
317
321
|
} else {
|
|
318
|
-
drawer.removeAttribute('hidden');
|
|
322
|
+
this.$.drawer.removeAttribute('hidden');
|
|
319
323
|
this.style.removeProperty('--_vaadin-app-layout-drawer-width');
|
|
320
324
|
}
|
|
321
|
-
this._updateOffsetSize();
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
/** @private */
|
|
325
|
-
|
|
326
|
-
this._blockAnimationUntilAfterNextRender();
|
|
327
|
-
this._updateTouchOptimizedMode();
|
|
328
|
-
this._updateOverlayMode();
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** @protected */
|
|
332
|
-
_updateOffsetSize() {
|
|
333
|
-
const navbar = this.$.navbarTop;
|
|
334
|
-
const navbarRect = navbar.getBoundingClientRect();
|
|
335
|
-
|
|
336
|
-
const navbarBottom = this.$.navbarBottom;
|
|
337
|
-
const navbarBottomRect = navbarBottom.getBoundingClientRect();
|
|
338
|
-
|
|
339
|
-
const drawer = this.$.drawer;
|
|
340
|
-
const drawerRect = drawer.getBoundingClientRect();
|
|
341
|
-
|
|
342
|
-
this.style.setProperty('--_vaadin-app-layout-navbar-offset-size', `${navbarRect.height}px`);
|
|
343
|
-
this.style.setProperty('--_vaadin-app-layout-navbar-offset-size-bottom', `${navbarBottomRect.height}px`);
|
|
328
|
+
__setOffsetSize({ drawerRect, navbarTopRect, navbarBottomRect }) {
|
|
344
329
|
this.style.setProperty('--_vaadin-app-layout-drawer-offset-size', `${drawerRect.width}px`);
|
|
330
|
+
this.style.setProperty('--_vaadin-app-layout-navbar-offset-size', `${navbarTopRect.height}px`);
|
|
331
|
+
this.style.setProperty('--_vaadin-app-layout-navbar-offset-size-bottom', `${navbarBottomRect.height}px`);
|
|
345
332
|
}
|
|
346
333
|
|
|
347
|
-
/** @
|
|
348
|
-
|
|
349
|
-
const overlay = this._getCustomPropertyValue('--vaadin-app-layout-drawer-overlay') === 'true';
|
|
350
|
-
|
|
334
|
+
/** @private */
|
|
335
|
+
__setOverlayMode(overlay) {
|
|
351
336
|
if (!this.overlay && overlay) {
|
|
352
337
|
// Changed from not overlay to overlay
|
|
353
338
|
this._drawerStateSaved = this.drawerOpened;
|
|
@@ -487,12 +472,9 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
487
472
|
return (customPropertyValue || '').trim().toLowerCase();
|
|
488
473
|
}
|
|
489
474
|
|
|
490
|
-
/** @
|
|
491
|
-
|
|
492
|
-
const touchOptimized = this._getCustomPropertyValue('--vaadin-app-layout-touch-optimized') === 'true';
|
|
493
|
-
|
|
475
|
+
/** @private */
|
|
476
|
+
__setTouchOptimized(touchOptimized) {
|
|
494
477
|
const navbarItems = this.querySelectorAll('[slot*="navbar"]');
|
|
495
|
-
|
|
496
478
|
if (navbarItems.length > 0) {
|
|
497
479
|
Array.from(navbarItems).forEach((navbar) => {
|
|
498
480
|
if (navbar.getAttribute('slot').indexOf('touch-optimized') > -1) {
|
|
@@ -518,8 +500,6 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
518
500
|
} else {
|
|
519
501
|
this.$.navbarBottom.removeAttribute('hidden');
|
|
520
502
|
}
|
|
521
|
-
|
|
522
|
-
this._updateOffsetSize();
|
|
523
503
|
}
|
|
524
504
|
|
|
525
505
|
/** @protected */
|
|
@@ -533,6 +513,18 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
533
513
|
});
|
|
534
514
|
}
|
|
535
515
|
|
|
516
|
+
/**
|
|
517
|
+
* Forces the ResizeObserver to re-report the size of the given element,
|
|
518
|
+
* scheduling a new {@link __onResize} callback even if the size hasn't changed.
|
|
519
|
+
*
|
|
520
|
+
* @param {Element} element
|
|
521
|
+
* @private
|
|
522
|
+
*/
|
|
523
|
+
__scheduleResize(element) {
|
|
524
|
+
this.__resizeObserver.unobserve(element);
|
|
525
|
+
this.__resizeObserver.observe(element);
|
|
526
|
+
}
|
|
527
|
+
|
|
536
528
|
/**
|
|
537
529
|
* App Layout listens to `close-overlay-drawer` on the window level.
|
|
538
530
|
* A custom event can be dispatched and the App Layout will close the drawer in overlay.
|
|
@@ -78,6 +78,7 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
78
78
|
* `navbar-top` | Container for the top navigation bar
|
|
79
79
|
* `navbar-bottom` | Container for the bottom navigation bar
|
|
80
80
|
* `drawer` | Container for the drawer area
|
|
81
|
+
* `content` | Container for the content area
|
|
81
82
|
*
|
|
82
83
|
* The following state attributes are available for styling:
|
|
83
84
|
*
|
|
@@ -140,8 +141,8 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
140
141
|
*
|
|
141
142
|
* To use the "content scrolling", in case of the content of the page relies on a pre-defined height (for instance,
|
|
142
143
|
* it has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.
|
|
143
|
-
* That
|
|
144
|
-
*
|
|
144
|
+
* That makes the content part of App Layout scrollable.
|
|
145
|
+
* In that case, the toolbars on mobile device won't collapse.
|
|
145
146
|
*
|
|
146
147
|
* @fires {CustomEvent} drawer-opened-changed - Fired when the `drawerOpened` property changes.
|
|
147
148
|
* @fires {CustomEvent} overlay-changed - Fired when the `overlay` property changes.
|
package/src/vaadin-app-layout.js
CHANGED
|
@@ -57,6 +57,7 @@ import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
|
57
57
|
* `navbar-top` | Container for the top navigation bar
|
|
58
58
|
* `navbar-bottom` | Container for the bottom navigation bar
|
|
59
59
|
* `drawer` | Container for the drawer area
|
|
60
|
+
* `content` | Container for the content area
|
|
60
61
|
*
|
|
61
62
|
* The following state attributes are available for styling:
|
|
62
63
|
*
|
|
@@ -119,8 +120,8 @@ import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
|
119
120
|
*
|
|
120
121
|
* To use the "content scrolling", in case of the content of the page relies on a pre-defined height (for instance,
|
|
121
122
|
* it has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.
|
|
122
|
-
* That
|
|
123
|
-
*
|
|
123
|
+
* That makes the content part of App Layout scrollable.
|
|
124
|
+
* In that case, the toolbars on mobile device won't collapse.
|
|
124
125
|
*
|
|
125
126
|
* @fires {CustomEvent} drawer-opened-changed - Fired when the `drawerOpened` property changes.
|
|
126
127
|
* @fires {CustomEvent} overlay-changed - Fired when the `overlay` property changes.
|
|
@@ -151,7 +152,7 @@ class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(L
|
|
|
151
152
|
<div part="drawer" id="drawer">
|
|
152
153
|
<slot name="drawer" id="drawerSlot" @slotchange="${this.__onDrawerSlotChange}"></slot>
|
|
153
154
|
</div>
|
|
154
|
-
<div content>
|
|
155
|
+
<div part="content">
|
|
155
156
|
<slot></slot>
|
|
156
157
|
</div>
|
|
157
158
|
<div part="navbar navbar-bottom" id="navbarBottom" hidden>
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/app-layout",
|
|
4
|
-
"version": "25.2.0-
|
|
4
|
+
"version": "25.2.0-alpha8",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-app-layout",
|
|
11
|
-
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat
|
|
11
|
+
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n`content` | Container for the content area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat makes the content part of App Layout scrollable.\nIn that case, the toolbars on mobile device won't collapse.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "close-drawer-on",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/app-layout",
|
|
4
|
-
"version": "25.2.0-
|
|
4
|
+
"version": "25.2.0-alpha8",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-app-layout",
|
|
19
|
-
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat
|
|
19
|
+
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables:\n\n- `--safe-area-inset-top`\n- `--safe-area-inset-right`\n- `--safe-area-inset-bottom`\n- `--safe-area-inset-left`\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`navbar-top` | Container for the top navigation bar\n`navbar-bottom` | Container for the bottom navigation bar\n`drawer` | Container for the drawer area\n`content` | Container for the content area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-drawer` | Set when the element has light DOM content in the drawer slot.\n`has-navbar` | Set when the element has light DOM content in the navbar slot.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------|\n| `--vaadin-app-layout-drawer-background` |\n| `--vaadin-app-layout-drawer-width` |\n| `--vaadin-app-layout-navbar-background` |\n| `--vaadin-app-layout-navbar-gap` |\n| `--vaadin-app-layout-navbar-padding-bottom` |\n| `--vaadin-app-layout-navbar-padding-inline-end` |\n| `--vaadin-app-layout-navbar-padding-inline-start` |\n| `--vaadin-app-layout-navbar-padding-top` |\n| `--vaadin-app-layout-transition-duration` |\n| `--vaadin-overlay-backdrop-background` |\n| `--vaadin-overlay-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat makes the content part of App Layout scrollable.\nIn that case, the toolbars on mobile device won't collapse.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|