chrome-devtools-frontend 1.0.1733843 → 1.0.1736236

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 (184) hide show
  1. package/.agents/rules/tests/test-view-and-presenter-isolation.md +4 -4
  2. package/.agents/rules/ui-and-widgets/ui-declarative-tree-and-prompt-patterns.md +61 -0
  3. package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +11 -7
  4. package/.agents/rules/ui-and-widgets/ui-modern-component-and-encapsulation-standards.md +13 -4
  5. package/.agents/rules/ui-and-widgets/ui-pure-view-and-presenter-separation.md +31 -2
  6. package/.agents/rules/ui-and-widgets/ui-reactive-widget-update-lifecycle.md +23 -4
  7. package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +34 -3
  8. package/.agents/skills/code-review/SKILL.md +27 -0
  9. package/.agents/skills/devtools-uistrings/SKILL.md +147 -0
  10. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -1
  11. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +100 -0
  12. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +16 -0
  13. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +13 -2
  14. package/.agents/skills/ui-widgets/SKILL.md +25 -25
  15. package/DIR_METADATA +8 -1
  16. package/docs/cookbook/localization.md +1 -1
  17. package/docs/ui_engineering.md +24 -0
  18. package/eslint.config.mjs +0 -1
  19. package/front_end/application_tokens.css +1 -1
  20. package/front_end/core/host/AidaClient.ts +147 -202
  21. package/front_end/core/host/AidaClientTypes.ts +9 -0
  22. package/front_end/core/host/AidaErrors.ts +416 -0
  23. package/front_end/core/host/AidaGcaTranslation.ts +11 -0
  24. package/front_end/core/host/InspectorFrontendHostAPI.ts +9 -2
  25. package/front_end/core/host/UserMetrics.ts +25 -0
  26. package/front_end/core/host/UserMetricsEnums.ts +25 -0
  27. package/front_end/core/host/host.ts +3 -1
  28. package/front_end/core/i18n/collect-ui-strings.js +20 -0
  29. package/front_end/core/root/Runtime.ts +12 -0
  30. package/front_end/core/sdk/CPUThrottlingManager.ts +3 -0
  31. package/front_end/core/sdk/EnhancedTracesParser.ts +8 -4
  32. package/front_end/core/sdk/NetworkManager.ts +0 -6
  33. package/front_end/core/sdk/OverlayModel.ts +0 -6
  34. package/front_end/core/sdk/PreloadingModel.ts +30 -13
  35. package/front_end/core/sdk/PrivateVerificationTokensModel.ts +0 -18
  36. package/front_end/core/sdk/RehydratingConnection.ts +5 -2
  37. package/front_end/core/sdk/ResourceTreeModel.ts +0 -42
  38. package/front_end/core/sdk/ScreenCaptureModel.ts +0 -84
  39. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -15
  40. package/front_end/core/sdk/StorageBucketsModel.ts +0 -15
  41. package/front_end/devtools_compatibility.js +57 -2
  42. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +4 -2
  43. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +203 -127
  44. package/front_end/entrypoints/inspector_main/renderingOptions.css +5 -0
  45. package/front_end/entrypoints/node_app/app/NodeMain.ts +0 -9
  46. package/front_end/entrypoints/node_app/app/nodeConnectionsPanel.css +0 -22
  47. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  48. package/front_end/generated/SupportedCSSProperties.ts +0 -136
  49. package/front_end/generated/protocol-proxy-api.d.ts +231 -231
  50. package/front_end/generated/protocol.ts +1 -0
  51. package/front_end/models/ai_assistance/AiAgent2.ts +4 -1
  52. package/front_end/models/ai_assistance/ChangeManager.ts +3 -1
  53. package/front_end/models/ai_assistance/DOMHelpers.ts +118 -3
  54. package/front_end/models/ai_assistance/ExtensionScope.ts +31 -24
  55. package/front_end/models/ai_assistance/agents/AiAgent.ts +6 -0
  56. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +13 -13
  57. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
  58. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  59. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +18 -8
  60. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +2 -2
  61. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +103 -81
  62. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +15 -203
  63. package/front_end/models/ai_assistance/injected.ts +6 -1
  64. package/front_end/models/ai_assistance/skills/lighthouse.md +1 -1
  65. package/front_end/models/ai_assistance/skills/styling.md +8 -10
  66. package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +1 -1
  67. package/front_end/models/ai_assistance/tools/SetElementStyles.ts +288 -0
  68. package/front_end/models/ai_assistance/tools/Tool.ts +1 -0
  69. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +3 -0
  70. package/front_end/models/bindings/ResourceScriptMapping.ts +64 -16
  71. package/front_end/models/comment_manager/CD4ABridge.ts +12 -2
  72. package/front_end/models/comment_manager/CommentManager.ts +24 -4
  73. package/front_end/models/javascript_metadata/NativeFunctions.ts +41 -1
  74. package/front_end/models/project_settings/ProjectSettingsModel.ts +1 -1
  75. package/front_end/models/trace/handlers/FlowsHandler.ts +10 -0
  76. package/front_end/models/trace/handlers/SamplesHandler.ts +3 -2
  77. package/front_end/models/trace/handlers/ScriptsHandler.ts +25 -26
  78. package/front_end/models/trace/helpers/TreeHelpers.ts +4 -0
  79. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -2
  80. package/front_end/models/trace/types/TraceEvents.ts +21 -22
  81. package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -1
  82. package/front_end/panels/ai_assistance/components/chatInput.css +4 -4
  83. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  84. package/front_end/panels/animation/animationTimeline.css +6 -4
  85. package/front_end/panels/application/IndexedDBModel.ts +0 -15
  86. package/front_end/panels/application/appManifestView.css +2 -5
  87. package/front_end/panels/application/components/backForwardCacheView.css +1 -5
  88. package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
  89. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -0
  90. package/front_end/panels/comments/CommentsPane.ts +12 -7
  91. package/front_end/panels/comments/commentsPane.css +16 -2
  92. package/front_end/panels/common/CommentsOverlayWidget.ts +16 -10
  93. package/front_end/panels/common/CommentsStatusBarPill.ts +12 -5
  94. package/front_end/panels/common/commentsOverlay.css +7 -1
  95. package/front_end/panels/common/commentsStatusBarPill.css +30 -0
  96. package/front_end/panels/console/consolePrompt.css +0 -12
  97. package/front_end/panels/console/consoleView.css +2 -2
  98. package/front_end/panels/developer_resources/developerResourcesView.css +4 -3
  99. package/front_end/panels/elements/DOMTreeWidget.ts +29 -9
  100. package/front_end/panels/elements/StylePropertyTreeElement.ts +2 -1
  101. package/front_end/panels/elements/components/CSSHintDetailsView.ts +12 -5
  102. package/front_end/panels/elements/components/cssVariableValueView.css +1 -1
  103. package/front_end/panels/elements/components/elementsBreadcrumbs.css +2 -2
  104. package/front_end/panels/elements/domTreeWidget.css +6 -1
  105. package/front_end/panels/elements/elementsPanel.css +0 -6
  106. package/front_end/panels/elements/layoutPane.css +1 -1
  107. package/front_end/panels/elements/metricsSidebarPane.css +1 -1
  108. package/front_end/panels/elements/platformFontsWidget.css +1 -1
  109. package/front_end/panels/elements/stylesSidebarPane.css +0 -10
  110. package/front_end/panels/emulation/deviceModeView.css +6 -7
  111. package/front_end/panels/explain/components/consoleInsight.css +4 -4
  112. package/front_end/panels/issues/issuesTree.css +1 -26
  113. package/front_end/panels/lighthouse/lighthouseStartView.css +2 -2
  114. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
  115. package/front_end/panels/media/TickingFlameChart.ts +20 -3
  116. package/front_end/panels/media/playerMessagesView.css +2 -2
  117. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +24 -5
  118. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +1 -6
  119. package/front_end/panels/network/networkLogView.css +2 -2
  120. package/front_end/panels/network/networkTimingTable.css +1 -1
  121. package/front_end/panels/performance_monitor/performanceMonitor.css +0 -4
  122. package/front_end/panels/protocol_monitor/JSONEditor.css +1 -1
  123. package/front_end/panels/protocol_monitor/JSONEditor.ts +4 -2
  124. package/front_end/panels/recorder/recorderPanel.css +3 -3
  125. package/front_end/panels/recorder/recordingListView.css +1 -1
  126. package/front_end/panels/screencast/screencastView.css +1 -1
  127. package/front_end/panels/search/searchResultsPane.css +1 -1
  128. package/front_end/panels/security/SecurityModel.ts +0 -6
  129. package/front_end/panels/security/SecurityPanel.ts +120 -108
  130. package/front_end/panels/security/originView.css +1 -1
  131. package/front_end/panels/sensors/locationsSettingsTab.css +3 -3
  132. package/front_end/panels/settings/EditFileSystemView.ts +159 -104
  133. package/front_end/panels/settings/editFileSystemView.css +30 -4
  134. package/front_end/panels/settings/emulation/devicesSettingsTab.css +0 -52
  135. package/front_end/panels/settings/settingsScreen.css +0 -7
  136. package/front_end/panels/sources/CallStackSidebarPane.ts +339 -221
  137. package/front_end/panels/sources/NavigatorView.ts +95 -8
  138. package/front_end/panels/sources/ThreadsSidebarPane.ts +8 -4
  139. package/front_end/panels/sources/breakpointsView.css +1 -3
  140. package/front_end/panels/sources/callStackSidebarPane.css +4 -0
  141. package/front_end/panels/sources/components/HeadersView.ts +15 -2
  142. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -1
  143. package/front_end/panels/timeline/CountersGraph.ts +0 -4
  144. package/front_end/panels/timeline/TimelineLoader.ts +16 -6
  145. package/front_end/panels/timeline/TimelinePanel.ts +20 -12
  146. package/front_end/panels/timeline/TimelineUIUtils.ts +1 -1
  147. package/front_end/panels/timeline/components/DetailsView.ts +2 -1
  148. package/front_end/panels/timeline/components/cwvMetrics.css +1 -1
  149. package/front_end/panels/timeline/components/metricCard.css +1 -1
  150. package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +4 -4
  151. package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
  152. package/front_end/panels/webauthn/WebauthnPane.ts +13 -14
  153. package/front_end/panels/webauthn/webauthnPane.css +1 -1
  154. package/front_end/third_party/chromium/README.chromium +1 -1
  155. package/front_end/ui/comments/CommentOverlayManager.ts +34 -18
  156. package/front_end/ui/components/icon_button/FileSourceIcon.ts +6 -0
  157. package/front_end/ui/components/input/textInput.css +1 -1
  158. package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +6 -4
  159. package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
  160. package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +14 -2
  161. package/front_end/ui/legacy/DockController.ts +17 -4
  162. package/front_end/ui/legacy/Treeoutline.ts +2 -2
  163. package/front_end/ui/legacy/UIUtils.ts +148 -10
  164. package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +3 -2
  165. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +2 -2
  166. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +2 -2
  167. package/front_end/ui/legacy/components/perf_ui/pieChart.css +1 -1
  168. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +5 -4
  169. package/front_end/ui/legacy/components/source_frame/imageView.css +1 -1
  170. package/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +0 -3
  171. package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
  172. package/front_end/ui/legacy/inspectorCommon.css +1 -14
  173. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +3 -2
  174. package/front_end/ui/legacy/listWidget.css +0 -18
  175. package/front_end/ui/legacy/theme_support/ThemeSupport.ts +44 -9
  176. package/front_end/ui/lit/strip-whitespace.ts +1 -1
  177. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  178. package/package.json +3 -3
  179. package/front_end/generated/Deprecation.ts +0 -471
  180. package/front_end/panels/accessibility/axBreadcrumbs.css +0 -155
  181. package/front_end/panels/network/requestHeadersTree.css +0 -226
  182. package/front_end/panels/recorder/startView.css +0 -38
  183. package/front_end/panels/security/ipProtectionView.css +0 -141
  184. package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +0 -27
