@dxos/react-ui-graph 0.8.3 → 0.8.4-main.3a94e84
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/lib/browser/{chunk-2YMRPQU7.mjs → chunk-MGVY54T5.mjs} +12 -12
- package/dist/lib/browser/index.mjs +35 -35
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -4
- package/dist/lib/node-esm/{chunk-ITHTKQOY.mjs → chunk-X5YVOSXZ.mjs} +12 -12
- package/dist/lib/node-esm/index.mjs +35 -35
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +4 -4
- package/dist/types/src/components/Graph/Graph.stories.d.ts +1 -1
- package/dist/types/src/components/Graph/Graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Mesh/Mesh.stories.d.ts +1 -1
- package/dist/types/src/components/Mesh/Mesh.stories.d.ts.map +1 -1
- package/dist/types/src/fx/fx.stories.d.ts +1 -1
- package/dist/types/src/fx/fx.stories.d.ts.map +1 -1
- package/dist/types/src/stories/hooks.stories.d.ts +1 -1
- package/dist/types/src/stories/hooks.stories.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/components/Graph/Graph.stories.tsx +3 -3
- package/src/components/Mesh/Mesh.stories.tsx +1 -1
- package/src/fx/fx.stories.tsx +1 -1
- package/src/graph/projector/graph-force-projector.ts +1 -1
- package/src/stories/hooks.stories.tsx +1 -1
- package/src/util/index.ts +2 -2
- package/dist/lib/node/chunk-WFHWEMPB.cjs +0 -919
- package/dist/lib/node/chunk-WFHWEMPB.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -1547
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -214
- package/dist/lib/node/testing/index.cjs.map +0 -7
- /package/dist/lib/browser/{chunk-2YMRPQU7.mjs.map → chunk-MGVY54T5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-ITHTKQOY.mjs.map → chunk-X5YVOSXZ.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Graph/Graph.tsx", "../../../src/graph/markers.ts", "../../../src/graph/projector/graph-drag.ts", "../../../src/graph/types.ts", "../../../src/graph/projector/projector.ts", "../../../src/graph/projector/graph-projector.ts", "../../../src/graph/projector/graph-force-projector.ts", "../../../src/graph/projector/graph-forces.ts", "../../../src/graph/projector/graph-hierarchical-projector.ts", "../../../src/graph/projector/graph-radial-projector.ts", "../../../src/graph/projector/graph-relational-projector.ts", "../../../src/graph/renderer/graph-renderer.ts", "../../../src/graph/renderer/bullets.ts", "../../../src/graph/renderer/renderer.ts", "../../../src/graph/renderer/linker.ts", "../../../src/components/Mesh/Mesh.tsx", "../../../src/components/SVG/Grid.tsx", "../../../src/components/SVG/Markers.tsx", "../../../src/components/SVG/Root.tsx", "../../../src/components/SVG/Zoom.tsx", "../../../src/components/SVG/SVG.tsx", "../../../src/fx/pulsar.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport React, { type JSX, type Ref, forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';\n\nimport { combine } from '@dxos/async';\nimport { type BaseGraphEdge, type BaseGraphNode, type GraphModel } from '@dxos/graph';\nimport { log } from '@dxos/log';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport {\n createGraphDrag,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProjector,\n GraphRenderer,\n type GraphRendererOptions,\n} from '../../graph';\nimport { useSvgContext } from '../../hooks';\n\nexport type GraphController = {\n refresh: () => void;\n repaint: () => void;\n findNode: (id: string) => SVGGElement | null;\n};\n\nexport type GraphProps<Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any> = ThemedClassName<\n Pick<GraphRendererOptions<Node>, 'labels' | 'subgraphs' | 'attributes'> & {\n model?: GraphModel<Node, Edge>; // TODO(burdon): ReactiveGraphModel\n projector?: GraphProjector<Node>;\n renderer?: GraphRenderer<Node>;\n drag?: boolean;\n arrows?: boolean;\n onSelect?: (node: GraphLayoutNode<Node>, event: MouseEvent) => void;\n onInspect?: (node: GraphLayoutNode<Node>, event: MouseEvent) => void;\n }\n>;\n\nexport const GraphInner = <Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any>(\n {\n classNames,\n model,\n projector: _projector,\n renderer: _renderer,\n drag,\n arrows,\n onSelect,\n onInspect,\n ...props\n }: GraphProps<Node, Edge>,\n forwardedRef: Ref<GraphController>,\n) => {\n const context = useSvgContext();\n const graphRef = useRef<SVGGElement>();\n\n const { projector, renderer } = useMemo(() => {\n let projector = _projector;\n if (!projector) {\n projector = new GraphForceProjector<Node>(context);\n }\n\n let renderer = _renderer;\n if (!renderer) {\n renderer = new GraphRenderer<Node>(context, graphRef, {\n ...props,\n // TODO(burdon): Replace drag when projector is updated.\n drag: drag ? createGraphDrag(context, projector) : undefined,\n arrows: { end: arrows },\n onNodeClick: onSelect ? (node: GraphLayoutNode, event) => onSelect(node, event) : undefined,\n onNodePointerEnter: onInspect ? (node: GraphLayoutNode, event) => onInspect(node, event) : undefined,\n });\n }\n\n return { projector, renderer };\n }, [context, _projector, _renderer, drag]);\n\n // External API.\n useImperativeHandle(\n forwardedRef,\n () => ({\n refresh: () => {\n projector.updateData(model?.graph);\n },\n repaint: () => {\n renderer.render(projector.layout);\n },\n findNode: (id: string) => {\n return graphRef.current?.querySelector<SVGGElement>(`g[data-id=\"${id}\"]`);\n },\n }),\n [model, projector, renderer],\n );\n\n // Subscriptions.\n useEffect(() => {\n return combine(\n effect(() => {\n projector.updateData(model?.graph);\n }),\n projector.updated.on(({ layout }) => {\n try {\n renderer.render(layout);\n } catch (error) {\n void projector.stop();\n log.catch(error);\n }\n }),\n );\n }, [model, projector, renderer]);\n\n // Start.\n useEffect(() => {\n void projector.start();\n return () => {\n void projector.stop();\n };\n }, [projector]);\n\n return <g ref={graphRef} className={mx('dx-graph', classNames)} />;\n};\n\n/**\n * SVG Graph.\n */\nexport const Graph = forwardRef(GraphInner) as <Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any>(\n props: GraphProps<Node, Edge> & { ref?: Ref<GraphController> },\n) => JSX.Element;\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { line, select } from 'd3';\n\nimport { type D3Callable } from '../util';\n\nconst createLine = line();\n\nexport type MarkerOptions = {\n arrowSize?: number;\n};\n\nconst createArrow =\n (length: number, offset: number, start: boolean): D3Callable =>\n (el) => {\n const height = length * 0.5;\n el.attr('markerWidth', length * 2)\n .attr('markerHeight', height * 2)\n .attr('viewBox', `-${length},-${height},${length * 2},${height * 2}`)\n .attr('orient', 'auto')\n .attr('refX', offset)\n .append('path')\n .attr('fill', 'none')\n // Inherit stroke from path.\n .attr('stroke', 'context-stroke')\n .attr(\n 'd',\n createLine([\n start ? [length, height] : [-length, -height],\n [0, 0],\n start ? [length, -height] : [-length, height],\n ]),\n );\n };\n\nconst createDot =\n (size: number): D3Callable =>\n (el) => {\n el.attr('markerWidth', size * 2)\n .attr('markerHeight', size * 2)\n .attr('viewBox', `-${size},-${size},${size * 2},${size * 2}`)\n .attr('orient', 'auto')\n .append('circle')\n // Inherit stroke from path.\n .attr('fill', 'context-stroke')\n .attr('r', size / 2 - 1);\n };\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker\n * https://www.dashingd3js.com/svg-paths-and-d3js\n * http://bl.ocks.org/dustinlarimer/5888271\n */\nexport const createMarkers =\n ({ arrowSize = 12 }: MarkerOptions = {}): D3Callable =>\n (group) => {\n return group\n .selectAll('marker')\n .data([\n {\n id: 'marker-arrow-start',\n generator: createArrow(arrowSize, -0.5, true),\n className: 'dx-arrow',\n },\n {\n id: 'marker-arrow-end',\n generator: createArrow(arrowSize, 0.5, false),\n className: 'dx-arrow',\n },\n {\n id: 'marker-dot',\n generator: createDot(6),\n className: 'dx-dot',\n },\n ])\n .join('marker')\n .attr('id', (d) => d.id)\n .attr('markerUnits', 'strokeWidth')\n .attr('class', (d) => d.className)\n .each((d, i, nodes) => {\n select(nodes[i]).call(d.generator);\n });\n };\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { drag, pointer, select } from 'd3';\n\nimport { type GraphProjector } from './graph-projector';\nimport { type SVGContext } from '../../hooks';\nimport { type Point } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nenum Mode {\n MOVE = 0,\n LINK = 1,\n}\n\nexport interface DragOptions<N> {\n dragMod?: string;\n linkMod?: string;\n freezeMod?: string;\n onDrag?: (source?: GraphLayoutNode<N>, target?: GraphLayoutNode<N>, point?: Point) => void;\n onDrop?: (source: GraphLayoutNode<N>, target?: GraphLayoutNode<N>) => void;\n}\n\nconst defaultDragOptions: DragOptions<any> = {\n linkMod: 'metaKey',\n freezeMod: 'shiftKey',\n};\n\n/**\n * Create drag handler.\n */\nexport const createGraphDrag = <NodeData>(\n context: SVGContext,\n projector: GraphProjector<NodeData>,\n options: DragOptions<NodeData> = defaultDragOptions,\n) => {\n let mode: Mode;\n let source: GraphLayoutNode<NodeData>;\n let target: GraphLayoutNode<NodeData> | undefined;\n let offset: Point | undefined;\n let moved = false;\n\n const keyMod = (event: MouseEvent, key: string): boolean => {\n const modKey = options?.[key] ?? defaultDragOptions[key];\n return modKey === undefined || event[modKey];\n };\n\n return drag<SVGElement, GraphLayoutNode<NodeData>>()\n .filter((event: MouseEvent) => !event.ctrlKey)\n .on('start', function (event, d) {\n source = d;\n offset = pointer(event, this.parentElement);\n\n if (options?.onDrop && keyMod(event.sourceEvent, 'linkMod')) {\n mode = Mode.LINK;\n } else if (keyMod(event.sourceEvent, 'dragMod')) {\n mode = Mode.MOVE;\n }\n })\n .on('drag', function (event, d) {\n const parent = this.closest('g.node');\n select(parent).classed('dragging', true).raise();\n\n // Calculate position.\n const [dx, dy] = pointer(event, this.parentElement);\n const x = d.x + dx - offset[0];\n const y = d.y + dy - offset[1];\n const point: Point = [x, y];\n\n switch (mode) {\n case Mode.MOVE: {\n select(context.svg).attr('cursor', 'grabbing');\n\n // Freeze node while dragging.\n event.subject.x = event.subject.fx = point[0];\n event.subject.y = event.subject.fy = point[1];\n projector.refresh(true);\n moved = true;\n break;\n }\n\n case Mode.LINK: {\n // Get drop target.\n if (options?.onDrag) {\n target = projector.findNode(event.x, event.y, 16);\n if (source === target) {\n select(context.svg).attr('cursor', undefined);\n options?.onDrag?.();\n } else {\n select(context.svg).attr('cursor', target ? 'alias' : 'cell');\n options?.onDrag?.(source, target, point);\n }\n }\n }\n }\n })\n .on('end', function (event) {\n select(context.svg).attr('cursor', undefined);\n select(this.parentElement).classed('dragging', false);\n switch (mode) {\n case Mode.LINK: {\n options?.onDrop?.(source, target);\n break;\n }\n }\n\n // Freeze node.\n if (!keyMod(event.sourceEvent, 'freezeMod')) {\n event.subject.fx = null;\n event.subject.fy = null;\n }\n\n mode = undefined;\n source = undefined;\n target = undefined;\n offset = undefined;\n\n if (moved) {\n projector.refresh(false);\n moved = false;\n }\n });\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\n//\n// Data\n// Generic graph data type.\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { invariant } from '@dxos/invariant';\n\nimport { type Point } from '../util';\n\nexport type IdAccessor<N = any> = (node: N) => string;\n\nexport const defaultIdAccessor: IdAccessor = (node: any) => {\n invariant(node.id);\n return node.id;\n};\n\nexport const emptyGraph: Graph = {\n nodes: [],\n edges: [],\n};\n\n//\n// Layout\n// Graph layout used by graph renderers.\n//\n\nexport type GraphGuide = {\n id: string;\n type: string;\n cx: number;\n cy: number;\n r: number;\n classes?: {\n circle?: string;\n };\n};\n\nexport type GraphLayoutNode<NodeData = any> = {\n id: string;\n type?: string;\n order?: number;\n data?: NodeData;\n x?: number;\n y?: number;\n r?: number;\n classes?: {\n circle?: string;\n text?: string;\n };\n children?: number;\n initialized?: boolean;\n last?: Point;\n};\n\nexport type GraphLayoutEdge<NodeData = any, EdgeData = any> = {\n id: string;\n type?: string;\n order?: number;\n source: GraphLayoutNode<NodeData>;\n target: GraphLayoutNode<NodeData>;\n data?: EdgeData;\n linkForce?: boolean;\n classes?: {\n path?: string;\n };\n};\n\nexport type GraphLayout<NodeData = any, EdgeData = any> = {\n id?: string;\n guides?: GraphGuide[];\n graph: {\n nodes: GraphLayoutNode<NodeData>[];\n edges: GraphLayoutEdge<NodeData, EdgeData>[];\n };\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type SVGContext } from '../../hooks';\nimport { EventEmitter } from '../../util';\nimport { defaultIdAccessor, type IdAccessor } from '../types';\n\nexport type ProjectorOptions = {\n idAccessor?: IdAccessor;\n};\n\n/**\n * Generates a layout to be rendered.\n */\nexport abstract class Projector<NodeData, Layout, Options extends ProjectorOptions> {\n public readonly updated = new EventEmitter<{ layout: Layout }>();\n\n private readonly _options: Options;\n\n constructor(\n private readonly _context: SVGContext,\n options?: Partial<Options>,\n ) {\n this._options = Object.assign(\n {\n idAccessor: defaultIdAccessor,\n },\n options,\n ) as Options;\n }\n\n abstract get layout(): Layout;\n\n get context(): SVGContext {\n return this._context;\n }\n\n get options(): Options {\n return this._options;\n }\n\n refresh(dragging = false) {\n this.onRefresh(dragging);\n }\n\n updateData(data?: NodeData) {\n this.onUpdate(data);\n }\n\n emitUpdate() {\n this.updated.emit({ layout: this.layout });\n }\n\n async clear() {\n await this.onClear();\n }\n\n async start() {\n await this.onStart();\n }\n\n async stop() {\n await this.onStop();\n }\n\n protected onRefresh(dragging = false): void {}\n protected onUpdate(data?: NodeData): void {}\n protected async onClear(): Promise<void> {}\n protected async onStart(): Promise<void> {}\n protected async onStop(): Promise<void> {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type SelectionModel, type Graph } from '@dxos/graph';\n\nimport { Projector, type ProjectorOptions } from './projector';\nimport { type SVGContext } from '../../hooks';\nimport { emptyGraph, type GraphLayout, type GraphLayoutNode } from '../types';\n\nexport type GraphProjectorOptions = ProjectorOptions & {};\n\n/**\n * Base class for graph projectors.\n */\nexport abstract class GraphProjector<NodeData = any, Options extends GraphProjectorOptions = any> extends Projector<\n Graph,\n GraphLayout<NodeData>,\n Options\n> {\n private readonly _layout: GraphLayout<NodeData>;\n\n // TODO(burdon): Change to object props.\n constructor(\n context: SVGContext,\n options?: Options,\n private readonly _selection?: SelectionModel,\n layout?: GraphLayout<NodeData>,\n ) {\n super(context, options);\n this._layout = {\n id: (Math.random() * 10).toString().slice(8),\n graph: {\n nodes: [...(layout?.graph.nodes ?? [])],\n edges: [...(layout?.graph.edges ?? [])],\n },\n };\n }\n\n get layout() {\n return this._layout;\n }\n\n get selection() {\n return this._selection;\n }\n\n numChildren(node: GraphLayoutNode) {\n return this._layout.graph.edges.filter((edge) => edge.source.id === this.options.idAccessor(node)).length;\n }\n\n reset() {\n this._layout.graph.nodes = [];\n this._layout.graph.edges = [];\n this.emitUpdate();\n }\n\n /**\n * Merge external data with internal representation (e.g., so force properties like position are preserved).\n * @param data\n */\n protected mergeData(data: Graph = emptyGraph) {\n // Merge nodes.\n const nodes: GraphLayoutNode[] = data.nodes.map((node) => {\n let current: GraphLayoutNode = this._layout.graph.nodes.find((n) => n.id === this.options.idAccessor(node));\n if (!current) {\n current = {\n id: this.options.idAccessor(node),\n };\n }\n\n current.data = node;\n return current;\n });\n\n // Replace edges.\n const edges = data.edges\n .map((edge) => ({\n id: edge.id,\n source: nodes.find((n) => n.id === edge.source),\n target: nodes.find((n) => n.id === edge.target),\n data: edge.data,\n }))\n .filter((edge) => edge.source && edge.target);\n\n Object.assign(this._layout, {\n graph: {\n nodes,\n edges,\n },\n });\n }\n\n override async onClear() {\n this.reset();\n }\n\n abstract findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined;\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport {\n type Force,\n forceCenter,\n forceCollide,\n forceLink,\n forceManyBody,\n forceRadial,\n forceSimulation,\n forceX,\n forceY,\n} from 'd3';\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { forcePoint } from './graph-forces';\nimport { GraphProjector, type GraphProjectorOptions } from './graph-projector';\nimport { type GraphLayoutEdge, type GraphLayoutNode } from '../types';\n\n/**\n * Return value or invoke function.\n * @param valueOrFunction\n * @param invoker\n * @param defaultValue\n */\nconst getValue = <T>(\n valueOrFunction: T | ((...args: any[]) => T) | undefined,\n invoker: (fn: (...args: any[]) => T) => T,\n defaultValue: T,\n) => {\n return (\n (typeof valueOrFunction === 'function' ? invoker(valueOrFunction as (...args: any[]) => T) : valueOrFunction) ??\n defaultValue\n );\n};\n\n/**\n * Returns the config object or an empty object if the property is set to true (or defaults to true).\n * Otherwise returns undefined.\n * @param options\n * @param cb\n * @param defaultValue\n */\nconst maybeForce = <Config>(\n options: Config | boolean,\n cb: (config: Config) => Force<any, any>,\n defaultValue = undefined,\n) => {\n const value = typeof options === 'boolean' ? (options ? {} : undefined) : options ?? defaultValue;\n if (value) {\n return cb(value);\n }\n};\n\n//\n// Forces\n// TODO(burdon): Provide utils for function properties (e.g., count edges).\n//\n\n/**\n * https://github.com/d3/d3-force#forceLink\n */\nexport type ForceLinkOptions = {\n // Default: edge => 1 / Math.min(2, count(edge.source), count(edge.target))\n strength?: number | ((edge: GraphLayoutEdge<any>) => number);\n distance?: number;\n iterations?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceManyBody\n */\nexport type ForceManyBodyOptions = {\n strength?: number | ((node: GraphLayoutNode<any>) => number);\n distanceMax?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#centering\n */\nexport type ForceCenterOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceCollide\n */\nexport type ForceCollideOptions = {\n radius?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceRadial\n */\nexport type ForceRadialOptions = {\n delay?: number;\n x?: number;\n y?: number;\n radius?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#positioning\n */\nexport type ForcePositioningOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\n/**\n * All force options.\n * NOTE: A value of `true` enables the force with the default option.\n */\n// TODO(burdon): Options for alpha, etc.\n// TODO(burdon): Change to map of forces by type (i.e., support multiple forces of the same type).\nexport type ForceOptions = {\n link?: boolean | ForceLinkOptions;\n manyBody?: boolean | ForceManyBodyOptions;\n center?: boolean | ForceCenterOptions;\n collide?: boolean | ForceCollideOptions;\n radial?: boolean | ForceRadialOptions;\n point?: boolean | ForcePositioningOptions;\n x?: boolean | ForcePositioningOptions;\n y?: boolean | ForcePositioningOptions;\n};\n\nexport const defaultForceOptions: ForceOptions = {\n link: true,\n manyBody: true,\n // center: true,\n point: true,\n};\n\nexport type GraphForceProjectorOptions = GraphProjectorOptions & {\n guides?: boolean;\n forces?: ForceOptions;\n radius?: number;\n attributes?: {\n radius?: number | ((node: GraphLayoutNode<any>, children: number) => number);\n linkForce?: boolean | ((edge: GraphLayoutEdge<any>) => boolean);\n };\n};\n\n/**\n * D3 force directed graph layout using d3 simulation..\n */\nexport class GraphForceProjector<NodeData = any> extends GraphProjector<NodeData, GraphForceProjectorOptions> {\n // https://github.com/d3/d3-force\n private _simulation = forceSimulation<GraphLayoutNode, GraphLayoutEdge>();\n\n private _timeout?: NodeJS.Timeout;\n\n get forces() {\n return this.options.forces ?? defaultForceOptions;\n }\n\n get simulation() {\n return this._simulation;\n }\n\n restart() {\n this._simulation.alpha(1).restart();\n }\n\n override findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined {\n return this._simulation.find(x, y, radius);\n }\n\n override async onStart() {\n clearTimeout(this._timeout);\n let propagating = true;\n\n // Delay radial force until other forces have settled.\n const { radial, ...forces } = this.forces;\n const delay = typeof radial === 'object' ? radial.delay : undefined;\n if (delay) {\n propagating = false;\n this.updateForces(forces);\n this._timeout = setTimeout(() => {\n this.updateForces(this.forces);\n this.restart();\n this._timeout = setTimeout(() => {\n propagating = true;\n }, delay);\n }, delay);\n } else {\n this.updateForces(this.forces);\n }\n\n this._simulation\n .on('tick', () => propagating && this.emitUpdate())\n .velocityDecay(0.3)\n .alphaDecay(1 - Math.pow(0.001, 1 / 300))\n .alpha(1)\n .restart();\n }\n\n override async onStop() {\n clearTimeout(this._timeout);\n this._simulation.stop();\n }\n\n override onRefresh(dragging = false) {\n // Disable centering force while dragging.\n if (this.forces.center) {\n if (dragging) {\n this._simulation.force('center', null);\n } else {\n this.updateForces(this.forces);\n }\n }\n\n this.restart();\n }\n\n override onUpdate(graph?: Graph): void {\n log('onUpdate', { graph: { nodes: graph?.nodes.length, edges: graph?.edges.length } });\n this._simulation.stop();\n this.mergeData(graph);\n this.updateLayout();\n this.updateForces(this.forces);\n this.restart();\n }\n\n private updateLayout() {\n // Guides.\n this.layout.guides = this.options.guides\n ? [\n {\n id: 'g-1',\n type: 'circle',\n cx: 0,\n cy: 0,\n r: this.context.scale.model.toValue([10, 1]),\n },\n ]\n : undefined;\n\n // Initialize nodes.\n this.layout.graph.nodes.forEach((node) => {\n if (!node.initialized) {\n // Get starting point from linked element.\n // const edge = this.layout.graph.edges.find((edge) => edge.target.id === this.options.idAccessor(node));\n const a = 2 * Math.PI * Math.random();\n const r = this.options.radius ?? 200;\n\n // Initial positions.\n Object.assign(node, {\n initialized: true,\n\n // TODO(burdon): Only when new nodes added to initial layout.\n // Position around center or parent; must have delta to avoid spike.\n // x: edge?.source?.x ?? Math.cos(a) * r,\n // y: edge?.source?.y ?? Math.sin(a) * r,\n x: Math.cos(a) * r,\n y: Math.sin(a) * r,\n });\n }\n\n // TODO(burdon): Ignored by renderer?\n Object.assign(node, {\n r: getValue<number>(this.options?.attributes?.radius, (fn) => fn(node, this.numChildren(node)), 6),\n });\n });\n\n // Initialize edges.\n this.layout.graph.edges.forEach((edge) => {\n Object.assign(edge, {\n linkForce: getValue<boolean>(this.options.attributes?.linkForce, (fn) => fn(edge), true),\n });\n });\n }\n\n /**\n * Update all forces.\n */\n private updateForces(forces: ForceOptions): void {\n log('updateForces', { forces });\n\n // https://github.com/d3/d3-force#simulation_force\n this._simulation\n\n // Nodes\n // https://github.com/d3/d3-force#simulation_nodes\n .nodes(this.layout.graph.nodes)\n\n // Links.\n // https://github.com/d3/d3-force#forceLink\n .force(\n 'link',\n maybeForce<ForceLinkOptions>(\n forces?.link,\n (config) => {\n const force = forceLink()\n .id((d: GraphLayoutNode) => d.id)\n .links(this.layout.graph.edges.filter((edge) => edge.linkForce));\n if (config.distance != null) {\n force.distance(config.distance);\n }\n if (config.strength != null) {\n force.strength(config.strength);\n }\n if (config.iterations != null) {\n force.iterations(config.iterations);\n }\n return force;\n },\n forces?.link === false ? undefined : {},\n ),\n )\n\n // Repulsion.\n // https://github.com/d3/d3-force#forceManyBody\n .force(\n 'manyBody',\n maybeForce<ForceManyBodyOptions>(\n forces?.manyBody,\n (config) => {\n const force = forceManyBody();\n if (config.distanceMax != null) {\n force.distanceMax(config.distanceMax);\n }\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n },\n forces?.manyBody === false ? undefined : {},\n ),\n )\n\n // Collision.\n // https://github.com/d3/d3-force#forceCollide\n .force(\n 'collide',\n maybeForce<ForceCollideOptions>(forces?.collide, (config) => {\n const force = forceCollide();\n force.radius(config.radius ?? 8);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Radial.\n // https://github.com/d3/d3-force#forceRadial\n .force(\n 'radial',\n maybeForce<ForceRadialOptions>(forces?.radial, (config) => {\n const force = forceRadial(config.radius ?? 100, config.x ?? 0, config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Centering.\n // NOTE: This moves all nodes such that the center of mass is at the origin.\n // It is different from the positional force which attracts nodes to a point.\n // https://github.com/d3/d3-force#centering\n .force(\n 'center',\n maybeForce<ForceCenterOptions>(forces?.center, (config) => {\n const force = forceCenter()\n .x(config.x ?? 0)\n .y(config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Positioning.\n // https://github.com/d3/d3-force#forcePoint\n .force(\n 'point',\n maybeForce<ForcePositioningOptions>(forces?.point, ({ x = 0, y = 0, strength }) => {\n return forcePoint({ x, y, strength });\n }),\n )\n .force(\n 'x',\n maybeForce<ForcePositioningOptions>(forces?.x, (config: ForcePositioningOptions) => {\n const force = forceX(config.x ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n .force(\n 'y',\n maybeForce<ForcePositioningOptions>(forces?.y, (config: ForcePositioningOptions) => {\n const force = forceY(config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n );\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Force, forceX, forceY, type SimulationLinkDatum, type SimulationNodeDatum } from 'd3';\n\nexport type ForcePointOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\nexport const forcePoint = <\n NodeDatum extends SimulationNodeDatum,\n LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined,\n>({\n x,\n y,\n strength = 0.01,\n}: ForcePointOptions): Force<NodeDatum, LinkDatum> => {\n const fx = x != null ? forceX(x).strength(strength) : undefined;\n const fy = y != null ? forceY(y).strength(strength) : undefined;\n\n const force = (alpha: number) => {\n fx?.(alpha);\n fy?.(alpha);\n };\n\n force.initialize = (nodes: any[], random: () => number) => {\n fx?.initialize(nodes, random);\n fy?.initialize(nodes, random);\n };\n\n return force;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { type GraphProjectorOptions } from './graph-projector';\nimport { GraphRadialProjector, layoutRadial, updateNode } from './graph-radial-projector';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphHierarchicalProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphHierarchicalProjector<\n NodeData = any,\n Options extends GraphHierarchicalProjectorOptions = any,\n> extends GraphRadialProjector<NodeData, Options> {\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', {\n graph: { nodes: graph?.nodes.length, edges: graph?.edges.length },\n selection: this.selection?.selected.value,\n });\n\n this.mergeData(graph);\n const selected = this.selection?.selected.value?.[0];\n if (selected) {\n const node = this.layout.graph.nodes.find((node) => node.id === selected);\n if (node) {\n this.doHierarchicalLayout(node);\n return;\n }\n }\n\n this.doRadialLayout();\n }\n\n protected doHierarchicalLayout(selected: GraphLayoutNode) {\n if (!this.context.size) {\n return;\n }\n\n const r2 =\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80);\n const r1 = r2 / 2;\n\n const children = this.layout.graph.edges\n .filter((edge) => edge.source.id === selected.id)\n .map((edge) => edge.target);\n\n // Root.\n updateNode(selected, [0, 0], 20);\n\n // Inner.\n {\n const radial = layoutRadial(0, 0, r1, children.length);\n children.forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n // Outer.\n {\n const radial = layoutRadial(0, 0, r2, this.layout.graph.nodes.length - 1 - children.length);\n this.layout.graph.nodes\n .filter((node) => node.id !== selected.id && !children.includes(node))\n .forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n this.animate();\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { easeCubic, timer, type Timer } from 'd3';\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { GraphProjector, type GraphProjectorOptions } from './graph-projector';\nimport { type Point } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphRadialProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphRadialProjector<\n NodeData = any,\n Options extends GraphRadialProjectorOptions = any,\n> extends GraphProjector<NodeData, Options> {\n private _timer?: Timer;\n\n override findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined {\n return undefined;\n }\n\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', { graph: { nodes: graph?.nodes.length, edges: graph?.edges.length } });\n this.mergeData(graph);\n this.doRadialLayout();\n }\n\n protected animate() {\n const start = Date.now();\n if (this.options.duration) {\n this._timer = timer(() => {\n const t = Math.min(1, (Date.now() - start) / this.options.duration);\n const d = easeCubic(t);\n\n this.layout.graph.nodes.forEach((node: any) => {\n node.x = node.sx + (node.tx - node.sx) * d;\n node.y = node.sy + (node.ty - node.sy) * d;\n node.r = node.sr + (node.tr - node.sr) * d;\n });\n\n this.emitUpdate();\n if (t >= 1) {\n this._timer.stop();\n this._timer = undefined;\n }\n });\n } else {\n this.emitUpdate();\n }\n }\n\n protected override async onStop() {\n this._timer?.stop();\n this._timer = undefined;\n }\n\n protected doRadialLayout() {\n if (!this.context.size) {\n return;\n }\n\n const radial = layoutRadial(\n 0,\n 0,\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80),\n this.layout.graph.nodes.length,\n );\n\n this.layout.graph.nodes.forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n\n this.animate();\n }\n}\n\n/**\n * Update node target.\n */\nexport const updateNode = (node: GraphLayoutNode, [tx, ty]: Point, tr = 8) => {\n const sx = node.x ?? tx;\n const sy = node.y ?? ty;\n const sr = node.r ?? tr;\n Object.assign(node, {\n initialized: true,\n // Start.\n sx,\n sy,\n sr,\n // Target.\n tx,\n ty,\n tr,\n // Current.\n x: sx,\n y: sy,\n r: sr,\n });\n};\n\n/**\n * Radial position generator.\n */\nexport const layoutRadial = (x: number, y: number, r: number, n: number, start = -Math.PI / 2) => {\n const da = (2 * Math.PI) / n;\n return (i: number): Point => {\n const a = start + i * da;\n return [x + Math.cos(a) * r, y + Math.sin(a) * r];\n };\n};\n\n/**\n * Horizontal position generator.\n */\nexport const layoutHorizontal = (x: number, y: number, w: number, n: number) => {\n const dx = n > 1 ? w / (n - 1) : 0;\n const sx = x - ((n - 1) * dx) / 2;\n return (i: number): Point => {\n return [sx + i * dx, y];\n };\n};\n\n/**\n * Vertical position generator.\n */\nexport const layoutVertical = (x: number, y: number, h: number, n: number) => {\n const dy = n > 1 ? h / (n - 1) : 0;\n const sy = y - ((n - 1) * dy) / 2;\n return (i: number): Point => {\n return [x, sy + i * dy];\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { type GraphProjectorOptions } from './graph-projector';\nimport { GraphRadialProjector, layoutHorizontal, layoutRadial, updateNode } from './graph-radial-projector';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphRelationalProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphRelationalProjector<\n NodeData = any,\n Options extends GraphRelationalProjectorOptions = any,\n> extends GraphRadialProjector<NodeData, Options> {\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', {\n graph: { nodes: graph?.nodes.length, edges: graph?.edges.length },\n selection: this.selection?.selected.value,\n });\n\n this.mergeData(graph);\n const selected = this.selection?.selected.value?.[0];\n if (selected) {\n const node = this.layout.graph.nodes.find((node) => node.id === selected);\n if (node) {\n this.doRelationalLayout(node);\n return;\n }\n }\n\n this.doRadialLayout();\n }\n\n protected doRelationalLayout(selected: GraphLayoutNode) {\n if (!this.context.size) {\n return;\n }\n\n // TODO(burdon): Generate edge types.\n const r2 =\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80);\n const r1 = r2 * 0.5;\n\n this.layout.graph.nodes.forEach((node) => (node.type = undefined));\n this.layout.graph.edges.forEach((edge) => {\n edge.order = 0;\n edge.type = undefined;\n });\n\n const children = this.layout.graph.edges\n .filter((edge) => edge.source.id === selected.id)\n .map((edge) => {\n edge.order = 1;\n edge.type = '1';\n edge.target.type = '1';\n return edge.target;\n });\n\n const parents = this.layout.graph.edges\n .filter((edge) => edge.target.id === selected.id)\n .map((edge) => {\n edge.order = 2;\n edge.type = '2';\n edge.source.type = '2';\n return edge.source;\n });\n\n // Root.\n updateNode(selected, [0, 0], 30);\n\n // Children.\n {\n const vertical = layoutHorizontal(0, r1, r1 * 2, children.length);\n children.forEach((node, i) => {\n const [tx, ty] = vertical(i);\n updateNode(node, [tx, ty], 20);\n });\n }\n\n // Parents.\n {\n const vertical = layoutHorizontal(0, -r1, r1, parents.length);\n parents.forEach((node, i) => {\n const [tx, ty] = vertical(i);\n updateNode(node, [tx, ty], 20);\n });\n }\n\n // Outer.\n {\n const radial = layoutRadial(0, 0, r2, this.layout.graph.nodes.length - 1 - children.length - parents.length);\n this.layout.graph.nodes\n .filter((node) => node.id !== selected.id && !children.includes(node) && !parents.includes(node))\n .forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n this.animate();\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { line, select, polygonHull, easeCubicOut } from 'd3';\nimport * as Clipper from 'js-clipper';\n\nimport { log } from '@dxos/log';\n\nimport { createBullets } from './bullets';\nimport { Renderer, type RendererOptions } from './renderer';\nimport { getCircumferencePoints, type D3Selection, type D3Callable, type Point } from '../../util';\nimport { type GraphLayout, type GraphLayoutEdge, type GraphLayoutNode } from '../types';\n\nconst createLine = line<Point>();\n\nexport type LabelOptions<NodeData = any> = {\n text: (node: GraphLayoutNode<NodeData>, highlight?: boolean) => string | undefined;\n};\n\nexport type AttributesOptions<NodeData = any, EdgeData = any> = {\n node?: (node: GraphLayoutNode<NodeData>) => {\n classes?: Record<string, boolean>;\n data?: Record<string, string | undefined>;\n };\n\n edge?: (edge: GraphLayoutEdge<NodeData, EdgeData>) => {\n classes?: Record<string, boolean>;\n data?: Record<string, string | undefined>;\n };\n};\n\nexport type GraphRendererOptions<NodeData = any, EdgeData = any> = RendererOptions<{\n drag?: D3Callable;\n arrows?: {\n start?: boolean; // TODO(burdon): Replace with marker id.\n end?: boolean;\n };\n highlight?: boolean;\n labels?: LabelOptions<NodeData>;\n subgraphs?: boolean;\n attributes?: AttributesOptions<NodeData>;\n transition?: () => any;\n onNodeClick?: (node: GraphLayoutNode<NodeData>, event: MouseEvent) => void;\n onNodePointerEnter?: (node: GraphLayoutNode<NodeData>, event: MouseEvent) => void;\n onLinkClick?: (link: GraphLayoutEdge<NodeData, EdgeData>, event: MouseEvent) => void;\n}>;\n\n// TODO(burdon): Perf\n// - Leaking JS event listeners.\n// - Don't update unless data changes.\n// - Cache subgraph components in layout.\n\n/**\n * Renders the Graph layout.\n */\nexport class GraphRenderer<NodeData = any, EdgeData = any> extends Renderer<\n GraphLayout<NodeData, EdgeData>,\n GraphRendererOptions<NodeData, EdgeData>\n> {\n override render(layout: GraphLayout<NodeData, EdgeData>) {\n log('render', layout);\n\n const root = select(this.root);\n\n //\n // Guides\n //\n\n if (layout.guides) {\n root\n .selectAll('g.dx-guides')\n .data([{ id: 'guides' }])\n .join('g')\n .classed('dx-guides', true)\n .selectAll<SVGCircleElement, { cx: number; cy: number; r: number }>('circle')\n .data(layout.guides ?? [])\n .join(\n (enter) => enter.append('circle').attr('r', 0),\n (update) => update,\n (exit) => exit.transition().duration(500).attr('r', 0).remove(),\n )\n .attr('cx', (d) => d.cx)\n .attr('cy', (d) => d.cy)\n .attr('r', (d) => d.r);\n }\n\n //\n // Subgraphs (aka components)\n //\n\n const scale = 100;\n const offsetDistance = 24 * scale;\n\n if (this._options.subgraphs) {\n // TODO(burdon): Cache components in layout.\n // TODO(burdon): Separate force system for each subgraph.\n const components = this._options.subgraphs\n ? findConnectedComponents({\n nodes: layout.graph?.nodes ?? [],\n edges: (layout.graph?.edges ?? []).map(({ source, target }) => ({ source: source.id, target: target.id })),\n })\n .filter((component) => component.length > 2)\n .map((component, i) => ({ id: `subgraph-${i}`, component }))\n : [];\n\n root\n .selectAll('g.dx-subgraphs')\n .data([{ id: 'subgraphs' }])\n .join('g')\n .classed('dx-subgraphs', true)\n .selectAll<SVGPathElement, { id: string }>('path')\n .data(components)\n .join(\n (enter) => enter.append('path').classed('dx-subgraph', true),\n (update) => {\n return update.attr('d', ({ component }) => {\n const points: Point[] =\n layout.graph?.nodes.filter((node) => component.includes(node.id)).map((node) => [node.x, node.y]) ?? [];\n\n // https://d3js.org/d3-polygon\n const hullPoints = polygonHull(points);\n\n // https://www.npmjs.com/package/js-clipper\n const co = new Clipper.ClipperOffset();\n const solution = [];\n const clipperPath = hullPoints.map(([x, y]) => ({ X: x * scale, Y: y * scale }));\n co.AddPath(clipperPath, Clipper.JoinType.jtRound, Clipper.EndType.etClosedPolygon);\n co.Execute(solution, offsetDistance);\n if (solution.length > 0) {\n const offset = solution[0].map(({ X, Y }) => [X / scale, Y / scale]);\n return createLine([...offset, offset[0]]);\n }\n });\n },\n );\n }\n\n //\n // Edges and nodes\n // TODO(burdon): Only call join when data changes (otherwise exit transitions are called multiple times).\n //\n\n const edgeGroup = root\n .selectAll('g.dx-edges')\n .data([{ id: 'edges' }], (d: any) => d.id)\n .join('g')\n .classed('dx-edges', true);\n\n const nodeGroup = root\n .selectAll('g.dx-nodes')\n .data([{ id: 'nodes' }], (d: any) => d.id)\n .join('g')\n .classed('dx-nodes', true);\n\n //\n // Nodes\n //\n\n nodeGroup\n .selectAll<SVGCircleElement, GraphLayoutNode<NodeData>>('g.dx-node')\n .data(layout.graph?.nodes ?? [], (d) => d.id)\n .join(\n (enter) =>\n enter\n .append('g')\n .attr('data-id', (d) => d.id)\n .attr('opacity', 1)\n .classed('dx-node', true)\n .call(createNode, this.options),\n (update) => update.call(updateNode, this.options),\n (exit) => {\n // Fade out.\n return exit\n .transition()\n .ease(easeCubicOut)\n .duration(300)\n .attr('opacity', 0)\n .on('end', function (d) {\n select(this).remove();\n });\n },\n )\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n\n //\n // Edges\n //\n\n edgeGroup\n .selectAll<SVGPathElement, GraphLayoutEdge<NodeData, EdgeData>>('g.dx-edge')\n .data(layout.graph?.edges ?? [], (d) => d.id)\n .join(\n (enter) =>\n enter\n .append('g')\n .attr('data-id', (d) => d.id)\n .classed('dx-edge', true)\n .call(createEdge, this.options),\n (update) => update.call(updateEdge, this.options, nodeGroup).each((d) => {}),\n (exit) => exit.remove(),\n )\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n }\n\n /**\n * Trigger path bullets.\n * @param node\n */\n fireBullet(node: GraphLayoutNode<NodeData>) {\n select(this.root).selectAll('g.dx-edges').selectAll('path').call(createBullets(this.root, node.id));\n }\n}\n\n/**\n * Create node elements.\n * @param group\n * @param options\n */\nconst createNode: D3Callable = <Data>(group: D3Selection, options: GraphRendererOptions<Data>) => {\n // Circle.\n const circle = group.append('circle');\n\n // Drag.\n // TODO(burdon): Update when layout changes.\n if (options.drag) {\n circle.call(options.drag);\n }\n\n // Click.\n if (options.onNodeClick) {\n group.on('click', (event: MouseEvent) => {\n const node = select<SVGElement, GraphLayoutNode<Data>>(event.target as SVGGElement).datum();\n options.onNodeClick(node, event);\n });\n }\n\n // Label.\n if (options.labels && !options.onNodePointerEnter) {\n const g = group.append('g').classed('dx-label', true);\n g.append('line');\n g.append('rect');\n g.append('text').style('dominant-baseline', 'middle');\n }\n\n // Hover.\n if (options.onNodePointerEnter) {\n circle.on('pointerenter', function (event: PointerEvent) {\n const node = select<any, GraphLayoutNode<Data>>(this.parentElement).datum();\n options.onNodePointerEnter(node, event);\n });\n\n group.attr('data-hover', 'handled'); // TODO(burdon): ???\n } else if (options.highlight !== false) {\n circle.on('pointerenter', function () {\n select(this.closest('g.dx-node')).raise();\n if (options.labels) {\n select(this.parentElement).classed('dx-active', true).classed('dx-highlight', true);\n }\n });\n\n group.on('pointerleave', function () {\n if (options.labels) {\n select(this).classed('dx-active', false);\n setTimeout(() => {\n if (!select(this).classed('dx-active')) {\n select(this).classed('dx-highlight', false);\n }\n }, 300);\n }\n });\n }\n};\n\n/**\n * Update node elements.\n * @param group\n * @param options\n */\nconst updateNode: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n) => {\n group.attr('transform', (d) => {\n return d.x != null && d.y != null ? `translate(${d.x},${d.y})` : undefined;\n });\n\n // Custom attributes.\n if (options.attributes?.node) {\n try {\n group.each((d, i, nodes) => {\n const node = select(nodes[i]);\n const { classes, data } = options.attributes?.node?.(d) ?? {};\n if (classes) {\n applyClasses(node, classes);\n }\n if (data) {\n Object.entries(data).forEach(([key, value]) => {\n node.attr(`data-${key}`, value);\n });\n }\n });\n } catch (error: any) {\n log.error('updateNode', { error: error?.message });\n }\n }\n\n // Optional transition.\n const groupOrTransition: D3Selection = options.transition\n ? (group.transition(options.transition()) as unknown as D3Selection)\n : group;\n\n // Update circles.\n groupOrTransition.select<SVGCircleElement>('circle').attr('r', (d) => d.r ?? 16);\n\n // Update labels.\n if (options.labels) {\n const bx = 1;\n const px = 4;\n const py = 2;\n const offset = 16;\n const dx = (d: any, offset = 0) => (offset + (d.r ?? 0)) * (d.x > 0 ? 1 : -1);\n\n groupOrTransition\n .select<SVGTextElement>('text')\n .text((d) => options.labels.text(d))\n .style('text-anchor', (d) => (d.x > 0 ? 'start' : 'end'))\n .attr('dx', (d) => dx(d, offset))\n .attr('dy', 1)\n .text((d) => options.labels.text(d))\n .each(function (d) {\n // Cache bounding box.\n let bbox = d.bbox;\n if (!bbox) {\n bbox = this.getBBox();\n d.bbox = bbox;\n }\n\n const width = bbox.width + (bx + px) * 2;\n const height = bbox.height + py * 2;\n\n select(this.parentElement)\n .select('rect')\n .attr('x', dx(d, offset - (bx + px)) + (d.x > 0 ? 0 : -1) * width)\n .attr('y', -height / 2)\n .attr('width', width)\n .attr('height', height)\n .attr('rx', 4);\n\n select(this.parentElement)\n .select('line')\n .attr('x1', dx(d, 1))\n .attr('y1', 0)\n .attr('x2', dx(d, offset - (bx + px)))\n .attr('y2', 0);\n });\n }\n};\n\n/**\n * Create edge elements.\n * @param group\n * @param options\n * @param nodes\n */\nconst createEdge: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n) => {\n if (options.onLinkClick) {\n // Shadow path with wide stroke for click handler.\n group\n .append('path')\n .classed('dx-click', true)\n .on('click', (event: MouseEvent) => {\n const edge = select<SVGLineElement, GraphLayoutEdge<NodeData, EdgeData>>(\n event.target as SVGLineElement,\n ).datum();\n options.onLinkClick(edge, event);\n });\n }\n\n group\n .append('path')\n .attr('pointer-events', 'none')\n .attr('marker-start', () => (options.arrows?.start ? 'url(#marker-arrow-start)' : undefined))\n .attr('marker-end', () => (options.arrows?.end ? 'url(#marker-arrow-end)' : undefined));\n};\n\n/**\n * Update edge elements.\n * @param group\n * @param options\n */\nconst updateEdge: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n nodeGroup: D3Selection,\n) => {\n // Custom attributes.\n try {\n group.each((d, i, edges) => {\n const edge = select(edges[i]);\n edge.classed('dx-dashed', d.linkForce === false);\n const { classes, data } = options.attributes?.edge?.(d) ?? {};\n if (classes) {\n applyClasses(edge, classes);\n }\n if (data) {\n Object.entries(data).forEach(([key, value]) => {\n edge.attr(`data-${key}`, value);\n });\n }\n });\n } catch (error: any) {\n log.error('updateEdge', { error: error?.message });\n }\n\n // Optional transition.\n const groupOrTransition: D3Selection = options.transition\n ? (group.transition(options.transition()) as unknown as D3Selection)\n : group;\n\n groupOrTransition.selectAll<SVGPathElement, GraphLayoutEdge<NodeData, EdgeData>>('path').attr('d', function () {\n // NOTE: `d` is stale after layout is switched so get the datum from the parent element.\n const { source, target } = select(this.parentElement).datum() as GraphLayoutEdge<NodeData, EdgeData>;\n if (!source.initialized || !target.initialized) {\n return;\n }\n\n return createLine(getCircumferencePoints([source.x, source.y], [target.x, target.y], source.r, target.r));\n });\n};\n\n// TODO(burdon): Factor out.\n\nconst applyClasses = (el: D3Selection, classes: Record<string, boolean>) => {\n for (const [className, value] of Object.entries(classes)) {\n el.classed(className, value);\n }\n};\n\n/**\n * Find connected components (subgraphs) in a graph.\n */\nconst findConnectedComponents = (graph: {\n nodes: { id: string }[];\n edges: { source: string; target: string }[];\n}): string[][] => {\n const adj: Record<string, string[]> = {};\n for (const node of graph.nodes) {\n adj[node.id] = [];\n }\n\n for (const { source, target } of graph.edges) {\n adj[source].push(target);\n adj[target].push(source);\n }\n\n const visited = new Set<string>();\n const components: string[][] = [];\n for (const node of graph.nodes) {\n if (visited.has(node.id)) {\n continue;\n }\n\n const stack = [node.id];\n const componentIds: string[] = [];\n\n while (stack.length) {\n const current = stack.pop()!;\n if (visited.has(current)) {\n continue;\n }\n visited.add(current);\n componentIds.push(current);\n stack.push(...adj[current]);\n }\n\n components.push(componentIds);\n }\n\n return components;\n};\n", "//\n// Copyright 2019 DXOS.org\n//\n\nimport { easeLinear, interpolate, select } from 'd3';\n\nimport { type D3Selection, type D3Callable } from '../../util';\n\nexport type BulletOptions = {\n max?: number;\n radius?: number;\n delay?: number;\n minDuration?: number;\n maxDuration?: number;\n};\n\n/**\n * Generate animated bullets that follow selected paths.\n * @param group\n * @param nodeId\n * @param options\n */\nexport const createBullets = (group: SVGGElement, nodeId: string, options: BulletOptions = {}): D3Callable => {\n return (selection: D3Selection) => {\n const { max = 32, radius = 3, delay = 50, minDuration = 100, maxDuration = 500 } = options;\n\n // Edge selection.\n selection.each(function (d, i, edges) {\n const { source, target } = d;\n\n // Match source node.\n if (source.id === nodeId) {\n const path = select(edges[i]);\n const p = path.node().getPointAtLength(0);\n\n const bullet = select(group)\n .append('circle')\n .attr('class', 'dx-bullet')\n .attr('cx', p.x)\n .attr('cy', p.y)\n .attr('r', radius);\n\n bullet\n // Start animation.\n .transition()\n .delay(delay)\n .duration(minDuration + Math.random() * maxDuration)\n .ease(easeLinear)\n .tween('pathTween', function () {\n const length = path.node().getTotalLength();\n const r = interpolate(0, length);\n\n return (t) => {\n const point = path.node().getPointAtLength(r(t));\n select(this).attr('cx', point.x).attr('cy', point.y);\n };\n })\n\n // End of transition.\n .on('end', function () {\n select(this).remove();\n\n // Propagate with circuit breaker to prevent infinite recursion.\n const num = select(group).selectAll('circle.dx-bullet').size();\n if (num < max) {\n selection.call(createBullets(group, target.id));\n }\n });\n }\n });\n };\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type RefObject } from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type SVGContext } from '../../hooks';\nimport { defaultIdAccessor, type IdAccessor } from '../types';\n\nexport type RendererOptions<T = any> = {\n idAccessor: IdAccessor;\n} & T;\n\n/**\n * Base class for renderer that draw layouts.\n */\nexport abstract class Renderer<LAYOUT, OPTIONS extends RendererOptions> {\n protected readonly _options?: OPTIONS;\n\n constructor(\n protected readonly _context: SVGContext,\n protected readonly _root: RefObject<SVGGElement>,\n options?: Partial<OPTIONS>,\n ) {\n this._options = Object.assign(\n {\n idAccessor: defaultIdAccessor,\n },\n options,\n ) as OPTIONS;\n }\n\n get context(): SVGContext {\n return this._context;\n }\n\n get root(): SVGGElement {\n invariant(this._root.current, 'SVG root is not initialized');\n return this._root.current;\n }\n\n get options() {\n return this._options;\n }\n\n abstract render(layout: LAYOUT): void;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { line } from 'd3';\n\nimport { type D3Callable, type Point } from '../../util';\nimport { getCircumferencePoints } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nconst createLine = line();\n\nexport type LinkOptions = {\n source?: GraphLayoutNode<any>;\n target?: GraphLayoutNode<any>;\n point?: Point;\n};\n\n/**\n * Render linker while dragging.\n */\nexport const linkerRenderer: D3Callable = (root, { source, target, point }: LinkOptions = {}) => {\n root\n .selectAll('g.dx-linker')\n .data([{ id: 'linker' }])\n .join('g')\n .attr('class', 'dx-linker')\n .selectAll<SVGPathElement, any>('path')\n .data(source ? [{ id: 'edge' }] : [])\n .join('path')\n .attr('marker-end', () => (target ? 'url(#marker-arrow-end)' : 'url(#marker-dot)'))\n .attr('d', () => {\n return createLine(\n getCircumferencePoints(\n [source.x, source.y],\n target ? [target.x, target.y] : point,\n source.r,\n target ? target.r : 0,\n ),\n );\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { geoPath, select, type GeoStream } from 'd3';\nimport { useEffect } from 'react';\nimport { feature, mesh } from 'topojson-client';\nimport { type GeometryCollection, type GeometryObject, type Objects, type Topology } from 'topojson-specification';\n\nimport { useSvgContext } from '../../hooks';\nimport { type Size } from '../../util';\n\nexport type MeshProps = {\n radius?: number;\n value?: number;\n};\n\n// https://d3og.com/mbostock/5249328\nexport const Mesh = ({ radius = 16, value = 0.5 }: MeshProps) => {\n const { svg, size } = useSvgContext();\n\n useEffect(() => {\n if (size) {\n // TODO(burdon): Resize doesn't trigger.\n const topology = hexTopology(size, radius, value);\n const projection = hexProjection(radius);\n const path = geoPath().projection(projection);\n\n select(svg)\n .append('g')\n .attr('class', 'hexagon')\n .selectAll('path')\n .data(topology.objects.hexagons.geometries)\n .enter()\n .append('path')\n .attr('d', (d) => path(feature(topology, d)))\n .attr('class', (d) => ((d.properties as Custom)?.fill ? 'fill' : null));\n // .on('mousedown', mousedown)\n // .on('mousemove', mousemove)\n // .on('mouseup', mouseup);\n\n select(svg).append('path').datum(mesh(topology, topology.objects.hexagons)).attr('class', 'mesh').attr('d', path);\n\n const redraw = (border: any) => {\n border.attr(\n 'd',\n path(\n mesh(\n topology,\n topology.objects.hexagons,\n (a, b) => (a.properties as Custom).fill !== (b.properties as Custom).fill,\n ),\n ),\n );\n };\n\n select(svg).append('path').attr('class', 'border').call(redraw);\n }\n }, [svg, size, value]);\n\n return null;\n};\n\ntype Custom = { fill: boolean };\n\ninterface HexObjects extends Objects<{ fill: boolean }> {\n hexagons: GeometryCollection<Custom>;\n}\n\nconst hexTopology = ({ width, height }: Size, radius: number, value = 1): Topology<HexObjects> => {\n const dx = radius * 2 * Math.sin(Math.PI / 3);\n const dy = radius * 1.5;\n const m = Math.ceil((height + radius) / dy) + 1;\n const n = Math.ceil(width / dx) + 1;\n const geometries: Array<GeometryObject<{ fill: boolean }>> = [];\n const arcs = [];\n\n for (let j = -1; j <= m; ++j) {\n for (let i = -1; i <= n; ++i) {\n const y = j * 2;\n const x = (i + (j & 1) / 2) * 2;\n arcs.push(\n [\n [x, y - 1],\n [1, 1],\n ],\n [\n [x + 1, y],\n [0, 1],\n ],\n [\n [x + 1, y + 1],\n [-1, 1],\n ],\n );\n }\n }\n\n for (let j = 0, q = 3; j < m; ++j, q += 6) {\n for (let i = 0; i < n; ++i, q += 3) {\n geometries.push({\n type: 'Polygon',\n arcs: [[q, q + 1, q + 2, ~(q + (n + 2 - (j & 1)) * 3), ~(q - 2), ~(q - (n + 2 + (j & 1)) * 3 + 2)]],\n properties: {\n fill: Math.random() > (i / n) * (1 / value),\n },\n });\n }\n }\n\n const hexagons: GeometryCollection<{ fill: boolean }> = { type: 'GeometryCollection', geometries };\n\n return {\n type: 'Topology',\n transform: { translate: [0, 0], scale: [1, 1] },\n objects: { hexagons },\n arcs,\n };\n};\n\nconst hexProjection = (radius: number) => {\n const dx = radius * 2 * Math.sin(Math.PI / 3);\n const dy = radius * 1.5;\n return {\n stream: (stream: GeoStream) => ({\n point: (x: number, y: number) => {\n stream.point((x * dx) / 2, ((y - (2 - (y & 1)) / 3) * dy) / 2);\n },\n lineStart: () => {\n stream.lineStart();\n },\n lineEnd: () => {\n stream.lineEnd();\n },\n polygonStart: () => {\n stream.polygonStart();\n },\n polygonEnd: () => {\n stream.polygonEnd();\n },\n }),\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { useGrid, type GridOptions } from '../../hooks';\n\nexport type GridProps = ThemedClassName<GridOptions>;\n\n/**\n * SVG grid wrapper.\n */\nexport const Grid = ({ classNames, ...props }: GridProps) => {\n const { ref } = useGrid(props);\n return <g ref={ref} className={mx('dx-grid', classNames)} />;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { select } from 'd3';\nimport React, { useEffect, useRef } from 'react';\n\nimport { createMarkers } from '../../graph';\n\nexport type MarkersProps = {\n arrowSize?: number;\n className?: string;\n};\n\n/**\n * SVG markers wrapper.\n */\nexport const Markers = ({ arrowSize, className }: MarkersProps) => {\n const ref = useRef();\n useEffect(() => {\n select(ref.current).call(createMarkers({ arrowSize }));\n }, [ref]);\n\n return <defs ref={ref} className={className} />;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { select } from 'd3';\nimport React, { forwardRef, type PropsWithChildren, useEffect, useMemo, useImperativeHandle } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { SVGContext, type SVGContextOptions, SVGContextProvider } from '../../hooks';\n\nexport type RootProps = ThemedClassName<PropsWithChildren<SVGContextOptions>>;\n\n/**\n * Makes the SVG context available to child nodes.\n * Automatically resizes the SVG element, which expands to fit the container.\n */\nexport const Root = forwardRef<SVGContext, RootProps>(({ classNames, children, ...props }, ref) => {\n const { ref: containerRef, width = 0, height = 0 } = useResizeDetector({ refreshRate: 200 });\n\n const context = useMemo<SVGContext>(() => {\n return new SVGContext(props);\n }, [props.scale, props.centered]);\n\n useImperativeHandle(ref, () => context, [context]);\n\n useEffect(() => {\n if (width && height) {\n context.setSize({ width, height });\n select(context.svg)\n .attr('display', 'block')\n .attr('viewBox', context.viewBox)\n .attr('width', width)\n .attr('height', height);\n }\n }, [context, width, height]);\n\n const ready = width !== 0 && height !== 0;\n\n return (\n <SVGContextProvider value={context}>\n <div ref={containerRef} className={mx('grid grow overflow-hidden', classNames)}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n ref={context.ref}\n className={mx('transition-opacity opacity-0 duration-1000', ready && 'opacity-100')}\n >\n {ready && children}\n </svg>\n </div>\n </SVGContextProvider>\n );\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { type ReactNode, memo, useMemo } from 'react';\n\nimport { useZoom, type ZoomExtent } from '../../hooks';\n\nexport type ZoomProps = {\n extent?: ZoomExtent;\n className?: string;\n children?: ReactNode;\n};\n\n/**\n * SVG zoomable component wrapper.\n */\nexport const Zoom = memo(({ extent, className, children }: ZoomProps) => {\n const options = useMemo(() => ({ extent }), [JSON.stringify(extent)]); // TODO(burdon): Avoid stringify.\n const zoom = useZoom(options);\n\n return (\n <g ref={zoom.ref as any} className={className}>\n {children}\n </g>\n );\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type PropsWithChildren } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\n\nimport { Grid, type GridProps as SVGGridProps } from './Grid';\nimport { Markers, type MarkersProps as SVGMarkersProps } from './Markers';\nimport { Root, type RootProps as SVGRootProps } from './Root';\nimport { Zoom, type ZoomProps as SVGZoomProps } from './Zoom';\nimport { Graph, type GraphProps as SVGGraphProps } from '../Graph';\nimport { Mesh, type MeshProps as SVGMeshProps } from '../Mesh';\n\nexport type SVGProps = PropsWithChildren<ThemedClassName>;\n\nexport const SVG = {\n Root,\n Grid,\n Markers,\n Mesh,\n Zoom,\n Graph,\n};\n\nexport type { SVGRootProps, SVGGridProps, SVGMarkersProps, SVGZoomProps, SVGGraphProps, SVGMeshProps };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { easeCubicOut, select } from 'd3';\n\nimport { type D3Callable, type D3Selection } from '../util';\n\nconst PROP_PULSAR_ACTIVE = 'dx-pulsar-active';\n\n/**\n * Pulsar effect.\n */\nexport namespace Pulsar {\n export const has = (group: D3Selection<SVGGElement>) => group.select('circle.dx-pulsar').empty();\n\n export const create: D3Callable<SVGGElement> = (group, r: number, options: PulsarOptions = {}) => {\n const pulsar = group\n .append('circle')\n .classed('dx-pulsar', true)\n .classed('stroke-2 stroke-red-500 fill-none', true)\n .property(PROP_PULSAR_ACTIVE, true);\n\n startAnimation(pulsar, r, options);\n };\n\n export const remove: D3Callable<SVGGElement> = (group) => {\n group.select('circle.dx-pulsar').property(PROP_PULSAR_ACTIVE, false);\n };\n\n export type Options = PulsarOptions;\n}\n\ntype PulsarOptions = {\n period?: number;\n duration?: number;\n ratio?: number;\n};\n\nconst startAnimation = (pulsar: D3Selection<SVGCircleElement>, r: number, options: PulsarOptions = {}) => {\n const { period = 1_000, duration = 800, ratio = 3 } = options;\n return pulsar\n .attr('r', r)\n .attr('opacity', 1)\n .transition('pulsar')\n .delay(period - (Date.now() % period))\n .duration(Math.min(duration, period - 20))\n .ease(easeCubicOut)\n .attr('r', r * ratio)\n .attr('opacity', -0.1)\n .on('end', function () {\n if (select(this).property(PROP_PULSAR_ACTIVE)) {\n startAnimation(select(this), r, options);\n } else {\n select(this).remove();\n }\n });\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAA6BC,YAAYC,WAAWC,qBAAqBC,SAASC,cAAc;AAEvG,SAASC,eAAe;AAExB,SAASC,OAAAA,YAAW;AAEpB,SAASC,UAAU;;;ACPnB,SAASC,MAAMC,cAAc;AAI7B,IAAMC,aAAaC,KAAAA;AAMnB,IAAMC,cACJ,CAACC,QAAgBC,QAAgBC,UACjC,CAACC,OAAAA;AACC,QAAMC,SAASJ,SAAS;AACxBG,KAAGE,KAAK,eAAeL,SAAS,CAAA,EAC7BK,KAAK,gBAAgBD,SAAS,CAAA,EAC9BC,KAAK,WAAW,IAAIL,MAAAA,KAAWI,MAAAA,IAAUJ,SAAS,CAAA,I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C,CAACX,UAAAA;AAC9CA,UAAMC,OAAO,kBAAA,EAAoBQ,SAASZ,oBAAoB,KAAA;EAChE;AAGF,GAlBiBC,WAAAA,SAAAA,CAAAA,EAAAA;AA0BjB,IAAMY,iBAAiB,CAACJ,QAAuCF,GAAWC,UAAyB,CAAC,MAAC;AACnG,QAAM,EAAEO,SAAS,KAAOC,WAAW,KAAKC,QAAQ,EAAC,IAAKT;AACtD,SAAOC,OACJS,KAAK,KAAKX,CAAAA,EACVW,KAAK,WAAW,CAAA,EAChBC,WAAW,QAAA,EACXC,MAAML,SAAUM,KAAKC,IAAG,IAAKP,MAAAA,EAC7BC,SAASO,KAAKC,IAAIR,UAAUD,SAAS,EAAA,CAAA,EACrCU,KAAKC,aAAAA,EACLR,KAAK,KAAKX,IAAIU,KAAAA,EACdC,KAAK,WAAW,IAAC,EACjBS,GAAG,OAAO,WAAA;AACT,QAAIvB,QAAO,IAAI,EAAEQ,SAASZ,kBAAAA,GAAqB;AAC7Ca,qBAAeT,QAAO,IAAI,GAAGG,GAAGC,OAAAA;IAClC,OAAO;AACLJ,MAAAA,QAAO,IAAI,EAAEU,OAAM;IACrB;EACF,CAAA;AACJ;;",
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport React, { type JSX, type Ref, forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';\n\nimport { combine } from '@dxos/async';\nimport { type BaseGraphEdge, type BaseGraphNode, type GraphModel } from '@dxos/graph';\nimport { log } from '@dxos/log';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport {\n createGraphDrag,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProjector,\n GraphRenderer,\n type GraphRendererOptions,\n} from '../../graph';\nimport { useSvgContext } from '../../hooks';\n\nexport type GraphController = {\n refresh: () => void;\n repaint: () => void;\n findNode: (id: string) => SVGGElement | null;\n};\n\nexport type GraphProps<Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any> = ThemedClassName<\n Pick<GraphRendererOptions<Node>, 'labels' | 'subgraphs' | 'attributes'> & {\n model?: GraphModel<Node, Edge>; // TODO(burdon): ReactiveGraphModel\n projector?: GraphProjector<Node>;\n renderer?: GraphRenderer<Node>;\n drag?: boolean;\n arrows?: boolean;\n onSelect?: (node: GraphLayoutNode<Node>, event: MouseEvent) => void;\n onInspect?: (node: GraphLayoutNode<Node>, event: MouseEvent) => void;\n }\n>;\n\nexport const GraphInner = <Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any>(\n {\n classNames,\n model,\n projector: _projector,\n renderer: _renderer,\n drag,\n arrows,\n onSelect,\n onInspect,\n ...props\n }: GraphProps<Node, Edge>,\n forwardedRef: Ref<GraphController>,\n) => {\n const context = useSvgContext();\n const graphRef = useRef<SVGGElement>();\n\n const { projector, renderer } = useMemo(() => {\n let projector = _projector;\n if (!projector) {\n projector = new GraphForceProjector<Node>(context);\n }\n\n let renderer = _renderer;\n if (!renderer) {\n renderer = new GraphRenderer<Node>(context, graphRef, {\n ...props,\n // TODO(burdon): Replace drag when projector is updated.\n drag: drag ? createGraphDrag(context, projector) : undefined,\n arrows: { end: arrows },\n onNodeClick: onSelect ? (node: GraphLayoutNode, event) => onSelect(node, event) : undefined,\n onNodePointerEnter: onInspect ? (node: GraphLayoutNode, event) => onInspect(node, event) : undefined,\n });\n }\n\n return { projector, renderer };\n }, [context, _projector, _renderer, drag]);\n\n // External API.\n useImperativeHandle(\n forwardedRef,\n () => ({\n refresh: () => {\n projector.updateData(model?.graph);\n },\n repaint: () => {\n renderer.render(projector.layout);\n },\n findNode: (id: string) => {\n return graphRef.current?.querySelector<SVGGElement>(`g[data-id=\"${id}\"]`);\n },\n }),\n [model, projector, renderer],\n );\n\n // Subscriptions.\n useEffect(() => {\n return combine(\n effect(() => {\n projector.updateData(model?.graph);\n }),\n projector.updated.on(({ layout }) => {\n try {\n renderer.render(layout);\n } catch (error) {\n void projector.stop();\n log.catch(error);\n }\n }),\n );\n }, [model, projector, renderer]);\n\n // Start.\n useEffect(() => {\n void projector.start();\n return () => {\n void projector.stop();\n };\n }, [projector]);\n\n return <g ref={graphRef} className={mx('dx-graph', classNames)} />;\n};\n\n/**\n * SVG Graph.\n */\nexport const Graph = forwardRef(GraphInner) as <Node extends BaseGraphNode = any, Edge extends BaseGraphEdge = any>(\n props: GraphProps<Node, Edge> & { ref?: Ref<GraphController> },\n) => JSX.Element;\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { line, select } from 'd3';\n\nimport { type D3Callable } from '../util';\n\nconst createLine = line();\n\nexport type MarkerOptions = {\n arrowSize?: number;\n};\n\nconst createArrow =\n (length: number, offset: number, start: boolean): D3Callable =>\n (el) => {\n const height = length * 0.5;\n el.attr('markerWidth', length * 2)\n .attr('markerHeight', height * 2)\n .attr('viewBox', `-${length},-${height},${length * 2},${height * 2}`)\n .attr('orient', 'auto')\n .attr('refX', offset)\n .append('path')\n .attr('fill', 'none')\n // Inherit stroke from path.\n .attr('stroke', 'context-stroke')\n .attr(\n 'd',\n createLine([\n start ? [length, height] : [-length, -height],\n [0, 0],\n start ? [length, -height] : [-length, height],\n ]),\n );\n };\n\nconst createDot =\n (size: number): D3Callable =>\n (el) => {\n el.attr('markerWidth', size * 2)\n .attr('markerHeight', size * 2)\n .attr('viewBox', `-${size},-${size},${size * 2},${size * 2}`)\n .attr('orient', 'auto')\n .append('circle')\n // Inherit stroke from path.\n .attr('fill', 'context-stroke')\n .attr('r', size / 2 - 1);\n };\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker\n * https://www.dashingd3js.com/svg-paths-and-d3js\n * http://bl.ocks.org/dustinlarimer/5888271\n */\nexport const createMarkers =\n ({ arrowSize = 12 }: MarkerOptions = {}): D3Callable =>\n (group) => {\n return group\n .selectAll('marker')\n .data([\n {\n id: 'marker-arrow-start',\n generator: createArrow(arrowSize, -0.5, true),\n className: 'dx-arrow',\n },\n {\n id: 'marker-arrow-end',\n generator: createArrow(arrowSize, 0.5, false),\n className: 'dx-arrow',\n },\n {\n id: 'marker-dot',\n generator: createDot(6),\n className: 'dx-dot',\n },\n ])\n .join('marker')\n .attr('id', (d) => d.id)\n .attr('markerUnits', 'strokeWidth')\n .attr('class', (d) => d.className)\n .each((d, i, nodes) => {\n select(nodes[i]).call(d.generator);\n });\n };\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { drag, pointer, select } from 'd3';\n\nimport { type GraphProjector } from './graph-projector';\nimport { type SVGContext } from '../../hooks';\nimport { type Point } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nenum Mode {\n MOVE = 0,\n LINK = 1,\n}\n\nexport interface DragOptions<N> {\n dragMod?: string;\n linkMod?: string;\n freezeMod?: string;\n onDrag?: (source?: GraphLayoutNode<N>, target?: GraphLayoutNode<N>, point?: Point) => void;\n onDrop?: (source: GraphLayoutNode<N>, target?: GraphLayoutNode<N>) => void;\n}\n\nconst defaultDragOptions: DragOptions<any> = {\n linkMod: 'metaKey',\n freezeMod: 'shiftKey',\n};\n\n/**\n * Create drag handler.\n */\nexport const createGraphDrag = <NodeData>(\n context: SVGContext,\n projector: GraphProjector<NodeData>,\n options: DragOptions<NodeData> = defaultDragOptions,\n) => {\n let mode: Mode;\n let source: GraphLayoutNode<NodeData>;\n let target: GraphLayoutNode<NodeData> | undefined;\n let offset: Point | undefined;\n let moved = false;\n\n const keyMod = (event: MouseEvent, key: string): boolean => {\n const modKey = options?.[key] ?? defaultDragOptions[key];\n return modKey === undefined || event[modKey];\n };\n\n return drag<SVGElement, GraphLayoutNode<NodeData>>()\n .filter((event: MouseEvent) => !event.ctrlKey)\n .on('start', function (event, d) {\n source = d;\n offset = pointer(event, this.parentElement);\n\n if (options?.onDrop && keyMod(event.sourceEvent, 'linkMod')) {\n mode = Mode.LINK;\n } else if (keyMod(event.sourceEvent, 'dragMod')) {\n mode = Mode.MOVE;\n }\n })\n .on('drag', function (event, d) {\n const parent = this.closest('g.node');\n select(parent).classed('dragging', true).raise();\n\n // Calculate position.\n const [dx, dy] = pointer(event, this.parentElement);\n const x = d.x + dx - offset[0];\n const y = d.y + dy - offset[1];\n const point: Point = [x, y];\n\n switch (mode) {\n case Mode.MOVE: {\n select(context.svg).attr('cursor', 'grabbing');\n\n // Freeze node while dragging.\n event.subject.x = event.subject.fx = point[0];\n event.subject.y = event.subject.fy = point[1];\n projector.refresh(true);\n moved = true;\n break;\n }\n\n case Mode.LINK: {\n // Get drop target.\n if (options?.onDrag) {\n target = projector.findNode(event.x, event.y, 16);\n if (source === target) {\n select(context.svg).attr('cursor', undefined);\n options?.onDrag?.();\n } else {\n select(context.svg).attr('cursor', target ? 'alias' : 'cell');\n options?.onDrag?.(source, target, point);\n }\n }\n }\n }\n })\n .on('end', function (event) {\n select(context.svg).attr('cursor', undefined);\n select(this.parentElement).classed('dragging', false);\n switch (mode) {\n case Mode.LINK: {\n options?.onDrop?.(source, target);\n break;\n }\n }\n\n // Freeze node.\n if (!keyMod(event.sourceEvent, 'freezeMod')) {\n event.subject.fx = null;\n event.subject.fy = null;\n }\n\n mode = undefined;\n source = undefined;\n target = undefined;\n offset = undefined;\n\n if (moved) {\n projector.refresh(false);\n moved = false;\n }\n });\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\n//\n// Data\n// Generic graph data type.\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { invariant } from '@dxos/invariant';\n\nimport { type Point } from '../util';\n\nexport type IdAccessor<N = any> = (node: N) => string;\n\nexport const defaultIdAccessor: IdAccessor = (node: any) => {\n invariant(node.id);\n return node.id;\n};\n\nexport const emptyGraph: Graph = {\n nodes: [],\n edges: [],\n};\n\n//\n// Layout\n// Graph layout used by graph renderers.\n//\n\nexport type GraphGuide = {\n id: string;\n type: string;\n cx: number;\n cy: number;\n r: number;\n classes?: {\n circle?: string;\n };\n};\n\nexport type GraphLayoutNode<NodeData = any> = {\n id: string;\n type?: string;\n order?: number;\n data?: NodeData;\n x?: number;\n y?: number;\n r?: number;\n classes?: {\n circle?: string;\n text?: string;\n };\n children?: number;\n initialized?: boolean;\n last?: Point;\n};\n\nexport type GraphLayoutEdge<NodeData = any, EdgeData = any> = {\n id: string;\n type?: string;\n order?: number;\n source: GraphLayoutNode<NodeData>;\n target: GraphLayoutNode<NodeData>;\n data?: EdgeData;\n linkForce?: boolean;\n classes?: {\n path?: string;\n };\n};\n\nexport type GraphLayout<NodeData = any, EdgeData = any> = {\n id?: string;\n guides?: GraphGuide[];\n graph: {\n nodes: GraphLayoutNode<NodeData>[];\n edges: GraphLayoutEdge<NodeData, EdgeData>[];\n };\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type SVGContext } from '../../hooks';\nimport { EventEmitter } from '../../util';\nimport { defaultIdAccessor, type IdAccessor } from '../types';\n\nexport type ProjectorOptions = {\n idAccessor?: IdAccessor;\n};\n\n/**\n * Generates a layout to be rendered.\n */\nexport abstract class Projector<NodeData, Layout, Options extends ProjectorOptions> {\n public readonly updated = new EventEmitter<{ layout: Layout }>();\n\n private readonly _options: Options;\n\n constructor(\n private readonly _context: SVGContext,\n options?: Partial<Options>,\n ) {\n this._options = Object.assign(\n {\n idAccessor: defaultIdAccessor,\n },\n options,\n ) as Options;\n }\n\n abstract get layout(): Layout;\n\n get context(): SVGContext {\n return this._context;\n }\n\n get options(): Options {\n return this._options;\n }\n\n refresh(dragging = false) {\n this.onRefresh(dragging);\n }\n\n updateData(data?: NodeData) {\n this.onUpdate(data);\n }\n\n emitUpdate() {\n this.updated.emit({ layout: this.layout });\n }\n\n async clear() {\n await this.onClear();\n }\n\n async start() {\n await this.onStart();\n }\n\n async stop() {\n await this.onStop();\n }\n\n protected onRefresh(dragging = false): void {}\n protected onUpdate(data?: NodeData): void {}\n protected async onClear(): Promise<void> {}\n protected async onStart(): Promise<void> {}\n protected async onStop(): Promise<void> {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type SelectionModel, type Graph } from '@dxos/graph';\n\nimport { Projector, type ProjectorOptions } from './projector';\nimport { type SVGContext } from '../../hooks';\nimport { emptyGraph, type GraphLayout, type GraphLayoutNode } from '../types';\n\nexport type GraphProjectorOptions = ProjectorOptions & {};\n\n/**\n * Base class for graph projectors.\n */\nexport abstract class GraphProjector<NodeData = any, Options extends GraphProjectorOptions = any> extends Projector<\n Graph,\n GraphLayout<NodeData>,\n Options\n> {\n private readonly _layout: GraphLayout<NodeData>;\n\n // TODO(burdon): Change to object props.\n constructor(\n context: SVGContext,\n options?: Options,\n private readonly _selection?: SelectionModel,\n layout?: GraphLayout<NodeData>,\n ) {\n super(context, options);\n this._layout = {\n id: (Math.random() * 10).toString().slice(8),\n graph: {\n nodes: [...(layout?.graph.nodes ?? [])],\n edges: [...(layout?.graph.edges ?? [])],\n },\n };\n }\n\n get layout() {\n return this._layout;\n }\n\n get selection() {\n return this._selection;\n }\n\n numChildren(node: GraphLayoutNode) {\n return this._layout.graph.edges.filter((edge) => edge.source.id === this.options.idAccessor(node)).length;\n }\n\n reset() {\n this._layout.graph.nodes = [];\n this._layout.graph.edges = [];\n this.emitUpdate();\n }\n\n /**\n * Merge external data with internal representation (e.g., so force properties like position are preserved).\n * @param data\n */\n protected mergeData(data: Graph = emptyGraph) {\n // Merge nodes.\n const nodes: GraphLayoutNode[] = data.nodes.map((node) => {\n let current: GraphLayoutNode = this._layout.graph.nodes.find((n) => n.id === this.options.idAccessor(node));\n if (!current) {\n current = {\n id: this.options.idAccessor(node),\n };\n }\n\n current.data = node;\n return current;\n });\n\n // Replace edges.\n const edges = data.edges\n .map((edge) => ({\n id: edge.id,\n source: nodes.find((n) => n.id === edge.source),\n target: nodes.find((n) => n.id === edge.target),\n data: edge.data,\n }))\n .filter((edge) => edge.source && edge.target);\n\n Object.assign(this._layout, {\n graph: {\n nodes,\n edges,\n },\n });\n }\n\n override async onClear() {\n this.reset();\n }\n\n abstract findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined;\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport {\n type Force,\n forceCenter,\n forceCollide,\n forceLink,\n forceManyBody,\n forceRadial,\n forceSimulation,\n forceX,\n forceY,\n} from 'd3';\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { forcePoint } from './graph-forces';\nimport { GraphProjector, type GraphProjectorOptions } from './graph-projector';\nimport { type GraphLayoutEdge, type GraphLayoutNode } from '../types';\n\n/**\n * Return value or invoke function.\n * @param valueOrFunction\n * @param invoker\n * @param defaultValue\n */\nconst getValue = <T>(\n valueOrFunction: T | ((...args: any[]) => T) | undefined,\n invoker: (fn: (...args: any[]) => T) => T,\n defaultValue: T,\n) => {\n return (\n (typeof valueOrFunction === 'function' ? invoker(valueOrFunction as (...args: any[]) => T) : valueOrFunction) ??\n defaultValue\n );\n};\n\n/**\n * Returns the config object or an empty object if the property is set to true (or defaults to true).\n * Otherwise returns undefined.\n * @param options\n * @param cb\n * @param defaultValue\n */\nconst maybeForce = <Config>(\n options: Config | boolean,\n cb: (config: Config) => Force<any, any>,\n defaultValue = undefined,\n) => {\n const value = typeof options === 'boolean' ? (options ? {} : undefined) : (options ?? defaultValue);\n if (value) {\n return cb(value);\n }\n};\n\n//\n// Forces\n// TODO(burdon): Provide utils for function properties (e.g., count edges).\n//\n\n/**\n * https://github.com/d3/d3-force#forceLink\n */\nexport type ForceLinkOptions = {\n // Default: edge => 1 / Math.min(2, count(edge.source), count(edge.target))\n strength?: number | ((edge: GraphLayoutEdge<any>) => number);\n distance?: number;\n iterations?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceManyBody\n */\nexport type ForceManyBodyOptions = {\n strength?: number | ((node: GraphLayoutNode<any>) => number);\n distanceMax?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#centering\n */\nexport type ForceCenterOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceCollide\n */\nexport type ForceCollideOptions = {\n radius?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#forceRadial\n */\nexport type ForceRadialOptions = {\n delay?: number;\n x?: number;\n y?: number;\n radius?: number;\n strength?: number;\n};\n\n/**\n * https://github.com/d3/d3-force#positioning\n */\nexport type ForcePositioningOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\n/**\n * All force options.\n * NOTE: A value of `true` enables the force with the default option.\n */\n// TODO(burdon): Options for alpha, etc.\n// TODO(burdon): Change to map of forces by type (i.e., support multiple forces of the same type).\nexport type ForceOptions = {\n link?: boolean | ForceLinkOptions;\n manyBody?: boolean | ForceManyBodyOptions;\n center?: boolean | ForceCenterOptions;\n collide?: boolean | ForceCollideOptions;\n radial?: boolean | ForceRadialOptions;\n point?: boolean | ForcePositioningOptions;\n x?: boolean | ForcePositioningOptions;\n y?: boolean | ForcePositioningOptions;\n};\n\nexport const defaultForceOptions: ForceOptions = {\n link: true,\n manyBody: true,\n // center: true,\n point: true,\n};\n\nexport type GraphForceProjectorOptions = GraphProjectorOptions & {\n guides?: boolean;\n forces?: ForceOptions;\n radius?: number;\n attributes?: {\n radius?: number | ((node: GraphLayoutNode<any>, children: number) => number);\n linkForce?: boolean | ((edge: GraphLayoutEdge<any>) => boolean);\n };\n};\n\n/**\n * D3 force directed graph layout using d3 simulation..\n */\nexport class GraphForceProjector<NodeData = any> extends GraphProjector<NodeData, GraphForceProjectorOptions> {\n // https://github.com/d3/d3-force\n private _simulation = forceSimulation<GraphLayoutNode, GraphLayoutEdge>();\n\n private _timeout?: NodeJS.Timeout;\n\n get forces() {\n return this.options.forces ?? defaultForceOptions;\n }\n\n get simulation() {\n return this._simulation;\n }\n\n restart() {\n this._simulation.alpha(1).restart();\n }\n\n override findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined {\n return this._simulation.find(x, y, radius);\n }\n\n override async onStart() {\n clearTimeout(this._timeout);\n let propagating = true;\n\n // Delay radial force until other forces have settled.\n const { radial, ...forces } = this.forces;\n const delay = typeof radial === 'object' ? radial.delay : undefined;\n if (delay) {\n propagating = false;\n this.updateForces(forces);\n this._timeout = setTimeout(() => {\n this.updateForces(this.forces);\n this.restart();\n this._timeout = setTimeout(() => {\n propagating = true;\n }, delay);\n }, delay);\n } else {\n this.updateForces(this.forces);\n }\n\n this._simulation\n .on('tick', () => propagating && this.emitUpdate())\n .velocityDecay(0.3)\n .alphaDecay(1 - Math.pow(0.001, 1 / 300))\n .alpha(1)\n .restart();\n }\n\n override async onStop() {\n clearTimeout(this._timeout);\n this._simulation.stop();\n }\n\n override onRefresh(dragging = false) {\n // Disable centering force while dragging.\n if (this.forces.center) {\n if (dragging) {\n this._simulation.force('center', null);\n } else {\n this.updateForces(this.forces);\n }\n }\n\n this.restart();\n }\n\n override onUpdate(graph?: Graph): void {\n log('onUpdate', { graph: { nodes: graph?.nodes.length, edges: graph?.edges.length } });\n this._simulation.stop();\n this.mergeData(graph);\n this.updateLayout();\n this.updateForces(this.forces);\n this.restart();\n }\n\n private updateLayout() {\n // Guides.\n this.layout.guides = this.options.guides\n ? [\n {\n id: 'g-1',\n type: 'circle',\n cx: 0,\n cy: 0,\n r: this.context.scale.model.toValue([10, 1]),\n },\n ]\n : undefined;\n\n // Initialize nodes.\n this.layout.graph.nodes.forEach((node) => {\n if (!node.initialized) {\n // Get starting point from linked element.\n // const edge = this.layout.graph.edges.find((edge) => edge.target.id === this.options.idAccessor(node));\n const a = 2 * Math.PI * Math.random();\n const r = this.options.radius ?? 200;\n\n // Initial positions.\n Object.assign(node, {\n initialized: true,\n\n // TODO(burdon): Only when new nodes added to initial layout.\n // Position around center or parent; must have delta to avoid spike.\n // x: edge?.source?.x ?? Math.cos(a) * r,\n // y: edge?.source?.y ?? Math.sin(a) * r,\n x: Math.cos(a) * r,\n y: Math.sin(a) * r,\n });\n }\n\n // TODO(burdon): Ignored by renderer?\n Object.assign(node, {\n r: getValue<number>(this.options?.attributes?.radius, (fn) => fn(node, this.numChildren(node)), 6),\n });\n });\n\n // Initialize edges.\n this.layout.graph.edges.forEach((edge) => {\n Object.assign(edge, {\n linkForce: getValue<boolean>(this.options.attributes?.linkForce, (fn) => fn(edge), true),\n });\n });\n }\n\n /**\n * Update all forces.\n */\n private updateForces(forces: ForceOptions): void {\n log('updateForces', { forces });\n\n // https://github.com/d3/d3-force#simulation_force\n this._simulation\n\n // Nodes\n // https://github.com/d3/d3-force#simulation_nodes\n .nodes(this.layout.graph.nodes)\n\n // Links.\n // https://github.com/d3/d3-force#forceLink\n .force(\n 'link',\n maybeForce<ForceLinkOptions>(\n forces?.link,\n (config) => {\n const force = forceLink()\n .id((d: GraphLayoutNode) => d.id)\n .links(this.layout.graph.edges.filter((edge) => edge.linkForce));\n if (config.distance != null) {\n force.distance(config.distance);\n }\n if (config.strength != null) {\n force.strength(config.strength);\n }\n if (config.iterations != null) {\n force.iterations(config.iterations);\n }\n return force;\n },\n forces?.link === false ? undefined : {},\n ),\n )\n\n // Repulsion.\n // https://github.com/d3/d3-force#forceManyBody\n .force(\n 'manyBody',\n maybeForce<ForceManyBodyOptions>(\n forces?.manyBody,\n (config) => {\n const force = forceManyBody();\n if (config.distanceMax != null) {\n force.distanceMax(config.distanceMax);\n }\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n },\n forces?.manyBody === false ? undefined : {},\n ),\n )\n\n // Collision.\n // https://github.com/d3/d3-force#forceCollide\n .force(\n 'collide',\n maybeForce<ForceCollideOptions>(forces?.collide, (config) => {\n const force = forceCollide();\n force.radius(config.radius ?? 8);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Radial.\n // https://github.com/d3/d3-force#forceRadial\n .force(\n 'radial',\n maybeForce<ForceRadialOptions>(forces?.radial, (config) => {\n const force = forceRadial(config.radius ?? 100, config.x ?? 0, config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Centering.\n // NOTE: This moves all nodes such that the center of mass is at the origin.\n // It is different from the positional force which attracts nodes to a point.\n // https://github.com/d3/d3-force#centering\n .force(\n 'center',\n maybeForce<ForceCenterOptions>(forces?.center, (config) => {\n const force = forceCenter()\n .x(config.x ?? 0)\n .y(config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n\n // Positioning.\n // https://github.com/d3/d3-force#forcePoint\n .force(\n 'point',\n maybeForce<ForcePositioningOptions>(forces?.point, ({ x = 0, y = 0, strength }) => {\n return forcePoint({ x, y, strength });\n }),\n )\n .force(\n 'x',\n maybeForce<ForcePositioningOptions>(forces?.x, (config: ForcePositioningOptions) => {\n const force = forceX(config.x ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n )\n .force(\n 'y',\n maybeForce<ForcePositioningOptions>(forces?.y, (config: ForcePositioningOptions) => {\n const force = forceY(config.y ?? 0);\n if (config.strength != null) {\n force.strength(config.strength);\n }\n return force;\n }),\n );\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Force, forceX, forceY, type SimulationLinkDatum, type SimulationNodeDatum } from 'd3';\n\nexport type ForcePointOptions = {\n x?: number;\n y?: number;\n strength?: number;\n};\n\nexport const forcePoint = <\n NodeDatum extends SimulationNodeDatum,\n LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined,\n>({\n x,\n y,\n strength = 0.01,\n}: ForcePointOptions): Force<NodeDatum, LinkDatum> => {\n const fx = x != null ? forceX(x).strength(strength) : undefined;\n const fy = y != null ? forceY(y).strength(strength) : undefined;\n\n const force = (alpha: number) => {\n fx?.(alpha);\n fy?.(alpha);\n };\n\n force.initialize = (nodes: any[], random: () => number) => {\n fx?.initialize(nodes, random);\n fy?.initialize(nodes, random);\n };\n\n return force;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { type GraphProjectorOptions } from './graph-projector';\nimport { GraphRadialProjector, layoutRadial, updateNode } from './graph-radial-projector';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphHierarchicalProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphHierarchicalProjector<\n NodeData = any,\n Options extends GraphHierarchicalProjectorOptions = any,\n> extends GraphRadialProjector<NodeData, Options> {\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', {\n graph: { nodes: graph?.nodes.length, edges: graph?.edges.length },\n selection: this.selection?.selected.value,\n });\n\n this.mergeData(graph);\n const selected = this.selection?.selected.value?.[0];\n if (selected) {\n const node = this.layout.graph.nodes.find((node) => node.id === selected);\n if (node) {\n this.doHierarchicalLayout(node);\n return;\n }\n }\n\n this.doRadialLayout();\n }\n\n protected doHierarchicalLayout(selected: GraphLayoutNode) {\n if (!this.context.size) {\n return;\n }\n\n const r2 =\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80);\n const r1 = r2 / 2;\n\n const children = this.layout.graph.edges\n .filter((edge) => edge.source.id === selected.id)\n .map((edge) => edge.target);\n\n // Root.\n updateNode(selected, [0, 0], 20);\n\n // Inner.\n {\n const radial = layoutRadial(0, 0, r1, children.length);\n children.forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n // Outer.\n {\n const radial = layoutRadial(0, 0, r2, this.layout.graph.nodes.length - 1 - children.length);\n this.layout.graph.nodes\n .filter((node) => node.id !== selected.id && !children.includes(node))\n .forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n this.animate();\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { easeCubic, timer, type Timer } from 'd3';\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { GraphProjector, type GraphProjectorOptions } from './graph-projector';\nimport { type Point } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphRadialProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphRadialProjector<\n NodeData = any,\n Options extends GraphRadialProjectorOptions = any,\n> extends GraphProjector<NodeData, Options> {\n private _timer?: Timer;\n\n override findNode(x: number, y: number, radius: number): GraphLayoutNode<NodeData> | undefined {\n return undefined;\n }\n\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', { graph: { nodes: graph?.nodes.length, edges: graph?.edges.length } });\n this.mergeData(graph);\n this.doRadialLayout();\n }\n\n protected animate() {\n const start = Date.now();\n if (this.options.duration) {\n this._timer = timer(() => {\n const t = Math.min(1, (Date.now() - start) / this.options.duration);\n const d = easeCubic(t);\n\n this.layout.graph.nodes.forEach((node: any) => {\n node.x = node.sx + (node.tx - node.sx) * d;\n node.y = node.sy + (node.ty - node.sy) * d;\n node.r = node.sr + (node.tr - node.sr) * d;\n });\n\n this.emitUpdate();\n if (t >= 1) {\n this._timer.stop();\n this._timer = undefined;\n }\n });\n } else {\n this.emitUpdate();\n }\n }\n\n protected override async onStop() {\n this._timer?.stop();\n this._timer = undefined;\n }\n\n protected doRadialLayout() {\n if (!this.context.size) {\n return;\n }\n\n const radial = layoutRadial(\n 0,\n 0,\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80),\n this.layout.graph.nodes.length,\n );\n\n this.layout.graph.nodes.forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n\n this.animate();\n }\n}\n\n/**\n * Update node target.\n */\nexport const updateNode = (node: GraphLayoutNode, [tx, ty]: Point, tr = 8) => {\n const sx = node.x ?? tx;\n const sy = node.y ?? ty;\n const sr = node.r ?? tr;\n Object.assign(node, {\n initialized: true,\n // Start.\n sx,\n sy,\n sr,\n // Target.\n tx,\n ty,\n tr,\n // Current.\n x: sx,\n y: sy,\n r: sr,\n });\n};\n\n/**\n * Radial position generator.\n */\nexport const layoutRadial = (x: number, y: number, r: number, n: number, start = -Math.PI / 2) => {\n const da = (2 * Math.PI) / n;\n return (i: number): Point => {\n const a = start + i * da;\n return [x + Math.cos(a) * r, y + Math.sin(a) * r];\n };\n};\n\n/**\n * Horizontal position generator.\n */\nexport const layoutHorizontal = (x: number, y: number, w: number, n: number) => {\n const dx = n > 1 ? w / (n - 1) : 0;\n const sx = x - ((n - 1) * dx) / 2;\n return (i: number): Point => {\n return [sx + i * dx, y];\n };\n};\n\n/**\n * Vertical position generator.\n */\nexport const layoutVertical = (x: number, y: number, h: number, n: number) => {\n const dy = n > 1 ? h / (n - 1) : 0;\n const sy = y - ((n - 1) * dy) / 2;\n return (i: number): Point => {\n return [x, sy + i * dy];\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\nimport { log } from '@dxos/log';\n\nimport { type GraphProjectorOptions } from './graph-projector';\nimport { GraphRadialProjector, layoutHorizontal, layoutRadial, updateNode } from './graph-radial-projector';\nimport { type GraphLayoutNode } from '../types';\n\nexport type GraphRelationalProjectorOptions = GraphProjectorOptions & {\n radius?: number;\n margin?: number;\n duration?: number;\n};\n\nexport class GraphRelationalProjector<\n NodeData = any,\n Options extends GraphRelationalProjectorOptions = any,\n> extends GraphRadialProjector<NodeData, Options> {\n protected override onUpdate(graph?: Graph) {\n log('onUpdate', {\n graph: { nodes: graph?.nodes.length, edges: graph?.edges.length },\n selection: this.selection?.selected.value,\n });\n\n this.mergeData(graph);\n const selected = this.selection?.selected.value?.[0];\n if (selected) {\n const node = this.layout.graph.nodes.find((node) => node.id === selected);\n if (node) {\n this.doRelationalLayout(node);\n return;\n }\n }\n\n this.doRadialLayout();\n }\n\n protected doRelationalLayout(selected: GraphLayoutNode) {\n if (!this.context.size) {\n return;\n }\n\n // TODO(burdon): Generate edge types.\n const r2 =\n this.options.radius ??\n Math.min(this.context.size.width, this.context.size.height) / 2 - (this.options.margin ?? 80);\n const r1 = r2 * 0.5;\n\n this.layout.graph.nodes.forEach((node) => (node.type = undefined));\n this.layout.graph.edges.forEach((edge) => {\n edge.order = 0;\n edge.type = undefined;\n });\n\n const children = this.layout.graph.edges\n .filter((edge) => edge.source.id === selected.id)\n .map((edge) => {\n edge.order = 1;\n edge.type = '1';\n edge.target.type = '1';\n return edge.target;\n });\n\n const parents = this.layout.graph.edges\n .filter((edge) => edge.target.id === selected.id)\n .map((edge) => {\n edge.order = 2;\n edge.type = '2';\n edge.source.type = '2';\n return edge.source;\n });\n\n // Root.\n updateNode(selected, [0, 0], 30);\n\n // Children.\n {\n const vertical = layoutHorizontal(0, r1, r1 * 2, children.length);\n children.forEach((node, i) => {\n const [tx, ty] = vertical(i);\n updateNode(node, [tx, ty], 20);\n });\n }\n\n // Parents.\n {\n const vertical = layoutHorizontal(0, -r1, r1, parents.length);\n parents.forEach((node, i) => {\n const [tx, ty] = vertical(i);\n updateNode(node, [tx, ty], 20);\n });\n }\n\n // Outer.\n {\n const radial = layoutRadial(0, 0, r2, this.layout.graph.nodes.length - 1 - children.length - parents.length);\n this.layout.graph.nodes\n .filter((node) => node.id !== selected.id && !children.includes(node) && !parents.includes(node))\n .forEach((node, i) => {\n const [tx, ty] = radial(i);\n updateNode(node, [tx, ty]);\n });\n }\n\n this.animate();\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { line, select, polygonHull, easeCubicOut } from 'd3';\nimport * as Clipper from 'js-clipper';\n\nimport { log } from '@dxos/log';\n\nimport { createBullets } from './bullets';\nimport { Renderer, type RendererOptions } from './renderer';\nimport { getCircumferencePoints, type D3Selection, type D3Callable, type Point } from '../../util';\nimport { type GraphLayout, type GraphLayoutEdge, type GraphLayoutNode } from '../types';\n\nconst createLine = line<Point>();\n\nexport type LabelOptions<NodeData = any> = {\n text: (node: GraphLayoutNode<NodeData>, highlight?: boolean) => string | undefined;\n};\n\nexport type AttributesOptions<NodeData = any, EdgeData = any> = {\n node?: (node: GraphLayoutNode<NodeData>) => {\n classes?: Record<string, boolean>;\n data?: Record<string, string | undefined>;\n };\n\n edge?: (edge: GraphLayoutEdge<NodeData, EdgeData>) => {\n classes?: Record<string, boolean>;\n data?: Record<string, string | undefined>;\n };\n};\n\nexport type GraphRendererOptions<NodeData = any, EdgeData = any> = RendererOptions<{\n drag?: D3Callable;\n arrows?: {\n start?: boolean; // TODO(burdon): Replace with marker id.\n end?: boolean;\n };\n highlight?: boolean;\n labels?: LabelOptions<NodeData>;\n subgraphs?: boolean;\n attributes?: AttributesOptions<NodeData>;\n transition?: () => any;\n onNodeClick?: (node: GraphLayoutNode<NodeData>, event: MouseEvent) => void;\n onNodePointerEnter?: (node: GraphLayoutNode<NodeData>, event: MouseEvent) => void;\n onLinkClick?: (link: GraphLayoutEdge<NodeData, EdgeData>, event: MouseEvent) => void;\n}>;\n\n// TODO(burdon): Perf\n// - Leaking JS event listeners.\n// - Don't update unless data changes.\n// - Cache subgraph components in layout.\n\n/**\n * Renders the Graph layout.\n */\nexport class GraphRenderer<NodeData = any, EdgeData = any> extends Renderer<\n GraphLayout<NodeData, EdgeData>,\n GraphRendererOptions<NodeData, EdgeData>\n> {\n override render(layout: GraphLayout<NodeData, EdgeData>) {\n log('render', layout);\n\n const root = select(this.root);\n\n //\n // Guides\n //\n\n if (layout.guides) {\n root\n .selectAll('g.dx-guides')\n .data([{ id: 'guides' }])\n .join('g')\n .classed('dx-guides', true)\n .selectAll<SVGCircleElement, { cx: number; cy: number; r: number }>('circle')\n .data(layout.guides ?? [])\n .join(\n (enter) => enter.append('circle').attr('r', 0),\n (update) => update,\n (exit) => exit.transition().duration(500).attr('r', 0).remove(),\n )\n .attr('cx', (d) => d.cx)\n .attr('cy', (d) => d.cy)\n .attr('r', (d) => d.r);\n }\n\n //\n // Subgraphs (aka components)\n //\n\n const scale = 100;\n const offsetDistance = 24 * scale;\n\n if (this._options.subgraphs) {\n // TODO(burdon): Cache components in layout.\n // TODO(burdon): Separate force system for each subgraph.\n const components = this._options.subgraphs\n ? findConnectedComponents({\n nodes: layout.graph?.nodes ?? [],\n edges: (layout.graph?.edges ?? []).map(({ source, target }) => ({ source: source.id, target: target.id })),\n })\n .filter((component) => component.length > 2)\n .map((component, i) => ({ id: `subgraph-${i}`, component }))\n : [];\n\n root\n .selectAll('g.dx-subgraphs')\n .data([{ id: 'subgraphs' }])\n .join('g')\n .classed('dx-subgraphs', true)\n .selectAll<SVGPathElement, { id: string }>('path')\n .data(components)\n .join(\n (enter) => enter.append('path').classed('dx-subgraph', true),\n (update) => {\n return update.attr('d', ({ component }) => {\n const points: Point[] =\n layout.graph?.nodes.filter((node) => component.includes(node.id)).map((node) => [node.x, node.y]) ?? [];\n\n // https://d3js.org/d3-polygon\n const hullPoints = polygonHull(points);\n\n // https://www.npmjs.com/package/js-clipper\n const co = new Clipper.ClipperOffset();\n const solution = [];\n const clipperPath = hullPoints.map(([x, y]) => ({ X: x * scale, Y: y * scale }));\n co.AddPath(clipperPath, Clipper.JoinType.jtRound, Clipper.EndType.etClosedPolygon);\n co.Execute(solution, offsetDistance);\n if (solution.length > 0) {\n const offset = solution[0].map(({ X, Y }) => [X / scale, Y / scale]);\n return createLine([...offset, offset[0]]);\n }\n });\n },\n );\n }\n\n //\n // Edges and nodes\n // TODO(burdon): Only call join when data changes (otherwise exit transitions are called multiple times).\n //\n\n const edgeGroup = root\n .selectAll('g.dx-edges')\n .data([{ id: 'edges' }], (d: any) => d.id)\n .join('g')\n .classed('dx-edges', true);\n\n const nodeGroup = root\n .selectAll('g.dx-nodes')\n .data([{ id: 'nodes' }], (d: any) => d.id)\n .join('g')\n .classed('dx-nodes', true);\n\n //\n // Nodes\n //\n\n nodeGroup\n .selectAll<SVGCircleElement, GraphLayoutNode<NodeData>>('g.dx-node')\n .data(layout.graph?.nodes ?? [], (d) => d.id)\n .join(\n (enter) =>\n enter\n .append('g')\n .attr('data-id', (d) => d.id)\n .attr('opacity', 1)\n .classed('dx-node', true)\n .call(createNode, this.options),\n (update) => update.call(updateNode, this.options),\n (exit) => {\n // Fade out.\n return exit\n .transition()\n .ease(easeCubicOut)\n .duration(300)\n .attr('opacity', 0)\n .on('end', function (d) {\n select(this).remove();\n });\n },\n )\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n\n //\n // Edges\n //\n\n edgeGroup\n .selectAll<SVGPathElement, GraphLayoutEdge<NodeData, EdgeData>>('g.dx-edge')\n .data(layout.graph?.edges ?? [], (d) => d.id)\n .join(\n (enter) =>\n enter\n .append('g')\n .attr('data-id', (d) => d.id)\n .classed('dx-edge', true)\n .call(createEdge, this.options),\n (update) => update.call(updateEdge, this.options, nodeGroup).each((d) => {}),\n (exit) => exit.remove(),\n )\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n }\n\n /**\n * Trigger path bullets.\n * @param node\n */\n fireBullet(node: GraphLayoutNode<NodeData>) {\n select(this.root).selectAll('g.dx-edges').selectAll('path').call(createBullets(this.root, node.id));\n }\n}\n\n/**\n * Create node elements.\n * @param group\n * @param options\n */\nconst createNode: D3Callable = <Data>(group: D3Selection, options: GraphRendererOptions<Data>) => {\n // Circle.\n const circle = group.append('circle');\n\n // Drag.\n // TODO(burdon): Update when layout changes.\n if (options.drag) {\n circle.call(options.drag);\n }\n\n // Click.\n if (options.onNodeClick) {\n group.on('click', (event: MouseEvent) => {\n const node = select<SVGElement, GraphLayoutNode<Data>>(event.target as SVGGElement).datum();\n options.onNodeClick(node, event);\n });\n }\n\n // Label.\n if (options.labels && !options.onNodePointerEnter) {\n const g = group.append('g').classed('dx-label', true);\n g.append('line');\n g.append('rect');\n g.append('text').style('dominant-baseline', 'middle');\n }\n\n // Hover.\n if (options.onNodePointerEnter) {\n circle.on('pointerenter', function (event: PointerEvent) {\n const node = select<any, GraphLayoutNode<Data>>(this.parentElement).datum();\n options.onNodePointerEnter(node, event);\n });\n\n group.attr('data-hover', 'handled'); // TODO(burdon): ???\n } else if (options.highlight !== false) {\n circle.on('pointerenter', function () {\n select(this.closest('g.dx-node')).raise();\n if (options.labels) {\n select(this.parentElement).classed('dx-active', true).classed('dx-highlight', true);\n }\n });\n\n group.on('pointerleave', function () {\n if (options.labels) {\n select(this).classed('dx-active', false);\n setTimeout(() => {\n if (!select(this).classed('dx-active')) {\n select(this).classed('dx-highlight', false);\n }\n }, 300);\n }\n });\n }\n};\n\n/**\n * Update node elements.\n * @param group\n * @param options\n */\nconst updateNode: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n) => {\n group.attr('transform', (d) => {\n return d.x != null && d.y != null ? `translate(${d.x},${d.y})` : undefined;\n });\n\n // Custom attributes.\n if (options.attributes?.node) {\n try {\n group.each((d, i, nodes) => {\n const node = select(nodes[i]);\n const { classes, data } = options.attributes?.node?.(d) ?? {};\n if (classes) {\n applyClasses(node, classes);\n }\n if (data) {\n Object.entries(data).forEach(([key, value]) => {\n node.attr(`data-${key}`, value);\n });\n }\n });\n } catch (error: any) {\n log.error('updateNode', { error: error?.message });\n }\n }\n\n // Optional transition.\n const groupOrTransition: D3Selection = options.transition\n ? (group.transition(options.transition()) as unknown as D3Selection)\n : group;\n\n // Update circles.\n groupOrTransition.select<SVGCircleElement>('circle').attr('r', (d) => d.r ?? 16);\n\n // Update labels.\n if (options.labels) {\n const bx = 1;\n const px = 4;\n const py = 2;\n const offset = 16;\n const dx = (d: any, offset = 0) => (offset + (d.r ?? 0)) * (d.x > 0 ? 1 : -1);\n\n groupOrTransition\n .select<SVGTextElement>('text')\n .text((d) => options.labels.text(d))\n .style('text-anchor', (d) => (d.x > 0 ? 'start' : 'end'))\n .attr('dx', (d) => dx(d, offset))\n .attr('dy', 1)\n .text((d) => options.labels.text(d))\n .each(function (d) {\n // Cache bounding box.\n let bbox = d.bbox;\n if (!bbox) {\n bbox = this.getBBox();\n d.bbox = bbox;\n }\n\n const width = bbox.width + (bx + px) * 2;\n const height = bbox.height + py * 2;\n\n select(this.parentElement)\n .select('rect')\n .attr('x', dx(d, offset - (bx + px)) + (d.x > 0 ? 0 : -1) * width)\n .attr('y', -height / 2)\n .attr('width', width)\n .attr('height', height)\n .attr('rx', 4);\n\n select(this.parentElement)\n .select('line')\n .attr('x1', dx(d, 1))\n .attr('y1', 0)\n .attr('x2', dx(d, offset - (bx + px)))\n .attr('y2', 0);\n });\n }\n};\n\n/**\n * Create edge elements.\n * @param group\n * @param options\n * @param nodes\n */\nconst createEdge: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n) => {\n if (options.onLinkClick) {\n // Shadow path with wide stroke for click handler.\n group\n .append('path')\n .classed('dx-click', true)\n .on('click', (event: MouseEvent) => {\n const edge = select<SVGLineElement, GraphLayoutEdge<NodeData, EdgeData>>(\n event.target as SVGLineElement,\n ).datum();\n options.onLinkClick(edge, event);\n });\n }\n\n group\n .append('path')\n .attr('pointer-events', 'none')\n .attr('marker-start', () => (options.arrows?.start ? 'url(#marker-arrow-start)' : undefined))\n .attr('marker-end', () => (options.arrows?.end ? 'url(#marker-arrow-end)' : undefined));\n};\n\n/**\n * Update edge elements.\n * @param group\n * @param options\n */\nconst updateEdge: D3Callable = <NodeData = any, EdgeData = any>(\n group: D3Selection,\n options: GraphRendererOptions<NodeData, EdgeData>,\n nodeGroup: D3Selection,\n) => {\n // Custom attributes.\n try {\n group.each((d, i, edges) => {\n const edge = select(edges[i]);\n edge.classed('dx-dashed', d.linkForce === false);\n const { classes, data } = options.attributes?.edge?.(d) ?? {};\n if (classes) {\n applyClasses(edge, classes);\n }\n if (data) {\n Object.entries(data).forEach(([key, value]) => {\n edge.attr(`data-${key}`, value);\n });\n }\n });\n } catch (error: any) {\n log.error('updateEdge', { error: error?.message });\n }\n\n // Optional transition.\n const groupOrTransition: D3Selection = options.transition\n ? (group.transition(options.transition()) as unknown as D3Selection)\n : group;\n\n groupOrTransition.selectAll<SVGPathElement, GraphLayoutEdge<NodeData, EdgeData>>('path').attr('d', function () {\n // NOTE: `d` is stale after layout is switched so get the datum from the parent element.\n const { source, target } = select(this.parentElement).datum() as GraphLayoutEdge<NodeData, EdgeData>;\n if (!source.initialized || !target.initialized) {\n return;\n }\n\n return createLine(getCircumferencePoints([source.x, source.y], [target.x, target.y], source.r, target.r));\n });\n};\n\n// TODO(burdon): Factor out.\n\nconst applyClasses = (el: D3Selection, classes: Record<string, boolean>) => {\n for (const [className, value] of Object.entries(classes)) {\n el.classed(className, value);\n }\n};\n\n/**\n * Find connected components (subgraphs) in a graph.\n */\nconst findConnectedComponents = (graph: {\n nodes: { id: string }[];\n edges: { source: string; target: string }[];\n}): string[][] => {\n const adj: Record<string, string[]> = {};\n for (const node of graph.nodes) {\n adj[node.id] = [];\n }\n\n for (const { source, target } of graph.edges) {\n adj[source].push(target);\n adj[target].push(source);\n }\n\n const visited = new Set<string>();\n const components: string[][] = [];\n for (const node of graph.nodes) {\n if (visited.has(node.id)) {\n continue;\n }\n\n const stack = [node.id];\n const componentIds: string[] = [];\n\n while (stack.length) {\n const current = stack.pop()!;\n if (visited.has(current)) {\n continue;\n }\n visited.add(current);\n componentIds.push(current);\n stack.push(...adj[current]);\n }\n\n components.push(componentIds);\n }\n\n return components;\n};\n", "//\n// Copyright 2019 DXOS.org\n//\n\nimport { easeLinear, interpolate, select } from 'd3';\n\nimport { type D3Selection, type D3Callable } from '../../util';\n\nexport type BulletOptions = {\n max?: number;\n radius?: number;\n delay?: number;\n minDuration?: number;\n maxDuration?: number;\n};\n\n/**\n * Generate animated bullets that follow selected paths.\n * @param group\n * @param nodeId\n * @param options\n */\nexport const createBullets = (group: SVGGElement, nodeId: string, options: BulletOptions = {}): D3Callable => {\n return (selection: D3Selection) => {\n const { max = 32, radius = 3, delay = 50, minDuration = 100, maxDuration = 500 } = options;\n\n // Edge selection.\n selection.each(function (d, i, edges) {\n const { source, target } = d;\n\n // Match source node.\n if (source.id === nodeId) {\n const path = select(edges[i]);\n const p = path.node().getPointAtLength(0);\n\n const bullet = select(group)\n .append('circle')\n .attr('class', 'dx-bullet')\n .attr('cx', p.x)\n .attr('cy', p.y)\n .attr('r', radius);\n\n bullet\n // Start animation.\n .transition()\n .delay(delay)\n .duration(minDuration + Math.random() * maxDuration)\n .ease(easeLinear)\n .tween('pathTween', function () {\n const length = path.node().getTotalLength();\n const r = interpolate(0, length);\n\n return (t) => {\n const point = path.node().getPointAtLength(r(t));\n select(this).attr('cx', point.x).attr('cy', point.y);\n };\n })\n\n // End of transition.\n .on('end', function () {\n select(this).remove();\n\n // Propagate with circuit breaker to prevent infinite recursion.\n const num = select(group).selectAll('circle.dx-bullet').size();\n if (num < max) {\n selection.call(createBullets(group, target.id));\n }\n });\n }\n });\n };\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type RefObject } from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type SVGContext } from '../../hooks';\nimport { defaultIdAccessor, type IdAccessor } from '../types';\n\nexport type RendererOptions<T = any> = {\n idAccessor: IdAccessor;\n} & T;\n\n/**\n * Base class for renderer that draw layouts.\n */\nexport abstract class Renderer<LAYOUT, OPTIONS extends RendererOptions> {\n protected readonly _options?: OPTIONS;\n\n constructor(\n protected readonly _context: SVGContext,\n protected readonly _root: RefObject<SVGGElement>,\n options?: Partial<OPTIONS>,\n ) {\n this._options = Object.assign(\n {\n idAccessor: defaultIdAccessor,\n },\n options,\n ) as OPTIONS;\n }\n\n get context(): SVGContext {\n return this._context;\n }\n\n get root(): SVGGElement {\n invariant(this._root.current, 'SVG root is not initialized');\n return this._root.current;\n }\n\n get options() {\n return this._options;\n }\n\n abstract render(layout: LAYOUT): void;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { line } from 'd3';\n\nimport { type D3Callable, type Point } from '../../util';\nimport { getCircumferencePoints } from '../../util';\nimport { type GraphLayoutNode } from '../types';\n\nconst createLine = line();\n\nexport type LinkOptions = {\n source?: GraphLayoutNode<any>;\n target?: GraphLayoutNode<any>;\n point?: Point;\n};\n\n/**\n * Render linker while dragging.\n */\nexport const linkerRenderer: D3Callable = (root, { source, target, point }: LinkOptions = {}) => {\n root\n .selectAll('g.dx-linker')\n .data([{ id: 'linker' }])\n .join('g')\n .attr('class', 'dx-linker')\n .selectAll<SVGPathElement, any>('path')\n .data(source ? [{ id: 'edge' }] : [])\n .join('path')\n .attr('marker-end', () => (target ? 'url(#marker-arrow-end)' : 'url(#marker-dot)'))\n .attr('d', () => {\n return createLine(\n getCircumferencePoints(\n [source.x, source.y],\n target ? [target.x, target.y] : point,\n source.r,\n target ? target.r : 0,\n ),\n );\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { geoPath, select, type GeoStream } from 'd3';\nimport { useEffect } from 'react';\nimport { feature, mesh } from 'topojson-client';\nimport { type GeometryCollection, type GeometryObject, type Objects, type Topology } from 'topojson-specification';\n\nimport { useSvgContext } from '../../hooks';\nimport { type Size } from '../../util';\n\nexport type MeshProps = {\n radius?: number;\n value?: number;\n};\n\n// https://d3og.com/mbostock/5249328\nexport const Mesh = ({ radius = 16, value = 0.5 }: MeshProps) => {\n const { svg, size } = useSvgContext();\n\n useEffect(() => {\n if (size) {\n // TODO(burdon): Resize doesn't trigger.\n const topology = hexTopology(size, radius, value);\n const projection = hexProjection(radius);\n const path = geoPath().projection(projection);\n\n select(svg)\n .append('g')\n .attr('class', 'hexagon')\n .selectAll('path')\n .data(topology.objects.hexagons.geometries)\n .enter()\n .append('path')\n .attr('d', (d) => path(feature(topology, d)))\n .attr('class', (d) => ((d.properties as Custom)?.fill ? 'fill' : null));\n // .on('mousedown', mousedown)\n // .on('mousemove', mousemove)\n // .on('mouseup', mouseup);\n\n select(svg).append('path').datum(mesh(topology, topology.objects.hexagons)).attr('class', 'mesh').attr('d', path);\n\n const redraw = (border: any) => {\n border.attr(\n 'd',\n path(\n mesh(\n topology,\n topology.objects.hexagons,\n (a, b) => (a.properties as Custom).fill !== (b.properties as Custom).fill,\n ),\n ),\n );\n };\n\n select(svg).append('path').attr('class', 'border').call(redraw);\n }\n }, [svg, size, value]);\n\n return null;\n};\n\ntype Custom = { fill: boolean };\n\ninterface HexObjects extends Objects<{ fill: boolean }> {\n hexagons: GeometryCollection<Custom>;\n}\n\nconst hexTopology = ({ width, height }: Size, radius: number, value = 1): Topology<HexObjects> => {\n const dx = radius * 2 * Math.sin(Math.PI / 3);\n const dy = radius * 1.5;\n const m = Math.ceil((height + radius) / dy) + 1;\n const n = Math.ceil(width / dx) + 1;\n const geometries: Array<GeometryObject<{ fill: boolean }>> = [];\n const arcs = [];\n\n for (let j = -1; j <= m; ++j) {\n for (let i = -1; i <= n; ++i) {\n const y = j * 2;\n const x = (i + (j & 1) / 2) * 2;\n arcs.push(\n [\n [x, y - 1],\n [1, 1],\n ],\n [\n [x + 1, y],\n [0, 1],\n ],\n [\n [x + 1, y + 1],\n [-1, 1],\n ],\n );\n }\n }\n\n for (let j = 0, q = 3; j < m; ++j, q += 6) {\n for (let i = 0; i < n; ++i, q += 3) {\n geometries.push({\n type: 'Polygon',\n arcs: [[q, q + 1, q + 2, ~(q + (n + 2 - (j & 1)) * 3), ~(q - 2), ~(q - (n + 2 + (j & 1)) * 3 + 2)]],\n properties: {\n fill: Math.random() > (i / n) * (1 / value),\n },\n });\n }\n }\n\n const hexagons: GeometryCollection<{ fill: boolean }> = { type: 'GeometryCollection', geometries };\n\n return {\n type: 'Topology',\n transform: { translate: [0, 0], scale: [1, 1] },\n objects: { hexagons },\n arcs,\n };\n};\n\nconst hexProjection = (radius: number) => {\n const dx = radius * 2 * Math.sin(Math.PI / 3);\n const dy = radius * 1.5;\n return {\n stream: (stream: GeoStream) => ({\n point: (x: number, y: number) => {\n stream.point((x * dx) / 2, ((y - (2 - (y & 1)) / 3) * dy) / 2);\n },\n lineStart: () => {\n stream.lineStart();\n },\n lineEnd: () => {\n stream.lineEnd();\n },\n polygonStart: () => {\n stream.polygonStart();\n },\n polygonEnd: () => {\n stream.polygonEnd();\n },\n }),\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { useGrid, type GridOptions } from '../../hooks';\n\nexport type GridProps = ThemedClassName<GridOptions>;\n\n/**\n * SVG grid wrapper.\n */\nexport const Grid = ({ classNames, ...props }: GridProps) => {\n const { ref } = useGrid(props);\n return <g ref={ref} className={mx('dx-grid', classNames)} />;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { select } from 'd3';\nimport React, { useEffect, useRef } from 'react';\n\nimport { createMarkers } from '../../graph';\n\nexport type MarkersProps = {\n arrowSize?: number;\n className?: string;\n};\n\n/**\n * SVG markers wrapper.\n */\nexport const Markers = ({ arrowSize, className }: MarkersProps) => {\n const ref = useRef();\n useEffect(() => {\n select(ref.current).call(createMarkers({ arrowSize }));\n }, [ref]);\n\n return <defs ref={ref} className={className} />;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { select } from 'd3';\nimport React, { forwardRef, type PropsWithChildren, useEffect, useMemo, useImperativeHandle } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { SVGContext, type SVGContextOptions, SVGContextProvider } from '../../hooks';\n\nexport type RootProps = ThemedClassName<PropsWithChildren<SVGContextOptions>>;\n\n/**\n * Makes the SVG context available to child nodes.\n * Automatically resizes the SVG element, which expands to fit the container.\n */\nexport const Root = forwardRef<SVGContext, RootProps>(({ classNames, children, ...props }, ref) => {\n const { ref: containerRef, width = 0, height = 0 } = useResizeDetector({ refreshRate: 200 });\n\n const context = useMemo<SVGContext>(() => {\n return new SVGContext(props);\n }, [props.scale, props.centered]);\n\n useImperativeHandle(ref, () => context, [context]);\n\n useEffect(() => {\n if (width && height) {\n context.setSize({ width, height });\n select(context.svg)\n .attr('display', 'block')\n .attr('viewBox', context.viewBox)\n .attr('width', width)\n .attr('height', height);\n }\n }, [context, width, height]);\n\n const ready = width !== 0 && height !== 0;\n\n return (\n <SVGContextProvider value={context}>\n <div ref={containerRef} className={mx('grid grow overflow-hidden', classNames)}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n ref={context.ref}\n className={mx('transition-opacity opacity-0 duration-1000', ready && 'opacity-100')}\n >\n {ready && children}\n </svg>\n </div>\n </SVGContextProvider>\n );\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { type ReactNode, memo, useMemo } from 'react';\n\nimport { useZoom, type ZoomExtent } from '../../hooks';\n\nexport type ZoomProps = {\n extent?: ZoomExtent;\n className?: string;\n children?: ReactNode;\n};\n\n/**\n * SVG zoomable component wrapper.\n */\nexport const Zoom = memo(({ extent, className, children }: ZoomProps) => {\n const options = useMemo(() => ({ extent }), [JSON.stringify(extent)]); // TODO(burdon): Avoid stringify.\n const zoom = useZoom(options);\n\n return (\n <g ref={zoom.ref as any} className={className}>\n {children}\n </g>\n );\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type PropsWithChildren } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\n\nimport { Grid, type GridProps as SVGGridProps } from './Grid';\nimport { Markers, type MarkersProps as SVGMarkersProps } from './Markers';\nimport { Root, type RootProps as SVGRootProps } from './Root';\nimport { Zoom, type ZoomProps as SVGZoomProps } from './Zoom';\nimport { Graph, type GraphProps as SVGGraphProps } from '../Graph';\nimport { Mesh, type MeshProps as SVGMeshProps } from '../Mesh';\n\nexport type SVGProps = PropsWithChildren<ThemedClassName>;\n\nexport const SVG = {\n Root,\n Grid,\n Markers,\n Mesh,\n Zoom,\n Graph,\n};\n\nexport type { SVGRootProps, SVGGridProps, SVGMarkersProps, SVGZoomProps, SVGGraphProps, SVGMeshProps };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { easeCubicOut, select } from 'd3';\n\nimport { type D3Callable, type D3Selection } from '../util';\n\nconst PROP_PULSAR_ACTIVE = 'dx-pulsar-active';\n\n/**\n * Pulsar effect.\n */\nexport namespace Pulsar {\n export const has = (group: D3Selection<SVGGElement>) => group.select('circle.dx-pulsar').empty();\n\n export const create: D3Callable<SVGGElement> = (group, r: number, options: PulsarOptions = {}) => {\n const pulsar = group\n .append('circle')\n .classed('dx-pulsar', true)\n .classed('stroke-2 stroke-red-500 fill-none', true)\n .property(PROP_PULSAR_ACTIVE, true);\n\n startAnimation(pulsar, r, options);\n };\n\n export const remove: D3Callable<SVGGElement> = (group) => {\n group.select('circle.dx-pulsar').property(PROP_PULSAR_ACTIVE, false);\n };\n\n export type Options = PulsarOptions;\n}\n\ntype PulsarOptions = {\n period?: number;\n duration?: number;\n ratio?: number;\n};\n\nconst startAnimation = (pulsar: D3Selection<SVGCircleElement>, r: number, options: PulsarOptions = {}) => {\n const { period = 1_000, duration = 800, ratio = 3 } = options;\n return pulsar\n .attr('r', r)\n .attr('opacity', 1)\n .transition('pulsar')\n .delay(period - (Date.now() % period))\n .duration(Math.min(duration, period - 20))\n .ease(easeCubicOut)\n .attr('r', r * ratio)\n .attr('opacity', -0.1)\n .on('end', function () {\n if (select(this).property(PROP_PULSAR_ACTIVE)) {\n startAnimation(select(this), r, options);\n } else {\n select(this).remove();\n }\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAA6BC,YAAYC,WAAWC,qBAAqBC,SAASC,cAAc;AAEvG,SAASC,eAAe;AAExB,SAASC,OAAAA,YAAW;AAEpB,SAASC,UAAU;;;ACPnB,SAASC,MAAMC,cAAc;AAI7B,IAAMC,aAAaC,KAAAA;AAMnB,IAAMC,cACJ,CAACC,QAAgBC,QAAgBC,UACjC,CAACC,OAAAA;AACC,QAAMC,SAASJ,SAAS;AACxBG,KAAGE,KAAK,eAAeL,SAAS,CAAA,EAC7BK,KAAK,gBAAgBD,SAAS,CAAA,EAC9BC,KAAK,WAAW,IAAIL,MAAAA,KAAWI,MAAAA,IAAUJ,SAAS,CAAA,IAAKI,SAAS,CAAA,EAAG,EACnEC,KAAK,UAAU,MAAA,EACfA,KAAK,QAAQJ,MAAAA,EACbK,OAAO,MAAA,EACPD,KAAK,QAAQ,MA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A,EAAAA;AA0BjB,IAAMY,iBAAiB,CAACJ,QAAuCF,GAAWC,UAAyB,CAAC,MAAC;AACnG,QAAM,EAAEO,SAAS,KAAOC,WAAW,KAAKC,QAAQ,EAAC,IAAKT;AACtD,SAAOC,OACJS,KAAK,KAAKX,CAAAA,EACVW,KAAK,WAAW,CAAA,EAChBC,WAAW,QAAA,EACXC,MAAML,SAAUM,KAAKC,IAAG,IAAKP,MAAAA,EAC7BC,SAASO,KAAKC,IAAIR,UAAUD,SAAS,EAAA,CAAA,EACrCU,KAAKC,aAAAA,EACLR,KAAK,KAAKX,IAAIU,KAAAA,EACdC,KAAK,WAAW,IAAC,EACjBS,GAAG,OAAO,WAAA;AACT,QAAIvB,QAAO,IAAI,EAAEQ,SAASZ,kBAAAA,GAAqB;AAC7Ca,qBAAeT,QAAO,IAAI,GAAGG,GAAGC,OAAAA;IAClC,OAAO;AACLJ,MAAAA,QAAO,IAAI,EAAEU,OAAM;IACrB;EACF,CAAA;AACJ;;",
|
|
6
6
|
"names": ["effect", "React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useRef", "combine", "log", "mx", "line", "select", "createLine", "line", "createArrow", "length", "offset", "start", "el", "height", "attr", "append", "createDot", "size", "createMarkers", "arrowSize", "group", "selectAll", "data", "id", "generator", "className", "join", "d", "each", "i", "nodes", "select", "call", "drag", "pointer", "select", "defaultDragOptions", "linkMod", "freezeMod", "createGraphDrag", "context", "projector", "options", "mode", "source", "target", "offset", "moved", "keyMod", "event", "key", "modKey", "undefined", "drag", "filter", "ctrlKey", "on", "d", "pointer", "parentElement", "onDrop", "sourceEvent", "parent", "closest", "select", "classed", "raise", "dx", "dy", "x", "y", "point", "svg", "attr", "subject", "fx", "fy", "refresh", "onDrag", "findNode", "invariant", "defaultIdAccessor", "node", "id", "emptyGraph", "nodes", "edges", "Projector", "_context", "options", "updated", "EventEmitter", "_options", "Object", "assign", "idAccessor", "defaultIdAccessor", "context", "refresh", "dragging", "onRefresh", "updateData", "data", "onUpdate", "emitUpdate", "emit", "layout", "clear", "onClear", "start", "onStart", "stop", "onStop", "GraphProjector", "Projector", "context", "options", "_selection", "layout", "_layout", "id", "Math", "random", "toString", "slice", "graph", "nodes", "edges", "selection", "numChildren", "node", "filter", "edge", "source", "idAccessor", "length", "reset", "emitUpdate", "mergeData", "data", "emptyGraph", "map", "current", "find", "n", "target", "Object", "assign", "onClear", "forceCenter", "forceCollide", "forceLink", "forceManyBody", "forceRadial", "forceSimulation", "forceX", "forceY", "log", "forceX", "forceY", "forcePoint", "x", "y", "strength", "fx", "forceX", "undefined", "fy", "forceY", "force", "alpha", "initialize", "nodes", "random", "getValue", "valueOrFunction", "invoker", "defaultValue", "maybeForce", "options", "cb", "undefined", "value", "defaultForceOptions", "link", "manyBody", "point", "GraphForceProjector", "GraphProjector", "_simulation", "forceSimulation", "forces", "simulation", "restart", "alpha", "findNode", "x", "y", "radius", "find", "onStart", "clearTimeout", "_timeout", "propagating", "radial", "delay", "updateForces", "setTimeout", "on", "emitUpdate", "velocityDecay", "alphaDecay", "Math", "pow", "onStop", "stop", "onRefresh", "dragging", "center", "force", "onUpdate", "graph", "log", "nodes", "length", "edges", "mergeData", "updateLayout", "layout", "guides", "id", "type", "cx", "cy", "r", "context", "scale", "model", "toValue", "forEach", "node", "initialized", "a", "PI", "random", "Object", "assign", "cos", "sin", "attributes", "fn", "numChildren", "edge", "linkForce", "config", "forceLink", "d", "links", "filter", "distance", "strength", "iterations", "forceManyBody", "distanceMax", "collide", "forceCollide", "forceRadial", "forceCenter", "forcePoint", "forceX", "forceY", "log", "easeCubic", "timer", "log", "GraphRadialProjector", "GraphProjector", "findNode", "x", "y", "radius", "undefined", "onUpdate", "graph", "log", "nodes", "length", "edges", "mergeData", "doRadialLayout", "animate", "start", "Date", "now", "options", "duration", "_timer", "timer", "t", "Math", "min", "d", "easeCubic", "layout", "forEach", "node", "sx", "tx", "sy", "ty", "r", "sr", "tr", "emitUpdate", "stop", "onStop", "context", "size", "radial", "layoutRadial", "width", "height", "margin", "i", "updateNode", "Object", "assign", "initialized", "n", "PI", "da", "a", "cos", "sin", "layoutHorizontal", "w", "dx", "layoutVertical", "h", "dy", "GraphHierarchicalProjector", "GraphRadialProjector", "onUpdate", "graph", "log", "nodes", "length", "edges", "selection", "selected", "value", "mergeData", "node", "layout", "find", "id", "doHierarchicalLayout", "doRadialLayout", "context", "size", "r2", "options", "radius", "Math", "min", "width", "height", "margin", "r1", "children", "filter", "edge", "source", "map", "target", "updateNode", "radial", "layoutRadial", "forEach", "i", "tx", "ty", "includes", "animate", "log", "GraphRelationalProjector", "GraphRadialProjector", "onUpdate", "graph", "log", "nodes", "length", "edges", "selection", "selected", "value", "mergeData", "node", "layout", "find", "id", "doRelationalLayout", "doRadialLayout", "context", "size", "r2", "options", "radius", "Math", "min", "width", "height", "margin", "r1", "forEach", "type", "undefined", "edge", "order", "children", "filter", "source", "map", "target", "parents", "updateNode", "vertical", "layoutHorizontal", "i", "tx", "ty", "radial", "layoutRadial", "includes", "animate", "line", "select", "polygonHull", "easeCubicOut", "Clipper", "log", "easeLinear", "interpolate", "select", "createBullets", "group", "nodeId", "options", "selection", "max", "radius", "delay", "minDuration", "maxDuration", "each", "d", "i", "edges", "source", "target", "id", "path", "select", "p", "node", "getPointAtLength", "bullet", "append", "attr", "x", "y", "transition", "duration", "Math", "random", "ease", "easeLinear", "tween", "length", "getTotalLength", "r", "interpolate", "t", "point", "on", "remove", "num", "selectAll", "size", "call", "invariant", "Renderer", "_context", "_root", "options", "_options", "Object", "assign", "idAccessor", "defaultIdAccessor", "context", "root", "invariant", "current", "createLine", "line", "GraphRenderer", "Renderer", "render", "layout", "log", "root", "select", "guides", "selectAll", "data", "id", "join", "classed", "enter", "append", "attr", "update", "exit", "transition", "duration", "remove", "d", "cx", "cy", "r", "scale", "offsetDistance", "_options", "subgraphs", "components", "findConnectedComponents", "nodes", "graph", "edges", "map", "source", "target", "filter", "component", "length", "i", "points", "node", "includes", "x", "y", "hullPoints", "polygonHull", "co", "ClipperOffset", "solution", "clipperPath", "X", "Y", "AddPath", "JoinType", "jtRound", "EndType", "etClosedPolygon", "Execute", "offset", "edgeGroup", "nodeGroup", "call", "createNode", "options", "updateNode", "ease", "easeCubicOut", "on", "sort", "a", "b", "order", "createEdge", "updateEdge", "each", "fireBullet", "createBullets", "group", "circle", "drag", "onNodeClick", "event", "datum", "labels", "onNodePointerEnter", "g", "style", "parentElement", "highlight", "closest", "raise", "setTimeout", "undefined", "attributes", "classes", "applyClasses", "Object", "entries", "forEach", "key", "value", "error", "message", "groupOrTransition", "bx", "px", "py", "dx", "text", "bbox", "getBBox", "width", "height", "onLinkClick", "edge", "arrows", "start", "end", "linkForce", "initialized", "getCircumferencePoints", "el", "className", "adj", "push", "visited", "Set", "has", "stack", "componentIds", "current", "pop", "add", "line", "createLine", "line", "linkerRenderer", "root", "source", "target", "point", "selectAll", "data", "id", "join", "attr", "getCircumferencePoints", "x", "y", "r", "GraphInner", "classNames", "model", "projector", "_projector", "renderer", "_renderer", "drag", "arrows", "onSelect", "onInspect", "props", "forwardedRef", "context", "useSvgContext", "graphRef", "useRef", "useMemo", "GraphForceProjector", "GraphRenderer", "createGraphDrag", "undefined", "end", "onNodeClick", "node", "event", "onNodePointerEnter", "useImperativeHandle", "refresh", "updateData", "graph", "repaint", "render", "layout", "findNode", "id", "current", "querySelector", "useEffect", "combine", "effect", "updated", "on", "error", "stop", "log", "catch", "start", "g", "ref", "className", "mx", "Graph", "forwardRef", "geoPath", "select", "useEffect", "feature", "mesh", "Mesh", "radius", "value", "svg", "size", "useSvgContext", "useEffect", "topology", "hexTopology", "projection", "hexProjection", "path", "geoPath", "select", "append", "attr", "selectAll", "data", "objects", "hexagons", "geometries", "enter", "d", "feature", "properties", "fill", "datum", "mesh", "redraw", "border", "a", "b", "call", "width", "height", "dx", "Math", "sin", "PI", "dy", "m", "ceil", "n", "arcs", "j", "i", "y", "x", "push", "q", "type", "random", "transform", "translate", "scale", "stream", "point", "lineStart", "lineEnd", "polygonStart", "polygonEnd", "React", "mx", "Grid", "classNames", "props", "ref", "useGrid", "React", "g", "className", "mx", "select", "React", "useEffect", "useRef", "Markers", "arrowSize", "className", "ref", "useRef", "useEffect", "select", "current", "call", "createMarkers", "React", "defs", "select", "React", "forwardRef", "useEffect", "useMemo", "useImperativeHandle", "useResizeDetector", "mx", "Root", "forwardRef", "classNames", "children", "props", "ref", "containerRef", "width", "height", "useResizeDetector", "refreshRate", "context", "useMemo", "SVGContext", "scale", "centered", "useImperativeHandle", "useEffect", "setSize", "select", "svg", "attr", "viewBox", "ready", "React", "SVGContextProvider", "value", "div", "className", "mx", "xmlns", "React", "memo", "useMemo", "Zoom", "memo", "extent", "className", "children", "options", "useMemo", "JSON", "stringify", "zoom", "useZoom", "React", "g", "ref", "SVG", "Root", "Grid", "Markers", "Mesh", "Zoom", "Graph", "easeCubicOut", "select", "PROP_PULSAR_ACTIVE", "Pulsar", "has", "group", "select", "empty", "create", "r", "options", "pulsar", "append", "classed", "property", "startAnimation", "remove", "period", "duration", "ratio", "attr", "transition", "delay", "Date", "now", "Math", "min", "ease", "easeCubicOut", "on"]
|
|
7
7
|
}
|