chrome-devtools-frontend 1.0.1732418 → 1.0.1733843
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/docs/get_the_code.md +1 -73
- package/front_end/Tests.js +0 -5
- package/front_end/core/host/AidaClientTypes.ts +24 -3
- package/front_end/core/host/AidaGcaTranslation.ts +29 -1
- package/front_end/core/platform/browser/HostRuntime.ts +5 -1
- package/front_end/core/sdk/DOMModel.ts +8 -3
- package/front_end/design_system_tokens.css +5 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
- package/front_end/generated/InspectorBackendCommands.ts +5 -5
- package/front_end/generated/SupportedCSSProperties.ts +8 -2
- package/front_end/generated/protocol.ts +29 -7
- package/front_end/models/ai-utils/debug.ts +127 -22
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/README.md +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +69 -11
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
- package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +4 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +6 -0
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
- package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
- package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
- package/front_end/models/trace/LanternComputationData.ts +4 -0
- package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
- package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
- package/front_end/models/web_mcp/WebMCPModel.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +65 -15
- package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +4 -5
- package/front_end/panels/ai_assistance/components/exploreWidget.css +3 -3
- package/front_end/panels/application/backgroundServiceView.css +2 -2
- package/front_end/panels/application/components/reportsGrid.css +1 -1
- package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
- package/front_end/panels/application/components/trustTokensView.css +1 -1
- package/front_end/panels/application/deviceBoundSessionsView.css +1 -1
- package/front_end/panels/application/frameDetailsReportView.css +0 -4
- package/front_end/panels/application/indexedDBViews.css +0 -4
- package/front_end/panels/application/resourcesPanel.css +0 -13
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +3 -3
- package/front_end/panels/application/serviceWorkersView.css +3 -2
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +346 -286
- package/front_end/panels/comments/CommentsPane.ts +2 -11
- package/front_end/panels/common/CommentThreadWidget.ts +11 -3
- package/front_end/panels/common/CommentsOverlayWidget.ts +3 -2
- package/front_end/panels/console/consoleContextSelector.css +1 -1
- package/front_end/panels/console/consolePinPane.css +1 -1
- package/front_end/panels/console/consolePrompt.css +4 -2
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
- package/front_end/panels/elements/PropertyRenderer.ts +7 -27
- package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
- package/front_end/panels/elements/components/cssPropertyDocsView.css +1 -1
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +1 -5
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +2 -2
- package/front_end/panels/elements/propertiesWidget.css +0 -5
- package/front_end/panels/elements/stylesSidebarPane.css +3 -2
- package/front_end/panels/emulation/deviceModeView.css +3 -3
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +2 -2
- package/front_end/panels/issues/issuesTree.css +10 -7
- package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
- package/front_end/panels/lighthouse/LighthousePanel.ts +16 -1
- package/front_end/panels/lighthouse/lighthousePanel.css +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +10 -6
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +1 -26
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
- package/front_end/panels/media/playerListView.css +11 -8
- package/front_end/panels/media/playerMessagesView.css +9 -5
- package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
- package/front_end/panels/network/networkConfigView.css +3 -3
- package/front_end/panels/network/networkLogView.css +5 -4
- package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
- package/front_end/panels/network/networkTimingTable.css +4 -8
- package/front_end/panels/network/requestPayloadView.css +1 -1
- package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
- package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +114 -18
- package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
- package/front_end/panels/recorder/createRecordingView.css +2 -2
- package/front_end/panels/recorder/stepEditor.css +1 -1
- package/front_end/panels/recorder/stepView.css +0 -7
- package/front_end/panels/recorder/timelineSection.css +1 -1
- package/front_end/panels/screencast/screencastView.css +1 -1
- package/front_end/panels/search/searchResultsPane.css +1 -1
- package/front_end/panels/security/mainView.css +2 -2
- package/front_end/panels/security/originView.css +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +1 -0
- package/front_end/panels/sources/NavigatorView.ts +120 -49
- package/front_end/panels/sources/breakpointsView.css +3 -3
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -1
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
- package/front_end/panels/timeline/TimelinePanel.ts +24 -3
- package/front_end/panels/timeline/components/metricCard.css +1 -1
- package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
- package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
- package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
- package/front_end/panels/timeline/timelineMiniMap.css +3 -2
- package/front_end/panels/web_audio/WebAudioModel.ts +14 -5
- package/front_end/panels/web_audio/WebAudioView.ts +34 -1
- package/front_end/panels/web_audio/webAudio.css +17 -3
- package/front_end/panels/webauthn/webauthnPane.css +2 -4
- package/front_end/panels/whats_new/ReleaseNoteText.ts +19 -1
- package/front_end/panels/whats_new/ReleaseNoteView.ts +15 -1
- package/front_end/panels/whats_new/releaseNoteView.css +49 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer-replay/README.chromium +9 -1
- package/front_end/third_party/puppeteer-replay/package/lib/main.d.ts +2 -2
- package/front_end/ui/components/buttons/button.css +0 -1
- package/front_end/ui/components/diff_view/diffView.css +1 -1
- package/front_end/ui/components/markdown_view/codeBlock.css +4 -4
- package/front_end/ui/components/markdown_view/markdownView.css +3 -7
- package/front_end/ui/components/panel_feedback/panelFeedback.css +3 -2
- package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
- package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
- package/front_end/ui/components/switch/switch.css +2 -1
- package/front_end/ui/legacy/TabbedPane.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +10 -3
- package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/flameChart.css +5 -3
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +7 -4
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +0 -1
- package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +11 -27
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/progressIndicator.css +1 -2
- package/front_end/ui/legacy/reportView.css +5 -2
- package/front_end/ui/legacy/searchableView.css +3 -2
- package/front_end/ui/legacy/suggestBox.css +2 -1
- package/front_end/ui/legacy/tabbedPane.css +8 -5
- package/front_end/ui/legacy/treeoutline.css +1 -1
- package/front_end/ui/legacy/viewContainers.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +11 -0
- package/package.json +1 -1
- package/front_end/models/ai_code_completion/debug.ts +0 -33
- package/front_end/models/ai_code_generation/debug.ts +0 -33
|
@@ -18,7 +18,7 @@ import commentsPaneStyles from './commentsPane.css.js';
|
|
|
18
18
|
|
|
19
19
|
const {html, render, i18nTemplate, Directives: {ref, repeat}} = Lit;
|
|
20
20
|
const {widget} = UI.Widget;
|
|
21
|
-
const {computeCommentTitle} = CommonPanels.CommentThreadWidget;
|
|
21
|
+
const {computeCommentTitle, inputDisclaimer} = CommonPanels.CommentThreadWidget;
|
|
22
22
|
type Title = CommonPanels.CommentThreadWidget.Title;
|
|
23
23
|
|
|
24
24
|
const UIStrings = {
|
|
@@ -92,17 +92,8 @@ const UIStrings = {
|
|
|
92
92
|
sentComments: 'Sent comments',
|
|
93
93
|
} as const;
|
|
94
94
|
|
|
95
|
-
const UIStringsNotTranslate = {
|
|
96
|
-
/**
|
|
97
|
-
* @description Disclaimer text in the comments pane info tooltip.
|
|
98
|
-
*/
|
|
99
|
-
inputDisclaimer:
|
|
100
|
-
'Comment strings, DOM hierarchy snippets, tracked CSS and DOM changes, Visual Element (VE) paths and signatures, and tracked presenter changes are sent to the connected third-party agent to assist with debugging and code updates',
|
|
101
|
-
} as const;
|
|
102
|
-
|
|
103
95
|
const str_ = i18n.i18n.registerUIStrings('panels/comments/CommentsPane.ts', UIStrings);
|
|
104
96
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
105
|
-
const lockedString = i18n.i18n.lockedString;
|
|
106
97
|
|
|
107
98
|
export type Tab = 'queued'|'sent';
|
|
108
99
|
|
|
@@ -290,7 +281,7 @@ export const DEFAULT_VIEW: View = (input: ViewInput, output: ViewOutput, target:
|
|
|
290
281
|
variant="rich"
|
|
291
282
|
>
|
|
292
283
|
<div class="info-tooltip-container">
|
|
293
|
-
${
|
|
284
|
+
${inputDisclaimer()}
|
|
294
285
|
</div>
|
|
295
286
|
</devtools-tooltip>
|
|
296
287
|
<button
|
|
@@ -80,16 +80,24 @@ const UIStrings = {
|
|
|
80
80
|
|
|
81
81
|
const UIStringsNotTranslate = {
|
|
82
82
|
/**
|
|
83
|
-
* @description Disclaimer text in the comment thread
|
|
83
|
+
* @description Disclaimer text in the info tooltips of the comment thread and the comments pane.
|
|
84
84
|
*/
|
|
85
85
|
inputDisclaimer:
|
|
86
|
-
'
|
|
86
|
+
'Comments and content attached to comments, and DOM/CSS changes recorded in the comment mode are sent to the connected third-party agent to assist with debugging and code updates',
|
|
87
87
|
} as const;
|
|
88
88
|
|
|
89
89
|
const str_ = i18n.i18n.registerUIStrings('panels/common/CommentThreadWidget.ts', UIStrings);
|
|
90
90
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
91
91
|
const lockedString = i18n.i18n.lockedString;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Returns the disclaimer about the data that is sent to the connected agent. The comment thread and the comments
|
|
95
|
+
* pane both show it in their info tooltips.
|
|
96
|
+
*/
|
|
97
|
+
export function inputDisclaimer(): string {
|
|
98
|
+
return lockedString(UIStringsNotTranslate.inputDisclaimer);
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
/**
|
|
94
102
|
* Either the DOM node the thread is anchored to, or a plain text label for anchors that are not
|
|
95
103
|
* DOM nodes (e.g. network requests).
|
|
@@ -250,7 +258,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
|
|
|
250
258
|
variant="rich"
|
|
251
259
|
>
|
|
252
260
|
<div class="info-tooltip-container">
|
|
253
|
-
${
|
|
261
|
+
${inputDisclaimer()}
|
|
254
262
|
</div>
|
|
255
263
|
</devtools-tooltip>
|
|
256
264
|
<devtools-button
|
|
@@ -368,8 +368,6 @@ export class CommentsOverlayWidget extends UI.Widget.Widget {
|
|
|
368
368
|
override willHide(): void {
|
|
369
369
|
this.#clearCloseTimeout();
|
|
370
370
|
this.#clearHover();
|
|
371
|
-
this.#removeDocumentListeners();
|
|
372
|
-
this.#commentOverlayManager.stop();
|
|
373
371
|
this.#commentOverlayManager.removeEventListener(
|
|
374
372
|
Comments.CommentOverlayManager.Events.POSITIONS_UPDATED,
|
|
375
373
|
this.#onPositionsUpdated,
|
|
@@ -396,6 +394,9 @@ export class CommentsOverlayWidget extends UI.Widget.Widget {
|
|
|
396
394
|
this.#onAgentAttachedChanged,
|
|
397
395
|
this,
|
|
398
396
|
);
|
|
397
|
+
this.#commentOverlayManager.stop();
|
|
398
|
+
this.#syncActiveThreadFromManager();
|
|
399
|
+
this.#removeDocumentListeners();
|
|
399
400
|
|
|
400
401
|
super.willHide();
|
|
401
402
|
}
|
|
@@ -40,8 +40,10 @@
|
|
|
40
40
|
|
|
41
41
|
.preview-result-icon {
|
|
42
42
|
position: absolute;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/* Offset both .console-prompt-icon's 12px (--sys-size-6) gutter offset and
|
|
44
|
+
* .console-eager-preview's 4px (--sys-size-3) left margin so both icons align. */
|
|
45
|
+
left: calc(-1 * (var(--sys-size-6) + var(--sys-size-3)));
|
|
46
|
+
top: 0;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.console-eager-inner-preview:empty,
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
.console-message-wrapper.console-adjacent-user-command-result:not(.console-error-level, .console-warning-level):focus .command-result-icon {
|
|
296
|
-
top:
|
|
296
|
+
top: var(--sys-size-1);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.console-message-wrapper .nesting-level-marker {
|
|
@@ -43,7 +43,7 @@ import * as TreeOutline from '../../ui/components/tree_outline/tree_outline.js';
|
|
|
43
43
|
import * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
|
|
44
44
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
45
45
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
46
|
-
import
|
|
46
|
+
import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
47
47
|
|
|
48
48
|
import * as ElementsComponents from './components/components.js';
|
|
49
49
|
import computedStyleWidgetStyles from './computedStyleWidget.css.js';
|
|
@@ -52,7 +52,6 @@ import {categorizePropertyName, type Category, DefaultCategoryOrder} from './Pro
|
|
|
52
52
|
import {Renderer, rendererBase, type RenderingContext, StringRenderer, URLRenderer} from './PropertyRenderer.js';
|
|
53
53
|
import {StylePropertiesSection} from './StylePropertiesSection.js';
|
|
54
54
|
|
|
55
|
-
const {html, render} = Lit;
|
|
56
55
|
const {bindToSetting} = UI.UIUtils;
|
|
57
56
|
const {widget} = UI.Widget;
|
|
58
57
|
|
|
@@ -129,7 +128,7 @@ const createPropertyElement =
|
|
|
129
128
|
(node: SDK.DOMModel.DOMNode, cache: Map<string, {name: Element, value: Element}>, propertyName: string,
|
|
130
129
|
propertyValue: string, traceable: boolean, inherited: boolean,
|
|
131
130
|
activeProperty: SDK.CSSProperty.CSSProperty|undefined, onContextMenu: ((event: Event) => void),
|
|
132
|
-
category?: Category):
|
|
131
|
+
category?: Category): TemplateResult => {
|
|
133
132
|
const {name, value} = renderPropertyContents(node, cache, propertyName, propertyValue, category);
|
|
134
133
|
// clang-format off
|
|
135
134
|
return html`<devtools-widget
|
|
@@ -191,26 +190,17 @@ const createTraceElement =
|
|
|
191
190
|
// clang-format off
|
|
192
191
|
class ColorRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.ColorMatch) {
|
|
193
192
|
// clang-format on
|
|
194
|
-
override render(match: SDK.CSSPropertyParserMatchers.ColorMatch, context: RenderingContext):
|
|
193
|
+
override render(match: SDK.CSSPropertyParserMatchers.ColorMatch, context: RenderingContext): LitTemplate {
|
|
195
194
|
const color = Common.Color.parse(match.text);
|
|
196
195
|
if (!color) {
|
|
197
|
-
return
|
|
196
|
+
return html`${match.text}`;
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
const swatch = new InlineEditor.ColorSwatch.ColorSwatch();
|
|
201
200
|
swatch.setReadonly(true);
|
|
202
201
|
swatch.renderColor(color);
|
|
203
|
-
const valueElement = document.createElement('span');
|
|
204
|
-
valueElement.textContent = match.text;
|
|
205
|
-
|
|
206
|
-
swatch.addEventListener(
|
|
207
|
-
InlineEditor.ColorSwatch.ColorChangedEvent.eventName, (event: InlineEditor.ColorSwatch.ColorChangedEvent) => {
|
|
208
|
-
const {data: {color}} = event;
|
|
209
|
-
valueElement.textContent = color.getAuthoredText() ?? color.asString();
|
|
210
|
-
});
|
|
211
|
-
|
|
212
202
|
context.addControl('color', swatch);
|
|
213
|
-
return
|
|
203
|
+
return html`${swatch}<span>${match.text}</span>`;
|
|
214
204
|
}
|
|
215
205
|
|
|
216
206
|
matcher(): SDK.CSSPropertyParserMatchers.ColorMatcher {
|
|
@@ -290,7 +280,7 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
290
280
|
>${i18nString(UIStrings.group)}</devtools-checkbox>
|
|
291
281
|
</devtools-toolbar>
|
|
292
282
|
</div>
|
|
293
|
-
` :
|
|
283
|
+
` : nothing}
|
|
294
284
|
${input.computedStylesTree}
|
|
295
285
|
${!input.hasMatches ? html`<div class="gray-info-message">${i18nString(UIStrings.noMatchingProperty)}</div>` : ''}
|
|
296
286
|
`, target);
|
|
@@ -632,9 +622,8 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
632
622
|
propertyTraces: Map<string, SDK.CSSProperty.CSSProperty[]>,
|
|
633
623
|
domNode: SDK.DOMModel.DOMNode,
|
|
634
624
|
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
635
|
-
):
|
|
636
|
-
|
|
637
|
-
state: {isExpanded: boolean}) => Lit.TemplateResult {
|
|
625
|
+
): (node: TreeOutline.TreeOutlineUtils.TreeNode<ComputedStyleData>,
|
|
626
|
+
state: {isExpanded: boolean}) => TemplateResult {
|
|
638
627
|
return node => {
|
|
639
628
|
const data = node.treeNodeData;
|
|
640
629
|
if (data.tag === 'property') {
|
|
@@ -55,7 +55,7 @@ export type RendererBase<MatchT extends SDK.CSSPropertyParser.Match> = abstract
|
|
|
55
55
|
|
|
56
56
|
export interface MatchRenderer<MatchT extends SDK.CSSPropertyParser.Match> {
|
|
57
57
|
readonly matchType: Platform.Constructor.Constructor<MatchT>;
|
|
58
|
-
render(match: MatchT, context: RenderingContext):
|
|
58
|
+
render(match: MatchT, context: RenderingContext): LitTemplate;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// A mixin to automatically expose the match type on specific renrerers
|
|
@@ -64,7 +64,7 @@ export function rendererBase<MatchT extends SDK.CSSPropertyParser.Match>(
|
|
|
64
64
|
matchT: Platform.Constructor.Constructor<MatchT>): RendererBase<MatchT> {
|
|
65
65
|
abstract class RendererBaseClass implements MatchRenderer<MatchT> {
|
|
66
66
|
readonly matchType = matchT;
|
|
67
|
-
render(_match: MatchT, _context: RenderingContext):
|
|
67
|
+
render(_match: MatchT, _context: RenderingContext): LitTemplate {
|
|
68
68
|
return nothing;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -365,19 +365,11 @@ export class TracingContext {
|
|
|
365
365
|
|
|
366
366
|
// After rendering the arguments of a function call, the TracingContext produced by TracingContext#evaluation need to
|
|
367
367
|
// be passed here to determine whether the "current" function call should be evaluated or not. If so, the
|
|
368
|
-
// evaluation callback is run. The callback
|
|
369
|
-
// optionally
|
|
370
|
-
// in-place placeholder update succeeded).
|
|
368
|
+
// evaluation callback is run. The callback should return synchronously a template as placeholder to be
|
|
369
|
+
// rendered immediately and optionally a callback for asynchronous updates of the template.
|
|
371
370
|
applyEvaluation(children: TracingContext[],
|
|
372
|
-
evaluation: () => {
|
|
373
|
-
|
|
374
|
-
evaluation: () => ({placeholder: LitTemplate, asyncEvalCallback?: () => Promise<boolean>} |
|
|
375
|
-
{template: LitTemplate, asyncEvalCallback?: () => Promise<LitTemplate|null>})):
|
|
376
|
-
LitTemplate|null;
|
|
377
|
-
applyEvaluation(children: TracingContext[],
|
|
378
|
-
evaluation: () => ({placeholder: Node[] | LitTemplate, asyncEvalCallback?: () => Promise<boolean>} |
|
|
379
|
-
{template: LitTemplate, asyncEvalCallback?: () => Promise<LitTemplate|null>})):
|
|
380
|
-
Node[]|LitTemplate|null {
|
|
371
|
+
evaluation: () => {template: LitTemplate, asyncEvalCallback?: () => Promise<LitTemplate|null>}):
|
|
372
|
+
LitTemplate|null {
|
|
381
373
|
if (this.#evaluationCount === 0 || children.some(child => child.#appliedEvaluations >= this.#evaluationCount)) {
|
|
382
374
|
this.#setHasMoreEvaluations(true);
|
|
383
375
|
children.forEach(child => this.#asyncEvalCallbacks.push(...child.#asyncEvalCallbacks));
|
|
@@ -386,10 +378,6 @@ export class TracingContext {
|
|
|
386
378
|
this.#setAppliedEvaluations(children.map(child => child.#appliedEvaluations).reduce((a, b) => Math.max(a, b), 0) +
|
|
387
379
|
1);
|
|
388
380
|
const result = evaluation();
|
|
389
|
-
if ('placeholder' in result) {
|
|
390
|
-
this.#asyncEvalCallbacks.push(result.asyncEvalCallback);
|
|
391
|
-
return result.placeholder;
|
|
392
|
-
}
|
|
393
381
|
if (!result.asyncEvalCallback) {
|
|
394
382
|
this.#asyncEvalCallbacks.push(result.asyncEvalCallback);
|
|
395
383
|
return result.template;
|
|
@@ -714,13 +702,6 @@ export class Renderer extends SDK.CSSPropertyParser.TreeWalker {
|
|
|
714
702
|
return {nodes: html`${nodes}`, cssControls};
|
|
715
703
|
}
|
|
716
704
|
|
|
717
|
-
static renderInto(nodeOrNodes: CodeMirror.SyntaxNode|CodeMirror.SyntaxNode[], context: RenderingContext,
|
|
718
|
-
parent: HTMLElement|DocumentFragment): {nodes: LitTemplate, cssControls: CSSControlMap} {
|
|
719
|
-
const {nodes, cssControls} = this.render(nodeOrNodes, context);
|
|
720
|
-
render(nodes, parent);
|
|
721
|
-
return {nodes, cssControls};
|
|
722
|
-
}
|
|
723
|
-
|
|
724
705
|
renderedMatchForTest(_nodes: LitTemplate, _match: SDK.CSSPropertyParser.Match): void {
|
|
725
706
|
}
|
|
726
707
|
|
|
@@ -730,8 +711,7 @@ export class Renderer extends SDK.CSSPropertyParser.TreeWalker {
|
|
|
730
711
|
this.#context.renderers.get(match.constructor as Platform.Constructor.Constructor<SDK.CSSPropertyParser.Match>);
|
|
731
712
|
if (renderer || match instanceof SDK.CSSPropertyParserMatchers.TextMatch) {
|
|
732
713
|
const rendered = renderer?.render(match, this.#context) ?? html`<span>${match.text}</span>`;
|
|
733
|
-
const output =
|
|
734
|
-
highlight(this.#context.tracing?.highlighting, match, Array.isArray(rendered) ? html`${rendered}` : rendered);
|
|
714
|
+
const output = highlight(this.#context.tracing?.highlighting, match, rendered);
|
|
735
715
|
this.renderedMatchForTest(output, match);
|
|
736
716
|
if (this.#output.some(t => t !== nothing)) {
|
|
737
717
|
const spacing = precedingSpace(node, this.#context.ast, this.#matchedResult);
|