@vaadin/master-detail-layout 24.8.0-alpha4 → 24.8.0-alpha6

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/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Vaadin Ltd.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/master-detail-layout",
3
- "version": "24.8.0-alpha4",
3
+ "version": "24.8.0-alpha6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,15 +34,15 @@
34
34
  "web-component"
35
35
  ],
36
36
  "dependencies": {
37
- "@vaadin/a11y-base": "24.8.0-alpha4",
38
- "@vaadin/component-base": "24.8.0-alpha4",
39
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha4",
40
- "@vaadin/vaadin-material-styles": "24.8.0-alpha4",
41
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha4",
37
+ "@vaadin/a11y-base": "24.8.0-alpha6",
38
+ "@vaadin/component-base": "24.8.0-alpha6",
39
+ "@vaadin/vaadin-lumo-styles": "24.8.0-alpha6",
40
+ "@vaadin/vaadin-material-styles": "24.8.0-alpha6",
41
+ "@vaadin/vaadin-themable-mixin": "24.8.0-alpha6",
42
42
  "lit": "^3.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@vaadin/chai-plugins": "24.8.0-alpha4",
45
+ "@vaadin/chai-plugins": "24.8.0-alpha6",
46
46
  "@vaadin/testing-helpers": "^1.1.0",
47
47
  "sinon": "^18.0.0"
48
48
  },
@@ -50,5 +50,5 @@
50
50
  "web-types.json",
51
51
  "web-types.lit.json"
52
52
  ],
53
- "gitHead": "88251b4c84ebb8849dde982acb62cc2b20eeec31"
53
+ "gitHead": "be9ac1686511f20dad4adf9303597c5eaa687df3"
54
54
  }
@@ -6,6 +6,23 @@
6
6
  import { css } from 'lit';
7
7
 
8
8
  export const transitionStyles = css`
9
+ html:not([dir='rtl']) {
10
+ --_vaadin-master-detail-layout-dir-multiplier: 1;
11
+ }
12
+
13
+ html[dir='rtl'] {
14
+ --_vaadin-master-detail-layout-dir-multiplier: -1;
15
+ }
16
+
17
+ /* Default cross-fade animation */
18
+ vaadin-master-detail-layout {
19
+ view-transition-name: vaadin-master-detail-layout;
20
+ }
21
+
22
+ ::view-transition-group(vaadin-master-detail-layout) {
23
+ animation-duration: var(--vaadin-master-detail-layout-transition-duration, 300ms);
24
+
25
+
9
26
  /* Overlay - horizontal - add */
10
27
 
11
28
  vaadin-master-detail-layout[overlay][orientation='horizontal'][transition='add']::part(detail) {
@@ -17,12 +34,13 @@ export const transitionStyles = css`
17
34
  }
18
35
 
19
36
  ::view-transition-new(vaadin-master-detail-layout-overlay-horizontal-detail-add) {
20
- animation: 300ms ease both vaadin-master-detail-layout-overlay-horizontal-detail-add;
37
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
38
+ vaadin-master-detail-layout-overlay-horizontal-detail-add;
21
39
  }
22
40
 
23
41
  @keyframes vaadin-master-detail-layout-overlay-horizontal-detail-add {
24
42
  from {
25
- transform: translateX(100%);
43
+ transform: translateX(calc(100% * var(--_vaadin-master-detail-layout-dir-multiplier)));
26
44
  }
27
45
  }
28
46
 
@@ -37,12 +55,13 @@ export const transitionStyles = css`
37
55
  }
38
56
 
39
57
  ::view-transition-old(vaadin-master-detail-layout-overlay-horizontal-detail-remove) {
40
- animation: 300ms ease both vaadin-master-detail-layout-overlay-horizontal-detail-remove;
58
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
59
+ vaadin-master-detail-layout-overlay-horizontal-detail-remove;
41
60
  }
42
61
 
43
62
  @keyframes vaadin-master-detail-layout-overlay-horizontal-detail-remove {
44
63
  to {
45
- transform: translateX(100%);
64
+ transform: translateX(calc(100% * var(--_vaadin-master-detail-layout-dir-multiplier)));
46
65
  }
47
66
  }
48
67
 
@@ -57,23 +76,25 @@ export const transitionStyles = css`
57
76
  }
