@diamondlightsource/davidia 0.1.0 → 1.0.0

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 (4) hide show
  1. package/dist/index.d.ts +346 -1428
  2. package/dist/index.js +48401 -52136
  3. package/dist/style.css +1 -1
  4. package/package.json +17 -29
package/dist/index.d.ts CHANGED
@@ -1,137 +1,51 @@
1
- /// <reference types="react" />
2
-
3
1
  import { Aspect } from '@h5web/lib';
4
2
  import { AxisScaleType } from '@h5web/lib';
5
- import type { Camera } from 'three';
6
3
  import { ColorMap } from '@h5web/lib';
7
4
  import { ColorScaleType } from '@h5web/lib';
8
- import { CommonInteractionProps } from '@h5web/lib';
9
- import type { ComponentType } from 'react';
10
5
  import { CustomDomain } from '@h5web/lib';
11
6
  import { Domain } from '@h5web/lib';
12
- import type { HistogramParams } from '@h5web/lib';
7
+ import { GlyphType } from '@h5web/lib';
8
+ import { HistogramParams } from '@h5web/lib';
13
9
  import { JSX as JSX_2 } from 'react/jsx-runtime';
14
10
  import { Matrix3 } from 'three';
15
- import { ModifierKey } from '@h5web/lib';
16
- import type { NdArray } from 'ndarray';
17
- import type { ReactNode } from 'react';
11
+ import { NdArray } from 'ndarray';
12
+ import { PropsWithChildren } from 'react';
18
13
  import { ScaleType } from '@h5web/lib';
19
- import { Size } from '@h5web/lib';
20
- import type { SVGAttributes } from 'react';
21
- import { SVGProps } from 'react';
22
- import type { TypedArray } from 'ndarray';
14
+ import { TypedArray } from 'ndarray';
23
15
  import { Vector3 } from 'three';
24
- import { VisCanvasContextValue } from '@h5web/lib';
25
16
 
26
17
  /**
27
- *
28
- * Renders a labelled input for angle.
29
- * @param {AngleInputProps} props - The component props.
30
- * @returns {JSX.Element<T>} The rendered component.
18
+ * A plot that accepts any plot props
19
+ * @param {AnyPlotProps} props - component props
20
+ * @returns {JSX.Element} The rendered component.
31
21
  */
32
- export declare function AngleInput(props: AngleInputProps): JSX_2.Element;
22
+ export declare function AnyPlot(props: AnyPlotProps): JSX_2.Element;
33
23
 
