chrome-devtools-frontend 1.0.1669021 → 1.0.1672388

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.
Files changed (208) hide show
  1. package/.agents/skills/fixing-skipped-tests/SKILL.md +6 -6
  2. package/.agents/skills/gerrit-cli/SKILL.md +4 -10
  3. package/.agents/skills/gerrit-cli/references/commands.md +45 -2
  4. package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
  5. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
  6. package/config/typescript/tsconfig.eslint.json +1 -1
  7. package/docs/contributing/settings-experiments-features.md +2 -8
  8. package/docs/ecosystem/automatic_workspace_folders.md +0 -19
  9. package/eslint.config.mjs +2 -2
  10. package/front_end/core/common/Lazy.ts +3 -3
  11. package/front_end/core/common/SettingRegistration.ts +0 -7
  12. package/front_end/core/common/Settings.ts +0 -38
  13. package/front_end/core/host/UserMetrics.ts +187 -953
  14. package/front_end/core/host/UserMetricsEnums.d.ts +949 -0
  15. package/front_end/core/root/Runtime.ts +21 -133
  16. package/front_end/core/sdk/CSSMetadata.ts +70 -65
  17. package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
  18. package/front_end/core/sdk/ChildTargetManager.ts +0 -2
  19. package/front_end/core/sdk/EmulationModel.ts +0 -2
  20. package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
  21. package/front_end/core/sdk/NetworkManager.ts +0 -3
  22. package/front_end/core/sdk/PageResourceLoader.ts +9 -9
  23. package/front_end/core/sdk/RehydratingConnection.ts +52 -4
  24. package/front_end/core/sdk/Target.ts +0 -4
  25. package/front_end/devtools_compatibility.js +886 -0
  26. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
  27. package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
  28. package/front_end/entrypoints/main/MainImpl.ts +18 -22
  29. package/front_end/foundation/Universe.ts +7 -2
  30. package/front_end/generated/InspectorBackendCommands.ts +3 -10
  31. package/front_end/generated/protocol-mapping.d.ts +0 -42
  32. package/front_end/generated/protocol-proxy-api.d.ts +0 -38
  33. package/front_end/generated/protocol.ts +9 -169
  34. package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
  35. package/front_end/models/ai_assistance/AiConversation.ts +1 -0
  36. package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
  37. package/front_end/models/ai_assistance/AiSetting.ts +108 -0
  38. package/front_end/models/ai_assistance/AiUtils.ts +47 -0
  39. package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
  40. package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
  41. package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
  42. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
  43. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
  44. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
  45. package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
  46. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
  47. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  48. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
  49. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
  50. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
  51. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
  52. package/front_end/models/ai_assistance/injected.ts +1 -0
  53. package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
  54. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  55. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
  56. package/front_end/models/ai_assistance/skills/performance.md +10 -0
  57. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
  58. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
  59. package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
  60. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
  61. package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
  62. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
  63. package/front_end/models/ai_assistance/tools/README.md +1 -1
  64. package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
  65. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
  66. package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
  67. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
  68. package/front_end/models/badges/UserBadges.ts +2 -0
  69. package/front_end/models/bindings/NetworkProject.ts +5 -0
  70. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
  71. package/front_end/models/bindings/ResourceUtils.ts +3 -0
  72. package/front_end/models/crux-manager/CrUXManager.ts +1 -0
  73. package/front_end/models/emulation/DeviceModeModel.ts +140 -7
  74. package/front_end/models/emulation/EmulatedDevices.ts +246 -793
  75. package/front_end/models/issues_manager/IssuesManager.ts +10 -2
  76. package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
  77. package/front_end/models/logs/LogManager.ts +8 -5
  78. package/front_end/models/logs/NetworkLog.ts +1 -0
  79. package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
  80. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
  81. package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
  82. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
  83. package/front_end/models/workspace/IgnoreListManager.ts +2 -0
  84. package/front_end/models/workspace/UISourceCode.ts +2 -0
  85. package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
  86. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
  87. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
  88. package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
  89. package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
  90. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
  91. package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
  92. package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
  93. package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
  94. package/front_end/panels/application/application.ts +0 -10
  95. package/front_end/panels/application/components/components.ts +0 -4
  96. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
  97. package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
  98. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
  99. package/front_end/panels/console/ConsoleFormat.ts +2 -62
  100. package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
  101. package/front_end/panels/emulation/AdvancedApp.ts +1 -2
  102. package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
  103. package/front_end/panels/emulation/DeviceModeView.ts +4 -134
  104. package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
  105. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
  106. package/front_end/panels/emulation/emulation-meta.ts +12 -12
  107. package/front_end/panels/issues/IssuesPane.ts +3 -1
  108. package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
  109. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
  110. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
  111. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
  112. package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
  113. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
  114. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
  115. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +11 -11
  116. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
  117. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
  118. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
  119. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
  120. package/front_end/panels/network/RequestHeadersView.ts +1 -1
  121. package/front_end/panels/network/ResourceChunkView.ts +243 -144
  122. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
  123. package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
  124. package/front_end/panels/network/resourceChunkView.css +41 -36
  125. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
  126. package/front_end/panels/profiler/profiler.ts +4 -0
  127. package/front_end/panels/recorder/RecorderPanel.ts +6 -14
  128. package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
  129. package/front_end/panels/settings/AISettingsTab.ts +75 -31
  130. package/front_end/panels/settings/SettingsScreen.ts +8 -13
  131. package/front_end/panels/settings/components/SyncSection.ts +3 -4
  132. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +200 -18
  133. package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
  134. package/front_end/panels/settings/settings-meta.ts +0 -1
  135. package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
  136. package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
  137. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  138. package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
  139. package/front_end/panels/sources/SourcesPanel.ts +19 -17
  140. package/front_end/panels/sources/SourcesView.ts +191 -96
  141. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
  142. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
  143. package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
  144. package/front_end/panels/timeline/timeline-meta.ts +3 -5
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
  147. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  148. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  149. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
  150. package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
  151. package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
  152. package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
  153. package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
  154. package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
  155. package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
  156. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  157. package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
  158. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  159. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  160. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  161. package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
  162. package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
  163. package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
  164. package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
  165. package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
  166. package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
  167. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  168. package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
  169. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
  170. package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
  171. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
  172. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  173. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  174. package/front_end/tsconfig.compatibility.json +2 -1
  175. package/front_end/tsconfig.json +1 -1
  176. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  177. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  178. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
  179. package/front_end/ui/components/settings/settings.ts +1 -2
  180. package/front_end/ui/legacy/Treeoutline.ts +52 -30
  181. package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
  182. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
  183. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
  184. package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
  185. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
  186. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
  187. package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
  188. package/front_end/ui/visual_logging/KnownContextValues.ts +21 -0
  189. package/inspector_overlay/tsconfig.json +8 -2
  190. package/package.json +3 -2
  191. package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
  192. package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
  193. package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
  194. package/front_end/foundation/Universe.test.api.ts +0 -73
  195. package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
  196. package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
  197. package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
  198. package/front_end/panels/application/SharedStorageModel.ts +0 -249
  199. package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
  200. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
  201. package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
  202. package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
  203. package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
  204. package/front_end/panels/application/sharedStorageEventsView.css +0 -9
  205. package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
  206. package/front_end/panels/network/originalResourceChunkView.css +0 -49
  207. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
  208. package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