@@ -2,17 +2,19 @@
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
4
 
5
- import '../../ui/legacy/components/data_grid/data_grid.js';
5
+ import '../../ui/components/lists/lists.js';
6
6
 
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
8
  import * as Platform from '../../core/platform/platform.js';
9
9
  import type * as Persistence from '../../models/persistence/persistence.js';
10
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
11
+ import type * as Lists from '../../ui/components/lists/lists.js';
10
12
  import * as UI from '../../ui/legacy/legacy.js';
11
- import {Directives, html, render} from '../../ui/lit/lit.js';
13
+ import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
12
14
 
13
15
  import editFileSystemViewStyles from './editFileSystemView.css.js';
14
16
 
15
- const {styleMap} = Directives;
17
+ const {ifDefined, repeat} = Directives;
16
18
 
17
19
  const UIStrings = {
18
20
  /**
@@ -31,181 +33,234 @@ const UIStrings = {
31
33
  * @description Error message when a file system path is identical to an existing path.
32
34
  */
33
35
  enterAUniquePath: 'Enter a unique path',
36
+ /**
37
+ * @description Text for the button to add a new excluded sub-folder.
38
+ */
39
+ addSubfolder: 'Add sub-folder',
40
+ /**
41
+ * @description Accessible label for the excluded sub-folder path input in Workspace settings.
42
+ */
43
+ folderPath: 'Folder path',
34
44
  } as const;
