chrome-devtools-frontend 1.0.1622369 → 1.0.1624583

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 (101) hide show
  1. package/.agents/skills/foundation-test-migration/SKILL.md +1 -1
  2. package/front_end/Images/src/expand.svg +1 -0
  3. package/front_end/core/host/AidaClient.ts +6 -5
  4. package/front_end/core/host/AidaClientTypes.ts +3 -1
  5. package/front_end/core/host/DispatchHttpRequestClient.ts +6 -3
  6. package/front_end/core/platform/api/HostRuntime.ts +3 -0
  7. package/front_end/core/platform/browser/HostRuntime.ts +10 -0
  8. package/front_end/core/platform/node/HostRuntime.ts +10 -0
  9. package/front_end/core/root/Runtime.ts +6 -5
  10. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +72 -8
  11. package/front_end/entrypoints/greendev_floaty/floaty.html +1 -1
  12. package/front_end/generated/Deprecation.ts +7 -0
  13. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  14. package/front_end/generated/SupportedCSSProperties.js +6 -6
  15. package/front_end/generated/protocol.ts +1 -0
  16. package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +373 -112
  17. package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +57 -0
  18. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +2 -1
  19. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -10
  20. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -3
  21. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -3
  22. package/front_end/models/javascript_metadata/NativeFunctions.js +9 -4
  23. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +8 -4
  24. package/front_end/panels/ai_assistance/components/ChatMessage.ts +219 -8
  25. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
  26. package/front_end/panels/console/ConsoleView.ts +86 -7
  27. package/front_end/panels/console/ConsoleViewMessage.ts +23 -1
  28. package/front_end/panels/elements/StylePropertiesSection.ts +1 -2
  29. package/front_end/panels/elements/StylePropertyTreeElement.ts +3 -3
  30. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +11 -2
  31. package/front_end/panels/elements/StylesSidebarPane.ts +29 -5
  32. package/front_end/panels/elements/stylePropertiesTreeOutline.css +5 -1
  33. package/front_end/panels/emulation/DeviceModeToolbar.ts +37 -13
  34. package/front_end/panels/emulation/deviceModeView.css +25 -0
  35. package/front_end/panels/greendev/GreenDevPanel.ts +30 -3
  36. package/front_end/panels/media/EventDisplayTable.ts +1 -1
  37. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +48 -27
  38. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +67 -38
  39. package/front_end/panels/network/NetworkConfigView.ts +1 -1
  40. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -22
  41. package/front_end/third_party/chromium/README.chromium +1 -1
  42. package/front_end/third_party/lighthouse/README.chromium +2 -2
  43. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +5176 -5104
  44. package/front_end/third_party/lighthouse/locales/ar-XB.json +72 -36
  45. package/front_end/third_party/lighthouse/locales/ar.json +72 -36
  46. package/front_end/third_party/lighthouse/locales/bg.json +72 -36
  47. package/front_end/third_party/lighthouse/locales/ca.json +72 -36
  48. package/front_end/third_party/lighthouse/locales/cs.json +72 -36
  49. package/front_end/third_party/lighthouse/locales/da.json +74 -38
  50. package/front_end/third_party/lighthouse/locales/de.json +72 -36
  51. package/front_end/third_party/lighthouse/locales/el.json +73 -37
  52. package/front_end/third_party/lighthouse/locales/en-GB.json +74 -38
  53. package/front_end/third_party/lighthouse/locales/en-US.json +245 -17
  54. package/front_end/third_party/lighthouse/locales/en-XL.json +245 -17
  55. package/front_end/third_party/lighthouse/locales/es-419.json +72 -36
  56. package/front_end/third_party/lighthouse/locales/es.json +73 -37
  57. package/front_end/third_party/lighthouse/locales/fi.json +72 -36
  58. package/front_end/third_party/lighthouse/locales/fil.json +74 -38
  59. package/front_end/third_party/lighthouse/locales/fr.json +162 -126
  60. package/front_end/third_party/lighthouse/locales/he.json +74 -38
  61. package/front_end/third_party/lighthouse/locales/hi.json +73 -37
  62. package/front_end/third_party/lighthouse/locales/hr.json +72 -36
  63. package/front_end/third_party/lighthouse/locales/hu.json +73 -37
  64. package/front_end/third_party/lighthouse/locales/id.json +74 -38
  65. package/front_end/third_party/lighthouse/locales/it.json +72 -36
  66. package/front_end/third_party/lighthouse/locales/ja.json +72 -36
  67. package/front_end/third_party/lighthouse/locales/ko.json +72 -36
  68. package/front_end/third_party/lighthouse/locales/lt.json +72 -36
  69. package/front_end/third_party/lighthouse/locales/lv.json +72 -36
  70. package/front_end/third_party/lighthouse/locales/nl.json +73 -37
  71. package/front_end/third_party/lighthouse/locales/no.json +72 -36
  72. package/front_end/third_party/lighthouse/locales/pl.json +72 -36
  73. package/front_end/third_party/lighthouse/locales/pt-PT.json +72 -36
  74. package/front_end/third_party/lighthouse/locales/pt.json +74 -38
  75. package/front_end/third_party/lighthouse/locales/ro.json +72 -36
  76. package/front_end/third_party/lighthouse/locales/ru.json +72 -36
  77. package/front_end/third_party/lighthouse/locales/sk.json +72 -36
  78. package/front_end/third_party/lighthouse/locales/sl.json +72 -36
  79. package/front_end/third_party/lighthouse/locales/sr-Latn.json +73 -37
  80. package/front_end/third_party/lighthouse/locales/sr.json +73 -37
  81. package/front_end/third_party/lighthouse/locales/sv.json +75 -39
  82. package/front_end/third_party/lighthouse/locales/ta.json +73 -37
  83. package/front_end/third_party/lighthouse/locales/te.json +72 -36
  84. package/front_end/third_party/lighthouse/locales/th.json +73 -37
  85. package/front_end/third_party/lighthouse/locales/tr.json +72 -36
  86. package/front_end/third_party/lighthouse/locales/uk.json +72 -36
  87. package/front_end/third_party/lighthouse/locales/vi.json +74 -38
  88. package/front_end/third_party/lighthouse/locales/zh-HK.json +72 -36
  89. package/front_end/third_party/lighthouse/locales/zh-TW.json +74 -38
  90. package/front_end/third_party/lighthouse/locales/zh.json +75 -39
  91. package/front_end/third_party/lighthouse/report/bundle.js +2 -1
  92. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  93. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +6 -2
  94. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +4 -1
  95. package/front_end/ui/legacy/SuggestBox.ts +1 -0
  96. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  97. package/front_end/ui/legacy/UIUtils.ts +26 -4
  98. package/front_end/ui/visual_logging/KnownContextValues.ts +20 -0
  99. package/package.json +9 -8
  100. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +0 -134
  101. package/front_end/panels/emulation/components/components.ts +0 -9
