chrome-devtools-frontend 1.0.1690116 → 1.0.1690531
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/.gitmodules +4 -0
- package/front_end/core/root/Runtime.ts +1 -0
- package/front_end/core/sdk/NetworkRequest.ts +50 -4
- package/front_end/core/sdk/NetworkRequestAccess.ts +172 -0
- package/front_end/core/sdk/SecurityOrigin.ts +25 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/generated/SupportedCSSProperties.ts +1 -1
- package/front_end/models/ai_assistance/AiAgent2.ts +4 -1
- package/front_end/models/ai_assistance/AiConversation.ts +29 -18
- package/front_end/panels/ai_assistance/components/chatMessage.css +3 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +1 -1
- package/front_end/panels/application/components/EndpointsGrid.ts +2 -1
- package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
- package/front_end/panels/application/components/ServiceWorkerRouterView.ts +1 -1
- package/front_end/panels/application/components/TrustTokensView.ts +1 -1
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -1
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
- package/front_end/panels/common/CPUThrottlingOption.ts +12 -6
- package/front_end/panels/common/DOMLinkifier.ts +1 -1
- package/front_end/panels/common/ExtensionView.ts +2 -1
- package/front_end/panels/console/ConsolePinPane.ts +4 -2
- package/front_end/panels/console/ConsoleSidebar.ts +6 -2
- package/front_end/panels/console/PromptBuilder.ts +1 -1
- package/front_end/panels/coverage/CoverageListView.ts +1 -1
- package/front_end/panels/coverage/CoverageModel.ts +6 -4
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +9 -9
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewStartView.ts +3 -3
- package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +1 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +4 -3
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
- package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
- package/front_end/panels/elements/PropertyNameCategories.ts +1 -1
- package/front_end/panels/elements/ShortcutTreeElement.ts +2 -1
- package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +3 -2
- package/front_end/panels/elements/components/StylePropertyEditor.ts +160 -148
- package/front_end/panels/emulation/MediaQueryInspector.ts +2 -1
- package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryNavigator.css +1 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +5 -5
- package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +6 -6
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +6 -6
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +2 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +11 -9
- package/front_end/panels/network/NetworkLogView.ts +4 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
- package/front_end/panels/network/RequestHeadersView.ts +1 -1
- package/front_end/panels/network/RequestPayloadView.ts +1 -1
- package/front_end/panels/network/RequestResponseView.ts +1 -1
- package/front_end/panels/network/RequestTimingView.ts +1 -1
- package/front_end/panels/network/ShowMoreDetailsWidget.ts +1 -1
- package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
- package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
- package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -6
- package/front_end/panels/sources/ProfilePlugin.ts +2 -1
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
- package/front_end/panels/timeline/IsolateSelector.ts +1 -1
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +1 -1
- package/front_end/panels/timeline/NetworkTrackAppender.ts +1 -1
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineHistoryManager.ts +1 -1
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +7 -3
- package/front_end/panels/timeline/TimelinePanel.ts +3 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/panels/timeline/TimelineUIUtils.ts +4 -4
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +4 -3
- package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +25 -24
- package/front_end/panels/timeline/components/RelatedInsightChips.ts +4 -3
- package/front_end/panels/timeline/components/Sidebar.ts +1 -1
- package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +4 -3
- package/front_end/panels/timeline/utils/Helpers.ts +1 -1
- package/front_end/panels/timeline/utils/ImageCache.ts +5 -3
- package/front_end/panels/web_audio/WebAudioView.ts +3 -3
- package/front_end/panels/webauthn/WebauthnPane.ts +5 -11
- package/front_end/third_party/acorn/acorn.ts +3 -3
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/chromium/ahem/ahem.d.ts +1 -0
- package/front_end/third_party/csp_evaluator/package/csp.ts +4 -4
- package/front_end/third_party/csp_evaluator/package/parser.ts +3 -1
- package/front_end/third_party/csp_evaluator/package/utils.ts +1 -1
- package/front_end/third_party/diff/diff_match_patch.d.ts +10 -0
- package/front_end/third_party/json5/json5.ts +2 -2
- package/front_end/ui/components/buttons/floatingButton.css +25 -0
- package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +45 -25
- package/front_end/ui/legacy/ContextMenu.ts +2 -2
- package/front_end/ui/legacy/DropTarget.ts +6 -1
- package/front_end/ui/legacy/EmptyWidget.ts +1 -1
- package/front_end/ui/legacy/GlassPane.ts +1 -1
- package/front_end/ui/legacy/ShortcutRegistry.ts +2 -2
- package/front_end/ui/legacy/SplitWidget.ts +2 -1
- package/front_end/ui/legacy/StackedPane.ts +1 -1
- package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -1
- package/front_end/ui/legacy/TextPrompt.ts +2 -1
- package/front_end/ui/legacy/Toolbar.ts +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +13 -37
- package/front_end/ui/legacy/UIUtils.ts +6 -3
- package/front_end/ui/legacy/ViewManager.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +7 -1
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -2
- package/front_end/ui/legacy/components/inline_editor/AnimationTimingModel.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +48 -44
- package/front_end/ui/legacy/components/inline_editor/CSSAngleUtils.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +141 -106
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +10 -10
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +7 -5
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +8 -5
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -1
- package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -5
- package/front_end/ui/legacy/inspectorCommon.css +11 -0
- package/front_end/ui/visual_logging/Debugging.ts +2 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
- package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
- package/front_end/ui/visual_logging/LoggingEvents.ts +5 -5
- package/front_end/ui/visual_logging/LoggingState.ts +1 -1
- package/front_end/ui/visual_logging/visual_logging.ts +67 -56
- package/package.json +2 -1
- package/front_end/third_party/acorn/acorn-tsconfig.json +0 -12
- package/front_end/third_party/acorn/estree-tsconfig.json +0 -8
- package/front_end/third_party/chromium/client-variations/client-variations-tsconfig.json +0 -8
- package/front_end/third_party/codemirror/codemirror-legacy-types-tsconfig.json +0 -8
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +0 -15
- package/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
- package/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
- package/front_end/third_party/json5/json5-tsconfig.json +0 -8
- package/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
- package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +0 -11
- package/front_end/third_party/lighthouse/report/bundle-tsconfig.json +0 -8
- package/front_end/third_party/lit/lit-tsconfig.json +0 -15
- package/front_end/third_party/marked/marked-tsconfig.json +0 -8
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +0 -191
- package/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
- package/front_end/third_party/wasmparser/wasmparser-tsconfig.json +0 -9
- package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +0 -47
|
@@ -1645,7 +1645,13 @@ const MaterialPaletteShades = new Map([
|
|
|
1645
1645
|
],
|
|
1646
1646
|
]);
|
|
1647
1647
|
|
|
1648
|
-
export const MaterialPalette
|
|
1648
|
+
export const MaterialPalette: {
|
|
1649
|
+
title: string,
|
|
1650
|
+
mutable: boolean,
|
|
1651
|
+
matchUserFormat: boolean,
|
|
1652
|
+
colors: string[],
|
|
1653
|
+
colorNames: string[],
|
|
1654
|
+
} = {
|
|
1649
1655
|
title: 'Material',
|
|
1650
1656
|
mutable: false,
|
|
1651
1657
|
matchUserFormat: true,
|
|
@@ -1756,7 +1756,7 @@ export class DataGridNode<T> {
|
|
|
1756
1756
|
selectable = true;
|
|
1757
1757
|
isRoot = false;
|
|
1758
1758
|
nodeAccessibleText = '';
|
|
1759
|
-
cellAccessibleTextMap = new Map<string, string>();
|
|
1759
|
+
cellAccessibleTextMap: Map<string, string> = new Map<string, string>();
|
|
1760
1760
|
isCreationNode = false;
|
|
1761
1761
|
#data: DataGridData;
|
|
1762
1762
|
#hasChildren: boolean;
|
|
@@ -58,7 +58,7 @@ type DataGridElementNode = SortableNode|DynamicHeightNode;
|
|
|
58
58
|
const elementToNode = new WeakMap<Element, DataGridElementNode>();
|
|
59
59
|
|
|
60
60
|
export class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
|
|
61
|
-
static readonly observedAttributes = ['striped', 'name', 'inline', 'resize', 'highlight'];
|
|
61
|
+
static readonly observedAttributes: string[] = ['striped', 'name', 'inline', 'resize', 'highlight'];
|
|
62
62
|
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
64
|
#dataGrid!: DataGridImpl<any>;
|
|
@@ -805,7 +805,8 @@ class IfExpandedDirective extends Lit.Directive.Directive {
|
|
|
805
805
|
return node.expanded;
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
export const ifExpanded
|
|
808
|
+
export const ifExpanded: (content: Lit.LitTemplate|Iterable<Lit.LitTemplate>) =>
|
|
809
|
+
Lit.DirectiveResult<typeof IfExpandedDirective> = Lit.Directive.directive(IfExpandedDirective);
|
|
809
810
|
|
|
810
811
|
function getNode(element: Element|undefined): DataGridElementNode|undefined {
|
|
811
812
|
return element ? elementToNode.get(element) : undefined;
|
|
@@ -245,50 +245,54 @@ export interface EventTypes {
|
|
|
245
245
|
[Events.BEZIER_CHANGED]: string;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
export const Presets
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
248
|
+
export const Presets: Array<Array<{
|
|
249
|
+
name: string,
|
|
250
|
+
value: string,
|
|
251
|
+
}>> =
|
|
252
|
+
[
|
|
253
|
+
[
|
|
254
|
+
{name: 'linear', value: 'linear'},
|
|
255
|
+
{
|
|
256
|
+
name: 'elastic',
|
|
257
|
+
value:
|
|
258
|
+
'linear(0 0%, 0.22 2.1%, 0.86 6.5%, 1.11 8.6%, 1.3 10.7%, 1.35 11.8%, 1.37 12.9%, 1.37 13.7%, 1.36 14.5%, 1.32 16.2%, 1.03 21.8%, 0.94 24%, 0.89 25.9%, 0.88 26.85%, 0.87 27.8%, 0.87 29.25%, 0.88 30.7%, 0.91 32.4%, 0.98 36.4%, 1.01 38.3%, 1.04 40.5%, 1.05 42.7%, 1.05 44.1%, 1.04 45.7%, 1 53.3%, 0.99 55.4%, 0.98 57.5%, 0.99 60.7%, 1 68.1%, 1.01 72.2%, 1 86.7%, 1 100%)',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'bounce',
|
|
262
|
+
value:
|
|
263
|
+
'linear(0 0%, 0 2.27%, 0.02 4.53%, 0.04 6.8%, 0.06 9.07%, 0.1 11.33%, 0.14 13.6%, 0.25 18.15%, 0.39 22.7%, 0.56 27.25%, 0.77 31.8%, 1 36.35%, 0.89 40.9%, 0.85 43.18%, 0.81 45.45%, 0.79 47.72%, 0.77 50%, 0.75 52.27%, 0.75 54.55%, 0.75 56.82%, 0.77 59.1%, 0.79 61.38%, 0.81 63.65%, 0.85 65.93%, 0.89 68.2%, 1 72.7%, 0.97 74.98%, 0.95 77.25%, 0.94 79.53%, 0.94 81.8%, 0.94 84.08%, 0.95 86.35%, 0.97 88.63%, 1 90.9%, 0.99 93.18%, 0.98 95.45%, 0.99 97.73%, 1 100%)',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: 'emphasized',
|
|
267
|
+
value:
|
|
268
|
+
'linear(0 0%, 0 1.8%, 0.01 3.6%, 0.03 6.35%, 0.07 9.1%, 0.13 11.4%, 0.19 13.4%, 0.27 15%, 0.34 16.1%, 0.54 18.35%, 0.66 20.6%, 0.72 22.4%, 0.77 24.6%, 0.81 27.3%, 0.85 30.4%, 0.88 35.1%, 0.92 40.6%, 0.94 47.2%, 0.96 55%, 0.98 64%, 0.99 74.4%, 1 86.4%, 1 100%)',
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
{name: 'ease-in-out', value: 'ease-in-out'},
|
|
273
|
+
{name: 'In Out · Sine', value: 'cubic-bezier(0.45, 0.05, 0.55, 0.95)'},
|
|
274
|
+
{name: 'In Out · Quadratic', value: 'cubic-bezier(0.46, 0.03, 0.52, 0.96)'},
|
|
275
|
+
{name: 'In Out · Cubic', value: 'cubic-bezier(0.65, 0.05, 0.36, 1)'},
|
|
276
|
+
{name: 'Fast Out, Slow In', value: 'cubic-bezier(0.4, 0, 0.2, 1)'},
|
|
277
|
+
{name: 'In Out · Back', value: 'cubic-bezier(0.68, -0.55, 0.27, 1.55)'},
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
{name: 'Fast Out, Linear In', value: 'cubic-bezier(0.4, 0, 1, 1)'},
|
|
281
|
+
{name: 'ease-in', value: 'ease-in'},
|
|
282
|
+
{name: 'In · Sine', value: 'cubic-bezier(0.47, 0, 0.75, 0.72)'},
|
|
283
|
+
{name: 'In · Quadratic', value: 'cubic-bezier(0.55, 0.09, 0.68, 0.53)'},
|
|
284
|
+
{name: 'In · Cubic', value: 'cubic-bezier(0.55, 0.06, 0.68, 0.19)'},
|
|
285
|
+
{name: 'In · Back', value: 'cubic-bezier(0.6, -0.28, 0.74, 0.05)'},
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
{name: 'ease-out', value: 'ease-out'},
|
|
289
|
+
{name: 'Out · Sine', value: 'cubic-bezier(0.39, 0.58, 0.57, 1)'},
|
|
290
|
+
{name: 'Out · Quadratic', value: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'},
|
|
291
|
+
{name: 'Out · Cubic', value: 'cubic-bezier(0.22, 0.61, 0.36, 1)'},
|
|
292
|
+
{name: 'Linear Out, Slow In', value: 'cubic-bezier(0, 0, 0.2, 1)'},
|
|
293
|
+
{name: 'Out · Back', value: 'cubic-bezier(0.18, 0.89, 0.32, 1.28)'},
|
|
294
|
+
],
|
|
295
|
+
];
|
|
292
296
|
export interface PresetCategory {
|
|
293
297
|
presets: Array<{
|
|
294
298
|
name: string,
|
|
@@ -6,7 +6,7 @@ import * as Platform from '../../../../core/platform/platform.js';
|
|
|
6
6
|
import * as Geometry from '../../../../models/geometry/geometry.js';
|
|
7
7
|
import * as UI from '../../legacy.js';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const CSSAngleRegex = /(?<value>[+-]?\d*\.?\d+)(?<unit>deg|grad|rad|turn)/;
|
|
10
10
|
|
|
11
11
|
export const enum AngleUnit {
|
|
12
12
|
DEG = 'deg',
|
|
@@ -19,8 +19,6 @@ import {
|
|
|
19
19
|
ObjectTree,
|
|
20
20
|
} from './ObjectPropertiesSection.js';
|
|
21
21
|
|
|
22
|
-
const {widget} = UI.Widget;
|
|
23
|
-
|
|
24
22
|
const UIStrings = {
|
|
25
23
|
/**
|
|
26
24
|
* @description Context menu item to show a custom formatted object as a standard JavaScript object.
|
|
@@ -30,18 +28,38 @@ const UIStrings = {
|
|
|
30
28
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/object_ui/CustomPreviewComponent.ts', UIStrings);
|
|
31
29
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
32
30
|
|
|
33
|
-
export class CustomPreviewSection {
|
|
34
|
-
|
|
35
|
-
private readonly object: SDK.RemoteObject.RemoteObject;
|
|
31
|
+
export class CustomPreviewSection extends UI.Widget.Widget {
|
|
32
|
+
#object?: SDK.RemoteObject.RemoteObject;
|
|
36
33
|
private expanded = false;
|
|
37
|
-
private cachedContent?: unknown|ObjectTree
|
|
34
|
+
private cachedContent?: unknown|ObjectTree;
|
|
38
35
|
private headerJsonML?: unknown;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
private readonly view: View;
|
|
37
|
+
|
|
38
|
+
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
39
|
+
super(element);
|
|
40
|
+
this.view = view;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get object(): SDK.RemoteObject.RemoteObject|undefined {
|
|
44
|
+
return this.#object;
|
|
45
|
+
}
|
|
44
46
|
|
|
47
|
+
set object(object: SDK.RemoteObject.RemoteObject|undefined) {
|
|
48
|
+
if (this.#object === object) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.#object = object;
|
|
52
|
+
this.headerJsonML = undefined;
|
|
53
|
+
this.cachedContent = undefined;
|
|
54
|
+
this.expanded = false;
|
|
55
|
+
this.parseHeader();
|
|
56
|
+
// CustomPreviewComponent is used synchronously by ConsoleViewMessage. We must render synchronously
|
|
57
|
+
// so ConsoleViewport can measure the true row height upon insertion.
|
|
58
|
+
this.performUpdate();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private parseHeader(): void {
|
|
62
|
+
const customPreview = this.#object?.customPreview();
|
|
45
63
|
if (!customPreview) {
|
|
46
64
|
return;
|
|
47
65
|
}
|
|
@@ -50,74 +68,88 @@ export class CustomPreviewSection {
|
|
|
50
68
|
this.headerJsonML = JSON.parse(customPreview.header);
|
|
51
69
|
} catch (e) {
|
|
52
70
|
Common.Console.Console.instance().error('Broken formatter: header is invalid json ' + e);
|
|
53
|
-
return;
|
|
54
71
|
}
|
|
55
|
-
this.render();
|
|
56
72
|
}
|
|
57
73
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
override performUpdate(): void {
|
|
75
|
+
this.view({
|
|
76
|
+
object: this.#object,
|
|
77
|
+
headerJsonML: this.headerJsonML,
|
|
78
|
+
expanded: this.expanded,
|
|
79
|
+
cachedContent: this.cachedContent,
|
|
80
|
+
toggleExpanded: this.toggleExpanded,
|
|
81
|
+
},
|
|
82
|
+
undefined, this.contentElement);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private toggleExpanded = (): void => {
|
|
86
|
+
if (this.cachedContent !== undefined) {
|
|
87
|
+
this.toggleExpand();
|
|
88
|
+
} else {
|
|
89
|
+
void this.loadBody();
|
|
62
90
|
}
|
|
91
|
+
};
|
|
63
92
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
bodyContent = html`<devtools-widget class="custom-expandable-section-default-body" ${
|
|
69
|
-
widget(ObjectPropertiesSectionWidget, {
|
|
70
|
-
objectTree: this.cachedContent,
|
|
71
|
-
showOverflow: false,
|
|
72
|
-
})}></devtools-widget>`;
|
|
73
|
-
} else if (this.cachedContent !== undefined) {
|
|
74
|
-
bodyContent = this.renderJSONMLTag(this.cachedContent);
|
|
75
|
-
}
|
|
93
|
+
private toggleExpand(): void {
|
|
94
|
+
this.expanded = !this.expanded;
|
|
95
|
+
this.performUpdate();
|
|
96
|
+
}
|
|
76
97
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
async loadBody(): Promise<void> {
|
|
99
|
+
const customPreview = this.#object?.customPreview();
|
|
100
|
+
if (!this.#object || !customPreview?.bodyGetterId) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const bodyJsonML =
|
|
105
|
+
await this.#object.callFunctionJSON(bodyGetter => bodyGetter(), [{objectId: customPreview.bodyGetterId}]);
|
|
106
|
+
if (bodyJsonML === null) {
|
|
107
|
+
// Per https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html#custom-formatter-structure
|
|
108
|
+
// we are supposed to fall back to the default format when the `body()` callback returns `null`.
|
|
109
|
+
const objectTree = new ObjectTree(this.#object, {
|
|
110
|
+
readOnly: true,
|
|
111
|
+
propertiesMode: ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
|
|
112
|
+
});
|
|
113
|
+
objectTree.expanded = true;
|
|
114
|
+
this.cachedContent = objectTree;
|
|
93
115
|
} else {
|
|
94
|
-
|
|
95
|
-
render(html`${headerTemplate}`, this.sectionElement);
|
|
116
|
+
this.cachedContent = bodyJsonML;
|
|
96
117
|
}
|
|
97
|
-
}
|
|
98
118
|
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
this.expanded = true;
|
|
120
|
+
this.performUpdate();
|
|
101
121
|
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const ALLOWED_TAGS = ['span', 'div', 'ol', 'li', 'table', 'tr', 'td'];
|
|
125
|
+
|
|
126
|
+
export interface ViewInput {
|
|
127
|
+
object?: SDK.RemoteObject.RemoteObject;
|
|
128
|
+
headerJsonML?: unknown;
|
|
129
|
+
expanded: boolean;
|
|
130
|
+
cachedContent?: unknown|ObjectTree|null;
|
|
131
|
+
toggleExpanded: () => void;
|
|
132
|
+
}
|
|
102
133
|
|
|
103
|
-
|
|
134
|
+
export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
|
|
135
|
+
const renderJSONMLTag = (object: SDK.RemoteObject.RemoteObject, jsonML: unknown): LitTemplate => {
|
|
104
136
|
if (!Array.isArray(jsonML)) {
|
|
105
137
|
return html`${String(jsonML)}`;
|
|
106
138
|
}
|
|
107
139
|
|
|
108
140
|
if (jsonML[0] !== 'object') {
|
|
109
|
-
return
|
|
141
|
+
return renderElement(object, jsonML);
|
|
110
142
|
}
|
|
111
143
|
if (jsonML.length !== 2) {
|
|
112
144
|
Common.Console.Console.instance().error('Broken formatter: object reference must contain exactly two elements');
|
|
113
145
|
return html`<span></span>`;
|
|
114
146
|
}
|
|
115
|
-
return
|
|
116
|
-
}
|
|
147
|
+
return layoutObjectTag(object, jsonML);
|
|
148
|
+
};
|
|
117
149
|
|
|
118
150
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
-
|
|
120
|
-
const it =
|
|
151
|
+
const renderElement = (object: SDK.RemoteObject.RemoteObject, jsonML: any[]): LitTemplate => {
|
|
152
|
+
const it = jsonML[Symbol.iterator]();
|
|
121
153
|
const tagName = it.next().value as string;
|
|
122
154
|
if (!ALLOWED_TAGS.includes(tagName)) {
|
|
123
155
|
Common.Console.Console.instance().error('Broken formatter: element ' + tagName + ' is not allowed!');
|
|
@@ -145,7 +177,7 @@ export class CustomPreviewSection {
|
|
|
145
177
|
|
|
146
178
|
const children: LitTemplate[] = [];
|
|
147
179
|
while (!next.done) {
|
|
148
|
-
children.push(
|
|
180
|
+
children.push(renderJSONMLTag(object, next.value));
|
|
149
181
|
next = it.next();
|
|
150
182
|
}
|
|
151
183
|
const style = Directives.styleMap(stylePropertyMap);
|
|
@@ -168,65 +200,65 @@ export class CustomPreviewSection {
|
|
|
168
200
|
default:
|
|
169
201
|
return html`<span>${children}</span>`;
|
|
170
202
|
}
|
|
171
|
-
}
|
|
203
|
+
};
|
|
172
204
|
|
|
173
|
-
|
|
205
|
+
const layoutObjectTag = (object: SDK.RemoteObject.RemoteObject, objectTag: unknown[]): LitTemplate => {
|
|
174
206
|
const it = objectTag[Symbol.iterator]();
|
|
175
207
|
it.next(); // skip 'object'
|
|
176
208
|
const attributes = it.next().value;
|
|
177
|
-
const remoteObject =
|
|
209
|
+
const remoteObject = object.runtimeModel().createRemoteObject((attributes as Protocol.Runtime.RemoteObject));
|
|
178
210
|
if (remoteObject.customPreview()) {
|
|
179
|
-
return html`${(
|
|
211
|
+
return html`${UI.Widget.widget(CustomPreviewSection, {object: remoteObject})}`;
|
|
180
212
|
}
|
|
181
213
|
|
|
182
214
|
return defaultObjectPresentation(remoteObject, undefined, undefined, undefined,
|
|
183
215
|
{'custom-expandable-section-standard-section': remoteObject.hasChildren});
|
|
184
|
-
}
|
|
216
|
+
};
|
|
185
217
|
|
|
186
|
-
|
|
218
|
+
const onClick = (event: Event): void => {
|
|
187
219
|
event.consume(true);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
} else {
|
|
191
|
-
void this.loadBody();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
220
|
+
input.toggleExpanded();
|
|
221
|
+
};
|
|
194
222
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
223
|
+
const object = input.object;
|
|
224
|
+
const customPreview = object?.customPreview();
|
|
225
|
+
if (!object || !customPreview || !input.headerJsonML) {
|
|
226
|
+
render(nothing, target);
|
|
227
|
+
return;
|
|
198
228
|
}
|
|
199
229
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
|
|
230
|
+
const headerTemplate = renderJSONMLTag(object, input.headerJsonML);
|
|
231
|
+
if (customPreview.bodyGetterId) {
|
|
232
|
+
let bodyContent: LitTemplate|Node|undefined;
|
|
233
|
+
if (input.cachedContent instanceof ObjectTree) {
|
|
234
|
+
bodyContent = html`<devtools-widget class="custom-expandable-section-default-body" ${
|
|
235
|
+
UI.Widget.widget(ObjectPropertiesSectionWidget, {
|
|
236
|
+
objectTree: input.cachedContent,
|
|
237
|
+
showOverflow: false,
|
|
238
|
+
})}></devtools-widget>`;
|
|
239
|
+
} else if (input.cachedContent) {
|
|
240
|
+
bodyContent = renderJSONMLTag(object, input.cachedContent);
|
|
205
241
|
}
|
|
206
242
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.expanded = true;
|
|
224
|
-
this.render();
|
|
225
|
-
}
|
|
243
|
+
render(html`
|
|
244
|
+
<span class=${Directives.classMap({'custom-expandable-section-header': true,
|
|
245
|
+
expanded: input.expanded})} @click=${onClick}>
|
|
246
|
+
<devtools-icon name=${
|
|
247
|
+
input.expanded ? 'triangle-down' : 'triangle-right'} class="custom-expand-icon"></devtools-icon>
|
|
248
|
+
${headerTemplate}
|
|
249
|
+
</span>
|
|
250
|
+
${
|
|
251
|
+
bodyContent ?
|
|
252
|
+
html`<span class="custom-expandable-section-body" ?hidden=${!input.expanded}>${bodyContent}</span>` :
|
|
253
|
+
nothing}
|
|
254
|
+
`,
|
|
255
|
+
target, {container: {classes: ['custom-expandable-section']}});
|
|
256
|
+
} else {
|
|
257
|
+
render(html`${headerTemplate}`, target, {container: {classes: ['custom-expandable-section']}});
|
|
226
258
|
}
|
|
227
|
-
}
|
|
259
|
+
};
|
|
228
260
|
|
|
229
|
-
|
|
261
|
+
export type View = typeof DEFAULT_VIEW;
|
|
230
262
|
|
|
231
263
|
export class CustomPreviewComponent {
|
|
232
264
|
private readonly object: SDK.RemoteObject.RemoteObject;
|
|
@@ -234,27 +266,27 @@ export class CustomPreviewComponent {
|
|
|
234
266
|
element: HTMLSpanElement;
|
|
235
267
|
constructor(object: SDK.RemoteObject.RemoteObject) {
|
|
236
268
|
this.object = object;
|
|
237
|
-
this.customPreviewSection = new CustomPreviewSection(
|
|
269
|
+
this.customPreviewSection = new CustomPreviewSection();
|
|
270
|
+
this.customPreviewSection.object = object;
|
|
238
271
|
this.element = document.createElement('span');
|
|
239
272
|
this.element.classList.add('source-code');
|
|
240
273
|
const shadowRoot = UI.UIUtils.createShadowRootWithCoreStyles(this.element, {cssFile: customPreviewComponentStyles});
|
|
241
274
|
this.element.addEventListener('contextmenu', this.contextMenuEventFired.bind(this), false);
|
|
242
|
-
|
|
275
|
+
this.customPreviewSection.show(shadowRoot, undefined, /* suppressOrphanWidgetError= */ true);
|
|
243
276
|
}
|
|
244
277
|
|
|
245
|
-
expandIfPossible(): void {
|
|
278
|
+
async expandIfPossible(): Promise<void> {
|
|
246
279
|
const customPreview = this.object.customPreview();
|
|
247
280
|
if (customPreview && customPreview.bodyGetterId && this.customPreviewSection) {
|
|
248
|
-
|
|
281
|
+
await this.customPreviewSection.loadBody();
|
|
249
282
|
}
|
|
250
283
|
}
|
|
251
284
|
|
|
252
285
|
private contextMenuEventFired(event: Event): void {
|
|
253
286
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
254
287
|
if (this.customPreviewSection) {
|
|
255
|
-
contextMenu.revealSection().appendItem(
|
|
256
|
-
|
|
257
|
-
{jslogContext: 'show-as-javascript-object'});
|
|
288
|
+
contextMenu.revealSection().appendItem(i18nString(UIStrings.showAsJavascriptObject), this.disassemble.bind(this),
|
|
289
|
+
{jslogContext: 'show-as-javascript-object'});
|
|
258
290
|
}
|
|
259
291
|
contextMenu.appendApplicableItems(this.object);
|
|
260
292
|
void contextMenu.show();
|
|
@@ -262,8 +294,11 @@ export class CustomPreviewComponent {
|
|
|
262
294
|
|
|
263
295
|
private disassemble(): void {
|
|
264
296
|
if (this.element.shadowRoot) {
|
|
297
|
+
if (this.customPreviewSection) {
|
|
298
|
+
this.customPreviewSection.detach();
|
|
299
|
+
this.customPreviewSection = null;
|
|
300
|
+
}
|
|
265
301
|
this.element.shadowRoot.textContent = '';
|
|
266
|
-
this.customPreviewSection = null;
|
|
267
302
|
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
268
303
|
render(defaultObjectPresentation(this.object), this.element.shadowRoot);
|
|
269
304
|
}
|
|
@@ -58,7 +58,7 @@ export class ObjectPopoverHelper {
|
|
|
58
58
|
|
|
59
59
|
if (result.customPreview()) {
|
|
60
60
|
const customPreviewComponent = new CustomPreviewComponent(result);
|
|
61
|
-
customPreviewComponent.expandIfPossible();
|
|
61
|
+
void customPreviewComponent.expandIfPossible();
|
|
62
62
|
popoverContentElement = customPreviewComponent.element;
|
|
63
63
|
} else {
|
|
64
64
|
popoverContentElement = document.createElement('div');
|
|
@@ -1301,7 +1301,7 @@ export function populateObjectTreeContextMenu(
|
|
|
1301
1301
|
{checked: object.includeNullOrUndefinedValues, jslogContext: 'show-all'});
|
|
1302
1302
|
}
|
|
1303
1303
|
|
|
1304
|
-
interface ObjectTreeViewInput {
|
|
1304
|
+
export interface ObjectTreeViewInput {
|
|
1305
1305
|
renderAsSubtree: boolean;
|
|
1306
1306
|
objectTree?: ObjectTree;
|
|
1307
1307
|
linkifier?: Components.Linkifier.Linkifier;
|
|
@@ -1309,7 +1309,7 @@ interface ObjectTreeViewInput {
|
|
|
1309
1309
|
skipProto: boolean;
|
|
1310
1310
|
onExpand: (expanded: boolean) => void;
|
|
1311
1311
|
}
|
|
1312
|
-
type ObjectTreeView = (input: ObjectTreeViewInput, output: object, target: HTMLElement) => void;
|
|
1312
|
+
export type ObjectTreeView = (input: ObjectTreeViewInput, output: object, target: HTMLElement) => void;
|
|
1313
1313
|
export const OBJECT_TREE_DEFAULT_VIEW: ObjectTreeView = (input, output, target) => {
|
|
1314
1314
|
const objectTree = input.objectTree;
|
|
1315
1315
|
if (!objectTree) {
|
|
@@ -1351,7 +1351,7 @@ export class ObjectTreeWidget extends UI.Widget.Widget {
|
|
|
1351
1351
|
#skipProto = false;
|
|
1352
1352
|
readonly #view: ObjectTreeView;
|
|
1353
1353
|
|
|
1354
|
-
constructor(element?: HTMLElement, view = OBJECT_TREE_DEFAULT_VIEW) {
|
|
1354
|
+
constructor(element?: HTMLElement, view: ObjectTreeView = OBJECT_TREE_DEFAULT_VIEW) {
|
|
1355
1355
|
super(element);
|
|
1356
1356
|
this.#view = view;
|
|
1357
1357
|
}
|
|
@@ -1676,12 +1676,12 @@ export interface ObjectPropertyViewInput {
|
|
|
1676
1676
|
node: ObjectTreeNode;
|
|
1677
1677
|
search?: UI.TreeOutline.TreeSearch<ObjectTreeNodeBase>;
|
|
1678
1678
|
}
|
|
1679
|
-
interface ObjectPropertyViewOutput {
|
|
1679
|
+
export interface ObjectPropertyViewOutput {
|
|
1680
1680
|
valueElement: Element|undefined;
|
|
1681
1681
|
nameElement: Element|undefined;
|
|
1682
1682
|
}
|
|
1683
|
-
type ObjectPropertyView =
|
|
1684
|
-
void;
|
|
1683
|
+
export type ObjectPropertyView =
|
|
1684
|
+
(input: ObjectPropertyViewInput, output: ObjectPropertyViewOutput, target: HTMLElement) => void;
|
|
1685
1685
|
export const OBJECT_PROPERTY_DEFAULT_VIEW: ObjectPropertyView = (input, output, target) => {
|
|
1686
1686
|
const {property} = input.node;
|
|
1687
1687
|
const isInternalEntries = property.synthetic && input.node.name === '[[Entries]]';
|
|
@@ -1807,7 +1807,7 @@ export class ObjectPropertyWidget extends UI.Widget.Widget {
|
|
|
1807
1807
|
#editable = false;
|
|
1808
1808
|
#search?: UI.TreeOutline.TreeSearch<ObjectTreeNodeBase>;
|
|
1809
1809
|
|
|
1810
|
-
constructor(target?: HTMLElement, view = OBJECT_PROPERTY_DEFAULT_VIEW) {
|
|
1810
|
+
constructor(target?: HTMLElement, view: ObjectPropertyView = OBJECT_PROPERTY_DEFAULT_VIEW) {
|
|
1811
1811
|
super(target);
|
|
1812
1812
|
this.#view = view;
|
|
1813
1813
|
}
|
|
@@ -2522,7 +2522,7 @@ export class ArrayGroupingTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2522
2522
|
static sparseIterationThreshold = 250000;
|
|
2523
2523
|
}
|
|
2524
2524
|
|
|
2525
|
-
interface ExpandableTextViewInput {
|
|
2525
|
+
export interface ExpandableTextViewInput {
|
|
2526
2526
|
copyText: () => void;
|
|
2527
2527
|
expandText: () => void;
|
|
2528
2528
|
expanded: boolean;
|
|
@@ -2530,7 +2530,7 @@ interface ExpandableTextViewInput {
|
|
|
2530
2530
|
byteCount: number;
|
|
2531
2531
|
text: string;
|
|
2532
2532
|
}
|
|
2533
|
-
type ExpandableTextView = (input: ExpandableTextViewInput, output: object, target: HTMLElement) => void;
|
|
2533
|
+
export type ExpandableTextView = (input: ExpandableTextViewInput, output: object, target: HTMLElement) => void;
|
|
2534
2534
|
export const EXPANDABLE_TEXT_DEFAULT_VIEW: ExpandableTextView = (input, output, target) => {
|
|
2535
2535
|
const totalBytesText = i18n.ByteUtilities.bytesToString(input.byteCount);
|
|
2536
2536
|
const canExpand = input.text.length < ExpandableTextPropertyValue.MAX_DISPLAYABLE_TEXT_LENGTH;
|
|
@@ -2588,7 +2588,7 @@ export class ExpandableTextPropertyValue extends UI.Widget.Widget {
|
|
|
2588
2588
|
#maxLength = ExpandableTextPropertyValue.EXPANDABLE_MAX_LENGTH;
|
|
2589
2589
|
readonly #view: ExpandableTextView;
|
|
2590
2590
|
|
|
2591
|
-
constructor(target?: HTMLElement, view = EXPANDABLE_TEXT_DEFAULT_VIEW) {
|
|
2591
|
+
constructor(target?: HTMLElement, view: ExpandableTextView = EXPANDABLE_TEXT_DEFAULT_VIEW) {
|
|
2592
2592
|
super(target);
|
|
2593
2593
|
this.#view = view;
|
|
2594
2594
|
}
|
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
* found in the LICENSE file.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
.root {
|
|
8
12
|
align-items: flex-start; /* keep chart at top so it doesnt change position as the legend changes height */
|
|
13
|
+
gap: var(--sys-size-6) 30px;
|
|
9
14
|
display: flex;
|
|
10
|
-
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
justify-content: flex-start;
|
|
11
17
|
white-space: nowrap;
|
|
12
18
|
}
|
|
13
19
|
|
|
@@ -48,10 +54,6 @@
|
|
|
48
54
|
stroke-linejoin: round;
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
.pie-chart-legend {
|
|
52
|
-
margin-left: 30px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
57
|
.pie-chart-legend-row {
|
|
56
58
|
margin: 5px var(--sys-size-2) 5px auto;
|
|
57
59
|
padding-right: 25px;
|