chrome-devtools-frontend 1.0.1520535 → 1.0.1521223

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.
@@ -221,6 +221,16 @@ const UIStrings = {
221
221
  * the overlay showing CSS scroll snapping for the current element.
222
222
  */
223
223
  disableScrollSnap: 'Disable scroll-snap overlay',
224
+ /**
225
+ * @description Label of an adorner in the Elements panel. When clicked, it forces
226
+ * the element into applying its starting-style rules.
227
+ */
228
+ enableStartingStyle: 'Enable @starting-style mode',
229
+ /**
230
+ * @description Label of an adorner in the Elements panel. When clicked, it no longer
231
+ * forces the element into applying its starting-style rules.
232
+ */
233
+ disableStartingStyle: 'Disable @starting-style mode',
224
234
  /**
225
235
  * @description Label of an adorner in the Elements panel. When clicked, it redirects
226
236
  * to the Media Panel.
@@ -2586,6 +2596,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
2586
2596
  this.pushMediaAdorner(this.tagTypeContext);
2587
2597
  }
2588
2598
 
2599
+ if (Root.Runtime.hostConfig.devToolsStartingStyleDebugging?.enabled) {
2600
+ const affectedByStartingStyles = node.affectedByStartingStyles();
2601
+ if (affectedByStartingStyles) {
2602
+ this.pushStartingStyleAdorner(this.tagTypeContext);
2603
+ }
2604
+ }
2605
+
2589
2606
  if (node.attributes().find(attr => attr.name === 'popover')) {
2590
2607
  this.pushPopoverAdorner(this.tagTypeContext);
2591
2608
  }
@@ -2756,6 +2773,36 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
2756
2773
  }
2757
2774
  }
2758
2775
 
2776
+ pushStartingStyleAdorner(context: OpeningTagContext): void {
2777
+ const node = this.node();
2778
+ const nodeId = node.id;
2779
+ if (!nodeId) {
2780
+ return;
2781
+ }
2782
+ const config = ElementsComponents.AdornerManager.getRegisteredAdorner(
2783
+ ElementsComponents.AdornerManager.RegisteredAdorners.STARTING_STYLE);
2784
+ const adorner = this.adorn(config);
2785
+ adorner.classList.add('starting-style');
2786
+
2787
+ const onClick = ((() => {
2788
+ const model = node.domModel().cssModel();
2789
+ if (adorner.isActive()) {
2790
+ model.forceStartingStyle(node, true);
2791
+ } else {
2792
+ model.forceStartingStyle(node, false);
2793
+ }
2794
+ }) as EventListener);
2795
+
2796
+ adorner.addInteraction(onClick, {
2797
+ isToggle: true,
2798
+ shouldPropagateOnKeydown: false,
2799
+ ariaLabelDefault: i18nString(UIStrings.enableStartingStyle),
2800
+ ariaLabelActive: i18nString(UIStrings.disableStartingStyle),
2801
+ });
2802
+
2803
+ context.styleAdorners.add(adorner);
2804
+ }
2805
+
2759
2806
  pushFlexAdorner(context: OpeningTagContext): void {
2760
2807
  const node = this.node();
2761
2808
  const nodeId = node.id;
@@ -1497,6 +1497,8 @@ export class ElementsTreeOutline extends
1497
1497
  domModel.addEventListener(SDK.DOMModel.Events.DistributedNodesChanged, this.distributedNodesChanged, this);
1498
1498
  domModel.addEventListener(SDK.DOMModel.Events.TopLayerElementsChanged, this.topLayerElementsChanged, this);
1499
1499
  domModel.addEventListener(SDK.DOMModel.Events.ScrollableFlagUpdated, this.scrollableFlagUpdated, this);
1500
+ domModel.addEventListener(
1501
+ SDK.DOMModel.Events.AffectedByStartingStylesFlagUpdated, this.affectedByStartingStylesFlagUpdated, this);
1500
1502
  }
1501
1503
 
1502
1504
  unwireFromDOMModel(domModel: SDK.DOMModel.DOMModel): void {
@@ -1511,6 +1513,8 @@ export class ElementsTreeOutline extends
1511
1513
  domModel.removeEventListener(SDK.DOMModel.Events.DistributedNodesChanged, this.distributedNodesChanged, this);
1512
1514
  domModel.removeEventListener(SDK.DOMModel.Events.TopLayerElementsChanged, this.topLayerElementsChanged, this);
1513
1515
  domModel.removeEventListener(SDK.DOMModel.Events.ScrollableFlagUpdated, this.scrollableFlagUpdated, this);
1516
+ domModel.removeEventListener(
1517
+ SDK.DOMModel.Events.AffectedByStartingStylesFlagUpdated, this.affectedByStartingStylesFlagUpdated, this);
1514
1518
  elementsTreeOutlineByDOMModel.delete(domModel);
1515
1519
  }
1516
1520
 
@@ -1983,6 +1987,15 @@ export class ElementsTreeOutline extends
1983
1987
  void treeElement.tagTypeContext.adornersThrottler.schedule(async () => treeElement.updateScrollAdorner());
1984
1988
  }
1985
1989
  }
1990
+
1991
+ private affectedByStartingStylesFlagUpdated(event: Common.EventTarget.EventTargetEvent<{node: SDK.DOMModel.DOMNode}>):
1992
+ void {
1993
+ const {node} = event.data;
1994
+ const treeElement = this.treeElementByNode.get(node);
1995
+ if (treeElement && isOpeningTag(treeElement.tagTypeContext)) {
1996
+ void treeElement.tagTypeContext.adornersThrottler.schedule(async () => await treeElement.updateStyleAdorners());
1997
+ }
1998
+ }
1986
1999
  }
1987
2000
 
1988
2001
  export namespace ElementsTreeOutline {
@@ -796,6 +796,11 @@ export class StylePropertiesSection {
796
796
  case Protocol.CSS.CSSRuleType.StyleRule:
797
797
  ancestorRuleElement = this.createNestingElement(rule.nestingSelectors?.[nestingIndex++]);
798
798
  break;
799
+ case Protocol.CSS.CSSRuleType.StartingStyleRule:
800
+ if (Root.Runtime.hostConfig.devToolsStartingStyleDebugging?.enabled) {
801
+ ancestorRuleElement = this.createStartingStyleElement();
802
+ }
803
+ break;
799
804
  }
800
805
  if (ancestorRuleElement) {
801
806
  this.#ancestorRuleListElement.prepend(ancestorRuleElement);
@@ -917,6 +922,17 @@ export class StylePropertiesSection {
917
922
  return scopeElement;
918
923
  }
919
924
 
925
+ protected createStartingStyleElement(/* startingStyle: SDK.CSSStartingStyle.CSSStartingStyle*/):
926
+ ElementsComponents.CSSQuery.CSSQuery|undefined {
927
+ const startingStyleElement = new ElementsComponents.CSSQuery.CSSQuery();
928
+ startingStyleElement.data = {
929
+ queryPrefix: '@starting-style',
930
+ queryText: '',
931
+ jslogContext: 'starting-style',
932
+ };
933
+ return startingStyleElement;
934
+ }
935
+
920
936
  protected createSupportsElement(supports: SDK.CSSSupports.CSSSupports): ElementsComponents.CSSQuery.CSSQuery
