@vaadin/app-layout 24.2.0-alpha1 → 24.2.0-alpha11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/app-layout",
3
- "version": "24.2.0-alpha1",
3
+ "version": "24.2.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,22 +36,22 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.2.0-alpha1",
40
- "@vaadin/button": "24.2.0-alpha1",
41
- "@vaadin/component-base": "24.2.0-alpha1",
42
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha1",
43
- "@vaadin/vaadin-material-styles": "24.2.0-alpha1",
44
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha1"
39
+ "@vaadin/a11y-base": "24.2.0-alpha11",
40
+ "@vaadin/button": "24.2.0-alpha11",
41
+ "@vaadin/component-base": "24.2.0-alpha11",
42
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha11",
43
+ "@vaadin/vaadin-material-styles": "24.2.0-alpha11",
44
+ "@vaadin/vaadin-themable-mixin": "24.2.0-alpha11"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@esm-bundle/chai": "^4.3.4",
48
- "@vaadin/tabs": "24.2.0-alpha1",
49
- "@vaadin/testing-helpers": "^0.4.2",
48
+ "@vaadin/tabs": "24.2.0-alpha11",
49
+ "@vaadin/testing-helpers": "^0.5.0",
50
50
  "sinon": "^13.0.2"
51
51
  },
52
52
  "web-types": [
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "0dbb118320203ab6c0c07450a3e718815367589f"
56
+ "gitHead": "a958207d5f6a09ca0e2dcf9f62194b3f92c8766a"
57
57
  }
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import './safe-area-inset.js';
7
7
  import './detect-ios-navbar.js';
8
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
9
8
  import { afterNextRender, beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
10
9
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
11
10
  import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller.js';
@@ -273,11 +272,11 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
273
272
  }
274
273
  </style>
275
274
  <div part="navbar" id="navbarTop">
276
- <slot name="navbar"></slot>
275
+ <slot name="navbar" on-slotchange="_updateTouchOptimizedMode"></slot>
277
276
  </div>
278
277
  <div part="backdrop" on-click="_onBackdropClick" on-touchend="_onBackdropTouchend"></div>
279
- <div part="drawer" id="drawer" on-keydown="__onDrawerKeyDown">
280
- <slot name="drawer" id="drawerSlot"></slot>
278
+ <div part="drawer" id="drawer">
279
+ <slot name="drawer" id="drawerSlot" on-slotchange="_updateDrawerSize"></slot>
281
280
  </div>
282
281
  <div content>
283
282
  <slot></slot>
@@ -285,7 +284,9 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
285
284
  <div part="navbar" id="navbarBottom" bottom hidden>
286
285
  <slot name="navbar-bottom"></slot>
287
286
  </div>
