Skip to content

Commit 2fc3983

Browse files
authored
refactor: rename #outgoing to #detailOutgoing for consistency (#11475)
1 parent 57abb69 commit 2fc3983

5 files changed

Lines changed: 41 additions & 41 deletions

File tree

packages/master-detail-layout/ARCHITECTURE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ The `detail-placeholder` slot shows content in the detail area when no detail is
108108
Visible only when a placeholder element is slotted, no detail is present, and there is no overlay. Uses `visibility: hidden/visible` (not `display: none/block`) so it always participates in grid sizing:
109109

110110
```css
111-
#detail-placeholder {
111+
#detailPlaceholder {
112112
visibility: hidden;
113113
}
114114

115-
:host([has-detail-placeholder]:not([has-detail], [overlay])) #detail-placeholder {
115+
:host([has-detail-placeholder]:not([has-detail], [overlay])) #detailPlaceholder {
116116
visibility: visible;
117117
}
118118
```
@@ -185,17 +185,17 @@ Each animation is tagged with a shared ID. When a new transition starts, the run
185185
### Z-index layering
186186

187187
```
188-
z-index: 1 — #detail-placeholder
188+
z-index: 1 — #detailPlaceholder
189189
z-index: 2 — #backdrop
190-
z-index: 3 — #outgoing (always position: absolute)
190+
z-index: 3 — #detailOutgoing (always position: absolute)
191191
z-index: 4 — #detail
192192
```
193193

194-
`#detail` above `#outgoing` is correct: split-mode replace has 0ms duration (no frames painted, z-order irrelevant), and overlay-mode replace has the incoming sliding over the outgoing.
194+
`#detail` above `#detailOutgoing` is correct: split-mode replace has 0ms duration (no frames painted, z-order irrelevant), and overlay-mode replace has the incoming sliding over the outgoing.
195195

196-
### Outgoing container
196+
### Detail outgoing container
197197

198-
The `#outgoing` shadow DOM element with `<slot name="detail-outgoing">` enables replace animations. Old content is moved to this slot (light DOM reassignment preserves user styles), animated out, then removed on completion. During replace, the outgoing width is frozen to `__detailCachedSize` so it retains the previous detail's dimensions even when the new detail has a different intrinsic size.
198+
The `#detailOutgoing` shadow DOM element with `<slot name="detail-outgoing">` enables replace animations. Old content is moved to this slot (light DOM reassignment preserves user styles), animated out, then removed on completion. During replace, the outgoing width is frozen to `__detailCachedSize` so it retains the previous detail's dimensions even when the new detail has a different intrinsic size.
199199

200200
## Test Patterns
201201

