@visuallyjs/browser-ui 1.1.4 → 1.2.1

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 (32) hide show
  1. package/css/visuallyjs.css +10 -0
  2. package/js/visuallyjs.browser-ui.cjs.js +53 -53
  3. package/js/visuallyjs.browser-ui.esm.js +53 -53
  4. package/package.json +1 -1
  5. package/types/browser-ui/auto-pan-handler.d.ts +10 -1
  6. package/types/browser-ui/browser-visuallyjs-instance.d.ts +6 -0
  7. package/types/browser-ui/components/inspector/definitions.d.ts +1 -0
  8. package/types/browser-ui/components/inspector/inspector.d.ts +2 -2
  9. package/types/browser-ui/dialogs/binder.d.ts +2 -1
  10. package/types/browser-ui/dialogs/constants.d.ts +1 -0
  11. package/types/browser-ui/pan-zoom.d.ts +14 -15
  12. package/types/browser-ui/paper-renderer/definitions.d.ts +9 -0
  13. package/types/browser-ui/paper-renderer/paper.d.ts +15 -0
  14. package/types/browser-ui/plugins/background/generated-grid-background.d.ts +1 -1
  15. package/types/browser-ui/surface-renderer/index.d.ts +1 -0
  16. package/types/browser-ui/surface-renderer/popups/definitions.d.ts +14 -0
  17. package/types/browser-ui/surface-renderer/popups/index.d.ts +3 -0
  18. package/types/browser-ui/surface-renderer/popups/popup-handler.d.ts +28 -0
  19. package/types/browser-ui/surface-renderer/popups/util.d.ts +4 -0
  20. package/types/browser-ui/surface-renderer/surface.d.ts +22 -9
  21. package/types/charts/sankey/sankey.d.ts +1 -1
  22. package/types/core/geom.d.ts +10 -4
  23. package/types/core/layout/circular/circular-layout.d.ts +6 -1
  24. package/types/core/params.d.ts +16 -16
  25. package/types/core/search/visuallyjs-search.d.ts +4 -6
  26. package/types/core/selection.d.ts +6 -2
  27. package/types/core/toolkit.d.ts +15 -7
  28. package/types/core/util.d.ts +5 -0
  29. package/types/ui/core/constants.d.ts +7 -0
  30. package/types/ui/core/core.d.ts +4 -0
  31. package/types/ui/core/definitions.d.ts +9 -0
  32. package/types/version.d.ts +1 -1
@@ -362,6 +362,11 @@ export declare function isDate(o: any): o is Date;
362
362
  * @internal
363
363
  */
364
364
  export declare function isFunction(o: any): o is Function;
365
+ /**
366
+ * return whether or not the given value is a Class
367
+ * @param o
368
+ */
369
+ export declare function isClass(o: any): boolean;
365
370
  /**
366
371
  * Returns whether or not the given value is of type `Function` and is a named Function.
367
372
  * @param o
@@ -23,6 +23,13 @@ export declare const ATTRIBUTE_MANAGED = "data-vjs-managed";
23
23
  * @context element-dragging
24
24
  */
25
25
  export declare const ATTRIBUTE_NOT_DRAGGABLE = "data-vjs-not-draggable";
26
+ /**
27
+ * This attribute can be written onto DOM elements by node/group renderers to instruct VisuallyJs that the given element should not cause mouse events for the given vertex to be fired.
28
+ * @group Nodes and Groups
29
+ * @category DOM Attributes
30
+ * @domAttribute
31
+ */
32
+ export declare const ATTRIBUTE_SUPPRESS_VERTEX_EVENTS = "data-vjs-no-events";
26
33
  /**
27
34
  * Written by the Surface when `elementsDraggable` is provided as a constructor option. The value of this attribute will match what you provide for `elementsDraggable`, but it's really only of any use if you set it to `false`, as `true` is the default.
28
35
  * @internal
@@ -643,6 +643,10 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
643
643
  * Gets the current bounds of the UI's viewport.
644
644
  */
645
645
  abstract getViewportBoundsInfo(): ViewportBounds;
646
+ /**
647
+ * If the UI has a fixed viewport (not panning, zooming etc), it can opt to return a value from this method. A background can use this information to place itself.
648
+ */
649
+ abstract $getFixedViewportBoundsInfo(): ViewportBounds | null;
646
650
  abstract getApparentCanvasLocation(): PointXY;
647
651
  abstract toFront(v: string | Vertex | EL, alsoBringAncestorsToFront?: boolean): void;
648
652
  abstract toBack(v: string | Vertex | EL, alsoSendAncestorsToBack?: boolean): void;
@@ -102,6 +102,10 @@ export type VertexDragFilter<E> = (p: {
102
102
  * @category Definitions
103
103
  */
104
104
  export type DragConstrainFunction<E> = (desiredLoc: PointXY, dragEl: E, modelObject: Node | Group, size: Size, currentLoc: PointXY, e: MouseEvent) => PointXY;
105
+ /**
106
+ * Strategy for determining whether something that is moving is considered out of bounds. Options are 'contained', ie the element must be fully contained inside the root bounds, or 'intersecting', ie. the element must intersect the root bounds by some amount. Prior to 1.1.4 the behaviour was 'contained', but a change in 1.1.4 switched this to 'intersecting', which does not necessarily provide the best UX when the canvas is hard up against the edge of the screen, because it isnt always possible to move the mouse far enough that the element is not intersecting, and in those situations panning stops. From 1.2.1 onwards the default is once again `contained`, but you can change that via the `autoPanBoundsStrategy` option on the surface's dragOptions.
107
+ */
108
+ export type AutoPanBoundsStrategy = "contained" | "intersecting";
105
109
  /**
106
110
  * Options for element drag
107
111
  * @group UI
@@ -136,6 +140,10 @@ export interface DragOptions<E> {
136
140
  * When auto-panning, this is the number of pixels that the canvas repositions itself on each tick. Defaults to 5.
137
141
  */
138
142
  autoPanDelta?: number;
143
+ /**
144
+ * When auto-panning, this flag instructs the auto pan how to determine if an element is inside the root bounds or not. A value of "contained" (the default), means the whole element has to be inside the root bounds. A value of "intersecting" means that the element needs to just intersect the root bounds by some amount.
145
+ */
146
+ autoPanBoundsStrategy?: AutoPanBoundsStrategy;
139
147
  /**
140
148
  * Optional function that is invoked at the start of a drag, and which identifies allowed drop targets. Each target - the canvas, nodes and groups - is passed in turn to this method; returning false indicates that the given target is not valid for that drag.
141
149
  * @param candidate
@@ -164,6 +172,7 @@ export interface SupportsElementDragging<E> {
164
172
  $startPanRepeat: (dirX: 1 | 0 | -1, dirY: 1 | 0 | -1, dx: number, dy: number, interval: number, cb?: (total: PointXY) => any) => void;
165
173
  $stopPanRepeat: () => void;
166
174
  $provisionallyMagnetize(focus: Vertex, repositionFocus: boolean, knownLocations: Record<string, PointXY>, knownSizes: Record<string, Size>, magnetizerIsAlreadyPrimed: boolean, invertTrackbackPreference: boolean): MagnetizeResult;
175
+ addVertexDragFilter(f: VertexDragFilter<E>): void;
167
176
  }
168
177
  /**
169
178
  * Payload for the node:move:start event that is fired when a node/group has just begun to be moved.
@@ -1 +1 @@
1
- export declare const VERSION = "1.1.4";
1
+ export declare const VERSION = "1.2.1";