@dxos/react-ui-graph 0.8.3 → 0.8.4-main.f9ba587
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-4C5Z5DAE.mjs} +12 -12
- package/dist/lib/browser/index.mjs +35 -35
- 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-AK6HNA4R.mjs} +12 -12
- package/dist/lib/node-esm/index.mjs +35 -35
- 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/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/stories/hooks.stories.tsx +1 -1
- 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-4C5Z5DAE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-ITHTKQOY.mjs.map → chunk-AK6HNA4R.mjs.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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,0BAAuB;AACvB,mBAAuG;AAEvG,mBAAwB;AAExB,iBAAoB;AAEpB,4BAAmB;ACPnB,gBAA6B;ACA7B,IAAAA,aAAsC;ACMtC,uBAA0B;AGN1B,IAAAA,aAUO;AAGP,IAAAC,cAAoB;ACbpB,IAAAD,aAA+F;ACC/F,IAAAC,cAAoB;ACDpB,IAAAD,aAA6C;AAG7C,IAAAC,cAAoB;ACFpB,IAAAA,cAAoB;ACDpB,IAAAD,aAAwD;AACxD,cAAyB;AAEzB,IAAAC,cAAoB;ACHpB,IAAAD,aAAgD;ACEhD,IAAAE,oBAA0B;ACF1B,IAAAF,aAAqB;ACArB,IAAAA,aAAgD;AAChD,IAAAG,gBAA0B;AAC1B,6BAA8B;;ACF9B,IAAAA,gBAAkB;AAGlB,IAAAC,yBAAmB;;ACHnB,IAAAJ,cAAuB;AACvB,IAAAG,gBA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AAK/V;AACtD,SAAO2V,OACJpX,KAAK,KAAK8I,CAAAA,EACV9I,KAAK,WAAW,CAAA,EAChBqN,WAAW,QAAA,EACXpF,MAAMsP,SAAU9M,KAAKC,IAAG,IAAK6M,MAAAA,EAC7B5M,SAASpF,KAAKwF,IAAIJ,UAAU4M,SAAS,EAAA,CAAA,EACrCjK,KAAKsC,YAAAA,YAAAA,EACL5P,KAAK,KAAK8I,IAAI0O,KAAAA,EACdxX,KAAK,WAAW,IAAC,EACjBsC,GAAG,OAAO,WAAA;AACT,YAAIrB,YAAAA,QAAO,IAAI,EAAEoW,SAASL,kBAAAA,GAAqB;AAC7CM,yBAAerW,YAAAA,QAAO,IAAI,GAAG6H,GAAGrH,OAAAA;IAClC,OAAO;AACLR,sBAAAA,QAAO,IAAI,EAAE0M,OAAM;IACrB;EACF,CAAA;AACJ;;",
|
|
6
|
-
"names": ["import_d3", "import_log", "import_invariant", "import_react", "import_react_ui_theme", "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", "defaultDragOptions", "linkMod", "freezeMod", "createGraphDrag", "context", "projector", "options", "mode", "source", "target", "moved", "keyMod", "event", "key", "modKey", "undefined", "drag", "filter", "ctrlKey", "on", "pointer", "parentElement", "onDrop", "sourceEvent", "parent", "closest", "classed", "raise", "dx", "dy", "x", "y", "point", "svg", "subject", "fx", "fy", "refresh", "onDrag", "findNode", "defaultIdAccessor", "node", "invariant", "emptyGraph", "edges", "Projector", "_context", "updated", "EventEmitter", "_options", "Object", "assign", "idAccessor", "dragging", "onRefresh", "updateData", "onUpdate", "emitUpdate", "emit", "layout", "clear", "onClear", "onStart", "stop", "onStop", "GraphProjector", "_selection", "_layout", "Math", "random", "toString", "slice", "graph", "selection", "numChildren", "edge", "reset", "mergeData", "map", "current", "find", "n", "forcePoint", "strength", "forceX", "forceY", "force", "alpha", "initialize", "getValue", "valueOrFunction", "invoker", "defaultValue", "maybeForce", "cb", "value", "defaultForceOptions", "link", "manyBody", "GraphForceProjector", "forceSimulation", "forces", "simulation", "_simulation", "restart", "radius", "clearTimeout", "_timeout", "propagating", "radial", "delay", "updateForces", "setTimeout", "velocityDecay", "alphaDecay", "pow", "center", "log", "updateLayout", "guides", "type", "cx", "cy", "r", "scale", "model", "toValue", "forEach", "initialized", "a", "PI", "cos", "sin", "attributes", "fn", "linkForce", "config", "forceLink", "links", "distance", "iterations", "forceManyBody", "distanceMax", "collide", "forceCollide", "forceRadial", "forceCenter", "GraphRadialProjector", "doRadialLayout", "animate", "Date", "now", "duration", "_timer", "timer", "t", "min", "easeCubic", "sx", "tx", "sy", "ty", "sr", "tr", "layoutRadial", "width", "margin", "updateNode", "da", "layoutHorizontal", "w", "layoutVertical", "h", "GraphHierarchicalProjector", "selected", "doHierarchicalLayout", "r2", "r1", "children", "includes", "GraphRelationalProjector", "doRelationalLayout", "order", "parents", "vertical", "createBullets", "nodeId", "max", "minDuration", "maxDuration", "path", "p", "getPointAtLength", "bullet", "transition", "ease", "easeLinear", "tween", "getTotalLength", "interpolate", "remove", "num", "Renderer", "_root", "root", "GraphRenderer", "render", "enter", "update", "exit", "offsetDistance", "subgraphs", "components", "findConnectedComponents", "component", "points", "hullPoints", "polygonHull", "co", "ClipperOffset", "solution", "clipperPath", "X", "Y", "AddPath", "JoinType", "jtRound", "EndType", "etClosedPolygon", "Execute", "edgeGroup", "nodeGroup", "createNode", "easeCubicOut", "sort", "b", "createEdge", "updateEdge", "fireBullet", "circle", "onNodeClick", "datum", "labels", "onNodePointerEnter", "g", "style", "highlight", "classes", "applyClasses", "entries", "error", "message", "groupOrTransition", "bx", "px", "py", "text", "bbox", "getBBox", "onLinkClick", "arrows", "end", "getCircumferencePoints", "adj", "push", "visited", "Set", "has", "stack", "componentIds", "pop", "add", "linkerRenderer", "GraphInner", "classNames", "_projector", "renderer", "_renderer", "onSelect", "onInspect", "props", "forwardedRef", "useSvgContext", "graphRef", "useRef", "useMemo", "useImperativeHandle", "repaint", "querySelector", "useEffect", "combine", "effect", "catch", "React", "ref", "mx", "Graph", "forwardRef", "Mesh", "topology", "hexTopology", "projection", "hexProjection", "geoPath", "objects", "hexagons", "geometries", "feature", "properties", "fill", "mesh", "redraw", "border", "m", "ceil", "arcs", "j", "q", "transform", "translate", "stream", "lineStart", "lineEnd", "polygonStart", "polygonEnd", "Grid", "useGrid", "Markers", "defs", "Root", "containerRef", "useResizeDetector", "refreshRate", "SVGContext", "centered", "setSize", "viewBox", "ready", "SVGContextProvider", "div", "xmlns", "Zoom", "memo", "extent", "JSON", "stringify", "zoom", "useZoom", "SVG", "PROP_PULSAR_ACTIVE", "Pulsar", "empty", "create", "pulsar", "property", "startAnimation", "period", "ratio"]
|
|
7
|
-
}
|
package/dist/lib/node/meta.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-graph/src/graph/markers.ts":{"bytes":7811,"imports":[{"path":"d3","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-drag.ts":{"bytes":11616,"imports":[{"path":"d3","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/util/d3-types.ts":{"bytes":1564,"imports":[],"format":"esm"},"packages/ui/react-ui-graph/src/util/events.ts":{"bytes":1879,"imports":[],"format":"esm"},"packages/ui/react-ui-graph/src/util/fraction.ts":{"bytes":14265,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/util/points.ts":{"bytes":7291,"imports":[],"format":"esm"},"packages/ui/react-ui-graph/src/util/scale.ts":{"bytes":16036,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/util/fraction.ts","kind":"import-statement","original":"./fraction"}],"format":"esm"},"packages/ui/react-ui-graph/src/util/screen.ts":{"bytes":8425,"imports":[],"format":"esm"},"packages/ui/react-ui-graph/src/util/types.ts":{"bytes":639,"imports":[],"format":"esm"},"packages/ui/react-ui-graph/src/util/vector.ts":{"bytes":6009,"imports":[{"path":"packages/ui/react-ui-graph/src/util/fraction.ts","kind":"import-statement","original":"./fraction"}],"format":"esm"},"packages/ui/react-ui-graph/src/util/index.ts":{"bytes":1057,"imports":[{"path":"packages/ui/react-ui-graph/src/util/d3-types.ts","kind":"import-statement","original":"./d3-types"},{"path":"packages/ui/react-ui-graph/src/util/events.ts","kind":"import-statement","original":"./events"},{"path":"packages/ui/react-ui-graph/src/util/fraction.ts","kind":"import-statement","original":"./fraction"},{"path":"packages/ui/react-ui-graph/src/util/points.ts","kind":"import-statement","original":"./points"},{"path":"packages/ui/react-ui-graph/src/util/scale.ts","kind":"import-statement","original":"./scale"},{"path":"packages/ui/react-ui-graph/src/util/screen.ts","kind":"import-statement","original":"./screen"},{"path":"packages/ui/react-ui-graph/src/util/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/ui/react-ui-graph/src/util/vector.ts","kind":"import-statement","original":"./vector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/types.ts":{"bytes":3080,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/projector.ts":{"bytes":4921,"imports":[{"path":"packages/ui/react-ui-graph/src/util/index.ts","kind":"import-statement","original":"../../util"},{"path":"packages/ui/react-ui-graph/src/graph/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-projector.ts":{"bytes":8725,"imports":[{"path":"packages/ui/react-ui-graph/src/graph/projector/projector.ts","kind":"import-statement","original":"./projector"},{"path":"packages/ui/react-ui-graph/src/graph/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-forces.ts":{"bytes":2627,"imports":[{"path":"d3","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-force-projector.ts":{"bytes":33134,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-forces.ts","kind":"import-statement","original":"./graph-forces"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-projector.ts","kind":"import-statement","original":"./graph-projector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-radial-projector.ts":{"bytes":12906,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-projector.ts","kind":"import-statement","original":"./graph-projector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-hierarchical-projector.ts":{"bytes":8410,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-radial-projector.ts","kind":"import-statement","original":"./graph-radial-projector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/graph-relational-projector.ts":{"bytes":11844,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-radial-projector.ts","kind":"import-statement","original":"./graph-radial-projector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/projector/index.ts":{"bytes":1201,"imports":[{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-drag.ts","kind":"import-statement","original":"./graph-drag"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-projector.ts","kind":"import-statement","original":"./graph-projector"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-force-projector.ts","kind":"import-statement","original":"./graph-force-projector"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-hierarchical-projector.ts","kind":"import-statement","original":"./graph-hierarchical-projector"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-relational-projector.ts","kind":"import-statement","original":"./graph-relational-projector"},{"path":"packages/ui/react-ui-graph/src/graph/projector/graph-radial-projector.ts","kind":"import-statement","original":"./graph-radial-projector"},{"path":"packages/ui/react-ui-graph/src/graph/projector/projector.ts","kind":"import-statement","original":"./projector"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/renderer/bullets.ts":{"bytes":7155,"imports":[{"path":"d3","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/renderer/renderer.ts":{"bytes":3491,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/renderer/graph-renderer.ts":{"bytes":47791,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"js-clipper","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/renderer/bullets.ts","kind":"import-statement","original":"./bullets"},{"path":"packages/ui/react-ui-graph/src/graph/renderer/renderer.ts","kind":"import-statement","original":"./renderer"},{"path":"packages/ui/react-ui-graph/src/util/index.ts","kind":"import-statement","original":"../../util"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/renderer/linker.ts":{"bytes":3589,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/util/index.ts","kind":"import-statement","original":"../../util"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/renderer/index.ts":{"bytes":669,"imports":[{"path":"packages/ui/react-ui-graph/src/graph/renderer/graph-renderer.ts","kind":"import-statement","original":"./graph-renderer"},{"path":"packages/ui/react-ui-graph/src/graph/renderer/linker.ts","kind":"import-statement","original":"./linker"},{"path":"packages/ui/react-ui-graph/src/graph/renderer/renderer.ts","kind":"import-statement","original":"./renderer"}],"format":"esm"},"packages/ui/react-ui-graph/src/graph/index.ts":{"bytes":729,"imports":[{"path":"packages/ui/react-ui-graph/src/graph/markers.ts","kind":"import-statement","original":"./markers"},{"path":"packages/ui/react-ui-graph/src/graph/projector/index.ts","kind":"import-statement","original":"./projector"},{"path":"packages/ui/react-ui-graph/src/graph/renderer/index.ts","kind":"import-statement","original":"./renderer"},{"path":"packages/ui/react-ui-graph/src/graph/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/ui/react-ui-graph/src/hooks/useSvgContext.ts":{"bytes":8279,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/util/index.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-graph/src/hooks/useGrid.ts":{"bytes":18853,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/useSvgContext.ts","kind":"import-statement","original":"./useSvgContext"}],"format":"esm"},"packages/ui/react-ui-graph/src/hooks/useStateRef.ts":{"bytes":5730,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/hooks/useZoom.ts":{"bytes":10298,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/useSvgContext.ts","kind":"import-statement","original":"./useSvgContext"}],"format":"esm"},"packages/ui/react-ui-graph/src/hooks/index.ts":{"bytes":758,"imports":[{"path":"packages/ui/react-ui-graph/src/hooks/useGrid.ts","kind":"import-statement","original":"./useGrid"},{"path":"packages/ui/react-ui-graph/src/hooks/useStateRef.ts","kind":"import-statement","original":"./useStateRef"},{"path":"packages/ui/react-ui-graph/src/hooks/useSvgContext.ts","kind":"import-statement","original":"./useSvgContext"},{"path":"packages/ui/react-ui-graph/src/hooks/useZoom.ts","kind":"import-statement","original":"./useZoom"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/Graph/Graph.tsx":{"bytes":12070,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/index.ts","kind":"import-statement","original":"../../graph"},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/Graph/index.ts":{"bytes":476,"imports":[{"path":"packages/ui/react-ui-graph/src/components/Graph/Graph.tsx","kind":"import-statement","original":"./Graph"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/Mesh/Mesh.tsx":{"bytes":14510,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"topojson-client","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/Mesh/index.ts":{"bytes":474,"imports":[{"path":"packages/ui/react-ui-graph/src/components/Mesh/Mesh.tsx","kind":"import-statement","original":"./Mesh"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/Grid.tsx":{"bytes":1965,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/Markers.tsx":{"bytes":2359,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/graph/index.ts","kind":"import-statement","original":"../../graph"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/Root.tsx":{"bytes":6541,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/Zoom.tsx":{"bytes":2533,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/SVG.tsx":{"bytes":2079,"imports":[{"path":"packages/ui/react-ui-graph/src/components/SVG/Grid.tsx","kind":"import-statement","original":"./Grid"},{"path":"packages/ui/react-ui-graph/src/components/SVG/Markers.tsx","kind":"import-statement","original":"./Markers"},{"path":"packages/ui/react-ui-graph/src/components/SVG/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"packages/ui/react-ui-graph/src/components/SVG/Zoom.tsx","kind":"import-statement","original":"./Zoom"},{"path":"packages/ui/react-ui-graph/src/components/Graph/index.ts","kind":"import-statement","original":"../Graph"},{"path":"packages/ui/react-ui-graph/src/components/Mesh/index.ts","kind":"import-statement","original":"../Mesh"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/SVG/index.ts":{"bytes":472,"imports":[{"path":"packages/ui/react-ui-graph/src/components/SVG/SVG.tsx","kind":"import-statement","original":"./SVG"}],"format":"esm"},"packages/ui/react-ui-graph/src/components/index.ts":{"bytes":625,"imports":[{"path":"packages/ui/react-ui-graph/src/components/Graph/index.ts","kind":"import-statement","original":"./Graph"},{"path":"packages/ui/react-ui-graph/src/components/Mesh/index.ts","kind":"import-statement","original":"./Mesh"},{"path":"packages/ui/react-ui-graph/src/components/SVG/index.ts","kind":"import-statement","original":"./SVG"}],"format":"esm"},"packages/ui/react-ui-graph/src/fx/pulsar.ts":{"bytes":5184,"imports":[{"path":"d3","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/fx/index.ts":{"bytes":467,"imports":[{"path":"packages/ui/react-ui-graph/src/fx/pulsar.ts","kind":"import-statement","original":"./pulsar"}],"format":"esm"},"packages/ui/react-ui-graph/src/index.ts":{"bytes":788,"imports":[{"path":"packages/ui/react-ui-graph/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-graph/src/fx/index.ts","kind":"import-statement","original":"./fx"},{"path":"packages/ui/react-ui-graph/src/graph/index.ts","kind":"import-statement","original":"./graph"},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-graph/src/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/ui/react-ui-graph/src/testing/data.ts":{"bytes":9494,"imports":[{"path":"@dxos/random","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-graph/src/testing/hooks.ts":{"bytes":8057,"imports":[{"path":"immutability-helper","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/testing/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/ui/react-ui-graph/src/hooks/index.ts","kind":"import-statement","original":"../hooks"}],"format":"esm"},"packages/ui/react-ui-graph/src/testing/model.ts":{"bytes":3010,"imports":[{"path":"@dxos/graph","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-graph/src/testing/data.ts","kind":"import-statement","original":"./data"}],"format":"esm"},"packages/ui/react-ui-graph/src/testing/index.ts":{"bytes":628,"imports":[{"path":"packages/ui/react-ui-graph/src/testing/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/ui/react-ui-graph/src/testing/hooks.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-graph/src/testing/model.ts","kind":"import-statement","original":"./model"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-graph/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":110015},"packages/ui/react-ui-graph/dist/lib/node/index.cjs":{"imports":[{"path":"packages/ui/react-ui-graph/dist/lib/node/chunk-WFHWEMPB.cjs","kind":"import-statement"},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"js-clipper","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"topojson-client","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true}],"exports":["EventEmitter","FractionUtil","Graph","GraphForceProjector","GraphHierarchicalProjector","GraphInner","GraphProjector","GraphRadialProjector","GraphRelationalProjector","GraphRenderer","GridController","Mesh","Projector","Pulsar","Renderer","SVG","SVGContext","SVGContextProvider","Scale","Screen","Vector","ZoomHandler","createGraphDrag","createMarkers","defaultForceOptions","defaultIdAccessor","emptyGraph","getCircumferencePoints","layoutHorizontal","layoutRadial","layoutVertical","linkerRenderer","normal","offsetPoints","updateNode","useDynamicRef","useGrid","useStateRef","useSvgContext","useTimestamp","useZoom"],"entryPoint":"packages/ui/react-ui-graph/src/index.ts","inputs":{"packages/ui/react-ui-graph/src/components/Graph/Graph.tsx":{"bytesInOutput":2805},"packages/ui/react-ui-graph/src/graph/markers.ts":{"bytesInOutput":1529},"packages/ui/react-ui-graph/src/graph/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/graph/projector/graph-drag.ts":{"bytesInOutput":2284},"packages/ui/react-ui-graph/src/graph/projector/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/graph/types.ts":{"bytesInOutput":370},"packages/ui/react-ui-graph/src/graph/projector/projector.ts":{"bytesInOutput":785},"packages/ui/react-ui-graph/src/graph/projector/graph-projector.ts":{"bytesInOutput":1656},"packages/ui/react-ui-graph/src/graph/projector/graph-force-projector.ts":{"bytesInOutput":6170},"packages/ui/react-ui-graph/src/graph/projector/graph-forces.ts":{"bytesInOutput":419},"packages/ui/react-ui-graph/src/graph/projector/graph-hierarchical-projector.ts":{"bytesInOutput":1847},"packages/ui/react-ui-graph/src/graph/projector/graph-radial-projector.ts":{"bytesInOutput":2639},"packages/ui/react-ui-graph/src/graph/projector/graph-relational-projector.ts":{"bytesInOutput":2624},"packages/ui/react-ui-graph/src/graph/renderer/graph-renderer.ts":{"bytesInOutput":9683},"packages/ui/react-ui-graph/src/graph/renderer/bullets.ts":{"bytesInOutput":1267},"packages/ui/react-ui-graph/src/graph/renderer/renderer.ts":{"bytesInOutput":746},"packages/ui/react-ui-graph/src/graph/renderer/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/graph/renderer/linker.ts":{"bytesInOutput":612},"packages/ui/react-ui-graph/src/components/Graph/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/components/Mesh/Mesh.tsx":{"bytesInOutput":3105},"packages/ui/react-ui-graph/src/components/Mesh/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/components/SVG/Grid.tsx":{"bytesInOutput":435},"packages/ui/react-ui-graph/src/components/SVG/Markers.tsx":{"bytesInOutput":569},"packages/ui/react-ui-graph/src/components/SVG/Root.tsx":{"bytesInOutput":1693},"packages/ui/react-ui-graph/src/components/SVG/Zoom.tsx":{"bytesInOutput":534},"packages/ui/react-ui-graph/src/components/SVG/SVG.tsx":{"bytesInOutput":66},"packages/ui/react-ui-graph/src/components/SVG/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/fx/pulsar.ts":{"bytesInOutput":1117},"packages/ui/react-ui-graph/src/fx/index.ts":{"bytesInOutput":0}},"bytes":45663},"packages/ui/react-ui-graph/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10594},"packages/ui/react-ui-graph/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/ui/react-ui-graph/dist/lib/node/chunk-WFHWEMPB.cjs","kind":"import-statement"},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"immutability-helper","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/graph","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true}],"exports":["TestGraphModel","convertTreeToGraph","createEdge","createGraph","createNode","createNodes","createTree","seed","useGraphGenerator","useObjectMutator"],"entryPoint":"packages/ui/react-ui-graph/src/testing/index.ts","inputs":{"packages/ui/react-ui-graph/src/testing/data.ts":{"bytesInOutput":1836},"packages/ui/react-ui-graph/src/testing/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/testing/hooks.ts":{"bytesInOutput":1632},"packages/ui/react-ui-graph/src/testing/model.ts":{"bytesInOutput":548}},"bytes":4433},"packages/ui/react-ui-graph/dist/lib/node/chunk-WFHWEMPB.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47585},"packages/ui/react-ui-graph/dist/lib/node/chunk-WFHWEMPB.cjs":{"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["EventEmitter","FractionUtil","GridController","SVGContext","SVGContextProvider","Scale","Screen","Vector","ZoomHandler","getCircumferencePoints","normal","offsetPoints","useDynamicRef","useGrid","useStateRef","useSvgContext","useTimestamp","useZoom"],"inputs":{"packages/ui/react-ui-graph/src/util/events.ts":{"bytesInOutput":330},"packages/ui/react-ui-graph/src/util/fraction.ts":{"bytesInOutput":4162},"packages/ui/react-ui-graph/src/util/points.ts":{"bytesInOutput":1312},"packages/ui/react-ui-graph/src/util/scale.ts":{"bytesInOutput":3605},"packages/ui/react-ui-graph/src/util/screen.ts":{"bytesInOutput":2048},"packages/ui/react-ui-graph/src/util/vector.ts":{"bytesInOutput":1565},"packages/ui/react-ui-graph/src/util/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-graph/src/hooks/useSvgContext.ts":{"bytesInOutput":1562},"packages/ui/react-ui-graph/src/hooks/useGrid.ts":{"bytesInOutput":4022},"packages/ui/react-ui-graph/src/hooks/useStateRef.ts":{"bytesInOutput":955},"packages/ui/react-ui-graph/src/hooks/useZoom.ts":{"bytesInOutput":2029},"packages/ui/react-ui-graph/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":22433}}}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var testing_exports = {};
|
|
29
|
-
__export(testing_exports, {
|
|
30
|
-
TestGraphModel: () => TestGraphModel,
|
|
31
|
-
convertTreeToGraph: () => convertTreeToGraph,
|
|
32
|
-
createEdge: () => createEdge,
|
|
33
|
-
createGraph: () => createGraph,
|
|
34
|
-
createNode: () => createNode,
|
|
35
|
-
createNodes: () => createNodes,
|
|
36
|
-
createTree: () => createTree,
|
|
37
|
-
seed: () => seed,
|
|
38
|
-
useGraphGenerator: () => useGraphGenerator,
|
|
39
|
-
useObjectMutator: () => useObjectMutator
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(testing_exports);
|
|
42
|
-
var import_chunk_WFHWEMPB = require("../chunk-WFHWEMPB.cjs");
|
|
43
|
-
var import_random = require("@dxos/random");
|
|
44
|
-
var import_immutability_helper = __toESM(require("immutability-helper"));
|
|
45
|
-
var import_random2 = require("@dxos/random");
|
|
46
|
-
var import_graph = require("@dxos/graph");
|
|
47
|
-
var import_random3 = require("@dxos/random");
|
|
48
|
-
var seed = (seed2) => import_random.faker.seed(seed2);
|
|
49
|
-
var createNode = (type = void 0) => ({
|
|
50
|
-
id: import_random.faker.string.uuid(),
|
|
51
|
-
type,
|
|
52
|
-
label: import_random.faker.lorem.words(3).replace(/ /g, "-")
|
|
53
|
-
});
|
|
54
|
-
var createNodes = (n = 0, types) => Array.from({
|
|
55
|
-
length: n
|
|
56
|
-
}, () => createNode(types ? import_random.faker.helpers.arrayElement(types) : void 0));
|
|
57
|
-
var createEdge = (source, target) => ({
|
|
58
|
-
id: `${source.id}-${target.id}`,
|
|
59
|
-
source: source.id,
|
|
60
|
-
target: target.id
|
|
61
|
-
});
|
|
62
|
-
var createTree = ({ depth = 2, children = 3 } = {}) => {
|
|
63
|
-
const createChildren = (root, d = 0) => {
|
|
64
|
-
if (d < depth) {
|
|
65
|
-
const max = Math.round(Math.log(depth + 1 - d) * children);
|
|
66
|
-
const num = import_random.faker.number.int({
|
|
67
|
-
min: 1,
|
|
68
|
-
max
|
|
69
|
-
});
|
|
70
|
-
root.children = [
|
|
71
|
-
...new Array(num)
|
|
72
|
-
].map(() => {
|
|
73
|
-
return createChildren(createNode(), d + 1);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return root;
|
|
77
|
-
};
|
|
78
|
-
return createChildren(createNode());
|
|
79
|
-
};
|
|
80
|
-
var convertTreeToGraph = (root) => {
|
|
81
|
-
const traverse = (node, graph) => {
|
|
82
|
-
graph.nodes.push(node);
|
|
83
|
-
node.children?.forEach((child) => {
|
|
84
|
-
graph.edges.push(createEdge(node, child));
|
|
85
|
-
traverse(child, graph);
|
|
86
|
-
});
|
|
87
|
-
return graph;
|
|
88
|
-
};
|
|
89
|
-
return traverse(root, {
|
|
90
|
-
nodes: [],
|
|
91
|
-
edges: []
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
var createGraph = (numNodes = 0, numEdges = 0, types) => {
|
|
95
|
-
const nodes = createNodes(numNodes, types);
|
|
96
|
-
const edges = /* @__PURE__ */ new Map();
|
|
97
|
-
if (numEdges && nodes.length >= 2) {
|
|
98
|
-
for (let i = 0; i < numEdges; i++) {
|
|
99
|
-
const source = import_random.faker.helpers.arrayElement(nodes);
|
|
100
|
-
const target = import_random.faker.helpers.arrayElement(nodes);
|
|
101
|
-
if (source.id !== target.id) {
|
|
102
|
-
const edge = createEdge(source, target);
|
|
103
|
-
if (!edges.get(edge.id)) {
|
|
104
|
-
edges.set(edge.id, edge);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
nodes,
|
|
111
|
-
edges: Array.from(edges.values())
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
var useObjectMutator = (initalValue) => {
|
|
115
|
-
const [data, setData, dataRef] = (0, import_chunk_WFHWEMPB.useStateRef)(initalValue);
|
|
116
|
-
return [
|
|
117
|
-
// Get data state (snapshot).
|
|
118
|
-
data,
|
|
119
|
-
// Update data state.
|
|
120
|
-
(data2) => {
|
|
121
|
-
setData(data2);
|
|
122
|
-
},
|
|
123
|
-
// Updater.
|
|
124
|
-
// https://github.com/kolodny/immutability-helper
|
|
125
|
-
// NOTE: Use $apply to update variable (e.g., push to potentially null object).
|
|
126
|
-
(mutation) => {
|
|
127
|
-
setData((current) => (0, import_immutability_helper.default)(current, mutation));
|
|
128
|
-
return dataRef.current;
|
|
129
|
-
}
|
|
130
|
-
];
|
|
131
|
-
};
|
|
132
|
-
var useGraphGenerator = (options = {}) => {
|
|
133
|
-
const [data, setData, updateData] = useObjectMutator(options.data || {
|
|
134
|
-
nodes: [],
|
|
135
|
-
edges: []
|
|
136
|
-
});
|
|
137
|
-
let interval;
|
|
138
|
-
const mutator = () => {
|
|
139
|
-
const parent = data.nodes.length ? import_random2.faker.helpers.arrayElement(data.nodes) : void 0;
|
|
140
|
-
const node = createNode();
|
|
141
|
-
updateData({
|
|
142
|
-
nodes: {
|
|
143
|
-
$push: [
|
|
144
|
-
node
|
|
145
|
-
]
|
|
146
|
-
},
|
|
147
|
-
edges: Object.assign({}, parent && {
|
|
148
|
-
$push: [
|
|
149
|
-
createEdge(parent, node)
|
|
150
|
-
]
|
|
151
|
-
})
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
const reset = (options2 = {
|
|
155
|
-
count: 0
|
|
156
|
-
}) => {
|
|
157
|
-
const { count = 0 } = options2;
|
|
158
|
-
setData({
|
|
159
|
-
nodes: [],
|
|
160
|
-
edges: []
|
|
161
|
-
});
|
|
162
|
-
for (let i = 0; i < count; i++) {
|
|
163
|
-
mutator();
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const start = ({ delay = 250 } = {}) => {
|
|
167
|
-
stop();
|
|
168
|
-
interval = setInterval(mutator, delay);
|
|
169
|
-
return stop;
|
|
170
|
-
};
|
|
171
|
-
const stop = () => {
|
|
172
|
-
if (interval) {
|
|
173
|
-
clearInterval(interval);
|
|
174
|
-
interval = void 0;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
return {
|
|
178
|
-
data,
|
|
179
|
-
mutator,
|
|
180
|
-
reset,
|
|
181
|
-
start,
|
|
182
|
-
stop
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
var TestGraphModel = class extends import_graph.ReactiveGraphModel {
|
|
186
|
-
getRandomNode() {
|
|
187
|
-
return import_random3.faker.helpers.arrayElement(this._graph.nodes);
|
|
188
|
-
}
|
|
189
|
-
createNodes(node = void 0, n = 1) {
|
|
190
|
-
Array.from({
|
|
191
|
-
length: n
|
|
192
|
-
}).forEach(() => {
|
|
193
|
-
const child = this.addNode(createNode());
|
|
194
|
-
const parent = node || import_random3.faker.helpers.arrayElement(this._graph.nodes);
|
|
195
|
-
if (parent) {
|
|
196
|
-
this.addEdge(createEdge(parent, child));
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
-
0 && (module.exports = {
|
|
203
|
-
TestGraphModel,
|
|
204
|
-
convertTreeToGraph,
|
|
205
|
-
createEdge,
|
|
206
|
-
createGraph,
|
|
207
|
-
createNode,
|
|
208
|
-
createNodes,
|
|
209
|
-
createTree,
|
|
210
|
-
seed,
|
|
211
|
-
useGraphGenerator,
|
|
212
|
-
useObjectMutator
|
|
213
|
-
});
|
|
214
|
-
//# sourceMappingURL=index.cjs.map
|