packages/master-detail-layout/src/styles/vaadin-master-detail-layout-base-styles.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ export const masterDetailLayoutStyles = css`
5151
[detail-end];
5252
}
5353
54-
:is(#master, #detail, #detail-placeholder, #outgoing) {
54+
:is(#master, #detail, #detailPlaceholder, #detailOutgoing) {
5555
box-sizing: border-box;
5656
}
5757
58-
#detail-placeholder {
58+
#detailPlaceholder {
5959
z-index: 1;
6060
opacity: 0;
6161
pointer-events: none;
6262
}
6363
64-
:host([has-detail-placeholder]:not([has-detail], [overlay])) #detail-placeholder {
64+
:host([has-detail-placeholder]:not([has-detail], [overlay])) #detailPlaceholder {
6565
opacity: 1;
6666
pointer-events: auto;
6767
}
@@ -78,7 +78,7 @@ export const masterDetailLayoutStyles = css`
7878
pointer-events: auto;
7979
}
8080
81-
:is(#detail, #detail-placeholder, #outgoing) {
81+
:is(#detail, #detailPlaceholder, #detailOutgoing) {
8282
grid-column: detail-start / detail-end;
8383
grid-row: 1;
8484
}
@@ -88,7 +88,7 @@ export const masterDetailLayoutStyles = css`
8888
grid-row: master-start / detail-start;
8989
}
9090
91-
:host([orientation='vertical']) :is(#detail, #detail-placeholder, #outgoing) {
91+
:host([orientation='vertical']) :is(#detail, #detailPlaceholder, #detailOutgoing) {
9292
grid-column: 1;
9393
grid-row: detail-start / detail-end;
9494
}
@@ -125,19 +125,19 @@ export const masterDetailLayoutStyles = css`
125125
--_master-extra: calc(100% - var(--_master-size));
126126
}
127127
128-
:host([orientation='horizontal']) #detail-placeholder,
128+
:host([orientation='horizontal']) #detailPlaceholder,
129129
:host([orientation='horizontal']:not([overlay])) #detail {
130130
border-inline-start: var(--vaadin-master-detail-layout-border-width, 1px) solid
131131
var(--vaadin-master-detail-layout-border-color, var(--vaadin-border-color-secondary));
132132
}
133133
134-
:host([orientation='vertical']) #detail-placeholder,
134+
:host([orientation='vertical']) #detailPlaceholder,
135135
:host([orientation='vertical']:not([overlay])) #detail {
136136
border-top: var(--vaadin-master-detail-layout-border-width, 1px) solid
137137
var(--vaadin-master-detail-layout-border-color, var(--vaadin-border-color-secondary));
138138
}
139139
140-
#outgoing {
140+
#detailOutgoing {
141141
position: absolute;
142142
z-index: 3;
143143
}
@@ -162,7 +162,7 @@ export const masterDetailLayoutStyles = css`
162162
--_transition-offset: 0 calc(100% + 30px);
163163
}
164164
165-
:host([has-detail][overlay]) :is(#detail, #outgoing) {
165+
:host([has-detail][overlay]) :is(#detail, #detailOutgoing) {
166166
position: absolute;
167167
background: var(--vaadin-master-detail-layout-detail-background, var(--vaadin-background-color));
168168
box-shadow: var(--vaadin-master-detail-layout-detail-shadow, 0 0 20px 0 rgba(0, 0, 0, 0.3));
@@ -175,30 +175,30 @@ export const masterDetailLayoutStyles = css`
175175
pointer-events: auto;
176176
}
177177
178-
:host([has-detail][overlay]:not([orientation='vertical'])) :is(#detail, #outgoing) {
178+
:host([has-detail][overlay]:not([orientation='vertical'])) :is(#detail, #detailOutgoing) {
179179
inset-block: 0;
180180
inset-inline-end: 0;
181181
width: var(--_overlay-size, var(--_detail-size));
182182
max-width: 100%;
183183
}
184184
185-
:host([has-detail][overlay][orientation='vertical']) :is(#detail, #outgoing) {
185+
:host([has-detail][overlay][orientation='vertical']) :is(#detail, #detailOutgoing) {
186186
inset-inline: 0;
187187
inset-block-end: 0;
188188
height: var(--_overlay-size, var(--_detail-size));
189189
max-height: 100%;
190190
}
191191
192-
:host([has-detail][overlay][overlay-containment='viewport']) :is(#detail, #outgoing, #backdrop) {
192+
:host([has-detail][overlay][overlay-containment='viewport']) :is(#detail, #detailOutgoing, #backdrop) {
193193
position: fixed;
194194
}
195195
196196
@media (forced-colors: active) {
197-
:host([has-detail][overlay]) :is(#detail, #outgoing) {
197+
:host([has-detail][overlay]) :is(#detail, #detailOutgoing) {
198198
outline: 3px solid !important;
199199
}
200200
201-
:is(#detail, #detail-placeholder, #outgoing) {
201+
:is(#detail, #detailPlaceholder, #detailOutgoing) {
202202
background: Canvas !important;
203203
}
204204
}

packages/master-detail-layout/src/vaadin-master-detail-layout.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
232232
<div id="master" part="master" ?inert="${isLayoutContained}">
233233
<slot @slotchange="${this.__onSlotChange}"></slot>
234234
</div>
235-
<div id="outgoing" inert ?hidden="${!this.__replacing}">
235+
<div id="detailOutgoing" inert ?hidden="${!this.__replacing}">
236236
<slot name="detail-outgoing"></slot>
237237
</div>
238238
<div
@@ -244,7 +244,7 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
244244
>
245245
<slot name="detail" @slotchange="${this.__onSlotChange}"></slot>
246246
</div>
247-
<div id="detail-placeholder" part="detail-placeholder">
247+
<div id="detailPlaceholder" part="detail-placeholder">
248248
<slot name="detail-placeholder" @slotchange="${this.__onSlotChange}"></slot>
249249
</div>
250250
`;
@@ -599,17 +599,17 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
599599
/** @private */
600600
async __replaceTransition(updateSlot) {
601601
try {
602-
this.__snapshotOutgoing();
602+
this.__snapshotDetailOutgoing();
603603

604604
await updateSlot();
605605

606606
const progress = getCurrentAnimationProgress(this.$.detail);
607607
await Promise.all([
608608
animateIn(this.$.detail, ['fade', 'slide'], progress),
609-
animateOut(this.$.outgoing, ['fade', 'slide'], progress),
609+
animateOut(this.$.detailOutgoing, ['fade', 'slide'], progress),
610610
]);
611611
} finally {
612-
this.__clearOutgoing();
612+
this.__clearDetailOutgoing();
613613
}
614614
}
615615

@@ -630,23 +630,23 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
630630
* light DOM so light DOM styles continue to apply.
631631
* @private
632632
*/
633-
__snapshotOutgoing() {
633+
__snapshotDetailOutgoing() {
634634
const currentDetail = this.querySelector('[slot="detail"]');
635635
if (!currentDetail) {
636636
return;
637637
}
638638
currentDetail.setAttribute('slot', 'detail-outgoing');
639-
this.$.outgoing.style.width = this.__detailCachedSize;
639+
this.$.detailOutgoing.style.width = this.__detailCachedSize;
640640
this.__replacing = true;
641641
}
642642

643643
/**
644644
* Clears the outgoing container after the replace transition completes.
645645
* @private
646646
*/
647-
__clearOutgoing() {
647+
__clearDetailOutgoing() {
648648
this.querySelectorAll('[slot="detail-outgoing"]').forEach((el) => el.remove());
649-
this.$.outgoing.style.width = '';
649+
this.$.detailOutgoing.style.width = '';
650650
this.__replacing = false;
651651
}
652652

packages/master-detail-layout/test/dom/__snapshots__/master-detail-layout.test.snap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ snapshots["vaadin-master-detail-layout shadow default"] =
7575
</div>
7676
<div
7777
hidden=""
78-
id="outgoing"
78+
id="detailOutgoing"
7979
inert=""
8080
>
8181
<slot name="detail-outgoing">
@@ -89,7 +89,7 @@ snapshots["vaadin-master-detail-layout shadow default"] =
8989
</slot>
9090
</div>
9191
<div
92-
id="detail-placeholder"
92+
id="detailPlaceholder"
9393
part="detail-placeholder"
9494
>
9595
<slot name="detail-placeholder">

packages/master-detail-layout/test/transitions.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ describe('Transitions', () => {
252252
const detailTranslateAfter = parseFloat(getComputedStyle(layout.$.detail).translate);
253253
expect(detailTranslateAfter).to.be.greaterThan(0).and.lessThan(detailTranslate);
254254

255-
const outgoingTranslateAfter = parseFloat(getComputedStyle(layout.$.outgoing).translate);
256-
expect(outgoingTranslateAfter).to.be.greaterThan(detailTranslate).and.lessThan(200);
255+
const detailOutgoingTranslateAfter = parseFloat(getComputedStyle(layout.$.detailOutgoing).translate);
256+
expect(detailOutgoingTranslateAfter).to.be.greaterThan(detailTranslate).and.lessThan(200);
257257
});
258258

259259
it('should complete transition immediately when no animation is running', async () => {
@@ -364,8 +364,8 @@ describe('Transitions', () => {
364364
const replacePromise = layout._setDetail(newDetail);
365365

366366
// During replace, old content should be in the outgoing slot
367-
const outgoing = layout.shadowRoot.querySelector('#outgoing');
368-
expect(outgoing.hasAttribute('hidden')).to.be.false;
367+
const detailOutgoing = layout.shadowRoot.querySelector('#detailOutgoing');
368+
expect(detailOutgoing.hasAttribute('hidden')).to.be.false;
369369
expect(detail.getAttribute('slot')).to.equal('detail-outgoing');
370370

371371
// New content should be in the detail slot
@@ -375,7 +375,7 @@ describe('Transitions', () => {
375375
await replacePromise;
376376

377377
// After transition, outgoing should be cleared and old element removed
378-
expect(outgoing.hasAttribute('hidden')).to.be.true;
378+
expect(detailOutgoing.hasAttribute('hidden')).to.be.true;
379379
expect(layout.querySelector('[slot="detail-outgoing"]')).to.be.null;
380380
});
381381

@@ -390,16 +390,16 @@ describe('Transitions', () => {
390390
detailContent = document.createElement('detail-content');
391391
detailContent.style.width = '400px';
392392
replacePromise = layout._setDetail(detailContent);
393-
expect(layout.$.outgoing.style.width).to.equal('201px'); // 1px border
393+
expect(layout.$.detailOutgoing.style.width).to.equal('201px'); // 1px border
394394
await replacePromise;
395-
expect(layout.$.outgoing.style.width).to.equal('');
395+
expect(layout.$.detailOutgoing.style.width).to.equal('');
396396

397397
detailContent = document.createElement('detail-content');
398398
detailContent.style.width = '200px';
399399
replacePromise = layout._setDetail(detailContent);
400-
expect(layout.$.outgoing.style.width).to.equal('401px'); // 1px border
400+
expect(layout.$.detailOutgoing.style.width).to.equal('401px'); // 1px border
401401
await replacePromise;
402-
expect(layout.$.outgoing.style.width).to.equal('');
402+
expect(layout.$.detailOutgoing.style.width).to.equal('');
403403
});
404404

405405
it('should adjust detail size after replacing with a differently sized detail', async () => {

0 commit comments

Comments
 (0)