@vaadin/master-detail-layout 24.8.0-alpha5 → 24.8.0-alpha7

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-alpha5",
3
+ "version": "24.8.0-alpha7",
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-alpha5",
38
- "@vaadin/component-base": "24.8.0-alpha5",
39
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha5",
40
- "@vaadin/vaadin-material-styles": "24.8.0-alpha5",
41
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha5",
37
+ "@vaadin/a11y-base": "24.8.0-alpha7",
38
+ "@vaadin/component-base": "24.8.0-alpha7",
39
+ "@vaadin/vaadin-lumo-styles": "24.8.0-alpha7",
40
+ "@vaadin/vaadin-material-styles": "24.8.0-alpha7",
41
+ "@vaadin/vaadin-themable-mixin": "24.8.0-alpha7",
42
42
  "lit": "^3.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@vaadin/chai-plugins": "24.8.0-alpha5",
45
+ "@vaadin/chai-plugins": "24.8.0-alpha7",
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": "3bb64b9ad9b00ac3adb94eb1bedd81b0f4ae574e"
53
+ "gitHead": "7e65e14cbdcc372ab89620ba00e04251291d3c63"
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[transition] {
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,25 @@ 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)));
109
132
  opacity: 0;
110
133
  }
111
134
  }
@@ -121,7 +144,8 @@ export const transitionStyles = css`
121
144
  }
122
145
 
123
146
  ::view-transition-new(vaadin-master-detail-layout-overlay-vertical-detail-add) {
124
- animation: 300ms ease both 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;
125
149
  }
126
150
 
127
151
  @keyframes vaadin-master-detail-layout-overlay-vertical-detail-add {
@@ -141,7 +165,8 @@ export const transitionStyles = css`
141
165
  }
142
166
 
143
167
  ::view-transition-old(vaadin-master-detail-layout-overlay-vertical-detail-remove) {
144
- animation: 300ms ease both 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;
145
170
  }
146
171
 
147
172
  @keyframes vaadin-master-detail-layout-overlay-vertical-detail-remove {
@@ -161,11 +186,13 @@ export const transitionStyles = css`
161
186
  }
162
187
 
163
188
  ::view-transition-new(vaadin-master-detail-layout-stack-vertical-add) {
164
- animation: 300ms ease both vaadin-master-detail-layout-stack-vertical-add-new;
189
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
190
+ vaadin-master-detail-layout-stack-vertical-add-new;
165
191
  }
166
192
 
167
193
  ::view-transition-old(vaadin-master-detail-layout-stack-vertical-add) {
168
- animation: 300ms ease both vaadin-master-detail-layout-stack-vertical-add-old;
194
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
195
+ vaadin-master-detail-layout-stack-vertical-add-old;
169
196
  }
170
197
 
171
198
  @keyframes vaadin-master-detail-layout-stack-vertical-add-new {
@@ -193,11 +220,13 @@ export const transitionStyles = css`
193
220
  }
194
221
 
195
222
  ::view-transition-new(vaadin-master-detail-layout-stack-vertical-remove) {
196
- animation: 300ms ease both vaadin-master-detail-layout-stack-vertical-remove-new;
223
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
224
+ vaadin-master-detail-layout-stack-vertical-remove-new;
197
225
  }
198
226
 
199
227
  ::view-transition-old(vaadin-master-detail-layout-stack-vertical-remove) {
200
- animation: 300ms ease both vaadin-master-detail-layout-stack-vertical-remove-old;
228
+ animation: var(--vaadin-master-detail-layout-transition-duration, 300ms) ease both
229
+ vaadin-master-detail-layout-stack-vertical-remove-old;
201
230
  }
202
231
 
203
232
  @keyframes vaadin-master-detail-layout-stack-vertical-remove-new {
@@ -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
  *
@@ -114,18 +122,6 @@ declare class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ThemableMix
114
122
  * @attr {boolean} no-animation
115
123
  */
116
124
  noAnimation: boolean;
117
-
118
- /**
119
- * Sets the detail element to be displayed in the detail area and starts a
120
- * view transition that animates adding, replacing or removing the detail
121
- * area. During the view transition, the element is added to the DOM and
122
- * assigned to the `detail` slot. Any previous detail element is removed.
123
- * When passing null as the element, the current detail element is removed.
124
- *
125
- * If the browser does not support view transitions, the respective updates
126
- * are applied immediately without starting a transition.
127
- */
128
- setDetail(detail: HTMLElement | null): Promise<void>;
129
125
  }
130
126
 
131
127
  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%;
@@ -348,6 +364,7 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
348
364
  /** @protected */
