@sqlrooms/cosmos 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE.md +9 -0
  2. package/dist/CosmosGraph.d.ts +64 -0
  3. package/dist/CosmosGraph.d.ts.map +1 -0
  4. package/dist/CosmosGraph.js +54 -0
  5. package/dist/CosmosGraph.js.map +1 -0
  6. package/dist/CosmosGraphContext.d.ts +76 -0
  7. package/dist/CosmosGraphContext.d.ts.map +1 -0
  8. package/dist/CosmosGraphContext.js +95 -0
  9. package/dist/CosmosGraphContext.js.map +1 -0
  10. package/dist/CosmosGraphControls.d.ts +48 -0
  11. package/dist/CosmosGraphControls.d.ts.map +1 -0
  12. package/dist/CosmosGraphControls.js +41 -0
  13. package/dist/CosmosGraphControls.js.map +1 -0
  14. package/dist/CosmosSimulationControls.d.ts +79 -0
  15. package/dist/CosmosSimulationControls.d.ts.map +1 -0
  16. package/dist/CosmosSimulationControls.js +140 -0
  17. package/dist/CosmosSimulationControls.js.map +1 -0
  18. package/dist/components/CosmosGraph.d.ts +14 -0
  19. package/dist/components/CosmosGraph.d.ts.map +1 -0
  20. package/dist/components/CosmosGraph.js +130 -0
  21. package/dist/components/CosmosGraph.js.map +1 -0
  22. package/dist/config.d.ts +24 -0
  23. package/dist/config.d.ts.map +1 -0
  24. package/dist/config.js +18 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/hooks/index.d.ts +29 -0
  27. package/dist/hooks/index.d.ts.map +1 -0
  28. package/dist/hooks/index.js +29 -0
  29. package/dist/hooks/index.js.map +1 -0
  30. package/dist/hooks/useGraph.d.ts +49 -0
  31. package/dist/hooks/useGraph.d.ts.map +1 -0
  32. package/dist/hooks/useGraph.js +93 -0
  33. package/dist/hooks/useGraph.js.map +1 -0
  34. package/dist/hooks/useGraphConfig.d.ts +101 -0
  35. package/dist/hooks/useGraphConfig.d.ts.map +1 -0
  36. package/dist/hooks/useGraphConfig.js +53 -0
  37. package/dist/hooks/useGraphConfig.js.map +1 -0
  38. package/dist/hooks/useHoverState.d.ts +55 -0
  39. package/dist/hooks/useHoverState.d.ts.map +1 -0
  40. package/dist/hooks/useHoverState.js +57 -0
  41. package/dist/hooks/useHoverState.js.map +1 -0
  42. package/dist/hooks/useRelativeCoordinates.d.ts +2 -0
  43. package/dist/hooks/useRelativeCoordinates.d.ts.map +1 -0
  44. package/dist/hooks/useRelativeCoordinates.js +10 -0
  45. package/dist/hooks/useRelativeCoordinates.js.map +1 -0
  46. package/dist/index.d.ts +92 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +92 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/utils/coordinates.d.ts +32 -0
  51. package/dist/utils/coordinates.d.ts.map +1 -0
  52. package/dist/utils/coordinates.js +29 -0
  53. package/dist/utils/coordinates.js.map +1 -0
  54. package/package.json +38 -0
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright 2025 Ilya Boyandin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ import { GraphConfigInterface } from '@cosmograph/cosmos';
2
+ import { FC } from 'react';
3
+ /**
4
+ * Props for the CosmosGraph component.
5
+ */
6
+ export type CosmosGraphProps = {
7
+ /** Configuration object for the graph's visual and behavioral properties */
8
+ config: GraphConfigInterface;
9
+ /** Float32Array containing x,y coordinates for each point (2 values per point) */
10
+ pointPositions: Float32Array;
11
+ /** Float32Array containing size values for each point (1 value per point) */
12
+ pointSizes: Float32Array;
13
+ /** Float32Array containing RGBA values for each point (4 values per point) */
14
+ pointColors: Float32Array;
15
+ /** Optional Float32Array containing pairs of point indices defining links */
16
+ linkIndexes?: Float32Array;
17
+ /** Optional Float32Array containing RGBA values for each link (4 values per link) */
18
+ linkColors?: Float32Array;
19
+ /** Optional index of the point to focus on */
20
+ focusedPointIndex?: number | undefined;
21
+ /** Optional function to render custom tooltip content for a point */
22
+ getPointTooltip?: (index: number) => React.ReactNode;
23
+ /** Optional child elements to render inside the graph container */
24
+ children?: React.ReactNode;
25
+ };
26
+ /**
27
+ * A React component that renders an interactive graph visualization using Cosmos.
28
+ *
29
+ * Features:
30
+ * - Renders points and optional links in a WebGL canvas
31
+ * - Supports point hovering with customizable tooltips
32
+ * - Handles point focusing
33
+ * - Provides graph context to child components
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const MyGraph = () => {
38
+ * const config = {
39
+ * backgroundColor: '#ffffff',
40
+ * nodeSize: 5,
41
+ * simulation: {
42
+ * repulsion: 0.5,
43
+ * gravity: 0.1,
44
+ * },
45
+ * };
46
+ *
47
+ * return (
48
+ * <div style={{ width: '800px', height: '600px' }}>
49
+ * <CosmosGraph
50
+ * config={config}
51
+ * pointPositions={new Float32Array([0, 0, 1, 1])}
52
+ * pointColors={new Float32Array([1, 0, 0, 1, 0, 1, 0, 1])}
53
+ * pointSizes={new Float32Array([5, 5])}
54
+ * getPointTooltip={(index) => `Point ${index}`}
55
+ * >
56
+ * <GraphControls />
57
+ * </CosmosGraph>
58
+ * </div>
59
+ * );
60
+ * };
61
+ * ```
62
+ */
63
+ export declare const CosmosGraph: FC<CosmosGraphProps>;
64
+ //# sourceMappingURL=CosmosGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraph.d.ts","sourceRoot":"","sources":["../src/CosmosGraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAC,EAAE,EAAS,MAAM,OAAO,CAAC;AAIjC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4EAA4E;IAC5E,MAAM,EAAE,oBAAoB,CAAC;IAC7B,kFAAkF;IAClF,cAAc,EAAE,YAAY,CAAC;IAC7B,6EAA6E;IAC7E,UAAU,EAAE,YAAY,CAAC;IACzB,8EAA8E;IAC9E,WAAW,EAAE,YAAY,CAAC;IAC1B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,qFAAqF;IACrF,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,qEAAqE;IACrE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD,mEAAmE;IACnE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA6D5C,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, useRelativeCoordinates } from '@sqlrooms/ui';
3
+ import { useRef } from 'react';
4
+ import { CosmosGraphProvider } from './CosmosGraphContext';
5
+ import { useGraph, useHoverState, useGraphConfig } from './hooks';
6
+ /**
7
+ * A React component that renders an interactive graph visualization using Cosmos.
8
+ *
9
+ * Features:
10
+ * - Renders points and optional links in a WebGL canvas
11
+ * - Supports point hovering with customizable tooltips
12
+ * - Handles point focusing
13
+ * - Provides graph context to child components
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const MyGraph = () => {
18
+ * const config = {
19
+ * backgroundColor: '#ffffff',
20
+ * nodeSize: 5,
21
+ * simulation: {
22
+ * repulsion: 0.5,
23
+ * gravity: 0.1,
24
+ * },
25
+ * };
26
+ *
27
+ * return (
28
+ * <div style={{ width: '800px', height: '600px' }}>
29
+ * <CosmosGraph
30
+ * config={config}
31
+ * pointPositions={new Float32Array([0, 0, 1, 1])}
32
+ * pointColors={new Float32Array([1, 0, 0, 1, 0, 1, 0, 1])}
33
+ * pointSizes={new Float32Array([5, 5])}
34
+ * getPointTooltip={(index) => `Point ${index}`}
35
+ * >
36
+ * <GraphControls />
37
+ * </CosmosGraph>
38
+ * </div>
39
+ * );
40
+ * };
41
+ * ```
42
+ */
43
+ export const CosmosGraph = ({ config, pointPositions, pointSizes, pointColors, linkIndexes, linkColors, focusedPointIndex, getPointTooltip, children, }) => {
44
+ const containerRef = useRef(null);
45
+ const calcRelativeCoordinates = useRelativeCoordinates(containerRef);
46
+ const { hoveredPoint, onPointMouseOver, clearHoverState } = useHoverState(calcRelativeCoordinates);
47
+ const configWithCallbacks = useGraphConfig(config, onPointMouseOver, clearHoverState);
48
+ const graphRef = useGraph(containerRef, configWithCallbacks, pointPositions, pointColors, pointSizes, linkIndexes, linkColors, focusedPointIndex);
49
+ return (_jsx(CosmosGraphProvider, { graphRef: graphRef, children: _jsxs("div", { className: "relative w-full h-full", children: [_jsx("div", { ref: containerRef, className: "absolute w-full h-full" }), getPointTooltip ? (_jsx("div", { className: cn('absolute z-50 max-w-xs', 'bg-white/90 dark:bg-gray-800/90 rounded-md shadow-lg p-2', 'text-xs flex gap-2 items-center pointer-events-none transition-opacity duration-150', hoveredPoint ? 'opacity-100' : 'opacity-0'), style: {
50
+ transform: `translate(${hoveredPoint?.position?.[0] ?? 0}px, ${hoveredPoint?.position?.[1] ?? 0}px) translate(-50%, 5px)`,
51
+ visibility: hoveredPoint ? 'visible' : 'hidden',
52
+ }, children: _jsx("div", { children: getPointTooltip?.(hoveredPoint?.index ?? 0) }) })) : null, children] }) }));
53
+ };
54
+ //# sourceMappingURL=CosmosGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraph.js","sourceRoot":"","sources":["../src/CosmosGraph.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAK,MAAM,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AA0BhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAChD,MAAM,EACN,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,MAAM,uBAAuB,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAErE,MAAM,EAAC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAC,GAAG,aAAa,CACrE,uBAAuB,CACxB,CAAC;IAEF,MAAM,mBAAmB,GAAG,cAAc,CACxC,MAAM,EACN,gBAAgB,EAChB,eAAe,CAChB,CAAC;IAEF,MAAM,QAAQ,GAAG,QAAQ,CACvB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,CAClB,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,IAAC,QAAQ,EAAE,QAAQ,YACrC,eAAK,SAAS,EAAC,wBAAwB,aACrC,cAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAC,wBAAwB,GAAG,EAC5D,eAAe,CAAC,CAAC,CAAC,CACjB,cACE,SAAS,EAAE,EAAE,CACX,wBAAwB,EACxB,0DAA0D,EAC1D,qFAAqF,EACrF,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAC3C,EACD,KAAK,EAAE;wBACL,SAAS,EAAE,aAAa,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OACtD,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CACjC,0BAA0B;wBAC1B,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;qBAChD,YAED,wBAAM,eAAe,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,GAAO,GACpD,CACP,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,IACL,GACc,CACvB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { Graph } from '@cosmograph/cosmos';
2
+ /**
3
+ * The shape of the context value provided by CosmosGraphContext.
4
+ */
5
+ interface CosmosGraphContextValue {
6
+ /** Whether the graph simulation is currently running */
7
+ isSimulationRunning: boolean;
8
+ /** Reference to the Cosmos Graph instance */
9
+ graphRef: React.MutableRefObject<Graph | null> | null;
10
+ /** Function to toggle the simulation state between running and paused */
11
+ handleToggleSimulation: () => void;
12
+ /** Function to fit the graph view to show all nodes */
13
+ handleFitView: () => void;
14
+ /** Function to start simulation with an energy push */
15
+ handleStartWithEnergy: () => void;
16
+ }
17
+ /**
18
+ * Hook to access the CosmosGraph context.
19
+ *
20
+ * Provides access to:
21
+ * - Graph simulation state
22
+ * - Graph instance reference
23
+ * - Control functions for simulation and view
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * const CustomControl = () => {
28
+ * const { isSimulationRunning, handleToggleSimulation } = useCosmosGraph();
29
+ *
30
+ * return (
31
+ * <button onClick={handleToggleSimulation}>
32
+ * {isSimulationRunning ? 'Pause' : 'Start'}
33
+ * </button>
34
+ * );
35
+ * };
36
+ * ```
37
+ *
38
+ * @throws {Error} If used outside of a CosmosGraphProvider
39
+ * @returns The graph context value
40
+ */
41
+ export declare const useCosmosGraph: () => CosmosGraphContextValue;
42
+ /**
43
+ * Props for the CosmosGraphProvider component.
44
+ */
45
+ interface CosmosGraphProviderProps {
46
+ /** Child components that will have access to the graph context */
47
+ children: React.ReactNode;
48
+ /** Reference to the Cosmos Graph instance */
49
+ graphRef: React.MutableRefObject<Graph | null>;
50
+ }
51
+ /**
52
+ * Provider component that makes graph state and controls available to its children.
53
+ *
54
+ * Manages:
55
+ * - Simulation running state
56
+ * - Graph instance reference
57
+ * - Control functions for simulation and view
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * const MyGraph = () => {
62
+ * const graphRef = useRef<Graph | null>(null);
63
+ *
64
+ * return (
65
+ * <CosmosGraphProvider graphRef={graphRef}>
66
+ * <CosmosGraph {...graphProps} />
67
+ * <CosmosGraphControls />
68
+ * <CustomControls />
69
+ * </CosmosGraphProvider>
70
+ * );
71
+ * };
72
+ * ```
73
+ */
74
+ export declare const CosmosGraphProvider: React.FC<CosmosGraphProviderProps>;
75
+ export {};
76
+ //# sourceMappingURL=CosmosGraphContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraphContext.d.ts","sourceRoot":"","sources":["../src/CosmosGraphContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAGzC;;GAEG;AACH,UAAU,uBAAuB;IAC/B,wDAAwD;IACxD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACtD,yEAAyE;IACzE,sBAAsB,EAAE,MAAM,IAAI,CAAC;IACnC,uDAAuD;IACvD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,uDAAuD;IACvD,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC;AAQD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,+BAM1B,CAAC;AAEF;;GAEG;AACH,UAAU,wBAAwB;IAChC,kEAAkE;IAClE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAyClE,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useState } from 'react';
3
+ /**
4
+ * Context for sharing graph state and controls across components.
5
+ * @internal
6
+ */
7
+ const CosmosGraphContext = createContext(null);
8
+ /**
9
+ * Hook to access the CosmosGraph context.
10
+ *
11
+ * Provides access to:
12
+ * - Graph simulation state
13
+ * - Graph instance reference
14
+ * - Control functions for simulation and view
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const CustomControl = () => {
19
+ * const { isSimulationRunning, handleToggleSimulation } = useCosmosGraph();
20
+ *
21
+ * return (
22
+ * <button onClick={handleToggleSimulation}>
23
+ * {isSimulationRunning ? 'Pause' : 'Start'}
24
+ * </button>
25
+ * );
26
+ * };
27
+ * ```
28
+ *
29
+ * @throws {Error} If used outside of a CosmosGraphProvider
30
+ * @returns The graph context value
31
+ */
32
+ export const useCosmosGraph = () => {
33
+ const context = useContext(CosmosGraphContext);
34
+ if (!context) {
35
+ throw new Error('useCosmosGraph must be used within a CosmosGraphProvider');
36
+ }
37
+ return context;
38
+ };
39
+ /**
40
+ * Provider component that makes graph state and controls available to its children.
41
+ *
42
+ * Manages:
43
+ * - Simulation running state
44
+ * - Graph instance reference
45
+ * - Control functions for simulation and view
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * const MyGraph = () => {
50
+ * const graphRef = useRef<Graph | null>(null);
51
+ *
52
+ * return (
53
+ * <CosmosGraphProvider graphRef={graphRef}>
54
+ * <CosmosGraph {...graphProps} />
55
+ * <CosmosGraphControls />
56
+ * <CustomControls />
57
+ * </CosmosGraphProvider>
58
+ * );
59
+ * };
60
+ * ```
61
+ */
62
+ export const CosmosGraphProvider = ({ children, graphRef, }) => {
63
+ const [isSimulationRunning, setIsSimulationRunning] = useState(true);
64
+ const handleStartWithEnergy = useCallback(() => {
65
+ if (!graphRef.current)
66
+ return;
67
+ graphRef.current.start(1);
68
+ setIsSimulationRunning(true);
69
+ }, [graphRef]);
70
+ const handleToggleSimulation = useCallback(() => {
71
+ if (!graphRef.current)
72
+ return;
73
+ if (graphRef.current.isSimulationRunning) {
74
+ graphRef.current.pause();
75
+ setIsSimulationRunning(false);
76
+ }
77
+ else {
78
+ graphRef.current.restart();
79
+ setIsSimulationRunning(true);
80
+ }
81
+ }, [graphRef]);
82
+ const handleFitView = useCallback(() => {
83
+ if (!graphRef.current)
84
+ return;
85
+ graphRef.current.fitView();
86
+ }, [graphRef]);
87
+ return (_jsx(CosmosGraphContext.Provider, { value: {
88
+ isSimulationRunning,
89
+ graphRef,
90
+ handleToggleSimulation,
91
+ handleFitView,
92
+ handleStartWithEnergy,
93
+ }, children: children }));
94
+ };
95
+ //# sourceMappingURL=CosmosGraphContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraphContext.js","sourceRoot":"","sources":["../src/CosmosGraphContext.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAkBvE;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;IAEf,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE;QACrC,IAAI,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAO;QAC9B,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAC1B,KAAK,EAAE;YACL,mBAAmB;YACnB,QAAQ;YACR,sBAAsB;YACtB,aAAa;YACb,qBAAqB;SACtB,YAEA,QAAQ,GACmB,CAC/B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ interface CosmosGraphControlsProps {
3
+ /**
4
+ * Optional className to override the default positioning and styling of the controls container.
5
+ * By default, controls are positioned at the top-left corner.
6
+ * @example
7
+ * ```tsx
8
+ * // Position controls at the bottom-right
9
+ * <CosmosGraphControls className="absolute bottom-4 right-4" />
10
+ * ```
11
+ */
12
+ className?: string;
13
+ }
14
+ /**
15
+ * A flexible control panel component for CosmosGraph that provides view controls.
16
+ * Must be used within a CosmosGraph component as it relies on the CosmosGraphContext.
17
+ *
18
+ * The component shows the default fit view control and allows adding custom controls as children.
19
+ * For simulation controls, use the CosmosSimulationControls component.
20
+ *
21
+ * @example Default usage
22
+ * ```tsx
23
+ * <CosmosGraph {...graphProps}>
24
+ * <CosmosGraphControls />
25
+ * </CosmosGraph>
26
+ * ```
27
+ *
28
+ * @example Custom positioning
29
+ * ```tsx
30
+ * <CosmosGraph {...graphProps}>
31
+ * <CosmosGraphControls className="absolute bottom-4 right-4" />
32
+ * </CosmosGraph>
33
+ * ```
34
+ *
35
+ * @example Adding custom controls
36
+ * ```tsx
37
+ * <CosmosGraph {...graphProps}>
38
+ * <CosmosGraphControls>
39
+ * <Button onClick={handleExport}>
40
+ * <Download className="h-4 w-4" />
41
+ * </Button>
42
+ * </CosmosGraphControls>
43
+ * </CosmosGraph>
44
+ * ```
45
+ */
46
+ export declare const CosmosGraphControls: FC<PropsWithChildren<CosmosGraphControlsProps>>;
47
+ export {};
48
+ //# sourceMappingURL=CosmosGraphControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraphControls.d.ts","sourceRoot":"","sources":["../src/CosmosGraphControls.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAG5C,UAAU,wBAAwB;IAChC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAClC,iBAAiB,CAAC,wBAAwB,CAAC,CAY5C,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, cn } from '@sqlrooms/ui';
3
+ import { Maximize2 } from 'lucide-react';
4
+ import { useCosmosGraph } from './CosmosGraphContext';
5
+ /**
6
+ * A flexible control panel component for CosmosGraph that provides view controls.
7
+ * Must be used within a CosmosGraph component as it relies on the CosmosGraphContext.
8
+ *
9
+ * The component shows the default fit view control and allows adding custom controls as children.
10
+ * For simulation controls, use the CosmosSimulationControls component.
11
+ *
12
+ * @example Default usage
13
+ * ```tsx
14
+ * <CosmosGraph {...graphProps}>
15
+ * <CosmosGraphControls />
16
+ * </CosmosGraph>
17
+ * ```
18
+ *
19
+ * @example Custom positioning
20
+ * ```tsx
21
+ * <CosmosGraph {...graphProps}>
22
+ * <CosmosGraphControls className="absolute bottom-4 right-4" />
23
+ * </CosmosGraph>
24
+ * ```
25
+ *
26
+ * @example Adding custom controls
27
+ * ```tsx
28
+ * <CosmosGraph {...graphProps}>
29
+ * <CosmosGraphControls>
30
+ * <Button onClick={handleExport}>
31
+ * <Download className="h-4 w-4" />
32
+ * </Button>
33
+ * </CosmosGraphControls>
34
+ * </CosmosGraph>
35
+ * ```
36
+ */
37
+ export const CosmosGraphControls = ({ className, children }) => {
38
+ const { handleFitView } = useCosmosGraph();
39
+ return (_jsxs("div", { className: cn('absolute top-1 left-1 flex gap-2', className), children: [_jsx(Button, { onClick: handleFitView, variant: "outline", size: "sm", children: _jsx(Maximize2, { className: "h-4 w-4" }) }), children] }));
40
+ };
41
+ //# sourceMappingURL=CosmosGraphControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosGraphControls.js","sourceRoot":"","sources":["../src/CosmosGraphControls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,EAAE,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAepD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAE5B,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAE,EAAE;IAC5B,MAAM,EAAC,aAAa,EAAC,GAAG,cAAc,EAAE,CAAC;IAEzC,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,kCAAkC,EAAE,SAAS,CAAC,aAC/D,KAAC,MAAM,IAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,YACzD,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,GAC1B,EACR,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { FC } from 'react';
2
+ /**
3
+ * Props for the CosmosSimulationControls component.
4
+ */
5
+ interface CosmosSimulationControlsProps {
6
+ /**
7
+ * Optional className to override the default positioning and styling of the controls container.
8
+ * By default, controls are positioned at the top-right corner.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // Position controls at the bottom-right
13
+ * <CosmosSimulationControls className="absolute bottom-4 right-4" />
14
+ * ```
15
+ */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * A component that provides fine-grained controls for adjusting graph simulation parameters.
20
+ * Must be used within a CosmosGraph component as it relies on the CosmosGraphContext.
21
+ *
22
+ * Features:
23
+ * - Slider controls for all simulation parameters
24
+ * - Real-time parameter adjustment
25
+ * - Tooltips with parameter descriptions
26
+ * - Customizable positioning
27
+ * - Default values optimized for common use cases
28
+ *
29
+ * Available parameters:
30
+ * - Gravity (0-0.5): Controls how strongly nodes are pulled toward the center
31
+ * - Repulsion (0-2): Controls how strongly nodes push away from each other
32
+ * - Link Strength (0-2): Controls the spring force between connected nodes
33
+ * - Link Distance (1-20): Sets the natural length of links between nodes
34
+ * - Friction (0-1): Controls how quickly node movement decays
35
+ * - Decay (100-10000): Controls how quickly the simulation "cools down"
36
+ *
37
+ * @example Basic usage
38
+ * ```tsx
39
+ * import { CosmosGraph, CosmosSimulationControls } from '@sqlrooms/cosmos';
40
+ *
41
+ * const MyGraph = () => {
42
+ * return (
43
+ * <div style={{ width: '800px', height: '600px' }}>
44
+ * <CosmosGraph {...graphProps}>
45
+ * <CosmosSimulationControls />
46
+ * </CosmosGraph>
47
+ * </div>
48
+ * );
49
+ * };
50
+ * ```
51
+ *
52
+ * @example Custom positioning with other controls
53
+ * ```tsx
54
+ * import { CosmosGraph, CosmosGraphControls, CosmosSimulationControls } from '@sqlrooms/cosmos';
55
+ *
56
+ * const MyGraph = () => {
57
+ * return (
58
+ * <div style={{ width: '800px', height: '600px' }}>
59
+ * <CosmosGraph {...graphProps}>
60
+ * <CosmosGraphControls className="absolute top-4 left-4" />
61
+ * <CosmosSimulationControls className="absolute top-4 right-4" />
62
+ * </CosmosGraph>
63
+ * </div>
64
+ * );
65
+ * };
66
+ * ```
67
+ *
68
+ * @example With custom styling
69
+ * ```tsx
70
+ * <CosmosGraph {...graphProps}>
71
+ * <CosmosSimulationControls
72
+ * className="absolute bottom-4 right-4 bg-opacity-75 backdrop-blur-sm"
73
+ * />
74
+ * </CosmosGraph>
75
+ * ```
76
+ */
77
+ export declare const CosmosSimulationControls: FC<CosmosSimulationControlsProps>;
78
+ export {};
79
+ //# sourceMappingURL=CosmosSimulationControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosSimulationControls.d.ts","sourceRoot":"","sources":["../src/CosmosSimulationControls.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,EAAE,EAAW,MAAM,OAAO,CAAC;AAMnC;;GAEG;AACH,UAAU,6BAA6B;IACrC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CA4GtE,CAAC"}
@@ -0,0 +1,140 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, Slider, Label, Tooltip, TooltipContent, TooltipTrigger, Button, } from '@sqlrooms/ui';
3
+ import { useState } from 'react';
4
+ import { useCosmosGraph } from './CosmosGraphContext';
5
+ import { Info, Pause, Play, Wind } from 'lucide-react';
6
+ import { CosmosSimulationConfigSchema } from './config';
7
+ /**
8
+ * Configuration for each simulation parameter slider.
9
+ * These values define the range and step size for each parameter.
10
+ *
11
+ * @internal
12
+ */
13
+ const simulationSliders = [
14
+ {
15
+ key: 'simulationGravity',
16
+ label: 'Gravity',
17
+ min: 0,
18
+ max: 0.5,
19
+ step: 0.01,
20
+ default: 0.25,
21
+ },
22
+ {
23
+ key: 'simulationRepulsion',
24
+ label: 'Repulsion',
25
+ min: 0,
26
+ max: 2,
27
+ step: 0.01,
28
+ default: 1.0,
29
+ },
30
+ {
31
+ key: 'simulationLinkSpring',
32
+ label: 'Link Strength',
33
+ min: 0,
34
+ max: 2,
35
+ step: 0.01,
36
+ default: 1,
37
+ },
38
+ {
39
+ key: 'simulationLinkDistance',
40
+ label: 'Link Distance',
41
+ min: 1,
42
+ max: 20,
43
+ step: 1,
44
+ default: 10,
45
+ },
46
+ {
47
+ key: 'simulationFriction',
48
+ label: 'Friction',
49
+ min: 0,
50
+ max: 1,
51
+ step: 0.01,
52
+ default: 0.85,
53
+ },
54
+ {
55
+ key: 'simulationDecay',
56
+ label: 'Decay',
57
+ min: 100,
58
+ max: 10000,
59
+ step: 100,
60
+ default: 1000,
61
+ },
62
+ ];
63
+ /**
64
+ * A component that provides fine-grained controls for adjusting graph simulation parameters.
65
+ * Must be used within a CosmosGraph component as it relies on the CosmosGraphContext.
66
+ *
67
+ * Features:
68
+ * - Slider controls for all simulation parameters
69
+ * - Real-time parameter adjustment
70
+ * - Tooltips with parameter descriptions
71
+ * - Customizable positioning
72
+ * - Default values optimized for common use cases
73
+ *
74
+ * Available parameters:
75
+ * - Gravity (0-0.5): Controls how strongly nodes are pulled toward the center
76
+ * - Repulsion (0-2): Controls how strongly nodes push away from each other
77
+ * - Link Strength (0-2): Controls the spring force between connected nodes
78
+ * - Link Distance (1-20): Sets the natural length of links between nodes
79
+ * - Friction (0-1): Controls how quickly node movement decays
80
+ * - Decay (100-10000): Controls how quickly the simulation "cools down"
81
+ *
82
+ * @example Basic usage
83
+ * ```tsx
84
+ * import { CosmosGraph, CosmosSimulationControls } from '@sqlrooms/cosmos';
85
+ *
86
+ * const MyGraph = () => {
87
+ * return (
88
+ * <div style={{ width: '800px', height: '600px' }}>
89
+ * <CosmosGraph {...graphProps}>
90
+ * <CosmosSimulationControls />
91
+ * </CosmosGraph>
92
+ * </div>
93
+ * );
94
+ * };
95
+ * ```
96
+ *
97
+ * @example Custom positioning with other controls
98
+ * ```tsx
99
+ * import { CosmosGraph, CosmosGraphControls, CosmosSimulationControls } from '@sqlrooms/cosmos';
100
+ *
101
+ * const MyGraph = () => {
102
+ * return (
103
+ * <div style={{ width: '800px', height: '600px' }}>
104
+ * <CosmosGraph {...graphProps}>
105
+ * <CosmosGraphControls className="absolute top-4 left-4" />
106
+ * <CosmosSimulationControls className="absolute top-4 right-4" />
107
+ * </CosmosGraph>
108
+ * </div>
109
+ * );
110
+ * };
111
+ * ```
112
+ *
113
+ * @example With custom styling
114
+ * ```tsx
115
+ * <CosmosGraph {...graphProps}>
116
+ * <CosmosSimulationControls
117
+ * className="absolute bottom-4 right-4 bg-opacity-75 backdrop-blur-sm"
118
+ * />
119
+ * </CosmosGraph>
120
+ * ```
121
+ */
122
+ export const CosmosSimulationControls = ({ className, }) => {
123
+ const { graphRef, isSimulationRunning, handleToggleSimulation, handleStartWithEnergy, } = useCosmosGraph();
124
+ const [values, setValues] = useState(() => Object.fromEntries(simulationSliders.map(({ key, default: defaultValue }) => [
125
+ key,
126
+ defaultValue,
127
+ ])));
128
+ const handleParameterChange = (paramKey, value) => {
129
+ if (!graphRef?.current)
130
+ return;
131
+ const newValues = { ...values, [paramKey]: value[0] };
132
+ setValues(newValues);
133
+ const config = {
134
+ [paramKey]: value[0],
135
+ };
136
+ graphRef.current.setConfig(config);
137
+ };
138
+ return (_jsxs("div", { className: cn('absolute top-1 right-1 w-48 bg-card/90 dark:bg-card/90 rounded-lg shadow-lg p-3 space-y-4', className), children: [_jsxs("div", { className: "flex gap-2", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: handleToggleSimulation, variant: "outline", size: "sm", className: "flex-1", children: isSimulationRunning ? (_jsx(Pause, { className: "h-4 w-4" })) : (_jsx(Play, { className: "h-4 w-4" })) }) }), _jsx(TooltipContent, { side: "bottom", children: isSimulationRunning ? 'Pause simulation' : 'Start simulation' })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: handleStartWithEnergy, variant: "outline", size: "sm", className: "flex-1", children: _jsx(Wind, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { side: "bottom", children: "Push energy into simulation" })] })] }), simulationSliders.map(({ key, label, min, max, step }) => (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Label, { htmlFor: key, className: "text-xs font-medium flex items-center gap-1 cursor-help", children: [label, _jsx(Info, { className: "w-3 h-3 text-muted-foreground" })] }) }), _jsx(TooltipContent, { side: "left", className: "max-w-[200px]", children: CosmosSimulationConfigSchema.shape[key].description })] }), _jsx("span", { className: "text-xs tabular-nums text-muted-foreground", children: values[key].toFixed(2) })] }), _jsx(Slider, { id: key, min: min, max: max, step: step, value: [values[key]], onValueChange: (value) => handleParameterChange(key, value), className: "w-full" })] }, key)))] }));
139
+ };
140
+ //# sourceMappingURL=CosmosSimulationControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosSimulationControls.js","sourceRoot":"","sources":["../src/CosmosSimulationControls.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,EAAE,EACF,MAAM,EACN,KAAK,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAErD,OAAO,EAAC,4BAA4B,EAAC,MAAM,UAAU,CAAC;AAmBtD;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG;IACxB;QACE,GAAG,EAAE,mBAAmB;QACxB,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD;QACE,GAAG,EAAE,qBAAqB;QAC1B,KAAK,EAAE,WAAW;QAClB,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,IAAI;QACV,OAAO,EAA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AAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC,CACvD,eAAe,SAAS,EAAC,WAAW,aAClC,eAAK,SAAS,EAAC,mCAAmC,aAChD,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,MAAC,KAAK,IACJ,OAAO,EAAE,GAAG,EACZ,SAAS,EAAC,yDAAyD,aAElE,KAAK,EACN,KAAC,IAAI,IAAC,SAAS,EAAC,+BAA+B,GAAG,IAC5C,GACO,EACjB,KAAC,cAAc,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,eAAe,YAClD,4BAA4B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,GACrC,IACT,EACV,eAAM,SAAS,EAAC,4CAA4C,YACzD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAClB,IACH,EACN,KAAC,MAAM,IACL,EAAE,EAAE,GAAG,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EACpB,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,EAC3D,SAAS,EAAC,QAAQ,GAClB,KA5BM,GAAG,CA6BP,CACP,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { GraphConfigInterface } from '@cosmograph/cosmos';
2
+ import { FC } from 'react';
3
+ export type CosmosGraphProps = {
4
+ config: GraphConfigInterface;
5
+ pointPositions: Float32Array;
6
+ pointSizes: Float32Array;
7
+ pointColors: Float32Array;
8
+ linkIndexes?: Float32Array;
9
+ linkColors?: Float32Array;
10
+ focusedPointIndex?: number | undefined;
11
+ getPointTooltip?: (index: number) => React.ReactNode;
12
+ };
13
+ export declare const CosmosGraph: FC<CosmosGraphProps>;
14
+ //# sourceMappingURL=CosmosGraph.d.ts.map