chrome-devtools-frontend 1.0.1672388 → 1.0.1674545
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/eslint.config.mjs +3 -3
- package/front_end/core/common/SettingRegistration.ts +1 -26
- package/front_end/core/common/Settings.ts +4 -53
- package/front_end/core/host/UserMetrics.ts +127 -117
- package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +42 -9
- package/front_end/core/root/Runtime.ts +7 -2
- package/front_end/core/sdk/NetworkManager.ts +0 -35
- package/front_end/core/sdk/SourceMap.ts +1 -19
- package/front_end/core/sdk/SourceMapManager.ts +75 -48
- package/front_end/core/sdk/SourceMapScopesInfo.ts +0 -62
- package/front_end/devtools_compatibility.js +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +4 -3
- package/front_end/generated/{SupportedCSSProperties.js → SupportedCSSProperties.ts} +32 -1
- package/front_end/generated/protocol-mapping.d.ts +8 -0
- package/front_end/generated/protocol-proxy-api.d.ts +6 -0
- package/front_end/generated/protocol.ts +16 -2
- package/front_end/models/ai_assistance/AiSetting.ts +66 -3
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +4 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +1 -1
- package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
- package/front_end/models/emulation/DeviceModeModel.ts +25 -34
- package/front_end/models/emulation/EmulatedDevices.ts +1 -1
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -4
- package/front_end/models/trace/ModelImpl.ts +5 -0
- package/front_end/models/trace/Processor.ts +47 -10
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +18 -19
- package/front_end/models/trace/handlers/MetaHandler.ts +46 -9
- package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +11 -0
- package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
- package/front_end/models/trace/insights/CharacterSet.ts +1 -1
- package/front_end/models/trace/insights/Common.ts +21 -2
- package/front_end/models/trace/insights/DocumentLatency.ts +1 -1
- package/front_end/models/trace/insights/LCPBreakdown.ts +7 -6
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +7 -3
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/ThirdParties.ts +5 -2
- package/front_end/models/trace/insights/types.ts +11 -6
- package/front_end/models/trace/types/Configuration.ts +5 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +11 -10
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +3 -45
- package/front_end/panels/application/BackgroundServiceView.ts +42 -40
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
- package/front_end/panels/common/ExtensionServer.ts +7 -1
- package/front_end/panels/common/common.ts +0 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +7 -6
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
- package/front_end/panels/elements/ClassesPaneWidget.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +56 -5
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AdornerManager.ts +1 -0
- package/front_end/panels/emulation/AdvancedApp.ts +3 -3
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -11
- package/front_end/panels/emulation/DeviceModeView.ts +234 -75
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +1 -1
- package/front_end/panels/emulation/deviceModeView.css +4 -21
- package/front_end/panels/emulation/emulation-meta.ts +4 -30
- package/front_end/panels/emulation/emulation.ts +0 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +11 -7
- package/front_end/panels/layers/LayersPanel.ts +2 -2
- package/front_end/panels/layers/layers-meta.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -7
- package/front_end/panels/mobile_throttling/CPUThrottlingSelector.ts +313 -0
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +0 -10
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +23 -10
- package/front_end/panels/mobile_throttling/mobile_throttling.ts +3 -0
- package/front_end/panels/network/NetworkConfigView.ts +1 -71
- package/front_end/panels/network/networkConfigView.css +1 -2
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +3 -3
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +5 -5
- package/front_end/panels/profiler/HeapProfileView.ts +32 -32
- package/front_end/panels/profiler/HeapProfilerPanel.ts +2 -2
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +33 -37
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +26 -27
- package/front_end/panels/profiler/HeapSnapshotView.ts +48 -48
- package/front_end/panels/profiler/IsolateSelector.ts +10 -10
- package/front_end/panels/profiler/ModuleUIStrings.ts +25 -25
- package/front_end/panels/profiler/ProfileLauncherView.ts +6 -6
- package/front_end/panels/profiler/ProfilesPanel.ts +6 -6
- package/front_end/panels/profiler/WritableProfileHeader.ts +6 -6
- package/front_end/panels/profiler/profiler-meta.ts +7 -7
- package/front_end/panels/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +27 -23
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +463 -13
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +12 -17
- package/front_end/panels/timeline/TimelinePanel.ts +22 -35
- package/front_end/panels/timeline/components/CWVMetrics.ts +16 -3
- package/front_end/panels/timeline/components/LiveMetricsView.ts +27 -6
- package/front_end/panels/timeline/components/NetworkTrackWidget.ts +1 -1
- package/front_end/panels/timeline/components/components.ts +0 -4
- package/front_end/panels/timeline/components/cwvMetrics.css +4 -0
- package/front_end/panels/timeline/components/liveMetricsView.css +7 -17
- package/front_end/panels/timeline/components/metricValueStyles.css +17 -0
- 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 +64 -15
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +65 -16
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +50 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +8 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js.map +1 -1
- 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 +16 -1
- 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/Connection.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +11 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js +5 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +10 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +27 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +12 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +5 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- 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 +64 -15
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +50 -7
- package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +9 -7
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +9 -6
- package/front_end/third_party/puppeteer/package/src/bidi/Dialog.ts +4 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +24 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +11 -6
- package/front_end/third_party/puppeteer/package/src/cdp/Dialog.ts +7 -0
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +7 -3
- package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -5
- package/front_end/third_party/puppeteer/package/src/common/util.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +2 -0
- package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +6 -4
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/README.md +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/deno.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +2 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +2 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -0
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +2 -0
- package/front_end/ui/components/settings/SettingCheckbox.ts +4 -12
- package/front_end/ui/components/settings/settingCheckbox.css +0 -7
- package/front_end/ui/legacy/Treeoutline.ts +14 -14
- package/front_end/ui/legacy/UIUtils.ts +2 -47
- package/front_end/ui/legacy/Widget.ts +10 -2
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +1 -1
- package/front_end/ui/lit/Directives.ts +80 -0
- package/front_end/ui/lit/lit.ts +1 -0
- package/front_end/ui/lit/render.ts +8 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +18 -0
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/panels/common/ThrottlingUtils.ts +0 -51
- package/front_end/panels/emulation/DeviceModeWrapper.ts +0 -248
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +0 -235
- package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +0 -245
- package/front_end/panels/timeline/components/cpuThrottlingSelector.css +0 -30
- package/front_end/panels/timeline/components/networkThrottlingSelector.css +0 -24
- /package/front_end/core/host/{UserMetricsEnums.d.ts → UserMetricsEnums.ts} +0 -0
- /package/front_end/generated/{ARIAProperties.js → ARIAProperties.ts} +0 -0
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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-lit-render-outside-of-view */
|
|
5
|
-
|
|
6
|
-
import '../../../ui/kit/kit.js';
|
|
7
|
-
import '../../../ui/components/menus/menus.js';
|
|
8
|
-
|
|
9
|
-
import * as Common from '../../../core/common/common.js';
|
|
10
|
-
import * as i18n from '../../../core/i18n/i18n.js';
|
|
11
|
-
import * as Platform from '../../../core/platform/platform.js';
|
|
12
|
-
import * as SDK from '../../../core/sdk/sdk.js';
|
|
13
|
-
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
14
|
-
import type * as Menus from '../../../ui/components/menus/menus.js';
|
|
15
|
-
import * as Lit from '../../../ui/lit/lit.js';
|
|
16
|
-
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
17
|
-
import * as MobileThrottling from '../../mobile_throttling/mobile_throttling.js';
|
|
18
|
-
|
|
19
|
-
import networkThrottlingSelectorStyles from './networkThrottlingSelector.css.js';
|
|
20
|
-
|
|
21
|
-
const {html, nothing} = Lit;
|
|
22
|
-
|
|
23
|
-
const UIStrings = {
|
|
24
|
-
/**
|
|
25
|
-
* @description Text label for a selection box showing which network throttling option is applied.
|
|
26
|
-
* @example {No throttling} PH1
|
|
27
|
-
*/
|
|
28
|
-
network: 'Network: {PH1}',
|
|
29
|
-
/**
|
|
30
|
-
* @description Text label for a selection box showing which network throttling option is applied.
|
|
31
|
-
* @example {No throttling} PH1
|
|
32
|
-
*/
|
|
33
|
-
networkThrottling: 'Network throttling: {PH1}',
|
|
34
|
-
/**
|
|
35
|
-
* @description Text label for a selection box showing that a specific option is recommended for network throttling.
|
|
36
|
-
* @example {Fast 4G} PH1
|
|
37
|
-
*/
|
|
38
|
-
recommendedThrottling: '{PH1} – recommended',
|
|
39
|
-
/**
|
|
40
|
-
* @description Text for why user should change a throttling setting.
|
|
41
|
-
*/
|
|
42
|
-
recommendedThrottlingReason: 'Consider changing setting to simulate real user environments',
|
|
43
|
-
/**
|
|
44
|
-
* @description Text label for a menu group that disables network throttling.
|
|
45
|
-
*/
|
|
46
|
-
disabled: 'Disabled',
|
|
47
|
-
/**
|
|
48
|
-
* @description Text label for a menu group that contains default presets for network throttling.
|
|
49
|
-
*/
|
|
50
|
-
presets: 'Presets',
|
|
51
|
-
/**
|
|
52
|
-
* @description Text label for a menu group that contains custom presets for network throttling.
|
|
53
|
-
*/
|
|
54
|
-
custom: 'Custom',
|
|
55
|
-
/**
|
|
56
|
-
* @description Text label for a menu option to add a new custom throttling preset.
|
|
57
|
-
*/
|
|
58
|
-
add: 'Add…',
|
|
59
|
-
} as const;
|
|
60
|
-
|
|
61
|
-
const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/NetworkThrottlingSelector.ts', UIStrings);
|
|
62
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
63
|
-
|
|
64
|
-
interface ConditionsGroup {
|
|
65
|
-
name: string;
|
|
66
|
-
items: SDK.NetworkManager.Conditions[];
|
|
67
|
-
showCustomAddOption?: boolean;
|
|
68
|
-
jslogContext?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export class NetworkThrottlingSelector extends HTMLElement {
|
|
72
|
-
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
73
|
-
|
|
74
|
-
#customNetworkConditionsSetting: Common.Settings.Setting<SDK.NetworkManager.Conditions[]>;
|
|
75
|
-
#groups: ConditionsGroup[] = [];
|
|
76
|
-
#currentConditions: SDK.NetworkManager.Conditions;
|
|
77
|
-
#recommendedConditions: SDK.NetworkManager.Conditions|null = null;
|
|
78
|
-
|
|
79
|
-
constructor() {
|
|
80
|
-
super();
|
|
81
|
-
this.#customNetworkConditionsSetting =
|
|
82
|
-
Common.Settings.Settings.instance().moduleSetting('custom-network-conditions');
|
|
83
|
-
this.#resetPresets();
|
|
84
|
-
this.#currentConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions();
|
|
85
|
-
this.#render();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
set recommendedConditions(recommendedConditions: SDK.NetworkManager.Conditions|null) {
|
|
89
|
-
this.#recommendedConditions = recommendedConditions;
|
|
90
|
-
void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
connectedCallback(): void {
|
|
94
|
-
SDK.NetworkManager.MultitargetNetworkManager.instance().addEventListener(
|
|
95
|
-
SDK.NetworkManager.MultitargetNetworkManager.Events.CONDITIONS_CHANGED, this.#onConditionsChanged, this);
|
|
96
|
-
|
|
97
|
-
// Also call onConditionsChanged immediately to make sure we get the
|
|
98
|
-
// latest snapshot. Otherwise if another panel updated this value and this
|
|
99
|
-
// component wasn't in the DOM, this component will not update itself
|
|
100
|
-
// when it is put into the page
|
|
101
|
-
this.#onConditionsChanged();
|
|
102
|
-
this.#customNetworkConditionsSetting.addChangeListener(this.#onSettingChanged, this);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
disconnectedCallback(): void {
|
|
106
|
-
SDK.NetworkManager.MultitargetNetworkManager.instance().removeEventListener(
|
|
107
|
-
SDK.NetworkManager.MultitargetNetworkManager.Events.CONDITIONS_CHANGED, this.#onConditionsChanged, this);
|
|
108
|
-
this.#customNetworkConditionsSetting.removeChangeListener(this.#onSettingChanged, this);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#resetPresets(): void {
|
|
112
|
-
this.#groups = [
|
|
113
|
-
{
|
|
114
|
-
name: i18nString(UIStrings.disabled),
|
|
115
|
-
items: [
|
|
116
|
-
SDK.NetworkManager.NoThrottlingConditions,
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: i18nString(UIStrings.presets),
|
|
121
|
-
items: MobileThrottling.ThrottlingPresets.ThrottlingPresets.networkPresets,
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: i18nString(UIStrings.custom),
|
|
125
|
-
items: this.#customNetworkConditionsSetting.get(),
|
|
126
|
-
showCustomAddOption: true,
|
|
127
|
-
jslogContext: 'custom-network-throttling-item',
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
#onConditionsChanged(): void {
|
|
133
|
-
this.#currentConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions();
|
|
134
|
-
void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
#onMenuItemSelected(event: Menus.SelectMenu.SelectMenuItemSelectedEvent): void {
|
|
138
|
-
const newConditions = this.#groups.flatMap(g => g.items).find(item => {
|
|
139
|
-
const keyForItem = this.#keyForNetworkConditions(item);
|
|
140
|
-
return keyForItem === event.itemValue;
|
|
141
|
-
});
|
|
142
|
-
if (newConditions) {
|
|
143
|
-
SDK.NetworkManager.MultitargetNetworkManager.instance().setNetworkConditions(newConditions);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
#onSettingChanged(): void {
|
|
148
|
-
this.#resetPresets();
|
|
149
|
-
void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
#getConditionsTitle(conditions: SDK.NetworkManager.Conditions): string {
|
|
153
|
-
return conditions.title instanceof Function ? conditions.title() : conditions.title;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#onAddClick(): void {
|
|
157
|
-
void Common.Revealer.reveal(this.#customNetworkConditionsSetting);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The key that uniquely identifies the condition setting. All the DevTools
|
|
162
|
-
* presets have the i18nKey, so we rely on that, but for custom user added
|
|
163
|
-
* ones we fallback to using the title (it wouldn't make sense for a user to
|
|
164
|
-
* add presets with the same title)
|
|
165
|
-
*/
|
|
166
|
-
#keyForNetworkConditions(conditions: SDK.NetworkManager.Conditions): string {
|
|
167
|
-
return conditions.i18nTitleKey || this.#getConditionsTitle(conditions);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
#render = (): void => {
|
|
171
|
-
const selectionTitle = this.#getConditionsTitle(this.#currentConditions);
|
|
172
|
-
const selectedConditionsKey = this.#keyForNetworkConditions(this.#currentConditions);
|
|
173
|
-
|
|
174
|
-
let recommendedInfoEl;
|
|
175
|
-
if (this.#recommendedConditions && this.#currentConditions === SDK.NetworkManager.NoThrottlingConditions) {
|
|
176
|
-
recommendedInfoEl = html`<devtools-icon
|
|
177
|
-
title=${i18nString(UIStrings.recommendedThrottlingReason)}
|
|
178
|
-
name=info></devtools-icon>`;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// clang-format off
|
|
182
|
-
/* eslint-disable @devtools/no-deprecated-component-usages */
|
|
183
|
-
const output = html`
|
|
184
|
-
<style>${networkThrottlingSelectorStyles}</style>
|
|
185
|
-
<devtools-select-menu
|
|
186
|
-
@selectmenuselected=${this.#onMenuItemSelected}
|
|
187
|
-
.showDivider=${true}
|
|
188
|
-
.showArrow=${true}
|
|
189
|
-
.sideButton=${false}
|
|
190
|
-
.showSelectedItem=${true}
|
|
191
|
-
.jslogContext=${'network-conditions'}
|
|
192
|
-
.buttonTitle=${i18nString(UIStrings.network, {PH1: selectionTitle})}
|
|
193
|
-
.title=${i18nString(UIStrings.networkThrottling, {PH1: selectionTitle})}
|
|
194
|
-
>
|
|
195
|
-
${this.#groups.map(group => {
|
|
196
|
-
return html`
|
|
197
|
-
<devtools-menu-group .name=${group.name} .title=${group.name}>
|
|
198
|
-
${group.items.map(conditions => {
|
|
199
|
-
let title = this.#getConditionsTitle(conditions);
|
|
200
|
-
if (conditions === this.#recommendedConditions) {
|
|
201
|
-
title = i18nString(UIStrings.recommendedThrottling, {PH1: title});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const key = this.#keyForNetworkConditions(conditions);
|
|
205
|
-
const jslogContext = group.jslogContext || Platform.StringUtilities.toKebabCase(conditions.i18nTitleKey || title);
|
|
206
|
-
return html`
|
|
207
|
-
<devtools-menu-item
|
|
208
|
-
.value=${key}
|
|
209
|
-
.selected=${selectedConditionsKey === key}
|
|
210
|
-
.title=${title}
|
|
211
|
-
jslog=${VisualLogging.item(jslogContext).track({click: true})}
|
|
212
|
-
>
|
|
213
|
-
${title}
|
|
214
|
-
</devtools-menu-item>
|
|
215
|
-
`;
|
|
216
|
-
})}
|
|
217
|
-
${group.showCustomAddOption ? html`
|
|
218
|
-
<devtools-menu-item
|
|
219
|
-
.value=${1 /* This won't be displayed unless it has some value. */}
|
|
220
|
-
.title=${i18nString(UIStrings.add)}
|
|
221
|
-
jslog=${VisualLogging.action('add').track({click: true})}
|
|
222
|
-
@click=${this.#onAddClick}
|
|
223
|
-
>
|
|
224
|
-
${i18nString(UIStrings.add)}
|
|
225
|
-
</devtools-menu-item>
|
|
226
|
-
` : nothing}
|
|
227
|
-
</devtools-menu-group>
|
|
228
|
-
`;
|
|
229
|
-
})}
|
|
230
|
-
</devtools-select-menu>
|
|
231
|
-
${recommendedInfoEl}
|
|
232
|
-
`;
|
|
233
|
-
/* eslint-enable @devtools/no-deprecated-component-usages */
|
|
234
|
-
// clang-format on
|
|
235
|
-
Lit.render(output, this.#shadow, {host: this});
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
customElements.define('devtools-network-throttling-selector', NetworkThrottlingSelector);
|
|
240
|
-
|
|
241
|
-
declare global {
|
|
242
|
-
interface HTMLElementTagNameMap {
|
|
243
|
-
'devtools-network-throttling-selector': NetworkThrottlingSelector;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 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
|
-
@scope to (devtools-widget > *) {
|
|
8
|
-
:scope {
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
max-width: 100%;
|
|
12
|
-
height: 20px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
* {
|
|
16
|
-
font-family: var(--default-font-family);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
devtools-icon[name="info"] {
|
|
20
|
-
margin-left: var(--sys-size-3);
|
|
21
|
-
width: var(--sys-size-8);
|
|
22
|
-
height: var(--sys-size-8);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
devtools-select-menu {
|
|
26
|
-
min-width: 160px;
|
|
27
|
-
max-width: 100%;
|
|
28
|
-
height: 20px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 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
|
-
:host {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
max-width: 100%;
|
|
11
|
-
height: 20px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
devtools-icon[name="info"] {
|
|
15
|
-
margin-left: var(--sys-size-3);
|
|
16
|
-
width: var(--sys-size-8);
|
|
17
|
-
height: var(--sys-size-8);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
devtools-select-menu {
|
|
21
|
-
min-width: 160px;
|
|
22
|
-
max-width: 100%;
|
|
23
|
-
height: 20px;
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|