@dxos/react-ui-graph 0.8.4-main.fffef41 → 0.9.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/LICENSE +102 -5
- package/README.md +5 -7
- package/dist/lib/browser/chunk-EASNZZ7B.mjs +52 -0
- package/dist/lib/browser/chunk-EASNZZ7B.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2729 -592
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +16 -16
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-JSE2X4ML.mjs +54 -0
- package/dist/lib/node-esm/chunk-JSE2X4ML.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2729 -592
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +16 -16
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Graph/Graph.d.ts +23 -6
- package/dist/types/src/components/Graph/Graph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/Graph.stories.d.ts +6 -6
- package/dist/types/src/components/Graph/Graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Mesh/Mesh.d.ts.map +1 -1
- package/dist/types/src/components/Mesh/Mesh.stories.d.ts.map +1 -1
- package/dist/types/src/components/SVG/FPS.d.ts +20 -0
- package/dist/types/src/components/SVG/FPS.d.ts.map +1 -0
- package/dist/types/src/components/SVG/Grid.d.ts.map +1 -1
- package/dist/types/src/components/SVG/Markers.d.ts.map +1 -1
- package/dist/types/src/components/SVG/Root.d.ts +8 -4
- package/dist/types/src/components/SVG/Root.d.ts.map +1 -1
- package/dist/types/src/components/SVG/SVG.d.ts +17 -18
- package/dist/types/src/components/SVG/SVG.d.ts.map +1 -1
- package/dist/types/src/components/SVG/Svg.stories.d.ts +1 -1
- package/dist/types/src/components/SVG/Svg.stories.d.ts.map +1 -1
- package/dist/types/src/fx/fx.stories.d.ts +3 -3
- package/dist/types/src/fx/fx.stories.d.ts.map +1 -1
- package/dist/types/src/fx/pulsar.d.ts.map +1 -1
- package/dist/types/src/graph/markers.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-bundle-projector.d.ts +47 -0
- package/dist/types/src/graph/projector/graph-bundle-projector.d.ts.map +1 -0
- package/dist/types/src/graph/projector/graph-cluster-projector.d.ts +65 -0
- package/dist/types/src/graph/projector/graph-cluster-projector.d.ts.map +1 -0
- package/dist/types/src/graph/projector/graph-drag.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-force-projector.d.ts +1 -1
- package/dist/types/src/graph/projector/graph-force-projector.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-forces.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-hierarchical-projector.d.ts +1 -1
- package/dist/types/src/graph/projector/graph-hierarchical-projector.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-lattice-projector.d.ts +23 -0
- package/dist/types/src/graph/projector/graph-lattice-projector.d.ts.map +1 -0
- package/dist/types/src/graph/projector/graph-plexus-projector.d.ts +67 -0
- package/dist/types/src/graph/projector/graph-plexus-projector.d.ts.map +1 -0
- package/dist/types/src/graph/projector/graph-plexus-projector.test.d.ts +2 -0
- package/dist/types/src/graph/projector/graph-plexus-projector.test.d.ts.map +1 -0
- package/dist/types/src/graph/projector/graph-projector.d.ts +10 -2
- package/dist/types/src/graph/projector/graph-projector.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-radial-projector.d.ts +7 -1
- package/dist/types/src/graph/projector/graph-radial-projector.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-relational-projector.d.ts +1 -1
- package/dist/types/src/graph/projector/graph-relational-projector.d.ts.map +1 -1
- package/dist/types/src/graph/projector/graph-swarm-projector.d.ts +72 -0
- package/dist/types/src/graph/projector/graph-swarm-projector.d.ts.map +1 -0
- package/dist/types/src/graph/projector/index.d.ts +5 -0
- package/dist/types/src/graph/projector/index.d.ts.map +1 -1
- package/dist/types/src/graph/projector/projector.d.ts +10 -1
- package/dist/types/src/graph/projector/projector.d.ts.map +1 -1
- package/dist/types/src/graph/renderer/bullets.d.ts.map +1 -1
- package/dist/types/src/graph/renderer/graph-renderer.d.ts +41 -1
- package/dist/types/src/graph/renderer/graph-renderer.d.ts.map +1 -1
- package/dist/types/src/graph/renderer/index.d.ts +1 -0
- package/dist/types/src/graph/renderer/index.d.ts.map +1 -1
- package/dist/types/src/graph/renderer/labels.d.ts +33 -0
- package/dist/types/src/graph/renderer/labels.d.ts.map +1 -0
- package/dist/types/src/graph/renderer/renderer.d.ts +12 -1
- package/dist/types/src/graph/renderer/renderer.d.ts.map +1 -1
- package/dist/types/src/graph/types.d.ts +15 -1
- package/dist/types/src/graph/types.d.ts.map +1 -1
- package/dist/types/src/hooks/useGrid.d.ts.map +1 -1
- package/dist/types/src/hooks/useStateRef.d.ts.map +1 -1
- package/dist/types/src/hooks/useSvgContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useZoom.d.ts.map +1 -1
- package/dist/types/src/stories/experimental.stories.d.ts +7 -0
- package/dist/types/src/stories/experimental.stories.d.ts.map +1 -0
- package/dist/types/src/stories/hooks.stories.d.ts +4 -3
- package/dist/types/src/stories/hooks.stories.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +5 -5
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/hooks.d.ts +2 -16
- package/dist/types/src/testing/hooks.d.ts.map +1 -1
- package/dist/types/src/testing/model.d.ts +4 -8
- package/dist/types/src/testing/model.d.ts.map +1 -1
- package/dist/types/src/util/events.d.ts.map +1 -1
- package/dist/types/src/util/fraction.d.ts +1 -1
- package/dist/types/src/util/fraction.d.ts.map +1 -1
- package/dist/types/src/util/points.d.ts.map +1 -1
- package/dist/types/src/util/scale.d.ts.map +1 -1
- package/dist/types/src/util/screen.d.ts.map +1 -1
- package/dist/types/src/util/vector.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -35
- package/src/components/Graph/Graph.stories.tsx +45 -39
- package/src/components/Graph/Graph.tsx +126 -23
- package/src/components/Mesh/Mesh.stories.tsx +8 -7
- package/src/components/Mesh/Mesh.tsx +43 -35
- package/src/components/SVG/FPS.tsx +91 -0
- package/src/components/SVG/Grid.tsx +1 -1
- package/src/components/SVG/Root.tsx +42 -9
- package/src/components/SVG/SVG.tsx +14 -3
- package/src/components/SVG/Svg.stories.tsx +4 -5
- package/src/fx/fx.stories.tsx +7 -8
- package/src/graph/projector/graph-bundle-projector.ts +210 -0
- package/src/graph/projector/graph-cluster-projector.ts +337 -0
- package/src/graph/projector/graph-drag.ts +0 -1
- package/src/graph/projector/graph-force-projector.ts +7 -3
- package/src/graph/projector/graph-hierarchical-projector.ts +4 -4
- package/src/graph/projector/graph-lattice-projector.ts +86 -0
- package/src/graph/projector/graph-plexus-projector.test.ts +102 -0
- package/src/graph/projector/graph-plexus-projector.ts +309 -0
- package/src/graph/projector/graph-projector.ts +24 -4
- package/src/graph/projector/graph-radial-projector.ts +31 -4
- package/src/graph/projector/graph-relational-projector.ts +4 -4
- package/src/graph/projector/graph-swarm-projector.ts +373 -0
- package/src/graph/projector/index.ts +5 -0
- package/src/graph/projector/projector.ts +12 -3
- package/src/graph/renderer/graph-renderer.ts +289 -31
- package/src/graph/renderer/index.ts +1 -0
- package/src/graph/renderer/labels.ts +138 -0
- package/src/graph/renderer/renderer.ts +15 -4
- package/src/graph/types.ts +15 -1
- package/src/stories/experimental.stories.tsx +446 -0
- package/src/stories/hooks.stories.tsx +21 -10
- package/src/testing/data.ts +14 -14
- package/src/testing/hooks.ts +3 -4
- package/src/testing/model.ts +6 -6
- package/src/util/fraction.ts +1 -1
- package/styles/graph.css +341 -43
- package/dist/lib/browser/chunk-XWA2XJDX.mjs +0 -955
- package/dist/lib/browser/chunk-XWA2XJDX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3RLSFEEV.mjs +0 -957
- package/dist/lib/node-esm/chunk-3RLSFEEV.mjs.map +0 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import '../../styles/graph.css';
|
|
1
2
|
import { type StoryObj } from '@storybook/react-vite';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Pulsar } from './pulsar';
|
|
4
|
-
|
|
5
|
-
type StoryProps = {
|
|
5
|
+
type DefaultStoryProps = {
|
|
6
6
|
count: number;
|
|
7
7
|
} & Pulsar.Options;
|
|
8
8
|
declare const meta: {
|
|
9
9
|
title: string;
|
|
10
|
-
render: (props:
|
|
10
|
+
render: (props: DefaultStoryProps) => React.JSX.Element;
|
|
11
11
|
decorators: import("@storybook/react").Decorator[];
|
|
12
12
|
parameters: {
|
|
13
13
|
layout: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fx.stories.d.ts","sourceRoot":"","sources":["../../../../src/fx/fx.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAA8C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"fx.stories.d.ts","sourceRoot":"","sources":["../../../../src/fx/fx.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAA8C,MAAM,OAAO,CAAC;AAOnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAAC,OAAO,CAAC;AAmEnB,QAAA,MAAM,IAAI;;oBAjEmB,iBAAiB;;;QAsE1C,MAAM;;CAE2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,KAI1B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAOxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulsar.d.ts","sourceRoot":"","sources":["../../../../src/fx/pulsar.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAI5D;;GAEG;AACH,yBAAiB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pulsar.d.ts","sourceRoot":"","sources":["../../../../src/fx/pulsar.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAI5D;;GAEG;AACH,yBAAiB,MAAM,CAAC,CAAC;IAChB,MAAM,GAAG,UAAW,WAAW,CAAC,WAAW,CAAC,YAA6C,CAAC;IAE1F,MAAM,MAAM,EAAE,UAAU,CAAC,WAAW,CAQ1C,CAAC;IAEK,MAAM,MAAM,EAAE,UAAU,CAAC,WAAW,CAE1C,CAAC;IAEF,KAAY,OAAO,GAAG,aAAa,CAAC;CACrC;AAED,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../../../src/graph/markers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsCF;;;;GAIG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../../../src/graph/markers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsCF;;;;GAIG;AACH,eAAO,MAAM,aAAa,mBACH,aAAa,KAAQ,UA4BzC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Graph } from '@dxos/graph';
|
|
2
|
+
import { type GraphLayoutNode } from '../types';
|
|
3
|
+
import { GraphRadialProjector, type GraphRadialProjectorOptions } from './graph-radial-projector';
|
|
4
|
+
export type GraphBundleProjectorOptions = GraphRadialProjectorOptions & {
|
|
5
|
+
/** Reserved space around the bundle (screen pixels). */
|
|
6
|
+
margin?: number;
|
|
7
|
+
/** Radius for leaf nodes. Default 4. */
|
|
8
|
+
leafRadius?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Group key for each node — synthetic intermediate nodes are created per unique key
|
|
11
|
+
* to give the bundling layout a routing point (lowest common ancestor) for edges
|
|
12
|
+
* between leaves in different groups. Return `undefined` to attach the node directly
|
|
13
|
+
* to the root (all such leaves bundle through the root).
|
|
14
|
+
*/
|
|
15
|
+
groupOf?: (node: GraphLayoutNode) => string | undefined;
|
|
16
|
+
/** Bundling tension passed to `d3.curveBundle.beta`. 0 = straight chord, 1 = max bundled. */
|
|
17
|
+
tension?: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Hierarchical edge bundling — Holten 2006 / d3 observable notebook
|
|
21
|
+
* (https://observablehq.com/@d3/hierarchical-edge-bundling).
|
|
22
|
+
*
|
|
23
|
+
* Synthesizes the same root → group → leaf hierarchy as `GraphClusterProjector`, runs
|
|
24
|
+
* d3.cluster to give every node a polar position, but renders ONLY the leaves
|
|
25
|
+
* (root + groups are routing anchors, not visible nodes). Each data edge is replaced
|
|
26
|
+
* with a curve generated by `lineRadial(curveBundle.beta(tension))` over the polar
|
|
27
|
+
* positions of `source.path(target)` — i.e. the chain of ancestors through the lowest
|
|
28
|
+
* common ancestor.
|
|
29
|
+
*
|
|
30
|
+
* Per-frame `onTickFrame` refreshes the leaf endpoints (first + last point of every
|
|
31
|
+
* path) from current cartesian positions so the curves stay glued to leaves during a
|
|
32
|
+
* cross-variant tween (force → bundle, lattice → bundle). Internal ancestor positions
|
|
33
|
+
* are fixed at d3.cluster's final polar layout, which means during the tween curves
|
|
34
|
+
* route through the destination "pivot points" while the leaf endpoints catch up —
|
|
35
|
+
* visually the bundle "snaps into shape" as the leaves arrive.
|
|
36
|
+
*/
|
|
37
|
+
export declare class GraphBundleProjector<NodeData = any, Options extends GraphBundleProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
38
|
+
#private;
|
|
39
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
40
|
+
/**
|
|
41
|
+
* Refresh leaf endpoint polar values from current cartesian so the curve tracks
|
|
42
|
+
* its endpoints during the tween. Internal hierarchy positions stay constant.
|
|
43
|
+
*/
|
|
44
|
+
protected onTickFrame(_t: number): void;
|
|
45
|
+
private doBundleLayout;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=graph-bundle-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-bundle-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-bundle-projector.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,KAAK,2BAA2B,EAAc,MAAM,0BAA0B,CAAC;AAE9G,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,GAAG;IACtE,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAgBF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAoB,CAC/B,QAAQ,GAAG,GAAG,EACd,OAAO,SAAS,2BAA2B,GAAG,GAAG,CACjD,SAAQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;;IAS/C,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,QAM5C;IAED;;;OAGG;IACH,UAAmB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAe/C;IAED,OAAO,CAAC,cAAc;CA4GvB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Graph } from '@dxos/graph';
|
|
2
|
+
import { type GraphLayoutNode } from '../types';
|
|
3
|
+
import { GraphRadialProjector, type GraphRadialProjectorOptions } from './graph-radial-projector';
|
|
4
|
+
export type GraphClusterProjectorOptions = GraphRadialProjectorOptions & {
|
|
5
|
+
/** Reserved space around the cluster (screen pixels). */
|
|
6
|
+
margin?: number;
|
|
7
|
+
/** Radius for leaf nodes. Default 4. */
|
|
8
|
+
leafRadius?: number;
|
|
9
|
+
/** Radius for the synthetic group nodes (visible as smaller intermediate dots). Default 3. */
|
|
10
|
+
groupRadius?: number;
|
|
11
|
+
/** Radius for the synthetic root node. Default 5. */
|
|
12
|
+
rootRadius?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Group key for each node — synthetic intermediate nodes are created per unique key,
|
|
15
|
+
* giving a root → group → leaf hierarchy. Return `undefined` to attach the node
|
|
16
|
+
* directly to the root.
|
|
17
|
+
*/
|
|
18
|
+
groupOf?: (node: GraphLayoutNode) => string | undefined;
|
|
19
|
+
/** Root id used for the synthetic root node. */
|
|
20
|
+
rootId?: string;
|
|
21
|
+
/** Display label set on the synthetic root node. Renderers read `node.label`. */
|
|
22
|
+
rootLabel?: string;
|
|
23
|
+
/** Optional formatter applied to the `groupOf` key to derive the group's display label.
|
|
24
|
+
* Defaults to the key itself. */
|
|
25
|
+
groupLabel?: (key: string) => string;
|
|
26
|
+
};
|
|
27
|
+
/** Node type tags so consumer renderers can distinguish leaves from synthetic structural nodes. */
|
|
28
|
+
export declare const CLUSTER_NODE_TYPE_LEAF = "leaf";
|
|
29
|
+
export declare const CLUSTER_NODE_TYPE_GROUP = "group";
|
|
30
|
+
export declare const CLUSTER_NODE_TYPE_ROOT = "root";
|
|
31
|
+
/**
|
|
32
|
+
* Radial cluster (d3.cluster) layout. Materializes a root → group → leaf
|
|
33
|
+
* hierarchy from the `groupOf` callback, runs d3.cluster, and:
|
|
34
|
+
*
|
|
35
|
+
* - Places leaves around the outer ring; synthetic group nodes sit on an
|
|
36
|
+
* inner ring; the root sits at the origin. All three kinds are added to the
|
|
37
|
+
* layout so they render via the consumer's `renderNode` (the `type` field
|
|
38
|
+
* identifies which is which).
|
|
39
|
+
* - Each hierarchy edge carries a `path` string (d3's `linkRadial` curve)
|
|
40
|
+
* computed from CURRENT cartesian endpoint positions every frame via
|
|
41
|
+
* `onTickFrame`. The curve therefore tracks moving endpoints during a
|
|
42
|
+
* cross-variant tween (e.g. force → cluster) instead of snapping to the
|
|
43
|
+
* final polar shape.
|
|
44
|
+
*/
|
|
45
|
+
export declare class GraphClusterProjector<NodeData = any, Options extends GraphClusterProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
46
|
+
#private;
|
|
47
|
+
/**
|
|
48
|
+
* Built-in click semantics: clicking a synthetic root / group node toggles its subtree.
|
|
49
|
+
* Leaf clicks fall through to the consumer's `onSelect` (returns `false`).
|
|
50
|
+
*/
|
|
51
|
+
handleNodeClick(node: GraphLayoutNode<NodeData>, _event: MouseEvent): boolean;
|
|
52
|
+
/** Toggle collapse state for a synthetic node id. Triggers a topology re-emit. */
|
|
53
|
+
toggleCollapsed(id: string): void;
|
|
54
|
+
/** Whether a synthetic-node id is currently collapsed. */
|
|
55
|
+
isCollapsed(id: string): boolean;
|
|
56
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
57
|
+
/**
|
|
58
|
+
* Recompute each hierarchy edge's `path` from current cartesian source/target positions,
|
|
59
|
+
* so the curves track moving endpoints during a cross-variant tween (e.g. force → cluster)
|
|
60
|
+
* instead of being pinned to the final polar layout.
|
|
61
|
+
*/
|
|
62
|
+
protected onTickFrame(_t: number): void;
|
|
63
|
+
private doClusterLayout;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=graph-cluster-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-cluster-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-cluster-projector.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,KAAK,2BAA2B,EAAc,MAAM,0BAA0B,CAAC;AAE9G,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,GAAG;IACvE,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;qCACiC;IACjC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC,CAAC;AAMF,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAwB7C;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAqB,CAChC,QAAQ,GAAG,GAAG,EACd,OAAO,SAAS,4BAA4B,GAAG,GAAG,CAClD,SAAQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;;IAa/C;;;OAGG;IACM,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAMrF;IAED,kFAAkF;IAClF,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAWhC;IAED,0DAA0D;IAC1D,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE/B;IAED,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,QAS5C;IAED;;;;OAIG;IACH,UAAmB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAU/C;IAED,OAAO,CAAC,eAAe;CAoLxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-drag.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-drag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-drag.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-drag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3F,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC5E;AAOD;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,WAC7B,UAAU,aACR,cAAc,CAAC,QAAQ,CAAC,YAC1B,WAAW,CAAC,QAAQ,CAAC,+HAwF/B,CAAC"}
|
|
@@ -86,7 +86,7 @@ export declare class GraphForceProjector<NodeData = any> extends GraphProjector<
|
|
|
86
86
|
onStart(): Promise<void>;
|
|
87
87
|
onStop(): Promise<void>;
|
|
88
88
|
onRefresh(dragging?: boolean): void;
|
|
89
|
-
onUpdate(graph?: Graph): void;
|
|
89
|
+
onUpdate(graph?: Graph.Any): void;
|
|
90
90
|
private updateLayout;
|
|
91
91
|
/**
|
|
92
92
|
* Update all forces.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-force-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-force-projector.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3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QAAQ,EAAE,0BAA0B,CAAC;IAE3G,OAAO,CAAC,WAAW,CAAuD;IAE1E,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAElC,IAAI,MAAM,iBAET;IAED,IAAI,UAAU,8DAEb;IAED,OAAO,SAEN;IAEQ,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,CAE7F;IAEc,OAAO,kBA4BrB;IAEc,MAAM,kBAGpB;IAEQ,SAAS,CAAC,QAAQ,UAAQ,QAWlC;IAEQ,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,IAAI,CAUzC;IAED,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,YAAY;CAgIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-forces.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-forces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAkB,MAAM,IAAI,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,mBAAmB,EACrC,SAAS,SAAS,mBAAmB,CAAC,SAAS,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"graph-forces.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-forces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAkB,MAAM,IAAI,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,mBAAmB,EACrC,SAAS,SAAS,mBAAmB,CAAC,SAAS,CAAC,GAAG,SAAS,uBAK3D,iBAAiB,KAAG,KAAK,CAAC,SAAS,EAAE,SAAS,CAehD,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type GraphHierarchicalProjectorOptions = GraphProjectorOptions & {
|
|
|
8
8
|
duration?: number;
|
|
9
9
|
};
|
|
10
10
|
export declare class GraphHierarchicalProjector<NodeData = any, Options extends GraphHierarchicalProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
11
|
-
protected onUpdate(graph?: Graph): void;
|
|
11
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
12
12
|
protected doHierarchicalLayout(selected: GraphLayoutNode): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=graph-hierarchical-projector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-hierarchical-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-hierarchical-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-hierarchical-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-hierarchical-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAA4B,MAAM,0BAA0B,CAAC;AAE1F,MAAM,MAAM,iCAAiC,GAAG,qBAAqB,GAAG;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,0BAA0B,CACrC,QAAQ,GAAG,GAAG,EACd,OAAO,SAAS,iCAAiC,GAAG,GAAG,CACvD,SAAQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC/C,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,QAkB5C;IAED,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,eAAe,QAsCvD;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Graph } from '@dxos/graph';
|
|
2
|
+
import { type GraphLayoutNode } from '../types';
|
|
3
|
+
import { GraphRadialProjector, type GraphRadialProjectorOptions } from './graph-radial-projector';
|
|
4
|
+
export type GraphLatticeProjectorOptions = GraphRadialProjectorOptions & {
|
|
5
|
+
/** Reserved space around the lattice (screen pixels). */
|
|
6
|
+
margin?: number;
|
|
7
|
+
/** Node radius used by `renderNode` consumers. Defaults to the force-graph default (6) so animations across variants don't resize nodes. */
|
|
8
|
+
radius?: number;
|
|
9
|
+
/** Sort key for cells; defaults to the node label / id. Same-typename nodes naturally cluster. */
|
|
10
|
+
sortBy?: (node: GraphLayoutNode) => string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Lays out nodes as a square-as-possible grid that fits the container.
|
|
14
|
+
* Extends `GraphRadialProjector` to inherit the tween (`updateNode` + `animate`),
|
|
15
|
+
* so switching to / from this layout animates each node from its current
|
|
16
|
+
* position to the grid cell — and the initial mount can also "grow" from
|
|
17
|
+
* existing positions if seeded with a prior projector's layout.
|
|
18
|
+
*/
|
|
19
|
+
export declare class GraphLatticeProjector<NodeData = any, Options extends GraphLatticeProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
20
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
21
|
+
private doLatticeLayout;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=graph-lattice-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-lattice-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-lattice-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,KAAK,2BAA2B,EAAc,MAAM,0BAA0B,CAAC;AAE9G,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,GAAG;IACvE,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4IAA4I;IAC5I,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;CAC5C,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,qBAAqB,CAChC,QAAQ,GAAG,GAAG,EACd,OAAO,SAAS,4BAA4B,GAAG,GAAG,CAClD,SAAQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC/C,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,QAQ5C;IAED,OAAO,CAAC,eAAe;CA6CxB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Graph } from '@dxos/graph';
|
|
2
|
+
import { type GraphLayoutEdge } from '../types';
|
|
3
|
+
import { GraphRadialProjector, type GraphRadialProjectorOptions } from './graph-radial-projector';
|
|
4
|
+
/** Display info for a relation group. */
|
|
5
|
+
export type PlexusRelation = {
|
|
6
|
+
/** Stable grouping key — edges sharing a key fan out from the same relation node. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Human-readable label rendered on the relation node. */
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
export type GraphPlexusProjectorOptions = GraphRadialProjectorOptions & {
|
|
12
|
+
/** Id of the focused node placed at the centre. When unset the layout falls back to a plain ring. */
|
|
13
|
+
focus?: string;
|
|
14
|
+
/** Reserved space around the outer ring (screen pixels). Default 100. */
|
|
15
|
+
margin?: number;
|
|
16
|
+
/** Radius for object leaf nodes — the base size shared by all non-focus nodes. Default 5. */
|
|
17
|
+
leafRadius?: number;
|
|
18
|
+
/** Radius for the synthetic relation nodes. Defaults to the leaf radius. */
|
|
19
|
+
relationRadius?: number;
|
|
20
|
+
/** Radius for the focused centre node. Defaults to double the leaf radius. */
|
|
21
|
+
focusRadius?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Classify an edge incident to the focus into a relation group. Return `undefined` to
|
|
24
|
+
* ignore the edge (e.g. when the focus is not one of the edge's endpoints). The neighbour
|
|
25
|
+
* placed under the relation is the edge endpoint that is NOT the focus, so both sides of a
|
|
26
|
+
* relation are supported: classify outgoing edges (focus is source) and incoming edges
|
|
27
|
+
* (focus is target) under different keys to get a separate relation node for each side.
|
|
28
|
+
* Mirrors the `groupOf` callback used by the cluster / bundle projectors — all ECHO
|
|
29
|
+
* knowledge stays in the consumer.
|
|
30
|
+
*/
|
|
31
|
+
relationOf?: (edge: GraphLayoutEdge, focusId: string) => PlexusRelation | undefined;
|
|
32
|
+
};
|
|
33
|
+
/** Node type tags so consumer renderers can distinguish the three kinds of node. */
|
|
34
|
+
export declare const PLEXUS_NODE_TYPE_FOCUS = "plexus-focus";
|
|
35
|
+
export declare const PLEXUS_NODE_TYPE_RELATION = "plexus-relation";
|
|
36
|
+
export declare const PLEXUS_NODE_TYPE_OBJECT = "plexus-object";
|
|
37
|
+
/**
|
|
38
|
+
* Focus-centric radial layout. A single focused object sits at the centre; its immediate
|
|
39
|
+
* neighbourhood fans out around it, grouped by the relation that connects each neighbour
|
|
40
|
+
* to the focus:
|
|
41
|
+
*
|
|
42
|
+
* - **Focus** (depth 0) — the focused data node, at the origin.
|
|
43
|
+
* - **Relation nodes** (depth 1) — synthetic group nodes (one per `relationOf` key) on an
|
|
44
|
+
* inner ring.
|
|
45
|
+
* - **Object nodes** (depth 2) — the neighbours reached through each relation, on the
|
|
46
|
+
* outer ring.
|
|
47
|
+
*
|
|
48
|
+
* Built on the same `d3.cluster` machinery as `GraphClusterProjector`: the synthesized
|
|
49
|
+
* `focus → relation → object` hierarchy is laid out radially and each hierarchy edge gets
|
|
50
|
+
* a `linkRadial` `path` recomputed from current cartesian endpoints every tick, so curves
|
|
51
|
+
* track moving nodes during a cross-focus (or cross-variant) tween.
|
|
52
|
+
*
|
|
53
|
+
* Focus itself is owned by the consumer (passed via `options.focus`); re-focusing is a
|
|
54
|
+
* matter of recreating the projector with the new focus and the previous layout as `prev`,
|
|
55
|
+
* which makes persistent nodes animate into their new positions.
|
|
56
|
+
*/
|
|
57
|
+
export declare class GraphPlexusProjector<NodeData = any, Options extends GraphPlexusProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
58
|
+
#private;
|
|
59
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
60
|
+
/**
|
|
61
|
+
* Recompute each hierarchy edge's `path` from current cartesian endpoints so curves track
|
|
62
|
+
* moving nodes during the tween (identical strategy to the cluster projector).
|
|
63
|
+
*/
|
|
64
|
+
protected onTickFrame(_t: number): void;
|
|
65
|
+
private doPlexusLayout;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=graph-plexus-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-plexus-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-plexus-projector.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,UAAU,CAAC;AACtE,OAA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/graph/projector/graph-plexus-projector.test.ts"],"names":[],"mappings":""}
|
|
@@ -6,7 +6,7 @@ export type GraphProjectorOptions = ProjectorOptions & {};
|
|
|
6
6
|
/**
|
|
7
7
|
* Base class for graph projectors.
|
|
8
8
|
*/
|
|
9
|
-
export declare abstract class GraphProjector<NodeData = any, Options extends GraphProjectorOptions = any> extends Projector<Graph, GraphLayout<NodeData>, Options> {
|
|
9
|
+
export declare abstract class GraphProjector<NodeData = any, Options extends GraphProjectorOptions = any> extends Projector<Graph.Any, GraphLayout<NodeData>, Options> {
|
|
10
10
|
private readonly _selection?;
|
|
11
11
|
private readonly _layout;
|
|
12
12
|
constructor(context: SVGContext, options?: Options, _selection?: SelectionModel, layout?: GraphLayout<NodeData>);
|
|
@@ -18,8 +18,16 @@ export declare abstract class GraphProjector<NodeData = any, Options extends Gra
|
|
|
18
18
|
* Merge external data with internal representation (e.g., so force properties like position are preserved).
|
|
19
19
|
* @param data
|
|
20
20
|
*/
|
|
21
|
-
protected mergeData(data?: Graph): void;
|
|
21
|
+
protected mergeData(data?: Graph.Any): void;
|
|
22
22
|
onClear(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional projector-owned click intercept. The Graph component invokes this BEFORE
|
|
25
|
+
* forwarding to the consumer's `onSelect`, so projectors can implement built-in
|
|
26
|
+
* interactions (e.g. cluster collapse) without each consumer wiring them. Returning
|
|
27
|
+
* `true` indicates the click was handled — consumer's `onSelect` is suppressed.
|
|
28
|
+
* Default no-op returns `false` so consumer handlers still run.
|
|
29
|
+
*/
|
|
30
|
+
handleNodeClick(_node: GraphLayoutNode<NodeData>, _event: MouseEvent): boolean;
|
|
23
31
|
abstract findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined;
|
|
24
32
|
}
|
|
25
33
|
//# sourceMappingURL=graph-projector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAc,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAc,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,EAAE,CAAC;AAE1D;;GAEG;AACH,8BAAsB,cAAc,CAAC,QAAQ,GAAG,GAAG,EAAE,OAAO,SAAS,qBAAqB,GAAG,GAAG,CAAE,SAAQ,SAAS,CACjH,KAAK,CAAC,GAAG,EACT,WAAW,CAAC,QAAQ,CAAC,EACrB,OAAO,CACR;IAOG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAN9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAGhD,YACE,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,OAAO,EACA,UAAU,CAAC,EAAE,cAAc,EAC5C,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,EAU/B;IAED,IAAI,MAAM,0BAET;IAED,IAAI,SAAS,mBAEZ;IAED,WAAW,CAAC,IAAI,EAAE,eAAe,UAEhC;IAED,KAAK,SAIJ;IAED;;;OAGG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,GAAE,KAAK,CAAC,GAAgB,QAwC/C;IAEc,OAAO,kBAErB;IAED;;;;;;OAMG;IACH,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAE7E;IAED,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;CAChG"}
|
|
@@ -10,8 +10,14 @@ export type GraphRadialProjectorOptions = GraphProjectorOptions & {
|
|
|
10
10
|
export declare class GraphRadialProjector<NodeData = any, Options extends GraphRadialProjectorOptions = any> extends GraphProjector<NodeData, Options> {
|
|
11
11
|
private _timer?;
|
|
12
12
|
findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined;
|
|
13
|
-
protected onUpdate(graph?: Graph): void;
|
|
13
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
14
14
|
protected animate(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Per-frame hook called after node x/y/r are interpolated and before the
|
|
17
|
+
* 'positions' emit. Subclasses override to update edge geometry (`edge.path`)
|
|
18
|
+
* so curves stay glued to moving endpoints. `t` is the eased progress in [0, 1].
|
|
19
|
+
*/
|
|
20
|
+
protected onTickFrame(t: number): void;
|
|
15
21
|
protected onStop(): Promise<void>;
|
|
16
22
|
protected doRadialLayout(): void;
|
|
17
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-radial-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-radial-projector.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-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EG;AACH,eAAO,MAAM,gBAAgB,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,SAG9D,MAAM,KAAG,KAGrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,SAG5D,MAAM,KAAG,KAGrB,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type GraphRelationalProjectorOptions = GraphProjectorOptions & {
|
|
|
8
8
|
duration?: number;
|
|
9
9
|
};
|
|
10
10
|
export declare class GraphRelationalProjector<NodeData = any, Options extends GraphRelationalProjectorOptions = any> extends GraphRadialProjector<NodeData, Options> {
|
|
11
|
-
protected onUpdate(graph?: Graph): void;
|
|
11
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
12
12
|
protected doRelationalLayout(selected: GraphLayoutNode): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=graph-relational-projector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-relational-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-relational-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-relational-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-relational-projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAA8C,MAAM,0BAA0B,CAAC;AAE5G,MAAM,MAAM,+BAA+B,GAAG,qBAAqB,GAAG;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,wBAAwB,CACnC,QAAQ,GAAG,GAAG,EACd,OAAO,SAAS,+BAA+B,GAAG,GAAG,CACrD,SAAQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC/C,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,QAkB5C;IAED,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,eAAe,QAoErD;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Graph } from '@dxos/graph';
|
|
2
|
+
import { type GraphLayoutNode } from '../types';
|
|
3
|
+
import { GraphProjector, type GraphProjectorOptions } from './graph-projector';
|
|
4
|
+
/** Per-frame state stored on a layout node by the projector. */
|
|
5
|
+
export type SwarmNode = GraphLayoutNode & {
|
|
6
|
+
vx?: number;
|
|
7
|
+
vy?: number;
|
|
8
|
+
ax?: number;
|
|
9
|
+
ay?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Shallow ring buffer of recent absolute positions (oldest first). One position is
|
|
12
|
+
* pushed per tick BEFORE integration, so after a tick the most recent entry is the
|
|
13
|
+
* pre-tick position. Cleared whenever the boid wraps a viewBox edge so the trail
|
|
14
|
+
* doesn't streak across the canvas.
|
|
15
|
+
*/
|
|
16
|
+
history?: Array<{
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export type GraphSwarmProjectorOptions = GraphProjectorOptions & {
|
|
22
|
+
/** Initial spread (px) of new boids around the origin. */
|
|
23
|
+
spawnRadius?: number;
|
|
24
|
+
/** Hard cap on per-tick velocity. */
|
|
25
|
+
maxVelocity?: number;
|
|
26
|
+
/** Per-force weights — match Swarm's normalisation (divided by 100 on apply). */
|
|
27
|
+
alignment?: number;
|
|
28
|
+
cohesion?: number;
|
|
29
|
+
separation?: number;
|
|
30
|
+
/** Pixel radius (in SVG model coords) of the invisible repel zone tracking the pointer. 0 disables. */
|
|
31
|
+
cursorRepel?: number;
|
|
32
|
+
/** Avoidance force weight (divided by 10 on apply, matching canvas Swarm). */
|
|
33
|
+
avoidance?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Number of previous positions retained per boid (one per simulation tick). The visible
|
|
36
|
+
* tail spans roughly `trailLength * maxVelocity` pixels — at 60 fps a value of 30 is
|
|
37
|
+
* about a half-second streak. Dense per-tick sampling avoids the "snap" artifact a
|
|
38
|
+
* coarser sample interval introduces when only the head moves between samples.
|
|
39
|
+
*/
|
|
40
|
+
trailLength?: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Boids projector. One simulation timer (d3 `timer`) drives the tick; nodes are
|
|
44
|
+
* the boids, with `vx/vy/ax/ay` carried alongside `x/y`. Edges are kept in the
|
|
45
|
+
* layout so the renderer still draws them between connected boids, but they do
|
|
46
|
+
* NOT exert a link force — boid motion is governed purely by alignment, cohesion
|
|
47
|
+
* and separation, with viewBox-wrap at the SVG bounds.
|
|
48
|
+
*/
|
|
49
|
+
export declare class GraphSwarmProjector<NodeData = any> extends GraphProjector<NodeData, GraphSwarmProjectorOptions> {
|
|
50
|
+
#private;
|
|
51
|
+
findNode(): GraphLayoutNode<NodeData> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Tell the projector where the pointer is, in SVG model coordinates (the same space
|
|
54
|
+
* `node.x/y` live in — center origin, post-zoom). Pass `null` (or omit args) on
|
|
55
|
+
* pointer-leave to disable cursor avoidance.
|
|
56
|
+
*/
|
|
57
|
+
setCursor(x?: number | null, y?: number | null): void;
|
|
58
|
+
protected onUpdate(graph?: Graph.Any): void;
|
|
59
|
+
protected onStart(): Promise<void>;
|
|
60
|
+
protected onStop(): Promise<void>;
|
|
61
|
+
protected onRefresh(): void;
|
|
62
|
+
private initializeNodes;
|
|
63
|
+
private startTimer;
|
|
64
|
+
private stopTimer;
|
|
65
|
+
/**
|
|
66
|
+
* One simulation step. Modeled on `tick` in Swarm.tsx, but operating in the
|
|
67
|
+
* SVG centered-origin coordinate space and writing to `node.x/y` directly so
|
|
68
|
+
* the existing `GraphRenderer.applyPositions` reads them unchanged.
|
|
69
|
+
*/
|
|
70
|
+
private tick;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=graph-swarm-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-swarm-projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/graph-swarm-projector.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAa/E,gEAAgE;AAChE,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG;IAC/D,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAyBF;;;;;;GAMG;AACH,qBAAa,mBAAmB,CAAC,QAAQ,GAAG,GAAG,CAAE,SAAQ,cAAc,CAAC,QAAQ,EAAE,0BAA0B,CAAC;;IAKlG,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,CAGzD;IAED;;;;OAIG;IACH,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAMpD;IAED,UAAmB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,IAAI,CAMnD;IAED,UAAyB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhD;IAED,UAAyB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;IAED,UAAmB,SAAS,IAAI,IAAI,CAInC;IAMD,OAAO,CAAC,eAAe;IAmCvB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,SAAS;IAKjB;;;;OAIG;IACH,OAAO,CAAC,IAAI;CAuLb"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
export * from './graph-bundle-projector';
|
|
2
|
+
export * from './graph-cluster-projector';
|
|
1
3
|
export * from './graph-drag';
|
|
2
4
|
export * from './graph-projector';
|
|
3
5
|
export * from './graph-force-projector';
|
|
4
6
|
export * from './graph-hierarchical-projector';
|
|
7
|
+
export * from './graph-lattice-projector';
|
|
8
|
+
export * from './graph-plexus-projector';
|
|
5
9
|
export * from './graph-relational-projector';
|
|
6
10
|
export * from './graph-radial-projector';
|
|
11
|
+
export * from './graph-swarm-projector';
|
|
7
12
|
export * from './projector';
|
|
8
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/index.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { type IdAccessor } from '../types';
|
|
|
4
4
|
export type ProjectorOptions = {
|
|
5
5
|
idAccessor?: IdAccessor;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Update kinds signal what changed since the previous render.
|
|
9
|
+
* - `topology`: nodes/edges added or removed, or per-node attributes may have changed.
|
|
10
|
+
* The renderer should perform a full enter/exit join and re-run attribute callbacks.
|
|
11
|
+
* - `positions`: only `x/y` (and similar transient layout state) changed.
|
|
12
|
+
* The renderer can fast-path: just update transforms and edge geometry.
|
|
13
|
+
*/
|
|
14
|
+
export type ProjectorUpdateKind = 'topology' | 'positions';
|
|
7
15
|
/**
|
|
8
16
|
* Generates a layout to be rendered.
|
|
9
17
|
*/
|
|
@@ -11,6 +19,7 @@ export declare abstract class Projector<NodeData, Layout, Options extends Projec
|
|
|
11
19
|
private readonly _context;
|
|
12
20
|
readonly updated: EventEmitter<{
|
|
13
21
|
layout: Layout;
|
|
22
|
+
kind: ProjectorUpdateKind;
|
|
14
23
|
}>;
|
|
15
24
|
private readonly _options;
|
|
16
25
|
constructor(_context: SVGContext, options?: Partial<Options>);
|
|
@@ -19,7 +28,7 @@ export declare abstract class Projector<NodeData, Layout, Options extends Projec
|
|
|
19
28
|
get options(): Options;
|
|
20
29
|
refresh(dragging?: boolean): void;
|
|
21
30
|
updateData(data?: NodeData): void;
|
|
22
|
-
emitUpdate(): void;
|
|
31
|
+
emitUpdate(kind?: ProjectorUpdateKind): void;
|
|
23
32
|
clear(): Promise<void>;
|
|
24
33
|
start(): Promise<void>;
|
|
25
34
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,8BAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAS,gBAAgB;IAM9E,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAL3B,SAAgB,OAAO;gBAA8B,MAAM;OAAM;
|
|
1
|
+
{"version":3,"file":"projector.d.ts","sourceRoot":"","sources":["../../../../../src/graph/projector/projector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,C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AAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"bullets.d.ts","sourceRoot":"","sources":["../../../../../src/graph/renderer/bullets.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,YAAY,CAAC;AAE/D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,UAAW,WAAW,UAAU,MAAM,YAAW,aAAa,KAAQ,UAiD/F,CAAC"}
|