chrome-devtools-frontend 1.0.1654411 → 1.0.1656897
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/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +116 -0
- package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +82 -0
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +123 -0
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +125 -0
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +75 -0
- package/AUTHORS +1 -0
- package/config/owner/COMMON_OWNERS +0 -4
- package/docs/playbook.md +1 -1
- package/front_end/Tests.js +1 -0
- package/front_end/core/common/Settings.ts +47 -30
- package/front_end/core/sdk/CPUThrottlingManager.ts +10 -159
- package/front_end/core/sdk/ConsoleModel.ts +13 -11
- package/front_end/core/sdk/DOMDebuggerModel.ts +11 -5
- package/front_end/core/sdk/DOMModel.ts +7 -5
- package/front_end/core/sdk/EventBreakpointsModel.ts +9 -5
- package/front_end/core/sdk/IsolateManager.ts +6 -6
- package/front_end/core/sdk/ResourceTreeModel.ts +5 -3
- package/front_end/core/sdk/SourceMapCache.ts +2 -4
- package/front_end/core/sdk/SourceMapManager.ts +8 -7
- package/front_end/core/sdk/TargetManager.ts +17 -0
- package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +12 -36
- package/front_end/entrypoints/main/SimpleApp.ts +0 -13
- package/front_end/entrypoints/main/main-meta.ts +1 -1
- package/front_end/foundation/Universe.ts +110 -3
- package/front_end/generated/InspectorBackendCommands.ts +5 -1
- package/front_end/generated/SupportedCSSProperties.js +2 -6
- package/front_end/generated/protocol-mapping.d.ts +8 -0
- package/front_end/generated/protocol-proxy-api.d.ts +15 -0
- package/front_end/generated/protocol.ts +36 -1
- package/front_end/models/ai_assistance/AiConversation.ts +0 -6
- package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -156
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -358
- package/front_end/models/ai_assistance/ai_assistance.ts +0 -6
- package/front_end/models/ai_assistance/contexts/RequestContext.snapshot.txt +0 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +0 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -14
- package/front_end/models/autofill_manager/AutofillManager.ts +1 -2
- package/front_end/models/crux-manager/CrUXManager.ts +16 -11
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +14 -13
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +12 -9
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +18 -9
- package/front_end/models/project_settings/ProjectSettingsModel.ts +12 -11
- package/front_end/models/trace/handlers/ScreenshotsHandler.ts +14 -59
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +3 -29
- package/front_end/panels/application/DeviceBoundSessionsView.ts +15 -3
- package/front_end/panels/application/FrameDetailsView.ts +2 -1
- package/front_end/panels/application/ServiceWorkersView.ts +193 -161
- package/front_end/panels/application/serviceWorkersView.css +8 -0
- package/front_end/panels/common/CPUThrottlingOption.ts +142 -0
- package/front_end/panels/common/ThrottlingUtils.ts +9 -4
- package/front_end/panels/common/common.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +45 -0
- package/front_end/panels/elements/ElementsPanel.ts +35 -102
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -4
- package/front_end/panels/elements/elements-meta.ts +3 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +46 -45
- package/front_end/panels/mobile_throttling/CalibrationController.ts +6 -5
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +40 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +13 -17
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +15 -13
- package/front_end/panels/network/NetworkLogView.ts +0 -9
- package/front_end/panels/network/NetworkPanel.ts +1 -63
- package/front_end/panels/network/RequestInitiatorView.ts +29 -4
- package/front_end/panels/network/components/HeaderSectionRow.css +9 -7
- package/front_end/panels/network/components/HeaderSectionRow.ts +20 -1
- package/front_end/panels/network/components/RequestHeaderSection.css +5 -3
- package/front_end/panels/network/components/RequestHeaderSection.ts +1 -2
- package/front_end/panels/network/components/RequestHeadersView.css +1 -1
- package/front_end/panels/security/SecurityPanel.ts +36 -23
- package/front_end/panels/settings/SettingsScreen.ts +18 -103
- package/front_end/panels/settings/settings-meta.ts +0 -24
- package/front_end/panels/timeline/TimelineController.ts +3 -2
- package/front_end/panels/timeline/TimelinePanel.ts +20 -3
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +15 -14
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -0
- package/front_end/panels/utils/utils.ts +25 -24
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +96 -83
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +10 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +23 -13
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Input.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts +3 -41
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -3
- package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/api/Realm.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/api/Target.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/Realm.ts +1 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +13 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +24 -13
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/LifecycleWatcher.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -76
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +5 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/util/httpUtils.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +3 -0
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -7
- package/front_end/ui/helpers/OpenInNewTab.ts +15 -7
- package/front_end/ui/legacy/TabbedPane.ts +1 -108
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -0
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +172 -123
- package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +89 -0
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +10 -0
- package/front_end/ui/legacy/components/data_grid/data_grid.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +89 -40
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
- package/front_end/Images/navigationControls.png +0 -0
- package/front_end/Images/navigationControls_2x.png +0 -0
- package/front_end/Images/popoverArrows.png +0 -0
- package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -746
- package/front_end/entrypoints/greendev_floaty/floaty.css +0 -301
- package/front_end/entrypoints/greendev_floaty/floaty.html +0 -38
- package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -415
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +0 -834
- package/front_end/models/ai_assistance/agents/GreenDevAgentAntigravityCliSocketClient.ts +0 -53
- package/front_end/models/ai_assistance/agents/GreenDevAgentGeminiCliSocketClient.ts +0 -117
- package/front_end/models/annotations/AnnotationRepository.ts +0 -238
- package/front_end/models/annotations/AnnotationType.ts +0 -10
- package/front_end/models/annotations/README.md +0 -7
- package/front_end/models/annotations/annotations.ts +0 -6
- package/front_end/models/greendev/Prototypes.ts +0 -68
- package/front_end/models/greendev/README.md +0 -5
- package/front_end/models/greendev/greendev.ts +0 -5
- package/front_end/panels/common/Annotation.ts +0 -184
- package/front_end/panels/common/AnnotationManager.ts +0 -208
- package/front_end/panels/common/annotation.css +0 -40
- package/front_end/panels/greendev/GreenDevPanel.css +0 -282
- package/front_end/panels/greendev/GreenDevPanel.ts +0 -364
- package/front_end/panels/greendev/GreenDevShared.ts +0 -13
- package/front_end/panels/greendev/greendev-meta.ts +0 -52
- package/front_end/panels/greendev/greendev.ts +0 -9
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
6
|
-
|
|
7
|
-
import * as Annotations from '../../models/annotations/annotations.js';
|
|
8
|
-
import * as UI from '../../ui/legacy/legacy.js';
|
|
9
|
-
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
|
10
|
-
import {html, nothing, render} from '../../ui/lit/lit.js';
|
|
11
|
-
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
12
|
-
|
|
13
|
-
import annotationStyles from './annotation.css.js';
|
|
14
|
-
|
|
15
|
-
// This class handles drawing of Annotations for the GreenDev project, but
|
|
16
|
-
// is not for general use (at the moment).
|
|
17
|
-
//
|
|
18
|
-
// **Important**: all of this functionality is behind the GreenDev flag. We
|
|
19
|
-
// have **no intention** of pushing this feature live in this state. This
|
|
20
|
-
// is code landing to user test in Canary that will not ship without an
|
|
21
|
-
// additional project to make this code fully production worthy. That is
|
|
22
|
-
// why this CL has no tests, for example.
|
|
23
|
-
|
|
24
|
-
// The label is angled on the left from the centre of the entry it belongs to.
|
|
25
|
-
// `LABEL_AND_CONNECTOR_SHIFT_LENGTH` specifies how many pixels to the left it is shifted.
|
|
26
|
-
const LABEL_AND_CONNECTOR_SHIFT_LENGTH = 8;
|
|
27
|
-
// Length of the line that connects the label to the entry.
|
|
28
|
-
const LABEL_CONNECTOR_HEIGHT = 7;
|
|
29
|
-
|
|
30
|
-
interface ViewInput {
|
|
31
|
-
inputText: string;
|
|
32
|
-
isExpanded: boolean;
|
|
33
|
-
anchored: boolean;
|
|
34
|
-
expandable: boolean;
|
|
35
|
-
showCloseButton: boolean;
|
|
36
|
-
clickHandler: () => void;
|
|
37
|
-
closeHandler: () => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
41
|
-
|
|
42
|
-
export const DEFAULT_VIEW: View = (input, _, target) => {
|
|
43
|
-
const {inputText: label, isExpanded, anchored, expandable, showCloseButton, clickHandler, closeHandler} = input;
|
|
44
|
-
|
|
45
|
-
// TODO(finnur): Use `x`, and `y` passed via `input` to set the coordinates for the
|
|
46
|
-
// *Widget* (not the `overlay` div), then remove the `this.element.style` calls and
|
|
47
|
-
// remove the lint override no-imperative-dom-api from the top.
|
|
48
|
-
const connectorColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
|
|
49
|
-
|
|
50
|
-
const overlayStyles = [
|
|
51
|
-
anchored ? 'left: 17px; top: 11px;' : '',
|
|
52
|
-
!expandable ? 'pointer-events: none;' : '',
|
|
53
|
-
].join(' ');
|
|
54
|
-
|
|
55
|
-
// clang-format off
|
|
56
|
-
render(html`
|
|
57
|
-
<style>${annotationStyles}</style>
|
|
58
|
-
${anchored ? html`
|
|
59
|
-
<svg class="connectorContainer"
|
|
60
|
-
width=${LABEL_AND_CONNECTOR_SHIFT_LENGTH * 2}
|
|
61
|
-
height=${LABEL_CONNECTOR_HEIGHT}>
|
|
62
|
-
<line
|
|
63
|
-
x1=${LABEL_AND_CONNECTOR_SHIFT_LENGTH}
|
|
64
|
-
y1=0
|
|
65
|
-
x2=${LABEL_AND_CONNECTOR_SHIFT_LENGTH * 2}
|
|
66
|
-
y2=${LABEL_CONNECTOR_HEIGHT}
|
|
67
|
-
stroke=${connectorColor}
|
|
68
|
-
stroke-width=2
|
|
69
|
-
/>
|
|
70
|
-
<circle
|
|
71
|
-
cx=${LABEL_AND_CONNECTOR_SHIFT_LENGTH}
|
|
72
|
-
cy=0
|
|
73
|
-
r=3
|
|
74
|
-
fill=${connectorColor}
|
|
75
|
-
/>
|
|
76
|
-
</svg>
|
|
77
|
-
` : nothing}
|
|
78
|
-
<div class='overlay' style=${overlayStyles} @click=${expandable ? clickHandler : null}>
|
|
79
|
-
${isExpanded ? label : '!'}
|
|
80
|
-
</div>
|
|
81
|
-
${showCloseButton ?
|
|
82
|
-
html`<svg @click=${closeHandler} class="close-button" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
83
|
-
<circle cx="8" cy="8" r="7.5" fill="#EEE" stroke="#888"/>
|
|
84
|
-
<path d="M5 5L11 11M5 11L11 5" stroke="#888" stroke-width="2"/>
|
|
85
|
-
</svg>` : nothing}
|
|
86
|
-
`, target);
|
|
87
|
-
// clang-format on
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export class Annotation extends UI.Widget.Widget {
|
|
91
|
-
readonly #view: View;
|
|
92
|
-
readonly #id: number;
|
|
93
|
-
#inputText: string;
|
|
94
|
-
#x = 0;
|
|
95
|
-
#y = 0;
|
|
96
|
-
#isExpanded = false;
|
|
97
|
-
#hasShown = false;
|
|
98
|
-
#anchored = false;
|
|
99
|
-
#expandable = false;
|
|
100
|
-
#showCloseButton = false;
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
id: number, label: string, showExpanded: boolean, anchored: boolean, expandable: boolean,
|
|
104
|
-
showCloseButton: boolean, view = DEFAULT_VIEW) {
|
|
105
|
-
super({jslog: `${VisualLogging.panel('annotation').track({resize: true})}`, useShadowDom: true});
|
|
106
|
-
this.#id = id;
|
|
107
|
-
this.#view = view;
|
|
108
|
-
this.#isExpanded = showExpanded;
|
|
109
|
-
this.#inputText = label;
|
|
110
|
-
this.#anchored = anchored;
|
|
111
|
-
this.#expandable = expandable;
|
|
112
|
-
this.#showCloseButton = showCloseButton;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#toggle(): void {
|
|
116
|
-
this.#isExpanded = !this.#isExpanded;
|
|
117
|
-
this.requestUpdate();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
#closeHandler(): void {
|
|
121
|
-
this.hide();
|
|
122
|
-
Annotations.AnnotationRepository.instance().deleteAnnotation(this.#id);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
override wasShown(): void {
|
|
126
|
-
this.element.style.position = 'absolute';
|
|
127
|
-
this.element.style.left = `${this.#x}px`;
|
|
128
|
-
this.element.style.top = `${this.#y}px`;
|
|
129
|
-
super.wasShown();
|
|
130
|
-
this.#hasShown = true;
|
|
131
|
-
this.requestUpdate();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
override performUpdate(): void {
|
|
135
|
-
if (!this.isShowing()) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const input = {
|
|
139
|
-
inputText: this.#inputText,
|
|
140
|
-
isExpanded: this.#isExpanded,
|
|
141
|
-
anchored: this.#anchored,
|
|
142
|
-
expandable: this.#expandable,
|
|
143
|
-
showCloseButton: this.#showCloseButton,
|
|
144
|
-
x: this.#x,
|
|
145
|
-
y: this.#y,
|
|
146
|
-
clickHandler: this.#toggle.bind(this),
|
|
147
|
-
closeHandler: this.#closeHandler.bind(this),
|
|
148
|
-
};
|
|
149
|
-
this.#view(input, undefined, this.contentElement);
|
|
150
|
-
|
|
151
|
-
if (this.#showCloseButton) {
|
|
152
|
-
const overlay = this.contentElement.querySelector('.overlay') as HTMLElement | null;
|
|
153
|
-
const closeButton = this.contentElement.querySelector('.close-button') as HTMLElement | null;
|
|
154
|
-
if (overlay && closeButton) {
|
|
155
|
-
const overlayLeft = parseFloat(overlay.style.left || '0');
|
|
156
|
-
const overlayWidth = overlay.getBoundingClientRect().width;
|
|
157
|
-
// Position the button to the right of the overlay, adjusting for button width.
|
|
158
|
-
closeButton.style.left = `${overlayLeft + overlayWidth - 16}px`;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
hide(): void {
|
|
164
|
-
this.detach();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
getCoordinates(): {x: number, y: number} {
|
|
168
|
-
return {x: this.#x, y: this.#y};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
setCoordinates(x: number, y: number): void {
|
|
172
|
-
this.#x = x;
|
|
173
|
-
this.#y = y;
|
|
174
|
-
if (this.isShowing()) {
|
|
175
|
-
this.element.style.left = `${this.#x}px`;
|
|
176
|
-
this.element.style.top = `${this.#y}px`;
|
|
177
|
-
}
|
|
178
|
-
this.requestUpdate();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
hasShown(): boolean {
|
|
182
|
-
return this.#hasShown;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import type * as Common from '../../core/common/common.js';
|
|
6
|
-
import type * as SDK from '../../core/sdk/sdk.js';
|
|
7
|
-
import * as Annotations from '../../models/annotations/annotations.js';
|
|
8
|
-
|
|
9
|
-
import {Annotation} from './Annotation.js';
|
|
10
|
-
|
|
11
|
-
interface AnnotationData {
|
|
12
|
-
id: number;
|
|
13
|
-
type: Annotations.AnnotationType;
|
|
14
|
-
annotation: Annotation;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface AnnotationPlacement {
|
|
18
|
-
parentElement: Element;
|
|
19
|
-
insertBefore?: Node|null;
|
|
20
|
-
resolveInitialState:
|
|
21
|
-
(parentElement: Element, reveal: boolean, lookupId: string,
|
|
22
|
-
anchor?: SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest) => Promise<{x: number, y: number}|null>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// This class handles general management of Annotations, the data needed to display them and any panel-specific things
|
|
26
|
-
// that the AnnotationRepository must be free from. It is created on-demand the first time a panel, that wants to show
|
|
27
|
-
// an Annotation, appears.
|
|
28
|
-
//
|
|
29
|
-
// NOTE: For now this class is not for general use and is inactive (unless a specific flag is supplied).
|
|
30
|
-
export class AnnotationManager {
|
|
31
|
-
static #instance: AnnotationManager|null = null;
|
|
32
|
-
|
|
33
|
-
#annotationPlacements: Map<Annotations.AnnotationType, AnnotationPlacement>|null = null;
|
|
34
|
-
#annotations = new Map<number, AnnotationData>();
|
|
35
|
-
#synced = false;
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
if (!Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
39
|
-
console.warn('AnnotationManager created with annotations disabled');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
Annotations.AnnotationRepository.instance().addEventListener(
|
|
44
|
-
Annotations.Events.ANNOTATION_ADDED, this.#onAnnotationAdded, this);
|
|
45
|
-
Annotations.AnnotationRepository.instance().addEventListener(
|
|
46
|
-
Annotations.Events.ANNOTATION_DELETED, this.#onAnnotationDeleted, this);
|
|
47
|
-
Annotations.AnnotationRepository.instance().addEventListener(
|
|
48
|
-
Annotations.Events.ALL_ANNOTATIONS_DELETED, this.#onAllAnnotationsDeleted, this);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static instance(): AnnotationManager {
|
|
52
|
-
if (!AnnotationManager.#instance) {
|
|
53
|
-
AnnotationManager.#instance = new AnnotationManager();
|
|
54
|
-
}
|
|
55
|
-
return AnnotationManager.#instance;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
initializePlacementForAnnotationType(
|
|
59
|
-
type: Annotations.AnnotationType,
|
|
60
|
-
resolveInitialState:
|
|
61
|
-
(parentElement: Element, reveal: boolean, lookupId: string,
|
|
62
|
-
anchor?: SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest) => Promise<{x: number, y: number}|null>,
|
|
63
|
-
parentElement: Element, insertBefore: Node|null = null): void {
|
|
64
|
-
if (!Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!this.#annotationPlacements) {
|
|
69
|
-
this.#annotationPlacements = new Map();
|
|
70
|
-
}
|
|
71
|
-
this.#annotationPlacements.set(type, {parentElement, insertBefore, resolveInitialState});
|
|
72
|
-
|
|
73
|
-
// eslint-disable-next-line no-console
|
|
74
|
-
console.log(
|
|
75
|
-
`[AnnotationManager] initializing placement for ${Annotations.AnnotationType[type]}`, {parentElement},
|
|
76
|
-
'placement count:', this.#annotationPlacements);
|
|
77
|
-
|
|
78
|
-
this.#syncAnnotations();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#syncAnnotations(): void {
|
|
82
|
-
if (this.#synced) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// eslint-disable-next-line no-console
|
|
87
|
-
console.log('[AnnotationManager] **** SYNC STARTED ***');
|
|
88
|
-
const repository = Annotations.AnnotationRepository.instance();
|
|
89
|
-
for (const type of Object.values(Annotations.AnnotationType)) {
|
|
90
|
-
for (const annotation of repository.getAnnotationDataByType(type as Annotations.AnnotationType)) {
|
|
91
|
-
// eslint-disable-next-line no-console
|
|
92
|
-
console.log(
|
|
93
|
-
'[AnnotationManager] Available annotation:', annotation,
|
|
94
|
-
'need sync:', !this.#annotations.has(annotation.id));
|
|
95
|
-
if (!this.#annotations.has(annotation.id)) {
|
|
96
|
-
this.#addAnnotation(annotation);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
this.#synced = true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
#onAllAnnotationsDeleted(): void {
|
|
104
|
-
for (const annotation of this.#annotations.values()) {
|
|
105
|
-
annotation.annotation.hide();
|
|
106
|
-
}
|
|
107
|
-
this.#annotations = new Map();
|
|
108
|
-
// eslint-disable-next-line no-console
|
|
109
|
-
console.log('[AnnotationManager] deleted all annotations');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
#onAnnotationDeleted(
|
|
113
|
-
event: Common.EventTarget.EventTargetEvent<Annotations.EventTypes[Annotations.Events.ANNOTATION_DELETED]>): void {
|
|
114
|
-
const {id} = event.data;
|
|
115
|
-
const annotation = this.#annotations.get(id);
|
|
116
|
-
if (annotation) {
|
|
117
|
-
annotation.annotation.hide();
|
|
118
|
-
this.#annotations.delete(id);
|
|
119
|
-
}
|
|
120
|
-
// eslint-disable-next-line no-console
|
|
121
|
-
console.log(`[AnnotationManager] Deleted annotation with id ${id}`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
#onAnnotationAdded(
|
|
125
|
-
event: Common.EventTarget.EventTargetEvent<Annotations.EventTypes[Annotations.Events.ANNOTATION_ADDED]>): void {
|
|
126
|
-
const annotationData = event.data;
|
|
127
|
-
// eslint-disable-next-line no-console
|
|
128
|
-
console.log('[AnnotationManager] handleAddAnnotation', annotationData);
|
|
129
|
-
this.#addAnnotation(annotationData);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
#addAnnotation(annotationData: Annotations.BaseAnnotationData): void {
|
|
133
|
-
const expandable = annotationData.type !== Annotations.AnnotationType.NETWORK_REQUEST;
|
|
134
|
-
const showExpanded = annotationData.type !== Annotations.AnnotationType.NETWORK_REQUEST;
|
|
135
|
-
const showAnchored = annotationData.type !== Annotations.AnnotationType.NETWORK_REQUEST;
|
|
136
|
-
const showCloseButton = annotationData.type !== Annotations.AnnotationType.NETWORK_REQUEST;
|
|
137
|
-
const annotation = new Annotation(
|
|
138
|
-
annotationData.id, annotationData.message, showExpanded, showAnchored, expandable, showCloseButton);
|
|
139
|
-
this.#annotations.set(annotationData.id, {id: annotationData.id, type: annotationData.type, annotation});
|
|
140
|
-
// eslint-disable-next-line no-console
|
|
141
|
-
console.log('[AnnotationManager] addAnnotation called. Annotations now', this.#annotations);
|
|
142
|
-
requestAnimationFrame(async () => {
|
|
143
|
-
await this.#resolveAnnotationWithId(annotationData.id);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async resolveAnnotationsOfType(type: Annotations.AnnotationType): Promise<void> {
|
|
148
|
-
for (const annotationData of this.#annotations.values()) {
|
|
149
|
-
if (annotationData.type === type) {
|
|
150
|
-
await this.#resolveAnnotationWithId(annotationData.id);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async #resolveAnnotationWithId(id: number): Promise<void> {
|
|
156
|
-
const annotation = this.#annotations.get(id);
|
|
157
|
-
if (!annotation) {
|
|
158
|
-
console.warn('Unable to find annotation with id', id, ' in annotations map', this.#annotations);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const placement = this.#annotationPlacements?.get(annotation.type);
|
|
163
|
-
if (!placement) {
|
|
164
|
-
console.warn(
|
|
165
|
-
'Unable to find placement for annotation with id', id,
|
|
166
|
-
'(note: this is expected if its panel hasn\'t been shown yet).');
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let position = undefined;
|
|
171
|
-
const annotationRegistration = Annotations.AnnotationRepository.instance().getAnnotationDataById(id);
|
|
172
|
-
const reveal = !annotation.annotation.hasShown();
|
|
173
|
-
switch (annotationRegistration?.type) {
|
|
174
|
-
case Annotations.AnnotationType.ELEMENT_NODE: {
|
|
175
|
-
const elementData = annotationRegistration as Annotations.ElementsAnnotationData;
|
|
176
|
-
position = await placement.resolveInitialState(
|
|
177
|
-
placement.parentElement, reveal, elementData.lookupId, elementData.anchor);
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
case Annotations.AnnotationType.NETWORK_REQUEST: {
|
|
181
|
-
const networkRequestData = annotationRegistration as Annotations.NetworkRequestAnnotationData;
|
|
182
|
-
position = await placement.resolveInitialState(
|
|
183
|
-
placement.parentElement, reveal, networkRequestData.lookupId, networkRequestData.anchor);
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
case Annotations.AnnotationType.NETWORK_REQUEST_SUBPANEL_HEADERS: {
|
|
187
|
-
const networkRequestDetailsData = annotationRegistration as Annotations.NetworkRequestDetailsAnnotationData;
|
|
188
|
-
position = await placement.resolveInitialState(
|
|
189
|
-
placement.parentElement, reveal, networkRequestDetailsData.lookupId, networkRequestDetailsData.anchor);
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
default:
|
|
193
|
-
console.warn('[AnnotationManager] Unknown AnnotationType', annotationRegistration?.type);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (!position) {
|
|
197
|
-
// eslint-disable-next-line no-console
|
|
198
|
-
console.log(`Unable to calculate position for annotation with id ${annotationRegistration?.id}`);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
annotation.annotation.setCoordinates(position.x, position.y);
|
|
203
|
-
|
|
204
|
-
if (!annotation.annotation.isShowing()) {
|
|
205
|
-
annotation.annotation.show(placement.parentElement, placement.insertBefore);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Chromium Authors
|
|
3
|
-
* Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
.overlay {
|
|
8
|
-
position: absolute;
|
|
9
|
-
z-index: 1000;
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
align-items: center;
|
|
13
|
-
|
|
14
|
-
/* From the other bubble */
|
|
15
|
-
background-color: var(--color-background-inverted);
|
|
16
|
-
color: var(--color-background);
|
|
17
|
-
pointer-events: auto;
|
|
18
|
-
border-radius: var(--sys-shape-corner-extra-small);
|
|
19
|
-
white-space: pre-wrap;
|
|
20
|
-
max-width: 300px;
|
|
21
|
-
width: max-content;
|
|
22
|
-
padding: var(--sys-size-3) var(--sys-size-4);
|
|
23
|
-
font-family: var(--default-font-family);
|
|
24
|
-
font-size: var(--sys-typescale-body2-size);
|
|
25
|
-
font-weight: var(--ref-typeface-weight-medium);
|
|
26
|
-
outline: 2px solid var(--color-background);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.connectorContainer {
|
|
30
|
-
z-index: 1000;
|
|
31
|
-
overflow: visible;
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.close-button {
|
|
36
|
-
position: absolute;
|
|
37
|
-
top:1px;
|
|
38
|
-
z-index: 1000;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
}
|