@vaadin/app-layout 24.1.1 → 24.1.3
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/package.json +9 -9
- package/src/vaadin-app-layout.d.ts +1 -1
- package/src/vaadin-app-layout.js +30 -4
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/app-layout",
|
|
3
|
-
"version": "24.1.
|
|
3
|
+
"version": "24.1.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/a11y-base": "~24.1.
|
|
40
|
-
"@vaadin/button": "~24.1.
|
|
41
|
-
"@vaadin/component-base": "~24.1.
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "~24.1.
|
|
43
|
-
"@vaadin/vaadin-material-styles": "~24.1.
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "~24.1.
|
|
39
|
+
"@vaadin/a11y-base": "~24.1.3",
|
|
40
|
+
"@vaadin/button": "~24.1.3",
|
|
41
|
+
"@vaadin/component-base": "~24.1.3",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "~24.1.3",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "~24.1.3",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "~24.1.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
|
-
"@vaadin/tabs": "~24.1.
|
|
48
|
+
"@vaadin/tabs": "~24.1.3",
|
|
49
49
|
"@vaadin/testing-helpers": "^0.4.2",
|
|
50
50
|
"sinon": "^13.0.2"
|
|
51
51
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "161d7de3f22afa4b67723493555c0512ce2acfe3"
|
|
57
57
|
}
|
|
@@ -78,7 +78,7 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
78
78
|
* `navbar` | Container for the navigation bar
|
|
79
79
|
* `drawer` | Container for the drawer area
|
|
80
80
|
*
|
|
81
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
81
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
82
82
|
*
|
|
83
83
|
* ### Component's slots
|
|
84
84
|
*
|
package/src/vaadin-app-layout.js
CHANGED
|
@@ -60,7 +60,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
60
60
|
* `navbar` | Container for the navigation bar
|
|
61
61
|
* `drawer` | Container for the drawer area
|
|
62
62
|
*
|
|
63
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
63
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
64
64
|
*
|
|
65
65
|
* ### Component's slots
|
|
66
66
|
*
|
|
@@ -276,7 +276,7 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
|
|
|
276
276
|
<slot name="navbar"></slot>
|
|
277
277
|
</div>
|
|
278
278
|
<div part="backdrop" on-click="_onBackdropClick" on-touchend="_onBackdropTouchend"></div>
|
|
279
|
-
<div part="drawer" id="drawer"
|
|
279
|
+
<div part="drawer" id="drawer">
|
|
280
280
|
<slot name="drawer" id="drawerSlot"></slot>
|
|
281
281
|
</div>
|
|
282
282
|
<div content>
|
|
@@ -399,6 +399,7 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
|
|
|
399
399
|
// TODO(jouni): might want to debounce
|
|
400
400
|
this.__boundResizeListener = this._resize.bind(this);
|
|
401
401
|
this.__drawerToggleClickListener = this._drawerToggleClick.bind(this);
|
|
402
|
+
this.__onDrawerKeyDown = this.__onDrawerKeyDown.bind(this);
|
|
402
403
|
this.__closeOverlayDrawerListener = this.__closeOverlayDrawer.bind(this);
|
|
403
404
|
this.__trapFocusInDrawer = this.__trapFocusInDrawer.bind(this);
|
|
404
405
|
this.__releaseFocusFromDrawer = this.__releaseFocusFromDrawer.bind(this);
|
|
@@ -440,14 +441,20 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
|
|
|
440
441
|
|
|
441
442
|
this._navbarSizeObserver = new ResizeObserver(() => {
|
|
442
443
|
requestAnimationFrame(() => {
|
|
443
|
-
|
|
444
|
-
|
|
444
|
+
// Prevent updating offset size multiple times
|
|
445
|
+
// during the drawer open / close transition.
|
|
446
|
+
if (this.__isDrawerAnimating) {
|
|
447
|
+
this.__updateOffsetSizePending = true;
|
|
448
|
+
} else {
|
|
449
|
+
this._updateOffsetSize();
|
|
450
|
+
}
|
|
445
451
|
});
|
|
446
452
|
});
|
|
447
453
|
this._navbarSizeObserver.observe(this.$.navbarTop);
|
|
448
454
|
this._navbarSizeObserver.observe(this.$.navbarBottom);
|
|
449
455
|
|
|
450
456
|
window.addEventListener('close-overlay-drawer', this.__closeOverlayDrawerListener);
|
|
457
|
+
window.addEventListener('keydown', this.__onDrawerKeyDown);
|
|
451
458
|
}
|
|
452
459
|
|
|
453
460
|
/** @protected */
|
|
@@ -455,6 +462,24 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
|
|
|
455
462
|
super.ready();
|
|
456
463
|
this.addController(this.__focusTrapController);
|
|
457
464
|
this.__setAriaExpanded();
|
|
465
|
+
|
|
466
|
+
this.$.drawer.addEventListener('transitionstart', () => {
|
|
467
|
+
this.__isDrawerAnimating = true;
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
this.$.drawer.addEventListener('transitionend', () => {
|
|
471
|
+
// Update offset size after drawer animation.
|
|
472
|
+
if (this.__updateOffsetSizePending) {
|
|
473
|
+
this.__updateOffsetSizePending = false;
|
|
474
|
+
this._updateOffsetSize();
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Delay resetting the flag until animation frame
|
|
478
|
+
// to avoid updating offset size again on resize.
|
|
479
|
+
requestAnimationFrame(() => {
|
|
480
|
+
this.__isDrawerAnimating = false;
|
|
481
|
+
});
|
|
482
|
+
});
|
|
458
483
|
}
|
|
459
484
|
|
|
460
485
|
/** @protected */
|
|
@@ -474,6 +499,7 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
|
|
|
474
499
|
window.removeEventListener('resize', this.__boundResizeListener);
|
|
475
500
|
this.removeEventListener('drawer-toggle-click', this.__drawerToggleClickListener);
|
|
476
501
|
window.removeEventListener('close-overlay-drawer', this.__drawerToggleClickListener);
|
|
502
|
+
window.removeEventListener('keydown', this.__onDrawerKeyDown);
|
|
477
503
|
}
|
|
478
504
|
|
|
479
505
|
/**
|
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": "24.1.
|
|
4
|
+
"version": "24.1.3",
|
|
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```\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```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\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\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
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```\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```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\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\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\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 will make the `[content]` element of app layout scrollable.\nOn this case, the toolbars on mobile device won't collapse.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "primary-section",
|
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": "24.1.
|
|
4
|
+
"version": "24.1.3",
|
|
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```\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```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\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\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
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```\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```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\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\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\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 will make the `[content]` element of app layout scrollable.\nOn this case, the toolbars on mobile device won't collapse.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|