@@ -5,6 +5,7 @@
5
5
  import * as Common from '../../../core/common/common.js';
6
6
  import * as Host from '../../../core/host/host.js';
7
7
  import * as i18n from '../../../core/i18n/i18n.js';
8
+ import * as Root from '../../../core/root/root.js';
8
9
  import * as AiCodeCompletion from '../../../models/ai_code_completion/ai_code_completion.js';
9
10
  import * as AiCodeGeneration from '../../../models/ai_code_generation/ai_code_generation.js';
10
11
  import * as PanelCommon from '../../../panels/common/common.js';
@@ -158,8 +159,11 @@ export class AiCodeCompletionProvider {
158
159
  return;
159
160
  }
160
161
  this.#aiCodeCompletion = new AiCodeCompletion.AiCodeCompletion.AiCodeCompletion(
161
- {aidaClient: this.#aidaClient}, this.#aiCodeCompletionConfig.panel, undefined,
162
- this.#aiCodeCompletionConfig.completionContext.stopSequences);
162
+ {
163
+ aidaClient: this.#aidaClient,
164
+ serverSideLoggingEnabled: !Root.Runtime.hostConfig.aidaAvailability?.disallowLogging,
165
+ },
166
+ this.#aiCodeCompletionConfig.panel, undefined, this.#aiCodeCompletionConfig.completionContext.stopSequences);
163
167
  this.#aiCodeCompletionConfig.onFeatureEnabled();
164
168
  }
165
169
 
@@ -119,7 +119,10 @@ export class AiCodeGenerationProvider {
119
119
  if (this.#aiCodeGeneration) {
120
120
  return;
121
121
  }
122
- this.#aiCodeGeneration = new AiCodeGeneration.AiCodeGeneration.AiCodeGeneration({aidaClient: this.#aidaClient});
122
+ this.#aiCodeGeneration = new AiCodeGeneration.AiCodeGeneration.AiCodeGeneration({
123
+ aidaClient: this.#aidaClient,
124
+ serverSideLoggingEnabled: !Root.Runtime.hostConfig.aidaAvailability?.disallowLogging,
125
+ });
123
126
  this.#editor?.dispatch({