288
- <div hidden><slot id="touchSlot" name="navbar touch-optimized"></slot></div>
287
+ <div hidden>
288
+ <slot id="touchSlot" name="navbar touch-optimized" on-slotchange="_updateTouchOptimizedMode"></slot>
289
+ </div>
289
290
  `;
290
291
  }
291
292
 
@@ -399,6 +400,7 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
399
400
  // TODO(jouni): might want to debounce
400
401
  this.__boundResizeListener = this._resize.bind(this);
401
402
  this.__drawerToggleClickListener = this._drawerToggleClick.bind(this);
403
+ this.__onDrawerKeyDown = this.__onDrawerKeyDown.bind(this);
402
404
  this.__closeOverlayDrawerListener = this.__closeOverlayDrawer.bind(this);
403
405
  this.__trapFocusInDrawer = this.__trapFocusInDrawer.bind(this);
404
406
  this.__releaseFocusFromDrawer = this.__releaseFocusFromDrawer.bind(this);
@@ -422,32 +424,25 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
422
424
  beforeNextRender(this, this._afterFirstRender);
423
425
 
424
426
  this._updateTouchOptimizedMode();
425
-
426
- const navbarSlot = this.$.navbarTop.firstElementChild;
427
- this._navbarChildObserver = new FlattenedNodesObserver(navbarSlot, () => {
428
- this._updateTouchOptimizedMode();
429
- });
430
-
431
- this._touchChildObserver = new FlattenedNodesObserver(this.$.touchSlot, () => {
432
- this._updateTouchOptimizedMode();
433
- });
434
-
435
- this._drawerChildObserver = new FlattenedNodesObserver(this.$.drawerSlot, () => {
436
- this._updateDrawerSize();
437
- });
438
427
  this._updateDrawerSize();
439
428
  this._updateOverlayMode();
440
429
 
441
430
  this._navbarSizeObserver = new ResizeObserver(() => {
442
431
  requestAnimationFrame(() => {
443
- this._blockAnimationUntilAfterNextRender();
444
- this._updateOffsetSize();
432
+ // Prevent updating offset size multiple times
433
+ // during the drawer open / close transition.
434
+ if (this.__isDrawerAnimating) {
435
+ this.__updateOffsetSizePending = true;
436
+ } else {
437
+ this._updateOffsetSize();
438
+ }
445
439
  });
446
440
  });
447
441
  this._navbarSizeObserver.observe(this.$.navbarTop);
448
442
  this._navbarSizeObserver.observe(this.$.navbarBottom);
449
443
 
450
444
  window.addEventListener('close-overlay-drawer', this.__closeOverlayDrawerListener);
445
+ window.addEventListener('keydown', this.__onDrawerKeyDown);
451
446
  }
452
447
 
453
448
  /** @protected */
@@ -455,25 +450,34 @@ class AppLayout extends ElementMixin(ThemableMixin(ControllerMixin(PolymerElemen
455
450
  super.ready();
456
451
  this.addController(this.__focusTrapController);
457
452
  this.__setAriaExpanded();
453
+
454
+ this.$.drawer.addEventListener('transitionstart', () => {
455
+ this.__isDrawerAnimating = true;
456
+ });
457
+
458
+ this.$.drawer.addEventListener('transitionend', () => {
459
+ // Update offset size after drawer animation.
460
+ if (this.__updateOffsetSizePending) {
461
+ this.__updateOffsetSizePending = false;
462
+ this._updateOffsetSize();
463
+ }
464
+
465
+ // Delay resetting the flag until animation frame
466
+ // to avoid updating offset size again on resize.
467
+ requestAnimationFrame(() => {
468
+ this.__isDrawerAnimating = false;
469
+ });
470
+ });
458
471
  }
459
472
 
460
473
  /** @protected */
461
474
  disconnectedCallback() {
462
475
  super.disconnectedCallback();
463
476
 
464
- if (this._navbarChildObserver) {
465
- this._navbarChildObserver.disconnect();
466
- }
467
- if (this._drawerChildObserver) {
468
- this._drawerChildObserver.disconnect();
469
- }
470
- if (this._touchChildObserver) {
471
- this._touchChildObserver.disconnect();
472
- }
473
-
474
477
  window.removeEventListener('resize', this.__boundResizeListener);
475
478
  this.removeEventListener('drawer-toggle-click', this.__drawerToggleClickListener);
476
479
  window.removeEventListener('close-overlay-drawer', this.__drawerToggleClickListener);
480
+ window.removeEventListener('keydown', this.__onDrawerKeyDown);
477
481
  }
478
482
 
479
483
  /**
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2018 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
7
6
  import { html } from '@polymer/polymer/lib/utils/html-tag.js';
8
7
  import { Button } from '@vaadin/button/src/vaadin-button.js';
9
8
  import { isEmptyTextNode } from '@vaadin/component-base/src/dom-utils.js';
@@ -108,7 +107,9 @@ class DrawerToggle extends Button {
108
107
  ready() {
109
108
  super.ready();
110
109
 
111
- this._observer = new FlattenedNodesObserver(this, () => {
110
+ this._toggleFallbackIcon();
111
+
112
+ this.$.slot.addEventListener('slotchange', () => {
112
113
  this._toggleFallbackIcon();
113
114
  });
114
115
  }
package/web-types.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.2.0-alpha1",
4
+ "version": "24.2.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/app-layout",
4
- "version": "24.2.0-alpha1",
4
+ "version": "24.2.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {