chrome-devtools-frontend 1.0.947377 → 1.0.948916

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 (124) hide show
  1. package/config/gni/all_devtools_files.gni +1 -6
  2. package/config/gni/devtools_grd_files.gni +5 -12
  3. package/config/gni/devtools_image_files.gni +1 -0
  4. package/front_end/.eslintrc.js +1 -0
  5. package/front_end/Images/src/circled_backslash_icon.svg +3 -0
  6. package/front_end/core/host/UserMetrics.ts +1 -1
  7. package/front_end/core/i18n/locales/en-US.json +32 -44
  8. package/front_end/core/i18n/locales/en-XL.json +32 -44
  9. package/front_end/core/platform/platform.ts +0 -2
  10. package/front_end/core/platform/string-utilities.ts +14 -1
  11. package/front_end/core/platform/utilities.ts +0 -29
  12. package/front_end/core/root/Runtime.ts +4 -207
  13. package/front_end/core/sdk/Cookie.ts +0 -21
  14. package/front_end/core/sdk/RemoteObject.ts +15 -1
  15. package/front_end/core/sdk/sdk-legacy.ts +0 -3
  16. package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -3
  17. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
  18. package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
  19. package/front_end/entrypoints/main/MainImpl.ts +0 -1
  20. package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +0 -2
  21. package/front_end/entrypoints/node_app/node_app.ts +1 -3
  22. package/front_end/entrypoints/shell/{shell.js → shell.ts} +0 -2
  23. package/front_end/entrypoints/visibility.gni +3 -1
  24. package/front_end/entrypoints/worker_app/worker_app.ts +1 -4
  25. package/front_end/generated/InspectorBackendCommands.js +8 -1
  26. package/front_end/generated/protocol-mapping.d.ts +4 -0
  27. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  28. package/front_end/generated/protocol.d.ts +9 -0
  29. package/front_end/legacy/legacy-defs.d.ts +0 -4
  30. package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
  31. package/front_end/models/issues_manager/AttributionReportingIssue.ts +27 -2
  32. package/front_end/models/issues_manager/CorsIssue.ts +15 -15
  33. package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
  34. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
  35. package/front_end/panels/application/BackForwardCacheStrings.ts +1 -5
  36. package/front_end/panels/application/BackForwardCacheView.ts +150 -58
  37. package/front_end/panels/application/ResourcesPanel.ts +0 -42
  38. package/front_end/panels/application/application-legacy.ts +0 -3
  39. package/front_end/panels/application/application-meta.ts +0 -13
  40. package/front_end/panels/application/backForwardCacheView.css +44 -6
  41. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  42. package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
  43. package/front_end/panels/application/components/StackTrace.ts +1 -1
  44. package/front_end/panels/console/ConsolePrompt.ts +0 -4
  45. package/front_end/panels/coverage/CoverageView.ts +1 -1
  46. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
  47. package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
  48. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
  49. package/front_end/panels/elements/AccessibilityTreeUtils.ts +1 -7
  50. package/front_end/panels/elements/ElementsPanel.ts +9 -1
  51. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  52. package/front_end/panels/elements/PropertiesWidget.ts +109 -4
  53. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  54. package/front_end/panels/elements/propertiesWidget.css +34 -0
  55. package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -1
  56. package/front_end/panels/issues/CorsIssueDetailsView.ts +20 -8
  57. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
  58. package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
  59. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
  60. package/front_end/panels/settings/components/SyncSection.ts +2 -2
  61. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +46 -46
  62. package/front_end/panels/timeline/TimelineTreeView.ts +2 -1
  63. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  64. package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
  65. package/front_end/ui/components/helpers/helpers.ts +0 -2
  66. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  67. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  68. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
  69. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  70. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
  71. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  72. package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
  73. package/front_end/ui/components/report_view/ReportView.ts +22 -0
  74. package/front_end/ui/components/report_view/reportSection.css +20 -0
  75. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  76. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
  77. package/front_end/ui/components/text_editor/config.ts +4 -3
  78. package/front_end/ui/components/text_editor/javascript.ts +8 -4
  79. package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
  80. package/front_end/ui/legacy/GlassPane.ts +1 -1
  81. package/front_end/ui/legacy/SearchableView.ts +2 -1
  82. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  83. package/front_end/ui/legacy/Widget.ts +1 -1
  84. package/front_end/ui/legacy/XWidget.ts +0 -5
  85. package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
  86. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
  87. package/front_end/ui/legacy/utils/append-style.ts +2 -13
  88. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
  89. package/package.json +2 -4
  90. package/scripts/build/build_inspector_overlay.py +15 -1
  91. package/scripts/build/rjsmin.py +84 -115
  92. package/scripts/eslint_rules/lib/ban_a_tags_in_lit_html.js +2 -11
  93. package/scripts/eslint_rules/lib/ban_literal_devtools_component_tag_names.js +2 -11
  94. package/scripts/eslint_rules/lib/ban_self_closing_custom_element_tagnames.js +2 -11
  95. package/scripts/eslint_rules/lib/ban_style_tags_in_lit_html.js +2 -11
  96. package/scripts/eslint_rules/lib/lit_html_data_as_type.js +2 -11
  97. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +89 -0
  98. package/scripts/eslint_rules/lib/lit_no_style_interpolation.js +2 -11
  99. package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
  100. package/scripts/eslint_rules/lib/static_tag_must_be_static_property.js +2 -11
  101. package/scripts/eslint_rules/lib/utils.js +29 -0
  102. package/scripts/eslint_rules/tests/.eslintrc.js +18 -0
  103. package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
  104. package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
  105. package/scripts/eslint_rules/tests/utils_test.js +40 -0
  106. package/front_end/entrypoints/devtools_app/devtools_app.js +0 -11
  107. package/front_end/entrypoints/devtools_app/devtools_app.json +0 -4
  108. package/front_end/entrypoints/js_app/js_app.js +0 -12
  109. package/front_end/entrypoints/js_app/js_app.json +0 -3
  110. package/front_end/entrypoints/ndb_app/ndb_app.json +0 -4
  111. package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
  112. package/front_end/entrypoints/startup/startup.ts +0 -9
  113. package/front_end/panels/help/HelpImpl.ts +0 -141
  114. package/front_end/panels/help/ReleaseNoteText.ts +0 -1496
  115. package/front_end/panels/help/ReleaseNoteView.ts +0 -107
  116. package/front_end/panels/help/help-meta.ts +0 -145
  117. package/front_end/panels/help/help.ts +0 -13
  118. package/front_end/panels/help/releaseNote.css +0 -115
  119. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
  120. package/scripts/build/build_release_applications.py +0 -216
  121. package/scripts/build/modular_build.py +0 -184
  122. package/scripts/check_gn.js +0 -119
  123. package/scripts/json_validator/module.schema.json +0 -19
  124. package/scripts/json_validator/validate_module_json.js +0 -44
@@ -28,6 +28,7 @@
28
28
  */
29
29
 
30
30
  import * as i18n from '../../core/i18n/i18n.js';
31
+ import * as Platform from '../../core/platform/platform.js';
31
32
  import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
32
33
 
33
34
  import type * as SDK from '../../core/sdk/sdk.js';
@@ -528,7 +529,7 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
528
529
  equalTo = true;
529
530
  }
530
531
 
531
- const matcher = createPlainTextSearchRegex(query, 'i');
532
+ const matcher = Platform.StringUtilities.createPlainTextSearchRegex(query, 'i');
532
533
 
533
534
  function matchesQuery(profileDataGridNode: ProfileDataGridNode): boolean {
534
535
  profileDataGridNode.searchMatchedSelfColumn = false;
@@ -92,7 +92,7 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
92
92
  // clang-format off
93
93
  return LitHtml.html`
94
94
  <span class="warning">
95
- ${i18nString(UIStrings.syncDisabled)} <a href="${link}" class="link" target="_blank"
95
+ ${i18nString(UIStrings.syncDisabled)} <a href=${link} class="link" target="_blank"
96
96
  @click=${(e: Event): void => openSettingsTab(link, e)}
97
97
  @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
98
98
  </span>`;
@@ -104,7 +104,7 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
104
104
  // clang-format off
105
105
  return LitHtml.html`
106
106
  <span class="warning">
107
- ${i18nString(UIStrings.preferencesSyncDisabled)} <a href="${link}" class="link" target="_blank"
107
+ ${i18nString(UIStrings.preferencesSyncDisabled)} <a href=${link} class="link" target="_blank"
108
108
  @click=${(e: Event): void => openSettingsTab(link, e)}
109
109
  @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
110
110
  </span>`;
@@ -356,9 +356,9 @@ export class UserAgentClientHintsForm extends HTMLElement {
356
356
  <input
357
357
  class="input-field"
358
358
  type="text"
359
- @input="${handleInputChange}"
360
- .value="${value}"
361
- placeholder="${placeholder}"
359
+ @input=${handleInputChange}
360
+ .value=${value}
361
+ placeholder=${placeholder}
362
362
  />
363
363
  </label>
364
364
  `;
@@ -376,22 +376,22 @@ export class UserAgentClientHintsForm extends HTMLElement {
376
376
  };
377
377
  return LitHtml.html`
378
378
  <span class="full-row label">${i18nString(UIStrings.platformLabel)}</span>
379
- <div class="full-row brand-row" aria-label="${i18nString(UIStrings.platformProperties)}" role="group">
379
+ <div class="full-row brand-row" aria-label=${i18nString(UIStrings.platformProperties)} role="group">
380
380
  <input
381
381
  class="input-field half-row"
382
382
  type="text"
383
- @input="${handlePlatformNameChange}"
384
- .value="${platform}"
385
- placeholder="${i18nString(UIStrings.platformPlaceholder)}"
386
- aria-label="${i18nString(UIStrings.platformLabel)}"
383
+ @input=${handlePlatformNameChange}
384
+ .value=${platform}
385
+ placeholder=${i18nString(UIStrings.platformPlaceholder)}
386
+ aria-label=${i18nString(UIStrings.platformLabel)}
387
387
  />
388
388
  <input
389
389
  class="input-field half-row"
390
390
  type="text"
391
- @input="${handlePlatformVersionChange}"
392
- .value="${platformVersion}"
393
- placeholder="${i18nString(UIStrings.platformVersion)}"
394
- aria-label="${i18nString(UIStrings.platformVersion)}"
391
+ @input=${handlePlatformVersionChange}
392
+ .value=${platformVersion}
393
+ placeholder=${i18nString(UIStrings.platformVersion)}
394
+ aria-label=${i18nString(UIStrings.platformVersion)}
395
395
  />
396
396
  </div>
397
397
  `;
@@ -409,20 +409,20 @@ export class UserAgentClientHintsForm extends HTMLElement {
409
409
  };
410
410
  const mobileCheckboxInput = this.showMobileCheckbox ? LitHtml.html`
411
411
  <label class="mobile-checkbox-container">
412
- <input type="checkbox" @input="${handleMobileChange}" .checked="${mobile}" />
412
+ <input type="checkbox" @input=${handleMobileChange} .checked=${mobile} />
413
413
  ${i18nString(UIStrings.mobileCheckboxLabel)}
414
414
  </label>
415
415
  ` :
416
416
  LitHtml.html``;
417
417
  return LitHtml.html`
418
418
  <span class="full-row label">${i18nString(UIStrings.deviceModel)}</span>
419
- <div class="full-row brand-row" aria-label="${i18nString(UIStrings.deviceProperties)}" role="group">
419
+ <div class="full-row brand-row" aria-label=${i18nString(UIStrings.deviceProperties)} role="group">
420
420
  <input
421
421
  class="input-field ${this.showMobileCheckbox ? 'device-model-input' : 'full-row'}"
422
422
  type="text"
423
- @input="${handleDeviceModelChange}"
424
- .value="${model}"
425
- placeholder="${i18nString(UIStrings.deviceModel)}"
423
+ @input=${handleDeviceModelChange}
424
+ .value=${model}
425
+ placeholder=${i18nString(UIStrings.deviceModel)}
426
426
  />
427
427
  ${mobileCheckboxInput}
428
428
  </div>
@@ -459,41 +459,41 @@ export class UserAgentClientHintsForm extends HTMLElement {
459
459
  this.handleBrandInputChange(value, index, 'brandVersion');
460
460
  };
461
461
  return LitHtml.html`
462
- <div class="full-row brand-row" aria-label="${i18nString(UIStrings.brandProperties)}" role="group">
462
+ <div class="full-row brand-row" aria-label=${i18nString(UIStrings.brandProperties)} role="group">
463
463
  <input
464
464
  class="input-field brand-name-input"
465
465
  type="text"
466
- @input="${handleBrandBrowserChange}"
467
- .value="${brand}"
466
+ @input=${handleBrandBrowserChange}
467
+ .value=${brand}
468
468
  id="brand-${index + 1}-input"
469
- placeholder="${i18nString(UIStrings.brandName)}"
470
- aria-label="${i18nString(UIStrings.brandNameAriaLabel, {
469
+ placeholder=${i18nString(UIStrings.brandName)}
470
+ aria-label=${i18nString(UIStrings.brandNameAriaLabel, {
471
471
  PH1: index + 1,
472
- })}"
472
+ })}
473
473
  />
474
474
  <input
475
475
  class="input-field"
476
476
  type="text"
477
- @input="${handleBrandVersionChange}"
478
- .value="${version}"
479
- placeholder="${i18nString(UIStrings.version)}"
480
- aria-label="${i18nString(UIStrings.brandVersionAriaLabel, {
477
+ @input=${handleBrandVersionChange}
478
+ .value=${version}
479
+ placeholder=${i18nString(UIStrings.version)}
480
+ aria-label=${i18nString(UIStrings.brandVersionAriaLabel, {
481
481
  PH1: index + 1,
482
- })}"
482
+ })}
483
483
  />
484
484
  <${IconButton.Icon.Icon.litTagName}
485
485
  .data=${
486
486
  {color: 'var(--client-hints-form-icon-color)', iconName: 'trash_bin_icon', width: '10px', height: '14px'} as
487
487
  IconButton.Icon.IconData}
488
- title="${i18nString(UIStrings.deleteTooltip)}"
488
+ title=${i18nString(UIStrings.deleteTooltip)}
489
489
  class="delete-icon"
490
490
  tabindex="0"
491
491
  role="button"
492
- @click="${handleDeleteClick}"
493
- @keypress="${handleKeyPress}"
494
- aria-label="${i18nString(UIStrings.brandDeleteAriaLabel, {
492
+ @click=${handleDeleteClick}
493
+ @keypress=${handleKeyPress}
494
+ aria-label=${i18nString(UIStrings.brandDeleteAriaLabel, {
495
495
  PH1: index + 1,
496
- })}"
496
+ })}
497
497
  >
498
498
  </${IconButton.Icon.Icon.litTagName}>
499
499
  </div>
@@ -507,9 +507,9 @@ export class UserAgentClientHintsForm extends HTMLElement {
507
507
  role="button"
508
508
  tabindex="0"
509
509
  id="add-brand-button"
510
- aria-label="${i18nString(UIStrings.addBrand)}"
511
- @click="${this.handleAddBrandClick}"
512
- @keypress="${this.handleAddBrandKeyPress}"
510
+ aria-label=${i18nString(UIStrings.addBrand)}
511
+ @click=${this.handleAddBrandClick}
512
+ @keypress=${this.handleAddBrandKeyPress}
513
513
  >
514
514
  <${IconButton.Icon.Icon.litTagName}
515
515
  aria-hidden="true"
@@ -547,16 +547,16 @@ export class UserAgentClientHintsForm extends HTMLElement {
547
547
  <div
548
548
  class="tree-title"
549
549
  role="button"
550
- @click="${this.handleTreeClick}"
550
+ @click=${this.handleTreeClick}
551
551
  tabindex="0"
552
- @keydown="${this.handleTreeExpand}"
553
- aria-expanded="${this.isFormOpened}"
552
+ @keydown=${this.handleTreeExpand}
553
+ aria-expanded=${this.isFormOpened}
554
554
  aria-controls="form-container"
555
- @disabled="${this.isFormDisabled}"
556
- aria-disabled="${this.isFormDisabled}"
555
+ @disabled=${this.isFormDisabled}
556
+ aria-disabled=${this.isFormDisabled}
557
557
  >
558
558
  <${IconButton.Icon.Icon.litTagName}
559
- class="${this.isFormOpened ? '' : 'rotate-icon'}"
559
+ class=${this.isFormOpened ? '' : 'rotate-icon'}
560
560
  .data=${
561
561
  {color: 'var(--client-hints-form-icon-color)', iconName: 'chromeSelect', width: '20px'} as
562
562
  IconButton.Icon.IconData}
@@ -568,8 +568,8 @@ export class UserAgentClientHintsForm extends HTMLElement {
568
568
  href="https://web.dev/user-agent-client-hints/"
569
569
  target="_blank"
570
570
  class="info-link"
571
- @keypress="${this.handleLinkPress}"
572
- aria-label="${i18nString(UIStrings.userAgentClientHintsInfo)}"
571
+ @keypress=${this.handleLinkPress}
572
+ aria-label=${i18nString(UIStrings.userAgentClientHintsInfo)}
573
573
  >
574
574
  <${IconButton.Icon.Icon.litTagName}
575
575
  .data=${
@@ -582,7 +582,7 @@ export class UserAgentClientHintsForm extends HTMLElement {
582
582
  <form
583
583
  id="form-container"
584
584
  class="form-container ${this.isFormOpened ? '' : 'hide-container'}"
585
- @submit="${this.handleSubmit}"
585
+ @submit=${this.handleSubmit}
586
586
  >
587
587
  ${brandSection}
588
588
  ${fullBrowserInput}
@@ -591,7 +591,7 @@ export class UserAgentClientHintsForm extends HTMLElement {
591
591
  ${deviceModelSection}
592
592
  ${submitButton}
593
593
  </form>
594
- <div aria-live="polite" aria-label="${this.brandsModifiedAriaMessage}"></div>
594
+ <div aria-live="polite" aria-label=${this.brandsModifiedAriaMessage}></div>
595
595
  </section>
596
596
  `;
597
597
  // clang-format off
@@ -284,7 +284,8 @@ export class TimelineTreeView extends UI.Widget.VBox implements UI.SearchableVie
284
284
  new UI.Toolbar.ToolbarInput(i18nString(UIStrings.filter), this.getToolbarInputAccessiblePlaceHolder());
285
285
  textFilterUI.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, () => {
286
286
  const searchQuery = textFilterUI.value();
287
- this.textFilterInternal.setRegExp(searchQuery ? createPlainTextSearchRegex(searchQuery, 'i') : null);
287
+ this.textFilterInternal.setRegExp(
288
+ searchQuery ? Platform.StringUtilities.createPlainTextSearchRegex(searchQuery, 'i') : null);
288
289
  this.refreshTree();
289
290
  }, this);
290
291
  this.textFilterUI = textFilterUI;
@@ -191,7 +191,7 @@ class DiffRenderer {
191
191
 
192
192
  private render(rows: readonly Row[]): LitHtml.TemplateResult {
193
193
  return LitHtml.html`
194
- <div class="diff-listing" aria-label="${i18nString(UIStrings.changesDiffViewer)}">
194
+ <div class="diff-listing" aria-label=${i18nString(UIStrings.changesDiffViewer)}>
195
195
  ${rows.map(row => this.renderRow(row))}
196
196
  </div>`;
197
197
  }
@@ -213,7 +213,7 @@ class DiffRenderer {
213
213
  return LitHtml.html`
214
214
  <div class="diff-line-number" aria-hidden="true">${baseNumber}</div>
215
215
  <div class="diff-line-number" aria-hidden="true">${curNumber}</div>
216
- <div class="${markerClass}" aria-hidden="true">${marker}</div>
216
+ <div class=${markerClass} aria-hidden="true">${marker}</div>
217
217
  <div class="diff-line-content diff-line-${row.type}" data-line-number=${curNumber}>${screenReaderText}${
218
218
  this.renderRowContent(row)}</div>`;
219
219
  }
@@ -230,10 +230,10 @@ class DiffRenderer {
230
230
  for (const token of row.tokens) {
231
231
  const tokenContent: (LitHtml.TemplateResult|string)[] = [];
232
232
  doc.highlightRange(pos, pos + token.text.length, (text, style) => {
233
- tokenContent.push(style ? LitHtml.html`<span class="${style}">${text}</span>` : text);
233
+ tokenContent.push(style ? LitHtml.html`<span class=${style}>${text}</span>` : text);
234
234
  });
235
235
  content.push(
236
- token.className ? LitHtml.html`<span class="${token.className}">${tokenContent}</span>` :
236
+ token.className ? LitHtml.html`<span class=${token.className}>${tokenContent}</span>` :
237
237
  LitHtml.html`${tokenContent}`);
238
238
  pos += token.text.length;
239
239
  }
@@ -3,28 +3,17 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import type * as Common from '../../../core/common/common.js';
6
- import * as Root from '../../../core/root/root.js';
7
6
  import * as ThemeSupport from '../../legacy/theme_support/theme_support.js';
8
7
 
9
- import {CSS_RESOURCES_TO_LOAD_INTO_RUNTIME} from './get-stylesheet.js';
10
-
11
8
  /**
12
9
  * Houses any setup required to run the component docs server. Currently this is
13
10
  * only populating the runtime CSS cache but may be extended in the future.
14
11
  */
15
- export async function setup(resourcesPrefix = ''): Promise<void> {
12
+ export async function setup(): Promise<void> {
16
13
  const setting = {
17
14
  get() {
18
15
  return 'default';
19
16
  },
20
17
  } as Common.Settings.Setting<string>;
21
18
  ThemeSupport.ThemeSupport.instance({forceNew: true, setting});
22
-
23
- const allPromises = CSS_RESOURCES_TO_LOAD_INTO_RUNTIME.map(resourcePath => {
24
- return fetch(resourcesPrefix + '/front_end/' + resourcePath).then(response => response.text()).then(cssText => {
25
- Root.Runtime.cachedResources.set(resourcePath, cssText);
26
- });
27
- });
28
-
29
- await Promise.all(allPromises);
30
19
  }
@@ -6,7 +6,6 @@ import * as ComponentServerSetup from './component-server-setup.js';
6
6
  import * as CustomElements from './custom-elements.js';
7
7
  import * as Directives from './directives.js';
8
8
  import * as GetRootNode from './get-root-node.js';
9
- import * as LegacyGetStylesheet from './get-stylesheet.js';
10
9
  import * as ScheduledRender from './scheduled-render.js';
11
10
  import * as SetCSSProperty from './set-css-property.js';
12
11
 
@@ -15,7 +14,6 @@ export {
15
14
  CustomElements,
16
15
  Directives,
17
16
  GetRootNode,
18
- LegacyGetStylesheet,
19
17
  ScheduledRender,
20
18
  SetCSSProperty,
21
19
  };
@@ -80,7 +80,7 @@ export class IconButton extends HTMLElement {
80
80
  // Disabled until https://crbug.com/1079231 is fixed.
81
81
  // clang-format off
82
82
  LitHtml.render(LitHtml.html`
83
- <button class="${buttonClasses}" @click=${this.onClickHandler} aria-label="${LitHtml.Directives.ifDefined(this.#accessibleName)}">
83
+ <button class=${buttonClasses} @click=${this.onClickHandler} aria-label=${LitHtml.Directives.ifDefined(this.#accessibleName)}>
84
84
  ${(!this.#compact && this.#leadingText) ? LitHtml.html`<span class="icon-button-title">${this.#leadingText}</span>` : LitHtml.nothing}
85
85
  ${filteredGroups.map(counter =>
86
86
  LitHtml.html`
@@ -192,8 +192,8 @@ export class IssueCounter extends HTMLElement {
192
192
  };
193
193
  LitHtml.render(
194
194
  LitHtml.html`
195
- <icon-button .data=${data as IconButton.IconButton.IconButtonData} .accessibleName="${
196
- this.#accessibleName}"></icon-button>
195
+ <icon-button .data=${data as IconButton.IconButton.IconButtonData} .accessibleName=${
196
+ this.#accessibleName}></icon-button>
197
197
  `,
198
198
  this.#shadow, {host: this});
199
199
  this.#tooltipCallback?.();
@@ -212,7 +212,7 @@ export class LinearMemoryViewer extends HTMLElement {
212
212
  };
213
213
  return html`
214
214
  <div class="row">
215
- <span class="${LitHtml.Directives.classMap(classMap)}">${toHexString({number: startIndex + this.#memoryOffset, pad: 8, prefix: false})}</span>
215
+ <span class=${LitHtml.Directives.classMap(classMap)}>${toHexString({number: startIndex + this.#memoryOffset, pad: 8, prefix: false})}</span>
216
216
  <span class="divider"></span>
217
217
  ${this.renderByteValues(startIndex, endIndex)}
218
218
  <span class="divider"></span>
@@ -237,7 +237,7 @@ export class LinearMemoryViewer extends HTMLElement {
237
237
  const byteValue = isSelectableCell ? html`${toHexString({number: this.#memory[i], pad: 2, prefix: false})}` : '';
238
238
  const actualIndex = i + this.#memoryOffset;
239
239
  const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, actualIndex) : '';
240
- cells.push(html`<span class="${LitHtml.Directives.classMap(classMap)}" @click=${onSelectedByte}>${byteValue}</span>`);
240
+ cells.push(html`<span class=${LitHtml.Directives.classMap(classMap)} @click=${onSelectedByte}>${byteValue}</span>`);
241
241
  }
242
242
  return html`${cells}`;
243
243
  }
@@ -253,7 +253,7 @@ export class LinearMemoryViewer extends HTMLElement {
253
253
  const isSelectableCell = i < this.#memory.length;
254
254
  const value = isSelectableCell ? html`${this.toAscii(this.#memory[i])}` : '';
255
255
  const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, i + this.#memoryOffset) : '';
256
- cells.push(html`<span class="${LitHtml.Directives.classMap(classMap)}" @click=${onSelectedByte}>${value}</span>`);
256
+ cells.push(html`<span class=${LitHtml.Directives.classMap(classMap)} @click=${onSelectedByte}>${value}</span>`);
257
257
  }
258
258
  return html`${cells}`;
259
259
  }
@@ -105,13 +105,13 @@ const tokenRenderers = new Map<string, (token: any) => LitHtml.TemplateResult>([
105
105
  ['space', (): LitHtml.TemplateResult => html``],
106
106
  [
107
107
  'link',
108
- (token): LitHtml.TemplateResult => html`<${MarkdownLink.litTagName} .data="${
109
- {key: token.href, title: token.text} as MarkdownLinkData}"></${MarkdownLink.litTagName}>`,
108
+ (token): LitHtml.TemplateResult => html`<${MarkdownLink.litTagName} .data=${
109
+ {key: token.href, title: token.text} as MarkdownLinkData}></${MarkdownLink.litTagName}>`,
110
110
  ],
111
111
  [
112
112
  'image',
113
- (token): LitHtml.TemplateResult => html`<${MarkdownImage.litTagName} .data="${
114
- {key: token.href, title: token.text} as MarkdownImageData}"></${MarkdownImage.litTagName}>`,
113
+ (token): LitHtml.TemplateResult => html`<${MarkdownImage.litTagName} .data=${
114
+ {key: token.href, title: token.text} as MarkdownImageData}></${MarkdownImage.litTagName}>`,
115
115
  ],
116
116
  ]);
117
117
 
@@ -0,0 +1,98 @@
1
+ // Copyright (c) 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../../core/i18n/i18n.js';
6
+ import * as Root from '../../../core/root/root.js';
7
+ import * as LitHtml from '../../../ui/lit-html/lit-html.js';
8
+ import * as ComponentHelpers from '../helpers/helpers.js';
9
+ import * as IconButton from '../icon_button/icon_button.js';
10
+
11
+ import previewToggleStyles from './previewToggle.css.js';
12
+
13
+ const {render, html, nothing} = LitHtml;
14
+
15
+ export interface PreviewToggleData {
16
+ name: string;
17
+ helperText: string|null;
18
+ feedbackURL: string|null;
19
+ experiment: Root.Runtime.ExperimentName;
20
+ onChangeCallback?: (checked: boolean) => void;
21
+ }
22
+
23
+ const UIStrings = {
24
+ /**
25
+ *@description Link text the user can click to provide feedback to the team.
26
+ */
27
+ previewTextFeedbackLink: 'Send us your feedback.',
28
+ };
29
+
30
+ const str_ = i18n.i18n.registerUIStrings('ui/components/panel_feedback/PreviewToggle.ts', UIStrings);
31
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
32
+
33
+ export class PreviewToggle extends HTMLElement {
34
+ static readonly litTagName = LitHtml.literal`devtools-preview-toggle`;
35
+ readonly #shadow = this.attachShadow({mode: 'open'});
36
+
37
+ #name = '';
38
+ #helperText: string|null = null;
39
+ #feedbackURL: string|null = null;
40
+ #experiment: string = '';
41
+ #onChangeCallback?: (checked: boolean) => void;
42
+
43
+ connectedCallback(): void {
44
+ this.#shadow.adoptedStyleSheets = [previewToggleStyles];
45
+ }
46
+
47
+ set data(data: PreviewToggleData) {
48
+ this.#name = data.name;
49
+ this.#helperText = data.helperText;
50
+ this.#feedbackURL = data.feedbackURL;
51
+ this.#experiment = data.experiment;
52
+ this.#onChangeCallback = data.onChangeCallback;
53
+ this.render();
54
+ }
55
+
56
+ private render(): void {
57
+ const checked = Root.Runtime.experiments.isEnabled(this.#experiment);
58
+ // Disabled until https://crbug.com/1079231 is fixed.
59
+ // clang-format off
60
+ render(
61
+ html`
62
+ <div class="experiment-preview">
63
+ <input type="checkbox" ?checked=${checked} @change=${this.checkboxChanged} aria-label=${this.#name}/>
64
+ <${IconButton.Icon.Icon.litTagName} .data=${{
65
+ iconName: 'ic_preview_feature',
66
+ width: '16px',
67
+ height: '16px',
68
+ color: 'var(--color-text-secondary)',
69
+ } as IconButton.Icon.IconData}>
70
+ </${IconButton.Icon.Icon.litTagName}>${this.#name}
71
+ </div>
72
+ <div class="helper">
73
+ ${this.#helperText && this.#feedbackURL
74
+ ? html`<p>${this.#helperText} <x-link href=${this.#feedbackURL}>${i18nString(UIStrings.previewTextFeedbackLink)}</x-link></p>`
75
+ : nothing}
76
+ </div>`,
77
+ this.#shadow,
78
+ {
79
+ host: this,
80
+ });
81
+ // clang-format on
82
+ }
83
+
84
+ private checkboxChanged(event: Event): void {
85
+ const checked = (event.target as HTMLInputElement).checked;
86
+ Root.Runtime.experiments.setEnabled(this.#experiment, checked);
87
+ this.#onChangeCallback?.(checked);
88
+ }
89
+ }
90
+
91
+ ComponentHelpers.CustomElements.defineComponent('devtools-preview-toggle', PreviewToggle);
92
+
93
+ declare global {
94
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
95
+ interface HTMLElementTagNameMap {
96
+ 'devtools-preview-toggle': PreviewToggle;
97
+ }
98
+ }
@@ -4,3 +4,4 @@
4
4
 
5
5
  export * as FeedbackButton from './FeedbackButton.js';
6
6
  export * as PanelFeedback from './PanelFeedback.js';
7
+ export * as PreviewToggle from './PreviewToggle.js';
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright 2021 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ :host {
8
+ display: block;
9
+ }
10
+
11
+ .experiment-preview {
12
+ display: flex;
13
+ align-items: center;
14
+ }
15
+
16
+ .helper {
17
+ text-align: center;
18
+ font-style: italic;
19
+ }
20
+
21
+ x-link { /* stylelint-disable-line selector-type-no-unknown */
22
+ color: var(--color-primary);
23
+ text-decoration-line: underline;
24
+ }
@@ -7,6 +7,7 @@ import * as LitHtml from '../../lit-html/lit-html.js';
7
7
 
8
8
  import reportStyles from './report.css.js';
9
9
  import reportKeyStyles from './reportKey.css.js';
10
+ import reportSectionStyles from './reportSection.css.js';
10
11
  import reportSectionDividerStyles from './reportSectionDivider.css.js';
11
12
  import reportSectionHeaderStyles from './reportSectionHeader.css.js';
12
13
  import reportValueStyles from './reportValue.css.js';
@@ -66,6 +67,25 @@ export interface ReportSectionData {
66
67
  sectionTitle: string;
67
68
  }
68
69
 
70
+ export class ReportSection extends HTMLElement {
71
+ static readonly litTagName = LitHtml.literal`devtools-report-section`;
72
+ private readonly shadow = this.attachShadow({mode: 'open'});
73
+ connectedCallback(): void {
74
+ this.shadow.adoptedStyleSheets = [reportSectionStyles];
75
+ this.render();
76
+ }
77
+ private render(): void {
78
+ // Disabled until https://crbug.com/1079231 is fixed.
79
+ // clang-format off
80
+ LitHtml.render(LitHtml.html`
81
+ <div class="section">
82
+ <slot></slot>
83
+ </div>
84
+ `, this.shadow, {host: this});
85
+ // clang-format on
86
+ }
87
+ }
88
+
69
89
  export class ReportSectionHeader extends HTMLElement {
70
90
  static readonly litTagName = LitHtml.literal`devtools-report-section-header`;
71
91
 
@@ -146,6 +166,7 @@ export class ReportValue extends HTMLElement {
146
166
  }
147
167
 
148
168
  ComponentHelpers.CustomElements.defineComponent('devtools-report', Report);
169
+ ComponentHelpers.CustomElements.defineComponent('devtools-report-section', ReportSection);
149
170
  ComponentHelpers.CustomElements.defineComponent('devtools-report-section-header', ReportSectionHeader);
150
171
  ComponentHelpers.CustomElements.defineComponent('devtools-report-key', ReportKey);
151
172
  ComponentHelpers.CustomElements.defineComponent('devtools-report-value', ReportValue);
@@ -155,6 +176,7 @@ declare global {
155
176
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
177
  interface HTMLElementTagNameMap {
157
178
  'devtools-report': Report;
179
+ 'devtools-report-section': ReportSection;
158
180
  'devtools-report-section-header': ReportSectionHeader;
159
181
  'devtools-report-key': ReportKey;
160
182
  'devtools-report-value': ReportValue;
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2021 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ :host {
8
+ grid-column-start: span 2;
9
+ }
10
+
11
+ .section {
12
+ padding: 12px;
13
+ margin-left: 18px;
14
+ display: flex;
15
+ flex-direction: row;
16
+ align-items: center;
17
+ flex: auto;
18
+ overflow-wrap: break-word;
19
+ overflow: hidden;
20
+ }
@@ -179,7 +179,7 @@ export class RequestLinkIcon extends HTMLElement {
179
179
  return LitHtml.nothing;
180
180
  }
181
181
  const filename = extractShortPath(url);
182
- return LitHtml.html`<span aria-label="${i18nString(UIStrings.shortenedURL)}" title="${url}">${filename}</span>`;
182
+ return LitHtml.html`<span aria-label=${i18nString(UIStrings.shortenedURL)} title=${url}>${filename}</span>`;
183
183
  }
184
184
 
185
185
  private render(): Promise<void> {
@@ -55,8 +55,8 @@ export class SettingCheckbox extends HTMLElement {
55
55
  LitHtml.html`
56
56
  <p>
57
57
  <label>
58
- <input type="checkbox" ?checked=${this.#setting.get()} ?disabled=${this.#disabled} @change="${
59
- this.checkboxChanged}" aria-label="${this.#setting.title()}" /> ${this.#setting.title()}
58
+ <input type="checkbox" ?checked=${this.#setting.get()} ?disabled=${this.#disabled} @change=${
59
+ this.checkboxChanged} aria-label=${this.#setting.title()} /> ${this.#setting.title()}
60
60
  </label>
61
61
  </p>`,
62
62
  this.#shadow, {host: this});
@@ -325,11 +325,12 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
325
325
  if (pos !== lineBefore.to) {
326
326
  return null;
327
327
  }
328
- const wordBefore = /#?[\w$]+$/.exec(lineBefore.text);
329
- if (wordBefore && !label.startsWith(wordBefore[0])) {
328
+ const partBefore = (label[0] === '\'' ? /'(\\.|[^'\\])*$/ : label[0] === '"' ? /"(\\.|[^"\\])*$/ : /#?[\w$]+$/)
329
+ .exec(lineBefore.text);
330
+ if (partBefore && !label.startsWith(partBefore[0])) {
330
331
  return null;
331
332
  }
332
- return label.slice(wordBefore ? wordBefore[0].length : 0);
333
+ return label.slice(partBefore ? partBefore[0].length : 0);
333
334
  }
334
335
  }, {decorations: p => p.decorations});
335
336