chrome-devtools-frontend 1.0.1526203 → 1.0.1526630

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.
@@ -94,7 +94,7 @@ export class Toolbar extends HTMLElement {
94
94
  if (element instanceof Buttons.Button.Button) {
95
95
  item = new ToolbarButton('', undefined, undefined, undefined, element);
96
96
  } else if (element instanceof ToolbarInputElement) {
97
- item = element.item;
97
+ item = element.item as ToolbarItem;
98
98
  } else if (element instanceof HTMLSelectElement) {
99
99
  item = new ToolbarComboBox(null, element.title, undefined, undefined, element);
100
100
  } else {
@@ -833,11 +833,12 @@ export class ToolbarFilter extends ToolbarInput {
833
833
  }
834
834
 
835
835
  export class ToolbarInputElement extends HTMLElement {
836
- static observedAttributes = ['value'];
836
+ static observedAttributes = ['value', 'disabled'];
837
837
 
838
- item!: ToolbarInput;
838
+ item?: ToolbarInput;
839
839
  datalist: HTMLDataListElement|null = null;
840
840
  value: string|undefined = undefined;
841
+ #disabled = false;
841
842
 
842
843
  connectedCallback(): void {
843
844
  if (this.item) {
@@ -866,6 +867,9 @@ export class ToolbarInputElement extends HTMLElement {
866
867
  if (this.value) {
867
868
  this.item.setValue(this.value);
868
869
  }
870
+ if (this.#disabled) {
871
+ this.item.setEnabled(false);
872
+ }
869
873
  this.item.addEventListener(ToolbarInput.Event.TEXT_CHANGED, event => {
870
874
  this.dispatchEvent(new CustomEvent('change', {detail: event.data}));
871
875
  });
@@ -875,7 +879,7 @@ export class ToolbarInputElement extends HTMLElement {
875
879
  }
876
880
 
877
881
  override focus(): void {
878
- this.item.focus();
882
+ this.item?.focus();
879
883
  }
880
884
 
881
885
  async #onAutocomplete(expression: string, prefix: string, force?: boolean): Promise<Suggestion[]> {
@@ -894,8 +898,25 @@ export class ToolbarInputElement extends HTMLElement {
894
898
  } else {
895
899
  this.value = newValue;
896
900
  }
901
+ } else if (name === 'disabled') {
902
+ this.#disabled = typeof newValue === 'string';
903
+ if (this.item) {
904
+ this.item.setEnabled(!this.#disabled);
905
+ }
906
+ }
907
+ }
908
+
909
+ set disabled(disabled: boolean) {
910
+ if (disabled) {
911
+ this.setAttribute('disabled', '');
912
+ } else {
913
+ this.removeAttribute('disabled');
897
914
  }
898
915
  }
916
+
917
+ get disabled(): boolean {
918
+ return this.hasAttribute('disabled');
919
+ }
899
920
  }
900
921
  customElements.define('devtools-toolbar-input', ToolbarInputElement);
901
922
 
@@ -2135,6 +2135,7 @@ export function bindToAction(actionName: string): ReturnType<typeof Directives.r
2135
2135
  const action = ActionRegistry.instance().getAction(actionName);
2136
2136
 
2137
2137
  let setEnabled: (enabled: boolean) => void;
2138
+ let toggled: () => void;
2138
2139
  function actionEnabledChanged(event: Common.EventTarget.EventTargetEvent<boolean>): void {
2139
2140
  setEnabled(event.data);
2140
2141
  }
@@ -2142,6 +2143,7 @@ export function bindToAction(actionName: string): ReturnType<typeof Directives.r
2142
2143
  return Directives.ref((e: Element|undefined) => {
2143
2144
  if (!e || !(e instanceof Buttons.Button.Button)) {
2144
2145
  action.removeEventListener(ActionRegistration.Events.ENABLED, actionEnabledChanged);
2146
+ action.removeEventListener(ActionRegistration.Events.TOGGLED, toggled);
2145
2147
  return;
2146
2148
  }
2147
2149
 
@@ -2151,10 +2153,34 @@ export function bindToAction(actionName: string): ReturnType<typeof Directives.r
2151
2153
 
2152
2154
  action.addEventListener(ActionRegistration.Events.ENABLED, actionEnabledChanged);
2153
2155
 
2156
+ const toggleable = action.toggleable();
2157
+ if (toggleable) {
2158
+ toggled = () => {
2159
+ e.toggled = action.toggled();
2160
+ if (action.title()) {
2161
+ e.title = action.title();
2162
+ Tooltip.installWithActionBinding(e, action.title(), action.id());
2163
+ }
2164
+ };
2165
+ action.addEventListener(ActionRegistration.Events.TOGGLED, toggled);
2166
+ }
2154
2167
  const title = action.title();
2155
- const iconName = action.icon();
2168
+ const iconName = action.icon() ?? '';
2156
2169
  const jslogContext = action.id();
2157
- if (iconName) {
2170
+ const toggledIconName = action.toggledIcon() ?? iconName;
2171
+ const toggleType = action.toggleWithRedColor() ? Buttons.Button.ToggleType.RED : Buttons.Button.ToggleType.PRIMARY;
2172
+ if (toggleable) {
2173
+ e.data = {
2174
+ jslogContext,
2175
+ title,
2176
+ variant: Buttons.Button.Variant.ICON_TOGGLE,
2177
+ iconName,
2178
+ toggledIconName,
2179
+ toggleType,
2180
+ toggled: action.toggled(),
2181
+ };
2182
+ toggled();
2183
+ } else if (iconName) {
2158
2184
  e.data = {iconName, jslogContext, title, variant: Buttons.Button.Variant.ICON};
2159
2185
  } else {
2160
2186
  e.data = {jslogContext, title, variant: Buttons.Button.Variant.TEXT};
@@ -737,6 +737,11 @@ export class Widget {
737
737
  return;
738
738
  }
739
739
 
740
+ if (this.#shadowRoot?.delegatesFocus && this.contentElement.querySelector('[autofocus]')) {
741
+ this.element.focus();
742
+ return;
743
+ }
744
+
740
745
  const element = (this.#defaultFocusedElement as HTMLElement | null);
741
746
  if (element) {
742
747
  if (!element.hasFocus()) {
@@ -312,6 +312,7 @@ class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
312
312
  for (const element of this.#getStyleElements(nodes)) {
313
313
  this.#shadowRoot.appendChild(element.cloneNode(true));
314
314
  }
315
+ this.#dataGrid.dispatchEventToListeners(DataGridEvents.SORTING_CHANGED);
315
316
  }
316
317
 
317
318
  override removeNodes(nodes: NodeList): void {
@@ -346,7 +347,6 @@ class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
346
347
  dataGridNode.refresh();
347
348
  }
348
349
  }
349
- this.#dataGrid.dispatchEventToListeners(DataGridEvents.SORTING_CHANGED);
350
350
  }
351
351
 
352
352
  #updateCreationNode(): void {
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable rulesdir/no-imperative-dom-api */
5
5
 
6
+ import type * as Common from '../../../../core/common/common.js';
6
7
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
7
8
  import * as LinearMemoryInspectorComponents from '../../../../panels/linear_memory_inspector/components/components.js';
8
9
  import * as UI from '../../legacy.js';
@@ -22,13 +23,11 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
22
23
 
23
24
  constructor() {
24
25
  super();
25
- this.#inspector.contentElement.addEventListener(
26
- LinearMemoryInspectorComponents.LinearMemoryInspector.MemoryRequestEvent.eventName,
27
- (event: LinearMemoryInspectorComponents.LinearMemoryInspector.MemoryRequestEvent) =>
28
- this.#memoryRequested(event));
29
- this.#inspector.contentElement.addEventListener(
30
- LinearMemoryInspectorComponents.LinearMemoryInspector.AddressChangedEvent.eventName,
31
- (event: LinearMemoryInspectorComponents.LinearMemoryInspector.AddressChangedEvent) => {
26
+ this.#inspector.addEventListener(
27
+ LinearMemoryInspectorComponents.LinearMemoryInspector.Events.MEMORY_REQUEST, this.#memoryRequested, this);
28
+ this.#inspector.addEventListener(
29
+ LinearMemoryInspectorComponents.LinearMemoryInspector.Events.ADDRESS_CHANGED,
30
+ (event: Common.EventTarget.EventTargetEvent<number>) => {
32
31
  this.#address = event.data;
33
32
  });
34
33
  this.#inspector.show(this.contentElement);
@@ -60,7 +59,7 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
60
59
  this.#inspector.hideValueInspector = true;
61
60
  }
62
61
 
63
- #memoryRequested(event: LinearMemoryInspectorComponents.LinearMemoryInspector.MemoryRequestEvent): void {
62
+ #memoryRequested(event: Common.EventTarget.EventTargetEvent<{start: number, end: number, address: number}>): void {
64
63
  // TODO(szuend): The following lines are copied from `LinearMemoryInspectorController`. We can't reuse them
65
64
  // as depending on a module in `panels/` from a component is a layering violation.
66
65
 
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "flat-cache": "6.1.12"
103
103
  }
104
104
  },
105
- "version": "1.0.1526203"
105
+ "version": "1.0.1526630"
106
106
  }