58
77
 
59
78
  ::view-transition-new(vaadin-master-detail-layout-stack-horizontal-add) {
60
- animation: 300ms ease both vaadin-master-detail-layout-stack-horizontal-add-new;
79
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
80
+ vaadin-master-detail-layout-stack-horizontal-add-new;
61
81
  }
62
82
 
63
83
  ::view-transition-old(vaadin-master-detail-layout-stack-horizontal-add) {
64
- animation: 300ms ease both vaadin-master-detail-layout-stack-horizontal-add-old;
84
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
85
+ vaadin-master-detail-layout-stack-horizontal-add-old;
65
86
  }
66
87
 
67
88
  @keyframes vaadin-master-detail-layout-stack-horizontal-add-new {
68
89
  from {
69
- transform: translateX(100px);
90
+ transform: translateX(calc(100px * var(--_vaadin-master-detail-layout-dir-multiplier)));
70
91
  opacity: 0;
71
92
  }
72
93
  }
73
94
 
74
95
  @keyframes vaadin-master-detail-layout-stack-horizontal-add-old {
75
96
  to {
76
- transform: translateX(-100px);
97
+ transform: translateX(calc(-100px * var(--_vaadin-master-detail-layout-dir-multiplier)));
77
98
  opacity: 0;
78
99
  }
79
100
  }
