chrome-devtools-frontend 1.0.930993 → 1.0.932348

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 (81) hide show
  1. package/config/gni/devtools_grd_files.gni +6 -2
  2. package/front_end/core/common/ParsedURL.ts +12 -10
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +8 -6
  4. package/front_end/core/i18n/locales/en-US.json +345 -12
  5. package/front_end/core/i18n/locales/en-XL.json +345 -12
  6. package/front_end/core/platform/DevToolsPath.ts +34 -0
  7. package/front_end/core/platform/platform.ts +2 -0
  8. package/front_end/core/protocol_client/NodeURL.ts +2 -1
  9. package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -2
  10. package/front_end/core/sdk/ChildTargetManager.ts +2 -0
  11. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -2
  12. package/front_end/core/sdk/DebuggerModel.ts +4 -3
  13. package/front_end/core/sdk/NetworkRequest.ts +3 -2
  14. package/front_end/core/sdk/Resource.ts +6 -5
  15. package/front_end/core/sdk/Script.ts +4 -2
  16. package/front_end/core/sdk/Target.ts +4 -0
  17. package/front_end/core/sdk/TracingModel.ts +8 -17
  18. package/front_end/entrypoint_template.html +1 -1
  19. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +1 -1
  20. package/front_end/models/bindings/BreakpointManager.ts +6 -3
  21. package/front_end/models/bindings/ResourceMapping.ts +2 -1
  22. package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
  23. package/front_end/models/emulation/DeviceModeModel.ts +1 -1
  24. package/front_end/models/persistence/IsolatedFileSystem.ts +9 -7
  25. package/front_end/models/persistence/IsolatedFileSystemManager.ts +8 -7
  26. package/front_end/models/persistence/PersistenceActions.ts +1 -1
  27. package/front_end/models/persistence/PlatformFileSystem.ts +4 -3
  28. package/front_end/models/text_utils/ContentProvider.ts +2 -1
  29. package/front_end/models/text_utils/StaticContentProvider.ts +4 -2
  30. package/front_end/models/workspace/UISourceCode.ts +3 -2
  31. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +25 -25
  32. package/front_end/panels/animation/AnimationModel.ts +157 -156
  33. package/front_end/panels/animation/AnimationScreenshotPopover.ts +26 -26
  34. package/front_end/panels/animation/AnimationTimeline.ts +274 -260
  35. package/front_end/panels/animation/AnimationUI.ts +155 -145
  36. package/front_end/panels/application/BackForwardCacheStrings.ts +621 -0
  37. package/front_end/panels/application/BackForwardCacheView.ts +24 -8
  38. package/front_end/panels/application/ReportingApiReportsView.ts +3 -2
  39. package/front_end/panels/application/ReportingApiView.ts +1 -2
  40. package/front_end/panels/application/backForwardCacheView.css +10 -0
  41. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +48 -40
  42. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +37 -37
  43. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +23 -19
  44. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +56 -56
  45. package/front_end/panels/changes/ChangesView.ts +42 -225
  46. package/front_end/panels/changes/changes-legacy.ts +0 -2
  47. package/front_end/panels/changes/changes.ts +0 -6
  48. package/front_end/panels/changes/changesView.css +2 -69
  49. package/front_end/panels/changes/module.json +1 -1
  50. package/front_end/panels/console/ConsolePinPane.ts +80 -75
  51. package/front_end/panels/console/ConsoleView.ts +1 -9
  52. package/front_end/panels/console/consolePinPane.css +4 -1
  53. package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
  54. package/front_end/panels/security/mainView.css +2 -1
  55. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -1
  56. package/front_end/panels/sources/NavigatorView.ts +5 -2
  57. package/front_end/panels/sources/SourcesPanel.ts +28 -1
  58. package/front_end/panels/sources/sources-meta.ts +1 -4
  59. package/front_end/third_party/codemirror.next/bundle.ts +6 -4
  60. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  61. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  62. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +30 -1
  63. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  64. package/front_end/third_party/codemirror.next/package.json +4 -3
  65. package/front_end/ui/components/buttons/Button.ts +22 -6
  66. package/front_end/ui/components/buttons/button.css +50 -4
  67. package/front_end/ui/components/diff_view/DiffView.ts +288 -0
  68. package/front_end/ui/components/diff_view/diffView.css +73 -0
  69. package/front_end/ui/components/diff_view/diff_view.ts +5 -0
  70. package/front_end/ui/components/docs/button/basic.html +28 -0
  71. package/front_end/ui/components/docs/button/basic.ts +43 -2
  72. package/front_end/ui/components/report_view/report.css +1 -0
  73. package/front_end/ui/components/text_editor/config.ts +34 -1
  74. package/front_end/ui/legacy/ForwardedInputEventHandler.ts +5 -3
  75. package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -4
  76. package/front_end/ui/legacy/themeColors.css +4 -0
  77. package/package.json +1 -1
  78. package/scripts/build/generate_css_js_files.js +1 -0
  79. package/scripts/migration/class-fields/migrate.js +1 -3
  80. package/front_end/panels/changes/ChangesHighlighter.ts +0 -179
  81. package/front_end/panels/changes/ChangesTextEditor.ts +0 -96
