@@ -6,7 +6,9 @@ import type {
66/** DevTools payload type for trace events. */
77export type DevToolsPayload = TrackEntryPayload | MarkerPayload ;
88
9- /** Unified trace event type for Chrome DevTools trace format. */
9+ /**
10+ * Unified trace event type for Chrome DevTools trace format.
11+ */
1012export type TraceEvent = {
1113 cat : string ;
1214 ph : string ;
@@ -24,66 +26,101 @@ export type TraceEvent = {
2426 } ;
2527} ;
2628
27- // ─────────────────────────────────────────────────────────────
28- // DevTools metadata and annotations
29- // ─────────────────────────────────────────────────────────────
30-
31- /** Time window bounds in trace time units. */
29+ /**
30+ * Time window bounds (min, max) in trace time units (e.g. microseconds).
31+ * @property {number } min - Minimum timestamp in the window
32+ * @property {number } max - Maximum timestamp in the window
33+ * @property {number } range - Calculated range (max - min)
34+ */
3235export type BreadcrumbWindow = {
3336 min : number ;
3437 max : number ;
3538 range : number ;
3639} ;
3740
38- /** Custom label for a trace entry. */
41+ /**
42+ * Custom label for a specific trace entry.
43+ * @property {number | string } entryId - ID or index of the trace entry
44+ * @property {string } label - Label text for the entry
45+ * @property {string } [color] - Optional display color for the label
46+ */
3947export type EntryLabel = {
4048 entryId : number | string ;
4149 label : string ;
4250 color ?: string ;
4351} ;
4452
45- /** Link between two trace entries. */
53+ /**
54+ * Link or relation between two trace entries.
55+ * @property {number | string } fromEntryId - Source entry ID for the link
56+ * @property {number | string } toEntryId - Target entry ID for the link
57+ * @property {string } [linkType] - Optional type or description of the link
58+ */
4659export type EntryLink = {
4760 fromEntryId : number | string ;
4861 toEntryId : number | string ;
4962 linkType ?: string ;
5063} ;
5164
52- /** Time range annotated with a label. */
65+ /**
66+ * A time range annotated with a label.
67+ * @property {number } startTime - Start timestamp of the range (microseconds)
68+ * @property {number } endTime - End timestamp of the range (microseconds)
69+ * @property {string } label - Annotation label for the time range
70+ * @property {string } [color] - Optional display color for the range
71+ */
5372export type LabelledTimeRange = {
5473 startTime : number ;
5574 endTime : number ;
5675 label : string ;
5776 color ?: string ;
5877} ;
5978
60- /** Hidden or expandable entries information. */
79+ /**
80+ * Hidden or expandable entries information.
81+ * @property {unknown[] } hiddenEntries - IDs or indexes of hidden entries
82+ * @property {unknown[] } expandableEntries - IDs or indexes of expandable entries
83+ */
6184export type EntriesModifications = {
6285 hiddenEntries : unknown [ ] ;
6386 expandableEntries : unknown [ ] ;
6487} ;
6588
66- /** Initial breadcrumb information. */
89+ /**
90+ * Initial breadcrumb information for time ranges and window.
91+ * @property {BreadcrumbWindow } window - Time window bounds
92+ * @property {unknown | null } child - Child breadcrumb or null
93+ */
6794export type InitialBreadcrumb = {
6895 window : BreadcrumbWindow ;
6996 child : unknown | null ;
7097} ;
7198
72- /** Annotations (labels, links, time ranges). */
99+ /**
100+ * Annotations such as labels and links between entries.
101+ * @property {EntryLabel[] } entryLabels - Custom labels for entries
102+ * @property {LabelledTimeRange[] } labelledTimeRanges - Time ranges annotated with labels
103+ * @property {EntryLink[] } linksBetweenEntries - Links or relations between entries
104+ */
73105export type Annotations = {
74106 entryLabels : EntryLabel [ ] ;
75107 labelledTimeRanges : LabelledTimeRange [ ] ;
76108 linksBetweenEntries : EntryLink [ ] ;
77109} ;
78110
79- /** Modifications made to trace data in DevTools export. */
111+ /**
112+ * Modifications made to trace data or UI in DevTools export
113+ */
80114export type Modifications = {
81115 entriesModifications : EntriesModifications ;
82116 initialBreadcrumb : InitialBreadcrumb ;
83117 annotations : Annotations ;
84118} ;
85119
86- /** Top-level metadata for Chrome DevTools trace files. */
120+ /**
121+ * Top-level metadata for a trace file exported by Chrome DevTools.
122+ * DevTools may add new fields over time.
123+ */
87124export type TraceMetadata = {
88125 /** Usually "DevTools" for exports from the Performance panel */
89126 source : string ;
@@ -99,18 +136,25 @@ export type TraceMetadata = {
99136 networkThrottling ?: string ;
100137 enhancedTraceVersion ?: number ;
101138
102- /** DevTools may add new fields over time */
139+ /** Allow additional custom metadata properties */
103140 [ key : string ] : unknown ;
104141} ;
105142
106- /** Structured container for trace events with metadata. */
143+ /**
144+ * Structured container for trace events with metadata.
145+ * @property {TraceEvent[] } traceEvents - Array of trace events
146+ * @property {'ms' | 'ns' } [displayTimeUnit] - Time unit for display (milliseconds or nanoseconds)
147+ * @property {TraceMetadata } [metadata] - Optional metadata about the trace
148+ */
107149export type TraceEventContainer = {
108150 traceEvents : TraceEvent [ ] ;
109151 displayTimeUnit ?: 'ms' | 'ns' ;
110152 metadata ?: TraceMetadata ;
111153} ;
112154
113- /** Trace file format: array of events or structured container. */
155+ /**
156+ * Trace file format - either an array of events or a structured container.
157+ */
114158export type TraceFile = TraceEventContainer ;
115159
116160/** Options for creating a tracing started in browser event. */
0 commit comments