124
127
  effects:
125
128
  [this.#generationTeaserCompartment.reconfigure([aiCodeGenerationTeaserExtension(this.#generationTeaser)])],
@@ -345,6 +345,7 @@ export interface Suggestion {
345
345
  };
346
346
  hideGhostText?: boolean;
347
347
  iconElement?: HTMLElement;
348
+ disableAcceptSuggestionOnStopCharacters?: boolean;
348
349
  }
349
350
 
350
351
  export type Suggestions = Suggestion[];
@@ -598,7 +598,8 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
598
598
 
599
599
  private acceptSuggestionOnStopCharacters(key: string): boolean {
600
600
  if (!this.currentSuggestion || !this.queryRange || key.length !== 1 ||
601
- !this.completionStopCharacters?.includes(key)) {
601
+ !this.completionStopCharacters?.includes(key) ||
602
+ this.currentSuggestion.disableAcceptSuggestionOnStopCharacters) {
602
603
  return false;
603
604
  }
604
605
 
@@ -2285,7 +2285,6 @@ export const bindToSetting =
2285
2285
  }
2286
2286
  }
2287
2287
 
2288
- const jslogBuilder = jslog ? VisualLogging.toggle(setting.name).track({change: true}) : null;
2289
2288
  // We can't use `setValue` as the change listener directly, otherwise we won't
2290
2289
  // be able to remove it again.
2291
2290
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2295,22 +2294,45 @@ export const bindToSetting =
2295
2294
  }
2296
2295
 
