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.
- package/config/gni/devtools_grd_files.gni +6 -2
- package/front_end/core/common/ParsedURL.ts +12 -10
- package/front_end/core/host/InspectorFrontendHostAPI.ts +8 -6
- package/front_end/core/i18n/locales/en-US.json +345 -12
- package/front_end/core/i18n/locales/en-XL.json +345 -12
- package/front_end/core/platform/DevToolsPath.ts +34 -0
- package/front_end/core/platform/platform.ts +2 -0
- package/front_end/core/protocol_client/NodeURL.ts +2 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -2
- package/front_end/core/sdk/ChildTargetManager.ts +2 -0
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -2
- package/front_end/core/sdk/DebuggerModel.ts +4 -3
- package/front_end/core/sdk/NetworkRequest.ts +3 -2
- package/front_end/core/sdk/Resource.ts +6 -5
- package/front_end/core/sdk/Script.ts +4 -2
- package/front_end/core/sdk/Target.ts +4 -0
- package/front_end/core/sdk/TracingModel.ts +8 -17
- package/front_end/entrypoint_template.html +1 -1
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +1 -1
- package/front_end/models/bindings/BreakpointManager.ts +6 -3
- package/front_end/models/bindings/ResourceMapping.ts +2 -1
- package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
- package/front_end/models/emulation/DeviceModeModel.ts +1 -1
- package/front_end/models/persistence/IsolatedFileSystem.ts +9 -7
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +8 -7
- package/front_end/models/persistence/PersistenceActions.ts +1 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +4 -3
- package/front_end/models/text_utils/ContentProvider.ts +2 -1
- package/front_end/models/text_utils/StaticContentProvider.ts +4 -2
- package/front_end/models/workspace/UISourceCode.ts +3 -2
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +25 -25
- package/front_end/panels/animation/AnimationModel.ts +157 -156
- package/front_end/panels/animation/AnimationScreenshotPopover.ts +26 -26
- package/front_end/panels/animation/AnimationTimeline.ts +274 -260
- package/front_end/panels/animation/AnimationUI.ts +155 -145
- package/front_end/panels/application/BackForwardCacheStrings.ts +621 -0
- package/front_end/panels/application/BackForwardCacheView.ts +24 -8
- package/front_end/panels/application/ReportingApiReportsView.ts +3 -2
- package/front_end/panels/application/ReportingApiView.ts +1 -2
- package/front_end/panels/application/backForwardCacheView.css +10 -0
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +48 -40
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +37 -37
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +23 -19
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +56 -56
- package/front_end/panels/changes/ChangesView.ts +42 -225
- package/front_end/panels/changes/changes-legacy.ts +0 -2
- package/front_end/panels/changes/changes.ts +0 -6
- package/front_end/panels/changes/changesView.css +2 -69
- package/front_end/panels/changes/module.json +1 -1
- package/front_end/panels/console/ConsolePinPane.ts +80 -75
- package/front_end/panels/console/ConsoleView.ts +1 -9
- package/front_end/panels/console/consolePinPane.css +4 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
- package/front_end/panels/security/mainView.css +2 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -1
- package/front_end/panels/sources/NavigatorView.ts +5 -2
- package/front_end/panels/sources/SourcesPanel.ts +28 -1
- package/front_end/panels/sources/sources-meta.ts +1 -4
- package/front_end/third_party/codemirror.next/bundle.ts +6 -4
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +30 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -3
- package/front_end/ui/components/buttons/Button.ts +22 -6
- package/front_end/ui/components/buttons/button.css +50 -4
- package/front_end/ui/components/diff_view/DiffView.ts +288 -0
- package/front_end/ui/components/diff_view/diffView.css +73 -0
- package/front_end/ui/components/diff_view/diff_view.ts +5 -0
- package/front_end/ui/components/docs/button/basic.html +28 -0
- package/front_end/ui/components/docs/button/basic.ts +43 -2
- package/front_end/ui/components/report_view/report.css +1 -0
- package/front_end/ui/components/text_editor/config.ts +34 -1
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +5 -3
- package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -4
- package/front_end/ui/legacy/themeColors.css +4 -0
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +1 -0
- package/scripts/migration/class-fields/migrate.js +1 -3
- package/front_end/panels/changes/ChangesHighlighter.ts +0 -179
- package/front_end/panels/changes/ChangesTextEditor.ts +0 -96
|
@@ -295,7 +295,7 @@ export class TracingModel {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
sortedProcesses(): Process[] {
|
|
298
|
-
return
|
|
298
|
+
return NamedObject.sort([...this.#processById.values()]);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
getProcessByName(name: string): Process|null {
|
|
@@ -712,21 +712,6 @@ class ProfileEventsGroup {
|
|
|
712
712
|
this.children.push(event);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
|
-
interface Sortable {
|
|
716
|
-
_sortIndex: number;
|
|
717
|
-
name: () => string;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
class Sorter {
|
|
721
|
-
static sort<Item>(array: Item[]): Item[] {
|
|
722
|
-
function comparator(a: Sortable, b: Sortable): number {
|
|
723
|
-
return a._sortIndex !== b._sortIndex ? a._sortIndex - b._sortIndex : a.name().localeCompare(b.name());
|
|
724
|
-
}
|
|
725
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
726
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
727
|
-
return (array as any).sort(comparator);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
715
|
|
|
731
716
|
class NamedObject {
|
|
732
717
|
model: TracingModel;
|
|
@@ -740,6 +725,12 @@ class NamedObject {
|
|
|
740
725
|
this.#sortIndex = 0;
|
|
741
726
|
}
|
|
742
727
|
|
|
728
|
+
static sort<Item extends NamedObject>(array: Item[]): Item[] {
|
|
729
|
+
return array.sort((a, b) => {
|
|
730
|
+
return a.#sortIndex !== b.#sortIndex ? a.#sortIndex - b.#sortIndex : a.name().localeCompare(b.name());
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
|
|
743
734
|
setName(name: string): void {
|
|
744
735
|
this.#nameInternal = name;
|
|
745
736
|
}
|
|
@@ -792,7 +783,7 @@ export class Process extends NamedObject {
|
|
|
792
783
|
}
|
|
793
784
|
|
|
794
785
|
sortedThreads(): Thread[] {
|
|
795
|
-
return
|
|
786
|
+
return NamedObject.sort([...this.threads.values()]);
|
|
796
787
|
}
|
|
797
788
|
}
|
|
798
789
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
|
-
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval'
|
|
17
|
+
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
|
18
18
|
<meta name="referrer" content="no-referrer">
|
|
19
19
|
<script type="module" src="./entrypoints/%ENTRYPOINT_NAME%/%ENTRYPOINT_NAME%.js"></script>
|
|
20
20
|
<body class="undocked" id="-blink-dev-tools">
|
|
@@ -15,7 +15,7 @@ export class ESTreeWalker {
|
|
|
15
15
|
beforeVisit: (arg0: Acorn.ESTree.Node) => (Object | undefined),
|
|
16
16
|
afterVisit?: ((arg0: Acorn.ESTree.Node) => void)) {
|
|
17
17
|
this.beforeVisit = beforeVisit;
|
|
18
|
-
this.afterVisit = afterVisit ||
|
|
18
|
+
this.afterVisit = afterVisit || function(): void {};
|
|
19
19
|
this.walkNulls = false;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
// TODO(crbug.com/1253323): All casts to UrlString will be removed from this file when migration to branded types is complete.
|
|
32
|
+
|
|
31
33
|
import * as Common from '../../core/common/common.js';
|
|
32
34
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
35
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
33
36
|
import type * as Protocol from '../../generated/protocol.js';
|
|
34
37
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
|
35
38
|
import * as Workspace from '../workspace/workspace.js';
|
|
@@ -627,7 +630,7 @@ export class ModelBreakpoint {
|
|
|
627
630
|
const positions = debuggerLocations.map(loc => {
|
|
628
631
|
const script = loc.script() as SDK.Script.Script;
|
|
629
632
|
return {
|
|
630
|
-
url: script.sourceURL,
|
|
633
|
+
url: script.sourceURL as Platform.DevToolsPath.UrlString,
|
|
631
634
|
scriptId: script.scriptId,
|
|
632
635
|
scriptHash: script.hash,
|
|
633
636
|
lineNumber: loc.lineNumber,
|
|
@@ -642,7 +645,7 @@ export class ModelBreakpoint {
|
|
|
642
645
|
// at least signal a warning to the developer that this #breakpoint wasn't
|
|
643
646
|
// really resolved.
|
|
644
647
|
const position = {
|
|
645
|
-
url: this.#breakpoint.url(),
|
|
648
|
+
url: this.#breakpoint.url() as Platform.DevToolsPath.UrlString,
|
|
646
649
|
scriptId: '' as Protocol.Runtime.ScriptId,
|
|
647
650
|
scriptHash: '',
|
|
648
651
|
lineNumber,
|
|
@@ -791,7 +794,7 @@ export class ModelBreakpoint {
|
|
|
791
794
|
}
|
|
792
795
|
|
|
793
796
|
interface Position {
|
|
794
|
-
url:
|
|
797
|
+
url: Platform.DevToolsPath.UrlString;
|
|
795
798
|
scriptId: Protocol.Runtime.ScriptId;
|
|
796
799
|
scriptHash: string;
|
|
797
800
|
lineNumber: number;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
6
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
7
8
|
import * as TextUtils from '../text_utils/text_utils.js';
|
|
8
9
|
import * as Workspace from '../workspace/workspace.js';
|
|
@@ -420,7 +421,7 @@ class Binding implements TextUtils.ContentProvider.ContentProvider {
|
|
|
420
421
|
return this.resources.values().next().value;
|
|
421
422
|
}
|
|
422
423
|
|
|
423
|
-
contentURL():
|
|
424
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
|
424
425
|
return this.firstResource().contentURL();
|
|
425
426
|
}
|
|
426
427
|
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import * as Common from '../../core/common/common.js';
|
|
32
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
32
33
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
33
34
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
|
34
35
|
import * as Workspace from '../workspace/workspace.js';
|
|
@@ -297,7 +298,7 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
|
|
|
297
298
|
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
contentURL():
|
|
301
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
|
301
302
|
console.assert(this.headers.size > 0);
|
|
302
303
|
return this.headers.values().next().value.originalContentProvider().contentURL();
|
|
303
304
|
}
|
|
@@ -113,7 +113,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
113
113
|
this.#appliedDeviceScaleFactorInternal = window.devicePixelRatio;
|
|
114
114
|
this.#appliedUserAgentTypeInternal = UA.Desktop;
|
|
115
115
|
this.#experimentDualScreenSupport = Root.Runtime.experiments.isEnabled('dualScreenSupport');
|
|
116
|
-
this.#webPlatformExperimentalFeaturesEnabledInternal =
|
|
116
|
+
this.#webPlatformExperimentalFeaturesEnabledInternal = 'segments' in window.visualViewport;
|
|
117
117
|
|
|
118
118
|
this.#scaleSettingInternal = Common.Settings.Settings.instance().createSetting('emulation.deviceScale', 1);
|
|
119
119
|
// We've used to allow zero before.
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
// TODO(crbug.com/1253323): All casts to UrlString will be removed from this file when migration to branded types is complete.
|
|
32
|
+
|
|
31
33
|
import * as Common from '../../core/common/common.js';
|
|
32
34
|
import * as Host from '../../core/host/host.js';
|
|
33
35
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
@@ -81,7 +83,7 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
|
81
83
|
|
|
82
84
|
constructor(
|
|
83
85
|
manager: IsolatedFileSystemManager, path: string, embedderPath: string, domFileSystem: FileSystem, type: string) {
|
|
84
|
-
super(path, type);
|
|
86
|
+
super(path as Platform.DevToolsPath.UrlString, type);
|
|
85
87
|
this.manager = manager;
|
|
86
88
|
this.embedderPathInternal = embedderPath;
|
|
87
89
|
this.domFileSystem = domFileSystem;
|
|
@@ -173,8 +175,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
|
173
175
|
this.initialGitFoldersInternal.add(parentFolder);
|
|
174
176
|
}
|
|
175
177
|
if (this.isFileExcluded(entry.fullPath + '/')) {
|
|
176
|
-
this.excludedEmbedderFolders.push(
|
|
177
|
-
|
|
178
|
+
this.excludedEmbedderFolders.push(Common.ParsedURL.ParsedURL.urlToRawPathString(
|
|
179
|
+
this.path() + entry.fullPath as Platform.DevToolsPath.UrlString, Host.Platform.isWin()));
|
|
178
180
|
continue;
|
|
179
181
|
}
|
|
180
182
|
++pendingRequests;
|
|
@@ -510,8 +512,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
|
510
512
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.searchInPath(
|
|
511
513
|
requestId, this.embedderPathInternal, query);
|
|
512
514
|
|
|
513
|
-
function innerCallback(files:
|
|
514
|
-
resolve(files.map(path => Common.ParsedURL.ParsedURL.
|
|
515
|
+
function innerCallback(files: Platform.DevToolsPath.RawPathString[]): void {
|
|
516
|
+
resolve(files.map(path => Common.ParsedURL.ParsedURL.rawPathToUrlString(path)));
|
|
515
517
|
progress.incrementWorked(1);
|
|
516
518
|
}
|
|
517
519
|
});
|
|
@@ -550,9 +552,9 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
|
550
552
|
Common.ResourceType.resourceTypes.Document;
|
|
551
553
|
}
|
|
552
554
|
|
|
553
|
-
tooltipForURL(url:
|
|
555
|
+
tooltipForURL(url: Platform.DevToolsPath.UrlString): string {
|
|
554
556
|
const path = Platform.StringUtilities.trimMiddle(
|
|
555
|
-
Common.ParsedURL.ParsedURL.
|
|
557
|
+
Common.ParsedURL.ParsedURL.urlToRawPathString(url, Host.Platform.isWin()), 150);
|
|
556
558
|
return i18nString(UIStrings.linkedToS, {PH1: path});
|
|
557
559
|
}
|
|
558
560
|
|
|
@@ -51,7 +51,7 @@ let isolatedFileSystemManagerInstance: IsolatedFileSystemManager;
|
|
|
51
51
|
|
|
52
52
|
export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
53
53
|
private readonly fileSystemsInternal: Map<string, PlatformFileSystem>;
|
|
54
|
-
private readonly callbacks: Map<number, (arg0: Array<
|
|
54
|
+
private readonly callbacks: Map<number, (arg0: Array<Platform.DevToolsPath.RawPathString>) => void>;
|
|
55
55
|
private readonly progresses: Map<number, Common.Progress.Progress>;
|
|
56
56
|
private readonly workspaceFolderExcludePatternSettingInternal: Common.Settings.RegExpSetting;
|
|
57
57
|
private fileSystemRequestResolve: ((arg0: IsolatedFileSystem|null) => void)|null;
|
|
@@ -173,7 +173,7 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
173
173
|
private innerAddFileSystem(fileSystem: Host.InspectorFrontendHostAPI.DevToolsFileSystem, dispatchEvent: boolean):
|
|
174
174
|
Promise<IsolatedFileSystem|null> {
|
|
175
175
|
const embedderPath = fileSystem.fileSystemPath;
|
|
176
|
-
const fileSystemURL = Common.ParsedURL.ParsedURL.
|
|
176
|
+
const fileSystemURL = Common.ParsedURL.ParsedURL.rawPathToUrlString(fileSystem.fileSystemPath);
|
|
177
177
|
const promise = IsolatedFileSystem.create(
|
|
178
178
|
this, fileSystemURL, embedderPath, fileSystem.type, fileSystem.fileSystemName, fileSystem.rootURL);
|
|
179
179
|
return promise.then(storeFileSystem.bind(this));
|
|
@@ -218,9 +218,9 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
private onFileSystemRemoved(event: Common.EventTarget.EventTargetEvent<
|
|
221
|
+
private onFileSystemRemoved(event: Common.EventTarget.EventTargetEvent<Platform.DevToolsPath.RawPathString>): void {
|
|
222
222
|
const embedderPath = event.data;
|
|
223
|
-
const fileSystemPath = Common.ParsedURL.ParsedURL.
|
|
223
|
+
const fileSystemPath = Common.ParsedURL.ParsedURL.rawPathToUrlString(embedderPath);
|
|
224
224
|
const isolatedFileSystem = this.fileSystemsInternal.get(fileSystemPath);
|
|
225
225
|
if (!isolatedFileSystem) {
|
|
226
226
|
return;
|
|
@@ -241,10 +241,11 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
241
241
|
this.dispatchEventToListeners(Events.FileSystemFilesChanged, urlPaths);
|
|
242
242
|
|
|
243
243
|
function groupFilePathsIntoFileSystemPaths(
|
|
244
|
-
this: IsolatedFileSystemManager,
|
|
244
|
+
this: IsolatedFileSystemManager,
|
|
245
|
+
embedderPaths: Platform.DevToolsPath.RawPathString[]): Platform.MapUtilities.Multimap<string, string> {
|
|
245
246
|
const paths = new Platform.MapUtilities.Multimap<string, string>();
|
|
246
247
|
for (const embedderPath of embedderPaths) {
|
|
247
|
-
const filePath = Common.ParsedURL.ParsedURL.
|
|
248
|
+
const filePath = Common.ParsedURL.ParsedURL.rawPathToUrlString(embedderPath);
|
|
248
249
|
for (const fileSystemPath of this.fileSystemsInternal.keys()) {
|
|
249
250
|
const fileSystem = this.fileSystemsInternal.get(fileSystemPath);
|
|
250
251
|
if (fileSystem && fileSystem.isFileExcluded(embedderPath)) {
|
|
@@ -273,7 +274,7 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
273
274
|
return this.workspaceFolderExcludePatternSettingInternal;
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
registerCallback(callback: (arg0: Array<
|
|
277
|
+
registerCallback(callback: (arg0: Array<Platform.DevToolsPath.RawPathString>) => void): number {
|
|
277
278
|
const requestId = ++lastRequestId;
|
|
278
279
|
this.callbacks.set(requestId, callback);
|
|
279
280
|
return requestId;
|
|
@@ -92,7 +92,7 @@ export class ContextMenuProvider implements UI.ContextMenu.Provider {
|
|
|
92
92
|
const binding = uiSourceCode && PersistenceImpl.instance().binding(uiSourceCode);
|
|
93
93
|
const fileURL = binding ? binding.fileSystem.contentURL() : contentProvider.contentURL();
|
|
94
94
|
if (fileURL.startsWith('file://')) {
|
|
95
|
-
const path = Common.ParsedURL.ParsedURL.
|
|
95
|
+
const path = Common.ParsedURL.ParsedURL.urlToRawPathString(fileURL, Host.Platform.isWin());
|
|
96
96
|
contextMenu.revealSection().appendItem(
|
|
97
97
|
i18nString(UIStrings.openInContainingFolder),
|
|
98
98
|
() => Host.InspectorFrontendHost.InspectorFrontendHostInstance.showItemInFolder(path));
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
6
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
8
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
|
8
9
|
|
|
@@ -15,9 +16,9 @@ const UIStrings = {
|
|
|
15
16
|
const str_ = i18n.i18n.registerUIStrings('models/persistence/PlatformFileSystem.ts', UIStrings);
|
|
16
17
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
17
18
|
export class PlatformFileSystem {
|
|
18
|
-
private readonly pathInternal:
|
|
19
|
+
private readonly pathInternal: Platform.DevToolsPath.UrlString;
|
|
19
20
|
private readonly typeInternal: string;
|
|
20
|
-
constructor(path:
|
|
21
|
+
constructor(path: Platform.DevToolsPath.UrlString, type: string) {
|
|
21
22
|
this.pathInternal = path;
|
|
22
23
|
this.typeInternal = type;
|
|
23
24
|
}
|
|
@@ -34,7 +35,7 @@ export class PlatformFileSystem {
|
|
|
34
35
|
return [];
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
path():
|
|
38
|
+
path(): Platform.DevToolsPath.UrlString {
|
|
38
39
|
return this.pathInternal;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import type * as Common from '../../core/common/common.js';
|
|
32
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
32
33
|
|
|
33
34
|
export abstract class ContentProvider {
|
|
34
|
-
abstract contentURL():
|
|
35
|
+
abstract contentURL(): Platform.DevToolsPath.UrlString;
|
|
35
36
|
abstract contentType(): Common.ResourceType.ResourceType;
|
|
36
37
|
abstract contentEncoded(): Promise<boolean>;
|
|
37
38
|
abstract requestContent(): Promise<DeferredContent>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
6
7
|
|
|
7
8
|
import type {ContentProvider, DeferredContent, SearchMatch} from './ContentProvider.js';
|
|
8
9
|
import {performSearchInContent} from './TextUtils.js';
|
|
@@ -28,8 +29,9 @@ export class StaticContentProvider implements ContentProvider {
|
|
|
28
29
|
return new StaticContentProvider(contentURL, contentType, lazyContent);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
|
|
33
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
|
34
|
+
return this.contentURLInternal as Platform.DevToolsPath.UrlString;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
contentType(): Common.ResourceType.ResourceType {
|
|
@@ -192,8 +192,9 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
192
192
|
WorkspaceImplEvents.UISourceCodeRenamed, {oldURL: oldURL, uiSourceCode: this});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
// TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
|
|
196
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
|
197
|
+
return this.url() as Platform.DevToolsPath.UrlString;
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
contentType(): Common.ResourceType.ResourceType {
|
|
@@ -7,34 +7,34 @@ import type {AnimationGroup} from './AnimationModel.js';
|
|
|
7
7
|
import {AnimationUI} from './AnimationUI.js';
|
|
8
8
|
|
|
9
9
|
export class AnimationGroupPreviewUI {
|
|
10
|
-
|
|
10
|
+
#model: AnimationGroup;
|
|
11
11
|
element: HTMLDivElement;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
readonly #removeButtonInternal: HTMLElement;
|
|
13
|
+
readonly #replayOverlayElement: HTMLElement;
|
|
14
|
+
readonly #svg: Element;
|
|
15
|
+
readonly #viewBoxHeight: number;
|
|
16
16
|
|
|
17
17
|
constructor(model: AnimationGroup) {
|
|
18
|
-
this
|
|
18
|
+
this.#model = model;
|
|
19
19
|
this.element = document.createElement('div');
|
|
20
20
|
this.element.classList.add('animation-buffer-preview');
|
|
21
21
|
this.element.createChild('div', 'animation-paused fill');
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
25
|
-
this
|
|
26
|
-
this
|
|
27
|
-
this
|
|
28
|
-
this
|
|
29
|
-
this
|
|
30
|
-
this
|
|
31
|
-
this
|
|
22
|
+
this.#removeButtonInternal = this.element.createChild('div', 'animation-remove-button');
|
|
23
|
+
this.#removeButtonInternal.textContent = '\u2715';
|
|
24
|
+
this.#replayOverlayElement = this.element.createChild('div', 'animation-buffer-preview-animation');
|
|
25
|
+
this.#svg = UI.UIUtils.createSVGChild(this.element, 'svg');
|
|
26
|
+
this.#svg.setAttribute('width', '100%');
|
|
27
|
+
this.#svg.setAttribute('preserveAspectRatio', 'none');
|
|
28
|
+
this.#svg.setAttribute('height', '100%');
|
|
29
|
+
this.#viewBoxHeight = 32;
|
|
30
|
+
this.#svg.setAttribute('viewBox', '0 0 100 ' + this.#viewBoxHeight);
|
|
31
|
+
this.#svg.setAttribute('shape-rendering', 'crispEdges');
|
|
32
32
|
this.render();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
private groupDuration(): number {
|
|
36
36
|
let duration = 0;
|
|
37
|
-
for (const anim of this
|
|
37
|
+
for (const anim of this.#model.animations()) {
|
|
38
38
|
const animDuration = anim.source().delay() + anim.source().duration();
|
|
39
39
|
if (animDuration > duration) {
|
|
40
40
|
duration = animDuration;
|
|
@@ -44,11 +44,11 @@ export class AnimationGroupPreviewUI {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
removeButton(): Element {
|
|
47
|
-
return this
|
|
47
|
+
return this.#removeButtonInternal;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
replay(): void {
|
|
51
|
-
this
|
|
51
|
+
this.#replayOverlayElement.animate(
|
|
52
52
|
[
|
|
53
53
|
{offset: 0, width: '0%', opacity: 1},
|
|
54
54
|
{offset: 0.9, width: '100%', opacity: 1},
|
|
@@ -58,19 +58,19 @@ export class AnimationGroupPreviewUI {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
private render(): void {
|
|
61
|
-
this
|
|
61
|
+
this.#svg.removeChildren();
|
|
62
62
|
const maxToShow = 10;
|
|
63
|
-
const numberOfAnimations = Math.min(this
|
|
63
|
+
const numberOfAnimations = Math.min(this.#model.animations().length, maxToShow);
|
|
64
64
|
const timeToPixelRatio = 100 / Math.max(this.groupDuration(), 750);
|
|
65
65
|
for (let i = 0; i < numberOfAnimations; i++) {
|
|
66
|
-
const effect = this
|
|
67
|
-
const line = UI.UIUtils.createSVGChild(this
|
|
66
|
+
const effect = this.#model.animations()[i].source();
|
|
67
|
+
const line = UI.UIUtils.createSVGChild(this.#svg, 'line') as SVGLineElement;
|
|
68
68
|
line.setAttribute('x1', String(effect.delay() * timeToPixelRatio));
|
|
69
69
|
line.setAttribute('x2', String((effect.delay() + effect.duration()) * timeToPixelRatio));
|
|
70
|
-
const y = String(Math.floor(this
|
|
70
|
+
const y = String(Math.floor(this.#viewBoxHeight / Math.max(6, numberOfAnimations) * i + 1));
|
|
71
71
|
line.setAttribute('y1', y);
|
|
72
72
|
line.setAttribute('y2', y);
|
|
73
|
-
line.style.stroke = AnimationUI.colorForAnimation(this
|
|
73
|
+
line.style.stroke = AnimationUI.colorForAnimation(this.#model.animations()[i]);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|