@@ -9,44 +9,44 @@ import * as Protocol from '../../generated/protocol.js';
9
9
  export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
10
10
  readonly runtimeModel: SDK.RuntimeModel.RuntimeModel;
11
11
  readonly agent: ProtocolProxyApi.AnimationApi;
12
- private animationsById: Map<string, AnimationImpl>;
12
+ #animationsById: Map<string, AnimationImpl>;
13
13
  readonly animationGroups: Map<string, AnimationGroup>;
14
- private pendingAnimations: Set<string>;
14
+ #pendingAnimations: Set<string>;
15
15
  playbackRate: number;
16
- private readonly screenshotCapture?: ScreenshotCapture;
17
- private enabled?: boolean;
16
+ readonly #screenshotCapture?: ScreenshotCapture;
17
+ #enabled?: boolean;
18
18
 
19
19
  constructor(target: SDK.Target.Target) {
20
20
  super(target);
21
21
  this.runtimeModel = (target.model(SDK.RuntimeModel.RuntimeModel) as SDK.RuntimeModel.RuntimeModel);
22
22
  this.agent = target.animationAgent();
23
23
  target.registerAnimationDispatcher(new AnimationDispatcher(this));
24
- this.animationsById = new Map();
24
+ this.#animationsById = new Map();
25
25
  this.animationGroups = new Map();
26
- this.pendingAnimations = new Set();
26
+ this.#pendingAnimations = new Set();
27
27
  this.playbackRate = 1;
28
28
  const resourceTreeModel =
29
29
  (target.model(SDK.ResourceTreeModel.ResourceTreeModel) as SDK.ResourceTreeModel.ResourceTreeModel);
30
30
  resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.MainFrameNavigated, this.reset, this);
31
31
  const screenCaptureModel = target.model(SDK.ScreenCaptureModel.ScreenCaptureModel);
32
32
  if (screenCaptureModel) {
33
- this.screenshotCapture = new ScreenshotCapture(this, screenCaptureModel);
33
+ this.#screenshotCapture = new ScreenshotCapture(this, screenCaptureModel);
34
34
  }
35
35
  }
36
36
 
37
37
  private reset(): void {
38
- this.animationsById.clear();
38
+ this.#animationsById.clear();
39
39
  this.animationGroups.clear();
40
- this.pendingAnimations.clear();
40
+ this.#pendingAnimations.clear();
41
41
  this.dispatchEventToListeners(Events.ModelReset);
42
42
  }
43
43
 
44
44
  animationCreated(id: string): void {
45
- this.pendingAnimations.add(id);
45
+ this.#pendingAnimations.add(id);
46
46
  }
47
47
 
48
48
  animationCanceled(id: string): void {
49
- this.pendingAnimations.delete(id);
49
+ this.#pendingAnimations.delete(id);
50
50
  this.flushPendingAnimationsIfNeeded();
51
51
  }
52
52
 
@@ -64,23 +64,23 @@ export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
64
64
  // Ignore Web Animations custom effects & groups.
65
65
  const keyframesRule = animation.source().keyframesRule();
66
66
  if (animation.type() === 'WebAnimation' && keyframesRule && keyframesRule.keyframes().length === 0) {
67
- this.pendingAnimations.delete(animation.id());
67
+ this.#pendingAnimations.delete(animation.id());
68
68
  } else {
69
- this.animationsById.set(animation.id(), animation);
70
- this.pendingAnimations.add(animation.id());
69
+ this.#animationsById.set(animation.id(), animation);
70
+ this.#pendingAnimations.add(animation.id());
71
71
  }
72
72
 
73
73
  this.flushPendingAnimationsIfNeeded();
74
74
  }
75
75
 