@@ -89,23 +110,135 @@ export const transitionStyles = css`
89
110
  }
90
111
 
91
112
  ::view-transition-new(vaadin-master-detail-layout-stack-horizontal-remove) {
92
- animation: 300ms ease both vaadin-master-detail-layout-stack-horizontal-remove-new;
113
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
114
+ vaadin-master-detail-layout-stack-horizontal-remove-new;
93
115
  }
94
116
 
95
117
  ::view-transition-old(vaadin-master-detail-layout-stack-horizontal-remove) {
96
- animation: 300ms ease both vaadin-master-detail-layout-stack-horizontal-remove-old;
118
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
119
+ vaadin-master-detail-layout-stack-horizontal-remove-old;
97
120
  }
98
121
 
99
122
  @keyframes vaadin-master-detail-layout-stack-horizontal-remove-new {
100
123
  from {
101
- transform: translateX(-100px);
124
+ transform: translateX(calc(-100px * var(--_vaadin-master-detail-layout-dir-multiplier)));
102
125
  opacity: 0;
103
126
  }
104
127
  }
105
128
 
106
129
  @keyframes vaadin-master-detail-layout-stack-horizontal-remove-old {
107
130
  to {
108
- transform: translateX(100px);
131
+ transform: translateX(calc(100px * var(--_vaadin-master-detail-layout-dir-multiplier)));
132
+ opacity: 0;
133
+ }
134
+ }
135
+
136
+ /* Overlay - vertical - add */
137
+
138
+ vaadin-master-detail-layout[overlay][orientation='vertical'][transition='add']::part(detail) {
139
+ view-transition-name: vaadin-master-detail-layout-overlay-vertical-detail-add;
140
+ }
141
+
142
+ ::view-transition-group(vaadin-master-detail-layout-overlay-vertical-detail-add) {
143
+ clip-path: inset(0);
144
+ }
145
+
146
+ ::view-transition-new(vaadin-master-detail-layout-overlay-vertical-detail-add) {
147
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
148
+ vaadin-master-detail-layout-overlay-vertical-detail-add;
149
+ }
150
+
151
+ @keyframes vaadin-master-detail-layout-overlay-vertical-detail-add {
152
+ from {
153
+ transform: translateY(100%);
154
+ }
155
+ }
156
+
157
+ /* Overlay - vertical - remove */
158
+
159
+ vaadin-master-detail-layout[overlay][orientation='vertical'][transition='remove']::part(detail) {
160
+ view-transition-name: vaadin-master-detail-layout-overlay-vertical-detail-remove;
161
+ }
162
+
163
+ ::view-transition-group(vaadin-master-detail-layout-overlay-vertical-detail-remove) {
164
+ clip-path: inset(0);
165
+ }
166
+
167
+ ::view-transition-old(vaadin-master-detail-layout-overlay-vertical-detail-remove) {
168
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
169
+ vaadin-master-detail-layout-overlay-vertical-detail-remove;
170
+ }
171
+
172
+ @keyframes vaadin-master-detail-layout-overlay-vertical-detail-remove {
173
+ to {
174
+ transform: translateY(100%);
175
+ }
176
+ }
177
+
178
+ /* Stack - vertical - add */
179
+
180
+ vaadin-master-detail-layout[stack][orientation='vertical'][transition='add'] {
181
+ view-transition-name: vaadin-master-detail-layout-stack-vertical-add;
182
+ }
183
+
184
+ ::view-transition-group(vaadin-master-detail-layout-stack-vertical-add) {
185
+ clip-path: inset(0);
186
+ }
187
+
188
+ ::view-transition-new(vaadin-master-detail-layout-stack-vertical-add) {
189
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
190
+ vaadin-master-detail-layout-stack-vertical-add-new;
191
+ }
192
+
193
+ ::view-transition-old(vaadin-master-detail-layout-stack-vertical-add) {
194
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
195
+ vaadin-master-detail-layout-stack-vertical-add-old;
196
+ }
197
+
198
+ @keyframes vaadin-master-detail-layout-stack-vertical-add-new {
199
+ from {
200
+ transform: translateY(100px);
201
+ opacity: 0;
202
+ }
203
+ }
204
+
205
+ @keyframes vaadin-master-detail-layout-stack-vertical-add-old {
206
+ to {
207
+ transform: translateY(-100px);
208
+ opacity: 0;
209
+ }
210
+ }
211
+
212
+ /* Stack - vertical - remove */
213
+
214
+ vaadin-master-detail-layout[stack][orientation='vertical'][transition='remove'] {
215
+ view-transition-name: vaadin-master-detail-layout-stack-vertical-remove;
216
+ }
217
+
218
+ ::view-transition-group(vaadin-master-detail-layout-stack-vertical-remove) {
219
+ clip-path: inset(0);
220
+ }
221
+
222
+ ::view-transition-new(vaadin-master-detail-layout-stack-vertical-remove) {
223
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
224
+ vaadin-master-detail-layout-stack-vertical-remove-new;
225
+ }
226
+
227
+ ::view-transition-old(vaadin-master-detail-layout-stack-vertical-remove) {
228
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
229
+ vaadin-master-detail-layout-stack-vertical-remove-old;
230
+ }
231
+
232
+ @keyframes vaadin-master-detail-layout-stack-vertical-remove-new {
233
+ from {
234
+ transform: translateY(-100px);
235
+ opacity: 0;
236
+ }
237
+ }
238
+
239
+ @keyframes vaadin-master-detail-layout-stack-vertical-remove-old {
240
+ to {
241
+ transform: translateY(100px);
109
242
  opacity: 0;
110
243
  }
111
244
  }
@@ -15,10 +15,18 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
15
15
  *
16
16
  * ### Styling
17
17
  *
18
+ * The following custom CSS property are available for styling (needed to be set
19
+ * on the `<html>` element since they are used by the global view transitions):
20
+ *
21
+ * Custom CSS property | Description | Default
22
+ * -----------------------------------------------------|---------------------|--------
23
+ * `--vaadin-master-detail-layout-transition-duration` | Transition duration | 300ms
24
+ *
18
25
  * The following shadow DOM parts are available for styling:
19
26
  *
20
27
  * Part name | Description
21
28
  * ---------------|----------------------
29
+ * `backdrop` | Backdrop covering the master area in the overlay mode
22
30
  * `master` | The master area
23
31
  * `detail` | The detail area
24
32
  *
@@ -108,6 +116,13 @@ declare class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ThemableMix
108
116
  */
109
117
  stackThreshold: string | null | undefined;
110
118
 
119
+ /**
120
+ * When true, the layout does not use animated transitions for the detail area.
121
+ *
122
+ * @attr {boolean} no-animation
123
+ */
124
+ noAnimation: boolean;
125
+
111
126
  /**
112
127
  * Sets the detail element to be displayed in the detail area and starts a
113
128
  * view transition that animates adding, replacing or removing the detail
@@ -118,7 +133,7 @@ declare class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ThemableMix
118
133
  * If the browser does not support view transitions, the respective updates
119
134
  * are applied immediately without starting a transition.
120
135
  */
121
- setDetail(detail: HTMLElement | null): Promise<void>;
136
+ protected _setDetail(detail: HTMLElement | null): Promise<void>;
122
137
  }
123
138
 
124
139
  declare global {
@@ -20,10 +20,18 @@ import { transitionStyles } from './vaadin-master-detail-layout-transition-style
20
20
  *
21
21
  * ### Styling
22
22
  *
23
+ * The following custom CSS properties are available for styling (needed to be set
24
+ * on the `<html>` element since they are used by the global view transitions):
25
+ *
26
+ * Custom CSS property | Description | Default
27
+ * -----------------------------------------------------|---------------------|--------
28
+ * `--vaadin-master-detail-layout-transition-duration` | Transition duration | 300ms
29
+ *
23
30
  * The following shadow DOM parts are available for styling:
24
31
  *
25
32
  * Part name | Description
26
33
  * ---------------|----------------------
34
+ * `backdrop` | Backdrop covering the master area in the overlay mode
27
35
  * `master` | The master area
28
36
  * `detail` | The detail area
29
37
  *
@@ -63,7 +71,8 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
63
71
  display: none !important;
64
72
  }
65
73
 
66
- :host(:not([has-detail])) [part='detail'] {
74
+ :host(:not([has-detail])) [part='detail'],
75
+ [part='backdrop'] {
67
76
  display: none;
68
77
  }
69
78
 
@@ -72,14 +81,21 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
72
81
  position: relative;
73
82
  }
74
83
 
75
- :host(:is([overlay], [stack])[containment='layout']) [part='detail'] {
84
+ :host(:is([overlay], [stack])[containment='layout']) [part='detail'],
85
+ :host([overlay][containment='layout']) [part='backdrop'] {
76
86
  position: absolute;
77
87
  }
78
88
 
79
- :host(:is([overlay], [stack])[containment='viewport']) [part='detail'] {
89
+ :host(:is([overlay], [stack])[containment='viewport']) [part='detail'],
90
+ :host([overlay][containment='viewport']) [part='backdrop'] {
80
91
  position: fixed;
81
92
  }
82
93
 
94
+ :host([overlay][has-detail]) [part='backdrop'] {
95
+ display: block;
96
+ inset: 0;
97
+ }
98
+
83
99
  :host([overlay][orientation='horizontal']) [part='detail'] {
84
100
  inset-inline-end: 0;
85
101
  height: 100%;
@@ -304,6 +320,16 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
304
320
  sync: true,
305
321
  },
306
322
 
323
+ /**
324
+ * When true, the layout does not use animated transitions for the detail area.
325
+ *
326
+ * @attr {boolean} no-animation
327
+ */
328
+ noAnimation: {
329
+ type: Boolean,
330
+ value: false,
331
+ },
332
+
307
333
  /**
308
334
  * When true, the component uses the overlay mode. This property is read-only.
309
335
  * In order to enforce the overlay mode, use `forceOverlay` property.
@@ -338,6 +364,7 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
338
364
  /** @protected */
339
365
  render() {
340
366
  return html`