2297
2296
  if (setting.type() === Common.Settings.SettingType.BOOLEAN || typeof setting.defaultValue === 'boolean') {
2297
+ let attachedButton: Buttons.Button.Button|undefined;
2298
+ let clickListener: (() => void)|undefined;
2299
+
2298
2300
  return Directives.ref(e => {
2299
2301
  if (e === undefined) {
2300
2302
  setting.removeChangeListener(settingChanged);
2303
+ if (attachedButton && clickListener) {
2304
+ attachedButton.removeEventListener('click', clickListener);
2305
+ attachedButton = undefined;
2306
+ }
2301
2307
  return;
2302
2308
  }
2303
- if (jslogBuilder) {
2309
+ if (jslog) {
2310
+ const isButton = e instanceof Buttons.Button.Button;
2311
+ const jslogBuilder = VisualLogging.toggle(setting.name).track(isButton ? {click: true} : {change: true});
2304
2312
  e.setAttribute('jslog', jslogBuilder.toString());
2305
2313
  }
2306
2314
 
2307
2315
  setting.addChangeListener(settingChanged);
2308
- setValue =
2309
- bindCheckboxImpl(e as CheckboxLabel, (setting as Common.Settings.Setting<boolean>).set.bind(setting));
2316
+
2317
+ if (e instanceof Buttons.Button.Button) {
2318
+ attachedButton = e;
2319
+ clickListener = (): void => {
2320
+ (setting as Common.Settings.Setting<boolean>).set(!setting.get());
2321
+ };
2322
+ e.addEventListener('click', clickListener);
2323
+ setValue = (value: boolean): void => {
2324
+ e.toggled = value;
2325
+ };
2326
+ } else {
2327
+ setValue =
2328
+ bindCheckboxImpl(e as CheckboxLabel, (setting as Common.Settings.Setting<boolean>).set.bind(setting));
2329
+ }
2310
2330
  setValue(setting.get());
2311
2331
  });
2312
2332
  }
2313
2333
 
2334
+ const jslogBuilder = jslog ? VisualLogging.toggle(setting.name).track({change: true}) : null;
2335
+
2314
2336
  if (setting.type() === Common.Settings.SettingType.REGEX || setting instanceof Common.Settings.RegExpSetting) {
2315
2337
  return Directives.ref(e => {
2316
2338
  if (e === undefined) {
@@ -722,6 +722,7 @@ export const knownContextValues = new Set([
722
722
  'cache-storage-view-tab',
723
723
  'cache-storage.delete-selected',
724
724
  'cache-storage.refresh',
725
+ 'cache-widget',
725
726
  'calibrated-cpu-throttling',
726
727
  'call-tree',
727
728
  'cancel',
@@ -744,6 +745,7 @@ export const knownContextValues = new Set([
744
745
  'changes',
745
746
  'changes.changes',
746
747
  'changes.reveal-source',
748
+ 'character-set-widget',
747
749
  'checkbox-item',
748
750
  'checked',
749
751
  'chevron-left',
@@ -935,6 +937,7 @@ export const knownContextValues = new Set([
935
937
  'console-view',
936
938
  'console.clear',
937
939
  'console.clear.history',
940
+ 'console.collapse-all',
938
941
  'console.create-pin',
939
942
  'console.sidebar-selected-filter',
940
943
  'console.text-filter',
@@ -1369,6 +1372,7 @@ export const knownContextValues = new Set([
1369
1372
  'distance',
1370
1373
  'dock-side',
1371
1374
  'document',
1375
+ 'document-latency-widget',
1372
1376
  'document.write',
1373
1377
  'documentation',
1374
1378
  'documents',
@@ -1384,6 +1388,7 @@ export const knownContextValues = new Set([
1384
1388
  'dom-node-inserted-into-document',
1385
1389
  'dom-node-removed',
1386
1390
  'dom-node-removed-from-document',
1391
+ 'dom-size-widget',
1387
1392
  'dom-snapshot',
1388
1393
  'dom-subtree-modified',
1389
1394
  'dom-window.close',
@@ -1422,6 +1427,7 @@ export const knownContextValues = new Set([
1422
1427
  'drjones.sources-panel-context.performance',
1423
1428
  'drjones.sources-panel-context.script',
1424
1429
  'drop',
1430
+ 'duplicate-javascript-widget',
1425
1431
  'durable-messages',
1426
1432
  'duration',
1427
1433
  'durationchange',
@@ -1705,6 +1711,7 @@ export const knownContextValues = new Set([
1705
1711
  'folder',
1706
1712
  'font',
1707
1713
  'font-display',
1714
+ 'font-display-widget',
1708
1715
  'font-editor',
1709
1716
  'font-editor-documentation',
1710
1717
  'font-family',
@@ -1744,6 +1751,7 @@ export const knownContextValues = new Set([
1744
1751
  'force-state',
1745
1752
  'forced-color-adjust',
1746
1753
  'forced-reflow',
1754
+ 'forced-reflow-widget',
1747
1755
  'form-data',
1748
1756
  'form-factors',
1749
1757
  'fourth',
@@ -1973,6 +1981,7 @@ export const knownContextValues = new Set([
1973
1981
  'ignore-this-retainer',
1974
1982
  'image',
1975
1983
  'image-animation',
1984
+ 'image-delivery-widget',
1976
1985
  'image-orientation',
1977
1986
  'image-rendering',
1978
1987
  'image-url',
@@ -2011,6 +2020,7 @@ export const knownContextValues = new Set([
2011
2020
  'inline-size',
2012
2021
  'inline-variable-values',
2013
2022
  'inline-variable-values-false',
2023
+ 'inp-breakdown-widget',
2014
2024
  'input',
2015
2025
  'insertCompositionText',
2016
2026
  'insertFromDrop',
@@ -2275,6 +2285,7 @@ export const knownContextValues = new Set([
2275
2285
  'layout-count',
2276
2286
  'layout-shifts',
2277
2287
  'lcp-breakdown',
2288
+ 'lcp-breakdown-widget',
2278
2289
  'lcp-discovery-widget',
2279
2290
  'learn-more',
2280
2291
  'learn-more.ai-annotations',
@@ -2290,6 +2301,7 @@ export const knownContextValues = new Set([
2290
2301
  'learn-more.origin-trials',
2291
2302
  'leavepictureinpicture',
2292
2303
  'left',
2304
+ 'legacy-javascript-widget',
2293
2305
  'legend',
2294
2306
  'length',
2295
2307
  'length-popover',
@@ -2328,6 +2340,7 @@ export const knownContextValues = new Set([
2328
2340
  'lighthouse.audit.aria-treeitem-name',
2329
2341
  'lighthouse.audit.aria-valid-attr',
2330
2342
  'lighthouse.audit.aria-valid-attr-value',
2343
+ 'lighthouse.audit.autocomplete-valid',
2331
2344
  'lighthouse.audit.baseline',
2332
2345
  'lighthouse.audit.bf-cache',
2333
2346
  'lighthouse.audit.bootup-time',
@@ -2435,6 +2448,7 @@ export const knownContextValues = new Set([
2435
2448
  'lighthouse.audit.offscreen-images',
2436
2449
  'lighthouse.audit.origin-isolation',
2437
2450
  'lighthouse.audit.paste-preventing-inputs',
2451
+ 'lighthouse.audit.presentation-role-conflict',
2438
2452
  'lighthouse.audit.prioritize-lcp-image',
2439
2453
  'lighthouse.audit.redirects',
2440
2454
  'lighthouse.audit.redirects-http',
@@ -2449,6 +2463,7 @@ export const knownContextValues = new Set([
2449
2463
  'lighthouse.audit.skip-link',
2450
2464
  'lighthouse.audit.speed-index',
2451
2465
  'lighthouse.audit.structured-data',
2466
+ 'lighthouse.audit.svg-img-alt',
2452
2467
  'lighthouse.audit.tabindex',
2453
2468
  'lighthouse.audit.table-duplicate-name',
2454
2469
  'lighthouse.audit.table-fake-caption',
@@ -2700,6 +2715,7 @@ export const knownContextValues = new Set([
2700
2715
  'mobile-throttling',
2701
2716
  'model',
2702
2717
  'modern',
2718
+ 'modern-http-widget',
2703
2719
  'monitoring-xhr-enabled',
2704
2720
  'monspace',
2705
2721
  'more',
@@ -2758,6 +2774,7 @@ export const knownContextValues = new Set([
2758
2774
  'network-conditions.network-offline',
2759
2775
  'network-conditions.network-online',
2760
2776
  'network-default',
2777
+ 'network-dependency-tree-widget',
2761
2778
  'network-direct-socket-message-filter',
2762
2779
  'network-event-source-message-filter',
2763
2780
  'network-film-strip',
@@ -3715,6 +3732,7 @@ export const knownContextValues = new Set([
3715
3732
  'slot',
3716
3733
  'slow',
3717
3734
  'slow-4g',
3735
+ 'slow-css-selector-widget',
3718
3736
  'sm-script',
3719
3737
  'sm-stylesheet',
3720
3738
  'small',
@@ -3965,6 +3983,7 @@ export const knownContextValues = new Set([
3965
3983
  'th',
3966
3984
  'third',
3967
3985
  'third-parties',
3986
+ 'third-parties-widget',
3968
3987
  'third-party-tree',
3969
3988
  'third-property',
3970
3989
  'this-origin',
@@ -4345,6 +4364,7 @@ export const knownContextValues = new Set([
4345
4364
  'view-transition-group',
4346
4365
  'view-transition-name',
4347
4366
  'view-transition-scope',
4367
+ 'viewport-widget',
4348
4368
  'views-location-override',
4349
4369
  'virtual-authenticators',
4350
4370
  'visibility',
package/package.json CHANGED
@@ -79,7 +79,7 @@
79
79
  "mocha": "11.7.5",
80
80
  "ora": "9.0.0",
81
81
  "postcss": "8.5.6",
82
- "puppeteer-core": "24.30.0",
82
+ "puppeteer-core": "24.42.0",
83
83
  "rollup": "4.22.4",
84
84
  "rollup-plugin-sourcemaps2": "0.5.4",
85
85
  "sinon": "21.0.0",
@@ -97,12 +97,13 @@
97
97
  "js-rouge": "3.2.0"
98
98
  },
99
99
  "overrides": {
100
- "baseline-browser-mapping": "2.8.25",
101
- "electron-to-chromium": "1.5.248",
102
- "caniuse-lite": "1.0.30001754",
103
- "stylelint": {
104
- "flat-cache": "6.1.12"
105
- }
100
+ "electron-to-chromium": "1.5.335",
101
+ "bare-os": "3.9.0",
102
+ "bare-stream": "2.13.0",
103
+ "tar-stream": "3.1.5",
104
+ "socks": "2.8.7",
105
+ "ip-address": "10.1.0",
106
+ "basic-ftp": "5.2.2"
106
107
  },
107
- "version": "1.0.1622369"
108
+ "version": "1.0.1624583"
108
109
  }
@@ -1,134 +0,0 @@
1
- // Copyright 2021 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
-
6
- import type * as Platform from '../../../core/platform/platform.js';
7
- import * as EmulationModel from '../../../models/emulation/emulation.js';
8
- import * as UILegacy from '../../../ui/legacy/legacy.js';
9
- import {html, render} from '../../../ui/lit/lit.js';
10
- import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
11
-
12
- class SizeChangedEvent extends Event {
13
- static readonly eventName = 'sizechanged';
14
- constructor(public size: number) {
15
- super(SizeChangedEvent.eventName);
16
- }
17
- }
18
-
19
- function getInputValue(event: Event): number {
20
- return Number((event.target as HTMLInputElement).value);
21
- }
22
-
23
- export class SizeInputElement extends HTMLElement {
24
- #root = this.attachShadow({mode: 'open'});
25
- #disabled = false;
26
- #size = '0';
27
- #placeholder = '';
28
- #title: Platform.UIString.LocalizedString;
29
- #jslogContext: string;
30
-
31
- constructor(title: Platform.UIString.LocalizedString, {jslogContext}: {jslogContext: string}) {
32
- super();
33
- this.#title = title;
34
- this.#jslogContext = jslogContext;
35
- }
36
-
37
- connectedCallback(): void {
38
- this.render();
39
- }
40
-
41
- set disabled(disabled: boolean) {
42
- this.#disabled = disabled;
43
- this.render();
44
- }
45
-
46
- set size(size: string) {
47
- this.#size = size;
48
- this.render();
49
- }
50
-
51
- set placeholder(placeholder: string) {
52
- this.#placeholder = placeholder;
53
- this.render();
54
- }
55
-
56
- render(): void {
57
- render(
58
- // Since the emulation code runs in a different frame, we can't
59
- // use constructed stylesheets (they are disallowed cross-frame).
60
- // For now, use an inline style tag and later we can refactor this
61
- // to use proper constructed stylesheets, when the code runs
62
- // in the correct frame context.
63
- html`
64
- <style>
65
- input {
66
- /*
67
- * 4 characters for the maximum size of the value,
68
- * 2 characters for the width of the step-buttons,
69
- * 2 pixels padding between the characters and the
70
- * step-buttons.
71
- */
72
- width: calc(4ch + 2ch + 2px);
73
- max-height: 18px;
74
- border: var(--sys-color-neutral-outline);
75
- border-radius: 4px;
76
- margin: 0 2px;
77
- text-align: center;
78
- font-size: inherit;
79
- font-family: inherit;
80
- }
81
-
82
- input:disabled {
83
- user-select: none;
84
- }
85
-
86
- input:focus::-webkit-input-placeholder {
87
- color: transparent;
88
- }
89
- </style>
90
- <input type="number"
91
- max=${EmulationModel.DeviceModeModel.MaxDeviceSize}
92
- min=${EmulationModel.DeviceModeModel.MinDeviceSize}
93
- jslog=${VisualLogging.textField().track({change: true}).context(this.#jslogContext)}
94
- maxlength="4"
95
- title=${this.#title}
96
- placeholder=${this.#placeholder}
97
- ?disabled=${this.#disabled}
98
- .value=${this.#size}
99
- @change=${this.#fireSizeChange}
100
- @keydown=${this.#handleModifierKeys} />
101
- `,
102
- this.#root, {host: this});
103
- }
104
-
105
- #fireSizeChange(event: Event): void {
106
- this.dispatchEvent(new SizeChangedEvent(getInputValue(event)));
107
- }
108
-
109
- #handleModifierKeys(event: Event): void {
110
- let modifiedValue = UILegacy.UIUtils.modifiedFloatNumber(getInputValue(event), event);
111
- if (modifiedValue === null) {
112
- return;
113
- }
114
-
115
- modifiedValue = Math.min(modifiedValue, EmulationModel.DeviceModeModel.MaxDeviceSize);
116
- modifiedValue = Math.max(modifiedValue, EmulationModel.DeviceModeModel.MinDeviceSize);
117
-
118
- event.preventDefault();
119
- (event.target as HTMLInputElement).value = String(modifiedValue);
120
- this.dispatchEvent(new SizeChangedEvent(modifiedValue));
121
- }
122
- }
123
-
124
- // eslint-disable-next-line @devtools/enforce-custom-element-prefix
125
- customElements.define('device-mode-emulation-size-input', SizeInputElement);
126
-
127
- declare global {
128
- interface HTMLElementTagNameMap {
129
- 'device-mode-emulation-size-input': SizeInputElement;
130
- }
131
- interface HTMLElementEventMap {
132
- sizechanged: SizeChangedEvent;
133
- }
134
- }
@@ -1,9 +0,0 @@
1
- // Copyright 2021 The Chromium Authors
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 DeviceSizeInputElement from './DeviceSizeInputElement.js';
6
-
7
- export {
8
- DeviceSizeInputElement,
9
- };