76
76
  private flushPendingAnimationsIfNeeded(): void {
77
- for (const id of this.pendingAnimations) {
78
- if (!this.animationsById.get(id)) {
77
+ for (const id of this.#pendingAnimations) {
78
+ if (!this.#animationsById.get(id)) {
79
79
  return;
80
80
  }
81
81
  }
82
82
 
83
- while (this.pendingAnimations.size) {
83
+ while (this.#pendingAnimations.size) {
84
84
  this.matchExistingGroups(this.createGroupFromPendingAnimations());
85
85
  }
86
86
  }
@@ -97,8 +97,8 @@ export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
97
97
 
98
98
  if (!matchedGroup) {
99
99
  this.animationGroups.set(incomingGroup.id(), incomingGroup);
100
- if (this.screenshotCapture) {
101
- this.screenshotCapture.captureScreenshots(incomingGroup.finiteDuration(), incomingGroup.screenshotsInternal);
100
+ if (this.#screenshotCapture) {
101
+ this.#screenshotCapture.captureScreenshots(incomingGroup.finiteDuration(), incomingGroup.screenshotsInternal);
102
102
  }
103
103
  }
104
104
  this.dispatchEventToListeners(Events.AnimationGroupStarted, matchedGroup || incomingGroup);
@@ -106,11 +106,11 @@ export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
106
106
  }
107
107
 
108
108
  private createGroupFromPendingAnimations(): AnimationGroup {
109
- console.assert(this.pendingAnimations.size > 0);
110
- const firstAnimationId = this.pendingAnimations.values().next().value;
111
- this.pendingAnimations.delete(firstAnimationId);
109
+ console.assert(this.#pendingAnimations.size > 0);
110
+ const firstAnimationId = this.#pendingAnimations.values().next().value;
111
+ this.#pendingAnimations.delete(firstAnimationId);
112
112
 
113
- const firstAnimation = this.animationsById.get(firstAnimationId);
113
+ const firstAnimation = this.#animationsById.get(firstAnimationId);
114
114
  if (!firstAnimation) {
115
115
  throw new Error('Unable to locate first animation');
116
116
  }
@@ -118,15 +118,15 @@ export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
118
118
  const groupedAnimations = [firstAnimation];
119
119
  const groupStartTime = firstAnimation.startTime();
120
120
  const remainingAnimations = new Set<string>();
121
- for (const id of this.pendingAnimations) {
122
- const anim = (this.animationsById.get(id) as AnimationImpl);
121
+ for (const id of this.#pendingAnimations) {
122
+ const anim = (this.#animationsById.get(id) as AnimationImpl);
123
123
  if (anim.startTime() === groupStartTime) {
124
124
  groupedAnimations.push(anim);
125
125
  } else {
126
126
  remainingAnimations.add(id);
127
127
  }
128
128
  }
129
- this.pendingAnimations = remainingAnimations;
129
+ this.#pendingAnimations = remainingAnimations;
130
130
  return new AnimationGroup(this, firstAnimationId, groupedAnimations);
131
131
  }
132
132
 
@@ -145,18 +145,18 @@ export class AnimationModel extends SDK.SDKModel.SDKModel<EventTypes> {
145
145
  }
146
146
 
147
147
  async resumeModel(): Promise<void> {
148
- if (!this.enabled) {
148
+ if (!this.#enabled) {
149
149
  return;
150
150
  }
151
151
  await this.agent.invoke_enable();
152
152
  }
153
153
 
154
154
  async ensureEnabled(): Promise<void> {
155
- if (this.enabled) {
155
+ if (this.#enabled) {
156
156
  return;
157
157
  }
158
158
  await this.agent.invoke_enable();
159
- this.enabled = true;
159
+ this.#enabled = true;
160
160
  }
161
161
  }
162
162
 
@@ -173,15 +173,15 @@ export type EventTypes = {
173
173
  };
174
174
 
175
175
  export class AnimationImpl {
176
- private readonly animationModel: AnimationModel;
177
- private readonly payloadInternal: Protocol.Animation.Animation;
178
- private sourceInternal: AnimationEffect;
179
- private playStateInternal?: string;
176
+ readonly #animationModel: AnimationModel;
177
+ readonly #payloadInternal: Protocol.Animation.Animation;
178
+ #sourceInternal: AnimationEffect;
179
+ #playStateInternal?: string;
180
180
  constructor(animationModel: AnimationModel, payload: Protocol.Animation.Animation) {
181
- this.animationModel = animationModel;
182
- this.payloadInternal = payload;
183
- this.sourceInternal =
184
- new AnimationEffect(animationModel, (this.payloadInternal.source as Protocol.Animation.AnimationEffect));
181
+ this.#animationModel = animationModel;
182
+ this.#payloadInternal = payload;
183
+ this.#sourceInternal =
184
+ new AnimationEffect(animationModel, (this.#payloadInternal.source as Protocol.Animation.AnimationEffect));
185
185
  }
186
186
 
187
187
  static parsePayload(animationModel: AnimationModel, payload: Protocol.Animation.Animation): AnimationImpl {
@@ -189,35 +189,35 @@ export class AnimationImpl {
189
189
  }
190
190
 
191
191
  payload(): Protocol.Animation.Animation {
192
- return this.payloadInternal;
192
+ return this.#payloadInternal;
193
193
  }
194
194
 
195
195
  id(): string {
196
- return this.payloadInternal.id;
196
+ return this.#payloadInternal.id;
197
197
  }
198
198
 
199
199
  name(): string {
200
- return this.payloadInternal.name;
200
+ return this.#payloadInternal.name;
201
201
  }
202
202
 
203
203
  paused(): boolean {
204
- return this.payloadInternal.pausedState;
204
+ return this.#payloadInternal.pausedState;
205
205
  }
206
206
 
207
207
  playState(): string {
208
- return this.playStateInternal || this.payloadInternal.playState;
208
+ return this.#playStateInternal || this.#payloadInternal.playState;
209
209
  }
210
210
 
211
211
  setPlayState(playState: string): void {
212
- this.playStateInternal = playState;
212
+ this.#playStateInternal = playState;
213
213
  }
214
214
 
215
215
  playbackRate(): number {
216
- return this.payloadInternal.playbackRate;
216
+ return this.#payloadInternal.playbackRate;
217
217
  }
218
218
 
219
219
  startTime(): number {
220
- return this.payloadInternal.startTime;
220
+ return this.#payloadInternal.startTime;
221
221
  }
222
222
 
223
223
  endTime(): number {
@@ -234,15 +234,15 @@ export class AnimationImpl {
234
234
  }
235
235
 
236
236
  currentTime(): number {
237
- return this.payloadInternal.currentTime;
237
+ return this.#payloadInternal.currentTime;
238
238
  }
239
239
 
240
240
  source(): AnimationEffect {
241
- return this.sourceInternal;
241
+ return this.#sourceInternal;
242
242
  }
243
243
 
244
244
  type(): Protocol.Animation.AnimationType {
245
- return this.payloadInternal.type;
245
+ return this.#payloadInternal.type;
246
246
  }
247
247
 
248
248
  overlaps(animation: AnimationImpl): boolean {
@@ -257,15 +257,15 @@ export class AnimationImpl {
257
257
  }
258
258
 
259
259
  setTiming(duration: number, delay: number): void {
260
- this.sourceInternal.node().then(node => {
260
+ this.#sourceInternal.node().then(node => {
261
261
  if (!node) {
262
262
  throw new Error('Unable to find node');
263
263
  }
264
264
  this.updateNodeStyle(duration, delay, node);
265
265
  });
266
- this.sourceInternal.durationInternal = duration;
267
- this.sourceInternal.delayInternal = delay;
268
- this.animationModel.agent.invoke_setTiming({animationId: this.id(), duration, delay});
266
+ this.#sourceInternal.durationInternal = duration;
267
+ this.#sourceInternal.delayInternal = delay;
268
+ this.#animationModel.agent.invoke_setTiming({animationId: this.id(), duration, delay});
269
269
  }
270
270
 
271
271
  private updateNodeStyle(duration: number, delay: number, node: SDK.DOMModel.DOMNode): void {
@@ -288,34 +288,34 @@ export class AnimationImpl {
288
288
  }
289
289
 
290
290
  async remoteObjectPromise(): Promise<SDK.RemoteObject.RemoteObject|null> {
291
- const payload = await this.animationModel.agent.invoke_resolveAnimation({animationId: this.id()});
291
+ const payload = await this.#animationModel.agent.invoke_resolveAnimation({animationId: this.id()});
292
292
  if (!payload) {
293
293
  return null;
294
294
  }
295
295
 
296
- return this.animationModel.runtimeModel.createRemoteObject(payload.remoteObject);
296
+ return this.#animationModel.runtimeModel.createRemoteObject(payload.remoteObject);
297
297
  }
298
298
 
299
299
  cssId(): string {
300
- return this.payloadInternal.cssId || '';
300
+ return this.#payloadInternal.cssId || '';
301
301
  }
302
302
  }
303
303
 
304
304
  export class AnimationEffect {
305
- private animationModel: AnimationModel;
306
- private readonly payload: Protocol.Animation.AnimationEffect;
307
- private readonly keyframesRuleInternal: KeyframesRule|undefined;
305
+ #animationModel: AnimationModel;
306
+ readonly #payload: Protocol.Animation.AnimationEffect;
307
+ readonly #keyframesRuleInternal: KeyframesRule|undefined;
308
308
  delayInternal: number;
309
309
  durationInternal: number;
310
- private deferredNodeInternal?: SDK.DOMModel.DeferredDOMNode;
310
+ #deferredNodeInternal?: SDK.DOMModel.DeferredDOMNode;
311
311
  constructor(animationModel: AnimationModel, payload: Protocol.Animation.AnimationEffect) {
312
- this.animationModel = animationModel;
313
- this.payload = payload;
312
+ this.#animationModel = animationModel;
313
+ this.#payload = payload;
314
314
  if (payload.keyframesRule) {
315
- this.keyframesRuleInternal = new KeyframesRule(payload.keyframesRule);
315
+ this.#keyframesRuleInternal = new KeyframesRule(payload.keyframesRule);
316
316
  }
317
- this.delayInternal = this.payload.delay;
318
- this.durationInternal = this.payload.duration;
317
+ this.delayInternal = this.#payload.delay;
318
+ this.durationInternal = this.#payload.duration;
319
319
  }
320
320
 
321
321
  delay(): number {
@@ -323,11 +323,11 @@ export class AnimationEffect {
323
323
  }
324
324
 
325
325
  endDelay(): number {
326
- return this.payload.endDelay;
326
+ return this.#payload.endDelay;
327
327
  }
328
328
 
329
329
  iterationStart(): number {
330
- return this.payload.iterationStart;
330
+ return this.#payload.iterationStart;
331
331
  }
332
332
 
333
333
  iterations(): number {
@@ -335,7 +335,7 @@ export class AnimationEffect {
335
335
  if (!this.delay() && !this.endDelay() && !this.duration()) {
336
336
  return 0;
337
337
  }
338
- return this.payload.iterations || Infinity;
338
+ return this.#payload.iterations || Infinity;
339
339
  }
340
340
 
341
341
  duration(): number {
@@ -343,115 +343,116 @@ export class AnimationEffect {
343
343
  }
344
344
 
345
345
  direction(): string {
346
- return this.payload.direction;
346
+ return this.#payload.direction;
347
347
  }
348
348
 
349
349
  fill(): string {
350
- return this.payload.fill;
350
+ return this.#payload.fill;
351
351
  }
352
352
 
353
353
  node(): Promise<SDK.DOMModel.DOMNode|null> {
354
- if (!this.deferredNodeInternal) {
355
- this.deferredNodeInternal = new SDK.DOMModel.DeferredDOMNode(this.animationModel.target(), this.backendNodeId());
354
+ if (!this.#deferredNodeInternal) {
355
+ this.#deferredNodeInternal =
356
+ new SDK.DOMModel.DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
356
357
  }
357
- return this.deferredNodeInternal.resolvePromise();
358
+ return this.#deferredNodeInternal.resolvePromise();
358
359
  }
359
360
 
360
361
  deferredNode(): SDK.DOMModel.DeferredDOMNode {
361
- return new SDK.DOMModel.DeferredDOMNode(this.animationModel.target(), this.backendNodeId());
362
+ return new SDK.DOMModel.DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
362
363
  }
363
364
 
364
365
  backendNodeId(): Protocol.DOM.BackendNodeId {
365
- return this.payload.backendNodeId as Protocol.DOM.BackendNodeId;
366
+ return this.#payload.backendNodeId as Protocol.DOM.BackendNodeId;
366
367
  }
367
368
 
368
369
  keyframesRule(): KeyframesRule|null {
369
- return this.keyframesRuleInternal || null;
370
+ return this.#keyframesRuleInternal || null;
370
371
  }
371
372
 
372
373
  easing(): string {
373
- return this.payload.easing;
374
+ return this.#payload.easing;
374
375
  }
375
376
  }
376
377
 
377
378
  export class KeyframesRule {
378
- private readonly payload: Protocol.Animation.KeyframesRule;
379
- private keyframesInternal: KeyframeStyle[];
379
+ readonly #payload: Protocol.Animation.KeyframesRule;
380
+ #keyframesInternal: KeyframeStyle[];
380
381
  constructor(payload: Protocol.Animation.KeyframesRule) {
381
- this.payload = payload;
382
- this.keyframesInternal = this.payload.keyframes.map(function(keyframeStyle) {
382
+ this.#payload = payload;
383
+ this.#keyframesInternal = this.#payload.keyframes.map(function(keyframeStyle) {
383
384
  return new KeyframeStyle(keyframeStyle);
384
385
  });
385
386
  }
386
387
 
387
388
  private setKeyframesPayload(payload: Protocol.Animation.KeyframeStyle[]): void {
388
- this.keyframesInternal = payload.map(function(keyframeStyle) {
389
+ this.#keyframesInternal = payload.map(function(keyframeStyle) {
389
390
  return new KeyframeStyle(keyframeStyle);
390
391
  });
391
392
  }
392
393
 
393
394
  name(): string|undefined {
394
- return this.payload.name;
395
+ return this.#payload.name;
395
396
  }
396
397
 
397
398
  keyframes(): KeyframeStyle[] {
398
- return this.keyframesInternal;
399
+ return this.#keyframesInternal;
399
400
  }
400
401
  }
401
402
 
402
403
  export class KeyframeStyle {
403
- private readonly payload: Protocol.Animation.KeyframeStyle;
404
- private offsetInternal: string;
404
+ readonly #payload: Protocol.Animation.KeyframeStyle;
405
+ #offsetInternal: string;
405
406
  constructor(payload: Protocol.Animation.KeyframeStyle) {
406
- this.payload = payload;
407
- this.offsetInternal = this.payload.offset;
407
+ this.#payload = payload;
408
+ this.#offsetInternal = this.#payload.offset;
408
409
  }
409
410
 
410
411
  offset(): string {
411
- return this.offsetInternal;
412
+ return this.#offsetInternal;
412
413
  }
413
414
 
414
415
  setOffset(offset: number): void {
415
- this.offsetInternal = offset * 100 + '%';
416
+ this.#offsetInternal = offset * 100 + '%';
416
417
  }
417
418
 
418
419
  offsetAsNumber(): number {
419
- return parseFloat(this.offsetInternal) / 100;
420
+ return parseFloat(this.#offsetInternal) / 100;
420
421
  }
421
422
 
422
423
  easing(): string {
423
- return this.payload.easing;
424
+ return this.#payload.easing;
424
425
  }
425
426
  }
426
427
 
427
428
  export class AnimationGroup {
428
- private readonly animationModel: AnimationModel;
429
- private readonly idInternal: string;
430
- private animationsInternal: AnimationImpl[];
431
- private pausedInternal: boolean;
429
+ readonly #animationModel: AnimationModel;
430
+ readonly #idInternal: string;
431
+ #animationsInternal: AnimationImpl[];
432
+ #pausedInternal: boolean;
432
433
  screenshotsInternal: string[];
433
- private readonly screenshotImages: HTMLImageElement[];
434
+ readonly #screenshotImages: HTMLImageElement[];
434
435
  constructor(animationModel: AnimationModel, id: string, animations: AnimationImpl[]) {
435
- this.animationModel = animationModel;
436
- this.idInternal = id;
437
- this.animationsInternal = animations;
438
- this.pausedInternal = false;
436
+ this.#animationModel = animationModel;
437
+ this.#idInternal = id;
438
+ this.#animationsInternal = animations;
439
+ this.#pausedInternal = false;
439
440
  this.screenshotsInternal = [];
440
441
 
441
- this.screenshotImages = [];
442
+ this.#screenshotImages = [];
442
443
  }
443
444
 
444
445
  id(): string {
445
- return this.idInternal;
446
+ return this.#idInternal;
446
447
  }
447
448
 
448
449
  animations(): AnimationImpl[] {
449
- return this.animationsInternal;
450
+ return this.#animationsInternal;
450
451
  }
451
452
 
452
453
  release(): void {
453
- this.animationModel.animationGroups.delete(this.id());
454
- this.animationModel.releaseAnimations(this.animationIds());
454
+ this.#animationModel.animationGroups.delete(this.id());
455
+ this.#animationModel.releaseAnimations(this.animationIds());
455
456
  }
456
457
 
457
458
  private animationIds(): string[] {
@@ -459,40 +460,40 @@ export class AnimationGroup {
459
460
  return animation.id();
460
461
  }
461
462
 
462
- return this.animationsInternal.map(extractId);
463
+ return this.#animationsInternal.map(extractId);
463
464
  }
464
465
 
465
466
  startTime(): number {
466
- return this.animationsInternal[0].startTime();
467
+ return this.#animationsInternal[0].startTime();
467
468
  }
468
469
 
469
470
  finiteDuration(): number {
470
471
  let maxDuration = 0;
471
- for (let i = 0; i < this.animationsInternal.length; ++i) {
472
- maxDuration = Math.max(maxDuration, this.animationsInternal[i].finiteDuration());
472
+ for (let i = 0; i < this.#animationsInternal.length; ++i) {
473
+ maxDuration = Math.max(maxDuration, this.#animationsInternal[i].finiteDuration());
473
474
  }
474
475
  return maxDuration;
475
476
  }
476
477
 
477
478
  seekTo(currentTime: number): void {
478
- this.animationModel.agent.invoke_seekAnimations({animations: this.animationIds(), currentTime});
479
+ this.#animationModel.agent.invoke_seekAnimations({animations: this.animationIds(), currentTime});
479
480
  }
480
481
 
481
482
  paused(): boolean {
482
- return this.pausedInternal;
483
+ return this.#pausedInternal;
483
484
  }
484
485
 
485
486
  togglePause(paused: boolean): void {
486
- if (paused === this.pausedInternal) {
487
+ if (paused === this.#pausedInternal) {
487
488
  return;
488
489
  }
489
- this.pausedInternal = paused;
490
- this.animationModel.agent.invoke_setPaused({animations: this.animationIds(), paused});
490
+ this.#pausedInternal = paused;
491
+ this.#animationModel.agent.invoke_setPaused({animations: this.animationIds(), paused});
491
492
  }
492
493
 
493
494
  currentTimePromise(): Promise<number> {
494
495
  let longestAnim: AnimationImpl|null = null;
495
- for (const anim of this.animationsInternal) {
496
+ for (const anim of this.#animationsInternal) {
496
497
  if (!longestAnim || anim.endTime() > longestAnim.endTime()) {
497
498
  longestAnim = anim;
498
499
  }
@@ -501,7 +502,7 @@ export class AnimationGroup {
501
502
  throw new Error('No longest animation found');
502
503
  }
503
504
 
504
- return this.animationModel.agent.invoke_getCurrentTime({id: longestAnim.id()})
505
+ return this.#animationModel.agent.invoke_getCurrentTime({id: longestAnim.id()})
505
506
  .then(({currentTime}) => currentTime || 0);
506
507
  }
507
508
 
@@ -513,11 +514,11 @@ export class AnimationGroup {
513
514
  return anim.cssId();
514
515
  }
515
516
 
516
- if (this.animationsInternal.length !== group.animationsInternal.length) {
517
+ if (this.#animationsInternal.length !== group.#animationsInternal.length) {
517
518
  return false;
518
519
  }
519
- const left = this.animationsInternal.map(extractId).sort();
520
- const right = group.animationsInternal.map(extractId).sort();
520
+ const left = this.#animationsInternal.map(extractId).sort();
521
+ const right = group.#animationsInternal.map(extractId).sort();
521
522
  for (let i = 0; i < left.length; i++) {
522
523
  if (left[i] !== right[i]) {
523
524
  return false;
@@ -527,70 +528,70 @@ export class AnimationGroup {
527
528
  }
528
529
 
529
530
  update(group: AnimationGroup): void {
530
- this.animationModel.releaseAnimations(this.animationIds());
531
- this.animationsInternal = group.animationsInternal;
531
+ this.#animationModel.releaseAnimations(this.animationIds());
532
+ this.#animationsInternal = group.#animationsInternal;
532
533
  }
533
534
 
534
535
  screenshots(): HTMLImageElement[] {
535
536
  for (let i = 0; i < this.screenshotsInternal.length; ++i) {
536
537
  const image = new Image();
537
538
  image.src = 'data:image/jpeg;base64,' + this.screenshotsInternal[i];
538
- this.screenshotImages.push(image);
539
+ this.#screenshotImages.push(image);
539
540
  }
540
541
  this.screenshotsInternal = [];
541
- return this.screenshotImages;
542
+ return this.#screenshotImages;
542
543
  }
543
544
  }
544
545
 
545
546
  export class AnimationDispatcher implements ProtocolProxyApi.AnimationDispatcher {
546
- private readonly animationModel: AnimationModel;
547
+ readonly #animationModel: AnimationModel;
547
548
  constructor(animationModel: AnimationModel) {
548
- this.animationModel = animationModel;
549
+ this.#animationModel = animationModel;
549
550
  }
550
551
 
551
552
  animationCreated({id}: Protocol.Animation.AnimationCreatedEvent): void {
552
- this.animationModel.animationCreated(id);
553
+ this.#animationModel.animationCreated(id);
553
554
  }
554
555
 
555
556
  animationCanceled({id}: Protocol.Animation.AnimationCanceledEvent): void {
556
- this.animationModel.animationCanceled(id);
557
+ this.#animationModel.animationCanceled(id);
557
558
  }
558
559
 
559
560
  animationStarted({animation}: Protocol.Animation.AnimationStartedEvent): void {
560
- this.animationModel.animationStarted(animation);
561
+ this.#animationModel.animationStarted(animation);
561
562
  }
562
563
  }
563
564
 
564
565
  export class ScreenshotCapture {
565
- private requests: Request[];
566
- private readonly screenCaptureModel: SDK.ScreenCaptureModel.ScreenCaptureModel;
567
- private readonly animationModel: AnimationModel;
568
- private stopTimer?: number;
569
- private endTime?: number;
570
- private capturing?: boolean;
566
+ #requests: Request[];
567
+ readonly #screenCaptureModel: SDK.ScreenCaptureModel.ScreenCaptureModel;
568
+ readonly #animationModel: AnimationModel;
569
+ #stopTimer?: number;
570
+ #endTime?: number;
571
+ #capturing?: boolean;
571
572
  constructor(animationModel: AnimationModel, screenCaptureModel: SDK.ScreenCaptureModel.ScreenCaptureModel) {
572
- this.requests = [];
573
- this.screenCaptureModel = screenCaptureModel;
574
- this.animationModel = animationModel;
575
- this.animationModel.addEventListener(Events.ModelReset, this.stopScreencast, this);
573
+ this.#requests = [];
574
+ this.#screenCaptureModel = screenCaptureModel;
575
+ this.#animationModel = animationModel;
576
+ this.#animationModel.addEventListener(Events.ModelReset, this.stopScreencast, this);
576
577
  }
577
578
 
578
579
  captureScreenshots(duration: number, screenshots: string[]): void {
579
- const screencastDuration = Math.min(duration / this.animationModel.playbackRate, 3000);
580
+ const screencastDuration = Math.min(duration / this.#animationModel.playbackRate, 3000);
580
581
  const endTime = screencastDuration + window.performance.now();
581
- this.requests.push({endTime: endTime, screenshots: screenshots});
582
+ this.#requests.push({endTime: endTime, screenshots: screenshots});
582
583
 
583
- if (!this.endTime || endTime > this.endTime) {
584
- clearTimeout(this.stopTimer);
585
- this.stopTimer = window.setTimeout(this.stopScreencast.bind(this), screencastDuration);
586
- this.endTime = endTime;
584
+ if (!this.#endTime || endTime > this.#endTime) {
585
+ clearTimeout(this.#stopTimer);
586
+ this.#stopTimer = window.setTimeout(this.stopScreencast.bind(this), screencastDuration);
587
+ this.#endTime = endTime;
587
588
  }
588
589
 
589
- if (this.capturing) {
590
+ if (this.#capturing) {
590
591
  return;
591
592
  }
592
- this.capturing = true;
593
- this.screenCaptureModel.startScreencast(
593
+ this.#capturing = true;
594
+ this.#screenCaptureModel.startScreencast(
594
595
  Protocol.Page.StartScreencastRequestFormat.Jpeg, 80, undefined, 300, 2, this.screencastFrame.bind(this),
595
596
  _visible => {});
596
597
  }
@@ -600,27 +601,27 @@ export class ScreenshotCapture {
600
601
  return request.endTime >= now;
601
602
  }
602
603
 
603
- if (!this.capturing) {
604
+ if (!this.#capturing) {
604
605
  return;
605
606
  }
606
607
 
607
608
  const now = window.performance.now();
608
- this.requests = this.requests.filter(isAnimating);
609
- for (const request of this.requests) {
609
+ this.#requests = this.#requests.filter(isAnimating);
610
+ for (const request of this.#requests) {
610
611
  request.screenshots.push(base64Data);
611
612
  }
612
613
  }
613
614
 
614
615
  private stopScreencast(): void {
615
- if (!this.capturing) {
616
+ if (!this.#capturing) {
616
617
  return;
617
618
  }
618
619
 
619
- delete this.stopTimer;
620
- delete this.endTime;
621
- this.requests = [];
622
- this.capturing = false;
623
- this.screenCaptureModel.stopScreencast();
620
+ this.#stopTimer = undefined;
621
+ this.#endTime = undefined;
622
+ this.#requests = [];
623
+ this.#capturing = false;
624
+ this.#screenCaptureModel.stopScreencast();
624
625
  }
625
626
  }
626
627