367
+ <div part="backdrop"></div>
341
368
  <div id="master" part="master" ?inert="${this._overlay && this.containment === 'layout'}">
342
369
  <slot></slot>
343
370
  </div>
@@ -527,15 +554,18 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
527
554
  *
528
555
  * @param element the new detail element, or null to remove the current detail
529
556
  * @returns {Promise<void>}
557
+ * @protected
530
558
  */
531
- async setDetail(element) {
559
+ _setDetail(element) {
532
560
  // Don't start a transition if detail didn't change
533
561
  const currentDetail = this.querySelector('[slot="detail"]');
534
562
  if ((element || null) === currentDetail) {
535
563
  return;
536
564
  }
537
565
 
538
- const updateSlot = () => {
566
+ const hasDetail = !!currentDetail;
567
+ const transitionType = hasDetail && element ? 'replace' : hasDetail ? 'remove' : 'add';
568
+ return this._startTransition(transitionType, () => {
539
569
  // Remove old content
540
570
  this.querySelectorAll('[slot="detail"]').forEach((oldElement) => oldElement.remove());
541
571
  // Add new content
@@ -543,18 +573,70 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
543
573
  element.setAttribute('slot', 'detail');
544
574
  this.appendChild(element);
545
575
  }
546
- };
576
+ // Finish the transition
577
+ this._finishTransition();
578
+ });
579
+ }
547
580
 
