@vaadin/vaadin-overlay 22.0.0-alpha9 → 23.0.0-alpha1
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/vaadin-overlay",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "
|
|
38
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
39
|
-
"@vaadin/vaadin-material-styles": "
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
37
|
+
"@vaadin/component-base": "23.0.0-alpha1",
|
|
38
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha1",
|
|
39
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha1",
|
|
40
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@esm-bundle/chai": "^4.3.4",
|
|
44
44
|
"@polymer/iron-overlay-behavior": "^3.0.0",
|
|
45
|
-
"@vaadin/button": "
|
|
46
|
-
"@vaadin/radio-group": "
|
|
47
|
-
"@vaadin/testing-helpers": "^0.3.
|
|
48
|
-
"@vaadin/text-field": "
|
|
45
|
+
"@vaadin/button": "23.0.0-alpha1",
|
|
46
|
+
"@vaadin/radio-group": "23.0.0-alpha1",
|
|
47
|
+
"@vaadin/testing-helpers": "^0.3.2",
|
|
48
|
+
"@vaadin/text-field": "23.0.0-alpha1",
|
|
49
49
|
"lit": "^2.0.0",
|
|
50
50
|
"sinon": "^9.2.1"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "fbcb07328fdf88260e3b461088d207426b21c710"
|
|
53
53
|
}
|
package/src/vaadin-overlay.d.ts
CHANGED
|
@@ -61,8 +61,7 @@ export type OverlayEventMap = HTMLElementEventMap & OverlayElementEventMap;
|
|
|
61
61
|
*
|
|
62
62
|
* The overlay provides `forwardHostProp` when calling
|
|
63
63
|
* `Polymer.Templatize.templatize` for the template, so that the bindings
|
|
64
|
-
* from the parent scope propagate to the content.
|
|
65
|
-
* custom `instanceProps` object using the `instanceProps` property.
|
|
64
|
+
* from the parent scope propagate to the content.
|
|
66
65
|
*
|
|
67
66
|
* ```html
|
|
68
67
|
* <vaadin-overlay>
|
|
@@ -70,10 +69,6 @@ export type OverlayEventMap = HTMLElementEventMap & OverlayElementEventMap;
|
|
|
70
69
|
* </vaadin-overlay>
|
|
71
70
|
* ```
|
|
72
71
|
*
|
|
73
|
-
* **NOTE:** when using `instanceProps`: because of the Polymer limitation,
|
|
74
|
-
* every template can only be templatized once, so it is important
|
|
75
|
-
* to set `instanceProps` before the `template` is assigned to the overlay.
|
|
76
|
-
*
|
|
77
72
|
* ### Styling
|
|
78
73
|
*
|
|
79
74
|
* To style the overlay content, use styles in the parent scope:
|
|
@@ -111,11 +106,6 @@ export type OverlayEventMap = HTMLElementEventMap & OverlayElementEventMap;
|
|
|
111
106
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
112
107
|
*/
|
|
113
108
|
declare class OverlayElement extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
114
|
-
/**
|
|
115
|
-
* returns true if this is the last one in the opened overlays stack
|
|
116
|
-
*/
|
|
117
|
-
readonly _last: boolean;
|
|
118
|
-
|
|
119
109
|
/**
|
|
120
110
|
* When true, the overlay is visible and attached to body.
|
|
121
111
|
*/
|
|
@@ -141,11 +131,6 @@ declare class OverlayElement extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
|
141
131
|
*/
|
|
142
132
|
template: HTMLTemplateElement | null | undefined;
|
|
143
133
|
|
|
144
|
-
/**
|
|
145
|
-
* Optional argument for `Polymer.Templatize.templatize`.
|
|
146
|
-
*/
|
|
147
|
-
instanceProps: object | null | undefined;
|
|
148
|
-
|
|
149
134
|
/**
|
|
150
135
|
* References the content container after the template is stamped.
|
|
151
136
|
*/
|
|
@@ -184,38 +169,8 @@ declare class OverlayElement extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
|
184
169
|
*/
|
|
185
170
|
restoreFocusOnClose: boolean;
|
|
186
171
|
|
|
187
|
-
_setTemplateFromNodes(nodes: Element[]): void;
|
|
188
|
-
|
|
189
172
|
close(sourceEvent?: Event | null): void;
|
|
190
173
|
|
|
191
|
-
_ensureTemplatized(): void;
|
|
192
|
-
|
|
193
|
-
_shouldAnimate(): boolean;
|
|
194
|
-
|
|
195
|
-
_enqueueAnimation(type: string, callback: Function | null): void;
|
|
196
|
-
|
|
197
|
-
_flushAnimation(type: string): void;
|
|
198
|
-
|
|
199
|
-
_animatedOpening(): void;
|
|
200
|
-
|
|
201
|
-
_attachOverlay(): void;
|
|
202
|
-
|
|
203
|
-
_animatedClosing(): void;
|
|
204
|
-
|
|
205
|
-
_detachOverlay(): void;
|
|
206
|
-
|
|
207
|
-
_addGlobalListeners(): void;
|
|
208
|
-
|
|
209
|
-
_enterModalState(): void;
|
|
210
|
-
|
|
211
|
-
_removeGlobalListeners(): void;
|
|
212
|
-
|
|
213
|
-
_exitModalState(): void;
|
|
214
|
-
|
|
215
|
-
_removeOldContent(): void;
|
|
216
|
-
|
|
217
|
-
_stampOverlayTemplate(template: HTMLTemplateElement, instanceProps: object | null): void;
|
|
218
|
-
|
|
219
174
|
/**
|
|
220
175
|
* Requests an update for the content of the overlay.
|
|
221
176
|
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
@@ -224,18 +179,6 @@ declare class OverlayElement extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
|
224
179
|
*/
|
|
225
180
|
requestContentUpdate(): void;
|
|
226
181
|
|
|
227
|
-
_isFocused(element: Element | null): boolean;
|
|
228
|
-
|
|
229
|
-
_focusedIndex(elements: Array<Element | null> | null): number;
|
|
230
|
-
|
|
231
|
-
_cycleTab(increment: number, index: number | undefined): void;
|
|
232
|
-
|
|
233
|
-
_getFocusableElements(): HTMLElement[];
|
|
234
|
-
|
|
235
|
-
_getActiveElement(): Element;
|
|
236
|
-
|
|
237
|
-
_deepContains(node: Node): boolean;
|
|
238
|
-
|
|
239
182
|
/**
|
|
240
183
|
* Brings the overlay as visually the frontmost one
|
|
241
184
|
*/
|
package/src/vaadin-overlay.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
|
|
8
|
-
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
9
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
|
+
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
8
|
+
import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
|
|
9
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
+
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
10
11
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
11
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
13
|
import { FocusablesHelper } from './vaadin-focusables-helper.js';
|
|
@@ -54,18 +55,7 @@ import { FocusablesHelper } from './vaadin-focusables-helper.js';
|
|
|
54
55
|
*
|
|
55
56
|
* The overlay provides `forwardHostProp` when calling
|
|
56
57
|
* `Polymer.Templatize.templatize` for the template, so that the bindings
|
|
57
|
-
* from the parent scope propagate to the content.
|
|
58
|
-
* custom `instanceProps` object using the `instanceProps` property.
|
|
59
|
-
*
|
|
60
|
-
* ```html
|
|
61
|
-
* <vaadin-overlay>
|
|
62
|
-
* <template>Overlay content</template>
|
|
63
|
-
* </vaadin-overlay>
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* **NOTE:** when using `instanceProps`: because of the Polymer limitation,
|
|
67
|
-
* every template can only be templatized once, so it is important
|
|
68
|
-
* to set `instanceProps` before the `template` is assigned to the overlay.
|
|
58
|
+
* from the parent scope propagate to the content.
|
|
69
59
|
*
|
|
70
60
|
* ### Styling
|
|
71
61
|
*
|
|
@@ -226,13 +216,6 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
226
216
|
notify: true
|
|
227
217
|
},
|
|
228
218
|
|
|
229
|
-
/**
|
|
230
|
-
* Optional argument for `Polymer.Templatize.templatize`.
|
|
231
|
-
*/
|
|
232
|
-
instanceProps: {
|
|
233
|
-
type: Object
|
|
234
|
-
},
|
|
235
|
-
|
|
236
219
|
/**
|
|
237
220
|
* References the content container after the template is stamped.
|
|
238
221
|
* @type {!HTMLElement | undefined}
|
|
@@ -329,9 +312,6 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
329
312
|
/** @private */
|
|
330
313
|
_oldTemplate: Object,
|
|
331
314
|
|
|
332
|
-
/** @private */
|
|
333
|
-
_oldInstanceProps: Object,
|
|
334
|
-
|
|
335
315
|
/** @private */
|
|
336
316
|
_oldRenderer: Object,
|
|
337
317
|
|
|
@@ -341,7 +321,7 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
341
321
|
}
|
|
342
322
|
|
|
343
323
|
static get observers() {
|
|
344
|
-
return ['_templateOrRendererChanged(template, renderer, owner, model,
|
|
324
|
+
return ['_templateOrRendererChanged(template, renderer, owner, model, opened)'];
|
|
345
325
|
}
|
|
346
326
|
|
|
347
327
|
constructor() {
|
|
@@ -359,7 +339,7 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
359
339
|
this._boundIronOverlayCanceledListener = this._ironOverlayCanceled.bind(this);
|
|
360
340
|
|
|
361
341
|
/* c8 ignore next 3 */
|
|
362
|
-
if (
|
|
342
|
+
if (isIOS) {
|
|
363
343
|
this._boundIosResizeListener = () => this._detectIosNavbar();
|
|
364
344
|
}
|
|
365
345
|
}
|
|
@@ -824,15 +804,13 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
824
804
|
|
|
825
805
|
/**
|
|
826
806
|
* @param {!HTMLTemplateElement} template
|
|
827
|
-
* @param {object} instanceProps
|
|
828
807
|
* @protected
|
|
829
808
|
*/
|
|
830
|
-
_stampOverlayTemplate(template
|
|
809
|
+
_stampOverlayTemplate(template) {
|
|
831
810
|
this._removeOldContent();
|
|
832
811
|
|
|
833
812
|
if (!template._Templatizer) {
|
|
834
813
|
template._Templatizer = templatize(template, this, {
|
|
835
|
-
instanceProps: instanceProps,
|
|
836
814
|
forwardHostProp: function (prop, value) {
|
|
837
815
|
if (this._instance) {
|
|
838
816
|
this._instance.forwardHostProp(prop, value);
|
|
@@ -885,7 +863,7 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
885
863
|
}
|
|
886
864
|
|
|
887
865
|
/** @private */
|
|
888
|
-
_templateOrRendererChanged(template, renderer, owner, model,
|
|
866
|
+
_templateOrRendererChanged(template, renderer, owner, model, opened) {
|
|
889
867
|
if (template && renderer) {
|
|
890
868
|
this._removeNewRendererOrTemplate(template, this._oldTemplate, renderer, this._oldRenderer);
|
|
891
869
|
throw new Error('You should only use either a renderer or a template for overlay content');
|
|
@@ -895,8 +873,7 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
895
873
|
this._oldModel = model;
|
|
896
874
|
this._oldOwner = owner;
|
|
897
875
|
|
|
898
|
-
const
|
|
899
|
-
this._oldInstanceProps = instanceProps;
|
|
876
|
+
const templateChanged = this._oldTemplate !== template;
|
|
900
877
|
this._oldTemplate = template;
|
|
901
878
|
|
|
902
879
|
const rendererChanged = this._oldRenderer !== renderer;
|
|
@@ -914,8 +891,8 @@ class OverlayElement extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
914
891
|
delete this.content._$litPart$;
|
|
915
892
|
}
|
|
916
893
|
|
|
917
|
-
if (template &&
|
|
918
|
-
this._stampOverlayTemplate(template
|
|
894
|
+
if (template && templateChanged) {
|
|
895
|
+
this._stampOverlayTemplate(template);
|
|
919
896
|
} else if (renderer && (rendererChanged || openedChanged || ownerOrModelChanged)) {
|
|
920
897
|
if (opened) {
|
|
921
898
|
this.requestContentUpdate();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
2
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
3
|
|
|
4
4
|
registerStyles('vaadin-overlay', overlay, { moduleId: 'lumo-vaadin-overlay' });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
|
|
2
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
3
|
|
|
4
4
|
registerStyles('vaadin-overlay', overlay, { moduleId: 'material-vaadin-overlay' });
|