35
45
  const str_ = i18n.i18n.registerUIStrings('panels/settings/EditFileSystemView.ts', UIStrings);
36
46
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
37
47
 
38
- export const enum ExcludedFolderStatus {
39
- VALID = 1,
40
- ERROR_NOT_A_PATH = 2,
41
- ERROR_NOT_UNIQUE = 3,
42
- }
43
-
44
- function statusString(status: ExcludedFolderStatus): Platform.UIString.LocalizedString {
45
- switch (status) {
46
- case ExcludedFolderStatus.ERROR_NOT_A_PATH:
47
- return i18nString(UIStrings.enterAPath);
48
- case ExcludedFolderStatus.ERROR_NOT_UNIQUE:
49
- return i18nString(UIStrings.enterAUniquePath);
50
- case ExcludedFolderStatus.VALID:
51
- throw new Error('unreachable');
52
- }
53
- }
54
-
55
- export interface PathWithStatus {
56
- path: Platform.DevToolsPath.EncodedPathString;
57
- status: ExcludedFolderStatus;
58
- }
48
+ const NEW_ITEM_KEY = Symbol('new-excluded-folder');
59
49
 
60
50
  export interface EditFileSystemViewInput {
61
51
  fileSystemPath: Platform.DevToolsPath.UrlString;
62
- excludedFolderPaths: PathWithStatus[];
63
- onCreate: (event: CustomEvent<{url?: string}>) => void;
64
- onEdit: (event: CustomEvent<{columnId: string, valueBeforeEditing: string, newText: string}>) => void;
65
- onDelete: (event: CustomEvent) => void;
52
+ excludedFolders: Platform.DevToolsPath.EncodedPathString[];
53
+ editingIndex: number|null;
54
+ onAdd: () => void;
55
+ onEdit: (index: number) => void;
56
+ onDelete: (index: number) => void;
57
+ onCommit: (index: number, value: string) => void;
58
+ onCancel: () => void;
59
+ validateFolder: (index: number, value: string) => Platform.UIString.LocalizedString | null;
66
60
  }