548
- if (typeof document.startViewTransition === 'function') {
549
- const hasDetail = !!currentDetail;
550
- const transitionType = hasDetail && element ? 'replace' : hasDetail ? 'remove' : 'add';
551
- this.setAttribute('transition', transitionType);
552
- const transition = document.startViewTransition(updateSlot);
553
- await transition.finished;
554
- this.removeAttribute('transition');
555
- } else {
556
- updateSlot();
581
+ /**
582
+ * Starts a view transition that animates adding, replacing or removing the
583
+ * detail area. Once the transition is ready and the browser has taken a
584
+ * snapshot of the current layout, the provided update callback is called.
585
+ * The callback should update the DOM, which can happen asynchronously.
586
+ * Once the DOM is updated, the caller must call `_finishTransition`,
587
+ * which results in the browser taking a snapshot of the new layout and
588
+ * animating the transition.
589
+ *
590
+ * If the browser does not support view transitions, or the `noAnimation`
591
+ * property is set, the update callback is called immediately without
592
+ * starting a transition.
593
+ *
594
+ * @param transitionType
595
+ * @param updateCallback
596
+ * @returns {Promise<void>}
597
+ * @protected
598
+ */
599
+ _startTransition(transitionType, updateCallback) {
600
+ const useTransition = typeof document.startViewTransition === 'function' && !this.noAnimation;
601
+ if (!useTransition) {
602
+ updateCallback();
603
+ return Promise.resolve();
604
+ }
605
+
606
+ this.setAttribute('transition', transitionType);
607
+ this.__transition = document.startViewTransition(() => {
608
+ // Return a promise that can be resolved once the DOM is updated
609
+ return new Promise((resolve) => {
610
+ this.__resolveUpdateCallback = resolve;
611
+ // Notify the caller that the transition is ready, so that they can
612
+ // update the DOM
613
+ updateCallback();
614
+ });
615
+ });
616
+ return this.__transition.finished;
617
+ }
618
+
619
+ /**
620
+ * Finishes the current view transition, if any. This method should be called
621
+ * after the DOM has been updated to finish the transition and animate the
622
+ * change in the layout.
623
+ *
624
+ * @returns {Promise<void>}
625
+ * @protected
626
+ */
627
+ async _finishTransition() {
628
+ // Detect new layout mode after DOM has been updated
629
+ this.__detectLayoutMode();
630
+
631
+ if (!this.__transition) {
632
+ return Promise.resolve();
557
633
  }
634
+ // Resolve the update callback to finish the transition
635
+ this.__resolveUpdateCallback();
636
+ await this.__transition.finished;
637
+ this.removeAttribute('transition');
638
+ this.__transition = null;
639
+ this.__resolveUpdateCallback = null;
558
640
  }
559
641
  }
