chrome-devtools-frontend 1.0.980193 → 1.0.981004

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 (29) hide show
  1. package/front_end/core/common/ParsedURL.ts +37 -4
  2. package/front_end/core/platform/DevToolsPath.ts +3 -0
  3. package/front_end/core/sdk/CSSRule.ts +2 -2
  4. package/front_end/core/sdk/DOMDebuggerModel.ts +2 -2
  5. package/front_end/core/sdk/NetworkRequest.ts +1 -1
  6. package/front_end/core/sdk/SourceMap.ts +14 -5
  7. package/front_end/core/sdk/Target.ts +2 -2
  8. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +26 -17
  9. package/front_end/legacy_test_runner/bindings_test_runner/BindingsTestRunner.js +5 -0
  10. package/front_end/models/bindings/BreakpointManager.ts +0 -2
  11. package/front_end/models/bindings/ContentProviderBasedProject.ts +6 -4
  12. package/front_end/models/persistence/EditFileSystemView.ts +3 -1
  13. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +14 -9
  14. package/front_end/models/persistence/IsolatedFileSystem.ts +66 -40
  15. package/front_end/models/persistence/IsolatedFileSystemManager.ts +4 -3
  16. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -5
  17. package/front_end/models/persistence/PlatformFileSystem.ts +15 -10
  18. package/front_end/models/workspace/UISourceCode.ts +4 -2
  19. package/front_end/models/workspace/WorkspaceImpl.ts +9 -5
  20. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  21. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -2
  22. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +25 -19
  23. package/front_end/panels/sources/NavigatorView.ts +9 -5
  24. package/front_end/panels/sources/SourcesNavigator.ts +2 -2
  25. package/front_end/ui/components/buttons/Button.ts +11 -1
  26. package/front_end/ui/components/buttons/button.css +31 -10
  27. package/front_end/ui/components/docs/button/basic.ts +47 -1
  28. package/front_end/ui/legacy/themeColors.css +4 -0
  29. package/package.json +1 -1
@@ -28,6 +28,8 @@
28
28
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  */
30
30
 
31
+ // TODO(crbug.com/1253323): Casts to Branded Types will be removed from this file when migration to branded types is complete.
32
+
31
33
  import * as Common from '../../core/common/common.js';
32
34
  import * as Host from '../../core/host/host.js';
33
35
  import * as i18n from '../../core/i18n/i18n.js';
@@ -843,7 +845,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
843
845
  }
844
846
 
845
847
  handleFolderContextMenu(event: Event, node: NavigatorTreeNode): void {
846
- const path = (node as NavigatorFolderTreeNode).folderPath || '';
848
+ const path = (node as NavigatorFolderTreeNode).folderPath || Platform.DevToolsPath.EmptyEncodedPathString;
847
849
  const project = (node as NavigatorFolderTreeNode).project || null;
848
850
 
849
851
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
@@ -914,7 +916,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
914
916
  if (uiSourceCodeToCopy) {
915
917
  content = (await uiSourceCodeToCopy.requestContent()).content || '';
916
918
  }
917
- const uiSourceCode = await project.createFile(path, null, content);
919
+ const uiSourceCode = await project.createFile(path as Platform.DevToolsPath.EncodedPathString, null, content);
918
920
  if (!uiSourceCode) {
919
921
  return;
920
922
  }
@@ -1413,7 +1415,9 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
1413
1415
  if (this.treeElement) {
1414
1416
  this.treeElement.title = newTitle;
1415
1417
  }
1416
- void this.uiSourceCodeInternal.rename(newTitle).then(renameCallback.bind(this));
1418
+ // necessary cast to RawPathString as alternative would be altering type of Config<T>
1419
+ void this.uiSourceCodeInternal.rename(newTitle as Platform.DevToolsPath.RawPathString)
1420
+ .then(renameCallback.bind(this));
1417
1421
  return;
1418
1422
  }
1419
1423
  afterEditing.call(this, true);
@@ -1453,7 +1457,7 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
1453
1457
 
