@vaadin/app-layout 24.8.0-alpha8 → 25.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/README.md +0 -26
- package/package.json +10 -13
- package/src/vaadin-app-layout-mixin.js +10 -10
- package/src/vaadin-app-layout.d.ts +1 -2
- package/src/vaadin-app-layout.js +18 -16
- package/src/vaadin-drawer-toggle.js +20 -19
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
- package/src/vaadin-lit-app-layout.d.ts +0 -1
- package/src/vaadin-lit-app-layout.js +0 -59
- package/src/vaadin-lit-drawer-toggle.d.ts +0 -1
- package/src/vaadin-lit-drawer-toggle.js +0 -87
- package/theme/lumo/vaadin-lit-app-layout.d.ts +0 -2
- package/theme/lumo/vaadin-lit-app-layout.js +0 -2
- package/theme/lumo/vaadin-lit-drawer-toggle.d.ts +0 -2
- package/theme/lumo/vaadin-lit-drawer-toggle.js +0 -2
- package/theme/material/vaadin-app-layout-styles.d.ts +0 -3
- package/theme/material/vaadin-app-layout-styles.js +0 -53
- package/theme/material/vaadin-app-layout.d.ts +0 -2
- package/theme/material/vaadin-app-layout.js +0 -2
- package/theme/material/vaadin-drawer-toggle-styles.d.ts +0 -1
- package/theme/material/vaadin-drawer-toggle-styles.js +0 -39
- package/theme/material/vaadin-drawer-toggle.d.ts +0 -2
- package/theme/material/vaadin-drawer-toggle.js +0 -2
- package/theme/material/vaadin-lit-app-layout.d.ts +0 -2
- package/theme/material/vaadin-lit-app-layout.js +0 -2
- package/theme/material/vaadin-lit-drawer-toggle.d.ts +0 -2
- package/theme/material/vaadin-lit-drawer-toggle.js +0 -2
- package/vaadin-lit-app-layout.d.ts +0 -1
- package/vaadin-lit-app-layout.js +0 -2
- package/vaadin-lit-drawer-toggle.d.ts +0 -1
- package/vaadin-lit-drawer-toggle.js +0 -2
package/README.md
CHANGED
|
@@ -47,32 +47,6 @@ import '@vaadin/app-layout';
|
|
|
47
47
|
import '@vaadin/app-layout/vaadin-drawer-toggle.js';
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
## Themes
|
|
51
|
-
|
|
52
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
53
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/app-layout/vaadin-app-layout.js) of the package uses the Lumo theme.
|
|
54
|
-
|
|
55
|
-
To use the Material theme, import the components from the `theme/material` folder:
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
import '@vaadin/app-layout/theme/material/vaadin-app-layout.js';
|
|
59
|
-
import '@vaadin/app-layout/theme/material/vaadin-drawer-toggle.js';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
You can also import the Lumo version of the components explicitly:
|
|
63
|
-
|
|
64
|
-
```js
|
|
65
|
-
import '@vaadin/app-layout/theme/lumo/vaadin-app-layout.js';
|
|
66
|
-
import '@vaadin/app-layout/theme/lumo/vaadin-drawer-toggle.js';
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Finally, you can import the un-themed components from the `src` folder to get a minimal starting point:
|
|
70
|
-
|
|
71
|
-
```js
|
|
72
|
-
import '@vaadin/app-layout/src/vaadin-app-layout.js';
|
|
73
|
-
import '@vaadin/app-layout/src/vaadin-drawer-toggle.js';
|
|
74
|
-
```
|
|
75
|
-
|
|
76
50
|
## Contributing
|
|
77
51
|
|
|
78
52
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/app-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,23 +31,20 @@
|
|
|
31
31
|
"Vaadin",
|
|
32
32
|
"vaadin-app-layout",
|
|
33
33
|
"web-components",
|
|
34
|
-
"web-component"
|
|
35
|
-
"polymer"
|
|
34
|
+
"web-component"
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/vaadin-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
39
|
+
"@vaadin/button": "25.0.0-alpha1",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
46
43
|
"lit": "^3.0.0"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "
|
|
50
|
-
"@vaadin/test-runner-commands": "
|
|
46
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
51
48
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
52
49
|
"sinon": "^18.0.0"
|
|
53
50
|
},
|
|
@@ -55,5 +52,5 @@
|
|
|
55
52
|
"web-types.json",
|
|
56
53
|
"web-types.lit.json"
|
|
57
54
|
],
|
|
58
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
59
56
|
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { afterNextRender, beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
7
6
|
import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller.js';
|
|
8
7
|
import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller.js';
|
|
8
|
+
import { animationFrame } from '@vaadin/component-base/src/async.js';
|
|
9
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
9
10
|
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -144,7 +145,9 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
144
145
|
window.addEventListener('resize', this.__boundResizeListener);
|
|
145
146
|
this.addEventListener('drawer-toggle-click', this.__drawerToggleClickListener);
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
requestAnimationFrame(() => {
|
|
149
|
+
this._updateOffsetSize();
|
|
150
|
+
});
|
|
148
151
|
|
|
149
152
|
this._updateTouchOptimizedMode();
|
|
150
153
|
this._updateDrawerSize();
|
|
@@ -255,12 +258,6 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
255
258
|
this.__updateDrawerAriaAttributes();
|
|
256
259
|
}
|
|
257
260
|
|
|
258
|
-
/** @protected */
|
|
259
|
-
_afterFirstRender() {
|
|
260
|
-
this._blockAnimationUntilAfterNextRender();
|
|
261
|
-
this._updateOffsetSize();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
261
|
/** @private */
|
|
265
262
|
_drawerToggleClick(e) {
|
|
266
263
|
e.stopPropagation();
|
|
@@ -508,8 +505,11 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
508
505
|
/** @protected */
|
|
509
506
|
_blockAnimationUntilAfterNextRender() {
|
|
510
507
|
this.setAttribute('no-anim', '');
|
|
511
|
-
|
|
512
|
-
|
|
508
|
+
|
|
509
|
+
this.__debounceAnimation = Debouncer.debounce(this.__debounceAnimation, animationFrame, () => {
|
|
510
|
+
setTimeout(() => {
|
|
511
|
+
this.removeAttribute('no-anim');
|
|
512
|
+
});
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
8
|
import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
@@ -123,7 +122,7 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
123
122
|
* @fires {CustomEvent} overlay-changed - Fired when the `overlay` property changes.
|
|
124
123
|
* @fires {CustomEvent} primary-section-changed - Fired when the `primarySection` property changes.
|
|
125
124
|
*/
|
|
126
|
-
declare class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(
|
|
125
|
+
declare class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(HTMLElement))) {
|
|
127
126
|
/**
|
|
128
127
|
* Helper static method that dispatches a `close-overlay-drawer` event
|
|
129
128
|
*/
|
package/src/vaadin-app-layout.js
CHANGED
|
@@ -5,16 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import './detect-ios-navbar.js';
|
|
7
7
|
import './safe-area-inset.js';
|
|
8
|
-
import { html,
|
|
9
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import { html, LitElement } from 'lit';
|
|
10
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
12
|
-
import {
|
|
11
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
13
|
import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
14
14
|
import { appLayoutStyles } from './vaadin-app-layout-styles.js';
|
|
15
15
|
|
|
16
|
-
registerStyles('vaadin-app-layout', appLayoutStyles, { moduleId: 'vaadin-app-layout-styles' });
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* `<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.
|
|
20
18
|
*
|
|
@@ -108,17 +106,25 @@ registerStyles('vaadin-app-layout', appLayoutStyles, { moduleId: 'vaadin-app-lay
|
|
|
108
106
|
* @mixes AppLayoutMixin
|
|
109
107
|
* @mixes ElementMixin
|
|
110
108
|
* @mixes ThemableMixin
|
|
111
|
-
* @mixes ControllerMixin
|
|
112
109
|
*/
|
|
113
|
-
class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(
|
|
114
|
-
static get
|
|
110
|
+
class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
111
|
+
static get is() {
|
|
112
|
+
return 'vaadin-app-layout';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static get styles() {
|
|
116
|
+
return appLayoutStyles;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** @protected */
|
|
120
|
+
render() {
|
|
115
121
|
return html`
|
|
116
122
|
<div part="navbar" id="navbarTop">
|
|
117
|
-
<slot name="navbar"
|
|
123
|
+
<slot name="navbar" @slotchange="${this._updateTouchOptimizedMode}"></slot>
|
|
118
124
|
</div>
|
|
119
|
-
<div part="backdrop"
|
|
125
|
+
<div part="backdrop" @click="${this._onBackdropClick}" @touchend="${this._onBackdropTouchend}"></div>
|
|
120
126
|
<div part="drawer" id="drawer">
|
|
121
|
-
<slot name="drawer" id="drawerSlot"
|
|
127
|
+
<slot name="drawer" id="drawerSlot" @slotchange="${this._updateDrawerSize}"></slot>
|
|
122
128
|
</div>
|
|
123
129
|
<div content>
|
|
124
130
|
<slot></slot>
|
|
@@ -127,14 +133,10 @@ class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(ControllerMixi
|
|
|
127
133
|
<slot name="navbar-bottom"></slot>
|
|
128
134
|
</div>
|
|
129
135
|
<div hidden>
|
|
130
|
-
<slot id="touchSlot" name="navbar touch-optimized"
|
|
136
|
+
<slot id="touchSlot" name="navbar touch-optimized" @slotchange="${this._updateTouchOptimizedMode}"></slot>
|
|
131
137
|
</div>
|
|
132
138
|
`;
|
|
133
139
|
}
|
|
134
|
-
|
|
135
|
-
static get is() {
|
|
136
|
-
return 'vaadin-app-layout';
|
|
137
|
-
}
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
defineCustomElement(AppLayout);
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
7
|
-
import { buttonStyles } from '@vaadin/button/src/vaadin-button-
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
|
+
import { buttonStyles } from '@vaadin/button/src/vaadin-button-core-styles.js';
|
|
8
8
|
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
11
11
|
import { isEmptyTextNode } from '@vaadin/component-base/src/dom-utils.js';
|
|
12
|
-
import {
|
|
12
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
14
|
import { drawerToggle } from './vaadin-drawer-toggle-styles.js';
|
|
14
15
|
|
|
15
|
-
registerStyles('vaadin-drawer-toggle', [buttonStyles, drawerToggle], { moduleId: 'vaadin-drawer-toggle-styles' });
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* The Drawer Toggle component controls the drawer in App Layout component.
|
|
19
18
|
*
|
|
@@ -29,26 +28,22 @@ registerStyles('vaadin-drawer-toggle', [buttonStyles, drawerToggle], { moduleId:
|
|
|
29
28
|
* @mixes DirMixin
|
|
30
29
|
* @mixes ThemableMixin
|
|
31
30
|
*/
|
|
32
|
-
class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(
|
|
33
|
-
static get template() {
|
|
34
|
-
return html`
|
|
35
|
-
<slot id="slot">
|
|
36
|
-
<div part="icon"></div>
|
|
37
|
-
</slot>
|
|
38
|
-
<div part="icon" hidden$="[[!_showFallbackIcon]]"></div>
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
|
|
31
|
+
class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
42
32
|
static get is() {
|
|
43
33
|
return 'vaadin-drawer-toggle';
|
|
44
34
|
}
|
|
45
35
|
|
|
36
|
+
static get styles() {
|
|
37
|
+
return [buttonStyles, drawerToggle];
|
|
38
|
+
}
|
|
39
|
+
|
|
46
40
|
static get properties() {
|
|
47
41
|
return {
|
|
48
42
|
ariaLabel: {
|
|
49
43
|
type: String,
|
|
50
44
|
value: 'Toggle navigation panel',
|
|
51
45
|
reflectToAttribute: true,
|
|
46
|
+
sync: true,
|
|
52
47
|
},
|
|
53
48
|
|
|
54
49
|
/** @private */
|
|
@@ -67,15 +62,21 @@ class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(PolymerElement)))
|
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
64
|
|
|
65
|
+
/** @protected */
|
|
66
|
+
render() {
|
|
67
|
+
return html`
|
|
68
|
+
<slot id="slot" @slotchange="${this._toggleFallbackIcon}">
|
|
69
|
+
<div part="icon"></div>
|
|
70
|
+
</slot>
|
|
71
|
+
<div part="icon" ?hidden="${!this._showFallbackIcon}"></div>
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
|
|
70
75
|
/** @protected */
|
|
71
76
|
ready() {
|
|
72
77
|
super.ready();
|
|
73
78
|
|
|
74
79
|
this._toggleFallbackIcon();
|
|
75
|
-
|
|
76
|
-
this.$.slot.addEventListener('slotchange', () => {
|
|
77
|
-
this._toggleFallbackIcon();
|
|
78
|
-
});
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
/** @private */
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-app-layout.js';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './detect-ios-navbar.js';
|
|
7
|
-
import './safe-area-inset.js';
|
|
8
|
-
import { html, LitElement } from 'lit';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
14
|
-
import { appLayoutStyles } from './vaadin-app-layout-styles.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* LitElement based version of `<vaadin-app-layout>` web component.
|
|
18
|
-
*
|
|
19
|
-
* ## Disclaimer
|
|
20
|
-
*
|
|
21
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
22
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
23
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
24
|
-
*/
|
|
25
|
-
class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-app-layout';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return appLayoutStyles;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** @protected */
|
|
35
|
-
render() {
|
|
36
|
-
return html`
|
|
37
|
-
<div part="navbar" id="navbarTop">
|
|
38
|
-
<slot name="navbar" @slotchange="${this._updateTouchOptimizedMode}"></slot>
|
|
39
|
-
</div>
|
|
40
|
-
<div part="backdrop" @click="${this._onBackdropClick}" @touchend="${this._onBackdropTouchend}"></div>
|
|
41
|
-
<div part="drawer" id="drawer">
|
|
42
|
-
<slot name="drawer" id="drawerSlot" @slotchange="${this._updateDrawerSize}"></slot>
|
|
43
|
-
</div>
|
|
44
|
-
<div content>
|
|
45
|
-
<slot></slot>
|
|
46
|
-
</div>
|
|
47
|
-
<div part="navbar" id="navbarBottom" bottom hidden>
|
|
48
|
-
<slot name="navbar-bottom"></slot>
|
|
49
|
-
</div>
|
|
50
|
-
<div hidden>
|
|
51
|
-
<slot id="touchSlot" name="navbar touch-optimized" @slotchange="${this._updateTouchOptimizedMode}"></slot>
|
|
52
|
-
</div>
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
defineCustomElement(AppLayout);
|
|
58
|
-
|
|
59
|
-
export { AppLayout };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-drawer-toggle.js';
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { buttonStyles } from '@vaadin/button/src/vaadin-button-base.js';
|
|
8
|
-
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
11
|
-
import { isEmptyTextNode } from '@vaadin/component-base/src/dom-utils.js';
|
|
12
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
-
import { drawerToggle } from './vaadin-drawer-toggle-styles.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* LitElement based version of `<vaadin-drawer-toggle>` web component.
|
|
18
|
-
*
|
|
19
|
-
* ## Disclaimer
|
|
20
|
-
*
|
|
21
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
22
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
23
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
24
|
-
*/
|
|
25
|
-
class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-drawer-toggle';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return [buttonStyles, drawerToggle];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static get properties() {
|
|
35
|
-
return {
|
|
36
|
-
ariaLabel: {
|
|
37
|
-
type: String,
|
|
38
|
-
value: 'Toggle navigation panel',
|
|
39
|
-
reflectToAttribute: true,
|
|
40
|
-
sync: true,
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/** @private */
|
|
44
|
-
_showFallbackIcon: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
value: false,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
constructor() {
|
|
52
|
-
super();
|
|
53
|
-
|
|
54
|
-
this.addEventListener('click', () => {
|
|
55
|
-
this.dispatchEvent(new CustomEvent('drawer-toggle-click', { bubbles: true, composed: true }));
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @protected */
|
|
60
|
-
render() {
|
|
61
|
-
return html`
|
|
62
|
-
<slot id="slot" @slotchange="${this._toggleFallbackIcon}">
|
|
63
|
-
<div part="icon"></div>
|
|
64
|
-
</slot>
|
|
65
|
-
<div part="icon" ?hidden="${!this._showFallbackIcon}"></div>
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** @protected */
|
|
70
|
-
ready() {
|
|
71
|
-
super.ready();
|
|
72
|
-
|
|
73
|
-
this._toggleFallbackIcon();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** @private */
|
|
77
|
-
_toggleFallbackIcon() {
|
|
78
|
-
const nodes = this.$.slot.assignedNodes();
|
|
79
|
-
|
|
80
|
-
// Show fallback icon if there are 1-2 empty text nodes assigned to the default slot.
|
|
81
|
-
this._showFallbackIcon = nodes.length > 0 && nodes.every((node) => isEmptyTextNode(node));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
defineCustomElement(DrawerToggle);
|
|
86
|
-
|
|
87
|
-
export { DrawerToggle };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/shadow.js';
|
|
3
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
registerStyles(
|
|
7
|
-
'vaadin-app-layout',
|
|
8
|
-
css`
|
|
9
|
-
:host {
|
|
10
|
-
background-color: var(--material-background-color);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
[part='navbar'] {
|
|
14
|
-
padding: 0.25em 0.5em;
|
|
15
|
-
background: var(--vaadin-app-layout-navbar-background, var(--material-secondary-background-color));
|
|
16
|
-
box-shadow: var(--material-shadow-elevation-8dp);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part='drawer'] {
|
|
20
|
-
background: var(--material-background-color);
|
|
21
|
-
border-inline-end: 1px solid var(--material-secondary-background-color);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
:host([primary-section='drawer']) [part='drawer'] {
|
|
25
|
-
z-index: 2;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:host([primary-section='navbar']:not([overlay])) [part='navbar'] {
|
|
29
|
-
z-index: 1;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part] ::slotted(h2),
|
|
33
|
-
[part] ::slotted(h3),
|
|
34
|
-
[part] ::slotted(h4) {
|
|
35
|
-
line-height: 2.5rem;
|
|
36
|
-
margin-top: 0.25rem !important;
|
|
37
|
-
margin-bottom: 0.25rem !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[part='navbar'][bottom] {
|
|
41
|
-
padding: 0 1em;
|
|
42
|
-
box-shadow: var(--material-shadow-elevation-4dp);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media (min-width: 700px) {
|
|
46
|
-
[part='navbar'] {
|
|
47
|
-
padding: 0.5em 0.75em;
|
|
48
|
-
box-shadow: var(--material-shadow-elevation-4dp);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
{ moduleId: 'material-app-layout' },
|
|
53
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import { button } from '@vaadin/button/theme/material/vaadin-button-styles.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
const drawerToggle = css`
|
|
6
|
-
:host {
|
|
7
|
-
min-width: 0 !important;
|
|
8
|
-
width: 48px;
|
|
9
|
-
height: 48px;
|
|
10
|
-
padding: 0;
|
|
11
|
-
border-radius: 50%;
|
|
12
|
-
margin-inline-end: 1em;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[part='icon'] {
|
|
16
|
-
top: 18px;
|
|
17
|
-
left: 15px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[part='icon'],
|
|
21
|
-
[part='icon']::after,
|
|
22
|
-
[part='icon']::before {
|
|
23
|
-
background-color: currentColor;
|
|
24
|
-
height: 2px;
|
|
25
|
-
width: 18px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[part='icon']::after {
|
|
29
|
-
top: 5px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part='icon']::before {
|
|
33
|
-
top: 10px;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
registerStyles('vaadin-drawer-toggle', [button, drawerToggle], {
|
|
38
|
-
moduleId: 'material-drawer-toggle',
|
|
39
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-app-layout.js';
|
package/vaadin-lit-app-layout.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-drawer-toggle.js';
|