560
642
 
@@ -0,0 +1 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
@@ -0,0 +1,28 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
+
4
+ registerStyles(
5
+ 'vaadin-master-detail-layout',
6
+ css`
7
+ :host(:is([overlay], [stack])) [part='detail'] {
8
+ background-color: var(--lumo-base-color);
9
+ }
10
+
11
+ :host([overlay]) [part='detail'] {
12
+ box-shadow: var(--lumo-box-shadow-s);
13
+ }
14
+
15
+ :host([overlay][orientation='horizontal']) [part='detail'] {
16
+ border-inline-start: 1px solid var(--lumo-contrast-10pct);
17
+ }
18
+
19
+ :host([overlay][orientation='vertical']) [part='detail'] {
20
+ border-block-start: 1px solid var(--lumo-contrast-10pct);
21
+ }
22
+
23
+ :host([overlay]) [part='backdrop'] {
24
+ background-color: var(--lumo-shade-20pct);
25
+ }
26
+ `,
27
+ { moduleId: 'lumo-master-detail-layout' },
28
+ );
@@ -1 +1,2 @@
1
+ import './vaadin-master-detail-layout-styles.js';
1
2
  import '../../src/vaadin-master-detail-layout.js';
@@ -1 +1,2 @@
1
+ import './vaadin-master-detail-layout-styles.js';
1
2
  import '../../src/vaadin-master-detail-layout.js';
@@ -0,0 +1,2 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/style.js';
@@ -0,0 +1,30 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/style.js';
3
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
+
5
+ registerStyles(
6
+ 'vaadin-master-detail-layout',
7
+ css`
8
+ :host(:is([overlay], [stack])) [part='detail'] {
9
+ background-color: var(--material-background-color);
10
+ }
11
+
12
+ :host([overlay]) [part='detail'] {
13
+ box-shadow: var(--material-shadow-elevation-4dp);
14
+ }
15
+
16
+ :host([overlay][orientation='horizontal']) [part='detail'] {
17
+ border-inline-start: 1px solid var(--material-divider-color);
18
+ }
19
+
20
+ :host([overlay][orientation='vertical']) [part='detail'] {
21
+ border-block-start: 1px solid var(--material-divider-color);
22
+ }
23
+
24
+ :host([overlay]) [part='backdrop'] {
25
+ background-color: var(--material-secondary-background-color);
26
+ opacity: 0.5;
27
+ }
28
+ `,
29
+ { moduleId: 'material-master-detail-layout' },
30
+ );
@@ -1 +1,2 @@
1
+ import './vaadin-master-detail-layout-styles.js';
1
2
  import '../../src/vaadin-master-detail-layout.js';
@@ -1 +1,2 @@
1
+ import './vaadin-master-detail-layout-styles.js';
1
2
  import '../../src/vaadin-master-detail-layout.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/master-detail-layout",
4
- "version": "24.8.0-alpha4",
4
+ "version": "24.8.0-alpha6",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-master-detail-layout",
11
- "description": "`<vaadin-master-detail-layout>` is a web component for building UIs with a master\n(or primary) area and a detail (or secondary) area that is displayed next to, or\noverlaid on top of, the master area, depending on configuration and viewport size.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|----------------------\n`master` | The master area\n`detail` | The detail area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------| -----------\n`containment` | Set to `layout` or `viewport` depending on the containment.\n`orientation` | Set to `horizontal` or `vertical` depending on the orientation.\n`has-detail` | Set when the detail content is provided.\n`overlay` | Set when the layout is using the overlay mode.\n`stack` | Set when the layout is using the stack mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-master-detail-layout>` is a web component for building UIs with a master\n(or primary) area and a detail (or secondary) area that is displayed next to, or\noverlaid on top of, the master area, depending on configuration and viewport size.\n\n### Styling\n\nThe following custom CSS properties are available for styling (needed to be set\non the `<html>` element since they are used by the global view transitions):\n\nCustom CSS property | Description | Default\n-----------------------------------------------------|---------------------|--------\n`--vaadin-master-detail-layout-transition-duration` | Transition duration | 300ms\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|----------------------\n`backdrop` | Backdrop covering the master area in the overlay mode\n`master` | The master area\n`detail` | The detail area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------| -----------\n`containment` | Set to `layout` or `viewport` depending on the containment.\n`orientation` | Set to `horizontal` or `vertical` depending on the orientation.\n`has-detail` | Set when the detail content is provided.\n`overlay` | Set when the layout is using the overlay mode.\n`stack` | Set when the layout is using the stack mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "detail-size",
@@ -98,6 +98,17 @@
98
98
  ]
