-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
365 lines (287 loc) · 10.3 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
import React, { RefObject, MutableRefObject, CSSProperties } from 'react'
export type widthI = number
export type heightI = number
export type countI = number
export type intervalI = number
export type filenameI = string
export type minI = number
export type maxI = number
export type activeI = boolean
export type memoryI = number
export type downloadCsvI = (filename?: filenameI) => void
export type downloadSvgI = (filename?: filenameI) => void
export type downloadSvgFullI = (filename?: filenameI) => void
export type configI = {
pointsRef: pointsRefI
countRef: countRefI
_count: countI
count: countI
_width: widthI
width: widthI
intervalRef: intervalRefI
_interval: intervalI
interval: intervalI
heightRef: heightRefI
svgRef: svgRefI
height: heightI
maxRef: maxRefI
_max: maxI
max: maxI
minRef: minRefI
_min: minI
min: minI
_active: activeI
active: activeI
activeRef: activeRefI
_memory: memoryI
memory: memoryI
memoryRef: memoryRefI
pathRef: pathRefI
widthRef: widthRefI
formatCursorX: formatCursorXI
formatCursorXRef: formatCursorXRefI
formatCursorY: formatCursorYI
formatCursorYRef: formatCursorYRefI
formatAxisX: formatAxisXI
formatAxisXRef: formatAxisXRefI
formatAxisY: formatAxisYI
formatAxisYRef: formatAxisYRefI
axisEnableX: axisEnableXI
_axisEnableX: axisEnableXI
axisEnableY: axisEnableYI
_axisEnableY: axisEnableYI
axisHeightX: axisHeightXI
_axisHeightX: axisHeightXI
axisWidthY: axisWidthYI
_axisWidthY: axisWidthYI
axisTitleX: axisTitleXI
_axisTitleX: axisTitleXI
axisTitleY: axisTitleYI
_axisTitleY: axisTitleYI
axisXSectionCount: axisSectionCountI
_axisXSectionCount: axisSectionCountI
axisYSectionCount: axisSectionCountI
_axisYSectionCount: axisSectionCountI
axisPositionX: axisPositionXI
_axisPositionX: axisPositionXI
axisPositionY: axisPositionYI
_axisPositionY: axisPositionYI
isAnimatingRef: isAnimatingRefI
_isCallback: isCallbackI
isCallback: isCallbackI
isCallbackRef: isCallbackRefI
_isGraphMoving: isGraphMovingI
_graphMovingRate: graphMovingRateI
isGraphMoving: isGraphMovingI
graphMovingRate: graphMovingRateI
isGraphMovingRef: isGraphMovingRefI
graphMovingRateRef: graphMovingRateRefI
callablesRef: callablesRefI
}
export type getConfigI = () => configI
export type graphExportRefI = {
downloadCsv: downloadCsvI
downloadSvg: downloadSvgI
downloadSvgFull: downloadSvgFullI
addPoint: callableAddPointI
getPoints: () => pointsI
render: callableRenderI
cleanup: callableCleanupI
getConfig: getConfigI
}
export type svgRefI = RefObject<SVGSVGElement>
export type pathRefI = RefObject<SVGPathElement>
export type intervalRefI = MutableRefObject<intervalI>
export type widthRefI = MutableRefObject<widthI>
export type heightRefI = MutableRefObject<heightI>
export type countRefI = MutableRefObject<countI>
export type memoryRefI = MutableRefObject<memoryI>
export type activeRefI = MutableRefObject<activeI>
export type minRefI = MutableRefObject<minI>
export type maxRefI = MutableRefObject<maxI>
export type pointsRefI = MutableRefObject<pointsI>
export type pointsI = Array<pointI>
export type pointI = {
x: number
y: number
}
export type getValueCallbackI = () => number
export type isCallbackI = boolean
export type isCallbackRefI = MutableRefObject<isCallbackI>
export type isGraphMovingI = boolean
export type isGraphMovingRefI = MutableRefObject<isGraphMovingI>
export type isGraphMovingLoopI = boolean
export type isGraphMovingLoopRefI = MutableRefObject<isGraphMovingLoopI>
export type graphMovingRateI = number
export type graphMovingRateRefI = MutableRefObject<graphMovingRateI>
export type addValueFunctionI = (y: pointI['y']) => void
export type addValueI = undefined | addValueFunctionI
export type formatCursorXI = (value: number) => string | number
export type formatCursorXRefI = MutableRefObject<formatCursorXI>
export type formatCursorYI = (value: number) => string | number
export type formatCursorYRefI = MutableRefObject<formatCursorYI>
export interface callbackingI {
callablesRef: callablesRefI
pointsRef: pointsRefI
intervalRef: intervalRefI
activeRef: activeRefI
getValueCallback: getValueCallbackI
isAnimatingRef: isAnimatingRefI
isCallbackRef: isCallbackRefI
}
export interface graphMovingI {
callablesRef: callablesRefI
isGraphMovingLoopRef: isGraphMovingLoopRefI
isGraphMovingRef: isGraphMovingRefI
graphMovingRateRef: graphMovingRateRefI
}
/* Cursor */
export type cursorCircleRefI = RefObject<SVGCircleElement>
export type cursorLineVerticalRefI = RefObject<SVGLineElement>
export type cursorLineHorizontalRefI = RefObject<SVGLineElement>
export type cursorLineVerticalTextRefI = RefObject<SVGTextElement>
export type cursorLineHorizontalTextRefI = RefObject<SVGTextElement>
export interface GraphI {
points?: pointsI
width?: widthI
height?: heightI
interval?: intervalI
count?: countI
memory?: memoryI
min?: minI
max?: maxI
style?: GraphStyleI
isCallback?: isCallbackI
getValueCallback?: getValueCallbackI
active?: boolean
formatCursorX?: formatCursorXI
formatCursorY?: formatCursorYI
axisEnableX?: axisEnableXI
axisEnableY?: axisEnableYI
axisHeightX?: axisHeightXI
axisWidthY?: axisWidthYI
axisTitleX?: axisTitleXI
axisTitleY?: axisTitleYI
axisXSectionCount?: axisSectionCountI
axisYSectionCount?: axisSectionCountI
formatAxisX?: formatAxisXI
formatAxisY?: formatAxisYI
axisPositionX?: axisPositionXI
axisPositionY?: axisPositionYI
isGraphMoving?: isGraphMovingI
graphMovingRate?: graphMovingRateI
}
/* Axis */
export type axisSectionCountI = number
export type axisHeightXI = number
export type axisWidthYI = number
export interface axisYSectionI {
key: number | string
top: number
value: string | number
}
export interface axisXSectionI {
key: number | string
left: number
value: string | number
}
export type formatAxisYI = (value: number) => number | string
export type formatAxisXI = (value: number) => number | string
export type formatAxisYRefI = MutableRefObject<formatAxisYI>
export type formatAxisXRefI = MutableRefObject<formatAxisXI>
export type axisPositionYI = 'LEFT' | 'RIGHT'
export type axisTextAnchorY = 'start' | 'end'
export type axisPositionXI = 'TOP' | 'BOTTOM'
export type axisDominantBaselineX = 'auto' | 'hanging'
export type axisTitleXI = string
export type axisEnableXI = boolean
export type axisEnableYI = boolean
export type axisTitleYI = string
export type isAnimatingI = boolean
export type isAnimatingRefI = MutableRefObject<isAnimatingI>
export type callableAddPointI = (y: pointI['y']) => void
export type callableRenderI = () => void
export type callableCleanupI = () => void
export type callablesI = {
addPoint: callableAddPointI
render: callableRenderI
cleanup: callableCleanupI
}
export type callablesRefI = MutableRefObject<callablesI>
/* Graph styling */
export interface GraphStyleI {
graphOuterContainer?: CSSProperties
graphInnerContainer?: CSSProperties
graphSvg?: CSSProperties
cursorLineHorizontal?: {
stroke?: React.SVGLineElementAttributes<SVGLineElement>['stroke']
strokeDasharray?: React.SVGLineElementAttributes<SVGLineElement>['strokeDasharray']
strokeWidth?: React.SVGLineElementAttributes<SVGLineElement>['strokeWidth']
style?: CSSProperties
}
cursorLineVertical?: {
stroke?: React.SVGLineElementAttributes<SVGLineElement>['stroke']
strokeDasharray?: React.SVGLineElementAttributes<SVGLineElement>['strokeDasharray']
strokeWidth?: React.SVGLineElementAttributes<SVGLineElement>['strokeWidth']
style?: CSSProperties
}
cursorCircle?: {
r?: React.SVGProps<SVGCircleElement>['r']
fill?: React.SVGProps<SVGCircleElement>['fill']
style?: CSSProperties
}
cursorLineHorizontalText?: {
textAnchor?: React.SVGTextElementAttributes<SVGTextElement>['textAnchor']
dominantBaseline?: React.SVGTextElementAttributes<SVGTextElement>['dominantBaseline']
dx?: React.SVGTextElementAttributes<SVGTextElement>['dx']
dy?: React.SVGTextElementAttributes<SVGTextElement>['dy']
rotate?: React.SVGTextElementAttributes<SVGTextElement>['rotate']
fontWeight?: React.SVGTextElementAttributes<SVGTextElement>['fontWeight']
style?: CSSProperties
}
cursorLineVerticalText?: {
textAnchor?: React.SVGTextElementAttributes<SVGTextElement>['textAnchor']
dominantBaseline?: React.SVGTextElementAttributes<SVGTextElement>['dominantBaseline']
dx?: React.SVGTextElementAttributes<SVGTextElement>['dx']
dy?: React.SVGTextElementAttributes<SVGTextElement>['dy']
rotate?: React.SVGTextElementAttributes<SVGTextElement>['rotate']
fontWeight?: React.SVGTextElementAttributes<SVGTextElement>['fontWeight']
style?: CSSProperties
}
graphPath?: CSSProperties | undefined
axisYContainer?: CSSProperties | undefined
axisYTitle?: CSSProperties | undefined
axisYSvg?: CSSProperties | undefined
axisYLine?: {
stroke?: React.SVGLineElementAttributes<SVGLineElement>['stroke']
strokeDasharray?: React.SVGLineElementAttributes<SVGLineElement>['strokeDasharray']
strokeWidth?: React.SVGLineElementAttributes<SVGLineElement>['strokeWidth']
style?: CSSProperties
}
axisYText?: {
dx?: React.SVGTextElementAttributes<SVGTextElement>['dx']
dy?: React.SVGTextElementAttributes<SVGTextElement>['dy']
rotate?: React.SVGTextElementAttributes<SVGTextElement>['rotate']
dominantBaseline?: React.SVGTextElementAttributes<SVGTextElement>['dominantBaseline']
fontWeight?: React.SVGTextElementAttributes<SVGTextElement>['fontWeight']
style?: CSSProperties
}
axisXOuterContainer?: CSSProperties | undefined
axisXInnerContainer?: CSSProperties | undefined
axisXTitle?: CSSProperties | undefined
axisXSvg?: CSSProperties | undefined
axisXLine?: {
stroke?: React.SVGLineElementAttributes<SVGLineElement>['stroke']
strokeDasharray?: React.SVGLineElementAttributes<SVGLineElement>['strokeDasharray']
strokeWidth?: React.SVGLineElementAttributes<SVGLineElement>['strokeWidth']
style?: CSSProperties
}
axisXText?: {
dx?: React.SVGTextElementAttributes<SVGTextElement>['dx']
dy?: React.SVGTextElementAttributes<SVGTextElement>['dy']
rotate?: React.SVGTextElementAttributes<SVGTextElement>['rotate']
textAnchor?: React.SVGTextElementAttributes<SVGTextElement>['textAnchor']
fontWeight?: React.SVGTextElementAttributes<SVGTextElement>['fontWeight']
style?: CSSProperties
}
}