@@ -42,6 +42,7 @@ import * as CodeHighlighter from '../../ui/components/code_highlighter/code_high
42
42
import * as IconButton from '../../ui/components/icon_button/icon_button.js' ;
43
43
import * as IssueCounter from '../../ui/components/issue_counter/issue_counter.js' ;
44
44
import * as UI from '../../ui/legacy/legacy.js' ;
45
+ import { html , nothing , render } from '../../ui/lit/lit.js' ;
45
46
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js' ;
46
47
47
48
import * as ElementsComponents from './components/components.js' ;
@@ -71,6 +72,10 @@ const UIStrings = {
71
72
*@description Link text content in Elements Tree Outline of the Elements panel
72
73
*/
73
74
reveal : 'reveal' ,
75
+ /**
76
+ * @description Text for popover that directs to Issues panel
77
+ */
78
+ viewIssue : 'View Issue:' ,
74
79
} as const ;
75
80
const str_ = i18n . i18n . registerUIStrings ( 'panels/elements/ElementsTreeOutline.ts' , UIStrings ) ;
76
81
const i18nString = i18n . i18n . getLocalizedString . bind ( undefined , str_ ) ;
@@ -106,7 +111,7 @@ export class ElementsTreeOutline extends
106
111
#topLayerContainerByParent = new Map < UI . TreeOutline . TreeElement , TopLayerContainer > ( ) ;
107
112
#issuesManager?: IssuesManager . IssuesManager . IssuesManager ;
108
113
#popupHelper?: UI . PopoverHelper . PopoverHelper ;
109
- #nodeElementToIssue = new Map < Element , IssuesManager . Issue . Issue > ( ) ;
114
+ #nodeElementToIssues = new Map < Element , IssuesManager . Issue . Issue [ ] > ( ) ;
110
115
111
116
constructor ( omitRootDOMNode ?: boolean , selectEnabled ?: boolean , hideGutter ?: boolean ) {
112
117
super ( ) ;
@@ -194,40 +199,34 @@ export class ElementsTreeOutline extends
194
199
return null ;
195
200
}
196
201
197
- const issue = this . #nodeElementToIssue. get ( hoveredNode ) ;
198
- if ( ! issue ) {
199
- return null ;
200
- }
201
- const elementIssueDetails = getElementIssueDetails ( issue ) ;
202
- if ( ! elementIssueDetails ) {
202
+ const issues = this . #nodeElementToIssues. get ( hoveredNode ) ;
203
+ if ( ! issues ) {
203
204
return null ;
204
205
}
205
- const issueKindIcon = new IconButton . Icon . Icon ( ) ;
206
- issueKindIcon . data = IssueCounter . IssueCounter . getIssueKindIconData ( issue . getKind ( ) ) ;
207
- issueKindIcon . style . cursor = 'pointer' ;
208
- const viewIssueElement = document . createElement ( 'a' ) ;
209
- viewIssueElement . href = '#' ;
210
- viewIssueElement . textContent = 'View issue:' ;
211
-
212
- const issueTitle = document . createElement ( 'span' ) ;
213
- issueTitle . textContent = elementIssueDetails . tooltip ;
214
-
215
- const element = document . createElement ( 'div' ) ;
216
- element . appendChild ( issueKindIcon ) ;
217
- element . appendChild ( viewIssueElement ) ;
218
- element . appendChild ( issueTitle ) ;
219
- element . style . display = 'flex' ;
220
- element . style . alignItems = 'center' ;
221
- element . style . gap = '5px' ;
222
206
223
207
return {
224
208
box : hoveredNode . boxInWindow ( ) ,
225
209
show : async ( popover : UI . GlassPane . GlassPane ) => {
226
210
popover . setIgnoreLeftMargin ( true ) ;
227
- const openIssueEvent = ( ) : Promise < void > => Common . Revealer . reveal ( issue ) ;
228
- viewIssueElement . addEventListener ( 'click' , ( ) => openIssueEvent ( ) ) ;
229
- issueKindIcon . addEventListener ( 'click' , ( ) => openIssueEvent ( ) ) ;
230
- popover . contentElement . appendChild ( element ) ;
211
+ // clang-format off
212
+ render ( html `
213
+ < div class ="squiggles-content ">
214
+ ${ issues . map ( issue => {
215
+ const elementIssueDetails = getElementIssueDetails ( issue ) ;
216
+ if ( ! elementIssueDetails ) {
217
+ // This shouldn't happen, but add this if check to pass ts check.
218
+ return nothing ;
219
+ }
220
+ const issueKindIconData = IssueCounter . IssueCounter . getIssueKindIconData ( issue . getKind ( ) ) ;
221
+ const openIssueEvent = ( ) : Promise < void > => Common . Revealer . reveal ( issue ) ;
222
+ return html `
223
+ < div class ="squiggles-content-item ">
224
+ < devtools-icon .data =${ issueKindIconData } @click =${ openIssueEvent } > </ devtools-icon >
225
+ < x-link class ="link " @click =${ openIssueEvent } > ${ i18nString ( UIStrings . viewIssue ) } </ x-link >
226
+ < span > ${ elementIssueDetails . tooltip } </ span >
227
+ </ div > ` ; } ) }
228
+ </ div > ` , popover . contentElement ) ;
229
+ // clang-format on
231
230
return true ;
232
231
} ,
233
232
} ;
@@ -276,7 +275,7 @@ export class ElementsTreeOutline extends
276
275
const treeElementNodeElementsToIssue = treeElement . issuesByNodeElement ;
277
276
// This element could be the treeElement tags name or an attribute.
278
277
for ( const [ element , issue ] of treeElementNodeElementsToIssue ) {
279
- this . #nodeElementToIssue . set ( element , issue ) ;
278
+ this . #nodeElementToIssues . set ( element , issue ) ;
280
279
}
281
280
}
282
281
}
0 commit comments