chrome-devtools-frontend 1.0.1667564 → 1.0.1668390
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/devtools-setting-migration/SKILL.md +290 -0
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +11 -4
- package/.agents/skills/ui-widgets/SKILL.md +25 -1
- package/docs/ui_engineering.md +44 -1
- package/front_end/core/common/Settings.ts +11 -4
- package/front_end/core/root/Runtime.ts +5 -0
- package/front_end/core/sdk/CSSModel.test.api.ts +102 -0
- package/front_end/core/sdk/CSSModel.ts +3 -2
- package/front_end/core/sdk/DebuggerModel.ts +3 -2
- package/front_end/core/sdk/SDKSettings.ts +19 -0
- package/front_end/core/sdk/sdk-meta.ts +0 -62
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/entrypoints/main/MainImpl.ts +10 -3
- package/front_end/foundation/Universe.ts +7 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +1 -1
- package/front_end/models/ai_assistance/BuiltInAi.ts +11 -6
- package/front_end/models/ai_assistance/ChangeManager.ts +17 -1
- package/front_end/models/javascript_metadata/NativeFunctions.js +22 -9
- package/front_end/models/source_map_scopes/NamesResolver.ts +23 -17
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +78 -118
- package/front_end/panels/application/preloading/components/preloadingDetailsReportView.css +13 -13
- package/front_end/panels/console/ConsoleInsightTeaser.ts +3 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -2
- package/front_end/panels/emulation/DeviceModeView.ts +63 -104
- package/front_end/panels/sensors/LocationsSettingsTab.ts +244 -34
- package/front_end/panels/sensors/locationsSettingsTab.css +74 -0
- package/front_end/panels/sources/DebuggerPlugin.ts +2 -2
- package/front_end/panels/sources/sources-meta.ts +55 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/legacy/Dialog.ts +93 -4
- package/front_end/ui/legacy/InspectorView.ts +1 -5
- package/front_end/ui/legacy/PopoverHelper.ts +5 -5
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/package.json +1 -1
|
@@ -9,10 +9,12 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
9
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
10
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
11
11
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
12
|
-
import {html, type LitTemplate, render} from '../../ui/lit/lit.js';
|
|
12
|
+
import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
|
|
13
13
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
14
14
|
|
|
15
15
|
import locationsSettingsTabStyles from './locationsSettingsTab.css.js';
|
|
16
|
+
const {createRef, ref} = Directives;
|
|
17
|
+
export {locationsSettingsTabStyles};
|
|
16
18
|
|
|
17
19
|
const UIStrings = {
|
|
18
20
|
/**
|
|
@@ -110,6 +112,22 @@ const UIStrings = {
|
|
|
110
112
|
* @description Text of add locations button in the Locations settings tab of the Device toolbar.
|
|
111
113
|
*/
|
|
112
114
|
addLocation: 'Add location',
|
|
115
|
+
/**
|
|
116
|
+
* @description Title for the dialog when editing an existing location in the Locations settings tab.
|
|
117
|
+
*/
|
|
118
|
+
editLocation: 'Edit location',
|
|
119
|
+
/**
|
|
120
|
+
* @description Label for button to save location changes.
|
|
121
|
+
*/
|
|
122
|
+
save: 'Save',
|
|
123
|
+
/**
|
|
124
|
+
* @description Label for button to cancel location edits.
|
|
125
|
+
*/
|
|
126
|
+
cancel: 'Cancel',
|
|
127
|
+
/**
|
|
128
|
+
* @description Label for button to close the location dialog.
|
|
129
|
+
*/
|
|
130
|
+
close: 'Close',
|
|
113
131
|
} as const;
|
|
114
132
|
const str_ = i18n.i18n.registerUIStrings('panels/sensors/LocationsSettingsTab.ts', UIStrings);
|
|
115
133
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -136,44 +154,236 @@ function renderItemView(location: LocationDescription): LitTemplate {
|
|
|
136
154
|
// clang-format on
|
|
137
155
|
}
|
|
138
156
|
|
|
139
|
-
interface EditorInputControls {
|
|
140
|
-
titleInput: Element;
|
|
141
|
-
latInput: Element;
|
|
142
|
-
longInput: Element;
|
|
143
|
-
timezoneIdInput: Element;
|
|
144
|
-
localeInput: Element;
|
|
145
|
-
accuracyInput: Element;
|
|
157
|
+
export interface EditorInputControls {
|
|
158
|
+
titleInput: LitTemplate|Element;
|
|
159
|
+
latInput: LitTemplate|Element;
|
|
160
|
+
longInput: LitTemplate|Element;
|
|
161
|
+
timezoneIdInput: LitTemplate|Element;
|
|
162
|
+
localeInput: LitTemplate|Element;
|
|
163
|
+
accuracyInput: LitTemplate|Element;
|
|
146
164
|
}
|
|
147
165
|
|
|
148
|
-
|
|
166
|
+
export interface LocationDialogInput {
|
|
167
|
+
location: LocationDescription;
|
|
168
|
+
isNew: boolean;
|
|
169
|
+
errors?: {
|
|
170
|
+
title?: string|null,
|
|
171
|
+
lat?: string|null,
|
|
172
|
+
long?: string|null,
|
|
173
|
+
timezoneId?: string|null,
|
|
174
|
+
locale?: string|null,
|
|
175
|
+
accuracy?: string|null,
|
|
176
|
+
};
|
|
177
|
+
onSave: (location: LocationDescription) => void;
|
|
178
|
+
onCancel: () => void;
|
|
179
|
+
onValidateErrors: (errors: {
|
|
180
|
+
title?: string|null,
|
|
181
|
+
lat?: string|null,
|
|
182
|
+
long?: string|null,
|
|
183
|
+
timezoneId?: string|null,
|
|
184
|
+
locale?: string|null,
|
|
185
|
+
accuracy?: string|null,
|
|
186
|
+
}) => void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function renderEditorView(controls: EditorInputControls, errors?: LocationDialogInput['errors'],
|
|
190
|
+
isDialog = false): LitTemplate {
|
|
191
|
+
if (!isDialog) {
|
|
192
|
+
// clang-format off
|
|
193
|
+
return html`
|
|
194
|
+
<div class="locations-edit-row">
|
|
195
|
+
<div class="locations-list-text locations-list-title">${i18nString(UIStrings.locationName)}</div>
|
|
196
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
197
|
+
<div class="locations-list-text">${i18nString(UIStrings.lat)}</div>
|
|
198
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
199
|
+
<div class="locations-list-text">${i18nString(UIStrings.long)}</div>
|
|
200
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
201
|
+
<div class="locations-list-text">${i18nString(UIStrings.timezoneId)}</div>
|
|
202
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
203
|
+
<div class="locations-list-text">${i18nString(UIStrings.locale)}</div>
|
|
204
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
205
|
+
<div class="locations-list-text">${i18nString(UIStrings.accuracy)}</div>
|
|
206
|
+
</div>
|
|
207
|
+
<div class="locations-edit-row">
|
|
208
|
+
<div class="locations-list-text locations-list-title locations-input-container">${controls.titleInput}</div>
|
|
209
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
210
|
+
<div class="locations-list-text locations-input-container">${controls.latInput}</div>
|
|
211
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
212
|
+
<div class="locations-list-text locations-list-text-longitude locations-input-container">${controls.longInput}</div>
|
|
213
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
214
|
+
<div class="locations-list-text locations-input-container">${controls.timezoneIdInput}</div>
|
|
215
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
216
|
+
<div class="locations-list-text locations-input-container">${controls.localeInput}</div>
|
|
217
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
218
|
+
<div class="locations-list-text locations-input-container">${controls.accuracyInput}</div>
|
|
219
|
+
</div>
|
|
220
|
+
${errors ? html`
|
|
221
|
+
<div class="locations-edit-row locations-error-row" role="alert">
|
|
222
|
+
<div class="locations-list-text locations-list-title locations-error-cell">${errors.title ?? nothing}</div>
|
|
223
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
224
|
+
<div class="locations-list-text locations-error-cell">${errors.lat ?? nothing}</div>
|
|
225
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
226
|
+
<div class="locations-list-text locations-list-text-longitude locations-error-cell">${errors.long ?? nothing}</div>
|
|
227
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
228
|
+
<div class="locations-list-text locations-error-cell">${errors.timezoneId ?? nothing}</div>
|
|
229
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
230
|
+
<div class="locations-list-text locations-error-cell">${errors.locale ?? nothing}</div>
|
|
231
|
+
<div class="locations-list-separator locations-list-separator-invisible"></div>
|
|
232
|
+
<div class="locations-list-text locations-error-cell">${errors.accuracy ?? nothing}</div>
|
|
233
|
+
</div>
|
|
234
|
+
` : nothing}`;
|
|
235
|
+
// clang-format on
|
|
236
|
+
}
|
|
237
|
+
|
|
149
238
|
// clang-format off
|
|
150
239
|
return html`
|
|
151
|
-
<div class="
|
|
152
|
-
<div class="
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<div class="
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<div class="
|
|
240
|
+
<div class="editor-grid">
|
|
241
|
+
<div class="editor-field editor-field-full-width ${errors?.title ? 'has-error' : ''}">
|
|
242
|
+
<label class="editor-field-label" for="location-title">${i18nString(UIStrings.locationName)}</label>
|
|
243
|
+
${controls.titleInput}
|
|
244
|
+
${errors?.title ? html`<div class="editor-field-error" role="alert">${errors.title}</div>` : nothing}
|
|
245
|
+
</div>
|
|
246
|
+
<div class="editor-field ${errors?.lat ? 'has-error' : ''}">
|
|
247
|
+
<label class="editor-field-label" for="location-lat">${i18nString(UIStrings.lat)}</label>
|
|
248
|
+
${controls.latInput}
|
|
249
|
+
${errors?.lat ? html`<div class="editor-field-error" role="alert">${errors.lat}</div>` : nothing}
|
|
250
|
+
</div>
|
|
251
|
+
<div class="editor-field ${errors?.long ? 'has-error' : ''}">
|
|
252
|
+
<label class="editor-field-label" for="location-long">${i18nString(UIStrings.long)}</label>
|
|
253
|
+
${controls.longInput}
|
|
254
|
+
${errors?.long ? html`<div class="editor-field-error" role="alert">${errors.long}</div>` : nothing}
|
|
255
|
+
</div>
|
|
256
|
+
<div class="editor-field ${errors?.timezoneId ? 'has-error' : ''}">
|
|
257
|
+
<label class="editor-field-label" for="location-timezone">${i18nString(UIStrings.timezoneId)}</label>
|
|
258
|
+
${controls.timezoneIdInput}
|
|
259
|
+
${errors?.timezoneId ? html`<div class="editor-field-error" role="alert">${errors.timezoneId}</div>` : nothing}
|
|
260
|
+
</div>
|
|
261
|
+
<div class="editor-field ${errors?.locale ? 'has-error' : ''}">
|
|
262
|
+
<label class="editor-field-label" for="location-locale">${i18nString(UIStrings.locale)}</label>
|
|
263
|
+
${controls.localeInput}
|
|
264
|
+
${errors?.locale ? html`<div class="editor-field-error" role="alert">${errors.locale}</div>` : nothing}
|
|
265
|
+
</div>
|
|
266
|
+
<div class="editor-field editor-field-full-width ${errors?.accuracy ? 'has-error' : ''}">
|
|
267
|
+
<label class="editor-field-label" for="location-accuracy">${i18nString(UIStrings.accuracy)}</label>
|
|
268
|
+
${controls.accuracyInput}
|
|
269
|
+
${errors?.accuracy ? html`<div class="editor-field-error" role="alert">${errors.accuracy}</div>` : nothing}
|
|
270
|
+
</div>
|
|
163
271
|
</div>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
272
|
+
`;
|
|
273
|
+
// clang-format on
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function renderLocationDialog(input: LocationDialogInput, target: HTMLElement): void {
|
|
277
|
+
const titleInputRef = createRef<HTMLInputElement>();
|
|
278
|
+
const latInputRef = createRef<HTMLInputElement>();
|
|
279
|
+
const longInputRef = createRef<HTMLInputElement>();
|
|
280
|
+
const timezoneIdInputRef = createRef<HTMLInputElement>();
|
|
281
|
+
const localeInputRef = createRef<HTMLInputElement>();
|
|
282
|
+
const accuracyInputRef = createRef<HTMLInputElement>();
|
|
283
|
+
|
|
284
|
+
const handleSave = (): void => {
|
|
285
|
+
const title = titleInputRef.value?.value.trim() ?? '';
|
|
286
|
+
const latStr = latInputRef.value?.value.trim() ?? '';
|
|
287
|
+
const longStr = longInputRef.value?.value.trim() ?? '';
|
|
288
|
+
const timezoneId = timezoneIdInputRef.value?.value.trim() ?? '';
|
|
289
|
+
const locale = localeInputRef.value?.value.trim() ?? '';
|
|
290
|
+
const accuracyStr = accuracyInputRef.value?.value.trim() ?? '';
|
|
291
|
+
|
|
292
|
+
const titleError = validateTitle(title);
|
|
293
|
+
const latError = validateLatitude(latStr);
|
|
294
|
+
const longError = validateLongitude(longStr);
|
|
295
|
+
const tzError = validateTimezoneId(timezoneId);
|
|
296
|
+
const localeError = validateLocale(locale);
|
|
297
|
+
const accuracyError = validateAccuracy(accuracyStr);
|
|
298
|
+
|
|
299
|
+
if (titleError || latError || longError || tzError || localeError || accuracyError) {
|
|
300
|
+
input.onValidateErrors({
|
|
301
|
+
title: titleError,
|
|
302
|
+
lat: latError,
|
|
303
|
+
long: longError,
|
|
304
|
+
timezoneId: tzError,
|
|
305
|
+
locale: localeError,
|
|
306
|
+
accuracy: accuracyError,
|
|
307
|
+
});
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
input.onSave({
|
|
312
|
+
title,
|
|
313
|
+
lat: latStr ? parseFloat(latStr) : 0,
|
|
314
|
+
long: longStr ? parseFloat(longStr) : 0,
|
|
315
|
+
timezoneId,
|
|
316
|
+
locale,
|
|
317
|
+
accuracy: accuracyStr ? parseFloat(accuracyStr) : SDK.EmulationModel.Location.DEFAULT_ACCURACY,
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const editorControls: EditorInputControls = {
|
|
322
|
+
titleInput:
|
|
323
|
+
html`<input id="location-title" aria-label=${i18nString(UIStrings.locationName)} type="text" placeholder=${
|
|
324
|
+
i18nString(UIStrings.locationName)} .value=${input.location.title} ${ref(titleInputRef)}>`,
|
|
325
|
+
latInput: html`<input id="location-lat" aria-label=${i18nString(UIStrings.lat)} type="text" placeholder=${
|
|
326
|
+
i18nString(UIStrings.latitude)} .value=${String(input.location.lat)} ${ref(latInputRef)}>`,
|
|
327
|
+
longInput: html`<input id="location-long" aria-label=${i18nString(UIStrings.long)} type="text" placeholder=${
|
|
328
|
+
i18nString(UIStrings.longitude)} .value=${String(input.location.long)} ${ref(longInputRef)}>`,
|
|
329
|
+
timezoneIdInput:
|
|
330
|
+
html`<input id="location-timezone" aria-label=${i18nString(UIStrings.timezoneId)} type="text" placeholder=${
|
|
331
|
+
i18nString(UIStrings.timezoneId)} .value=${input.location.timezoneId} ${ref(timezoneIdInputRef)}>`,
|
|
332
|
+
localeInput: html`<input id="location-locale" aria-label=${i18nString(UIStrings.locale)} type="text" placeholder=${
|
|
333
|
+
i18nString(UIStrings.locale)} .value=${input.location.locale} ${ref(localeInputRef)}>`,
|
|
334
|
+
accuracyInput: html`<input id="location-accuracy" aria-label=${
|
|
335
|
+
i18nString(UIStrings.accuracy)} type="text" placeholder=${i18nString(UIStrings.accuracy)} .value=${
|
|
336
|
+
String(input.location.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY)} ${ref(accuracyInputRef)}>`,
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// clang-format off
|
|
340
|
+
|
|
341
|
+
const dialogContent = html`
|
|
342
|
+
<style>${locationsSettingsTabStyles}</style>
|
|
343
|
+
<div class="location-dialog-content">
|
|
344
|
+
<div class="dialog-header">
|
|
345
|
+
<span class="dialog-title">${input.isNew ? i18nString(UIStrings.addLocation) : i18nString(UIStrings.editLocation)}</span>
|
|
346
|
+
<devtools-button
|
|
347
|
+
class="dialog-close-button"
|
|
348
|
+
.iconName=${'cross'}
|
|
349
|
+
.variant=${Buttons.Button.Variant.ICON}
|
|
350
|
+
.title=${i18nString(UIStrings.close)}
|
|
351
|
+
.jslogContext=${'dialog-close'}
|
|
352
|
+
@click=${input.onCancel}
|
|
353
|
+
aria-label=${i18nString(UIStrings.close)}>
|
|
354
|
+
</devtools-button>
|
|
355
|
+
</div>
|
|
356
|
+
${renderEditorView(editorControls, input.errors, true)}
|
|
357
|
+
<div class="dialog-buttons">
|
|
358
|
+
<devtools-button
|
|
359
|
+
class="save-button"
|
|
360
|
+
.variant=${Buttons.Button.Variant.PRIMARY}
|
|
361
|
+
@click=${handleSave}>
|
|
362
|
+
${i18nString(UIStrings.save)}
|
|
363
|
+
</devtools-button>
|
|
364
|
+
<devtools-button
|
|
365
|
+
class="cancel-button"
|
|
366
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
367
|
+
@click=${input.onCancel}>
|
|
368
|
+
${i18nString(UIStrings.cancel)}
|
|
369
|
+
</devtools-button>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
`;
|
|
373
|
+
|
|
374
|
+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
375
|
+
render(html`
|
|
376
|
+
<style>${locationsSettingsTabStyles}</style>
|
|
377
|
+
<devtools-widget
|
|
378
|
+
class="location-dialog-widget"
|
|
379
|
+
${UI.Widget.widget(UI.Dialog.DialogWidget, {
|
|
380
|
+
open: true,
|
|
381
|
+
jslogContext: 'location-dialog',
|
|
382
|
+
content: dialogContent,
|
|
383
|
+
})}
|
|
384
|
+
@hidden=${input.onCancel}>
|
|
385
|
+
</devtools-widget>
|
|
386
|
+
`, target);
|
|
177
387
|
// clang-format on
|
|
178
388
|
}
|
|
179
389
|
|
|
@@ -89,3 +89,77 @@
|
|
|
89
89
|
align-items: center;
|
|
90
90
|
gap: var(--sys-size-9);
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
.location-dialog-content {
|
|
94
|
+
padding: var(--sys-size-6);
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: var(--sys-size-6);
|
|
98
|
+
width: var(--sys-size-33);
|
|
99
|
+
min-width: var(--sys-size-33);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.editor-grid {
|
|
103
|
+
display: grid;
|
|
104
|
+
grid-template-columns: 1fr 1fr;
|
|
105
|
+
gap: var(--sys-size-5) var(--sys-size-6);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.editor-field-full-width {
|
|
109
|
+
grid-column: 1 / -1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.editor-field {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
gap: var(--sys-size-2);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.editor-field-label {
|
|
119
|
+
color: var(--sys-color-on-surface);
|
|
120
|
+
font-size: var(--sys-size-6);
|
|
121
|
+
font-weight: var(--ref-typeface-weight-medium);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.editor-field input {
|
|
125
|
+
width: 100%;
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
padding: var(--sys-size-3) var(--sys-size-4);
|
|
128
|
+
height: var(--sys-size-11);
|
|
129
|
+
border: var(--sys-size-1) solid var(--sys-color-neutral-outline);
|
|
130
|
+
border-radius: var(--sys-size-2);
|
|
131
|
+
outline: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.editor-field.has-error input {
|
|
135
|
+
border-color: var(--sys-color-error);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.editor-field-error {
|
|
139
|
+
color: var(--sys-color-error);
|
|
140
|
+
font-size: var(--sys-size-6);
|
|
141
|
+
overflow-wrap: break-word;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.dialog-buttons {
|
|
145
|
+
display: flex;
|
|
146
|
+
justify-content: flex-end;
|
|
147
|
+
gap: var(--sys-size-3);
|
|
148
|
+
margin-top: var(--sys-size-3);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.dialog-header {
|
|
152
|
+
display: flex;
|
|
153
|
+
justify-content: space-between;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.dialog-title {
|
|
158
|
+
font-size: var(--sys-size-7);
|
|
159
|
+
font-weight: var(--ref-typeface-weight-medium);
|
|
160
|
+
color: var(--sys-color-on-surface);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.dialog-close-button {
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
}
|
|
@@ -566,7 +566,7 @@ export class DebuggerPlugin extends Plugin {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
if (this.uiSourceCode.project().type() === Workspace.Workspace.projectTypes.Network &&
|
|
569
|
-
Common.Settings.Settings.instance().
|
|
569
|
+
Common.Settings.Settings.instance().resolve(SDK.SDKSettings.jsSourceMapsEnabledSettingDescriptor).get() &&
|
|
570
570
|
!Workspace.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(this.uiSourceCode.url())) {
|
|
571
571
|
if (this.scriptFileForDebuggerModel.size) {
|
|
572
572
|
const scriptFile: Bindings.ResourceScriptMapping.ResourceScriptFile =
|
|
@@ -1519,7 +1519,7 @@ export class DebuggerPlugin extends Plugin {
|
|
|
1519
1519
|
if (this.sourceMapInfobar) {
|
|
1520
1520
|
return;
|
|
1521
1521
|
}
|
|
1522
|
-
if (!Common.Settings.Settings.instance().
|
|
1522
|
+
if (!Common.Settings.Settings.instance().resolve(SDK.SDKSettings.jsSourceMapsEnabledSettingDescriptor).get()) {
|
|
1523
1523
|
return;
|
|
1524
1524
|
}
|
|
1525
1525
|
if (!this.scriptHasSourceMap()) {
|
|
@@ -13,6 +13,7 @@ import * as Workspace from '../../models/workspace/workspace.js';
|
|
|
13
13
|
import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
|
14
14
|
import * as QuickOpen from '../../ui/legacy/components/quick_open/quick_open.js';
|
|
15
15
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
16
|
+
import * as SettingsUI from '../../ui/settings/settings.js';
|
|
16
17
|
|
|
17
18
|
import type * as Sources from './sources.js';
|
|
18
19
|
|
|
@@ -463,6 +464,30 @@ const UIStrings = {
|
|
|
463
464
|
* wrap' setting.
|
|
464
465
|
*/
|
|
465
466
|
toggleWordWrap: 'Toggle word wrap',
|
|
467
|
+
/**
|
|
468
|
+
* @description Setting under the Sources category to toggle usage of JavaScript source maps.
|
|
469
|
+
*/
|
|
470
|
+
javaScriptSourceMaps: 'JavaScript source maps',
|
|
471
|
+
/**
|
|
472
|
+
* @description Title of an option under the Sources category that can be invoked through the Command Menu.
|
|
473
|
+
*/
|
|
474
|
+
enableJavaScriptSourceMaps: 'Enable JavaScript source maps',
|
|
475
|
+
/**
|
|
476
|
+
* @description Title of an option under the Sources category that can be invoked through the Command Menu.
|
|
477
|
+
*/
|
|
478
|
+
disableJavaScriptSourceMaps: 'Disable JavaScript source maps',
|
|
479
|
+
/**
|
|
480
|
+
* @description Setting under the Sources category to toggle usage of CSS source maps.
|
|
481
|
+
*/
|
|
482
|
+
cssSourceMaps: 'CSS source maps',
|
|
483
|
+
/**
|
|
484
|
+
* @description Title of an option under the Sources category that can be invoked through the Command Menu.
|
|
485
|
+
*/
|
|
486
|
+
enableCssSourceMaps: 'Enable CSS source maps',
|
|
487
|
+
/**
|
|
488
|
+
* @description Title of an option under the Sources category that can be invoked through the Command Menu.
|
|
489
|
+
*/
|
|
490
|
+
disableCssSourceMaps: 'Disable CSS source maps',
|
|
466
491
|
} as const;
|
|
467
492
|
const str_ = i18n.i18n.registerUIStrings('panels/sources/sources-meta.ts', UIStrings);
|
|
468
493
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
@@ -1512,6 +1537,36 @@ Common.Settings.registerSettingExtension({
|
|
|
1512
1537
|
defaultValue: false,
|
|
1513
1538
|
});
|
|
1514
1539
|
|
|
1540
|
+
SettingsUI.SettingUIRegistration.register(SDK.SDKSettings.jsSourceMapsEnabledSettingDescriptor, {
|
|
1541
|
+
category: Common.Settings.SettingCategory.SOURCES,
|
|
1542
|
+
title: i18nLazyString(UIStrings.javaScriptSourceMaps),
|
|
1543
|
+
options: [
|
|
1544
|
+
{
|
|
1545
|
+
value: true,
|
|
1546
|
+
title: i18nLazyString(UIStrings.enableJavaScriptSourceMaps),
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
value: false,
|
|
1550
|
+
title: i18nLazyString(UIStrings.disableJavaScriptSourceMaps),
|
|
1551
|
+
},
|
|
1552
|
+
],
|
|
1553
|
+
});
|
|
1554
|
+
|
|
1555
|
+
SettingsUI.SettingUIRegistration.register(SDK.SDKSettings.cssSourceMapsEnabledSettingDescriptor, {
|
|
1556
|
+
category: Common.Settings.SettingCategory.SOURCES,
|
|
1557
|
+
title: i18nLazyString(UIStrings.cssSourceMaps),
|
|
1558
|
+
options: [
|
|
1559
|
+
{
|
|
1560
|
+
value: true,
|
|
1561
|
+
title: i18nLazyString(UIStrings.enableCssSourceMaps),
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
value: false,
|
|
1565
|
+
title: i18nLazyString(UIStrings.disableCssSourceMaps),
|
|
1566
|
+
},
|
|
1567
|
+
],
|
|
1568
|
+
});
|
|
1569
|
+
|
|
1515
1570
|
Common.Settings.registerSettingExtension({
|
|
1516
1571
|
category: Common.Settings.SettingCategory.SOURCES,
|
|
1517
1572
|
storageType: Common.Settings.SettingStorageType.SYNCED,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: Internal
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: c15d009df51d794d8a37df41cdc89d4056e7e0cd
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Common from '../../core/common/common.js';
|
|
8
8
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
9
|
+
import {type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
|
|
9
10
|
import * as Buttons from '../components/buttons/buttons.js';
|
|
10
11
|
import * as VisualLogging from '../visual_logging/visual_logging.js';
|
|
11
12
|
|
|
12
13
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
13
14
|
import dialogStyles from './dialog.css.js';
|
|
14
|
-
import {GlassPane, PointerEventsBehavior} from './GlassPane.js';
|
|
15
|
+
import {GlassPane, PointerEventsBehavior, SizeBehavior} from './GlassPane.js';
|
|
15
16
|
import {InspectorView} from './InspectorView.js';
|
|
16
17
|
import {KeyboardShortcut, Keys} from './KeyboardShortcut.js';
|
|
17
18
|
import type {SplitWidget} from './SplitWidget.js';
|
|
18
|
-
import {WidgetFocusRestorer} from './Widget.js';
|
|
19
|
+
import {Widget, WidgetFocusRestorer} from './Widget.js';
|
|
19
20
|
|
|
20
21
|
const UIStrings = {
|
|
21
22
|
/**
|
|
@@ -41,8 +42,7 @@ export class Dialog extends Common.ObjectWrapper.eventMixin<EventTypes, typeof G
|
|
|
41
42
|
this.contentElement.tabIndex = 0;
|
|
42
43
|
this.contentElement.addEventListener('focus', () => this.widget().focus(), false);
|
|
43
44
|
if (jslogContext) {
|
|
44
|
-
this.
|
|
45
|
-
'jslog', `${VisualLogging.dialog(jslogContext).track({resize: true, keydown: 'Escape'})}`);
|
|
45
|
+
this.jslogContext = jslogContext;
|
|
46
46
|
}
|
|
47
47
|
this.setPointerEventsBehavior(PointerEventsBehavior.BLOCKED_BY_GLASS_PANE);
|
|
48
48
|
this.setOutsideClickCallback(event => {
|
|
@@ -59,6 +59,15 @@ export class Dialog extends Common.ObjectWrapper.eventMixin<EventTypes, typeof G
|
|
|
59
59
|
this.targetDocumentKeyDownHandler = this.onKeyDown.bind(this);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
set jslogContext(jslogContext: string) {
|
|
63
|
+
if (jslogContext) {
|
|
64
|
+
this.contentElement.setAttribute(
|
|
65
|
+
'jslog', `${VisualLogging.dialog(jslogContext).track({resize: true, keydown: 'Escape'})}`);
|
|
66
|
+
} else {
|
|
67
|
+
this.contentElement.removeAttribute('jslog');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
static hasInstance(): boolean {
|
|
63
72
|
return Dialog.dialogs.length > 0;
|
|
64
73
|
}
|
|
@@ -243,3 +252,83 @@ export const enum OutsideTabIndexBehavior {
|
|
|
243
252
|
PRESERVE_MAIN_VIEW_TAB_INDEX = 'PreserveMainViewTabIndex',
|
|
244
253
|
PRESERVE_TAB_INDEX = 'PreserveTabIndex',
|
|
245
254
|
}
|
|
255
|
+
|
|
256
|
+
export class DialogWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typeof Widget>(Widget) {
|
|
257
|
+
#open = false;
|
|
258
|
+
#content: LitTemplate = nothing;
|
|
259
|
+
readonly #dialog = new Dialog();
|
|
260
|
+
|
|
261
|
+
constructor(element?: HTMLElement) {
|
|
262
|
+
super(element);
|
|
263
|
+
this.#dialog.setSizeBehavior(SizeBehavior.MEASURE_CONTENT);
|
|
264
|
+
this.#dialog.contentElement.tabIndex = -1;
|
|
265
|
+
this.#dialog.addEventListener(Events.HIDDEN, () => {
|
|
266
|
+
this.#open = false;
|
|
267
|
+
this.dispatchEventToListeners(Events.HIDDEN);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
get open(): boolean {
|
|
272
|
+
return this.#open;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
set open(open: boolean) {
|
|
276
|
+
if (this.#open !== open) {
|
|
277
|
+
this.#open = open;
|
|
278
|
+
this.requestUpdate();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#jslogContext = '';
|
|
283
|
+
|
|
284
|
+
get content(): LitTemplate {
|
|
285
|
+
return this.#content;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
set content(content: LitTemplate) {
|
|
289
|
+
this.#content = content;
|
|
290
|
+
this.requestUpdate();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
get jslogContext(): string {
|
|
294
|
+
return this.#jslogContext;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
set jslogContext(jslogContext: string) {
|
|
298
|
+
if (this.#jslogContext !== jslogContext) {
|
|
299
|
+
this.#jslogContext = jslogContext;
|
|
300
|
+
this.#dialog.jslogContext = jslogContext;
|
|
301
|
+
this.requestUpdate();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
override wasShown(): void {
|
|
306
|
+
super.wasShown();
|
|
307
|
+
this.requestUpdate();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
override willHide(): void {
|
|
311
|
+
super.willHide();
|
|
312
|
+
this.#dialog.hide();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
override onDetach(): void {
|
|
316
|
+
super.onDetach();
|
|
317
|
+
this.#dialog.hide();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
override performUpdate(): void {
|
|
321
|
+
if (this.open) {
|
|
322
|
+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
323
|
+
render(this.#content ?? nothing, this.#dialog.contentElement);
|
|
324
|
+
if (!this.#dialog.isShowing()) {
|
|
325
|
+
this.#dialog.show(this.contentElement.ownerDocument);
|
|
326
|
+
this.#dialog.contentElement.focus();
|
|
327
|
+
} else {
|
|
328
|
+
this.#dialog.positionContent();
|
|
329
|
+
}
|
|
330
|
+
} else if (this.#dialog.isShowing()) {
|
|
331
|
+
this.#dialog.hide();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
@@ -316,10 +316,6 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
#applyDrawerOrientationForDockSide(): void {
|
|
319
|
-
if (!this.drawerVisible()) {
|
|
320
|
-
this.applyDrawerOrientationForDockSideForTest();
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
319
|
const newOrientation = this.#getOrientationForDockMode();
|
|
324
320
|
this.#applyDrawerOrientation(newOrientation);
|
|
325
321
|
this.applyDrawerOrientationForDockSideForTest();
|
|
@@ -504,6 +500,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
504
500
|
}
|
|
505
501
|
return;
|
|
506
502
|
}
|
|
503
|
+
this.#applyDrawerOrientationForDockSide();
|
|
507
504
|
this.#drawerView.show(hasTargetDrawer);
|
|
508
505
|
if (focus) {
|
|
509
506
|
this.focusRestorer = new WidgetFocusRestorer(this.drawerTabbedPane);
|
|
@@ -512,7 +509,6 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
512
509
|
this.focusRestorer = null;
|
|
513
510
|
this.#mainPanelAtDrawerFocus = null;
|
|
514
511
|
}
|
|
515
|
-
this.#applyDrawerOrientationForDockSide();
|
|
516
512
|
ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.drawerShown));
|
|
517
513
|
}
|
|
518
514
|
|