@diamondlightsource/davidia 1.1.0 → 1.3.1-rc.3

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 (104) hide show
  1. package/README.md +6 -3
  2. package/dist/index.css +2 -1
  3. package/dist/index.d.ts +863 -36
  4. package/dist/index.js +3488 -3937
  5. package/package.json +12 -13
  6. package/dist/AnyPlot.d.ts +0 -17
  7. package/dist/AnyPlot.d.ts.map +0 -1
  8. package/dist/AspectConfigModal.d.ts +0 -22
  9. package/dist/AspectConfigModal.d.ts.map +0 -1
  10. package/dist/AxialSelectionConfig.d.ts +0 -22
  11. package/dist/AxialSelectionConfig.d.ts.map +0 -1
  12. package/dist/AxisConfigModal.d.ts +0 -57
  13. package/dist/AxisConfigModal.d.ts.map +0 -1
  14. package/dist/BatonConfigModal.d.ts +0 -9
  15. package/dist/BatonConfigModal.d.ts.map +0 -1
  16. package/dist/ClearSelectionsBtn.d.ts +0 -21
  17. package/dist/ClearSelectionsBtn.d.ts.map +0 -1
  18. package/dist/ConnectedPlot.d.ts +0 -23
  19. package/dist/ConnectedPlot.d.ts.map +0 -1
  20. package/dist/DomainConfig.d.ts +0 -31
  21. package/dist/DomainConfig.d.ts.map +0 -1
  22. package/dist/GlyphTypeToggle.d.ts +0 -23
  23. package/dist/GlyphTypeToggle.d.ts.map +0 -1
  24. package/dist/HeatmapPlot.d.ts +0 -35
  25. package/dist/HeatmapPlot.d.ts.map +0 -1
  26. package/dist/ImagePlot.d.ts +0 -37
  27. package/dist/ImagePlot.d.ts.map +0 -1
  28. package/dist/InteractionModeToggle.d.ts +0 -22
  29. package/dist/InteractionModeToggle.d.ts.map +0 -1
  30. package/dist/LabelledInput.d.ts +0 -35
  31. package/dist/LabelledInput.d.ts.map +0 -1
  32. package/dist/LineConfig.d.ts +0 -37
  33. package/dist/LineConfig.d.ts.map +0 -1
  34. package/dist/LineKeyDropdown.d.ts +0 -23
  35. package/dist/LineKeyDropdown.d.ts.map +0 -1
  36. package/dist/LinePlot.d.ts +0 -65
  37. package/dist/LinePlot.d.ts.map +0 -1
  38. package/dist/LinearSelectionConfig.d.ts +0 -22
  39. package/dist/LinearSelectionConfig.d.ts.map +0 -1
  40. package/dist/Modal.d.ts +0 -26
  41. package/dist/Modal.d.ts.map +0 -1
  42. package/dist/Modeless.d.ts +0 -23
  43. package/dist/Modeless.d.ts.map +0 -1
  44. package/dist/MulticlickSelectionTool.d.ts +0 -50
  45. package/dist/MulticlickSelectionTool.d.ts.map +0 -1
  46. package/dist/PlotCustomizationContext.d.ts +0 -131
  47. package/dist/PlotCustomizationContext.d.ts.map +0 -1
  48. package/dist/PlotToolbar.d.ts +0 -17
  49. package/dist/PlotToolbar.d.ts.map +0 -1
  50. package/dist/PolygonalSelectionConfig.d.ts +0 -22
  51. package/dist/PolygonalSelectionConfig.d.ts.map +0 -1
  52. package/dist/RectangularSelectionConfig.d.ts +0 -22
  53. package/dist/RectangularSelectionConfig.d.ts.map +0 -1
  54. package/dist/ScatterPlot.d.ts +0 -42
  55. package/dist/ScatterPlot.d.ts.map +0 -1
  56. package/dist/SelectionComponent.d.ts +0 -25
  57. package/dist/SelectionComponent.d.ts.map +0 -1
  58. package/dist/SelectionConfig.d.ts +0 -52
  59. package/dist/SelectionConfig.d.ts.map +0 -1
  60. package/dist/SelectionConfigComponents.d.ts +0 -69
  61. package/dist/SelectionConfigComponents.d.ts.map +0 -1
  62. package/dist/SelectionIDDropdown.d.ts +0 -23
  63. package/dist/SelectionIDDropdown.d.ts.map +0 -1
  64. package/dist/SelectionTypeDropdown.d.ts +0 -23
  65. package/dist/SelectionTypeDropdown.d.ts.map +0 -1
  66. package/dist/SurfacePlot.d.ts +0 -46
  67. package/dist/SurfacePlot.d.ts.map +0 -1
  68. package/dist/TableDisplay.d.ts +0 -37
  69. package/dist/TableDisplay.d.ts.map +0 -1
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/models.d.ts +0 -70
  72. package/dist/models.d.ts.map +0 -1
  73. package/dist/selections/AxialSelection.d.ts +0 -22
  74. package/dist/selections/AxialSelection.d.ts.map +0 -1
  75. package/dist/selections/BaseSelection.d.ts +0 -24
  76. package/dist/selections/BaseSelection.d.ts.map +0 -1
  77. package/dist/selections/CircularSectorialSelection.d.ts +0 -17
  78. package/dist/selections/CircularSectorialSelection.d.ts.map +0 -1
  79. package/dist/selections/CircularSelection.d.ts +0 -15
  80. package/dist/selections/CircularSelection.d.ts.map +0 -1
  81. package/dist/selections/EllipticalSelection.d.ts +0 -15
  82. package/dist/selections/EllipticalSelection.d.ts.map +0 -1
  83. package/dist/selections/LinearSelection.d.ts +0 -20
  84. package/dist/selections/LinearSelection.d.ts.map +0 -1
  85. package/dist/selections/OrientableSelection.d.ts +0 -14
  86. package/dist/selections/OrientableSelection.d.ts.map +0 -1
  87. package/dist/selections/PolygonalSelection.d.ts +0 -22
  88. package/dist/selections/PolygonalSelection.d.ts.map +0 -1
  89. package/dist/selections/RectangularSelection.d.ts +0 -19
  90. package/dist/selections/RectangularSelection.d.ts.map +0 -1
  91. package/dist/selections/utils.d.ts +0 -223
  92. package/dist/selections/utils.d.ts.map +0 -1
  93. package/dist/setupTests.d.ts +0 -1
  94. package/dist/setupTests.d.ts.map +0 -1
  95. package/dist/shapes/DvdAxisBox.d.ts +0 -15
  96. package/dist/shapes/DvdAxisBox.d.ts.map +0 -1
  97. package/dist/shapes/DvdDragHandle.d.ts +0 -18
  98. package/dist/shapes/DvdDragHandle.d.ts.map +0 -1
  99. package/dist/shapes/DvdPolyline.d.ts +0 -15
  100. package/dist/shapes/DvdPolyline.d.ts.map +0 -1
  101. package/dist/utils.d.ts +0 -170
  102. package/dist/utils.d.ts.map +0 -1
  103. package/dist/utils.test.d.ts +0 -2
  104. package/dist/utils.test.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,36 +1,863 @@
