@@ -149,13 +149,19 @@ export class Dialog extends HTMLElement {
149149 // still close the dialog.
150150 #onKeyDownBound = this . #onKeyDown. bind ( this ) ;
151151
152+ /**
153+ * @deprecated
154+ */
152155 get showConnector ( ) : boolean {
156+ console . assert ( this . #props. showConnector === false ) ;
153157 return this . #props. showConnector ;
154158 }
155159
156- set showConnector ( showConnector : boolean ) {
157- this . #props. showConnector = showConnector ;
158- this . #onStateChange( ) ;
160+ /**
161+ * @deprecated
162+ */
163+ set showConnector ( _showConnector : boolean ) {
164+ console . warn ( 'Connector is no longer supported' ) ;
159165 }
160166
161167 get origin ( ) : DialogOrigin {
@@ -264,7 +270,6 @@ export class Dialog extends HTMLElement {
264270 this . #devtoolsMutationObserver. observe ( this . #devToolsBoundingElement, { childList : true , subtree : true } ) ;
265271 this . #devToolsBoundingElement. addEventListener ( 'wheel' , this . #handleScrollAttemptBound) ;
266272 this . style . setProperty ( '--dialog-padding' , '0' ) ;
267- this . style . setProperty ( '--override-content-box-shadow' , 'none' ) ;
268273 this . style . setProperty ( '--dialog-display' , IS_DIALOG_SUPPORTED ? 'block' : 'none' ) ;
269274 this . style . setProperty ( '--override-dialog-content-border' , `${ CONNECTOR_HEIGHT } px solid transparent` ) ;
270275 this . style . setProperty ( '--dialog-padding' , `${ DIALOG_VERTICAL_PADDING } px ${ DIALOG_SIDE_PADDING } px` ) ;
@@ -452,9 +457,8 @@ export class Dialog extends HTMLElement {
452457 this . #bestVerticalPositionInternal === DialogVerticalPosition . AUTO ) {
453458 return ;
454459 }
455- this . #hitArea. height = anchorBottom - anchorTop + ( CONNECTOR_HEIGHT * ( this . showConnector ? 2 : 1 ) ) ;
460+ this . #hitArea. height = anchorBottom - anchorTop + CONNECTOR_HEIGHT ;
456461 this . #hitArea. width = hitAreaWidth ;
457- let connectorRelativeXValue = 0 ;
458462 // If the connector is to be shown, the dialog needs a minimum width such that it covers
459463 // the connector's width.
460464 this . style . setProperty (
@@ -463,16 +467,14 @@ export class Dialog extends HTMLElement {
463467 this . style . setProperty ( '--dialog-left' , 'auto' ) ;
464468 this . style . setProperty ( '--dialog-right' , 'auto' ) ;
465469 this . style . setProperty ( '--dialog-margin' , '0' ) ;
466- const offsetToCoverConnector = this . showConnector ? CONNECTOR_WIDTH * 3 / 4 : 0 ;
467470 switch ( this . #bestHorizontalAlignment) {
468471 case DialogHorizontalAlignment . LEFT : {
469472 // Position the dialog such that its left border is in line with that of its anchor.
470473 // If this means the dialog's left border is out of DevTools bounds, move it to the right.
471474 // Cap its width as needed so that the right border doesn't overflow.
472- const dialogLeft = Math . max ( anchorLeft - offsetToCoverConnector , devToolsLeft ) ;
475+ const dialogLeft = Math . max ( anchorLeft , devToolsLeft ) ;
473476 const devtoolsRightBorderToDialogLeft = devToolsRight - dialogLeft ;
474477 const dialogMaxWidth = devtoolsRightBorderToDialogLeft - DIALOG_PADDING_FROM_WINDOW ;
475- connectorRelativeXValue = connectorFixedXValue - dialogLeft - DIALOG_SIDE_PADDING ;
476478 this . style . setProperty ( '--dialog-left' , `${ dialogLeft } px` ) ;
477479 this . #hitArea. x = anchorLeft ;
478480 this . style . setProperty ( '--dialog-max-width' , `${ dialogMaxWidth } px` ) ;
@@ -485,15 +487,11 @@ export class Dialog extends HTMLElement {
485487 const windowRightBorderToAnchorRight = windowWidth - anchorRight ;
486488 const windowRightBorderToDevToolsRight = windowWidth - devToolsRight ;
487489 const windowRightBorderToDialogRight =
488- Math . max ( windowRightBorderToAnchorRight - offsetToCoverConnector , windowRightBorderToDevToolsRight ) ;
490+ Math . max ( windowRightBorderToAnchorRight , windowRightBorderToDevToolsRight ) ;
489491
490492 const dialogRight = windowWidth - windowRightBorderToDialogRight ;
491493 const devtoolsLeftBorderToDialogRight = dialogRight - devToolsLeft ;
492494 const dialogMaxWidth = devtoolsLeftBorderToDialogRight - DIALOG_PADDING_FROM_WINDOW ;
493- const dialogCappedWidth = Math . min ( dialogMaxWidth , dialogWidth ) ;
494-
495- const dialogLeft = dialogRight - dialogCappedWidth ;
496- connectorRelativeXValue = connectorFixedXValue - dialogLeft ;
497495
498496 this . #hitArea. x = windowWidth - windowRightBorderToDialogRight - hitAreaWidth ;
499497 this . style . setProperty ( '--dialog-right' , `${ windowRightBorderToDialogRight } px` ) ;
@@ -508,7 +506,6 @@ export class Dialog extends HTMLElement {
508506
509507 let dialogLeft = Math . max ( originCenterX - dialogCappedWidth * 0.5 , devToolsLeft ) ;
510508 dialogLeft = Math . min ( dialogLeft , devToolsRight - dialogCappedWidth ) ;
511- connectorRelativeXValue = connectorFixedXValue - dialogLeft - DIALOG_SIDE_PADDING ;
512509 this . style . setProperty ( '--dialog-left' , `${ dialogLeft } px` ) ;
513510 this . #hitArea. x = originCenterX - hitAreaWidth * 0.5 ;
514511 this . style . setProperty ( '--dialog-max-width' , `${ devToolsWidth - DIALOG_PADDING_FROM_WINDOW } px` ) ;
@@ -518,92 +515,32 @@ export class Dialog extends HTMLElement {
518515 Platform . assertNever (
519516 this . #bestHorizontalAlignment, `Unknown alignment type: ${ this . #bestHorizontalAlignment} ` ) ;
520517 }
521- const visibleConnectorHeight = this . showConnector ? CONNECTOR_HEIGHT : 0 ;
522- const clipPathConnectorStartX = connectorRelativeXValue - CONNECTOR_WIDTH / 2 ;
523- const clipPathConnectorEndX = connectorRelativeXValue + CONNECTOR_WIDTH / 2 ;
524- let [ p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 ] = [ '' , '' , '' , '' , '' , '' , '' , '' , '' , '' ] ;
525518
526- const PSEUDO_BORDER_RADIUS = 2 ;
527519 switch ( this . #bestVerticalPositionInternal) {
528520 case DialogVerticalPosition . TOP : {
529- // p1 p2
530- // *-----------------------------*
531- // | |
532- // | |
533- // p9| |
534- // \__________________p7 p5____/ p3 <-- A pseudo curve is added to the clip path to
535- // p8 \/ p4 imitate a curved boder.
536- // p6
537- // |-connectorRelativeX--|
538- const clipPathBottom = `calc(100% - ${ CONNECTOR_HEIGHT } px)` ;
539- if ( this . #props. showConnector ) {
540- p1 = '0 0' ;
541- p2 = '100% 0' ;
542- p3 = `100% calc(${ clipPathBottom } - ${ PSEUDO_BORDER_RADIUS } px)` ;
543- p4 = `calc(100% - ${ PSEUDO_BORDER_RADIUS } px) ${ clipPathBottom } ` ;
544- p5 = `${ clipPathConnectorStartX } px ${ clipPathBottom } ` ;
545- p6 = `${ connectorRelativeXValue } px 100%` ;
546- p7 = `${ clipPathConnectorEndX } px ${ clipPathBottom } ` ;
547- p8 = `${ PSEUDO_BORDER_RADIUS } px ${ clipPathBottom } ` ;
548- p9 = `0 calc(${ clipPathBottom } - ${ PSEUDO_BORDER_RADIUS } px)` ;
549- }
550-
551- this . style . setProperty (
552- '--content-padding-bottom' ,
553- `${ CONNECTOR_HEIGHT + ( this . #props. showConnector ? CONNECTOR_HEIGHT : 0 ) } px` ) ;
554- this . style . setProperty ( '--content-padding-top' , `${ CONNECTOR_HEIGHT } px` ) ;
555521 this . style . setProperty ( '--dialog-top' , '0' ) ;
556522 this . style . setProperty ( '--dialog-margin' , 'auto' ) ;
557523 this . style . setProperty ( '--dialog-margin-bottom' , `${ innerHeight - anchorTop } px` ) ;
558- this . #hitArea. y = anchorTop - ( CONNECTOR_HEIGHT * ( this . showConnector ? 2 : 1 ) ) ;
524+ this . #hitArea. y = anchorTop - CONNECTOR_HEIGHT ;
559525 this . style . setProperty ( '--dialog-offset-y' , `${ DIALOG_ANIMATION_OFFSET } px` ) ;
560526 this . style . setProperty (
561- '--dialog-max-height' ,
562- `${
563- devToolsHeight - ( innerHeight - anchorTop ) - DIALOG_PADDING_FROM_WINDOW -
564- visibleConnectorHeight } px`) ;
527+ '--dialog-max-height' , `${ devToolsHeight - ( innerHeight - anchorTop ) - DIALOG_PADDING_FROM_WINDOW } px` ) ;
565528 break ;
566529 }
567530 case DialogVerticalPosition . BOTTOM : {
568- // p4
569- // p2_________/\_________p6
570- // / p3 p5 \
571- // p1 | | p7
572- // | |
573- // p9 *________________________* p8
574-
575- if ( this . #props. showConnector ) {
576- p1 = `0 ${ CONNECTOR_HEIGHT + PSEUDO_BORDER_RADIUS } px` ;
577- p2 = `${ PSEUDO_BORDER_RADIUS } px ${ CONNECTOR_HEIGHT } px` ;
578- p3 = `${ clipPathConnectorStartX } px ${ CONNECTOR_HEIGHT } px` ;
579- p4 = `${ connectorRelativeXValue } px 0` ;
580- p5 = `${ clipPathConnectorEndX } px ${ CONNECTOR_HEIGHT } px` ;
581- p6 = `calc(100% - ${ PSEUDO_BORDER_RADIUS } px) ${ CONNECTOR_HEIGHT } px` ;
582- p7 = `100% ${ CONNECTOR_HEIGHT + PSEUDO_BORDER_RADIUS } px` ;
583- p8 = '100% 100%' ;
584- p9 = '0 100%' ;
585- }
586- this . style . setProperty (
587- '--content-padding-top' , `${ CONNECTOR_HEIGHT + ( this . #props. showConnector ? CONNECTOR_HEIGHT : 0 ) } px` ) ;
588- this . style . setProperty ( '--content-padding-bottom' , `${ CONNECTOR_HEIGHT } px` ) ;
589531 this . style . setProperty ( '--dialog-top' , `${ anchorBottom } px` ) ;
590532 this . #hitArea. y = anchorTop ;
591533 this . style . setProperty ( '--dialog-offset-y' , `-${ DIALOG_ANIMATION_OFFSET } px` ) ;
592534 this . style . setProperty (
593535 '--dialog-max-height' ,
594- `${
595- devToolsHeight - ( anchorBottom - devToolsTop ) - DIALOG_PADDING_FROM_WINDOW -
596- visibleConnectorHeight } px`) ;
536+ `${ devToolsHeight - ( anchorBottom - devToolsTop ) - DIALOG_PADDING_FROM_WINDOW } px` ) ;
597537 break ;
598538 }
599539 default :
600540 Platform . assertNever (
601541 this . #bestVerticalPositionInternal, `Unknown position type: ${ this . #bestVerticalPositionInternal} ` ) ;
602542 }
603543
604- const clipPath = [ p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 ] . join ( ) ;
605-
606- this . style . setProperty ( '--content-clip-path' , clipPath ) ;
607544 dialog . close ( ) ;
608545 dialog . style . visibility = '' ;
609546 } ) ;
0 commit comments