@lion/overlays
Advanced tools
Comparing version 0.22.5 to 0.22.6
# Change Log | ||
## 0.22.6 | ||
### Patch Changes | ||
- de536282: Sync config change to the controller and make sure that an overlay is re-opened/re-hidden after the updateConfig handling, instead of always closed. | ||
- 11e8dbcb: Return promises for the OverlayMixin toggle, open and close methods, since the OverlayController hiding/showing is asynchronous. | ||
## 0.22.5 | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@lion/overlays", | ||
"version": "0.22.5", | ||
"version": "0.22.6", | ||
"description": "Overlays System using lit-html for rendering", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -660,2 +660,7 @@ import '@lion/core/src/differentKeyEventNamesShimIE.js'; | ||
async show(elementToFocusAfterHide = this.elementToFocusAfterHide) { | ||
// Subsequent shows could happen, make sure we await it first. | ||
// Otherwise it gets replaced before getting resolved, and places awaiting it will time out. | ||
if (this._showComplete) { | ||
await this._showComplete; | ||
} | ||
this._showComplete = new Promise(resolve => { | ||
@@ -662,0 +667,0 @@ this._showResolve = resolve; |
import { dedupeMixin } from '@lion/core'; | ||
import { OverlayController } from './OverlayController.js'; | ||
import { isEqualConfig } from './utils/is-equal-config.js'; | ||
@@ -46,6 +47,11 @@ /** | ||
set config(value) { | ||
if (this._overlayCtrl) { | ||
const shouldUpdate = !isEqualConfig(this.config, value); | ||
if (this._overlayCtrl && shouldUpdate) { | ||
this._overlayCtrl.updateConfig(value); | ||
} | ||
this.__config = value; | ||
if (this._overlayCtrl && shouldUpdate) { | ||
this.__syncToOverlayController(); | ||
} | ||
} | ||
@@ -323,4 +329,4 @@ | ||
*/ | ||
toggle() { | ||
/** @type {OverlayController} */ (this._overlayCtrl).toggle(); | ||
async toggle() { | ||
await /** @type {OverlayController} */ (this._overlayCtrl).toggle(); | ||
} | ||
@@ -331,4 +337,4 @@ | ||
*/ | ||
open() { | ||
/** @type {OverlayController} */ (this._overlayCtrl).show(); | ||
async open() { | ||
await /** @type {OverlayController} */ (this._overlayCtrl).show(); | ||
} | ||
@@ -339,6 +345,6 @@ | ||
*/ | ||
close() { | ||
/** @type {OverlayController} */ (this._overlayCtrl).hide(); | ||
async close() { | ||
await /** @type {OverlayController} */ (this._overlayCtrl).hide(); | ||
} | ||
}; | ||
export const OverlayMixin = dedupeMixin(OverlayMixinImplementation); |
@@ -923,5 +923,7 @@ /* eslint-disable no-new */ | ||
await ctrl3.show(); | ||
await ctrl3._showComplete; | ||
expect(ctrl3.content).to.be.displayed; | ||
await ctrl2.hide(); | ||
await ctrl2._hideComplete; | ||
expect(ctrl0.content).to.be.displayed; | ||
@@ -928,0 +930,0 @@ expect(ctrl1.content).to.be.displayed; |
320282
140
6376