-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathtypes.ts
190 lines (160 loc) · 3.88 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import { ChartPoints, ChartStyle } from './plugins/utils/chart-render';
export const EVENT_NAMES = ['down', 'up', 'move', 'click', 'select'] as const;
export type TriangleDirections =
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right';
export interface Mark {
shortName: string;
fullName: string;
timestamp: number;
color: string;
}
export type Marks = Array<Mark>;
export interface FlameChartNode {
name: string; // node name
start: number; // node start time
duration: number; // node duration
type?: string; // node type (use it for custom colorization)
color?: string; // node color (use it for current node colorization)
pattern?: string; // node pattern type
badge?: string; // node badge color
children?: FlameChartNode[]; // node children (same structure as for node)
}
export type FlameChartNodes = FlameChartNode[];
export type WaterfallItems = WaterfallItem[];
export type WaterfallItem = {
name: string;
intervals: WaterfallInterval[] | string; // intervals or intervals name
timing: {
[key: string]: number;
};
meta?: WaterfallItemMeta[];
};
export type WaterfallItemMeta = {
name: string;
value: string;
color: string;
};
export type WaterfallInterval = {
name: string;
color: string;
pattern?: string;
type: 'block' | 'line';
timeframeChart?: boolean | string;
start: string | number; // timing name or timestamp
end: string | number; // timing name or timestamp
};
export interface WaterfallIntervals {
[intervalName: string]: WaterfallInterval[];
}
export interface Waterfall {
items: WaterfallItems;
intervals: WaterfallIntervals;
}
export type Colors = Record<string, string>;
export interface Mouse {
x: number;
y: number;
}
export type Dot = {
x: number;
y: number;
};
export interface Rect {
x: number;
y: number;
w: number;
h?: number;
}
export interface RectRenderQueue {
[pattern: string]: {
[color: string]: Rect[];
};
}
export interface Text {
text: string;
x: number;
y: number;
w: number;
textMaxWidth: number;
}
export interface Stroke {
color: string;
x: number;
y: number;
w: number;
h: number;
}
export type FlatTreeNode = {
source: FlameChartNode;
end: number;
parent: FlatTreeNode | null;
level: number;
index: number;
};
export type FlatTree = FlatTreeNode[];
export interface MetaClusterizedFlatTreeNode {
nodes: FlatTreeNode[];
}
export type MetaClusterizedFlatTree = MetaClusterizedFlatTreeNode[];
export interface ClusterizedFlatTreeNode {
start: number;
end: number;
duration: number;
type?: string;
color?: string;
pattern?: string;
badge?: string;
level: number;
nodes: FlatTreeNode[];
}
export type ClusterizedFlatTree = ClusterizedFlatTreeNode[];
export interface TooltipField {
color?: string;
text: string;
}
export const enum RegionTypes {
WATERFALL_NODE = 'waterfall-node',
CLUSTER = 'cluster',
TIMEFRAME = 'timeframe',
TIMEFRAME_AREA = 'timeframeArea',
TIMEFRAME_KNOB = 'timeframeKnob',
KNOB_RESIZE = 'knob-resize',
TOGGLE = 'toggle',
TIMESTAMP = 'timestamp',
TIMESERIES = 'timeseries',
}
export const enum CursorTypes {
TEXT = 'text',
ROW_RESIZE = 'row-resize',
POINTER = 'pointer',
EW_RESIZE = 'ew-resize',
GRABBING = 'grabbing',
}
export interface HitRegion<S = any> {
type: RegionTypes;
data: S;
x: number;
y: number;
w: number;
h: number;
cursor?: CursorTypes;
id?: number;
}
export type TimeseriesChart = {
points: ChartPoints;
group?: string;
units?: string;
name?: string;
style?: Partial<ChartStyle>;
min?: number;
max?: number;
dynamicMinMax?: boolean;
};
export type Timeseries = TimeseriesChart[];