@@ -1,12 +1,12 @@
1
1
  // Copyright 2020 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
4
 
6
5
  import '../../../ui/kit/kit.js';
7
6
 
8
7
  import * as i18n from '../../../core/i18n/i18n.js';
9
8
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
9
+ import * as UI from '../../../ui/legacy/legacy.js';
10
10
  import * as Lit from '../../../ui/lit/lit.js';
11
11
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
12
12
 
@@ -48,43 +48,6 @@ export const enum Navigation {
48
48
  FORWARD = 'Forward',
49
49
  }
50
50
 
51
- export class AddressInputChangedEvent extends Event {
52
- static readonly eventName = 'addressinputchanged';
53
- data: {address: string, mode: Mode};
54
-
55
- constructor(address: string, mode: Mode) {
56
- super(AddressInputChangedEvent.eventName);
57
- this.data = {address, mode};
58
- }
59
- }
60
-
61
- export class PageNavigationEvent extends Event {
62
- static readonly eventName = 'pagenavigation';
63
- data: Navigation;
64
-
65
- constructor(navigation: Navigation) {
66
- super(PageNavigationEvent.eventName, {});
67
- this.data = navigation;
68
- }
69
- }
70
-
71
- export class HistoryNavigationEvent extends Event {
72
- static readonly eventName = 'historynavigation';
73
- data: Navigation;
74
-
75
- constructor(navigation: Navigation) {
76
- super(HistoryNavigationEvent.eventName, {});
77
- this.data = navigation;
78
- }
79
- }
80
-
81
- export class RefreshRequestedEvent extends Event {
82
- static readonly eventName = 'refreshrequested';
83
- constructor() {
84
- super(RefreshRequestedEvent.eventName, {});
85
- }
86
- }
87
-
88
51
  export interface LinearMemoryNavigatorData {
89
52
  address: string;
90
53
  mode: Mode;
@@ -100,108 +63,225 @@ export const enum Mode {
100
63
  INVALID_SUBMIT = 'InvalidSubmit',
101
64
  }
102
65
 
103
- export class LinearMemoryNavigator extends HTMLElement {
104
- readonly #shadow = this.attachShadow({mode: 'open'});
66
+ export interface ViewInput extends LinearMemoryNavigatorData {
67
+ onAddressChange?: (address: string, mode: Mode) => void;
68
+ onNavigatePage?: (navigation: Navigation) => void;
69
+ onNavigateHistory?: (navigation: Navigation) => void;
70
+ onRefreshRequest?: () => void;
71
+ }
72
+
73
+ export type View = (input: ViewInput, output: undefined, target: HTMLElement|ShadowRoot) => void;
74
+
75
+ export const DEFAULT_VIEW: View = (input, _output, target) => {
76
+ // Disabled until https://crbug.com/1079231 is fixed.
77
+ // clang-format off
78
+ const result = html`
79
+ <style>${linearMemoryNavigatorStyles}</style>
80
+ <div class="navigator">
81
+ <div class="navigator-item">
82
+ ${createButton({icon: 'undo', title: i18nString(UIStrings.goBackInAddressHistory),
83
+ onClick: () => input.onNavigateHistory?.(Navigation.BACKWARD), enabled: input.canGoBackInHistory,
84
+ jslogContext:'linear-memory-inspector.history-back'})}
85
+ ${createButton({icon: 'redo', title: i18nString(UIStrings.goForwardInAddressHistory),
86
+ onClick: () => input.onNavigateHistory?.(Navigation.FORWARD), enabled: input.canGoForwardInHistory,
87
+ jslogContext:'linear-memory-inspector.history-forward'})}
88
+ </div>
89
+ <div class="navigator-item">
90
+ ${createButton({icon: 'chevron-left', title: i18nString(UIStrings.previousPage),
91
+ onClick: () => input.onNavigatePage?.(Navigation.BACKWARD), enabled: true,
92
+ jslogContext:'linear-memory-inspector.previous-page'})}
93
+ ${createAddressInput(input)}
94
+ ${createButton({icon: 'chevron-right', title: i18nString(UIStrings.nextPage),
95
+ onClick: () => input.onNavigatePage?.(Navigation.FORWARD), enabled: true,
96
+ jslogContext:'linear-memory-inspector.next-page'})}
97
+ </div>
98
+ ${createButton({icon: 'refresh', title: i18nString(UIStrings.refresh),
99
+ onClick: () => input.onRefreshRequest?.(), enabled: true,
100
+ jslogContext:'linear-memory-inspector.refresh'})}
101
+ </div>
102
+ `;
103
+ render(result, target);
104
+ // clang-format on
105
+ };
106
+
107
+ function createAddressInput(data: ViewInput): Lit.TemplateResult {
108
+ const classMap = {
109
+ 'address-input': true,
110
+ invalid: !data.valid,
111
+ };
112
+ return html`<input
113
+ class=${Lit.Directives.classMap(classMap)}
114
+ data-input="true"
115
+ .value=${data.address}
116
+ jslog=${VisualLogging.textField('linear-memory-inspector.address').track({
117
+ change: true,
118
+ })}
119
+ title=${
120
+ ifDefined(
121
+ data.valid ? i18nString(UIStrings.enterAddress) : data.error,
122
+ )}
123
+ @change=${(e: Event) => data.onAddressChange?.((e.target as HTMLInputElement).value, Mode.SUBMITTED)}
124
+ @input=${(e: Event) => data.onAddressChange?.((e.target as HTMLInputElement).value, Mode.EDIT)}
125
+ ${Lit.Directives.ref((el: Element|undefined) => {
126
+ if (el) {
127
+ const inputEl = el as HTMLInputElement;
128
+ if (data.mode === Mode.SUBMITTED) {
129
+ inputEl.blur();
130
+ } else if (data.mode === Mode.INVALID_SUBMIT) {
131
+ inputEl.select();
132
+ }
133
+ }
134
+ })}
135
+ />`;
136
+ }
137
+
138
+ function createButton(data: {
139
+ icon: string,
140
+ title: string,
141
+ onClick: () => void,
142
+ enabled: boolean,
143
+ jslogContext: string,
144
+ }): Lit.TemplateResult {
145
+ return html`
146
+ <devtools-button class="navigator-button"
147
+ .data=${{variant: Buttons.Button.Variant.ICON,
148
+ iconName: data.icon,
149
+ disabled: !data.enabled} as Buttons.Button.ButtonData}
150
+ jslog=${VisualLogging.action().track({click: true, keydown: 'Enter'}).context(data.jslogContext)}
151
+ title=${data.title}
152
+ @click=${data.onClick}
153
+ ></devtools-button>`;
154
+ }
155
+
156
+ export class LinearMemoryNavigator extends UI.Widget.Widget {
157
+ readonly #view: View;
105
158
  #address = '0';
106
159
  #error: string|undefined = undefined;
107
160
  #valid = true;
108
161
  #canGoBackInHistory = false;
109
162
  #canGoForwardInHistory = false;
163
+ #mode = Mode.SUBMITTED;
110
164
 
111
- set data(data: LinearMemoryNavigatorData) {
112
- this.#address = data.address;
113
- this.#error = data.error;
114
- this.#valid = data.valid;
115
- this.#canGoBackInHistory = data.canGoBackInHistory;
116
- this.#canGoForwardInHistory = data.canGoForwardInHistory;
117
- this.#render();
165
+ #onRefreshRequest?: () => void;
166
+ #onAddressChange?: (address: string, mode: Mode) => void;
167
+ #onNavigatePage?: (navigation: Navigation) => void;
168
+ #onNavigateHistory?: (navigation: Navigation) => void;
118
169
 
119
- const addressInput = this.#shadow.querySelector<HTMLInputElement>('.address-input');
120
- if (addressInput) {
121
- if (data.mode === Mode.SUBMITTED) {
122
- addressInput.blur();
123
- } else if (data.mode === Mode.INVALID_SUBMIT) {
124
- addressInput.select();
125
- }
170
+ get onRefreshRequest(): (() => void)|undefined {
171
+ return this.#onRefreshRequest;
172
+ }
173
+
174
+ set onRefreshRequest(callback: (() => void)|undefined) {
175
+ this.#onRefreshRequest = callback;
176
+ this.performUpdate();
177
+ }
178
+
179
+ get onAddressChange(): ((address: string, mode: Mode) => void)|undefined {
180
+ return this.#onAddressChange;
181
+ }
182
+
183
+ set onAddressChange(callback: ((address: string, mode: Mode) => void)|undefined) {
184
+ this.#onAddressChange = callback;
185
+ this.performUpdate();
186
+ }
187
+
188
+ get onNavigatePage(): ((navigation: Navigation) => void)|undefined {
189
+ return this.#onNavigatePage;
190
+ }
191
+
192
+ set onNavigatePage(callback: ((navigation: Navigation) => void)|undefined) {
193
+ this.#onNavigatePage = callback;
194
+ this.performUpdate();
195
+ }
196
+
197
+ get onNavigateHistory(): ((navigation: Navigation) => void)|undefined {
198
+ return this.#onNavigateHistory;
199
+ }
200
+
201
+ set onNavigateHistory(callback: ((navigation: Navigation) => void)|undefined) {
202
+ this.#onNavigateHistory = callback;
203
+ this.performUpdate();
204
+ }
205
+
206
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
207
+ super(element);
208
+ this.#view = view;
209
+ if (!this.element.shadowRoot) {
210
+ this.element.attachShadow({mode: 'open'});
126
211
  }
127
212
  }
128
213
 
129
- #render(): void {
130
- // Disabled until https://crbug.com/1079231 is fixed.
131
- // clang-format off
132
- const result = html`
133
- <style>${linearMemoryNavigatorStyles}</style>
134
- <div class="navigator">
135
- <div class="navigator-item">
136
- ${this.#createButton({icon: 'undo', title: i18nString(UIStrings.goBackInAddressHistory),
137
- event: new HistoryNavigationEvent(Navigation.BACKWARD), enabled: this.#canGoBackInHistory,
138
- jslogContext:'linear-memory-inspector.history-back'})}
139
- ${this.#createButton({icon: 'redo', title: i18nString(UIStrings.goForwardInAddressHistory),
140
- event: new HistoryNavigationEvent(Navigation.FORWARD), enabled: this.#canGoForwardInHistory,
141
- jslogContext:'linear-memory-inspector.history-forward'})}
142
- </div>
143
- <div class="navigator-item">
144
- ${this.#createButton({icon: 'chevron-left', title: i18nString(UIStrings.previousPage),
145
- event: new PageNavigationEvent(Navigation.BACKWARD), enabled: true,
146
- jslogContext:'linear-memory-inspector.previous-page'})}
147
- ${this.#createAddressInput()}
148
- ${this.#createButton({icon: 'chevron-right', title: i18nString(UIStrings.nextPage),
149
- event: new PageNavigationEvent(Navigation.FORWARD), enabled: true,
150
- jslogContext:'linear-memory-inspector.next-page'})}
151
- </div>
152
- ${this.#createButton({icon: 'refresh', title: i18nString(UIStrings.refresh),
153
- event: new RefreshRequestedEvent(), enabled: true,
154
- jslogContext:'linear-memory-inspector.refresh'})}
155
- </div>
156
- `;
157
- render(result, this.#shadow, {host: this});
158
- // clang-format on
214
+ get address(): string {
215
+ return this.#address;
159
216
  }
160
217
 
161
- #createAddressInput(): Lit.TemplateResult {
162
- const classMap = {
163
- 'address-input': true,
164
- invalid: !this.#valid,
165
- };
166
- return html`<input
167
- class=${Lit.Directives.classMap(classMap)}
168
- data-input="true"
169
- .value=${this.#address}
170
- jslog=${VisualLogging.textField('linear-memory-inspector.address').track({
171
- change: true,
172
- })}
173
- title=${
174
- ifDefined(
175
- this.#valid ? i18nString(UIStrings.enterAddress) : this.#error,
176
- )}
177
- @change=${this.#onAddressChange.bind(this, Mode.SUBMITTED)}
178
- @input=${this.#onAddressChange.bind(this, Mode.EDIT)}
179
- />`;
180
- }
181
-
182
- #onAddressChange(mode: Mode, event: Event): void {
183
- const addressInput = event.target as HTMLInputElement;
184
- this.dispatchEvent(new AddressInputChangedEvent(addressInput.value, mode));
185
- }
186
-
187
- #createButton(data: {icon: string, title: string, event: Event, enabled: boolean, jslogContext: string}):
188
- Lit.TemplateResult {
189
- return html`
190
- <devtools-button class="navigator-button"
191
- .data=${
192
- {variant: Buttons.Button.Variant.ICON, iconName: data.icon, disabled: !data.enabled} as
193
- Buttons.Button.ButtonData}
194
- jslog=${VisualLogging.action().track({click: true, keydown: 'Enter'}).context(data.jslogContext)}
195
- data-button=${data.event.type} title=${data.title}
196
- @click=${this.dispatchEvent.bind(this, data.event)}
197
- ></devtools-button>`;
218
+ set address(address: string) {
219
+ this.#address = address;
220
+ this.requestUpdate();
221
+ }
222
+
223
+ get error(): string|undefined {
224
+ return this.#error;
225
+ }
226
+
227
+ set error(error: string|undefined) {
228
+ this.#error = error;
229
+ this.requestUpdate();
230
+ }
231
+
232
+ get valid(): boolean {
233
+ return this.#valid;
234
+ }
235
+
236
+ set valid(valid: boolean) {
237
+ this.#valid = valid;
238
+ this.requestUpdate();
239
+ }
240
+
241
+ get canGoBackInHistory(): boolean {
242
+ return this.#canGoBackInHistory;
243
+ }
244
+
245
+ set canGoBackInHistory(canGoBackInHistory: boolean) {
246
+ this.#canGoBackInHistory = canGoBackInHistory;
247
+ this.requestUpdate();
198
248
  }
199
- }
200
249
 
201
- customElements.define('devtools-linear-memory-inspector-navigator', LinearMemoryNavigator);
250
+ get canGoForwardInHistory(): boolean {
251
+ return this.#canGoForwardInHistory;
252
+ }
253
+
254
+ set canGoForwardInHistory(canGoForwardInHistory: boolean) {
255
+ this.#canGoForwardInHistory = canGoForwardInHistory;
256
+ this.requestUpdate();
257
+ }
258
+
259
+ get mode(): Mode {
260
+ return this.#mode;
261
+ }
202
262
 
203
- declare global {
204
- interface HTMLElementTagNameMap {
205
- 'devtools-linear-memory-inspector-navigator': LinearMemoryNavigator;
263
+ set mode(mode: Mode) {
264
+ this.#mode = mode;
265
+ this.requestUpdate();
266
+ }
267
+
268
+ override performUpdate(): void {
269
+ const shadowRoot = this.element.shadowRoot;
270
+ if (!shadowRoot) {
271
+ return;
272
+ }
273
+ const viewInput: ViewInput = {
274
+ address: this.#address,
275
+ error: this.#error,
276
+ valid: this.#valid,
277
+ canGoBackInHistory: this.#canGoBackInHistory,
278
+ canGoForwardInHistory: this.#canGoForwardInHistory,
279
+ mode: this.#mode,
280
+ onAddressChange: this.onAddressChange,
281
+ onNavigatePage: this.onNavigatePage,
282
+ onNavigateHistory: this.onNavigateHistory,
283
+ onRefreshRequest: this.onRefreshRequest,
284
+ };
285
+ this.#view(viewInput, undefined, shadowRoot);
206
286
  }
207
287
  }
@@ -29,7 +29,7 @@
29
29
  justify-content: center;
30
30
  }
31
31
 
32
- devtools-linear-memory-inspector-navigator + devtools-linear-memory-inspector-viewer {
32
+ .navigator-widget ~ devtools-linear-memory-inspector-viewer {
33
33
  margin-top: 12px;
34
34
  }
35
35
 
@@ -10,7 +10,7 @@ const UIStrings = {
10
10
  /**
11
11
  * @description Text to display to user while a calibration process is running.
12
12
  */
13
- runningCalibration: 'Running CPU calibration, please do not leave this tab or close DevTools.',
13
+ runningCalibration: 'Running CPU calibration, don’t leave this tab or close DevTools.',
14
14
  } as const;
15
15
  const str_ = i18n.i18n.registerUIStrings('panels/mobile_throttling/CalibrationController.ts', UIStrings);
16
16
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -16,17 +16,17 @@ import {
16
16
  const UIStrings = {
17
17
  /**
18
18
  * @description Mobile throttling is disabled. The user can select this option to run mobile
19
- *emulation at a normal speed instead of throttled.
19
+ * emulation at a normal speed instead of throttled.
20
20
  */
21
21
  disabled: 'Disabled',
22
22
  /**
23
23
  * @description Title for a group of pre-decided configuration options for mobile throttling. These
24
- *are useful default options that users might want.
24
+ * are useful default options that users might want.
25
25
  */
26
26
  presets: 'Presets',
27
27
  /**
28
28
  * @description Title for a group of advanced configuration options for mobile throttling, which
29
- *might not be applicable to every user or situation.
29
+ * might not be applicable to every user or situation.
30
30
  */
31
31
  advanced: 'Advanced',
32
32
  } as const;
@@ -9,22 +9,22 @@ import * as UI from '../../ui/legacy/legacy.js';
9
9
 
10
10
  const UIStrings = {
11
11
  /**
12
- * @description Icon title in Network Panel Indicator of the Network panel
12
+ * @description Icon title for warning indicator in the Network panel title.
13
13
  */
14
14
  networkThrottlingIsEnabled: 'Network throttling is enabled',
15
15
  /**
16
- * @description Icon title in Network Panel Indicator of the Network panel
16
+ * @description Icon title for warning indicator in the Network panel title.
17
17
  */
18
- requestsMayBeOverridden: 'Requests may be overridden locally, see the Sources panel',
18
+ requestsMayBeOverridden: 'Requests may be overridden locally. See the Sources panel',
19
19
  /**
20
- * @description Icon title in Network Panel Indicator of the Network panel
20
+ * @description Icon title for warning indicator in the Network panel title.
21
21
  */
22
- requestsMayBeBlocked: 'Requests may be blocked, see the Network request blocking panel',
22
+ requestsMayBeBlocked: 'Requests may be blocked. See the Network request blocking panel',
23
23
  /**
24
24
  * @description Title of an icon in the Network panel that indicates that accepted content encodings have been overridden.
25
25
  */
26
26
  acceptedEncodingOverrideSet:
27
- 'The set of accepted `Content-Encoding` headers has been modified by DevTools, see the Network conditions panel',
27
+ 'The set of accepted `Content-Encoding` headers has been changed by DevTools. See the Network conditions panel',
28
28
  } as const;
29
29
  const str_ = i18n.i18n.registerUIStrings('panels/mobile_throttling/NetworkPanelIndicator.ts', UIStrings);
30
30
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -19,38 +19,38 @@ const {render, html, Directives} = Lit;
19
19
 
20
20
  const UIStrings = {
21
21
  /**
22
- * @description Text to indicate something is not enabled
22
+ * @description Text to indicate something is not enabled.
23
23
  */
24
24
  disabled: 'Disabled',
25
25
  /**
26
- * @description Title for a group of configuration options
26
+ * @description Title for a group of configuration options.
27
27
  */
28
28
  presets: 'Presets',
29
29
  /**
30
- * @description Text in Network Throttling Selector of the Network panel
30
+ * @description Text in network throttling selector of the Network panel.
31
31
  */
32
32
  custom: 'Custom',
33
33
  /**
34
- * @description Title for a network throttling group containing the request blocking option
34
+ * @description Title for a network throttling group containing the request blocking option.
35
35
  */
36
36
  blockingGroup: 'Blocking',
37
37
  /**
38
- *@description Text with two placeholders separated by a colon
39
- *@example {Node removed} PH1
40
- *@example {div#id1} PH2
38
+ * @description Text with two placeholders separated by a colon.
39
+ * @example {Node removed} PH1
40
+ * @example {div#id1} PH2
41
41
  */
42
42
  sS: '{PH1}: {PH2}',
43
43
  /**
44
- *@description Accessibility label for custom add network throttling option
45
- *@example {Custom} PH1
44
+ * @description Accessibility label for custom add network throttling option.
45
+ * @example {Custom} PH1
46
46
  */
47
47
  addS: 'Add {PH1}',
48
48
  /**
49
- *@description Text in Throttling Manager of the Network panel
49
+ * @description Text in throttling manager of the Network panel.
50
50
  */
51
51
  add: 'Add…',
52
52
  /**
53
- * @description Text label for a selection box showing that a specific option is recommended for CPU or Network throttling.
53
+ * @description Text label for a selection box showing that a specific option is recommended for CPU or network throttling.
54
54
  * @example {Fast 4G} PH1
55
55
  * @example {4x slowdown} PH1
56
56
  */
@@ -28,43 +28,43 @@ export interface CPUThrottlingSelectorWrapper {
28
28
 
29
29
  const UIStrings = {
30
30
  /**
31
- *@description Text to indicate the network connectivity is offline
31
+ * @description Text to indicate the network connectivity is offline.
32
32
  */
33
33
  offline: 'Offline',
34
34
  /**
35
- *@description Text in Throttling Manager of the Network panel
35
+ * @description Text in throttling manager of the Network panel.
36
36
  */
37
37
  forceDisconnectedFromNetwork: 'Force disconnected from network',
38
38
  /**
39
- * @description Text for throttling the network
39
+ * @description Text for throttling the network.
40
40
  */
41
41
  throttling: 'Throttling',
42
42
  /**
43
- * @description Icon title in Throttling Manager of the Network panel
43
+ * @description Icon title in throttling manager of the Network panel.
44
44
  */
45
45
  cpuThrottlingIsEnabled: 'CPU throttling is enabled',
46
46
  /**
47
- * @description Screen reader label for a select box that chooses the CPU throttling speed in the Performance panel
47
+ * @description Screen reader label for a select box that chooses the CPU throttling speed in the Performance panel.
48
48
  */
49
49
  cpuThrottling: 'CPU throttling',
50
50
  /**
51
- * @description Tooltip text in Throttling Manager of the Performance panel
51
+ * @description Tooltip text in throttling manager of the Performance panel.
52
52
  */
53
53
  excessConcurrency: 'Exceeding the default value may degrade system performance.',
54
54
  /**
55
- * @description Tooltip text in Throttling Manager of the Performance panel
55
+ * @description Tooltip text in throttling manager of the Performance panel.
56
56
  */
57
57
  resetConcurrency: 'Reset to the default value',
58
58
  /**
59
- * @description Label for an check box that neables overriding navigator.hardwareConcurrency
59
+ * @description Label for a checkbox that enables overriding navigator.hardwareConcurrency.
60
60
  */
61
61
  hardwareConcurrency: 'Hardware concurrency',
62
62
  /**
63
- * @description Tooltip text for an input box that overrides navigator.hardwareConcurrency on the page
63
+ * @description Tooltip text for an input box that overrides navigator.hardwareConcurrency on the page.
64
64
  */
65
- hardwareConcurrencySettingLabel: 'Override the value reported by navigator.hardwareConcurrency',
65
+ hardwareConcurrencySettingLabel: 'Override the value reported by `navigator.hardwareConcurrency`',
66
66
  /**
67
- * @description Text label for a selection box showing that a specific option is recommended for CPU or Network throttling.
67
+ * @description Text label for a selection box showing that a specific option is recommended for CPU or network throttling.
68
68
  * @example {Fast 4G} PH1
69
69
  * @example {4x slowdown} PH1
70
70
  */
@@ -90,9 +90,9 @@ const UIStrings = {
90
90
  */
91
91
  saveDataOff: '\'Save-Data\': off',
92
92
  /**
93
- * @description Tooltip text for an select element that overrides navigator.connection.saveData on the page
93
+ * @description Tooltip text for a select element that overrides navigator.connection.saveData on the page.
94
94
  */
95
- saveDataSettingTooltip: 'Override the value reported by navigator.connection.saveData on the page',
95
+ saveDataSettingTooltip: 'Override the value reported by `navigator.connection.saveData` on the page',
96
96
  } as const;
97
97
  const str_ = i18n.i18n.registerUIStrings('panels/mobile_throttling/ThrottlingManager.ts', UIStrings);
98
98
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -8,45 +8,45 @@ import * as PanelsCommon from '../common/common.js';
8
8
 
9
9
  const UIStrings = {
10
10
  /**
11
- * @description Text for no network throttling
11
+ * @description Text for no network throttling.
12
12
  */
13
13
  noThrottling: 'No CPU and no network throttling',
14
14
  /**
15
- * @description Text in Throttling Presets of the Network panel
15
+ * @description Text in throttling presets of the Network panel.
16
16
  */
17
17
  noInternetConnectivity: 'No internet connectivity',
18
18
  /**
19
- * @description Text in Throttling Presets of the Network panel
19
+ * @description Text in throttling presets of the Network panel.
20
20
  */
21
21
  lowTierMobile: 'Low-tier mobile',
22
22
  /**
23
- * @description Text in Throttling Presets of the Network panel
23
+ * @description Text in throttling presets of the Network panel.
24
24
  */
25
25
  slowGXCpuSlowdown: 'Slow 3G & 6x CPU slowdown',
26
26
  /**
27
- * @description Text in Throttling Presets of the Network panel
27
+ * @description Text in throttling presets of the Network panel.
28
28
  * @example {2.2} PH1
29
29
  */
30
30
  slowGXCpuSlowdownCalibrated: 'Slow 3G & {PH1}x CPU slowdown',
31
31
  /**
32
- * @description Text in Throttling Presets of the Network panel
32
+ * @description Text in throttling presets of the Network panel.
33
33
  */
34
34
  midtierMobile: 'Mid-tier mobile',
35
35
  /**
36
- * @description Text in Throttling Presets of the Network panel
36
+ * @description Text in throttling presets of the Network panel.
37
37
  */
38
38
  fastGXCpuSlowdown: 'Fast 3G & 4x CPU slowdown',
39
39
  /**
40
- * @description Text in Throttling Presets of the Network panel
40
+ * @description Text in throttling presets of the Network panel.
41
41
  * @example {2.2} PH1
42
42
  */
43
43
  fastGXCpuSlowdownCalibrated: 'Fast 3G & {PH1}x CPU slowdown',
44
44
  /**
45
- * @description Text in Network Throttling Selector of the Network panel
45
+ * @description Text in network throttling selector of the Network panel.
46
46
  */
47
47
  custom: 'Custom',
48
48
  /**
49
- * @description Text in Throttling Presets of the Network panel
49
+ * @description Text in throttling presets of the Network panel.
50
50
  */
51
51
  checkNetworkAndPerformancePanels: 'Check Network and Performance panels',
52
52
  } as const;