99
99
  }
100
100
  },
101
+ {
102
+ "name": "no-animation",
103
+ "description": "When true, the layout does not use animated transitions for the detail area.",
104
+ "value": {
105
+ "type": [
106
+ "boolean",
107
+ "null",
108
+ "undefined"
109
+ ]
110
+ }
111
+ },
101
112
  {
102
113
  "name": "theme",
103
114
  "description": "The theme variants to apply to the component.",
@@ -199,6 +210,17 @@
199
210
  "undefined"
200
211
  ]
201
212
  }
213
+ },
214
+ {
215
+ "name": "noAnimation",
216
+ "description": "When true, the layout does not use animated transitions for the detail area.",
217
+ "value": {
218
+ "type": [
219
+ "boolean",
220
+ "null",
221
+ "undefined"
222
+ ]
223
+ }
202
224
  }
203
225
  ],
204
226
  "events": []
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/master-detail-layout",
4
- "version": "24.8.0-alpha4",
4
+ "version": "24.8.0-alpha6",
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-master-detail-layout",
19
- "description": "`<vaadin-master-detail-layout>` is a web component for building UIs with a master\n(or primary) area and a detail (or secondary) area that is displayed next to, or\noverlaid on top of, the master area, depending on configuration and viewport size.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|----------------------\n`master` | The master area\n`detail` | The detail area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------| -----------\n`containment` | Set to `layout` or `viewport` depending on the containment.\n`orientation` | Set to `horizontal` or `vertical` depending on the orientation.\n`has-detail` | Set when the detail content is provided.\n`overlay` | Set when the layout is using the overlay mode.\n`stack` | Set when the layout is using the stack mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-master-detail-layout>` is a web component for building UIs with a master\n(or primary) area and a detail (or secondary) area that is displayed next to, or\noverlaid on top of, the master area, depending on configuration and viewport size.\n\n### Styling\n\nThe following custom CSS properties are available for styling (needed to be set\non the `<html>` element since they are used by the global view transitions):\n\nCustom CSS property | Description | Default\n-----------------------------------------------------|---------------------|--------\n`--vaadin-master-detail-layout-transition-duration` | Transition duration | 300ms\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|----------------------\n`backdrop` | Backdrop covering the master area in the overlay mode\n`master` | The master area\n`detail` | The detail area\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------| -----------\n`containment` | Set to `layout` or `viewport` depending on the containment.\n`orientation` | Set to `horizontal` or `vertical` depending on the orientation.\n`has-detail` | Set when the detail content is provided.\n`overlay` | Set when the layout is using the overlay mode.\n`stack` | Set when the layout is using the stack mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -26,6 +26,13 @@
26
26
  "kind": "expression"
27
27
  }
28
28
  },
29
+ {
30
+ "name": "?noAnimation",
31
+ "description": "When true, the layout does not use animated transitions for the detail area.",
32
+ "value": {
33
+ "kind": "expression"
34
+ }
35
+ },
29
36
  {
30
37
  "name": ".detailSize",
31
38
  "description": "Fixed size (in CSS length units) to be set on the detail area.\nWhen specified, it prevents the detail area from growing or\nshrinking. If there is not enough space to show master and detail\nareas next to each other, the layout switches to the overlay mode.",