chrome-devtools-frontend 1.0.944903 → 1.0.945884

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 (86) hide show
  1. package/config/gni/devtools_grd_files.gni +1 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
  4. package/front_end/core/host/InspectorFrontendHostAPI.ts +5 -5
  5. package/front_end/core/host/UserMetrics.ts +3 -1
  6. package/front_end/core/i18n/i18nImpl.ts +7 -4
  7. package/front_end/core/i18n/locales/en-US.json +9 -45
  8. package/front_end/core/i18n/locales/en-XL.json +9 -45
  9. package/front_end/core/sdk/CSSMetadata.ts +0 -1
  10. package/front_end/core/sdk/sdk-meta.ts +20 -8
  11. package/front_end/entrypoints/main/MainImpl.ts +6 -0
  12. package/front_end/generated/protocol.d.ts +0 -4
  13. package/front_end/models/emulation/EmulatedDevices.ts +2 -4
  14. package/front_end/models/persistence/IsolatedFileSystemManager.ts +6 -10
  15. package/front_end/models/timeline_model/TimelineJSProfile.ts +16 -3
  16. package/front_end/models/timeline_model/TimelineModel.ts +1 -0
  17. package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
  18. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  19. package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
  20. package/front_end/panels/application/BackForwardCacheView.ts +8 -1
  21. package/front_end/panels/changes/ChangesView.ts +8 -7
  22. package/front_end/panels/elements/StyleEditorWidget.ts +7 -7
  23. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -15
  24. package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
  25. package/front_end/panels/emulation/DeviceModeView.ts +3 -0
  26. package/front_end/panels/help/ReleaseNoteText.ts +3 -1
  27. package/front_end/panels/network/NetworkItemView.ts +7 -1
  28. package/front_end/panels/profiler/heapProfiler.css +2 -5
  29. package/front_end/panels/timeline/TimelineController.ts +3 -0
  30. package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
  31. package/front_end/third_party/acorn/README.chromium +2 -2
  32. package/front_end/third_party/acorn/acorn.ts +1 -1
  33. package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
  34. package/front_end/third_party/acorn/package/README.md +1 -1
  35. package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
  36. package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
  37. package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
  38. package/front_end/third_party/acorn/package/dist/bin.js +47 -21
  39. package/front_end/third_party/acorn/package/package.json +1 -1
  40. package/front_end/third_party/acorn-loose/README.chromium +2 -2
  41. package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
  42. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
  43. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
  44. package/front_end/third_party/acorn-loose/package/package.json +2 -2
  45. package/front_end/third_party/i18n/i18n-impl.ts +1 -1
  46. package/front_end/ui/components/adorners/Adorner.ts +14 -14
  47. package/front_end/ui/components/buttons/Button.ts +133 -42
  48. package/front_end/ui/components/buttons/button.css +31 -0
  49. package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
  50. package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
  51. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  52. package/front_end/ui/components/docs/button/basic.html +3 -0
  53. package/front_end/ui/components/docs/button/basic.ts +58 -0
  54. package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
  55. package/front_end/ui/components/icon_button/Icon.ts +24 -21
  56. package/front_end/ui/components/icon_button/IconButton.ts +31 -31
  57. package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
  58. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
  59. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
  60. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
  61. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
  62. package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
  63. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +24 -32
  64. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
  65. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
  66. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
  67. package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
  68. package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
  69. package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
  70. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
  71. package/front_end/ui/components/report_view/ReportView.ts +18 -18
  72. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
  73. package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
  74. package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
  75. package/front_end/ui/components/text_editor/TextEditor.ts +55 -52
  76. package/front_end/ui/components/text_editor/javascript.ts +6 -6
  77. package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
  78. package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
  79. package/front_end/ui/legacy/Infobar.ts +9 -0
  80. package/front_end/ui/legacy/InspectorView.ts +1 -1
  81. package/front_end/ui/legacy/ListWidget.ts +2 -2
  82. package/front_end/ui/legacy/tabbedPane.css +1 -1
  83. package/inspector_overlay/main.ts +3 -0
  84. package/package.json +1 -1
  85. package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
  86. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