1
- export type { PlotConfig, BatonProps, NDT, PlotBaseProps, PlotSelectionProps, } from './models';
2
- export { default as AnyPlot } from './AnyPlot';
3
- export type { AnyPlotProps, AnyPlotVisProps } from './AnyPlot';
4
- export { default as ConnectedPlot } from './ConnectedPlot';
5
- export type { ConnectedPlotProps } from './ConnectedPlot';
6
- export { default as HeatmapPlot } from './HeatmapPlot';
7
- export type { HeatmapData, HeatmapPlotProps } from './HeatmapPlot';
8
- export { default as ImagePlot } from './ImagePlot';
9
- export type { ImageData, ImagePlotProps } from './ImagePlot';
10
- export { default as LinePlot } from './LinePlot';
11
- export type { LineData, LineParams, LinePlotProps } from './LinePlot';
12
- export { PlotCustomizationContextProvider, usePlotCustomizationContext, } from './PlotCustomizationContext';
13
- export type { AnyPlotCustomizationProps, PlotCustomizationContextValue, PlotType, } from './PlotCustomizationContext';
14
- export { default as PlotToolbar, AnyToolbar } from './PlotToolbar';
15
- export type { AnyToolbarProps } from './PlotToolbar';
16
- export { default as ScatterPlot } from './ScatterPlot';
17
- export type { ScatterPlotProps } from './ScatterPlot';
18
- export { default as SurfacePlot } from './SurfacePlot';
19
- export type { SurfaceData, SurfacePlotProps } from './SurfacePlot';
20
- export { default as TableDisplay } from './TableDisplay';
21
- export type { TableDisplayType, TableDisplayParams, TableDisplayProps, } from './TableDisplay';
22
- export { InteractionModeType } from './utils';
23
- export { default as AxialSelection } from './selections/AxialSelection';
24
- export { default as BaseSelection } from './selections/BaseSelection';
25
- export { default as CircularSectorialSelection } from './selections/CircularSectorialSelection';
26
- export { default as CircularSelection } from './selections/CircularSelection';
27
- export { default as EllipticalSelection } from './selections/EllipticalSelection';
28
- export { default as LinearSelection } from './selections/LinearSelection';
29
- export { default as OrientableSelection } from './selections/OrientableSelection';
30
- export { default as PolygonalSelection } from './selections/PolygonalSelection';
31
- export { default as RectangularSelection } from './selections/RectangularSelection';
32
- export { SelectionType, useSelections } from './selections/utils';
33
- export type { HandleChangeFunction, SelectionBase, SelectionHandler, SelectionsEventListener, SelectionsEventType, } from './selections/utils';
34
- export { GlyphType, ScaleType } from '@h5web/lib';
35
- export type { Aspect, AxisScaleType, ColorMap, ColorScaleType, Domain, } from '@h5web/lib';
36
- //# sourceMappingURL=index.d.ts.map
1
+ import { Aspect } from '@h5web/lib';
2
+ import { AxisScaleType } from '@h5web/lib';
3
+ import { ColorMap } from '@h5web/lib';
4
+ import { ColorScaleType } from '@h5web/lib';
5
+ import { CustomDomain } from '@h5web/lib';
6
+ import { Dispatch } from 'react';
7
+ import { Domain } from '@h5web/lib';
8
+ import { GlyphType } from '@h5web/lib';
9
+ import { HistogramParams } from '@h5web/lib';
10
+ import { JSX as JSX_2 } from 'react';
11
+ import { Matrix3 } from 'three';
12
+ import { MutableRefObject } from 'react';
13
+ import { NdArray } from 'ndarray';
14
+ import { PropsWithChildren } from 'react';
15
+ import { ScaleType } from '@h5web/lib';
16
+ import { SetStateAction } from 'react';
17
+ import { TypedArray } from 'ndarray';
18
+ import { Vector3 } from 'three';
19
+
20
+ /**
21
+ * A plot that accepts any plot props
22
+ * @param {AnyPlotProps} props - component props
23
+ * @returns {JSX.Element} The rendered component.
24
+ */
25
+ export declare function AnyPlot(props: AnyPlotProps): JSX_2.Element;
26
+
27
+ export declare type AnyPlotProps = AnyPlotVisProps | TableDisplayProps;
28
+
29
+ export declare type AnyPlotVisProps = LinePlotProps | ImagePlotProps | HeatmapPlotProps | ScatterPlotProps | SurfacePlotProps;
30
+
31
+ /**
32
+ * Toolbar component for any plot
33
+ */
34
+ export declare function AnyToolbar(props: PropsWithChildren<AnyToolbarProps>): false | JSX_2.Element;
35
+
36
+ export declare interface AnyToolbarProps {
37
+ /** Inner children to add to plot toolbar */
38
+ extraChildren?: React.ReactNode;
39
+ }
40
+
41
+ export { Aspect }
42
+
43
+ /** Class to select part of an axis */
44
+ export declare class AxialSelection extends BaseSelection {
45
+ readonly _defaultColour = "#882255";
46
+ /** length in dimension */
47
+ length: number;
48
+ /** dimension (x=0, y=1) */
49
+ dimension: number;
50
+ constructor(start: [number, number], length: number, dimension: number);
51
+ _getPoint(fraction?: number): Vector3;
52
+ getPoints(): Vector3[];
53
+ toString(): string;
54
+ static clicks(): number[];
55
+ static isShape(s: AxialSelection | SelectionBase): s is AxialSelection;
56
+ _setFromPoints(points: Vector3[]): void;
57
+ static createFromPoints(points: Vector3[], dimension: number): AxialSelection;
58
+ static createFromSelection(s: AxialSelection): AxialSelection;
59
+ onHandleChange(i: number, pos: [number | undefined, number | undefined]): AxialSelection;
60
+ }
61
+
62
+ export { AxisScaleType }
63
+
64
+ /** Base class for all selections */
65
+ export declare class BaseSelection implements SelectionBase {
66
+ id: string;
67
+ name: string;
68
+ _defaultColour: string;
69
+ colour?: string;
70
+ alpha: number;
71
+ fixed: boolean;
72
+ permanent: boolean;
73
+ start: [number, number];
74
+ _asDashed?: boolean;
75
+ /** Vector3 copy of start coordinate */
76
+ _vStart: Vector3;
77
+ constructor(start: [number, number]);
78
+ toString(): string;
79
+ setStart(i: number, v: number): void;
80
+ getPoints(): Vector3[];
81
+ setProperties(other: BaseSelection): void;
82
+ static createFromSelection(s: BaseSelection): BaseSelection;
83
+ onHandleChange(i: number, pos: [number | undefined, number | undefined], d?: boolean): BaseSelection;
84
+ static isShape(s: BaseSelection | SelectionBase): s is BaseSelection;
85
+ }
86
+
87
+ /**
88
+ * Context provider of baton properties
89
+ * @param props children
90
+ * @returns context provider
91
+ */
92
+ export declare function BatonContextProvider(props: PropsWithChildren): JSX_2.Element;
93
+
94
+ /**
95
+ * Value for a `Baton` context.
96
+ */
97
+ export declare interface BatonContextValue {
98
+ /** The baton properties */
99
+ batonProps: BatonProps;
100
+ /** A function that sets the baton properties */
101
+ setBatonProps?: (bp: BatonProps) => void;
102
+ }
103
+
104
+ /**
105
+ * Baton props
106
+ */
107
+ export declare interface BatonProps {
108
+ /** The universally unique identifier (uuid) of the client */
109
+ uuid: string;
110
+ /** The uuid of the current baton holder */
111
+ batonUuid: string;
112
+ /** The other uuids */
113
+ others: string[];
114
+ /** If client holds baton */
115
+ hasBaton: boolean;
116
+ /** Handles baton request */
117
+ requestBaton: () => void;
118
+ /** Handle passing baton to client with given uuid */
119
+ offerBaton: (s: string) => void;
120
+ }
121
+
122
+ /** Class to select a circular sector */
123
+ export declare class CircularSectorialSelection extends BaseSelection {
124
+ readonly _defaultColour = "#117733";
125
+ /** inner and outer radii */
126
+ radii: [number, number];
127
+ /** start and end angles (radians) */
128
+ angles: [number, number];
129
+ constructor(start: [number, number], radii: [number, number], angles: [number, number]);
130
+ static clicks(): number[];
131
+ static isShape(s: CircularSectorialSelection | SelectionBase): s is CircularSectorialSelection;
132
+ static createFromPoints(points: Vector3[]): CircularSectorialSelection;
133
+ static createFromSelection(s: CircularSectorialSelection): CircularSectorialSelection;
134
+ }
135
+
136
+ /** Class to select a circle */
137
+ export declare class CircularSelection extends BaseSelection {
138
+ readonly _defaultColour = "#332288";
139
+ /** radius of circle */
140
+ radius: number;
141
+ constructor(start: [number, number], radius: number);
142
+ static clicks(): number[];
143
+ static isShape(s: CircularSelection | SelectionBase): s is CircularSelection;
144
+ static createFromPoints(points: Vector3[]): CircularSelection;
145
+ static createFromSelection(s: CircularSelection): CircularSelection;
146
+ }
147
+
148
+ export { ColorMap }
149
+
150
+ export { ColorScaleType }
151
+
152
+ /**
153
+ * Renders a connected plot
154
+ *
155
+ * Note, wrap this in a BatonContextProvider (at the highest level to contain
156
+ * all connected plots) to support baton handling, otherwise the component
157
+ * always has the baton
158
+ * @param {ConnectedPlotProps} props - component props
159
+ * @returns {JSX.Element} The rendered component
160
+ */
161
+ export declare function ConnectedPlot({ uuid, plotId, hostname, port, baseUrl, source, events, tightAxes, customToolbarChildren, depends_on, canEditSelections, selections, selectionsListener, selectionOptions, initialSelections, }: ConnectedPlotProps): JSX_2.Element;
162
+
163
+ /**
164
+ * Props for the `ConnectedPlot` component
165
+ */
166
+ export declare interface ConnectedPlotProps {
167
+ /** The universally unique identifier */
168
+ uuid: string;
169
+ /** The plot ID */
170
+ plotId: string;
171
+ /** The hostname */
172
+ hostname?: string;
173
+ /** The port */
174
+ port?: string;
175
+ /** Optional WebSocket base URL */
176
+ baseUrl?: string;
177
+ /** Possible source configuration */
178
+ source?: SourceConfig;
179
+ /** Any event configuration */
180
+ events?: EventConfig[];
181
+ /**
182
+ * If enabled, forces the plot to shrink or expand to keep the image flush with the axes.
183
+ * Has no effect if the aspect is not equal.
184
+ */
185
+ tightAxes?: boolean;
186
+ /**
187
+ * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar,
188
+ * otherwise use given children
189
+ */
190
+ customToolbarChildren?: React.ReactNode;
191
+ /** The plot ID that this plot depends on */
192
+ depends_on?: string;
193
+ /** If true (default), can edit selections */
194
+ canEditSelections?: boolean;
195
+ /** The selections */
196
+ selections?: SelectionBase[];
197
+ /** Selections event listener */
198
+ selectionsListener?: SelectionsEventListener;
199
+ /** Selection type options and limits (0 = limitless) */
200
+ selectionOptions?: SelectionOptions;
201
+ /** Creates selections when the first plot configuration is received */
202
+ initialSelections?: (config: PlotConfig) => SelectionBase[];
203
+ }
204
+
205
+ export { Domain }
206
+
207
+ /** Class to select an ellipse */
208
+ export declare class EllipticalSelection extends OrientableSelection {
209
+ readonly _defaultColour = "#999933";
210
+ /** lengths of major and minor semi-axes */
211
+ semiAxes: [number, number];
212
+ constructor(start: [number, number], semiAxes: [number, number], angle?: number);
213
+ static clicks(): number[];
214
+ static isShape(s: EllipticalSelection | SelectionBase): s is EllipticalSelection;
215
+ static createFromPoints(points: Vector3[]): EllipticalSelection;
216
+ static createFromSelection(s: EllipticalSelection): EllipticalSelection;
217
+ }
218
+
219
+ export declare interface EventConfig {
220
+ plugin: string;
221
+ [propName: string]: unknown;
222
+ }
223
+
224
+ export { GlyphType }
225
+
226
+ /**
227
+ * Function called when drag handles are moved
228
+ */
229
+ export declare type HandleChangeFunction = (
230
+ /** Number of drag handle */
231
+ i: number,
232
+ /** Position of handle */
233
+ pos: [number | undefined, number | undefined],
234
+ /** If true, then is dragging */
235
+ d?: boolean) => SelectionBase;
236
+
237
+ /**
238
+ * Represent heatmap data
239
+ */
240
+ export declare interface HeatmapData extends ImageData_2 {
241
+ /** extent of scale for pixel values */
242
+ domain?: Domain;
243
+ /** heatmap scale type */
244
+ heatmapScale?: ColorScaleType;
245
+ /** colour map */
246
+ colourMap?: ColorMap;
247
+ }
248
+
249
+ /**
250
+ * A heatmap plot
251
+ * @param {HeatmapPlotProps} props - The component props
252
+ * @returns {JSX.Element} The rendered component
253
+ */
254
+ export declare function HeatmapPlot(props: HeatmapPlotProps): JSX_2.Element;
255
+
256
+ /**
257
+ * Props for `HeatmapPlot` component
258
+ */
259
+ export declare interface HeatmapPlotProps extends PlotBaseProps, HeatmapData {
260
+ }
261
+
262
+ /**
263
+ * Represent image data
264
+ */
265
+ declare interface ImageData_2 {
266
+ /** pixel values */
267
+ values: NDT;
268
+ /** aspect ratio */
269
+ aspect?: Aspect;
270
+ }
271
+ export { ImageData_2 as ImageData }
272
+
273
+ /**
274
+ * Render an image plot.
275
+ * @param {ImagePlotProps} props - The component props.
276
+ * @returns {JSX.Element} The rendered component.
277
+ */
278
+ export declare function ImagePlot(props: ImagePlotProps): JSX_2.Element;
279
+
280
+ /**
281
+ * Props for the `ImagePlot` component
282
+ */
283
+ export declare interface ImagePlotProps extends PlotBaseProps, ImageData_2 {
284
+ /**
285
+ * If enabled, forces the plot to shrink or expand to keep the image flush with the axes.
286
+ * Has no effect if the aspect is not equal.
287
+ */
288
+ tightAxes?: boolean;
289
+ }
290
+
291
+ export declare enum InteractionModeType {
292
+ panAndWheelZoom = "panAndWheelZoom",
293
+ selectToZoom = "selectToZoom",
294
+ selectRegion = "selectRegion"
295
+ }
296
+
297
+ /** Class to select a line */
298
+ export declare class LinearSelection extends OrientableSelection {
299
+ readonly _defaultColour = "#44aa99";
300
+ /** length of line */
301
+ length: number;
302
+ constructor(start?: [number, number], length?: number, angle?: number);
303
+ _getPoint(fraction?: number): Vector3;
304
+ getPoints(): Vector3[];
305
+ toString(): string;
306
+ static clicks(): number[];
307
+ static isShape(s: LinearSelection | SelectionBase): s is LinearSelection;
308
+ _setFromPoints(points: Vector3[]): void;
309
+ static createFromPoints(points: Vector3[]): LinearSelection;
310
+ static createFromSelection(s: LinearSelection): LinearSelection;
311
+ onHandleChange(i: number, pos: [number | undefined, number | undefined]): LinearSelection;
312
+ }
313
+
314
+ /**
315
+ * Represent line data
316
+ */
317
+ export declare interface LineData {
318
+ /** The object key */
319
+ key: string;
320
+ /** Line parameters */
321
+ lineParams: LineParams;
322
+ /** x coordinates */
323
+ x: NDT;
324
+ /** x data domain */
325
+ xDomain: Domain;
326
+ /** y coordinates */
327
+ y: NDT;
328
+ /** y data domain */
329
+ yDomain: Domain;
330
+ /** Line uses default generated x-axis values */
331
+ defaultIndices?: boolean;
332
+ }
333
+
334
+ /**
335
+ * Represent line parameters
336
+ */
337
+ export declare interface LineParams {
338
+ /** The line name */
339
+ name: string;
340
+ /** The line colour */
341
+ colour?: string;
342
+ /** If line is visible */
343
+ lineOn: boolean;
344
+ /** The size of the data points (optional) */
345
+ pointSize?: number;
346
+ /** The type of glyph */
347
+ glyphType?: GlyphType;
348
+ /** The line width */
349
+ width?: number;
350
+ }
351
+
352
+ /**
353
+ * Render a line plot.
354
+ * @param {LinePlotProps} props - The component props.
355
+ * @returns {JSX.Element} The rendered component.
356
+ */
357
+ export declare function LinePlot(props: LinePlotProps): JSX_2.Element;
358
+
359
+ /**
360
+ * Props for the `LinePlot` component.
361
+ */
362
+ export declare interface LinePlotProps extends PlotBaseProps {
363
+ /** The line data */
364
+ lineData: LineData[];
365
+ /** The x data domain */
366
+ xDomain?: Domain;
367
+ /** The y data domain */
368
+ yDomain?: Domain;
369
+ /** Handles updating line params */
370
+ updateLineParams?: (key: string, params: LineParams) => void;
371
+ }
372
+
373
+ /** ndarray of a typed array */
374
+ export declare type NDT = NdArray<TypedArray>;
375
+
376
+ /** Superclass for all orientable selections */
377
+ export declare class OrientableSelection extends BaseSelection {
378
+ /** angle of selection (radians) */
379
+ angle: number;
380
+ protected _transform: Matrix3;
381
+ protected _invTransform: Matrix3;
382
+ constructor(start: [number, number], angle?: number);
383
+ setAngle(angle: number): void;
384
+ static isShape(s: OrientableSelection | SelectionBase): s is OrientableSelection;
385
+ }
386
+
387
+ /**
388
+ * Props for selections, baton and configuration in a plot component
389
+ */
390
+ export declare interface PlotBaseProps extends PlotSelectionProps, PlotBatonProps {
391
+ /** The plot configuration */
392
+ plotConfig: PlotConfig;
393
+ /**
394
+ * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar,
395
+ * otherwise use given children
396
+ */
397
+ customToolbarChildren?: React.ReactNode;
398
+ }
399
+
400
+ /**
401
+ * Props for a baton in a plot component
402
+ */
403
+ export declare interface PlotBatonProps {
404
+ /** The baton props */
405
+ batonProps?: BatonProps;
406
+ }
407
+
408
+ /**
409
+ * Represent plot configuration
410
+ */
411
+ export declare interface PlotConfig {
412
+ /** The label for the x-axis */
413
+ xLabel?: string;
414
+ /** The label for the y-axis */
415
+ yLabel?: string;
416
+ /** The x-axis scale type */
417
+ xScale?: AxisScaleType;
418
+ /** The y-axis scale type */
419
+ yScale?: AxisScaleType;
420
+ /** The x-axis values */
421
+ xValues?: NDT;
422
+ /** The y-axis values */
423
+ yValues?: NDT;
424
+ /** The plot title */
425
+ title?: string;
426
+ }
427
+
428
+ export declare function PlotCustomizationContextProvider(props: PropsWithChildren): JSX_2.Element;
429
+
430
+ /**
431
+ * Value for a `PlotCustomization` context.
432
+ */
433
+ export declare interface PlotCustomizationContextValue {
434
+ /** If the grid should be shown */
435
+ showGrid: boolean;
436
+ /** Toggles the grid */
437
+ toggleShowGrid: () => void;
438
+ /** The title */
439
+ title: string;
440
+ /** A function that sets the title */
441
+ setTitle: (t: string) => void;
442
+ /** The mode */
443
+ mode: InteractionModeType;
444
+ /** An optional function that sets the mode */
445
+ setMode: (m: InteractionModeType) => void;
446
+ /** A domain value for the x-axis */
447
+ xDomain: Domain;
448
+ /** A function that sets the domain value for the x-axis */
449
+ setXDomain: (d: Domain) => void;
450
+ /** A custom domain value for the x-axis */
451
+ xCustomDomain: CustomDomain;
452
+ /** A function that sets the custom domain value for the x-axis */
453
+ setXCustomDomain: (d: CustomDomain) => void;
454
+ /** The label for the x-axis */
455
+ xLabel: string;
456
+ /** A function that sets the label for the x-axis */
457
+ setXLabel: (l: string) => void;
458
+ /** An axis scale type for the x-axis */
459
+ xScaleType: AxisScaleType;
460
+ /** An optional function that sets the axis scale type for the x-axis */
461
+ setXScaleType: (s: AxisScaleType) => void;
462
+ /** A domain value for the y-axis */
463
+ yDomain: Domain;
464
+ /** A function that sets the domain value for the y-axis */
465
+ setYDomain: (d: Domain) => void;
466
+ /** A custom domain value for the y-axis */
467
+ yCustomDomain: CustomDomain;
468
+ /** A function that sets the custom domain value for the y-axis */
469
+ setYCustomDomain: (d: CustomDomain) => void;
470
+ /** The label for the y-axis */
471
+ yLabel: string;
472
+ /** A function that sets the label for the y-axis */
473
+ setYLabel: (l: string) => void;
474
+ /** An axis scale type for the y-axis */
475
+ yScaleType: AxisScaleType;
476
+ /** A function that sets the axis scale type for the y-axis */
477
+ setYScaleType: (s: AxisScaleType) => void;
478
+ /** An aspect value */
479
+ aspect: Aspect;
480
+ /** A function that sets the aspect value */
481
+ setAspect: (a: Aspect) => void;
482
+ /** Selection upper limit (on current type) */
483
+ selectionMax: number;
484
+ /** A selection type */
485
+ selectionType: SelectionType;
486
+ /** A function that sets the selection type */
487
+ setSelectionType: (s: SelectionType) => void;
488
+ /** A domain value for the d-axis */
489
+ dDomain: Domain;
490
+ /** A function that sets the domain value for the d-axis */
491
+ setDDomain: (d: Domain) => void;
492
+ /** A custom domain value for the d-axis */
493
+ dCustomDomain: CustomDomain;
494
+ /** A function that sets the custom domain value for the d-axis */
495
+ setDCustomDomain: (d: CustomDomain) => void;
496
+ /** A color scale type for the d-axis */
497
+ dScaleType: ColorScaleType;
498
+ /** A function that sets the color scale type for the d-axis */
499
+ setDScaleType: (s: ColorScaleType) => void;
500
+ /** A color map */
501
+ colourMap: ColorMap;
502
+ /** A function that sets the color map */
503
+ setColourMap: (c: ColorMap) => void;
504
+ /** Whether to invert the color map */
505
+ invertColourMap: boolean;
506
+ /** A function that toggles the color map inversion */
507
+ toggleInvertColourMap: () => void;
508
+ /** Selection options */
509
+ selectionOptions?: SelectionOptions;
510
+ /** Selections */
511
+ selections: SelectionBase[];
512
+ /** A function that sets the selections */
513
+ setSelections: Dispatch<SetStateAction<SelectionBase[]>>;
514
+ /** A function that sets the selections listener */
515
+ setSelectionsListener: (l: SelectionsEventListener) => void;
516
+ /** A function that updates the selections */
517
+ updateSelection: SelectionHandler;
518
+ /** Map of line parameters */
519
+ allLineParams: Map<string, LineParams>;
520
+ /** Set line parameters */
521
+ setAllLineParams: (params: Map<string, LineParams>) => void;
522
+ /** A function to update parameters in a line */
523
+ updateLineParams: (key: string, params: LineParams) => void;
524
+ /** current line key */
525
+ currentLineKey: string | null;
526
+ /** A function that sets current line key */
527
+ setCurrentLineKey: (k: string) => void;
528
+ /** The size of scatter data points. */
529
+ scatterPointSize: number;
530
+ /** A function that updates the selections */
531
+ setScatterPointSize: (p: number) => void;
532
+ /** Whether to show points on surface */
533
+ showPoints: boolean;
534
+ /** A function that toggles the points */
535
+ toggleShowPoints: () => void;
536
+ /** Get heatmap histogram */
537
+ histogramGetter?: () => HistogramParams;
538
+ /** Update heatmap histogram getter */
539
+ updateHistogramGetter: (getter: () => HistogramParams) => void;
540
+ updateLineContext: (xDomain?: Domain, yDomain?: Domain, plotConfig?: PlotConfig) => void;
541
+ updateHeatmapContext: (data: HeatmapData, plotConfig: PlotConfig) => void;
542
+ updateImageContext: (data: ImageData_2, plotConfig: PlotConfig) => void;
543
+ updateScatterContext: (data: ScatterData, plotConfig: PlotConfig) => void;
544
+ updateSurfaceContext: (data: SurfaceData, plotConfig: PlotConfig) => void;
545
+ updateSelectionContext: (selectionProps: PlotSelectionProps) => void;
546
+ /** Can select */
547
+ canSelect: boolean;
548
+ /** Type of plot */
549
+ plotType: PlotType;
550
+ /** Can edit selections */
551
+ canEditSelections: boolean;
552
+ }
553
+
554
+ /**
555
+ * Props for selections in a plot component
556
+ */
557
+ export declare interface PlotSelectionProps {
558
+ /** Handles adding selection */
559
+ updateSelection?: SelectionHandler;
560
+ /** If true (default), can edit selections */
561
+ canEditSelections?: boolean;
562
+ /** The selections */
563
+ selections?: SelectionBase[];
564
+ /** Selections event listener */
565
+ selectionsListener?: SelectionsEventListener;
566
+ /** Selection type options and limits (0 = limitless) */
567
+ selectionOptions?: SelectionOptions;
568
+ }
569
+
570
+ /**
571
+ * Render a plot toolbar.
572
+ * @param {Props} props - inner children
573
+ * @returns {JSX.Element} The rendered component.
574
+ */
575
+ export declare function PlotToolbar(props: PropsWithChildren): React.JSX.Element;
576
+
577
+ /**
578
+ * Plot type available
579
+ */
580
+ export declare type PlotType = 'Line' | 'Heatmap' | 'Image' | 'Scatter' | 'Surface';
581
+
582
+ /** Class to select a polygon */
583
+ export declare class PolygonalSelection extends BaseSelection {
584
+ readonly _defaultOpenColour = "#88ccee";
585
+ readonly _defaultClosedColour = "#ffa07a";
586
+ readonly _defaultColour = "#88ccee";
587
+ /** array of point coordinates */
588
+ points: [number, number][];
589
+ /** if true, polygon is closed by joining last and first point */
590
+ closed: boolean;
591
+ constructor(points: [number, number][], closed?: boolean);
592
+ getPoints(): Vector3[];
593
+ getPoint(i: number): Vector3 | null;
594
+ static clicks(): number[];
595
+ static isShape(s: PolygonalSelection | SelectionBase): s is PolygonalSelection;
596
+ static createFromPoints(closed: boolean, points: Vector3[]): PolygonalSelection;
597
+ static createFromSelection(s: PolygonalSelection): PolygonalSelection;
598
+ onHandleChange(i: number, pos: [number | undefined, number | undefined]): PolygonalSelection;
599
+ }
600
+
601
+ /** Class to select a rectangle */
602
+ export declare class RectangularSelection extends OrientableSelection {
603
+ readonly _defaultColour = "#ddcc77";
604
+ /** lengths of major and minor sides */
605
+ lengths: [number, number];
606
+ constructor(start: [number, number], lengths: [number, number], angle?: number);
607
+ getPoints(): Vector3[];
608
+ getPoint(i: number): Vector3 | null;
609
+ toString(): string;
610
+ static clicks(): number[];
611
+ static isShape(s: RectangularSelection | SelectionBase): s is RectangularSelection;
612
+ static createFromPoints(axesFlipped: [boolean, boolean], points: Vector3[]): RectangularSelection;
613
+ static createFromSelection(s: RectangularSelection): RectangularSelection;
614
+ onHandleChange(i: number, pos: [number | undefined, number | undefined]): RectangularSelection;
615
+ }
616
+
617
+ export { ScaleType }
618
+
619
+ /**
620
+ * Represent scatter data.
621
+ */
622
+ export declare interface ScatterData {
623
+ /** The x values for the scatter plot */
624
+ x: NDT;
625
+ /** The y values for the scatter plot */
626
+ y: NDT;
627
+ /** The values at each point in the scatter plot */
628
+ pointValues: NDT;
629
+ /** The domain of the z axis */
630
+ domain?: Domain;
631
+ /** The size of the data points */
632
+ pointSize?: number;
633
+ /** The colour map (optional) */
634
+ colourMap?: ColorMap;
635
+ }
636
+
637
+ /**
638
+ * Render a scatter plot.
639
+ * @param {ScatterPlotProps} props - The component props.
640
+ * @returns {JSX.Element} The rendered component.
641
+ */
642
+ export declare function ScatterPlot(props: ScatterPlotProps): JSX_2.Element;
643
+
644
+ /**
645
+ * Props for the `ScatterPlotProps` component.
646
+ */
647
+ export declare interface ScatterPlotProps extends PlotBaseProps, ScatterData {
648
+ /** Function to update data point size */
649
+ setPointSize?: (p: number) => void;
650
+ }
651
+
652
+ /**
653
+ * Base for Selection
654
+ */
655
+ export declare interface SelectionBase {
656
+ /** identity */
657
+ readonly id: string;
658
+ /** name */
659
+ name: string;
660
+ /** default colour */
661
+ _defaultColour: string;
662
+ /** outline colour */
663
+ colour?: string;
664
+ /** opacity [0,1] */
665
+ alpha: number;
666
+ /** if true, not moveable */
667
+ fixed: boolean;
668
+ /** if true, not deletable */
669
+ permanent: boolean;
670
+ /** start (or centre) point coordinate */
671
+ start: [number, number];
672
+ /** if true, outline is dashed */
673
+ _asDashed?: boolean;
674
+ /** set start */
675
+ setStart: (i: number, v: number) => void;
676
+ /** retrieve points */
677
+ getPoints: () => Vector3[];
678
+ /** callback for drag handle movements */
679
+ onHandleChange: HandleChangeFunction;
680
+ /** string representation */
681
+ toString: () => string;
682
+ }
683
+
684
+ /**
685
+ * Selection handler
686
+ * @returns ID of changed selection
687
+ */
688
+ export declare type SelectionHandler = (selection: SelectionBase | null,
689
+ /** if true, selection is being dragged */
690
+ dragging?: boolean,
691
+ /** if true, remove selection */
692
+ clear?: boolean) => string | null;
693
+
694
+ export declare type SelectionOptions = {
695
+ [K in SelectionType]?: number;
696
+ };
697
+
698
+ /**
699
+ * Selections event listener
700
+ */
701
+ export declare type SelectionsEventListener = (type: SelectionsEventType,
702
+ /** if true, selection is being dragged */
703
+ dragging: boolean,
704
+ /** can be undefined for removing all selections */
705
+ selection?: SelectionBase) => void;
706
+
707
+ /**
708
+ * Selections event type
709
+ */
710
+ export declare enum SelectionsEventType {
711
+ created = "created",
712
+ removed = "removed",
713
+ updated = "updated"
714
+ }
715
+
716
+ /**
717
+ * Supported types of selections
718
+ */
719
+ export declare enum SelectionType {
720
+ line = "line",
721
+ rectangle = "rectangle",
722
+ polyline = "polyline",
723
+ polygon = "polygon",
724
+ circle = "circle",
725
+ ellipse = "ellipse",
726
+ sector = "sector",
727
+ horizontalAxis = "horizontalAxis",
728
+ verticalAxis = "verticalAxis",
729
+ unknown = "unknown"
730
+ }
731
+
732
+ export declare interface SourceConfig {
733
+ /** name of plugin class*/
734
+ plugin: string;
735
+ /** if true, allow new updates from source - optionally true */
736
+ activate?: boolean;
737
+ [propName: string]: unknown;
738
+ }
739
+
740
+ /**
741
+ * Represent surface data
742
+ */
743
+ export declare interface SurfaceData {
744
+ /** The height values for the surface */
745
+ heightValues: NDT;
746
+ /** The domain of the surface data */
747
+ domain?: Domain;
748
+ /** The colour scale type */
749
+ surfaceScale?: ColorScaleType;
750
+ /** The colour map (optional) */
751
+ colourMap?: ColorMap;
752
+ /** Show points if true */
753
+ showPoints?: boolean;
754
+ }
755
+
756
+ /**
757
+ * Render a surface plot.
758
+ * @param {SurfacePlotProps} props - The component props.
759
+ * @returns {JSX.Element} The rendered component.
760
+ */
761
+ export declare function SurfacePlot(props: SurfacePlotProps): JSX_2.Element;
762
+
763
+ /**
764
+ * Props for the `SurfacePlot` component.
765
+ */
766
+ export declare interface SurfacePlotProps extends SurfaceData, PlotBatonProps {
767
+ /** The plot configuration */
768
+ plotConfig: PlotConfig;
769
+ /**
770
+ * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar,
771
+ * otherwise use given children
772
+ */
773
+ customToolbarChildren?: React.ReactNode;
774
+ }
775
+
776
+ /** Represent table data */
777
+ declare interface TableData {
778
+ /** The cell values */
779
+ cellValues: NDT;
780
+ /** The cell width */
781
+ cellWidth: number;
782
+ /** The parameters for the table display (optional) */
783
+ displayParams?: TableDisplayParams;
784
+ }
785
+
786
+ /**
787
+ * Render a table display.
788
+ * @param {TableDisplayProps} props - The component props.
789
+ * @returns {JSX.Element} The rendered component.
790
+ */
791
+ export declare function TableDisplay(props: TableDisplayProps): JSX_2.Element;
792
+
793
+ /**
794
+ * Parameters for `TableDisplay`.
795
+ */
796
+ export declare interface TableDisplayParams {
797
+ /** The table display type (optional) */
798
+ displayType?: TableDisplayType;
799
+ /** The number of digits to display for each data value (optional) */
800
+ numberDigits?: number;
801
+ }
802
+
803
+ /**
804
+ * Props for the `TableDisplay` component.
805
+ */
806
+ export declare interface TableDisplayProps extends TableData, PlotBatonProps {
807
+ }
808
+
809
+ /** Number represent in table */
810
+ export declare type TableDisplayType = 'scientific' | 'standard';
811
+
812
+ /**
813
+ * @returns context for baton
814
+ */
815
+ export declare function useBatonContext(): BatonContextValue;
816
+
817
+ /**
818
+ * @returns context for customizing a plot
819
+ */
820
+ export declare function usePlotCustomizationContext(): PlotCustomizationContextValue;
821
+
822
+ /**
823
+ * Custom hook to handle selection changes
824
+ * @param initSelections initial selections
825
+ * @param listener event listener
826
+ * @returns selections, selections setter, new selection reference, updateSelection,
827
+ * canSelect, enableSelect, setSelectionsListener, editable, setEditable,
828
+ */
829
+ export declare function useSelections(initSelections?: SelectionBase[], listener?: SelectionsEventListener): {
830
+ selections: SelectionBase[];
831
+ setSelections: Dispatch<SetStateAction<SelectionBase[]>>;
832
+ isNewSelection: MutableRefObject<boolean>;
833
+ updateSelection: SelectionHandler;
834
+ canSelect: boolean;
835
+ enableSelect: Dispatch<SetStateAction<boolean>>;
836
+ setSelectionsListener: (listener: SelectionsEventListener) => void;
837
+ editable: boolean;
838
+ setEditable: Dispatch<SetStateAction<boolean>>;
839
+ };
840
+
841
+ /**
842
+ * Render a video plot.
843
+ * @param {VideoPlotProps} props - The component props.
844
+ * @returns {JSX.Element} The rendered component.
845
+ */
846
+ export declare function VideoPlot(props: VideoPlotProps): JSX_2.Element;
847
+
848
+ /**
849
+ * Props for the `VideoPlot` component.
850
+ */
851
+ export declare interface VideoPlotProps extends PlotBaseProps {
852
+ /** video source url */
853
+ sourceURL: string;
854
+ /** if true, source is an animated image (MJPEG, animated GIF, etc) */
855
+ isImage?: boolean;
856
+ }
857
+
858
+ export { }
859
+
860
+
861
+ declare namespace DomainConfig {
862
+ var displayName: string;
863
+ }