349
365
  render() {
350
366
  return html`
367
+ <div part="backdrop"></div>
351
368
  <div id="master" part="master" ?inert="${this._overlay && this.containment === 'layout'}">
352
369
  <slot></slot>
353
370
  </div>
@@ -533,16 +550,19 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
533
550
  * When passing null as the element, the current detail element is removed.
534
551
  *
535
552
  * If the browser does not support view transitions, the respective updates
536
- * are applied immediately without starting a transition.
553
+ * are applied immediately without starting a transition. The transition can
554
+ * also be skipped using the `skipTransition` parameter.
537
555
  *
538
556
  * @param element the new detail element, or null to remove the current detail
557
+ * @param skipTransition whether to skip the transition
539
558
  * @returns {Promise<void>}
559
+ * @protected
540
560
  */
541
- async setDetail(element) {
561
+ _setDetail(element, skipTransition) {
542
562
  // Don't start a transition if detail didn't change
543
563
  const currentDetail = this.querySelector('[slot="detail"]');
544
564
  if ((element || null) === currentDetail) {
545
- return;
565
+ return Promise.resolve();
546
566
  }
547
567
 
548
568
  const updateSlot = () => {
@@ -555,16 +575,80 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
555
575
  }
556
576
  };
557
577
 
558
- if (typeof document.startViewTransition === 'function' && !this.noAnimation) {
559
- const hasDetail = !!currentDetail;
560
- const transitionType = hasDetail && element ? 'replace' : hasDetail ? 'remove' : 'add';
561
- this.setAttribute('transition', transitionType);
562
- const transition = document.startViewTransition(updateSlot);
563
- await transition.finished;
564
- this.removeAttribute('transition');
565
- } else {
578
+ if (skipTransition) {
566
579
  updateSlot();
580
+ return Promise.resolve();
581
+ }
582
+
583
+ const hasDetail = !!currentDetail;
584
+ const transitionType = hasDetail && element ? 'replace' : hasDetail ? 'remove' : 'add';
585
+ return this._startTransition(transitionType, () => {
586
+ // Update the DOM
587
+ updateSlot();
588
+ // Finish the transition
589
+ this._finishTransition();
590
+ });
591
+ }
592
+
593
+ /**
594
+ * Starts a view transition that animates adding, replacing or removing the
595
+ * detail area. Once the transition is ready and the browser has taken a
596
+ * snapshot of the current layout, the provided update callback is called.
597
+ * The callback should update the DOM, which can happen asynchronously.
598
+ * Once the DOM is updated, the caller must call `_finishTransition`,
599
+ * which results in the browser taking a snapshot of the new layout and
600
+ * animating the transition.
601
+ *
602
+ * If the browser does not support view transitions, or the `noAnimation`
603
+ * property is set, the update callback is called immediately without
604
+ * starting a transition.
605
+ *
606
+ * @param transitionType
607
+ * @param updateCallback
608
+ * @returns {Promise<void>}
609
+ * @protected
610
+ */
611
+ _startTransition(transitionType, updateCallback) {
612
+ const useTransition = typeof document.startViewTransition === 'function' && !this.noAnimation;
613
+ if (!useTransition) {
614
+ updateCallback();
615
+ return Promise.resolve();
616
+ }
617
+
618
+ this.setAttribute('transition', transitionType);
619
+ this.__transition = document.startViewTransition(() => {
620
+ // Return a promise that can be resolved once the DOM is updated
621
+ return new Promise((resolve) => {
622
+ this.__resolveUpdateCallback = resolve;
623
+ // Notify the caller that the transition is ready, so that they can
624
+ // update the DOM
625
+ updateCallback();
626
+ });
627
+ });
628
+ return this.__transition.finished;
629
+ }
630
+
631
+ /**
632
+ * Finishes the current view transition, if any. This method should be called
633
+ * after the DOM has been updated to finish the transition and animate the
634
+ * change in the layout.
635
+ *
636
+ * @returns {Promise<void>}
637
+ * @protected
638
+ */
639
+ async _finishTransition() {
640
+ // Detect new layout mode after DOM has been updated
641
+ this.__detectLayoutMode();
642
+
643
+ if (!this.__transition) {
644
+ return Promise.resolve();
567
645
  }
646
+ // Resolve the update callback to finish the transition
647
+ this.__resolveUpdateCallback();
648
+ await this.__transition.finished;
649
+ this.removeAttribute('transition');
650
+ this.__transition = null;
651
+ this.__resolveUpdateCallback = null;
568
652
  }
569
653
  }
570
654
 
@@ -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-alpha5",
4
+ "version": "24.8.0-alpha7",
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",
@@ -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-alpha5",
4
+ "version": "24.8.0-alpha7",
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
  {