@@ -25,12 +25,17 @@ export const enum Size {
25
25
  MEDIUM = 'MEDIUM',
26
26
  }
27
27
 
28
+ type ButtonType = 'button'|'submit'|'reset';
29
+
28
30
  interface ButtonState {
29
31
  iconUrl?: string;
30
32
  variant?: Variant;
31
33
  size?: Size;
32
34
  disabled: boolean;
33
35
  active: boolean;
36
+ spinner?: boolean;
37
+ type: ButtonType;
38
+ value?: string;
34
39
  }
35
40
 
36
41
  export type ButtonData = {
@@ -39,30 +44,49 @@ export type ButtonData = {
39
44
  size?: Size,
40
45
  disabled?: boolean,
41
46
  active?: boolean,
47
+ spinner?: boolean,
48
+ type?: ButtonType,
49
+ value?: string,
42
50
  }|{
43
51
  variant: Variant.PRIMARY | Variant.SECONDARY,
44
52
  iconUrl?: string,
45
53
  size?: Size,
46
54
  disabled?: boolean,
47
55
  active?: boolean,
56
+ spinner?: boolean,
57
+ type?: ButtonType,
58
+ value?: string,
48
59
  };
49
60
 
61
+ interface ButtonElementInternals extends ElementInternals {
62
+ readonly form?: HTMLFormElement;
63
+ readonly validity: ValidityState;
64
+ readonly willValidate: boolean;
65
+ readonly validationMessage: string;
66
+ checkValidity(): void;
67
+ reportValidity(): void;
68
+ }
69
+
50
70
  export class Button extends HTMLElement {
71
+ static formAssociated = true;
51
72
  static readonly litTagName = LitHtml.literal`devtools-button`;
52
- private readonly shadow = this.attachShadow({mode: 'open', delegatesFocus: true});
53
- private readonly boundRender = this.render.bind(this);
54
- private readonly boundOnClick = this.onClick.bind(this);
55
- private readonly props: ButtonState = {
73
+ readonly #shadow = this.attachShadow({mode: 'open', delegatesFocus: true});
74
+ readonly #boundRender = this.render.bind(this);
75
+ readonly #boundOnClick = this.onClick.bind(this);
76
+ readonly #props: ButtonState = {
56
77
  size: Size.MEDIUM,
57
78
  disabled: false,
58
79
  active: false,
80
+ spinner: false,
81
+ type: 'button',
59
82
  };
60
- private isEmpty = true;
83
+ #isEmpty = true;
84
+ #internals = this.attachInternals() as ButtonElementInternals;
61
85
 
62
86
  constructor() {
63
87
  super();
64
88
  this.setAttribute('role', 'presentation');
65
- this.addEventListener('click', this.boundOnClick, true);
89
+ this.addEventListener('click', this.#boundOnClick, true);
66
90
  }
67
91
 
68
92
  /**
@@ -70,104 +94,171 @@ export class Button extends HTMLElement {
70
94
  * for increased type-safety.
71
95
  */
72
96
  set data(data: ButtonData) {
73
- this.props.variant = data.variant;
74
- this.props.iconUrl = data.iconUrl;
75
- this.props.size = data.size || Size.MEDIUM;
76
- this.props.active = Boolean(data.active);
97
+ this.#props.variant = data.variant;
98
+ this.#props.iconUrl = data.iconUrl;
99
+ this.#props.size = data.size || Size.MEDIUM;
100
+ this.#props.active = Boolean(data.active);
101
+ this.#props.spinner = Boolean(data.spinner);
102
+ this.#props.type = data.type || 'button';
77
103
  this.setDisabledProperty(data.disabled || false);
78
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
104
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
79
105
  }
80
106
 
81
107
  set iconUrl(iconUrl: string|undefined) {
82
- this.props.iconUrl = iconUrl;
83
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
108
+ this.#props.iconUrl = iconUrl;
109
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
84
110
  }
85
111
 
86
112
  set variant(variant: Variant) {
87
- this.props.variant = variant;
88
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
113
+ this.#props.variant = variant;
114
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
89
115
  }
90
116
 
91
117
  set size(size: Size) {
92
- this.props.size = size;
93
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
118
+ this.#props.size = size;
119
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
120
+ }
121
+
122
+ set type(type: ButtonType) {
123
+ this.#props.type = type;
124
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
94
125
  }
95
126
 
96
127
  set disabled(disabled: boolean) {
97
128
  this.setDisabledProperty(disabled);
98
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
129
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
99
130
  }
100
131
 
101
132
  set active(active: boolean) {
102
- this.props.active = active;
103
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
133
+ this.#props.active = active;
134
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
135
+ }
136
+
137
+ set spinner(spinner: boolean) {
138
+ this.#props.spinner = spinner;
139
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
104
140
  }
105
141
 
106
142
  private setDisabledProperty(disabled: boolean): void {
107
- this.props.disabled = disabled;
143
+ this.#props.disabled = disabled;
108
144
  this.toggleAttribute('disabled', disabled);
109
145
  }
110
146
 
111
147
  focus(): void {
112
- this.shadow.querySelector('button')?.focus();
148
+ this.#shadow.querySelector('button')?.focus();
113
149
  }
114
150
 
115
151
  connectedCallback(): void {
116
- this.shadow.adoptedStyleSheets = [buttonStyles];
117
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
152
+ this.#shadow.adoptedStyleSheets = [buttonStyles];
153
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
118
154
  }
119
155
 
120
156
  private onClick(event: Event): void {
121
- if (this.props.disabled) {
157
+ if (this.#props.disabled) {
122
158
  event.stopPropagation();
123
159
  event.preventDefault();
160
+ return;
161
+ }
162
+ if (this.form && this.#props.type === 'submit') {
163
+ event.preventDefault();
164
+ this.form.dispatchEvent(new SubmitEvent('submit', {
165
+ submitter: this,
166
+ }));
167
+ }
168
+ if (this.form && this.#props.type === 'reset') {
169
+ event.preventDefault();
170
+ this.form.reset();
124
171
  }
125
172
  }
126
173
 
127
174
  private onSlotChange(event: Event): void {
128
175
  const slot = event.target as HTMLSlotElement | undefined;
129
176
  const nodes = slot?.assignedNodes();
130
- this.isEmpty = !nodes || !Boolean(nodes.length);
131
- ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
177
+ this.#isEmpty = !nodes || !Boolean(nodes.length);
178
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
132
179
  }
133
180
 
134
181
  private render(): void {
135
- if (!this.props.variant) {
182
+ if (!this.#props.variant) {
136
183
  throw new Error('Button requires a variant to be defined');
137
184
  }
138
- if (this.props.variant === Variant.TOOLBAR) {
139
- if (!this.props.iconUrl) {
185
+ if (this.#props.variant === Variant.TOOLBAR) {
186
+ if (!this.#props.iconUrl) {
140
187
  throw new Error('Toolbar button requires an icon');
141
188
  }
142
- if (!this.isEmpty) {
189
+ if (!this.#isEmpty) {
143
190
  throw new Error('Tooblar button does not accept children');
144
191
  }
145
192
  }
146
193
  const classes = {
147
- primary: this.props.variant === Variant.PRIMARY,
148
- secondary: this.props.variant === Variant.SECONDARY,
149
- toolbar: this.props.variant === Variant.TOOLBAR,
150
- 'text-with-icon': Boolean(this.props.iconUrl) && !this.isEmpty,
151
- 'only-icon': Boolean(this.props.iconUrl) && this.isEmpty,
152
- small: Boolean(this.props.size === Size.SMALL),
153
- active: this.props.active,
194
+ primary: this.#props.variant === Variant.PRIMARY,
195
+ secondary: this.#props.variant === Variant.SECONDARY,
196
+ toolbar: this.#props.variant === Variant.TOOLBAR,
197
+ 'text-with-icon': Boolean(this.#props.iconUrl) && !this.#isEmpty,
198
+ 'only-icon': Boolean(this.#props.iconUrl) && this.#isEmpty,
199
+ small: Boolean(this.#props.size === Size.SMALL),
200
+ active: this.#props.active,
201
+ };
202
+ const spinnerClasses = {
203
+ primary: this.#props.variant === Variant.PRIMARY,
204
+ secondary: this.#props.variant === Variant.SECONDARY,
205
+ disabled: Boolean(this.#props.disabled),
206
+ 'spinner-component': true,
154
207
  };
155
208
  // clang-format off
156
209
  LitHtml.render(
157
210
  LitHtml.html`
158
- <button .disabled=${this.props.disabled} class=${LitHtml.Directives.classMap(classes)}>
159
- ${this.props.iconUrl ? LitHtml.html`<${IconButton.Icon.Icon.litTagName}
211
+ <button .disabled=${this.#props.disabled} class=${LitHtml.Directives.classMap(classes)}>
212
+ ${this.#props.iconUrl ? LitHtml.html`<${IconButton.Icon.Icon.litTagName}
160
213
  .data=${{
161
- iconPath: this.props.iconUrl,
214
+ iconPath: this.#props.iconUrl,
162
215
  color: 'var(--color-background)',
163
216
  } as IconButton.Icon.IconData}
164
217
  >
165
218
  </${IconButton.Icon.Icon.litTagName}>` : ''}
219
+ ${this.#props.spinner ? LitHtml.html`<span class=${LitHtml.Directives.classMap(spinnerClasses)}></span>` : ''}
166
220
  <slot @slotchange=${this.onSlotChange}></slot>
167
221
  </button>
168
- `, this.shadow, {host: this});
222
+ `, this.#shadow, {host: this});
169
223
  // clang-format on
170
224
  }
225
+
226
+ // Based on https://web.dev/more-capable-form-controls/ to make custom elements form-friendly.
227
+ // Form controls usually expose a "value" property.
228
+ get value(): string {
229
+ return this.#props.value || '';
230
+ }
231
+ set value(value: string) {
232
+ this.#props.value = value;
233
+ }
234
+
235
+ // The following properties and methods aren't strictly required,
236
+ // but browser-level form controls provide them. Providing them helps
237
+ // ensure consistency with browser-provided controls.
238
+ get form(): HTMLFormElement|undefined {
239
+ return this.#internals.form;
240
+ }
241
+ get name(): string|null {
242
+ return this.getAttribute('name');
243
+ }
244
+ get type(): ButtonType {
245
+ return this.#props.type;
246
+ }
247
+ get validity(): ValidityState {
248
+ return this.#internals.validity;
249
+ }
250
+ get validationMessage(): string {
251
+ return this.#internals.validationMessage;
252
+ }
253
+ get willValidate(): boolean {
254
+ return this.#internals.willValidate;
255
+ }
256
+ checkValidity(): void {
257
+ return this.#internals.checkValidity();
258
+ }
259
+ reportValidity(): void {
260
+ return this.#internals.reportValidity();
261
+ }
171
262
  }
172
263
 
173
264
  ComponentHelpers.CustomElements.defineComponent('devtools-button', Button);
@@ -201,3 +201,34 @@ button.primary:disabled devtools-icon {
201
201
  button.secondary:disabled devtools-icon {
202
202
  --icon-color: var(--color-text-disabled);
203
203
  }
204
+
205
+ .spinner-component.secondary {
206
+ border: 2px solid var(--color-primary);
207
+ border-right-color: transparent;
208
+ }
209
+
210
+ .spinner-component.disabled {
211
+ border: 2px solid var(--color-text-disabled);
212
+ border-right-color: transparent;
213
+ }
214
+
215
+ .spinner-component {
216
+ display: block;
217
+ width: 12px;
218
+ height: 12px;
219
+ border-radius: 6px;
220
+ border: 2px solid var(--color-background);
221
+ animation: spinner-animation 1s linear infinite;
222
+ border-right-color: transparent;
223
+ margin-right: 6px;
224
+ }
225
+
226
+ @keyframes spinner-animation {
227
+ from {
228
+ transform: rotate(0);
229
+ }
230
+
231
+ to {
232
+ transform: rotate(360deg);
233
+ }
234
+ }