@yggy-tech/graphraum 0.34.1 → 0.35.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.
package/dist/index.d.ts CHANGED
@@ -72,6 +72,14 @@ interface GraphraumData<NodeAttributes = undefined, EdgeAttributes = undefined>
72
72
  nodes: readonly GraphraumNode<NodeAttributes>[];
73
73
  edges: readonly GraphraumEdge<EdgeAttributes>[];
74
74
  }
75
+ interface GraphraumSetDataOptions {
76
+ /**
77
+ * Fit the camera to the new data (default `true`). `false` replaces the data and leaves the camera
78
+ * where it is, for hosts that pass a full snapshot on every change. On a graph that never had a
79
+ * fit the camera keeps its initial pose, so call `fitView()` once after the first data.
80
+ */
81
+ fit?: boolean;
82
+ }
75
83
  interface GraphraumDataPatch<NodeAttributes = undefined, EdgeAttributes = undefined> {
76
84
  addedNodes?: readonly GraphraumNode<NodeAttributes>[];
77
85
  addedEdges?: readonly GraphraumEdge<EdgeAttributes>[];
@@ -531,7 +539,8 @@ declare class Graphraum<NodeAttributes = undefined, EdgeAttributes = undefined>
531
539
  private readonly focusListeners;
532
540
  private lastHoveredNodeId;
533
541
  constructor(container: HTMLElement, options?: GraphraumOptions<NodeAttributes, EdgeAttributes>);
534
- setData(data: GraphraumData<NodeAttributes, EdgeAttributes>): void;
542
+ /** Replaces the whole graph. Fits the camera unless `options.fit` is `false`. */
543
+ setData(data: GraphraumData<NodeAttributes, EdgeAttributes>, options?: GraphraumSetDataOptions): void;
535
544
  /** Merge a topology patch without fitting or resetting the current camera. */
536
545
  applyDataPatch(patch: GraphraumDataPatch<NodeAttributes, EdgeAttributes>): void;
537
546
  private canAppendDataPatch;
@@ -851,4 +860,4 @@ declare function isTransparentGraphraumBackground(background: GraphraumBackgroun
851
860
  /** Defines typed, serializable graph visuals without coupling application data to the render loop. */
852
861
  declare function defineVisuals<NodeAttributes = undefined, EdgeAttributes = undefined>(visuals: GraphraumVisualMapper<NodeAttributes, EdgeAttributes>): GraphraumVisualMapper<NodeAttributes, EdgeAttributes>;
853
862
  //#endregion
854
- export { type CompiledGraphraumPresentation, DEFAULT_ENDPOINT_ATTACH, DEFAULT_ENDPOINT_CLEARANCE, DEFAULT_FORCE_SETTINGS, type EndpointAttach, type EndpointOutline, type ForceLayoutRequest, type ForceSettings, type GraphologyEdgeAttributes, type GraphologyNodeAttributes, type GraphologyRenderer, Graphraum, type GraphraumAutoOrbitOptions, type GraphraumAutoOrbitStatus, type GraphraumBackground, type GraphraumColor, type GraphraumData, type GraphraumDataPatch, type GraphraumDiagnostics, type GraphraumEdge, type GraphraumEdgeEncoding, type GraphraumEdgeMarker, type GraphraumEdgeMarkerEnd, type GraphraumEdgePath, type GraphraumEdgeState, type GraphraumEdgeStyle, type GraphraumEdgeVisual, type GraphraumFlyToOptions, type GraphraumLabelCandidate, type GraphraumLayoutPositions, type GraphraumMode, type GraphraumNode, type GraphraumNodeEncoding, type GraphraumNodeGeometry, type GraphraumNodeShape, type GraphraumNodeState, type GraphraumNodeUpdate, type GraphraumNodeVisual, type GraphraumOptions, GraphraumOverlay, type GraphraumOverlayNode, type GraphraumOverlayOptions, type GraphraumPatternBackground, type GraphraumPickHit, type GraphraumPosition, type GraphraumPresentation, type GraphraumPresentationAction, type GraphraumPresentationProperty, type GraphraumPropertyValue, type GraphraumScreenPosition, type GraphraumTheme, type GraphraumThemeName, type GraphraumVisualMapper, type LabelBudgetCandidate, type RichNodePolicy, type SelectBudgetedLabelIdsInput, type SelectFocusLabelIdsInput, attachPointOnOutline, bindGraphology, boundOverlayIds, computeClusteredForcePositions, computeForcePositions, createForceSimulation, defineVisuals, forceIterationCount, graphraumEdgePaths, graphraumNodeShapes, graphraumTheme, graphraumThemeDark, graphraumThemeLight, graphraumThemes, isTransparentGraphraumBackground, normalizeGraphraumBackground, orderFocusNodeIds, resolveGraphraumTheme, selectBudgetedLabelIds, selectFocusLabelIds, selectRichNodeIds, trimEdgeEndpoints };
863
+ export { type CompiledGraphraumPresentation, DEFAULT_ENDPOINT_ATTACH, DEFAULT_ENDPOINT_CLEARANCE, DEFAULT_FORCE_SETTINGS, type EndpointAttach, type EndpointOutline, type ForceLayoutRequest, type ForceSettings, type GraphologyEdgeAttributes, type GraphologyNodeAttributes, type GraphologyRenderer, Graphraum, type GraphraumAutoOrbitOptions, type GraphraumAutoOrbitStatus, type GraphraumBackground, type GraphraumColor, type GraphraumData, type GraphraumDataPatch, type GraphraumDiagnostics, type GraphraumEdge, type GraphraumEdgeEncoding, type GraphraumEdgeMarker, type GraphraumEdgeMarkerEnd, type GraphraumEdgePath, type GraphraumEdgeState, type GraphraumEdgeStyle, type GraphraumEdgeVisual, type GraphraumFlyToOptions, type GraphraumLabelCandidate, type GraphraumLayoutPositions, type GraphraumMode, type GraphraumNode, type GraphraumNodeEncoding, type GraphraumNodeGeometry, type GraphraumNodeShape, type GraphraumNodeState, type GraphraumNodeUpdate, type GraphraumNodeVisual, type GraphraumOptions, GraphraumOverlay, type GraphraumOverlayNode, type GraphraumOverlayOptions, type GraphraumPatternBackground, type GraphraumPickHit, type GraphraumPosition, type GraphraumPresentation, type GraphraumPresentationAction, type GraphraumPresentationProperty, type GraphraumPropertyValue, type GraphraumScreenPosition, type GraphraumSetDataOptions, type GraphraumTheme, type GraphraumThemeName, type GraphraumVisualMapper, type LabelBudgetCandidate, type RichNodePolicy, type SelectBudgetedLabelIdsInput, type SelectFocusLabelIdsInput, attachPointOnOutline, bindGraphology, boundOverlayIds, computeClusteredForcePositions, computeForcePositions, createForceSimulation, defineVisuals, forceIterationCount, graphraumEdgePaths, graphraumNodeShapes, graphraumTheme, graphraumThemeDark, graphraumThemeLight, graphraumThemes, isTransparentGraphraumBackground, normalizeGraphraumBackground, orderFocusNodeIds, resolveGraphraumTheme, selectBudgetedLabelIds, selectFocusLabelIds, selectRichNodeIds, trimEdgeEndpoints };
package/dist/index.js CHANGED
@@ -2882,8 +2882,11 @@ var Graphraum = class {
2882
2882
  this.resizeObserver.observe(container);
2883
2883
  this.resize();
2884
2884
  }
2885
- setData(data) {
2886
- this.replaceData(data, true);
2885
+ /** Replaces the whole graph. Fits the camera unless `options.fit` is `false`. */
2886
+ setData(data, options = {}) {
2887
+ const { fit = true } = options;
2888
+ if (typeof fit !== "boolean") throw new Error("setData option fit must be a boolean.");
2889
+ this.replaceData(data, fit);
2887
2890
  }
2888
2891
  /** Merge a topology patch without fitting or resetting the current camera. */
2889
2892
  applyDataPatch(patch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yggy-tech/graphraum",
3
- "version": "0.34.1",
3
+ "version": "0.35.0",
4
4
  "description": "yggy's WebGL engine for interactive graphs in 2D and 3D",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",