3030
3131import * as Common from '../../core/common/common.js' ;
3232import * as i18n from '../../core/i18n/i18n.js' ;
33+ import type * as Platform from '../../core/platform/platform.js' ;
3334import * as SDK from '../../core/sdk/sdk.js' ;
3435import * as Protocol from '../../generated/protocol.js' ;
3536import * as UI from '../../ui/legacy/legacy.js' ;
@@ -47,10 +48,6 @@ const UIStrings = {
4748 *@description DOM breakpoints description that shows if no DOM breakpoints are set
4849 */
4950 domBreakpointsDescription : 'DOM breakpoints pause on the code that changes a DOM node or its children.' ,
50- /**
51- *@description Link text to more information on DOM breakpoints
52- */
53- learnMore : 'Learn more' ,
5451 /**
5552 *@description Accessibility label for the DOM breakpoints list in the Sources panel
5653 */
@@ -130,14 +127,15 @@ const str_ = i18n.i18n.registerUIStrings('panels/browser_debugger/DOMBreakpoints
130127const i18nString = i18n . i18n . getLocalizedString . bind ( undefined , str_ ) ;
131128const i18nLazyString = i18n . i18n . getLazilyComputedLocalizedString . bind ( undefined , str_ ) ;
132129
133- const DOM_BREAKPOINT_DOCUMENTATION_URL = 'https://developer.chrome.com/docs/devtools/javascript/breakpoints#dom' ;
130+ const DOM_BREAKPOINT_DOCUMENTATION_URL =
131+ 'https://developer.chrome.com/docs/devtools/javascript/breakpoints#dom' as Platform . DevToolsPath . UrlString ;
134132
135133let domBreakpointsSidebarPaneInstance : DOMBreakpointsSidebarPane ;
136134
137135export class DOMBreakpointsSidebarPane extends UI . Widget . VBox implements
138136 UI . ContextFlavorListener . ContextFlavorListener , UI . ListControl . ListDelegate < SDK . DOMDebuggerModel . DOMBreakpoint > {
139137 elementToCheckboxes : WeakMap < Element , HTMLInputElement > ;
140- readonly #emptyElement: HTMLElement ;
138+ readonly #emptyElement: UI . EmptyWidget . EmptyWidget ;
141139 readonly #breakpoints: UI . ListModel . ListModel < SDK . DOMDebuggerModel . DOMBreakpoint > ;
142140 #list: UI . ListControl . ListControl < SDK . DOMDebuggerModel . DOMBreakpoint > ;
143141 #highlightedBreakpoint: SDK . DOMDebuggerModel . DOMBreakpoint | null ;
@@ -150,21 +148,17 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox implements
150148 this . contentElement . setAttribute (
151149 'jslog' , `${ VisualLogging . section ( 'sources.dom-breakpoints' ) . track ( { resize : true } ) } ` ) ;
152150 this . contentElement . classList . add ( 'dom-breakpoints-container' ) ;
153- this . #emptyElement = this . contentElement . createChild ( 'div' , 'empty-state' ) ;
154- this . #emptyElement. createChild ( 'div' , 'header' ) . textContent = i18nString ( UIStrings . noBreakpoints ) ;
155- const emptyStateDescription = this . #emptyElement. createChild ( 'div' , 'description' ) ;
156- emptyStateDescription . textContent = i18nString ( UIStrings . domBreakpointsDescription ) ;
157- const learnMore = UI . XLink . XLink . create (
158- DOM_BREAKPOINT_DOCUMENTATION_URL , i18nString ( UIStrings . learnMore ) , '' , undefined , 'learn-more' ) ;
159- emptyStateDescription . appendChild ( learnMore ) ;
151+ this . #emptyElement =
152+ new UI . EmptyWidget . EmptyWidget ( UIStrings . noBreakpoints , i18nString ( UIStrings . domBreakpointsDescription ) ) ;
153+ this . #emptyElement. appendLink ( DOM_BREAKPOINT_DOCUMENTATION_URL ) ;
154+ this . #emptyElement. show ( this . contentElement ) ;
160155
161156 this . #breakpoints = new UI . ListModel . ListModel ( ) ;
162157 this . #list = new UI . ListControl . ListControl ( this . #breakpoints, this , UI . ListControl . ListMode . NonViewport ) ;
163158 this . contentElement . appendChild ( this . #list. element ) ;
164159 this . #list. element . classList . add ( 'breakpoint-list' , 'hidden' ) ;
165160 UI . ARIAUtils . markAsList ( this . #list. element ) ;
166161 UI . ARIAUtils . setLabel ( this . #list. element , i18nString ( UIStrings . domBreakpointsList ) ) ;
167- this . #emptyElement. tabIndex = - 1 ;
168162
169163 SDK . TargetManager . TargetManager . instance ( ) . addModelListener (
170164 SDK . DOMDebuggerModel . DOMDebuggerModel , SDK . DOMDebuggerModel . Events . DOM_BREAKPOINT_ADDED , this . breakpointAdded ,
@@ -255,7 +249,7 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox implements
255249 UI . ARIAUtils . setDescription ( element , checkedStateText ) ;
256250 }
257251
258- this . #emptyElement. classList . add ( 'hidden' ) ;
252+ this . #emptyElement. hideWidget ( ) ;
259253 this . #list. element . classList . remove ( 'hidden' ) ;
260254
261255 return element ;
@@ -314,8 +308,8 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox implements
314308 }
315309 }
316310 if ( this . #breakpoints. length === 0 ) {
317- this . #emptyElement. classList . remove ( 'hidden' ) ;
318- this . setDefaultFocusedElement ( this . #emptyElement) ;
311+ this . #emptyElement. showWidget ( ) ;
312+ this . setDefaultFocusedElement ( this . #emptyElement. element ) ;
319313 this . #list. element . classList . add ( 'hidden' ) ;
320314 } else if ( lastIndex >= 0 ) {
321315 const breakpointToSelect = this . #breakpoints. at ( lastIndex ) ;
0 commit comments