1454
1458
  export class NavigatorFolderTreeNode extends NavigatorTreeNode {
1455
1459
  project: Workspace.Workspace.Project|null;
1456
- readonly folderPath: string;
1460
+ readonly folderPath: Platform.DevToolsPath.EncodedPathString;
1457
1461
  title: string;
1458
1462
  treeElement!: NavigatorFolderTreeElement|null;
1459
1463
  constructor(
@@ -1461,7 +1465,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
1461
1465
  folderPath: string, title: string) {
1462
1466
  super(navigatorView, id, type);
1463
1467
  this.project = project;
1464
- this.folderPath = folderPath;
1468
+ this.folderPath = folderPath as Platform.DevToolsPath.EncodedPathString;
1465
1469
  this.title = title;
1466
1470
  }
1467
1471
 
@@ -31,9 +31,9 @@
31
31
  import * as Common from '../../core/common/common.js';
32
32
  import * as Host from '../../core/host/host.js';
33
33
  import * as i18n from '../../core/i18n/i18n.js';
34
+ import * as Platform from '../../core/platform/platform.js';
34
35
  import * as SDK from '../../core/sdk/sdk.js';
35
36
  import * as Persistence from '../../models/persistence/persistence.js';
36
- import type * as Platform from '../../core/platform/platform.js';
37
37
  import * as Workspace from '../../models/workspace/workspace.js';
38
38
  import * as UI from '../../ui/legacy/legacy.js';
39
39
  import * as Snippets from '../snippets/snippets.js';
@@ -406,7 +406,7 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
406
406
  switch (actionId) {
407
407
  case 'sources.create-snippet':
408
408
  void Snippets.ScriptSnippetFileSystem.findSnippetsProject()
409
- .createFile('', null, '')
409
+ .createFile(Platform.DevToolsPath.EmptyEncodedPathString, null, '')
410
410
  .then(uiSourceCode => Common.Revealer.reveal(uiSourceCode));
411
411
  return true;
412
412
  case 'sources.add-folder-to-workspace':
@@ -18,6 +18,7 @@ export const enum Variant {
18
18
  PRIMARY = 'primary',
19
19
  SECONDARY = 'secondary',
20
20
  TOOLBAR = 'toolbar',
21
+ ROUND = 'round',
21
22
  }
22
23
 
23
24
  export const enum Size {
@@ -40,7 +41,7 @@ interface ButtonState {
40
41
  }
41
42
 
42
43
  export type ButtonData = {
43
- variant: Variant.TOOLBAR,
44
+ variant: Variant.TOOLBAR|Variant.ROUND,
44
45
  iconUrl: string,
45
46
  size?: Size,
46
47
  disabled?: boolean,
@@ -199,10 +200,19 @@ export class Button extends HTMLElement {
199
200
  throw new Error('Tooblar button does not accept children');
200
201
  }
201
202
  }
203
+ if (this.#props.variant === Variant.ROUND) {
204
+ if (!this.#props.iconUrl) {
205
+ throw new Error('Round button requires an icon');
206
+ }
207
+ if (!this.#isEmpty) {
208
+ throw new Error('Round button does not accept children');
209
+ }
210
+ }
202
211
  const classes = {
203
212
  primary: this.#props.variant === Variant.PRIMARY,
204
213
  secondary: this.#props.variant === Variant.SECONDARY,
205
214
  toolbar: this.#props.variant === Variant.TOOLBAR,
215
+ round: this.#props.variant === Variant.ROUND,
206
216
  'text-with-icon': Boolean(this.#props.iconUrl) && !this.#isEmpty,
207
217
  'only-icon': Boolean(this.#props.iconUrl) && this.#isEmpty,
208
218
  small: Boolean(this.#props.size === Size.SMALL),
@@ -49,7 +49,8 @@ button:focus-visible {
49
49
  box-shadow: 0 0 0 2px var(--color-button-outline-focus);
50
50
  }
51
51
 
52
- button.toolbar {
52
+ button.toolbar,
53
+ button.round {
53
54
  background: transparent;
54
55
  border-radius: 2px;
55
56
  border: none;
@@ -60,11 +61,22 @@ button.toolbar {
60
61
  white-space: nowrap;
61
62
  }
62
63
 
64
+ button.round {
65
+ border-radius: 100%;
66
+ height: 30px;
67
+ width: 30px;
68
+ }
69
+
63
70
  button.toolbar.small {
64
71
  height: 18px;
65
72
  width: 18px;
66
73
  }
67
74
 
75
+ button.round.small {
76
+ height: 24px;
77
+ width: 24px;
78
+ }
79
+
68
80
  button.primary {
69
81
  border: 1px solid var(--color-primary);
70
82
  background: var(--color-primary);
@@ -123,21 +135,27 @@ button.secondary:active:focus-visible {
123
135
  border: 1px solid var(--color-button-secondary-background-pressed);
124
136
  }
125
137
 
126
- button.toolbar:hover {
127
- background-color: var(--color-button-secondary-background-hovering);
138
+ button.toolbar:hover,
139
+ button.round:hover {
140
+ background-color: var(--color-iconbutton-hover);
128
141
  }
129
142
 
130
143
  button.toolbar.active,
131
- button.toolbar:active {
132
- background-color: var(--color-button-secondary-background-pressed);
144
+ button.toolbar:active,
145
+ button.round.active,
146
+ button.round:active {
147
+ background-color: var(--color-iconbutton-pressed);
133
148
  }
134
149
 
135
- button.toolbar:focus-visible {
150
+ button.toolbar:focus-visible,
151
+ button.round:focus-visible {
136
152
  background-color: var(--color-background-elevation-2);
137
153
  }
138
154
 
139
155
  button.toolbar:disabled,
140
- button.toolbar:disabled:hover {
156
+ button.toolbar:disabled:hover,
157
+ button.round:disabled,
158
+ button.round:disabled:hover {
141
159
  background: var(--color-background);
142
160
  color: var(--color-text-disabled);
143
161
  cursor: not-allowed;
@@ -160,7 +178,8 @@ button devtools-icon {
160
178
  height: 19px;
161
179
  }
162
180
 
163
- button.toolbar devtools-icon {
181
+ button.toolbar devtools-icon,
182
+ button.round devtools-icon {
164
183
  width: 24px;
165
184
  height: 24px;
166
185
 
@@ -180,7 +199,8 @@ button.small devtools-icon {
180
199
  height: 14px;
181
200
  }
182
201
 
183
- button.toolbar.small devtools-icon {
202
+ button.toolbar.small devtools-icon,
203
+ button.round.small devtools-icon {
184
204
  width: 18px;
185
205
  height: 18px;
186
206
  }
@@ -194,7 +214,8 @@ button.toolbar:hover devtools-icon {
194
214
  --icon-color: var(--color-text-primary);
195
215
  }
196
216
 
197
- button.toolbar:disabled devtools-icon {
217
+ button.toolbar:disabled devtools-icon,
218
+ button.round:disabled devtools-icon {
198
219
  --icon-color: var(--color-text-disabled);
199
220
  }
200
221
 
@@ -190,7 +190,7 @@ disabledPrimaryIconButton.data = {
190
190
  disabledPrimaryIconButton.onclick = () => alert('clicked');
191
191
  appendButton(disabledPrimaryIconButton);
192
192
 
193
- // Disabled Secondary Icon Only
193
+ // Small Disabled Secondary Icon Only
194
194
  const disabledSecondaryIconOnlyButton = new Buttons.Button.Button();
195
195
  disabledSecondaryIconOnlyButton.onclick = () => alert('clicked');
196
196
  disabledSecondaryIconOnlyButton.style.width = '18px';
@@ -202,6 +202,50 @@ disabledSecondaryIconOnlyButton.data = {
202
202
  };
203
203
  appendButton(disabledSecondaryIconOnlyButton);
204
204
 
205
+ // Round Button
206
+ const roundButton = new Buttons.Button.Button();
207
+ roundButton.data = {
208
+ variant: Buttons.Button.Variant.ROUND,
209
+ iconUrl: testIcon,
210
+ };
211
+ roundButton.title = 'Round Button';
212
+ roundButton.onclick = () => alert('clicked');
213
+ appendButton(roundButton);
214
+
215
+ // Disabled Round Button
216
+ const roundButtonDisabled = new Buttons.Button.Button();
217
+ roundButtonDisabled.data = {
218
+ variant: Buttons.Button.Variant.ROUND,
219
+ iconUrl: testIcon,
220
+ disabled: true,
221
+ };
222
+ roundButtonDisabled.title = 'Disabled Round Button';
223
+ roundButtonDisabled.onclick = () => alert('clicked');
224
+ appendButton(roundButtonDisabled);
225
+
226
+ // Small Round Button
227
+ const smallRoundButton = new Buttons.Button.Button();
228
+ smallRoundButton.data = {
229
+ variant: Buttons.Button.Variant.ROUND,
230
+ iconUrl: testIcon,
231
+ size: Buttons.Button.Size.SMALL,
232
+ };
233
+ smallRoundButton.title = 'Small Round Button';
234
+ smallRoundButton.onclick = () => alert('clicked');
235
+ appendButton(smallRoundButton);
236
+
237
+ // Small Disabled Round Button
238
+ const smallRoundButtonDisabled = new Buttons.Button.Button();
239
+ smallRoundButtonDisabled.data = {
240
+ variant: Buttons.Button.Variant.ROUND,
241
+ iconUrl: testIcon,
242
+ disabled: true,
243
+ size: Buttons.Button.Size.SMALL,
244
+ };
245
+ smallRoundButtonDisabled.title = 'Small Disabled Round Button';
246
+ smallRoundButtonDisabled.onclick = () => alert('clicked');
247
+ appendButton(smallRoundButtonDisabled);
248
+
205
249
  for (let i = 0; i < 6; i++) {
206
250
  // Regular Toolbar Button
207
251
  const toolbarButton = new Buttons.Button.Button();
@@ -245,6 +289,7 @@ for (let i = 0; i < 6; i++) {
245
289
  }
246
290
  }
247
291
 
292
+ // Submit Button
248
293
  const submitButton = new Buttons.Button.Button();
249
294
  submitButton.data = {
250
295
  variant: Buttons.Button.Variant.PRIMARY,
@@ -253,6 +298,7 @@ submitButton.data = {
253
298
  submitButton.innerText = 'Submit';
254
299
  document.querySelector('#form')?.append(submitButton);
255
300
 
301
+ // Reset Button
256
302
  const resetButton = new Buttons.Button.Button();
257
303
  resetButton.data = {
258
304
  variant: Buttons.Button.Variant.SECONDARY,
@@ -127,6 +127,8 @@
127
127
  --color-button-secondary-background-hovering: rgb(26 115 232 / 10%);
128
128
  --color-button-secondary-background-pressed: rgb(26 92 178 / 25%);
129
129
  --color-button-secondary-border: rgb(218 220 224);
130
+ --color-iconbutton-hover: rgb(0 0 0 / 10%);
131
+ --color-iconbutton-pressed: rgb(0 0 0 / 15%);
130
132
 
131
133
  /* Colors for file icons */
132
134
  --color-ic-file-document: rgb(39 116 240);
@@ -273,6 +275,8 @@
273
275
  --color-button-secondary-background-hovering: rgb(138 180 248 / 15%);
274
276
  --color-button-secondary-background-pressed: rgb(138 180 248 / 23%);
275
277
  --color-button-secondary-border: rgb(60 61 65);
278
+ --color-iconbutton-hover: rgb(255 255 255 / 12%);
279
+ --color-iconbutton-pressed: rgb(255 255 255 / 20%);
276
280
 
277
281
  /* Colors for file icons */
278
282
  --color-ic-file-document: rgb(39 116 240);
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.980193"
57
+ "version": "1.0.981004"
58
58
  }