921
937
  |undefined {
922
938
  if (!supports.text) {
@@ -28,6 +28,7 @@ export enum RegisteredAdorners {
28
28
  FLEX = 'flex',
29
29
  AD = 'ad',
30
30
  SCROLL_SNAP = 'scroll-snap',
31
+ STARTING_STYLE = 'starting-style',
31
32
  CONTAINER = 'container',
32
33
  SLOT = 'slot',
33
34
  TOP_LAYER = 'top-layer',
@@ -77,6 +78,12 @@ export function getRegisteredAdorner(which: RegisteredAdorners): RegisteredAdorn
77
78
  category: AdornerCategories.LAYOUT,
78
79
  enabledByDefault: true,
79
80
  };
81
+ case RegisteredAdorners.STARTING_STYLE:
82
+ return {
83
+ name: 'starting-style',
84
+ category: AdornerCategories.LAYOUT,
85
+ enabledByDefault: true,
86
+ };
80
87
  case RegisteredAdorners.CONTAINER:
81
88
  return {
82
89
  name: 'container',
@@ -54,22 +54,12 @@ const UIStrings = {
54
54
  * @description Label for the Google Developer Program subscription status that corresponds to
55
55
  * `PREMIUM_ANNUAL` plan.
56
56
  */
57
- gdpPremiumAnnualSubscription: 'Premium (Annual)',
58
- /**
59
- * @description Label for the Google Developer Program subscription status that corresponds to
60
- * `PREMIUM_MONTHLY` plan.
61
- */
62
- gdpPremiumMonthlySubscription: 'Premium (Monthly)',
57
+ gdpPremiumSubscription: 'Premium',
63
58
  /**
64
59
  * @description Label for the Google Developer Program subscription status that corresponds to
65
60
  * `PRO_ANNUAL` plan.
66
61
  */
67
- gdpProAnnualSubscription: 'Pro (Annual)',
68
- /**
69
- * @description Label for the Google Developer Program subscription status that corresponds to
70
- * `PRO_MONTHLY` plan.
71
- */
72
- gdpProMonthlySubscription: 'Pro (Monthly)',
62
+ gdpProSubscription: 'Pro',
73
63
  /**
74
64
  * @description Label for the Google Developer Program subscription status that corresponds
75
65
  * to a plan not known by the client.
@@ -137,13 +127,11 @@ function getGdpSubscriptionText(profile: Host.GdpClient.Profile): Platform.UIStr
137
127
 
138
128
  switch (profile.activeSubscription.subscriptionTier) {
139
129
  case Host.GdpClient.SubscriptionTier.PREMIUM_ANNUAL:
140
- return i18nString(UIStrings.gdpPremiumAnnualSubscription);
141
130
  case Host.GdpClient.SubscriptionTier.PREMIUM_MONTHLY:
142
- return i18nString(UIStrings.gdpPremiumMonthlySubscription);
131
+ return i18nString(UIStrings.gdpPremiumSubscription);
143
132
  case Host.GdpClient.SubscriptionTier.PRO_ANNUAL:
144
- return i18nString(UIStrings.gdpProAnnualSubscription);
145
133
  case Host.GdpClient.SubscriptionTier.PRO_MONTHLY:
146
- return i18nString(UIStrings.gdpProMonthlySubscription);
134
+ return i18nString(UIStrings.gdpProSubscription);
147
135
  default:
148
136
  return i18nString(UIStrings.gdpUnknownSubscription);
149
137
  }
@@ -197,8 +197,8 @@ export class InspectorView extends VBox implements ViewLocationResolver {
197
197
  this.#toggleOrientationButton = new ToolbarButton(
198
198
  i18nString(UIStrings.toggleDrawerOrientation),
199
199
  this.drawerSplitWidget.isVertical() ? 'dock-bottom' : 'dock-right');
200
- this.#toggleOrientationButton.element.setAttribute('jslog', `${VisualLogging.toggle().track({click: true})}`);
201
- this.#toggleOrientationButton.element.setAttribute('jslogcontext', 'toggle-drawer-orientation');
200
+ this.#toggleOrientationButton.element.setAttribute(
201
+ 'jslog', `${VisualLogging.toggle('toggle-drawer-orientation').track({click: true})}`);
202
202
  this.#toggleOrientationButton.addEventListener(
203
203
  ToolbarButton.Events.CLICK, () => this.toggleDrawerOrientation(), this);
204
204
  this.drawerTabbedPane.addEventListener(
@@ -302,17 +302,17 @@ export class InspectorView extends VBox implements ViewLocationResolver {
302
302
  inspectorViewInstance = null;
303
303
  }
304
304
 
305
- onDockSideChangedHandledForTest(): void {
305
+ applyDrawerOrientationForDockSideForTest(): void {
306
306
  }
307
307
 
308
- #onDockSideChanged(): void {
308
+ #applyDrawerOrientationForDockSide(): void {
309
309
  if (!this.drawerVisible()) {
310
- this.onDockSideChangedHandledForTest();
310
+ this.applyDrawerOrientationForDockSideForTest();
311
311
  return;
312
312
  }
313
313
  const newOrientation = this.#getOrientationForDockMode();
314
- this.#applyOrientation(newOrientation);
315
- this.onDockSideChangedHandledForTest();
314
+ this.#applyDrawerOrientation(newOrientation);
315
+ this.applyDrawerOrientationForDockSideForTest();
316
316
  }
317
317
 
318
318
  #getDockMode(): DockMode {
@@ -339,10 +339,15 @@ export class InspectorView extends VBox implements ViewLocationResolver {
339
339
  return orientation;
340
340
  }
341
341
 
342
- #applyOrientation(orientation: Omit<DrawerOrientation, DrawerOrientation.UNSET>): void {
343
- const isVertical = orientation === DrawerOrientation.VERTICAL;
344
- this.#toggleOrientationButton.setGlyph(isVertical ? 'dock-bottom' : 'dock-right');
345
- this.drawerSplitWidget.setVertical(isVertical);
342
+ #applyDrawerOrientation(orientation: Omit<DrawerOrientation, DrawerOrientation.UNSET>): void {
343
+ const shouldBeVertical = orientation === DrawerOrientation.VERTICAL;
344
+ const isVertical = this.drawerSplitWidget.isVertical();
345
+ if (shouldBeVertical === isVertical) {
346
+ return;
347
+ }
348
+
349
+ this.#toggleOrientationButton.setGlyph(shouldBeVertical ? 'dock-bottom' : 'dock-right');
350
+ this.drawerSplitWidget.setVertical(shouldBeVertical);
346
351
  this.setDrawerRelatedMinimumSizes();
347
352
  }
348
353
 
@@ -360,15 +365,16 @@ export class InspectorView extends VBox implements ViewLocationResolver {
360
365
  this.#resizeObserver.observe(this.element);
361
366
  this.#observedResize();
362
367
  this.element.ownerDocument.addEventListener('keydown', this.keyDownBound, false);
363
- DockController.instance().addEventListener(DockControllerEvents.DOCK_SIDE_CHANGED, this.#onDockSideChanged, this);
364
- this.#onDockSideChanged();
368
+ DockController.instance().addEventListener(
369
+ DockControllerEvents.DOCK_SIDE_CHANGED, this.#applyDrawerOrientationForDockSide, this);
370
+ this.#applyDrawerOrientationForDockSide();
365
371
  }
366
372
 
367
373
  override willHide(): void {
368
374
  this.#resizeObserver.unobserve(this.element);
369
375
  this.element.ownerDocument.removeEventListener('keydown', this.keyDownBound, false);
370
376
  DockController.instance().removeEventListener(
371
- DockControllerEvents.DOCK_SIDE_CHANGED, this.#onDockSideChanged, this);
377
+ DockControllerEvents.DOCK_SIDE_CHANGED, this.#applyDrawerOrientationForDockSide, this);
372
378
  }
373
379
 
374
380
  resolveLocation(locationName: string): ViewLocation|null {
@@ -463,6 +469,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
463
469
  } else {
464
470
  this.focusRestorer = null;
465
471
  }
472
+ this.#applyDrawerOrientationForDockSide();
466
473
  ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.drawerShown));
467
474
  }
468
475
 
@@ -502,7 +509,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
502
509
  currentSettings[dockMode] = newOrientation as DrawerOrientation;
503
510
  this.drawerOrientationByDockSetting.set(currentSettings);
504
511
 
505
- this.#applyOrientation(newOrientation);
512
+ this.#applyDrawerOrientation(newOrientation);
506
513
  }
507
514
 
508
515
  isUserExplicitlyUpdatedDrawerOrientation(): boolean {
@@ -3573,6 +3573,7 @@ export const knownContextValues = new Set([
3573
3573
  'starter-badge-dismissed',
3574
3574
  'starter-badge-last-snoozed-timestamp',
3575
3575
  'starter-badge-snooze-count',
3576
+ 'starting-style',
3576
3577
  'static-global-setting',
3577
3578
  'static-synced-setting',
3578
3579
  'status',
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "@eslint/core": "0.15.1"
103
103
  }
104
104
  },
105
- "version": "1.0.1520535"
105
+ "version": "1.0.1521223"
106
106
  }