@visuallyjs/browser-ui-svelte 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 (43) hide show
  1. package/AreaChartComponent.svelte +37 -0
  2. package/BarChartComponent.svelte +37 -0
  3. package/BubbleChartComponent.svelte +38 -0
  4. package/ColorPickerComponent.svelte +94 -0
  5. package/ColumnChartComponent.svelte +38 -0
  6. package/ControlsComponent.svelte +66 -0
  7. package/DecoratorComponent.svelte +55 -0
  8. package/DefaultGroupComponent.svelte +5 -0
  9. package/DefaultNodeComponent.svelte +5 -0
  10. package/DiagramComponent.svelte +46 -0
  11. package/DiagramPaletteComponent.svelte +47 -0
  12. package/DiagramProvider.svelte +9 -0
  13. package/EdgeTypePickerComponent.svelte +47 -0
  14. package/ExportControlsComponent.svelte +94 -0
  15. package/GaugeChartComponent.svelte +31 -0
  16. package/InspectorComponent.svelte +79 -0
  17. package/LineChartComponent.svelte +38 -0
  18. package/MiniviewComponent.svelte +73 -0
  19. package/PaletteComponent.svelte +73 -0
  20. package/PieChartComponent.svelte +37 -0
  21. package/SankeyChartComponent.svelte +44 -0
  22. package/ScatterChartComponent.svelte +38 -0
  23. package/ShapeComponent.svelte +66 -0
  24. package/ShapePaletteComponent.svelte +82 -0
  25. package/SurfaceComponent.svelte +270 -0
  26. package/SurfaceProvider.svelte +9 -0
  27. package/WrapperComponent.svelte +27 -0
  28. package/XYChartComponent.svelte +32 -0
  29. package/components.d.ts +29 -0
  30. package/components.js +29 -0
  31. package/definitions.d.ts +841 -0
  32. package/definitions.js +1 -0
  33. package/diagram-store.d.ts +30 -0
  34. package/diagram-store.js +58 -0
  35. package/index.d.ts +27 -0
  36. package/index.js +33 -0
  37. package/inspector-store.d.ts +24 -0
  38. package/inspector-store.js +42 -0
  39. package/package.json +1 -0
  40. package/store-adapter.d.ts +15 -0
  41. package/store-adapter.js +47 -0
  42. package/surface-store.d.ts +41 -0
  43. package/surface-store.js +73 -0