34
- /**
35
- *
36
- * The props for the `AngleInput` component.
37
- * @interface AngleInputProps
38
- * @member {OrientableSelection} selection - The selection for which the angle is being configured.
39
- * @member {(s: OrientableSelection) => void} updateSelection - Function to handle updating angle of selection.
40
- * @member {boolean} [disabled] - If input component is disabled.
41
- */
42
- declare interface AngleInputProps {
43
- selection: OrientableSelection;
44
- updateSelection: (s: OrientableSelection) => void;
45
- disabled?: boolean;
24
+ export declare interface AnyPlotCustomizationProps extends LinePlotCustomizationProps, ImagePlotCustomizationProps, HeatmapPlotCustomizationProps, ScatterPlotCustomizationProps, SurfacePlotCustomizationProps {
46
25
  }
47
26
 
48
- /**
49
- *
50
- * Renders a plot.
51
- * @param {AnyPlotProps} props - The component props.
52
- * @returns {JSX.Element} The rendered component.
53
- */
54
- export declare function AnyPlot(props: AnyPlotProps): JSX_2.Element | null;
55
-
56
- export declare type AnyPlotProps = LinePlotProps | ImagePlotProps | HeatmapPlotProps | ScatterPlotProps | SurfacePlotProps | TableDisplayProps;
27
+ export declare type AnyPlotProps = AnyPlotVisProps | TableDisplayProps;
57
28
 
58
- /**
59
- * An append line data message.
60
- * @interface {object} AppendLineDataMessage
61
- * @extends {DataMessage}
62
- * @member {LineData[]} al_data - The line data to append.
63
- */
64
- export declare interface AppendLineDataMessage extends DataMessage {
65
- /** The line data to append */
66
- al_data: LineData[];
67
- }
29
+ export declare type AnyPlotVisProps = LinePlotProps | ImagePlotProps | HeatmapPlotProps | ScatterPlotProps | SurfacePlotProps;
68
30
 
69
31
  /**
70
- * Renders the configuration options for the aspect ratio.
71
- * @param {AspectConfigModalProps} props - The component props.
72
- * @returns {(JSX.Element | null)[]} {Modal} The rendered component.
32
+ * Toolbar component for any plot
73
33
  */
74
- export declare function AspectConfigModal(props: AspectConfigModalProps): (JSX.Element | null)[];
34
+ export declare function AnyToolbar(props: PropsWithChildren<AnyToolbarProps>): false | JSX_2.Element;
75
35
 
76
- /**
77
- * The props for the `AspectConfigModal` component.
78
- * @interface {object} AspectConfigModalProps
79
- * @member {string} title - The title of the modal and the label on the modal's button.
80
- * @member {IIconType} [icon] - The icon to display on the modal's button.
81
- * @member {Aspect} aspect - The current value of the aspect.
82
- * @member {(value: Aspect) => void} setAspect - The function to update aspect state.
83
- * @member {ReactNode} [children] - The children to render inside the modal.
84
- */
85
- export declare interface AspectConfigModalProps {
86
- /**
87
- * The title of the modal and the label on the modal's button */
88
- title: string;
89
- /**
90
- * The icon to display on the modal's button (optional) */
91
- icon?: IIconType;
92
- /**
93
- * The current value of the aspect */
94
- aspect: Aspect;
95
- /**
96
- * The function to update aspect state */
97
- setAspect: (value: Aspect) => void;
98
- /**
99
- * The children to render inside the modal (optional) */
100
- children?: ReactNode;
36
+ export declare interface AnyToolbarProps {
37
+ /** Inner child to add to plot toolbar */
38
+ extraChildren?: React.ReactNode;
101
39
  }
102
40
 
103
- /**
104
- * Represents axes parameters.
105
- * @interface {object} AxesParameters
106
- * @member {string} [x_label] - The label for the x-axis.
107
- * @member {string} [y_label] - The label for the y-axis.
108
- * @member {AxisScaleType} [x_scale] - The x-axis scale type.
109
- * @member {AxisScaleType} [y_scale] - The y-axis scale type.
110
- * @member {MP_NDArray} [x_values] - The x-axis values.
111
- * @member {MP_NDArray} [y_values] - The y-axis values.
112
- * @member {string} [title] - The plot title.
113
- */
114
- export declare interface AxesParameters {
115
- /** The label for the x-axis */
116
- x_label?: string;
117
- /** The label for the y-axis */
118
- y_label?: string;
119
- /** The x-axis scale type */
120
- x_scale?: AxisScaleType;
121
- /** The y-axis scale type */
122
- y_scale?: AxisScaleType;
123
- /** The x-axis values */
124
- x_values?: MP_NDArray;
125
- /** The y-axis values */
126
- y_values?: MP_NDArray;
127
- /** The plot title */
128
- title?: string;
129
- }
41
+ export { Aspect }
130
42
 
131
- /** export class to make an axis selection */
43
+ /** Class to select part of an axis */
132
44
  export declare class AxialSelection extends BaseSelection {
133
45
  readonly defaultColour = "#882255";
46
+ /** length in dimension */
134
47
  length: number;
48
+ /** dimension (x=0, y=1) */
135
49
  dimension: number;
136
50
  constructor(start: [number, number], length: number, dimension: number);
137
51
  _getPoint(fraction?: number): Vector3;
@@ -145,184 +59,54 @@ export declare class AxialSelection extends BaseSelection {
145
59
  onHandleChange(i: number, pos: [number | undefined, number | undefined]): AxialSelection;
146
60
  }
147
61
 
148
- /**
149
- * Renders the configuration options for an axial selection.
150
- * @param {AxialSelectionConfigProps} props - The component props.
151
- * @returns {JSX.Element} The rendered component.
152
- */
153
- export declare function AxialSelectionConfig(props: AxialSelectionConfigProps): JSX_2.Element;
154
-
155
- /**
156
- * The props for the `AxialSelectionConfig` component.
157
- * @interface {object} AxialSelectionConfigProps
158
- * @member {AxialSelection} selection - The axial selection to configure.
159
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} updateSelection - The function to call to update the selections state.
160
- * @member {boolean} [disabled] - Indicates whether the component is disabled.
161
- */
162
- export declare interface AxialSelectionConfigProps {
163
- /** The axial selection to configure */
164
- selection: AxialSelection;
165
- /** The function to call to update the selections state */
166
- updateSelection: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
167
- /** Indicates whether the component is disabled (optional) */
168
- disabled?: boolean;
169
- }
62
+ export { AxisScaleType }
170
63
 
171
- /**
172
- * Renders the configuration options for an axis.
173
- * @param {AxisConfigModalProps} props - The component props.
174
- * @returns {JSX.Element} The rendered component.
175
- * @template S
176
- */
177
- export declare function AxisConfigModal<S extends ScaleType>(props: AxisConfigModalProps<S>): (JSX_2.Element | null)[];
178
-
179
- /**
180
- * The props for the `AxisConfigModal` component.
181
- * @interface {object} AxisConfigModalProps
182
- * @member {string} title - The title of the modal.
183
- * @member {IIconType} [icon] - The icon to display in the modal.
184
- * @member {string} [label] - The label for the axis.
185
- * @member {(value: string) => void} [setLabel] - The function to call when the label is updated.
186
- * @member {S} [scaleType] - The type of scale to use for the axis.
187
- * @member {(value: S) => void} [setScaleType] - The function to call when the scale type is updated.
188
- * @member {EnumArray<S>} scaleOptions - The available scale options.
189
- * @member {ColorMap} [colourMap] - The color map for the axis.
190
- * @member {(value: ColorMap) => void} [setColourMap] - The function to call when the color map is updated.
191
- * @member {boolean} [invertColourMap] - A boolean value indicating whether to invert the color map.
192
- * @member {() => void} [toggleColourMapInversion] - The function to call when the color map inversion is toggled.
193
- * @member {Domain} [domain] - The domain for the axis.
194
- * @member {CustomDomain} [customDomain] - The custom domain for the axis.
195
- * @member {(value: CustomDomain) => void} [setCustomDomain] - The function to call when the custom domain is updated.
196
- * @member {TypedArray} [values] - The values for the axis.
197
- * @member {ReactNode} [children] - The children to render inside the modal.
198
- */
199
- export declare interface AxisConfigModalProps<S extends ScaleType> {
200
- /** The title of the modal */
201
- title: string;
202
- /** The icon to display in the modal (optional) */
203
- icon?: IIconType;
204
- /** The label for the axis (optional) */
205
- label?: string;
206
- /** The function to call when the label is updated (optional) */
207
- setLabel?: (value: string) => void;
208
- /** The type of scale to use for the axis (optional) */
209
- scaleType?: S;
210
- /** The function to call when the scale type is updated (optional) */
211
- setScaleType?: (value: S) => void;
212
- /** The available scale options */
213
- scaleOptions: EnumArray<S>;
214
- /** The color map for the axis (optional) */
215
- colourMap?: ColorMap;
216
- /** The function to call when the color map is updated (optional) */
217
- setColourMap?: (value: ColorMap) => void;
218
- /** A boolean value indicating whether to invert the color map (optional) */
219
- invertColourMap?: boolean;
220
- /** The function to call when the color map inversion is toggled (optional) */
221
- toggleColourMapInversion?: () => void;
222
- /** The domain for the axis (optional) */
223
- domain?: Domain;
224
- /** The custom domain for the axis (optional) */
225
- customDomain?: CustomDomain;
226
- /** The function to call when the custom domain is updated (optional) */
227
- setCustomDomain?: (value: CustomDomain) => void;
228
- /** The values for the axis (optional) */
229
- values?: TypedArray;
230
- /** The children to render inside the modal (optional) */
231
- children?: ReactNode;
232
- }
233
-
234
- /** export class for all selections */
64
+ /** Base class for all selections */
235
65
  export declare class BaseSelection implements SelectionBase {
236
66
  id: string;
237
67
  name: string;
68
+ defaultColour: string;
238
69
  colour?: string;
239
70
  alpha: number;
240
71
  fixed: boolean;
241
72
  start: [number, number];
242
73
  asDashed?: boolean;
74
+ /** Vector3 copy of start coordinate */
243
75
  vStart: Vector3;
244
76
  constructor(start: [number, number]);
245
77
  toString(): string;
78
+ setStart(i: number, v: number): void;
246
79
  getPoints(): Vector3[];
247
80
  setProperties(other: BaseSelection): void;
248
- setName(name: string): void;
249
- setFixed(fixed: boolean): void;
250
81
  static createFromSelection(s: BaseSelection): BaseSelection;
251
- onHandleChange(i: number, pos: [number | undefined, number | undefined]): BaseSelection;
82
+ onHandleChange(i: number, pos: [number | undefined, number | undefined], d?: boolean): BaseSelection;
252
83
  static isShape(s: BaseSelection | SelectionBase): s is BaseSelection;
253
84
  }
254
85
 
255
86
  /**
256
- * A baton approval request message.
257
- * @interface {object} BatonApprovalRequestMessage
258
- * @member {string} requester - The uuid of the client requesting the baton.
259
- */
260
- export declare interface BatonApprovalRequestMessage {
261
- /** The uuid of the client requesting the baton */
262
- requester: string;
263
- }
264
-
265
- /**
266
- *
267
- * Renders the configuration options for the baton.
268
- * @export
269
- * @param {BatonProps} props - The component props.
270
- * @returns {JSX.Element} The rendered component.
271
- */
272
- export declare function BatonConfigModal(props: BatonProps): (JSX_2.Element | null)[];
273
-
274
- /**
275
- * A baton message.
276
- * @interface {object} BatonMessage
277
- * @member {string} baton - The uuid of the current baton holder.
278
- * @member {string[]} uuids - The uuids of all clients.
279
- */
280
- export declare interface BatonMessage {
281
- /** The uuid of the current baton holder */
282
- baton: string;
283
- /** The uuids of all the clients */
284
- uuids: string[];
285
- }
286
-
287
- /**
288
- * Baton props.
289
- * @interface {object} BatonProps
290
- * @member {string} uuid - The universally unique identifier (uuid) of the client.
291
- * @member {string | null} uuid - The uuid of the current baton holder.
292
- * @member {string[]} others - The other uuids.
293
- * @member {boolean} hasBaton - If client holds baton.
294
- * @member {() => void} requestBaton - Handles baton request.
295
- * @member {(s: string) => void} approveBaton - Approves passing baton to client with given uuid.
87
+ * Baton props
296
88
  */
297
89
  export declare interface BatonProps {
298
90
  /** The universally unique identifier (uuid) of the client */
299
91
  uuid: string;
300
92
  /** The uuid of the current baton holder */
301
- batonUuid: string | null;
93
+ batonUuid: string;
302
94
  /** The other uuids */
303
95
  others: string[];
304
96
  /** If client holds baton */
305
97
  hasBaton: boolean;
306
98
  /** Handles baton request */
307
99
  requestBaton: () => void;
308
- /** Approves passing baton to client with given uuid */
309
- approveBaton: (s: string) => void;
100
+ /** Handle passing baton to client with given uuid */
101
+ offerBaton: (s: string) => void;
310
102
  }
311
103
 
312
- /**
313
- * A baton request message.
314
- * @interface {object} BatonRequestMessage
315
- * @member {string} uuid - The universally unique identifier.
316
- */
317
- export declare interface BatonRequestMessage {
318
- /** The universally unique identifier */
319
- uuid: string;
320
- }
321
-
322
- /** export class to select a circular sector */
104
+ /** Class to select a circular sector */
323
105
  export declare class CircularSectorialSelection extends BaseSelection {
324
106
  readonly defaultColour = "#117733";
107
+ /** inner and outer radii */
325
108
  radii: [number, number];
109
+ /** start and end angles (radians) */
326
110
  angles: [number, number];
327
111
  constructor(start: [number, number], radii: [number, number], angles: [number, number]);
328
112
  static clicks(): number[];
@@ -331,9 +115,10 @@ export declare class CircularSectorialSelection extends BaseSelection {
331
115
  static createFromSelection(s: CircularSectorialSelection): CircularSectorialSelection;
332
116
  }
333
117
 
334
- /** export class to select a circle */
118
+ /** Class to select a circle */
335
119
  export declare class CircularSelection extends BaseSelection {
336
120
  readonly defaultColour = "#332288";
121
+ /** radius of circle */
337
122
  radius: number;
338
123
  constructor(start: [number, number], radius: number);
339
124
  static clicks(): number[];
@@ -342,410 +127,110 @@ export declare class CircularSelection extends BaseSelection {
342
127
  static createFromSelection(s: CircularSelection): CircularSelection;
343
128
  }
344
129
 
345
- /**
346
- * A clear plots message.
347
- * @interface {object} ClearPlotsMessage
348
- * @member {string} plot_id - The plot ID.
349
- */
350
- export declare interface ClearPlotsMessage {
351
- /** The plot ID */
352
- plot_id: string;
353
- }
354
-
355
- /**
356
- *
357
- * Renders a button to clear selections.
358
- * @param {ClearSelectionsBtnProps} props - The component props.
359
- * @returns {JSX.Element} The rendered component.
360
- */
361
- export declare function ClearSelectionsBtn(props: ClearSelectionsBtnProps): JSX.Element;
362
-
363
- /**
364
- * The props for the `ClearSelectionsBtn` component.
365
- * @interface {object} ClearSelectionsBtnProps
366
- * @member {BaseSelection[]} selections - The current selections.
367
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} updateSelections - The function to call to update the selections state.
368
- * @member {string | null} currentSelectionID - The ID of the current selection.
369
- * @member {(s: string | null) => void} updateCurrentSelectionID - The function to call to update the current selection ID.
370
- * @member {boolean} [disabled] - Indicates whether the component is disabled.
371
- */
372
- export declare interface ClearSelectionsBtnProps {
373
- /** The current selections */
374
- selections: BaseSelection[];
375
- /** The function to call to update the selections state */
376
- updateSelections: (s: SelectionBase | null, b?: boolean, d?: boolean) => void;
377
- /** The ID of the current selection */
378
- currentSelectionID: string | null;
379
- /** The function to call to update the current selection ID */
380
- updateCurrentSelectionID: (s: string | null) => void;
381
- /** Indicates whether the component is disabled (optional) */
382
- disabled?: boolean;
383
- }
384
-
385
- /**
386
- * A clear selections message.
387
- * @interface {object} ClearSelectionsMessage
388
- * @member {string[]} selection_ids - The selection IDs.
389
- */
390
- export declare interface ClearSelectionsMessage {
391
- /** The selection IDs */
392
- selection_ids: string[];
393
- }
130
+ export { ColorMap }
394
131
 
395
- /**
396
- * A client selection message.
397
- * @interface {object} ClientSelectionMessage
398
- * @member {SelectionBase} selection - The selection.
399
- */
400
- export declare interface ClientSelectionMessage {
401
- /** The selection */
402
- selection: SelectionBase;
403
- }
132
+ export { ColorScaleType }
404
133
 
405
134
  /**
406
135
  *
407
- * Renders a connected plot.
408
- * @param {ConnectedPlotProps} props - The component props.
409
- * @returns {JSX.Element} The rendered component.
136
+ * Renders a connected plot
137
+ * @param {ConnectedPlotProps} props - component props
138
+ * @returns {JSX.Element} The rendered component
410
139
  */
411
- export declare function ConnectedPlot(props: ConnectedPlotProps): JSX_2.Element;
412
-
413
- export declare namespace ConnectedPlot {
414
- var defaultProps: ConnectedPlotProps;
415
- }
140
+ export declare function ConnectedPlot({ plotId, hostname, port, uuid, }: ConnectedPlotProps): JSX_2.Element;
416
141
 
417
142
  /**
418
- * The props for the `ConnectedPlot` component.
419
- * @interface {object} ConnectedPlotProps
420
- * @member {string} plot_id - The plot ID.
421
- * @member {string} hostname - The hostname.
422
- * @member {string} port - The port.
423
- * @member {string} uuid - The uuid.
143
+ * Props for the `ConnectedPlot` component
424
144
  */
425
145
  export declare interface ConnectedPlotProps {
426
146
  /** The plot ID */
427
- plot_id: string;
147
+ plotId: string;
428
148
  /** The hostname */
429
- hostname: string;
149
+ hostname?: string;
430
150
  /** The port */
431
- port: string;
151
+ port?: string;
432
152
  /** The universally unique identifier */
433
153
  uuid: string;
434
154
  }
435
155
 
436
- export declare function createHistogramParams(values: TypedArray | undefined, domain: Domain | undefined, colourMap: ColorMap | undefined, invertColourMap: boolean | undefined): HistogramParams | undefined;
437
-
438
- /**
439
- * A data message.
440
- * @interface {object} DataMessage
441
- * @member {AxesParameters} axes_parameters - The axes parameters.
442
- */
443
- export declare interface DataMessage {
444
- /** The axes parameters */
445
- axes_parameters: AxesParameters;
446
- }
447
-
448
- /**
449
- * Represents Axes parameters.
450
- * @interface {object} DAxesParameters
451
- * @member {string} [xLabel] - the x-axis label.
452
- * @member {string} [yLabel] - the y-axis label.
453
- * @member {AxisScaleType} [xScale] - the x-axis scale type.
454
- * @member {AxisScaleType} [yScale] - the y-axis scale type.
455
- * @member {NdArray<TypedArray>} [xValues] - the x-axis values.
456
- * @member {NdArray<TypedArray>} [yValues] - the y-axis values.
457
- * @member {string} [title] - the plot title.
458
- */
459
- export declare interface DAxesParameters {
460
- /** The x-axis label (optional) */
461
- xLabel?: string;
462
- /** The y-axis label (optional) */
463
- yLabel?: string;
464
- /** The x-axis scale type (optional) */
465
- xScale?: AxisScaleType;
466
- /** The y-axis scale type (optional) */
467
- yScale?: AxisScaleType;
468
- /** The x-axis values (optional) */
469
- xValues?: NdArray<TypedArray>;
470
- /** The y-axis values (optional) */
471
- yValues?: NdArray<TypedArray>;
472
- /** The plot title (optional) */
473
- title?: string;
474
- }
475
-
476
- export declare type DecodedMessage = MultiLineDataMessage | AppendLineDataMessage | ImageDataMessage | ScatterDataMessage | SurfaceDataMessage | TableDataMessage | UpdateSelectionsMessage | SelectionsMessage | ClearSelectionsMessage | ClearPlotsMessage | BatonMessage | BatonApprovalRequestMessage;
156
+ export { Domain }
477
157
 
478
- /**
479
- * Represents line data.
480
- * @interface {object} DLineData
481
- * @member {string} key - The object key.
482
- * @member {string} [colour] - The line colour.
483
- * @member {NdArray<TypedArray>} x - x coordinates.
484
- * @member {[number, number]} dx - x data domain.
485
- * @member {NdArray<TypedArray>} y - y coordinates.
486
- * @member {[number, number]} dy - y data domain.
487
- * @member {boolean} line_on - If line is visible.
488
- * @member {number} [point_size] - The size of data points.
489
- * @member {boolean} [default_indices] - Line uses default generated x-axis values.
490
- */
491
- export declare interface DLineData {
492
- /** The object key */
493
- key: string;
494
- /** The line colour (optional) */
495
- colour?: string;
496
- /** x coordinates */
497
- x: NdArray<TypedArray>;
498
- /** x data domain */
499
- dx: [number, number];
500
- /** y coordinates */
501
- y: NdArray<TypedArray>;
502
- /** y data domain */
503
- dy: [number, number];
504
- /** If line is visible */
505
- line_on: boolean;
506
- /** The size of the data points (optional) */
507
- point_size?: number;
508
- /** Line uses default generated x-axis values (optional) */
509
- default_indices?: boolean;
510
- }
511
-
512
- /**
513
- *
514
- * Renders the configuration options for a domain.
515
- * @param {DomainConfigProps} props - The component props.
516
- * @returns {JSX.Element} The rendered component.
517
- */
518
- export declare function DomainConfig(props: DomainConfigProps): JSX_2.Element;
519
-
520
- export declare namespace DomainConfig {
521
- var displayName: string;
522
- }
523
-
524
- /**
525
- * The props for the `DomainConfig` component.
526
- * @interface {object} DomainConfigProps
527
- * @member {dataDomain} Domain - The domain to configure.
528
- * @member {CustomDomain} customDomain - The custom domain.
529
- * @member {ColorScaleType} scaleType - The type of the colour scale.
530
- * @member {(domain: CustomDomain) => void} onCustomDomainChange - Handles custom domain change.
531
- * @member {() => HistogramParams | undefined} [histogramFunction] - Returns histogram params.
532
- */
533
- export declare interface DomainConfigProps {
534
- /** The domain to configure */
535
- dataDomain: Domain;
536
- /** The custom domain */
537
- customDomain: CustomDomain;
538
- /** The type of the colour scale */
539
- scaleType: ColorScaleType;
540
- /** Handles custom domain change */
541
- onCustomDomainChange: (domain: CustomDomain) => void;
542
- /** Returns histogram params (optional) */
543
- histogramFunction?: () => HistogramParams | undefined;
544
- }
545
-
546
- export declare function DvdAxisBox(props: DvdAxisBoxProps): JSX_2.Element;
547
-
548
- export declare interface DvdAxisBoxProps extends SVGProps<SVGPolygonElement> {
549
- size: Size;
550
- coords: Vector3[];
551
- isFixed?: boolean;
552
- axis: number;
553
- onHandleChange?: HandleChangeFunction;
554
- }
555
-
556
- export declare function DvdDragHandle(props: DvdDragHandleProps): JSX_2.Element;
557
-
558
- export declare interface DvdDragHandleProps extends SVGProps<SVGElement> {
559
- name: string;
560
- size: Size;
561
- i: number;
562
- nx: number;
563
- ny: number;
564
- onHandleChange?: HandleChangeFunction;
565
- restrictX?: boolean;
566
- restrictY?: boolean;
567
- }
568
-
569
- export declare function DvdPolyline(props: DvdPolylineProps): JSX_2.Element;
570
-
571
- export declare interface DvdPolylineProps extends SVGProps<SVGPolylineElement> {
572
- size: Size;
573
- coords: Vector3[];
574
- isClosed?: boolean;
575
- isFixed?: boolean;
576
- onHandleChange?: HandleChangeFunction;
577
- }
578
-
579
- /** export class to select an ellipse */
158
+ /** Class to select an ellipse */
580
159
  export declare class EllipticalSelection extends OrientableSelection {
581
160
  readonly defaultColour = "#999933";
582
- semi_axes: [number, number];
583
- constructor(start: [number, number], semi_axes: [number, number], angle?: number);
161
+ /** lengths of major and minor semi-axes */
162
+ semiAxes: [number, number];
163
+ constructor(start: [number, number], semiAxes: [number, number], angle?: number);
584
164
  static clicks(): number[];
585
165
  static isShape(s: EllipticalSelection | SelectionBase): s is EllipticalSelection;
586
166
  static createFromPoints(points: Vector3[]): EllipticalSelection;
587
167
  static createFromSelection(s: EllipticalSelection): EllipticalSelection;
588
168
  }
589
169
 
590
- declare type EnumArray<T> = Array<T[keyof T]>;
591
-
592
- export declare function findSelection(selections: SelectionBase[], id: string | null): SelectionBase | undefined;
170
+ export { GlyphType }
593
171
 
594
- export declare function getClicks(selectionType: SelectionType): number[];
595
-
596
- export declare function getSelectionLabel(selection: SelectionBase | null, selectionIcons?: {
597
- line: string;
598
- rectangle: string;
599
- polyline: string;
600
- polygon: string;
601
- circle: string;
602
- ellipse: string;
603
- sector: string;
604
- horizontalAxis: string;
605
- verticalAxis: string;
606
- unknown: string;
607
- }): string;
608
-
609
- export declare function getSelectionLabelFromID(selections: SelectionBase[], id: string | null, selectionIcons: {
610
- line: string;
611
- rectangle: string;
612
- polyline: string;
613
- polygon: string;
614
- circle: string;
615
- ellipse: string;
616
- sector: string;
617
- horizontalAxis: string;
618
- verticalAxis: string;
619
- unknown: string;
620
- }): string;
621
-
622
- export declare function getSelectionType(selection: SelectionBase): SelectionType;
623
-
624
- export declare const HANDLE_SIZE = 8;
625
-
626
- declare type HandleChangeFunction = (i: number, pos: [number | undefined, number | undefined], b?: boolean) => BaseSelection;
627
-
628
- declare type _HandleChangeFunction = (i: number, position: [number | undefined, number | undefined]) => SelectionBase;
172
+ /**
173
+ * Function called when drag handles are moved
174
+ */
175
+ export declare type HandleChangeFunction = (
176
+ /** Number of drag handle */
177
+ i: number,
178
+ /** Position of handle */
179
+ pos: [number | undefined, number | undefined],
180
+ /** If true, then is dragging */
181
+ d?: boolean) => SelectionBase;
629
182
 
630
183
  /**
631
- * Represents heatmap data.
632
- * @interface {object} HeatmapData
633
- * @extends {ImageData}
634
- * @member {Domain} domain - The heatmap data domain.
635
- * @member {string} heatmap_scale - The heatmap scale.
636
- * @member {ColorMap} colourMap - The colour map.
184
+ * Represent heatmap data
637
185
  */
638
186
  export declare interface HeatmapData extends ImageData_2 {
639
- /** The heatmap data domain */
640
- domain: Domain;
641
- /** The heatmap scale */
642
- heatmap_scale: string;
643
- /** The colour map */
644
- colourMap: ColorMap;
187
+ /** extent of scale for pixel values */
188
+ domain?: Domain;
189
+ /** heatmap scale type */
190
+ heatmapScale?: ColorScaleType;
191
+ /** colour map */
192
+ colourMap?: ColorMap;
645
193
  }
646
194
 
647
195
  /**
648
- *
649
- * Renders a heatmap plot.
650
- * @param {HeatmapPlotProps} props - The component props.
651
- * @returns {JSX.Element} The rendered component.
196
+ * A heatmap plot
197
+ * @param {HeatmapPlotProps} props - The component props
198
+ * @returns {JSX.Element} The rendered component
652
199
  */
653
200
  export declare function HeatmapPlot(props: HeatmapPlotProps): JSX_2.Element;
654
201
 
202
+ declare type HeatmapPlotCustomizationProps = Omit<HeatmapPlotProps, 'values'>;
203
+
655
204
  /**
656
- * The props for the `HeatmapPlot` component.
657
- * @interface {object} HeatmapPlotProps
658
- * @extends {PlotSelectionProps}
659
- * @member {Domain} domain - The data domain.
660
- * @member {ColorScaleType} heatmapScale - The colour scale type.
661
- * @member {ColorMap} [colourMap] - The colour map.
205
+ * Props for `HeatmapPlot` component
662
206
  */
663
- export declare interface HeatmapPlotProps extends ImagePlotProps {
664
- /** The data domain */
665
- domain: Domain;
666
- /** The colour scale type */
667
- heatmapScale: ColorScaleType;
668
- /** The colour map (optional) */
669
- colourMap?: ColorMap;
207
+ export declare interface HeatmapPlotProps extends PlotBaseProps, HeatmapData {
670
208
  }
671
209
 
672
- export declare type IIconType = ComponentType<SVGAttributes<SVGElement>>;
673
-
674
210
  /**
675
- * Represents image data.
676
- * @interface {object} ImageData
677
- * @member {string} key - The key.
678
- * @member {MP_NDArray} values - The image data values.
679
- * @member {Aspect} aspect - The aspect ratio.
211
+ * Represent image data
680
212
  */
681
213
  declare interface ImageData_2 {
682
- /** The key */
683
- key: string;
684
- /** The image data values */
685
- values: MP_NDArray;
686
- /** The aspect ratio (optional) */
214
+ /** pixel values */
215
+ values: NDT;
216
+ /** aspect ratio */
687
217
  aspect?: Aspect;
688
218
  }
689
219
  export { ImageData_2 as ImageData }
690
220
 
691
221
  /**
692
- * An image data message.
693
- * @interface {object} ImageDataMessage
694
- * @extends {DataMessage}
695
- * @member {ImageData} im_data - The image data.
696
- */
697
- export declare interface ImageDataMessage extends DataMessage {
698
- /** The image data */
699
- im_data: ImageData_2;
700
- }
701
-
702
- /**
703
- *
704
- * Renders an image plot.
222
+ * Render an image plot.
705
223
  * @param {ImagePlotProps} props - The component props.
706
224
  * @returns {JSX.Element} The rendered component.
707
225
  */
708
226
  export declare function ImagePlot(props: ImagePlotProps): JSX_2.Element;
709
227
 
710
- /**
711
- * The props for the `ImagePlot` component.
712
- * @interface {object} ImagePlotProps
713
- * @extends {ImagePlotProps}
714
- * @member {NdArray<TypedArray>} values - The image data.
715
- * @member {DAxesParameters} axesParameters - The axes parameters.
716
- * @member {Aspect} [aspect] - The image plot aspect.
717
- */
718
- export declare interface ImagePlotProps extends PlotSelectionProps {
719
- /** The image data */
720
- values: NdArray<TypedArray>;
721
- /** The axes parameters */
722
- axesParameters: DAxesParameters;
723
- /** The image plot aspect (optional) */
724
- aspect?: Aspect;
725
- }
726
-
727
- /**
728
- *
729
- * Renders a toggle button for interaction mode.
730
- * @param {InteractionModeToggleProps} props - The component props.
731
- * @returns {JSX.Element} The rendered component.
732
- */
733
- export declare function InteractionModeToggle(props: InteractionModeToggleProps): JSX_2.Element;
228
+ declare type ImagePlotCustomizationProps = Omit<ImagePlotProps, 'values'>;
734
229
 
735
230
  /**
736
- * The props for the `InteractionModeToggle` component.
737
- * @interface {object} InteractionModeToggleProps
738
- * @member {InteractionModeType} value - The interaction mode.
739
- * @member {(value: string) => void} onModeChange - Handles change of mode.
740
- * @member {boolean} hasBaton - If client holds baton.
231
+ * Props for the `ImagePlot` component
741
232
  */
742
- export declare interface InteractionModeToggleProps {
743
- /** The interaction mode */
744
- value: InteractionModeType;
745
- /** Handles change of mode */
746
- onModeChange: (value: InteractionModeType) => void;
747
- /** If client holds baton */
748
- hasBaton: boolean;
233
+ export declare interface ImagePlotProps extends PlotBaseProps, ImageData_2 {
749
234
  }
750
235
 
751
236
  export declare enum InteractionModeType {
@@ -754,56 +239,10 @@ export declare enum InteractionModeType {
754
239
  selectRegion = "selectRegion"
755
240
  }
756
241
 
757
- /**
758
- *
759
- * Renders a labelled input box.
760
- * @template T
761
- * @param {LabelledInputProps<T>} props - The component props.
762
- * @returns {JSX.Element} The rendered component.
763
- */
764
- export declare function LabelledInput<T>(props: LabelledInputProps<T>): JSX_2.Element;
765
-
766
- /**
767
- * The props for the `LabelledInput<T>` component.
768
- * @template T
769
- * @interface {object} LabelledInputProps<T>
770
- * @member {(value: T) => void} updateValue - Updates value.
771
- * @member {(value: string) => [boolean, T]} [isValid] - Checks if value is valid.
772
- * @member {string} label - The input label.
773
- * @member {T} input - The input value.
774
- * @member {number} [decimalPlaces] - The number of decimal places to display.
775
- * @member {object} [inputAttribs] - Input attributes.
776
- * @member {string} [submitLabel] - Label on submit button.
777
- * @member {boolean} [disabled] - If input is diabled.
778
- * @member {boolean} [enableEnterKey] - If enter key is enabled.
779
- * @member {boolean} [resetButton] - If reset button is enabled.
780
- */
781
- export declare interface LabelledInputProps<T> {
782
- /** Updates value */
783
- updateValue: (value: T) => void;
784
- /** Checks if value is valid (optional) */
785
- isValid?: (value: string) => [boolean, T];
786
- /** The input label */
787
- label: string;
788
- /** The input value */
789
- input: T;
790
- /** The number of decimal places to display (optional) */
791
- decimalPlaces?: number;
792
- /** Input attributes (optional) */
793
- inputAttribs?: object;
794
- /** Label on submit button (optional) */
795
- submitLabel?: string;
796
- /** If input is disabled (optional) */
797
- disabled?: boolean;
798
- /** If enter key is enabled (optional) */
799
- enableEnterKey?: boolean;
800
- /** If reset button is enabled (optional) */
801
- resetButton?: boolean;
802
- }
803
-
804
- /** export class to select a line */
242
+ /** Class to select a line */
805
243
  export declare class LinearSelection extends OrientableSelection {
806
244
  readonly defaultColour = "#44aa99";
245
+ /** length of line */
807
246
  length: number;
808
247
  constructor(start?: [number, number], length?: number, angle?: number);
809
248
  _getPoint(fraction?: number): Vector3;
@@ -818,317 +257,117 @@ export declare class LinearSelection extends OrientableSelection {
818
257
  }
819
258
 
820
259
  /**
821
- *
822
- * Renders the configuration options for a linear selection.
823
- * @param {LinearSelectionConfigProps} props - The component props.
824
- * @returns {JSX.Element} The rendered component.
825
- */
826
- export declare function LinearSelectionConfig(props: LinearSelectionConfigProps): JSX_2.Element;
827
-
828
- /**
829
- * The props for the `LinearSelectionConfig` component.
830
- * @interface {object} LinearSelectionConfigProps
831
- * @member {LinearSelection} selection - The linear selection to configure.
832
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} updateSelection - Handle updating selection.
833
- * @member {boolean} [disabled] - If input is diabled.
260
+ * Represent line data
834
261
  */
835
- export declare interface LinearSelectionConfigProps {
836
- /** The linear selection to configure */
837
- selection: LinearSelection;
838
- /** Handle updating selection */
839
- updateSelection: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
840
- /** If input is disabled (optional) */
841
- disabled?: boolean;
262
+ export declare interface LineData {
263
+ /** The object key */
264
+ key: string;
265
+ /** Line parameters */
266
+ lineParams: LineParams;
267
+ /** x coordinates */
268
+ x: NDT;
269
+ /** x data domain */
270
+ xDomain: Domain;
271
+ /** y coordinates */
272
+ y: NDT;
273
+ /** y data domain */
274
+ yDomain: Domain;
275
+ /** Line uses default generated x-axis values */
276
+ defaultIndices?: boolean;
842
277
  }
843
278
 
844
279
  /**
845
- * Represents line data.
846
- * @interface {object} LineData
847
- * @member {string} key - The key.
848
- * @member {string} [colour] - The line colour.
849
- * @member {MP_NDArray} x - The x data.
850
- * @member {MP_NDArray} y - The y data.
851
- * @member {boolean} line_on - If line is visible.
852
- * @member {number} [point_size] - The data point size.
280
+ * Represent line parameters
853
281
  */
854
- export declare interface LineData {
855
- /** The key */
856
- key: string;
857
- /** The line colour (optional) */
282
+ export declare interface LineParams {
283
+ /** The line name */
284
+ name: string;
285
+ /** The line colour */
858
286
  colour?: string;
859
- /** The x data */
860
- x: MP_NDArray;
861
- /** The y data */
862
- y: MP_NDArray;
863
287
  /** If line is visible */
864
- line_on: boolean;
865
- /** The data point size (optional) */
866
- point_size?: number;
288
+ lineOn: boolean;
289
+ /** The size of the data points (optional) */
290
+ pointSize?: number;
291
+ /** The type of glyph */
292
+ glyphType: GlyphType;
867
293
  }
868
294
 
869
295
  /**
870
- *
871
- * Renders a line plot.
296
+ * Render a line plot.
872
297
  * @param {LinePlotProps} props - The component props.
873
298
  * @returns {JSX.Element} The rendered component.
874
299
  */
875
300
  export declare function LinePlot(props: LinePlotProps): JSX_2.Element;
876
301
 
302
+ declare type LinePlotCustomizationProps = Omit<LinePlotProps, 'lineData'>;
303
+
877
304
  /**
878
- * The props for the `LinePlot` component.
879
- * @interface {object} LinePlotProps
880
- * @extends {LinePlotProps}
881
- * @member {DLineData[]} data - The line data.
882
- * @member {Domain} xDomain - The x data domain.
883
- * @member {Domain} yDomain - The y data domain.
884
- * @member {DAxesParameters} axesParameters - The axes parameters.
305
+ * Props for the `LinePlot` component.
885
306
  */
886
- export declare interface LinePlotProps extends PlotSelectionProps {
307
+ export declare interface LinePlotProps extends PlotBaseProps {
887
308
  /** The line data */
888
- data: DLineData[];
309
+ lineData: LineData[];
889
310
  /** The x data domain */
890
- xDomain: Domain;
311
+ xDomain?: Domain;
891
312
  /** The y data domain */
892
- yDomain: Domain;
893
- /** The axes parameters */
894
- axesParameters: DAxesParameters;
895
- }
896
-
897
- export declare function makeShapes(size: Size, selections: SelectionBase[], showHandles: boolean, update?: (s: SelectionBase) => void): JSX_2.Element[] | undefined;
898
-
899
- /**
900
- *
901
- * Renders a modal component.
902
- * @param {ModalProps} props - The component props.
903
- * @returns {JSX.Element} The rendered component.
904
- */
905
- export declare function Modal(props: ModalProps): (JSX_2.Element | null)[];
906
-
907
- /**
908
- * The props for the `Modal` component.
909
- * @interface {object} ModalProps
910
- * @member {string} title - The title of the modal.
911
- * @member {IIcontype} [icon] - The icon to display.
912
- * @member {ReactNode} [button] - The button to display.
913
- * @member {ReactNode} [children] - Any child components.
914
- */
915
- export declare interface ModalProps {
916
- /** The title of the modal */
917
- title: string;
918
- /** The icon to display (optional) */
919
- icon?: IIconType;
920
- /** The button to display (optional) */
921
- button?: ReactNode;
922
- /** Any child components (optional) */
923
- children?: ReactNode;
924
- }
925
-
926
- /**
927
- *
928
- * Renders a modeless.
929
- * @param {ModelessProps} props - The component props.
930
- * @returns {JSX.Element} The rendered component.
931
- */
932
- export declare function Modeless(props: ModelessProps): (JSX_2.Element | null)[];
933
-
934
- /**
935
- *
936
- * The props for the `Modeless` component.
937
- * @interface {object} ModalProps
938
- * @member {string} title - The title of the modeless.
939
- * @member {ReactNode} [button] - The button to display.
940
- * @member {boolean} showModeless - If the modeless is shown.
941
- * @member {(s: boolean) => void} [setShowModeless] - Handles showModeless toggle.
942
- * @member {ReactNode} [children] - Any child components.
943
- */
944
- export declare interface ModelessProps {
945
- /** The title of the modeless */
946
- title: string;
947
- /** The button to display (optional) */
948
- button?: ReactNode;
949
- /** If the modeless is shown */
950
- showModeless: boolean;
951
- /** Handles showModeless toggle */
952
- setShowModeless: (s: boolean) => void;
953
- /** Any child components (optional) */
954
- children?: ReactNode;
955
- }
956
-
957
- /**
958
- * An MP_NDArray.
959
- * @interface {object} MP_NDArray
960
- * @member {boolean} nd - If it is an n-dimensional array.
961
- * @member {string} [dtype] - The data type.
962
- * @member {number[]} [shape] - The shape of the data.
963
- * @member {ArrayBuffer} [data] - The data.
964
- */
965
- export declare interface MP_NDArray {
966
- /** If it is an n-dimensional array */
967
- nd: boolean;
968
- /** The data type */
969
- dtype: string;
970
- /** The shape of the data */
971
- shape: number[];
972
- /** The data */
973
- data: ArrayBuffer;
974
- }
975
-
976
- export declare type MsgType = 'status' | 'new_multiline_data' | 'append_line_data' | 'new_image_data' | 'new_scatter_data' | 'new_surface_data' | 'new_table_data' | 'new_selection_data' | 'append_selection_data' | 'baton_request' | 'baton_approval' | 'clear_selection_data' | 'clear_data' | 'client_new_selection' | 'client_update_selection';
977
-
978
- /**
979
- *
980
- * Renders a tool with which to create a multiclick selection.
981
- * @param {Props} props - The component props.
982
- */
983
- export declare function MulticlickSelectionTool(props: MulticlickSelectionToolProps): JSX_2.Element | null;
984
-
985
- /**
986
- * The props for the `MultiClickSelectionTool` component.
987
- * @interface {object} Props
988
- * @extends CommonInteractionProps
989
- * @member {string} [id] - The ID.
990
- * @member {number} [minPoints] - The minimum number of points. Default = 2, must be >= 1.
991
- * @member {number} [maxPoints] - The maximum number of points. Defaults to minPoints, must be >= minPoints or -1 = unlimited.
992
- * @member {number} [maxMovement] - The maximum movement between pointer up/down to ignore, default = 1.
993
- * @member {(rawSelection: Selection, camera: Camera, context: VisCanvasContextValue) => Selection} [transform] - The transform.
994
- * @member {(selection: Selection) => boolean} [validate] - Validates selection.
995
- * @member {() => void} [onSelectionStart] - Handles start of selection.
996
- * @member {(selection: Selection | undefined, rawSelection: Selection, isValid: boolean) => void} [onSelectionChange] - Handles selection changing.
997
- * @member {{(selection: Selection | undefined, isValid: boolean) => void}} [onSelectionEnd] - Handles end of selection.
998
- * @member {(selection: Selection) => void} [onValidSelection] - Handles valid selections.
999
- * @member {(selection: Selection, rawSelection: Selection, isValid: boolean, isComplete: boolean) => ReactNode} [children] - Any child components.
1000
- */
1001
- export declare interface MulticlickSelectionToolProps extends CommonInteractionProps {
1002
- /** The ID (optional) */
1003
- id?: string;
1004
- /** The minimum number of points. Default = 2, must be >= 1 (optional) */
1005
- minPoints?: number;
1006
- /** The maximum number of points. Defaults to minPoints, must be >= minPoints or -1 = unlimited (optional) */
1007
- maxPoints?: number;
1008
- /** The maximum movement between pointer up/down to ignore, default = 1 (optional) */
1009
- maxMovement?: number;
1010
- /** The transform (optional) */
1011
- transform?: (rawSelection: Selection_2, camera: Camera, context: VisCanvasContextValue) => Selection_2;
1012
- /** Validates selection (optional) */
1013
- validate?: (selection: Selection_2) => boolean;
1014
- /** Handles selection starting (optional) */
1015
- onSelectionStart?: () => void;
1016
- /** Handles selection changing (optional) */
1017
- onSelectionChange?: (selection: Selection_2 | undefined, rawSelection: Selection_2, isValid: boolean) => void;
1018
- /** Handles end of selection (optional) */
1019
- onSelectionEnd?: (selection: Selection_2 | undefined, isValid: boolean) => void;
1020
- /** handles valid selections (optional) */
1021
- onValidSelection?: (selection: Selection_2) => void;
1022
- /** Any child components */
1023
- children: (selection: Selection_2, rawSelection: Selection_2, isValid: boolean, isComplete: boolean) => ReactNode;
313
+ yDomain?: Domain;
314
+ /** Handles updating line params */
315
+ updateLineParams?: (key: string, params: LineParams) => void;
1024
316
  }
1025
317
 
1026
- /**
1027
- * A multiline data message.
1028
- * @interface {object} MultiLineDataMessage
1029
- * @extends {DataMessage}
1030
- * @member {LineData[]} ml_data - The multiline data.
1031
- */
1032
- export declare interface MultiLineDataMessage extends DataMessage {
1033
- /** The multiline data */
1034
- ml_data: LineData[];
1035
- }
318
+ /** ndarray of a typed array */
319
+ export declare type NDT = NdArray<TypedArray>;
1036
320
 
1037
- /** export class for all orientable selections */
321
+ /** Superclass for all orientable selections */
1038
322
  export declare class OrientableSelection extends BaseSelection {
323
+ /** angle of selection (radians) */
1039
324
  angle: number;
1040
- transform: Matrix3;
1041
- invTransform: Matrix3;
325
+ protected transform: Matrix3;
326
+ protected invTransform: Matrix3;
1042
327
  constructor(start: [number, number], angle?: number);
1043
328
  setAngle(angle: number): void;
1044
329
  static isShape(s: OrientableSelection | SelectionBase): s is OrientableSelection;
1045
330
  }
1046
331
 
1047
332
  /**
1048
- * A plot message.
1049
- * @interface {object} PlotMessage
1050
- * @member {string} plot_id - The plot ID.
1051
- * @member {MsgType} type - The message type.
1052
- * @member {unknown} params - The message parameters.
1053
- * @member {unknown} plot_config - The plot configuration.
333
+ * Props for selections, baton and configuration in a plot component
1054
334
  */
1055
- export declare interface PlotMessage {
1056
- /** The plot ID */
1057
- plot_id: string;
1058
- /** The message type */
1059
- type: MsgType;
1060
- /** The message parameters */
1061
- params: unknown;
1062
- /** The plot configureation */
1063
- plot_config: unknown;
335
+ export declare interface PlotBaseProps extends PlotSelectionProps {
336
+ /** The plot configuration */
337
+ plotConfig: PlotConfig;
338
+ /**
339
+ * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar,
340
+ * otherwise use given children
341
+ */
342
+ customToolbarChildren?: React.ReactNode;
1064
343
  }
1065
344
 
1066
345
  /**
1067
- * The props for the `PlotSelectionProps` component.
1068
- * @interface {object} PlotSelectionProps
1069
- * @member {(selection: SelectionBase | null, broadcast?: boolean, clear?: boolean) => void} addSelection - Handles adding selection.
1070
- * @member {SelectionBase[]} selections - The selections.
1071
- * @member {BatonProps} [batonProps] - The baton props.
346
+ * Represent plot configuration
1072
347
  */
1073
- export declare interface PlotSelectionProps {
1074
- /** Handles adding selection */
1075
- addSelection?: (selection: SelectionBase | null, broadcast?: boolean, clear?: boolean) => void;
1076
- /** The selections */
1077
- selections: SelectionBase[];
1078
- /** The baton props */
1079
- batonProps?: BatonProps;
348
+ export declare interface PlotConfig {
349
+ /** The label for the x-axis */
350
+ xLabel?: string;
351
+ /** The label for the y-axis */
352
+ yLabel?: string;
353
+ /** The x-axis scale type */
354
+ xScale?: AxisScaleType;
355
+ /** The y-axis scale type */
356
+ yScale?: AxisScaleType;
357
+ /** The x-axis values */
358
+ xValues?: NDT;
359
+ /** The y-axis values */
360
+ yValues?: NDT;
361
+ /** The plot title */
362
+ title?: string;
1080
363
  }
1081
364
 
1082
- /**
1083
- *
1084
- * Renders a plot toolbar.
1085
- * @param {PlotToolbarProps} props - The component props.
1086
- * @returns {JSX.Element} The rendered component.
1087
- */
1088
- export declare function PlotToolbar(props: PlotToolbarProps): JSX_2.Element;
365
+ export declare function PlotCustomizationContextProvider(props: PropsWithChildren<AnyPlotCustomizationProps>): JSX_2.Element;
1089
366
 
1090
367
  /**
1091
- * The props for the `PlotToolbar` component.
1092
- * @param {boolean} showGrid - If the grid should be shown.
1093
- * @param {() => void} toggleShowGrid - Toggles the grid.
1094
- * @param {string} title - The title.
1095
- * @param {(t:string) => void} setTitle - A function that sets the title.
1096
- * @param {InteractionModeType} [mode] - The mode.
1097
- * @param {(m:InteractionModeType) => void} [setMode] - An optional function that sets the mode.
1098
- * @param {Domain} [xDomain] - A domain value for the x-axis.
1099
- * @param {CustomDomain} [xCustomDomain] - A custom domain value for the x-axis.
1100
- * @param {(d: CustomDomain) => void} [setXCustomDomain] - A function that sets the custom domain value for the x-axis.
1101
- * @param {string} xLabel - The label for the x-axis.
1102
- * @param {(l: string) => void} setXLabel - A function that sets the label for the x-axis.
1103
- * @param {AxisScaleType} [xScaleType] - An axis scale type for the x-axis.
1104
- * @param {(s: AxisScaleType) => void} [setXScaleType] - An optional function that sets the axis scale type for the x-axis.
1105
- * @param {Domain} [yDomain] - A domain value for the y-axis.
1106
- * @param {CustomDomain} [yCustomDomain] - A custom domain value for the y-axis.
1107
- * @param {(d: CustomDomain) => void} [setYCustomDomain] - A function that sets the custom domain value for the y-axis.
1108
- * @param {string} yLabel - The label for the y-axis.
1109
- * @param {(l: string) => void} setYLabel - Function that sets the label for the y-axis.
1110
- * @param {BatonProps} [batonProps] - The baton properties.
1111
- * @param {AxisScaleType} [yScaleType] - Axis scale type for the y-axis.
1112
- * @param {(s: AxisScaleType) => void} [setYScaleType] - A function that sets the axis scale type for the y-axis.
1113
- * @param {Aspect} [aspect] - An aspect value.
1114
- * @param {(a: Aspect) => void} [setAspect] - A function that sets the aspect value.
1115
- * @param {SelectionType} [selectionType] - Selection type.
1116
- * @param {(s: SelectionType) => void} [setSelectionType] - Function that sets the selection type.
1117
- * @param {Domain} [dDomain] - Domain value for the d-axis.
1118
- * @param {CustomDomain} [dCustomDomain] - Custom domain value for the d-axis.
1119
- * @param {(d: CustomDomain) => void} [setDCustomDomain] - Sets the custom domain value for the d-axis.
1120
- * @param {TypedArray} [values] - Values.
1121
- * @param {ColorScaleType} [dScaleType] - The color scale type for the d-axis.
1122
- * @param {(s: ColorScaleType) => void} [setDScaleType] - Sets the color scale type for the d-axis.
1123
- * @param {ColorMap} [colourMap] - The color map.
1124
- * @param {(c: ColorMap) => void} [setColourMap] - A function that sets the color map.
1125
- * @param {boolean} invertColourMap - Whether to invert the color map.
1126
- * @param {() => void} toggleInvertColourMap - A function that toggles the color map inversion.
1127
- * @param {SelectionBase[]} [selections] - Selections.
1128
- * @param {(s: SelectionBase | null, b?: boolean, c?: boolean ) => void} [updateSelections] - A function that updates the selections.
1129
- * @param {reactNode} [children] - Any child components.
368
+ * Value for a `PlotCustomization` context.
1130
369
  */
1131
- export declare interface PlotToolbarProps {
370
+ export declare interface PlotCustomizationContextValue {
1132
371
  /** If the grid should be shown */
1133
372
  showGrid: boolean;
1134
373
  /** Toggles the grid */
@@ -1137,126 +376,132 @@ export declare interface PlotToolbarProps {
1137
376
  title: string;
1138
377
  /** A function that sets the title */
1139
378
  setTitle: (t: string) => void;
1140
- /** The mode (optional) */
1141
- mode?: InteractionModeType;
379
+ /** The mode */
380
+ mode: InteractionModeType;
1142
381
  /** An optional function that sets the mode */
1143
- setMode?: (m: InteractionModeType) => void;
1144
- /** A domain value for the x-axis (optional) */
1145
- xDomain?: Domain;
1146
- /** A custom domain value for the x-axis (optional) */
1147
- xCustomDomain?: CustomDomain;
1148
- /** A function that sets the custom domain value for the x-axis (optional) */
1149
- setXCustomDomain?: (d: CustomDomain) => void;
382
+ setMode: (m: InteractionModeType) => void;
383
+ /** A domain value for the x-axis */
384
+ xDomain: Domain;
385
+ /** A custom domain value for the x-axis */
386
+ xCustomDomain: CustomDomain;
387
+ /** A function that sets the custom domain value for the x-axis */
388
+ setXCustomDomain: (d: CustomDomain) => void;
1150
389
  /** The label for the x-axis */
1151
390
  xLabel: string;
1152
391
  /** A function that sets the label for the x-axis */
1153
392
  setXLabel: (l: string) => void;
1154
- /** An axis scale type for the x-axis (optional) */
1155
- xScaleType?: AxisScaleType;
393
+ /** An axis scale type for the x-axis */
394
+ xScaleType: AxisScaleType;
1156
395
  /** An optional function that sets the axis scale type for the x-axis */
1157
- setXScaleType?: (s: AxisScaleType) => void;
1158
- /** A domain value for the y-axis (optional) */
1159
- yDomain?: Domain;
1160
- /** A custom domain value for the y-axis (optional) */
1161
- yCustomDomain?: CustomDomain;
1162
- /** A function that sets the custom domain value for the y-axis (optional) */
1163
- setYCustomDomain?: (d: CustomDomain) => void;
396
+ setXScaleType: (s: AxisScaleType) => void;
397
+ /** A domain value for the y-axis */
398
+ yDomain: Domain;
399
+ /** A custom domain value for the y-axis */
400
+ yCustomDomain: CustomDomain;
401
+ /** A function that sets the custom domain value for the y-axis */
402
+ setYCustomDomain: (d: CustomDomain) => void;
1164
403
  /** The label for the y-axis */
1165
404
  yLabel: string;
1166
405
  /** A function that sets the label for the y-axis */
1167
406
  setYLabel: (l: string) => void;
1168
407
  /** The baton properties */
1169
- batonProps?: BatonProps;
1170
- /** An axis scale type for the y-axis (optional) */
1171
- yScaleType?: AxisScaleType;
1172
- /** A function that sets the axis scale type for the y-axis (optional) */
1173
- setYScaleType?: (s: AxisScaleType) => void;
1174
- /** An aspect value (optional) */
1175
- aspect?: Aspect;
1176
- /** A function that sets the aspect value (optional) */
1177
- setAspect?: (a: Aspect) => void;
1178
- /** A selection type (optional) */
1179
- selectionType?: SelectionType;
1180
- /** A function that sets the selection type (optional) */
1181
- setSelectionType?: (s: SelectionType) => void;
1182
- /** A domain value for the d-axis (optional) */
1183
- dDomain?: Domain;
1184
- /** A custom domain value for the d-axis (optional) */
1185
- dCustomDomain?: CustomDomain;
1186
- /** A function that sets the custom domain value for the d-axis (optional) */
1187
- setDCustomDomain?: (d: CustomDomain) => void;
1188
- /** Values (optional) */
1189
- values?: TypedArray;
1190
- /** A color scale type for the d-axis (optional) */
1191
- dScaleType?: ColorScaleType;
1192
- /** A function that sets the color scale type for the d-axis (optional) */
1193
- setDScaleType?: (s: ColorScaleType) => void;
1194
- /** A color map (optional) */
1195
- colourMap?: ColorMap;
1196
- /** A function that sets the color map (optional) */
1197
- setColourMap?: (c: ColorMap) => void;
408
+ batonProps: BatonProps;
409
+ /** An axis scale type for the y-axis */
410
+ yScaleType: AxisScaleType;
411
+ /** A function that sets the axis scale type for the y-axis */
412
+ setYScaleType: (s: AxisScaleType) => void;
413
+ /** An aspect value */
414
+ aspect: Aspect;
415
+ /** A function that sets the aspect value */
416
+ setAspect: (a: Aspect) => void;
417
+ /** A selection type */
418
+ selectionType: SelectionType;
419
+ /** A function that sets the selection type */
420
+ setSelectionType: (s: SelectionType) => void;
421
+ /** A domain value for the d-axis */
422
+ dDomain: Domain;
423
+ /** A custom domain value for the d-axis */
424
+ dCustomDomain: CustomDomain;
425
+ /** A function that sets the custom domain value for the d-axis */
426
+ setDCustomDomain: (d: CustomDomain) => void;
427
+ /** A color scale type for the d-axis */
428
+ dScaleType: ColorScaleType;
429
+ /** A function that sets the color scale type for the d-axis */
430
+ setDScaleType: (s: ColorScaleType) => void;
431
+ /** A color map */
432
+ colourMap: ColorMap;
433
+ /** A function that sets the color map */
434
+ setColourMap: (c: ColorMap) => void;
1198
435
  /** Whether to invert the color map */
1199
- invertColourMap?: boolean;
436
+ invertColourMap: boolean;
1200
437
  /** A function that toggles the color map inversion */
1201
- toggleInvertColourMap?: () => void;
1202
- /** Selections (optional) */
1203
- selections?: SelectionBase[];
1204
- /** A function that updates the selections (optional) */
1205
- updateSelections?: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
1206
- /** Any child components (optional) */
1207
- children?: ReactNode;
1208
- }
1209
-
1210
- /**
1211
- *
1212
- * The props for the `PointInput` component.
1213
- * @interface PointInputProps
1214
- * @member {number} i - The point number.
1215
- * @member {[number, number]} point - The coordinates of the point.
1216
- * @member {(p: [number, number]) => void} updatePoint - Function to handle updating of point.
1217
- * @member {boolean} [disabled] - If input component is disabled.
438
+ toggleInvertColourMap: () => void;
439
+ /** Selections */
440
+ selections: SelectionBase[];
441
+ /** A function that sets the selections */
442
+ setSelections: (s: SelectionBase[]) => void;
443
+ /** A function that updates the selections */
444
+ updateSelection: SelectionHandler;
445
+ /** Map of line parameters */
446
+ allLineParams: Map<string, LineParams>;
447
+ /** Set line parameters */
448
+ setAllLineParams: (params: Map<string, LineParams>) => void;
449
+ /** A function to update parameters in a line */
450
+ updateLineParams: (key: string, params: LineParams) => void;
451
+ /** current line key */
452
+ currentLineKey: string | null;
453
+ /** A function that sets current line key */
454
+ setCurrentLineKey: (k: string) => void;
455
+ /** The size of scatter data points. */
456
+ scatterPointSize: number;
457
+ /** A function that updates the selections */
458
+ setScatterPointSize: (p: number) => void;
459
+ /** Whether to show points on surface */
460
+ showPoints: boolean;
461
+ /** A function that toggles the points */
462
+ toggleShowPoints: () => void;
463
+ /** Histogram params */
464
+ histogram?: HistogramParams;
465
+ /** Set heatmap histogram */
466
+ setHistogram: (histogram: HistogramParams) => void;
467
+ /** Can select */
468
+ canSelect: boolean;
469
+ /** Type of plot */
470
+ plotType: PlotType;
471
+ }
472
+
473
+ /**
474
+ * Props for selections (and baton) in a plot component
1218
475
  */
1219
- declare interface PointInputProps {
1220
- /** The point number */
1221
- i: number;
1222
- /** The coordinates of the point */
1223
- point: [number, number];
1224
- /** Function to handle updating of point */
1225
- updatePoint: (p: [number, number]) => void;
1226
- /** If input component is disabled (optional) */
1227
- disabled?: boolean;
476
+ export declare interface PlotSelectionProps {
477
+ /** Handles adding selection (set null to disable editing) */
478
+ updateSelection?: SelectionHandler | null;
479
+ /** The selections */
480
+ selections?: SelectionBase[];
481
+ /** The baton props */
482
+ batonProps?: BatonProps;
1228
483
  }
1229
484
 
1230
- export declare type Points = Vector3[];
1231
-
1232
- export declare function pointsToSelection(selections: SelectionBase[], selectionType: SelectionType, points: Vector3[], alpha: number, colour?: string): BaseSelection;
1233
-
1234
- export declare function pointsToShape(selectionType: SelectionType, points: Vector3[], axesFlipped: [boolean, boolean], alpha: number, size: Size, colour?: string): JSX_2.Element | null;
1235
-
1236
485
  /**
1237
- *
1238
- * Renders a labelled input for point x.
1239
- * @param {PointInputProps} props - The component props.
486
+ * Render a plot toolbar.
487
+ * @param {Props} props - inner children
1240
488
  * @returns {JSX.Element} The rendered component.
1241
489
  */
1242
- export declare function PointXInput(props: PointInputProps): JSX_2.Element;
490
+ export declare function PlotToolbar(props: PropsWithChildren): JSX.Element;
1243
491
 
1244
492
  /**
1245
- *
1246
- * Renders a labelled input for point y.
1247
- * @param {PointInputProps} props - The component props.
1248
- * @returns {JSX.Element} The rendered component.
493
+ * Plot type available
1249
494
  */
1250
- export declare function PointYInput(props: PointInputProps): JSX_2.Element;
1251
-
1252
- export declare function polar(xy: Vector3): [number, number];
495
+ export declare type PlotType = 'Line' | 'Heatmap' | 'Image' | 'Scatter' | 'Surface';
1253
496
 
1254
- /** export class to select a polygon */
497
+ /** Class to select a polygon */
1255
498
  export declare class PolygonalSelection extends BaseSelection {
1256
499
  readonly defaultOpenColour = "#88ccee";
1257
500
  readonly defaultClosedColour = "#ffa07a";
1258
501
  readonly defaultColour = "#88ccee";
502
+ /** array of point coordinates */
1259
503
  points: [number, number][];
504
+ /** if true, polygon is closed by joining last and first point */
1260
505
  closed: boolean;
1261
506
  constructor(points: [number, number][], closed?: boolean);
1262
507
  getPoints(): Vector3[];
@@ -1268,35 +513,10 @@ export declare class PolygonalSelection extends BaseSelection {
1268
513
  onHandleChange(i: number, pos: [number | undefined, number | undefined]): PolygonalSelection;
1269
514
  }
1270
515
 
1271
- /**
1272
- *
1273
- * Renders configuration for polygonal selection.
1274
- * @param {PolygonalSelectionConfigProps} props - The component props.
1275
- * @returns {JSX.Element} The rendered component.
1276
- */
1277
- export declare function PolygonalSelectionConfig(props: PolygonalSelectionConfigProps): JSX_2.Element;
1278
-
1279
- /**
1280
- * The props for the `PolygonalSelectionConfig` component.
1281
- * @interface {object} PolygonalSelectionConfigProps
1282
- * @member {PolygonalSelection} selection - The polygonal selection to configure.
1283
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} [updateSelection] - Handles update of selection.
1284
- * @member {boolean} [disabled] - If disabled.
1285
- */
1286
- export declare interface PolygonalSelectionConfigProps {
1287
- /** The polygonal selection to configure */
1288
- selection: PolygonalSelection;
1289
- /** Handles update of selection */
1290
- updateSelection: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
1291
- /** If disabled */
1292
- disabled?: boolean;
1293
- }
1294
-
1295
- export declare function recreateSelection(selection: SelectionBase): AxialSelection | CircularSelection | CircularSectorialSelection | EllipticalSelection | LinearSelection | PolygonalSelection | RectangularSelection | null;
1296
-
1297
- /** export class to select a rectangle */
516
+ /** Class to select a rectangle */
1298
517
  export declare class RectangularSelection extends OrientableSelection {
1299
518
  readonly defaultColour = "#ddcc77";
519
+ /** lengths of major and minor sides */
1300
520
  lengths: [number, number];
1301
521
  constructor(start: [number, number], lengths: [number, number], angle?: number);
1302
522
  getPoints(): Vector3[];
@@ -1309,280 +529,86 @@ export declare class RectangularSelection extends OrientableSelection {
1309
529
  onHandleChange(i: number, pos: [number | undefined, number | undefined]): RectangularSelection;
1310
530
  }
1311
531
 
1312
- /**
1313
- *
1314
- * Renders the configuration options for a rectangular selection.
1315
- * @param {RectangularSelectionConfigProps} props - The component props.
1316
- * @returns {JSX.Element} The rendered component.
1317
- */
1318
- export declare function RectangularSelectionConfig(props: RectangularSelectionConfigProps): JSX_2.Element;
532
+ export { ScaleType }
1319
533
 
1320
534
  /**
1321
- * The props for the `RectangularSelectionConfig` component.
1322
- * @interface {object} RectangularSelectionConfigProps
1323
- * @member {RectangularSelection} selection - The rectangular selection to configure.
1324
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} [updateSelection] - Handles update of selection.
1325
- * @member {boolean} [disabled] - If disabled.
1326
- */
1327
- export declare interface RectangularSelectionConfigProps {
1328
- /** The rectangular selection to configure */
1329
- selection: RectangularSelection;
1330
- /** Handles update of selection */
1331
- updateSelection: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
1332
- /** If disabled */
1333
- disabled?: boolean;
1334
- }
1335
-
1336
- /**
1337
- * Represents scatter data.
1338
- * @interface {object} ScatterData
1339
- * @member {string} key - The key.
1340
- * @member {MP_NDArray} xData - The x data.
1341
- * @member {MP_NDArray} yData - The y data.
1342
- * @member {MP_NDArray} dataArray - The z data.
1343
- * @member {Domain} domain - The z data domain.
1344
- * @member {ColorMap} [colourMap] - The colour map.
535
+ * Represent scatter data.
1345
536
  */
1346
537
  declare interface ScatterData {
1347
- /** The key */
1348
- key: string;
1349
- /** The x data */
1350
- xData: MP_NDArray;
1351
- /** The y data */
1352
- yData: MP_NDArray;
1353
- /** The z data */
1354
- dataArray: MP_NDArray;
1355
- /** The z data domain */
1356
- domain: Domain;
1357
- /** The colour map */
538
+ /** The x values for the scatter plot */
539
+ x: NDT;
540
+ /** The y values for the scatter plot */
541
+ y: NDT;
542
+ /** The values at each point in the scatter plot */
543
+ pointValues: NDT;
544
+ /** The domain of the z axis */
545
+ domain?: Domain;
546
+ /** The size of the data points */
547
+ pointSize?: number;
548
+ /** The colour map (optional) */
1358
549
  colourMap?: ColorMap;
1359
550
  }
1360
551
 
1361
552
  /**
1362
- * A scatter data message.
1363
- * @interface {object} ScatterDataMessage
1364
- * @extends {DataMessage}
1365
- * @member {ScatterData} sc_data - The scatter data.
1366
- */
1367
- export declare interface ScatterDataMessage extends DataMessage {
1368
- /** The scatter data */
1369
- sc_data: ScatterData;
1370
- }
1371
-
1372
- /**
1373
- *
1374
- * Renders a scatter plot.
553
+ * Render a scatter plot.
1375
554
  * @param {ScatterPlotProps} props - The component props.
1376
555
  * @returns {JSX.Element} The rendered component.
1377
556
  */
1378
557
  export declare function ScatterPlot(props: ScatterPlotProps): JSX_2.Element;
1379
558
 
559
+ declare type ScatterPlotCustomizationProps = Omit<ScatterPlotProps, 'pointValues' | 'x' | 'y'>;
560
+
1380
561
  /**
1381
- * The props for the `ScatterPlotProps` component.
1382
- * @interface {object} ScatterPlotProps
1383
- * @extends {PlotSelectionProps}
1384
- * @member {NdArray<TypedArray>} xData - The x data values for the scatter plot.
1385
- * @member {NdArray<TypedArray>} yData - The y data values for the scatter plot.
1386
- * @member {NdArray<TypedArray>} dataArray - The z data values for the scatter plot.
1387
- * @member {Domain} domain - The domain of the z axis.
1388
- * @member {DAxesParameters} axesParameters - The axes parameters.
1389
- * @member {ColorMap} [colourMap] - The colour map.
562
+ * Props for the `ScatterPlotProps` component.
1390
563
  */
1391
- export declare interface ScatterPlotProps extends PlotSelectionProps {
1392
- /** The x data values for the scatter plot */
1393
- xData: NdArray<TypedArray>;
1394
- /** The y data values for the scatter plot */
1395
- yData: NdArray<TypedArray>;
1396
- /** The z data values for the scatter plot */
1397
- dataArray: NdArray<TypedArray>;
1398
- /** The domain of the z axis */
1399
- domain: Domain;
1400
- /** The axes parameters */
1401
- axesParameters: DAxesParameters;
1402
- /** The colour map (optional) */
1403
- colourMap?: ColorMap;
564
+ export declare interface ScatterPlotProps extends PlotBaseProps, ScatterData {
565
+ /** Function to update data point size */
566
+ setPointSize?: (p: number) => void;
1404
567
  }
1405
568
 
1406
569
  /**
1407
- * Represents a selection.
1408
- * @interface {object} Selection
1409
- * @member {Points} html - The html points.
1410
- * @member {Points} world - The world points.
1411
- * @member {Points} data - The data points.
570
+ * Base for Selection
1412
571
  */
1413
- declare interface Selection_2 {
1414
- /** The html points */
1415
- html: Points;
1416
- /** The world points */
1417
- world: Points;
1418
- /** The data points */
1419
- data: Points;
1420
- }
1421
- export { Selection_2 as Selection }
1422
-
1423
- export declare const SELECTION_ICONS: {
1424
- line: string;
1425
- rectangle: string;
1426
- polyline: string;
1427
- polygon: string;
1428
- circle: string;
1429
- ellipse: string;
1430
- sector: string;
1431
- horizontalAxis: string;
1432
- verticalAxis: string;
1433
- unknown: string;
1434
- };
1435
-
1436
572
  export declare interface SelectionBase {
573
+ /** identity */
1437
574
  readonly id: string;
575
+ /** name */
1438
576
  name: string;
577
+ /** default colour */
578
+ defaultColour: string;
579
+ /** outline colour */
1439
580
  colour?: string;
581
+ /** opacity [0,1] */
1440
582
  alpha: number;
583
+ /** if true, not moveable */
1441
584
  fixed: boolean;
585
+ /** start (or centre) point coordinate */
1442
586
  start: [number, number];
587
+ /** if true, outline is dashed */
1443
588
  asDashed?: boolean;
1444
- getPoints?: () => Vector3[];
1445
- onHandleChange: _HandleChangeFunction;
589
+ /** set start */
590
+ setStart: (i: number, v: number) => void;
591
+ /** retrieve points */
592
+ getPoints: () => Vector3[];
593
+ /** callback for drag handle movements */
594
+ onHandleChange: HandleChangeFunction;
595
+ /** string representation */
1446
596
  toString: () => string;
1447
597
  }
1448
598
 
1449
599
  /**
1450
- *
1451
- * Renders a selection component.
1452
- * @param {SelectionComponentProps} props - The component props.
1453
- * @returns {JSX.Element | null} The rendered component.
1454
- */
1455
- export declare function SelectionComponent(props: SelectionComponentProps): JSX_2.Element;
1456
-
1457
- /**
1458
- * The props for the `SelectionComponent` component.
1459
- * @interface {object} SelectionComponentProps
1460
- * @extends {PlotSelectionProps}
1461
- * @member {SelectionType} [selectionType] - The selection type.
1462
- * @member {ModifierKey | ModifierKey[]} modifierKey - The modifier key(s).
1463
- * @member {BatonProps} [batonProps] - The baton props.
1464
- * @member {boolean} [disabled] - If disabled.
1465
- */
1466
- export declare interface SelectionComponentProps extends PlotSelectionProps {
1467
- /** The selection type (optional) */
1468
- selectionType?: SelectionType;
1469
- /** The modifier key(s) */
1470
- modifierKey: ModifierKey | ModifierKey[];
1471
- /** The baton props */
1472
- batonProps?: BatonProps;
1473
- /** If disabled (optional) */
1474
- disabled?: boolean;
1475
- }
1476
-
1477
- /**
1478
- *
1479
- * Renders the configuration options for a selection.
1480
- * @param {SelectionConfigProps} props - The component props.
1481
- * @returns {JSX.Element} The rendered component.
1482
- */
1483
- export declare function SelectionConfig(props: SelectionConfigProps): (JSX_2.Element | null)[];
1484
-
1485
- /**
1486
- * The props for the `SelectionConfig` component.
1487
- * @interface {object} SelectionConfigProps
1488
- * @member {string} title - The modal title.
1489
- * @member {BaseSelection[]} selections - The current selections.
1490
- * @member {(s: SelectionBase | null, b?: boolean, c?: boolean) => void} updateSelections - Handles updating selections.
1491
- * @member {string | null} currentSelectionID - The ID of the current selection.
1492
- * @member {(s: string | null) => void} updateCurrentSelectionID - Handles updating current selection ID.
1493
- * @member {SelectionType} showSelectionConfig - If the selection config is shown.
1494
- * @member {(s: boolean) => void} updateShowSelectionConfig - Handles updating showSelectionConfig.
1495
- * @member {boolean} hasBaton - If has control of the baton.
1496
- * @member {IIConType} [icon] - The icon.
1497
- * @member {string} [label] - The label.
1498
- * @member {Domain} [domain] - The data domain.
1499
- * @member {CustomDomain} [customDomain] - The custom data domain.
1500
- */
1501
- export declare interface SelectionConfigProps {
1502
- /** The modal title */
1503
- title: string;
1504
- /** The current selections */
1505
- selections: BaseSelection[];
1506
- /** Handles updating selections */
1507
- updateSelections: (s: SelectionBase | null, b?: boolean, c?: boolean) => void;
1508
- /** The ID of the current selection (optional) */
1509
- currentSelectionID: string | null;
1510
- /** Handles updating current selection ID */
1511
- updateCurrentSelectionID: (s: string | null) => void;
1512
- /** If the selection config is shown */
1513
- showSelectionConfig: boolean;
1514
- /** Handles updating showSelectionConfig */
1515
- updateShowSelectionConfig: (s: boolean) => void;
1516
- /** If has control of the baton */
1517
- hasBaton: boolean;
1518
- /** The icon (optional) */
1519
- icon?: IIconType;
1520
- /** The label (optional) */
1521
- label?: string;
1522
- /** The data domain (optional) */
1523
- domain?: Domain;
1524
- /** The custom data domain (optional) */
1525
- customDomain?: CustomDomain;
1526
- }
1527
-
1528
- /**
1529
- *
1530
- * The props for the `SelectionDropdown` component.
1531
- * @interface SelectionDropdownProps
1532
- * @member {SelectionType} value - The chosen selection type.
1533
- * @member {(selectionType: SelectionType) => void} onSelectionTypeChange - Function that handles change in chosen selection type.
1534
- * @member {boolean} disabled - If component is disabled.
1535
- * @member {SelectionType[]} [options] - The set of selection type options that are available in the dropdown.
1536
- */
1537
- export declare interface SelectionDropdownProps {
1538
- /** The chosen selection type */
1539
- value: SelectionType;
1540
- /** Function that handles change in chosen selection type */
1541
- onSelectionTypeChange: (selectionType: SelectionType) => void;
1542
- /** If component is disabled */
1543
- disabled: boolean;
1544
- /** The set of selection type options that are available in the dropdown */
1545
- options?: SelectionType[];
1546
- }
1547
-
1548
- /**
1549
- *
1550
- * Renders a dropdown for choosing selection.
1551
- * @param {SelectionIDDropdownProps} props - The component props.
1552
- * @returns {JSX.Element} The rendered component.
600
+ * Selection handler
601
+ * @returns ID of changed selection
1553
602
  */
1554
- export declare function SelectionIDDropdown(props: SelectionIDDropdownProps): JSX_2.Element;
603
+ export declare type SelectionHandler = (selection: SelectionBase | null,
604
+ /** if true, update server with selection */
605
+ broadcast?: boolean,
606
+ /** if true, remove selection */
607
+ clear?: boolean) => string | null;
1555
608
 
1556
609
  /**
1557
- *
1558
- * The props for the `SelectionIDDropdown` component.
1559
- * @interface SelectionIDDropdownProps
1560
- * @member {SelectionBase[]} selections - The selections.
1561
- * @member {string | null} selectionID - The ID of the highlighted selection.
1562
- * @member {(s: string) => void} onSelectionIDChange - Function that handles change in chosen selection ID.
1563
- * @member {string[]} [options] - The selections from which to choose.
610
+ * Supported types of selections
1564
611
  */
1565
- export declare interface SelectionIDDropdownProps {
1566
- /** The selections */
1567
- selections: SelectionBase[];
1568
- /** The ID of the highlighted selection */
1569
- selectionID: string | null;
1570
- /** Function that handles change in chosen selection ID */
1571
- onSelectionIDChange: (s: string) => void;
1572
- /** The selections from which to choose */
1573
- options?: string[];
1574
- }
1575
-
1576
- /**
1577
- * A selections message.
1578
- * @interface {object} SelectionsMessage
1579
- * @member {SelectionBase[]} set_selections - The selections.
1580
- */
1581
- export declare interface SelectionsMessage {
1582
- /** The selections */
1583
- set_selections: SelectionBase[];
1584
- }
1585
-
1586
612
  export declare enum SelectionType {
1587
613
  line = "line",
1588
614
  rectangle = "rectangle",
@@ -1597,124 +623,64 @@ export declare enum SelectionType {
1597
623
  }
1598
624
 
1599
625
  /**
1600
- *
1601
- * Renders a dropdown for choosing selection type.
1602
- * @param {SelectionDropdownProps} props - The component props.
1603
- * @returns {JSX.Element} The rendered component.
1604
- */
1605
- export declare function SelectionTypeDropdown(props: SelectionDropdownProps): JSX_2.Element;
1606
-
1607
- export declare type StatusType = 'ready' | 'busy';
1608
-
1609
- /**
1610
- *
1611
- * Represents surface data.
1612
- * @interface SurfaceData
1613
- * @member {string} key - The key.
1614
- * @member {MP_NDArray} values - The surface data values.
1615
- * @member {Domain} domain - The surface data domain.
1616
- * @member {string} surface_scale - The surface data scale.
1617
- * @member {ColorMap} colourMap - The surface colour map.
626
+ * Represent surface data
1618
627
  */
1619
628
  export declare interface SurfaceData {
1620
- /** The key */
1621
- key: string;
1622
- /** The surface data values */
1623
- values: MP_NDArray;
1624
- /** The surface data domain */
1625
- domain: Domain;
1626
- /** The surface data scale */
1627
- surface_scale: string;
1628
- /** The surface colour map */
1629
- colourMap: ColorMap;
1630
- }
1631
-
1632
- /**
1633
- * A surface data message.
1634
- * @interface {object} SurfaceDataMessage
1635
- * @extends {DataMessage}
1636
- * @member {SurfaceData} su_data - The surface data.
1637
- */
1638
- export declare interface SurfaceDataMessage extends DataMessage {
1639
- /** The surface data */
1640
- su_data: SurfaceData;
629
+ /** The height values for the surface */
630
+ heightValues: NDT;
631
+ /** The domain of the surface data */
632
+ domain?: Domain;
633
+ /** The colour scale type */
634
+ surfaceScale?: ColorScaleType;
635
+ /** The colour map (optional) */
636
+ colourMap?: ColorMap;
637
+ /** Show points if true */
638
+ showPoints?: boolean;
1641
639
  }
1642
640
 
1643
641
  /**
1644
- *
1645
- * Renders a surface plot.
642
+ * Render a surface plot.
1646
643
  * @param {SurfacePlotProps} props - The component props.
1647
644
  * @returns {JSX.Element} The rendered component.
1648
645
  */
1649
646
  export declare function SurfacePlot(props: SurfacePlotProps): JSX_2.Element;
1650
647
 
648
+ declare type SurfacePlotCustomizationProps = Omit<SurfacePlotProps, 'heightValues'>;
649
+
1651
650
  /**
1652
- * The props for the `SurfacePlot` component.
1653
- * @interface {object} SurfacePlotProps
1654
- * @extends {PlotSelectionProps}
1655
- * @member {NdArray<TypedArray>} values - The data values for the surface plot.
1656
- * @member {Domain} domain - The domain of the surface data.
1657
- * @member {DAxesParameters} axesParameters - The axes parameters.
1658
- * @member {ColorScaleType} surfaceScale - The colour scale type.
1659
- * @member {ColorMap} [colourMap] - The colour map.
651
+ * Props for the `SurfacePlot` component.
1660
652
  */
1661
- export declare interface SurfacePlotProps extends PlotSelectionProps {
1662
- /** The data values for the surface plot */
1663
- values: NdArray<TypedArray>;
1664
- /** The domain of the surface data */
1665
- domain: Domain;
1666
- /** The axes parameters */
1667
- axesParameters: DAxesParameters;
1668
- /** The colour scale type */
1669
- surfaceScale: ColorScaleType;
1670
- /** The colour map (optional) */
1671
- colourMap?: ColorMap;
653
+ export declare interface SurfacePlotProps extends SurfaceData {
654
+ /** The baton props */
655
+ batonProps?: BatonProps;
656
+ /** The plot configuration */
657
+ plotConfig: PlotConfig;
658
+ /**
659
+ * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar,
660
+ * otherwise use given children
661
+ */
662
+ customToolbarChildren?: React.ReactNode;
1672
663
  }
1673
664
 
1674
- /**
1675
- *
1676
- * Represents table data.
1677
- * @interface TableData
1678
- * @member {string} key - The key.
1679
- * @member {MP_NDArray} values - The table data values.
1680
- * @member {number} cellWidth - The individual cell width.
1681
- * @member {TableDisplayParams} [displayParams] - The table display parameters.
1682
- */
665
+ /** Represent table data */
1683
666
  declare interface TableData {
1684
- /** The key */
1685
- key: string;
1686
- /** The table data values */
1687
- dataArray: MP_NDArray;
1688
- /** The individual cell width */
667
+ /** The cell values */
668
+ cellValues: NDT;
669
+ /** The cell width */
1689
670
  cellWidth: number;
1690
- /** The table display parameters (optional) */
671
+ /** The parameters for the table display (optional) */
1691
672
  displayParams?: TableDisplayParams;
1692
673
  }
1693
674
 
1694
675
  /**
1695
- * A table data message.
1696
- * @interface {object} TableDataMessage
1697
- * @extends {DataMessage}
1698
- * @member {TableData} ta_data - The table data.
1699
- */
1700
- export declare interface TableDataMessage extends DataMessage {
1701
- /** The table data */
1702
- ta_data: TableData;
1703
- }
1704
-
1705
- /**
1706
- *
1707
- * Renders a table display.
676
+ * Render a table display.
1708
677
  * @param {TableDisplayProps} props - The component props.
1709
678
  * @returns {JSX.Element} The rendered component.
1710
679
  */
1711
680
  export declare function TableDisplay(props: TableDisplayProps): JSX_2.Element;
1712
681
 
1713
682
  /**
1714
- * The parameters for a `TableDisplay`.
1715
- * @interface {object} TableDisplayParams
1716
- * @member {TableDisplayType} [displayType] - The table display type.
1717
- * @member {number} [numberDigits] - The number of digits to display for each data value.
683
+ * Parameters for `TableDisplay`.
1718
684
  */
1719
685
  export declare interface TableDisplayParams {
1720
686
  /** The table display type (optional) */
@@ -1724,73 +690,25 @@ export declare interface TableDisplayParams {
1724
690
  }
1725
691
 
1726
692
  /**
1727
- * The props for the `TableDisplay` component.
1728
- * @interface {object} TableDisplayProps
1729
- * @extends {PlotSelectionProps}
1730
- * @member {number} cellWidth - The cell width.
1731
- * @member {NdArray<TypedArray>} dataArray - The data for the table display.
1732
- * @member {TableDisplayParams} [displayParams] - The parameters for the table display.
693
+ * Props for the `TableDisplay` component.
1733
694
  */
1734
- export declare interface TableDisplayProps extends PlotSelectionProps {
1735
- /** The cell width */
1736
- cellWidth: number;
1737
- /** The data for the table display */
1738
- dataArray: NdArray<TypedArray>;
1739
- /** The parameters for the table display (optional) */
1740
- displayParams?: TableDisplayParams;
695
+ export declare interface TableDisplayProps extends TableData {
696
+ /** The baton props */
697
+ batonProps?: BatonProps;
1741
698
  }
1742
699
 
700
+ /** Number represent in table */
1743
701
  export declare type TableDisplayType = 'scientific' | 'standard';
1744
702
 
1745
703
  /**
1746
- * An update selections message.
1747
- * @interface {object} UpdateSelectionsMessage
1748
- * @member {SelectionBase[]} update_selections - The selections to update.
704
+ * @returns context for customizing a plot
1749
705
  */
1750
- export declare interface UpdateSelectionsMessage {
1751
- /** The selections to update */
1752
- update_selections: SelectionBase[];
1753
- }
1754
-
1755
- export declare function validateHtml(html: Points, selectionType: SelectionType): boolean;
1756
-
1757
- /**
1758
- *
1759
- * Renders a labelled inout for x.
1760
- * @param {XInputProps} props - The component props.
1761
- * @returns {JSX.Element} The rendered component.
1762
- */
1763
- export declare function XInput(props: XInputProps): JSX_2.Element;
1764
-
1765
- declare interface XInputProps {
1766
- selection: BaseSelection;
1767
- updateSelection: (s: BaseSelection) => void;
1768
- disabled?: boolean;
1769
- }
1770
-
1771
- /**
1772
- *
1773
- * Renders a labelled input for y.
1774
- * @param {YInputProps} props - The component props.
1775
- * @returns {JSX.Element} The rendered component.
1776
- */
1777
- export declare function YInput(props: YInputProps): JSX_2.Element;
1778
-
1779
- /**
1780
- *
1781
- * The props for the `YInput` component.
1782
- * @interface YInputProps
1783
- * @member {BaseSelection} selection - The selection for which the y values are being configured.
1784
- * @member {(s: BaseSelection) => void} updateSelection - Function to handle updating y of selection.
1785
- * @member {boolean} [disabled] - If input component is disabled.
1786
- */
1787
- declare interface YInputProps {
1788
- /** The selection for which the y values are being configured */
1789
- selection: BaseSelection;
1790
- /** Function to handle updating y of selection */
1791
- updateSelection: (s: BaseSelection) => void;
1792
- /** If input component is disabled (optional) */
1793
- disabled?: boolean;
1794
- }
706
+ export declare function usePlotCustomizationContext(): PlotCustomizationContextValue;
1795
707
 
1796
708
  export { }
709
+
710
+
711
+ declare namespace DomainConfig {
712
+ var displayName: string;
713
+ }
714
+