67
61
 
68
62
  export type View = (input: EditFileSystemViewInput, output: undefined, target: HTMLElement) => void;
69
63
 
64
+ function renderExcludedFolderRow(folder: string, index: number, input: EditFileSystemViewInput): LitTemplate {
65
+ const editing = input.editingIndex === index;
66
+ const onPromptActivate = (event: Event): void => {
67
+ if (editing) {
68
+ return;
69
+ }
70
+ input.onEdit(index);
71
+ event.consume(true);
72
+ };
73
+
74
+ // clang-format off
75
+ return html`
76
+ <div
77
+ class="excluded-folder-row"
78
+ ?editable=${!editing}
79
+ ?deletable=${!editing}>
80
+ <devtools-prompt
81
+ class="excluded-folder-path"
82
+ render-as-block
83
+ title=${ifDefined(folder || undefined)}
84
+ aria-label=${ifDefined(editing ? i18nString(UIStrings.folderPath) : undefined)}
85
+ value=${folder}
86
+ ?editing=${editing}
87
+ .validator=${(value: string) => input.validateFolder(index, value)}
88
+ @click=${onPromptActivate}
89
+ @commit=${(event: UI.TextPrompt.TextPromptElement.CommitEvent) => input.onCommit(index, event.detail)}
90
+ @cancel=${input.onCancel}>
91
+ ${folder}
92
+ </devtools-prompt>
93
+ </div>
94
+ `;
95
+ // clang-format on
96
+ }
97
+
70
98
  export const DEFAULT_VIEW: View = (input, _output, target) => {
99
+ const isAdding = input.editingIndex === input.excludedFolders.length;
100
+ const items = isAdding ? [...input.excludedFolders, ''] : input.excludedFolders;
71
101
  // clang-format off
72
102
  render(html`
73
- <style>${editFileSystemViewStyles}</style>
74
- <div class="excluded-folder-header">
75
- <span>${i18nString(UIStrings.url)}</span>
76
- <span class="excluded-folder-url">${input.fileSystemPath}</span>
77
- <devtools-data-grid
78
- @create=${input.onCreate}
79
- class="exclude-subfolders-table"
80
- parts="excluded-folder-row-with-error"
81
- inline striped deletable>
82
- <table>
83
- <thead>
84
- <tr>
85
- <th id="url" editable>${i18nString(UIStrings.excludedFolders)}</th>
86
- </tr>
87
- </thead>
88
- <tbody>
89
- ${input.excludedFolderPaths.map((path, index) => html`
90
- <tr data-url=${path.path} data-index=${index}
91
- @edit=${input.onEdit}
92
- @delete=${input.onDelete}>
93
- <td style=${styleMap({backgroundColor: path.status !== ExcludedFolderStatus.VALID ? 'var(--sys-color-error-container)' : undefined})}>${path.path}</td>
94
- </tr>
95
- `)}
96
- <tr placeholder></tr>
97
- </tbody>
98
- </table>
99
- </devtools-data-grid>
100
- ${input.excludedFolderPaths.filter(({status}) => status !== ExcludedFolderStatus.VALID).map(({status}) =>
101
- html`<span class="excluded-folder-error">${statusString(status)}</span>`)}
102
- </div>`, target);
103
+ <style>${editFileSystemViewStyles}</style>
104
+ <div class="excluded-folder-header">
105
+ <span>${i18nString(UIStrings.url)}</span>
106
+ <span class="excluded-folder-url">${input.fileSystemPath}</span>
107
+ <div class="excluded-folders-title">${i18nString(UIStrings.excludedFolders)}</div>
108
+ ${items.length > 0 ? html`
109
+ <devtools-list
110
+ ?disable-li-focus=${input.editingIndex !== null}
111
+ @edit=${(e: Lists.List.ItemEditEvent) => input.onEdit(e.detail.index)}
112
+ @delete=${(e: Lists.List.ItemRemoveEvent) => input.onDelete(e.detail.index)}>
113
+ ${repeat(
114
+ items,
115
+ (folder, index) => index === input.excludedFolders.length ? NEW_ITEM_KEY : folder,
116
+ (folder, index) => renderExcludedFolderRow(folder, index, input))}
117
+ </devtools-list>
118
+ ` : nothing}
119
+ <devtools-button
120
+ class="add-subfolder-button"
121
+ .variant=${Buttons.Button.Variant.OUTLINED}
122
+ .jslogContext=${'settings.add-excluded-folder'}
123
+ @click=${input.onAdd}>
124
+ ${i18nString(UIStrings.addSubfolder)}
125
+ </devtools-button>
126
+ </div>
127
+ `, target);
103
128
  // clang-format on
104
129
  };
105
130
 
106
131
  export class EditFileSystemView extends UI.Widget.VBox {
107
132
  #fileSystem?: Persistence.PlatformFileSystem.PlatformFileSystem;
108
- #excludedFolderPaths: PathWithStatus[] = [];
133
+ #excludedFolders: Platform.DevToolsPath.EncodedPathString[] = [];
134
+ #editingIndex: number|null = null;
109
135
  readonly #view: View;
110
136
 
111
- constructor(element: HTMLElement|undefined, view: View = DEFAULT_VIEW) {
137
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
112
138
  super(element);
113
139
  this.#view = view;
114
140
  }
115
141
 
116
142
  set fileSystem(fileSystem: Persistence.PlatformFileSystem.PlatformFileSystem) {
143
+ if (this.#fileSystem === fileSystem) {
144
+ return;
145
+ }
117
146
  this.#fileSystem = fileSystem;
118
- this.#resyncExcludedFolderPaths();
147
+ this.#editingIndex = null;
148
+ this.#resyncExcludedFolders();
119
149
  this.requestUpdate();
120
150
  }
121
151
 
122
152
  override wasShown(): void {
123
153
  super.wasShown();
124
- this.#resyncExcludedFolderPaths();
154
+ this.#editingIndex = null;
155
+ this.#resyncExcludedFolders();
125
156
  this.requestUpdate();
126
157
  }
127
158
 
128
- #resyncExcludedFolderPaths(): void {
129
- this.#excludedFolderPaths =
130
- this.#fileSystem?.excludedFolders()
131
- .values()
132
- .map((path: Platform.DevToolsPath.EncodedPathString) => ({path, status: ExcludedFolderStatus.VALID}))
133
- .toArray() ??
134
- [];
159
+ override willHide(): void {
160
+ super.willHide();
161
+ this.#editingIndex = null;
162
+ }
163
+
164
+ #resyncExcludedFolders(): void {
165
+ this.#excludedFolders = this.#fileSystem?.excludedFolders().values().toArray() ?? [];
135
166
  }
136
167
 
137
168
  override performUpdate(): void {
138
169
  const input: EditFileSystemViewInput = {
139
170
  fileSystemPath: this.#fileSystem?.path() ?? Platform.DevToolsPath.urlString``,
140
- excludedFolderPaths: this.#excludedFolderPaths,
141
- onCreate: e => this.#onCreate(e.detail.url),
142
- onEdit: e => this.#onEdit(
143
- (e.currentTarget as HTMLElement).dataset.index ?? '-1', e.detail.valueBeforeEditing, e.detail.newText),
144
- onDelete: e => this.#onDelete((e.currentTarget as HTMLElement).dataset.index ?? '-1'),
171
+ excludedFolders: [...this.#excludedFolders],
172
+ editingIndex: this.#editingIndex,
173
+ onAdd: this.#onAdd.bind(this),
174
+ onEdit: this.#onEdit.bind(this),
175
+ onDelete: this.#onDelete.bind(this),
176
+ onCommit: this.#onCommit.bind(this),
177
+ onCancel: this.#onCancel.bind(this),
178
+ validateFolder: this.#validateFolder.bind(this),
145
179
  };
146
180
  this.#view(input, undefined, this.contentElement);
147
181
  }
148
182
 
149
- #onCreate(url?: string): void {
150
- if (url === undefined) {
151
- // The data grid fires onCreate even when the user just selects and then deselects the
152
- // creation row. Ignore those occurrences.
183
+ #onAdd(): void {
184
+ if (this.#editingIndex === this.#excludedFolders.length) {
153
185
  return;
154
186
  }
187
+ this.#editingIndex = this.#excludedFolders.length;
188
+ this.requestUpdate();
189
+ }
155
190
 
156
- const pathWithStatus = this.#validateFolder(url);
157
- this.#excludedFolderPaths.push(pathWithStatus);
158
- if (pathWithStatus.status === ExcludedFolderStatus.VALID) {
159
- this.#fileSystem?.addExcludedFolder(pathWithStatus.path);
191
+ #onEdit(index: number): void {
192
+ if (index < 0 || index >= this.#excludedFolders.length) {
193
+ return;
160
194
  }
161
-
195
+ this.#editingIndex = index;
162
196
  this.requestUpdate();
163
197
  }
164
198
 
165
- #onEdit(idx: string, valueBeforeEditing: string, newText: string): void {
166
- const index = Number.parseInt(idx, 10);
167
- if (index < 0 || index >= this.#excludedFolderPaths.length) {
199
+ #onCancel(): void {
200
+ if (!this.isShowing() || this.#editingIndex === null) {
168
201
  return;
169
202
  }
203
+ this.#editingIndex = null;
204
+ this.requestUpdate();
205
+ }
170
206
 
171
- const pathWithStatus = this.#validateFolder(newText);
172
- const oldPathWithStatus = this.#excludedFolderPaths[index];
173
- this.#excludedFolderPaths[index] = pathWithStatus;
174
-
175
- if (oldPathWithStatus.status === ExcludedFolderStatus.VALID) {
176
- this.#fileSystem?.removeExcludedFolder(valueBeforeEditing as Platform.DevToolsPath.EncodedPathString);
207
+ #onCommit(index: number, rawValue: string): void {
208
+ if (!this.isShowing() || this.#editingIndex === null) {
209
+ return;
210
+ }
211
+ const isNew = index === this.#excludedFolders.length;
212
+ if (!isNew && (index < 0 || index >= this.#excludedFolders.length)) {
213
+ return;
214
+ }
215
+ if (this.#validateFolder(index, rawValue) !== null) {
216
+ return;
177
217
  }
178
218
 
179
- if (pathWithStatus.status === ExcludedFolderStatus.VALID) {
180
- this.#fileSystem?.addExcludedFolder(pathWithStatus.path);
219
+ const path = EditFileSystemView.#normalizePrefix(rawValue.trim()) as Platform.DevToolsPath.EncodedPathString;
220
+ if (isNew) {
221
+ this.#excludedFolders.push(path);
222
+ this.#fileSystem?.addExcludedFolder(path);
223
+ } else if (this.#excludedFolders[index] !== path) {
224
+ this.#fileSystem?.removeExcludedFolder(this.#excludedFolders[index]);
225
+ this.#excludedFolders[index] = path;
226
+ this.#fileSystem?.addExcludedFolder(path);
181
227
  }
182
228
 
229
+ this.#editingIndex = null;
183
230
  this.requestUpdate();
184
231
  }
185
232
 
186
- #onDelete(idx: string): void {
187
- const index = Number.parseInt(idx, 10);
188
- if (index < 0 || index >= this.#excludedFolderPaths.length) {
233
+ #onDelete(index: number): void {
234
+ if (index < 0 || index >= this.#excludedFolders.length) {
189
235
  return;
190
236
  }
191
237
 
192
- this.#fileSystem?.removeExcludedFolder(this.#excludedFolderPaths[index].path);
193
- this.#excludedFolderPaths.splice(index, 1);
238
+ this.#fileSystem?.removeExcludedFolder(this.#excludedFolders[index]);
239
+ this.#excludedFolders.splice(index, 1);
240
+
241
+ if (this.#editingIndex !== null) {
242
+ if (this.#editingIndex === index) {
243
+ this.#editingIndex = null;
244
+ } else if (this.#editingIndex > index) {
245
+ this.#editingIndex--;
246
+ }
247
+ }
194
248
 
195
249
  this.requestUpdate();
196
250
  }
197
251
 
198
- #validateFolder(rawInput: string): PathWithStatus {
252
+ #validateFolder(index: number, rawInput: string): Platform.UIString.LocalizedString|null {
199
253
  const path = EditFileSystemView.#normalizePrefix(rawInput.trim()) as Platform.DevToolsPath.EncodedPathString;
200
254
  if (!path) {
201
- return {path, status: ExcludedFolderStatus.ERROR_NOT_A_PATH};
255
+ return i18nString(UIStrings.enterAPath);
202
256
  }
203
257
 
204
- if (this.#excludedFolderPaths.findIndex(({path: p}) => p === path) !== -1) {
205
- return {path, status: ExcludedFolderStatus.ERROR_NOT_UNIQUE};
258
+ const isDuplicate = this.#excludedFolders.some((p, i) => i !== index && p === path);
259
+ if (isDuplicate) {
260
+ return i18nString(UIStrings.enterAUniquePath);
206
261
  }
207
262
 
208
- return {path, status: ExcludedFolderStatus.VALID};
263
+ return null;
209
264
  }
210
265
 
211
266
  static #normalizePrefix(prefix: string): string {
@@ -18,11 +18,37 @@
18
18
  }
19
19
  }
20
20
 
21
- .exclude-subfolders-table {
22
- padding: var(--sys-size-4) 0;
21
+ .excluded-folder-row {
22
+ display: flex;
23
+ align-items: center;
24
+ flex: auto;
25
+ min-width: 0;
26
+ padding: var(--sys-size-2) var(--sys-size-4);
27
+
28
+ &:has(devtools-prompt[editing]) {
29
+ align-self: stretch;
30
+ background-color: var(--app-color-card-background, var(--sys-color-cdt-base-container));
31
+ }
32
+ }
33
+
34
+ .excluded-folder-path {
35
+ flex: auto;
36
+ white-space: nowrap;
37
+ text-overflow: ellipsis;
38
+ overflow: hidden;
39
+
40
+ --devtools-text-prompt-min-width: 6em;
41
+ }
42
+
43
+ devtools-prompt.excluded-folder-path {
44
+ cursor: text;
45
+ }
46
+
47
+ devtools-prompt.excluded-folder-path[editing] {
48
+ overflow: visible;
23
49
  }
24
50
 
25
- .excluded-folder-error {
26
- color: var(--sys-color-error);
51
+ .add-subfolder-button {
52
+ align-self: flex-start;
27
53
  }
28
54
  }
@@ -32,20 +32,6 @@
32
32
  padding: var(--sys-size-5) var(--sys-size-6);
33
33
  }
34
34
 
35
- .devices-settings-tab .devices-button-row {
36
- flex: none;
37
- display: flex;
38
-
39
- devtools-button {
40
- margin: var(--sys-size-3) 0 0 5px;
41
- }
42
- }
43
-
44
- .devices-settings-tab .devices-list {
45
- width: min(350px, 100%);
46
- margin-top: 10px;
47
- }
48
-
49
35
  .devices-list-item {
50
36
  padding: var(--sys-size-3) var(--sys-size-6);
51
37
  height: var(--sys-size-13);
@@ -92,49 +78,11 @@
92
78
  margin-bottom: 0;
93
79
  }
94
80
 
95
- .devices-edit-client-hints-heading {
96
- display: flex;
97
- flex-direction: row;
98
- align-items: center;
99
- margin-bottom: 5px;
100
- }
101
- /* Don't want the bottom margin in the specific case of the folding one;
102
- * it messes with alignment with the arrow (which is a ::before) and it's
103
- * spaced reasonably without it anyway
104
- */
105
- li .devices-edit-client-hints-heading {
106
- margin-bottom: 0;
107
- }
108
-
109
- .devices-edit-client-hints-heading b {
110
- margin-inline-end: var(--sys-size-2);
111
- }
112
-
113
- .devices-edit-client-hints-heading .help-icon {
114
- margin-left: var(--sys-size-2);
115
- margin-right: var(--sys-size-2);
116
- vertical-align: middle;
117
- }
118
-
119
- .devices-edit-client-hints-heading a:focus {
120
- box-shadow: var(--sys-color-state-focus-ring);
121
- }
122
-
123
81
  .devices-edit-fields input {
124
82
  flex: auto;
125
83
  margin: var(--sys-size-5) 5px 0;
126
84
  }
127
85
 
128
- li.devices-edit-client-hints-field {
129
- /* Cancel out padding from treeview's .tree-outline ol */
130
- left: calc(-1 * var(--sys-size-6));
131
- }
132
-
133
- .devices-edit-client-hints-field input {
134
- flex: auto;
135
- margin: var(--sys-size-5) 5px 0;
136
- }
137
-
138
86
  .devices-edit-fields .device-edit-fixed {
139
87
  flex: 0 0 140px;
140
88
  }
@@ -9,13 +9,6 @@
9
9
  background-color: var(--sys-color-cdt-base-container);
10
10
  }
11
11
 
12
- .settings-content {
13
- overflow: hidden auto;
14
- margin: var(--sys-size-5) var(--sys-size-5) var(--sys-size-5) 0;
15
- padding: 0 var(--sys-size-3);
16
- flex: auto;
17
- }
18
-
19
12
  .settings-experiments-block {
20
13
  padding: 0 var(--sys-size-6) var(--sys-size-5) var(--sys-size-4);
21
14
  }