@@ -0,0 +1,841 @@
1
+ import type { DOMAttributes } from "svelte/elements";
2
+ import { SurfaceOptions, Vertex, Group, Node, ControlsComponentButtons, DataGeneratorFunction, type BrowserElement, Base, Size, ObjectData, DropTargetInfo, PaletteMode, SvgExportUIOptions, ImageExportUIOptions, ShapeLibraryImpl, ModelOptions, DiagramOptions, ColumnChartOptions, BarChartOptions, CategoryValueChartOptions, Diagram, DiagramCell, NodeMapping, GroupMapping, PortMapping, Surface, EdgeMapping, OnVertexAddedCallback, CanvasDropFilter, LineChartOptions, AreaChartOptions, PieChartOptions, ScatterChartOptions, BubbleChartOptions, GaugeChartOptions, SankeyOptions, FontSpec, BrowserUIModel, PreparedShape, ChartModelFilter, VisuallyJsDefaultJSON, PointXY, FixedElementConstraints } from "@visuallyjs/browser-ui";
3
+ import { type Snippet } from "svelte";
4
+ /**
5
+ * Render options for a SurfaceComponent. This interface is the same as SurfaceOptions but with several vanilla-only options removed.
6
+ */
7
+ export interface SvelteSurfaceRenderOptions extends Omit<SurfaceOptions, "directRender" | "enhancedView" | "view" | "templates"> {
8
+ }
9
+ /**
10
+ * Definition of a node - its component, and behaviour.
11
+ */
12
+ export interface SvelteNodeMapping extends Omit<NodeMapping<any>, "template" | "templateId" | "parameters"> {
13
+ /**
14
+ * component used to render this node type. Optional; if you do not supply it a default component will be used.
15
+ */
16
+ component?: any;
17
+ }
18
+ /**
19
+ * Definition of a group - its component, and behaviour.
20
+ */
21
+ export interface SvelteGroupMapping extends Omit<GroupMapping<any>, "template" | "templateId" | "parameters"> {
22
+ /**
23
+ * component used to render this group type. Optional; if you do not supply it a default component will be used.
24
+ */
25
+ component?: any;
26
+ }
27
+ /**
28
+ * Definition of a port - its component, and behaviour.
29
+ */
30
+ export interface SveltePortMapping extends Omit<PortMapping<any>, "template" | "templateId" | "parameters"> {
31
+ /**
32
+ * component used to render this port type. Optional; if you do not supply it a default component will be used.
33
+ */
34
+ component?: any;
35
+ }
36
+ /**
37
+ * Spec for a react component overlay. A ctx object is passed in to your component and you are expected to return JSX.
38
+ */
39
+ /**
40
+ * Edge mappings for a view.
41
+ */
42
+ /**
43
+ * Mapping definition for edges in a Svelte view.
44
+ */
45
+ export interface SvelteEdgeMapping extends EdgeMapping {
46
+ }
47
+ /**
48
+ * Options for the view in the Svelte surface component. Maps node/group/port/edge types to components and behaviour.
49
+ */
50
+ export interface SvelteSurfaceViewOptions {
51
+ /**
52
+ * Optional node mappings
53
+ */
54
+ nodes?: Record<string, SvelteNodeMapping>;
55
+ /**
56
+ * Optional group mappings
57
+ */
58
+ groups?: Record<string, SvelteGroupMapping>;
59
+ /**
60
+ * Optional port mappings. Because of the nature of Svelte 5, separate port mappings are a little rare in VisuallyJs Svelte, but they are supported if you need them.
61
+ */
62
+ ports?: Record<string, SveltePortMapping>;
63
+ /**
64
+ * Optional edge mappings.
65
+ */
66
+ edges?: Record<string, SvelteEdgeMapping>;
67
+ }
68
+ /**
69
+ * @group Props
70
+ */
71
+ export interface SurfaceComponentProps extends DOMAttributes<HTMLDivElement> {
72
+ /**
73
+ * @internal
74
+ */
75
+ children?: Snippet;
76
+ /**
77
+ * Optional class name to set on the surface component's container
78
+ */
79
+ className?: string;
80
+ /**
81
+ * Render options for the Surface.
82
+ */
83
+ renderOptions?: SvelteSurfaceRenderOptions;
84
+ /**
85
+ * View options for the Surface.
86
+ */
87
+ viewOptions?: SvelteSurfaceViewOptions;
88
+ /**
89
+ * Options for the underlying model instance.
90
+ */
91
+ modelOptions?: ModelOptions;
92
+ /**
93
+ * Optional Visually JS instance to use. If this is not provided, a Visually JS instance will be created, with `modelOptions` if you provide them.
94
+ */
95
+ model?: BrowserUIModel;
96
+ /**
97
+ * Optional function that is used to generate a set of props for a given vertex before rendering it. This provides a mechanism for you to inject specific items into the components you use to render your vertices. The return value of this function should be `Record<string, any>`. It may be null.
98
+ */
99
+ injector?: (v: Vertex) => Record<string, any>;
100
+ /**
101
+ * Optional data to load after the component has been mounted.
102
+ */
103
+ data?: any;
104
+ /**
105
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
106
+ */
107
+ url?: string;
108
+ /**
109
+ * Shape library to use to render SVG shapes. Optional.
110
+ */
111
+ shapeLibrary?: ShapeLibraryImpl<ObjectData>;
112
+ }
113
+ /**
114
+ * @group Props
115
+ */
116
+ export interface MiniviewComponentProps extends DOMAttributes<HTMLDivElement> {
117
+ /**
118
+ * Defaults to true, determines whether or not the miniview can be collapsed.
119
+ */
120
+ collapsible?: boolean;
121
+ /**
122
+ * Optional function to use to derive a type for each rendered node/group. This is written onto the corresponding element as the value of the `data-vjs-miniview-type` attribute, and can be useful for styling.
123
+ */
124
+ typeFunction?: (v: Node | Group) => string;
125
+ /**
126
+ * Optional override for how sensitive the wheel zoom should be.
127
+ */
128
+ wheelSensitivity?: number;
129
+ /**
130
+ * Optional filter for elements to display. Defaults to undefined - all elements displayed.
131
+ * @param v
132
+ */
133
+ elementFilter?: (v: Vertex) => boolean;
134
+ /**
135
+ * Defaults to true, Whether or not to enable the wheel zoom.
136
+ */
137
+ enableWheelZoom?: boolean;
138
+ /**
139
+ * Defaults to true. Whether or not the miniview is initially visible.
140
+ */
141
+ visible?: boolean;
142
+ /**
143
+ * Defaults to false. Whether or not to reverse the zoom direction in response to a wheel event.
144
+ */
145
+ wheelReverse?: boolean;
146
+ /**
147
+ * Defaults to true, meaning the miniview actively updates as nodes/groups are dragged on the related surface. If this is set to false, the miniview only updates after mouseup.
148
+ */
149
+ activeTracking?: boolean;
150
+ /**
151
+ * Defaults to true, meaning a click on a node/group in the miniview will cause that node/group to be centered in the related surface.
152
+ */
153
+ clickToCenter?: boolean;
154
+ /**
155
+ * Optional class name to set on the miniview component's container
156
+ */
157
+ className?: string;
158
+ }
159
+ /**
160
+ * @group Props
161
+ */
162
+ export interface ControlsComponentProps extends DOMAttributes<HTMLDivElement> {
163
+ /**
164
+ * Whether or not to show the clear button, defaults to true.
165
+ */
166
+ clear?: boolean;
167
+ /**
168
+ * Whether or not to show undo/redo buttons, defaults to true
169
+ */
170
+ undoRedo?: boolean;
171
+ /**
172
+ * Whether or not to show the zoom to extents button, defaults to true
173
+ */
174
+ zoomToExtents?: boolean;
175
+ /**
176
+ * Whether or not to show the zoom in/zoom out buttons, defaults to false
177
+ */
178
+ zoomButtons?: boolean;
179
+ /**
180
+ * Optional message to show the user when prompting them to confirm they want to clear the dataset
181
+ */
182
+ clearMessage?: string;
183
+ /**
184
+ * Optional extra buttons to add to the controls component.
185
+ */
186
+ buttons?: ControlsComponentButtons;
187
+ /**
188
+ * Optional orientation for the controls. Defaults to 'row'.
189
+ */
190
+ orientation?: "row" | "column";
191
+ /**
192
+ * Optional class name to set on the control component's container
193
+ */
194
+ className?: string;
195
+ }
196
+ /**
197
+ * @group Props
198
+ */
199
+ export interface PaletteComponentProps extends DOMAttributes<HTMLDivElement> {
200
+ /**
201
+ * @internal
202
+ */
203
+ children?: Snippet;
204
+ /**
205
+ * Optional class name to set on the component's root element.
206
+ */
207
+ className?: string;
208
+ /**
209
+ * CSS selector identifying draggable elements. Defaults to '[data-vjs-type]'
210
+ */
211
+ selector?: string;
212
+ /**
213
+ * Function to invoke to get a payload for an element that is being dragged/has been tapped. Defaults to a function that extracts `type` from the element via its `data-vjs-type` attribute.
214
+ */
215
+ dataGenerator?: DataGeneratorFunction<BrowserElement>;
216
+ /**
217
+ * Optional function to invoke after a vertex has been added
218
+ */
219
+ onVertexAdded?: OnVertexAddedCallback;
220
+ /**
221
+ * Defaults to false. When true, a newly added vertex is set as the model's current selection.
222
+ */
223
+ selectAfterAdd?: boolean;
224
+ /**
225
+ * Optional size for elements dragged from the palette; used in drag mode only.
226
+ */
227
+ dragSize?: Size;
228
+ /**
229
+ * Optional filter to use to decide at run time which elements may be dragged/dropped
230
+ */
231
+ canvasDropFilter?: CanvasDropFilter<BrowserElement>;
232
+ /**
233
+ * Mode to operate in - 'drag', 'tap' or 'draw'. Defaults to 'drag'.
234
+ */
235
+ mode?: PaletteMode;
236
+ /**
237
+ * When in draw mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drag to draw functionality also still works)
238
+ */
239
+ allowClickToAdd?: boolean;
240
+ /**
241
+ * This flag relates to "draw" mode, and defaults to false. When true, the palette only supports click to draw new vertices, not drag. This flag is forced to true if the associated UI does not have `useModelForSizes` set, since there is no point in allowing a user to drag a vertex to some size if its not going to be honoured. When you set this flag and associated UI does have `useModelForSizes` set, the palette will use default sizes for new nodes/groups.
242
+ */
243
+ clickToAddOnly?: boolean;
244
+ /**
245
+ * Whether or not to allow drop on edge. Defaults to false.
246
+ */
247
+ allowDropOnEdge?: boolean;
248
+ /**
249
+ * Whether or not to allow drop on whitespace in the canvas. Defaults to true.
250
+ */
251
+ allowDropOnCanvas?: boolean;
252
+ /**
253
+ * Whether or not to allow drop on existing vertices. Defaults to true.
254
+ */
255
+ allowDropOnGroup?: boolean;
256
+ /**
257
+ * Defaults to false. Allows items to be dropped onto nodes in the canvas. If this is true and an element is dropped onto a node, the result is the same as if the element has been dropped onto whitespace. Note that when this is false and the user has dragged something over a node, the drag item is still not considered to be over the canvas, and releasing the mouse button at that time will not cause a new node to be added. Use `ignoreDropOnNode` if that's the behaviour you want.
258
+ */
259
+ allowDropOnNode?: boolean;
260
+ /**
261
+ * Defaults to false. When true, the palette treats nodes as if they are part of the canvas - a user can drag new items on top of existing nodes and the new item will be added to the canvas. If you want to force your users to drop on canvas whitespace, don't set this. Note that this flag will force `allowDropOnNode` to `false`.
262
+ */
263
+ ignoreDropOnNode?: boolean;
264
+ }
265
+ /**
266
+ * @group Props
267
+ */
268
+ export interface InspectorComponentProps extends DOMAttributes<HTMLDivElement> {
269
+ /**
270
+ * Optional style to set on the component's root element.
271
+ */
272
+ style?: string;
273
+ /**
274
+ * Optional class name to set on the component's root element.
275
+ */
276
+ className?: string;
277
+ /**
278
+ * Callback invoked when the inspector is cleared.
279
+ * @internal
280
+ */
281
+ renderEmptyContainer: () => void;
282
+ /**
283
+ * Callback invoked when a new object has started to be edited.
284
+ * @param obj
285
+ * @param cb
286
+ */
287
+ refresh: (obj: Base) => void;
288
+ /**
289
+ * Optional filter function that you can supply if you want to ignore certain objects in your dataset.
290
+ */
291
+ filter?: (obj: Base) => boolean;
292
+ /**
293
+ * Whether or not to allow multiple objects to be selected and edited at once.
294
+ * Defaults to false.
295
+ */
296
+ multipleSelections?: boolean;
297
+ /**
298
+ * Whether or not to auto commit changes on blur or enter keypress. Defaults to true.
299
+ */
300
+ autoCommit?: boolean;
301
+ }
302
+ /**
303
+ * @group Props
304
+ */
305
+ export interface ShapePaletteComponentProps extends DOMAttributes<HTMLDivElement> {
306
+ /**
307
+ * Optional class name to set on the container
308
+ */
309
+ className?: string;
310
+ /**
311
+ * Optional size to use for dragged elements.
312
+ */
313
+ dragSize?: Size;
314
+ /**
315
+ * Optional fill color to use for dragged elements. This should be in RGB format, _not_ a color like 'white' or 'cyan' etc. Defaults to "#000000"
316
+ */
317
+ fill?: string;
318
+ /**
319
+ * Optional color to use for outline of dragged elements. Should be in RGB format.
320
+ */
321
+ outline?: string;
322
+ /**
323
+ * Message to use for the 'show all' option in the shape set drop down when there is more than one set of shapes. Defaults to `Show all`.
324
+ */
325
+ showAllMessage?: string;
326
+ /**
327
+ * When true (which is the default), a newly dropped vertex will be set as the underlying model's selection.
328
+ */
329
+ selectAfterDrop?: boolean;
330
+ /**
331
+ * Stroke width to use for shapes in palette. Defaults to 1.
332
+ */
333
+ paletteStrokeWidth?: number;
334
+ /**
335
+ * Optional data generator to allow you to specify initial data for some element to be dragged. Note that you cannot override the object's `type` with this function. The palette will set the new object's type to match the type of the element that the user is dragging from the palette.
336
+ */
337
+ dataGenerator?: DataGeneratorFunction<ObjectData>;
338
+ /**
339
+ * Optional size to use for icons. Defaults to 150x100 pixels. If you provide this but not `dragSize` this size will also be used for an icon that is being dragged.
340
+ */
341
+ iconSize?: Size;
342
+ /**
343
+ * Optional ID of the first set to show, hiding the others.
344
+ */
345
+ initialSet?: string;
346
+ /**
347
+ * Optionally show each icon's label underneath it
348
+ */
349
+ showLabels?: boolean;
350
+ /**
351
+ * Optional callback to invoke when a new vertex has been added
352
+ * @param v
353
+ * @param dropTarget
354
+ */
355
+ onVertexAdded?: (v: Vertex, dropTarget?: DropTargetInfo) => any;
356
+ /**
357
+ * Mode to operate in - 'drag' or 'tap'. Defaults to 'drag' (DROP_MANAGER_MODE_DRAG).
358
+ */
359
+ mode?: PaletteMode;
360
+ /**
361
+ * When in tap mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drawing method also still works)
362
+ */
363
+ allowClickToAdd?: boolean;
364
+ /**
365
+ * Defaults to true: when in 'tap' mode and a new group/node has been drawn on the canvas, the surface is set back to pan mode.
366
+ */
367
+ autoExitDrawMode?: boolean;
368
+ /**
369
+ * Indicates two things: first, when one or more vertices are selected, clicking on an entry in the palette will change the type of the selected vertices to that type. Secondly, selecting an element in the canvas will cause its related shape to be selected in the palette. Defaults to true.
370
+ */
371
+ inspector?: boolean;
372
+ /**
373
+ * Optional set of prepared shapes to show in the palette. When this is provided, the palette will only render these shapes, and not the contents of the shape library.
374
+ */
375
+ preparedShapes?: Array<PreparedShape>;
376
+ }
377
+ /**
378
+ * @group Props
379
+ */
380
+ export interface ShapeComponentProps extends DOMAttributes<HTMLDivElement> {
381
+ /**
382
+ * Backing data for the vertex. Required. This is passed in as a prop to a component used to render a node/group, so you can pass it straight through from the parent to this component.
383
+ */
384
+ data: ObjectData;
385
+ /**
386
+ * Whether or not to show labels on each shape. Defaults to false.
387
+ */
388
+ showLabels?: boolean;
389
+ /**
390
+ * The name of the property containing each vertex's label. Defaults to `label`.
391
+ */
392
+ labelProperty?: string;
393
+ /**
394
+ * Stroke width to use on the text element rendering a label. Defaults to "0.25px".
395
+ */
396
+ labelStrokeWidth: string;
397
+ /**
398
+ * Optional font size/style.
399
+ */
400
+ font?: FontSpec;
401
+ }
402
+ /**
403
+ * @group Props
404
+ */
405
+ export interface EdgeTypePickerComponentProps extends DOMAttributes<HTMLDivElement> {
406
+ /**
407
+ * Name of the property in the backing data that this picker is manipulating.
408
+ */
409
+ propertyName: string;
410
+ }
411
+ /**
412
+ * @group Props
413
+ */
414
+ export interface ExportControlsComponentProps extends DOMAttributes<HTMLDivElement> {
415
+ /**
416
+ * Optional class name to set on the element.
417
+ */
418
+ className?: string;
419
+ /**
420
+ * Whether or not to show a label in front of the buttons. Defaults to true.
421
+ */
422
+ showLabel?: boolean;
423
+ /**
424
+ * What to show in the label, if visible. Defaults to "Export:".
425
+ */
426
+ label?: string;
427
+ /**
428
+ * Options for SVG exports.
429
+ */
430
+ svgOptions?: SvgExportUIOptions;
431
+ /**
432
+ * Options for image exports.
433
+ */
434
+ imageOptions?: ImageExportUIOptions;
435
+ /**
436
+ * Defaults to true.
437
+ */
438
+ allowSvgExport?: boolean;
439
+ /**
440
+ * Defaults to true.
441
+ */
442
+ allowPngExport?: boolean;
443
+ /**
444
+ * Defaults to true.
445
+ */
446
+ allowJpgExport?: boolean;
447
+ }
448
+ /**
449
+ * @group Props
450
+ */
451
+ export interface DiagramComponentProps extends DOMAttributes<HTMLDivElement> {
452
+ /**
453
+ * Options for the model used by the diagram. Only required for
454
+ * certain advanced use cases.
455
+ */
456
+ modelOptions?: ModelOptions;
457
+ /**
458
+ * Options for the diagram.
459
+ */
460
+ options?: DiagramOptions;
461
+ /**
462
+ * Optional class name to set on the diagram component's container
463
+ */
464
+ className?: string;
465
+ /**
466
+ * Optional data to load after the component has been mounted.
467
+ */
468
+ data?: any;
469
+ /**
470
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
471
+ */
472
+ url?: string;
473
+ }
474
+ /**
475
+ * @group Props
476
+ */
477
+ export interface ColumnChartComponentProps extends DOMAttributes<HTMLDivElement> {
478
+ /**
479
+ * Options for the chart
480
+ */
481
+ options: Omit<ColumnChartOptions, "data" | "url" | "model">;
482
+ /**
483
+ * Optional class name to set on the chart component's container
484
+ */
485
+ className?: string;
486
+ /**
487
+ * Optional data to load after the chart has been mounted.
488
+ */
489
+ data?: Array<ObjectData>;
490
+ /**
491
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
492
+ */
493
+ url?: string;
494
+ /**
495
+ * Optional filter to apply to the data source.
496
+ */
497
+ dataSourceFilter?: ChartModelFilter;
498
+ }
499
+ /**
500
+ * @group Props
501
+ */
502
+ export interface BarChartComponentProps extends DOMAttributes<HTMLDivElement> {
503
+ /**
504
+ * Options for the chart
505
+ */
506
+ options: Omit<BarChartOptions, "data" | "url" | "model">;
507
+ /**
508
+ * Optional class name to set on the chart component's container
509
+ */
510
+ className?: string;
511
+ /**
512
+ * Optional data to load after the chart has been mounted.
513
+ */
514
+ data?: Array<ObjectData>;
515
+ /**
516
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
517
+ */
518
+ url?: string;
519
+ /**
520
+ * Optional filter to apply to the data source.
521
+ */
522
+ dataSourceFilter?: ChartModelFilter;
523
+ }
524
+ /**
525
+ * @group Props
526
+ */
527
+ export interface XYChartComponentProps extends DOMAttributes<HTMLDivElement> {
528
+ /**
529
+ * Options for the chart
530
+ */
531
+ options: Omit<CategoryValueChartOptions, "data" | "url" | "model">;
532
+ /**
533
+ * Optional class name to set on the chart component's container
534
+ */
535
+ className?: string;
536
+ /**
537
+ * Optional data to load after the chart has been mounted.
538
+ */
539
+ data?: Array<ObjectData>;
540
+ /**
541
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
542
+ */
543
+ url?: string;
544
+ }
545
+ /**
546
+ * @group Props
547
+ */
548
+ export interface LineChartComponentProps extends DOMAttributes<HTMLDivElement> {
549
+ /**
550
+ * Options for the chart
551
+ */
552
+ options: Omit<LineChartOptions, "data" | "url" | "model">;
553
+ /**
554
+ * Optional class name to set on the chart component's container
555
+ */
556
+ className?: string;
557
+ /**
558
+ * Optional data to load after the chart has been mounted.
559
+ */
560
+ data?: Array<ObjectData>;
561
+ /**
562
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
563
+ */
564
+ url?: string;
565
+ /**
566
+ * Optional filter to apply to the data source.
567
+ */
568
+ dataSourceFilter?: ChartModelFilter;
569
+ }
570
+ /**
571
+ * @group Props
572
+ */
573
+ export interface AreaChartComponentProps extends DOMAttributes<HTMLDivElement> {
574
+ /**
575
+ * Options for the chart
576
+ */
577
+ options: Omit<AreaChartOptions, "data" | "url" | "model">;
578
+ /**
579
+ * Optional class name to set on the chart component's container
580
+ */
581
+ className?: string;
582
+ /**
583
+ * Optional data to load after the chart has been mounted.
584
+ */
585
+ data?: Array<ObjectData>;
586
+ /**
587
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
588
+ */
589
+ url?: string;
590
+ /**
591
+ * Optional filter to apply to the data source.
592
+ */
593
+ dataSourceFilter?: ChartModelFilter;
594
+ }
595
+ /**
596
+ * @group Props
597
+ */
598
+ export interface PieChartComponentProps extends DOMAttributes<HTMLDivElement> {
599
+ /**
600
+ * Options for the chart
601
+ */
602
+ options: Omit<PieChartOptions, "data" | "url" | "model">;
603
+ /**
604
+ * Optional class name to set on the chart component's container
605
+ */
606
+ className?: string;
607
+ /**
608
+ * Optional data to load after the chart has been mounted.
609
+ */
610
+ data?: Array<ObjectData>;
611
+ /**
612
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
613
+ */
614
+ url?: string;
615
+ /**
616
+ * Optional filter to apply to the data source.
617
+ */
618
+ dataSourceFilter?: ChartModelFilter;
619
+ }
620
+ /**
621
+ * @group Props
622
+ */
623
+ export interface ScatterChartComponentProps extends DOMAttributes<HTMLDivElement> {
624
+ /**
625
+ * Options for the chart
626
+ */
627
+ options: Omit<ScatterChartOptions, "data" | "url" | "model">;
628
+ /**
629
+ * Optional class name to set on the chart component's container
630
+ */
631
+ className?: string;
632
+ /**
633
+ * Optional data to load after the chart has been mounted.
634
+ */
635
+ data?: Array<ObjectData>;
636
+ /**
637
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
638
+ */
639
+ url?: string;
640
+ /**
641
+ * Optional filter to apply to the data source.
642
+ */
643
+ dataSourceFilter?: ChartModelFilter;
644
+ }
645
+ /**
646
+ * @group Props
647
+ */
648
+ export interface BubbleChartComponentProps extends DOMAttributes<HTMLDivElement> {
649
+ /**
650
+ * Options for the chart
651
+ */
652
+ options: Omit<BubbleChartOptions, "data" | "url" | "model">;
653
+ /**
654
+ * Optional class name to set on the chart component's container
655
+ */
656
+ className?: string;
657
+ /**
658
+ * Optional data to load after the chart has been mounted.
659
+ */
660
+ data?: Array<ObjectData>;
661
+ /**
662
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
663
+ */
664
+ url?: string;
665
+ /**
666
+ * Optional filter to apply to the data source.
667
+ */
668
+ dataSourceFilter?: ChartModelFilter;
669
+ }
670
+ /**
671
+ * @group Props
672
+ */
673
+ export interface GaugeChartComponentProps extends DOMAttributes<HTMLDivElement> {
674
+ /**
675
+ * Options for the chart
676
+ */
677
+ options: Omit<GaugeChartOptions, "data" | "url" | "model">;
678
+ /**
679
+ * Optional class name to set on the chart component's container
680
+ */
681
+ className?: string;
682
+ /**
683
+ * Optional data to load after the chart has been mounted.
684
+ */
685
+ data?: Array<ObjectData>;
686
+ /**
687
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
688
+ */
689
+ url?: string;
690
+ }
691
+ /**
692
+ * @group Props
693
+ */
694
+ export interface SankeyChartComponentProps extends DOMAttributes<HTMLDivElement> {
695
+ /**
696
+ * Options for the chart
697
+ */
698
+ options: Omit<SankeyOptions, "data" | "url" | "model">;
699
+ /**
700
+ * Optional class name to set on the chart component's container
701
+ */
702
+ className?: string;
703
+ /**
704
+ * Optional data to load into the chart (in CSV format)
705
+ */
706
+ csvData?: string;
707
+ /**
708
+ * Optional data to load into the chart (in VisuallyJs default json format)
709
+ */
710
+ jsonData?: VisuallyJsDefaultJSON;
711
+ /**
712
+ * Optional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.
713
+ */
714
+ url?: string;
715
+ /**
716
+ * Whether the chart is interactive.
717
+ */
718
+ interactive?: boolean;
719
+ /**
720
+ * Optional property to pivot the sankey chart on.
721
+ */
722
+ pivot?: string;
723
+ }
724
+ /**
725
+ * Props for the diagram palette.
726
+ * @group Props
727
+ */
728
+ export interface DiagramPaletteProps extends DOMAttributes<HTMLDivElement> {
729
+ /**
730
+ * Optional fill color to use for dragged elements. This should be in RGB format, _not_ a color like 'white' or 'cyan' etc.
731
+ */
732
+ fill?: string;
733
+ /**
734
+ * Optional color to use for outline of dragged elements. Should be in RGB format.
735
+ */
736
+ outline?: string;
737
+ /**
738
+ * Optional size to use for dragged elements.
739
+ */
740
+ dragSize?: Size;
741
+ /**
742
+ * Indicates that when one or more vertices are selected, clicking on an entry in the palette will change the type of the selected vertices to that type. Defaults to true.
743
+ */
744
+ inspector?: boolean;
745
+ /**
746
+ * Optional size to use for icons. Defaults to 150x100 pixels. If you provide this but not `dragSize` this size will also be used for an icon that is being dragged.
747
+ */
748
+ iconSize?: Size;
749
+ /**
750
+ * Optionally show each shape icon's label underneath it
751
+ */
752
+ showLabels?: boolean;
753
+ /**
754
+ * Stroke width to use for shapes in palette. Defaults to 1.
755
+ */
756
+ paletteStrokeWidth?: number;
757
+ /**
758
+ * Message to use for the 'show all' option in the shape set drop down when there is more than one set of shapes. Defaults to `Show all`.
759
+ */
760
+ showAllMessage?: string;
761
+ /**
762
+ * Callback to invoke when a new diagram cell has been added.
763
+ * @param dc
764
+ */
765
+ onCellAdded?: (dc: DiagramCell) => any;
766
+ /**
767
+ * Mode to operate in - 'drag' or 'tap'. Defaults to 'drag' (PALETTE_MODE_DRAG).
768
+ */
769
+ mode?: PaletteMode;
770
+ /**
771
+ * When in tap mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drawing method also still works)
772
+ */
773
+ allowClickToAdd?: boolean;
774
+ /**
775
+ * Defaults to true: when in 'tap' mode and a new group/node has been drawn on the canvas, the UI is set back to pan mode.
776
+ */
777
+ autoExitDrawMode?: boolean;
778
+ /**
779
+ * When true (which is the default), a newly dropped shape will be set as the underlying model's selection.
780
+ */
781
+ selectAfterAdd?: boolean;
782
+ /**
783
+ * Optional diagram to attach to. In most cases it is better to use a DiagramProvider to provision the diagram to this component.
784
+ */
785
+ diagram?: Diagram;
786
+ /**
787
+ * Optional class name to set on the diagram palette root element.
788
+ */
789
+ className?: string;
790
+ /**
791
+ * Optional callback that will be invoked after a new vertex has been dropped and added to the dataset.
792
+ * @param v
793
+ */
794
+ onVertexAdded?: OnVertexAddedCallback;
795
+ /**
796
+ * Optional set of prepared shapes to show in the palette. When this is provided, the palette will only render these shapes, and not the contents of the shape library.
797
+ */
798
+ preparedShapes?: Array<PreparedShape>;
799
+ }
800
+ /**
801
+ * Props for the ColorPicker inspector component.
802
+ * @group Props
803
+ */
804
+ export interface ColorPickerComponentProps extends DOMAttributes<HTMLDivElement> {
805
+ /**
806
+ * Maximum color swatches to show. Defaults to 10.
807
+ */
808
+ maxColors?: number;
809
+ /**
810
+ * Property name in the data that this picker represents. Required.
811
+ */
812
+ propertyName: string;
813
+ }
814
+ /**
815
+ * The props that are passed in to a component used to render a node/group by a surface component.
816
+ * @group Props
817
+ */
818
+ export interface SvelteWrapperProps {
819
+ data: ObjectData;
820
+ surface: Surface;
821
+ vertex: Vertex;
822
+ model: BrowserUIModel;
823
+ }
824
+ /**
825
+ * Props for the decorator component.
826
+ * @props
827
+ */
828
+ export interface DecoratorComponentProps extends DOMAttributes<HTMLDivElement> {
829
+ /**
830
+ * Whether to float the element over the UI (floating) or place it on the canvas (fixed). Floating is the default.
831
+ */
832
+ placement: string;
833
+ /**
834
+ * Position relative to viewport (floating) or canvas (fixed).
835
+ */
836
+ position: PointXY;
837
+ /**
838
+ * Optional constraints when using fixed placement.
839
+ */
840
+ constraints?: FixedElementConstraints;
841
+ }