@dxos/react-ui-graph 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a
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-PDEA4KBO.mjs → chunk-EX2Q43O6.mjs} +2 -2
- package/dist/lib/browser/{chunk-PDEA4KBO.mjs.map → chunk-EX2Q43O6.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +3 -3
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-NJGJKPL7.mjs → chunk-SWA6OT3W.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-NJGJKPL7.mjs.map → chunk-SWA6OT3W.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +3 -3
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- 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 +3 -1
- package/dist/types/src/components/Mesh/Mesh.stories.d.ts.map +1 -1
- package/dist/types/src/components/SVG/SVG.d.ts.map +1 -1
- package/dist/types/src/components/SVG/Svg.stories.d.ts +3 -1
- package/dist/types/src/components/SVG/Svg.stories.d.ts.map +1 -1
- package/dist/types/src/fx/fx.stories.d.ts +3 -1
- package/dist/types/src/fx/fx.stories.d.ts.map +1 -1
- package/dist/types/src/stories/hooks.stories.d.ts +3 -1
- package/dist/types/src/stories/hooks.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/src/components/Graph/Graph.stories.tsx +6 -7
- package/src/components/Graph/Graph.tsx +1 -1
- package/src/components/Mesh/Mesh.stories.tsx +5 -4
- package/src/components/SVG/Markers.tsx +1 -1
- package/src/components/SVG/Svg.stories.tsx +5 -4
- package/src/fx/fx.stories.tsx +6 -5
- package/src/hooks/useStateRef.ts +1 -1
- package/src/stories/hooks.stories.tsx +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-graph",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.ead640a",
|
|
4
4
|
"description": "GEM Graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@preact-signals/safe-react": "^0.9.0",
|
|
41
|
-
"@preact/signals-core": "^1.
|
|
41
|
+
"@preact/signals-core": "^1.12.1",
|
|
42
42
|
"d3": "^7.9.0",
|
|
43
43
|
"d3-force": "~3.0.0",
|
|
44
44
|
"immutability-helper": "^3.0.2",
|
|
@@ -46,40 +46,40 @@
|
|
|
46
46
|
"lodash.defaultsdeep": "^4.6.1",
|
|
47
47
|
"react-resize-detector": "^11.0.1",
|
|
48
48
|
"topojson-client": "^3.1.0",
|
|
49
|
-
"@dxos/async": "0.8.4-main.
|
|
50
|
-
"@dxos/debug": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
49
|
+
"@dxos/async": "0.8.4-main.ead640a",
|
|
50
|
+
"@dxos/debug": "0.8.4-main.ead640a",
|
|
51
|
+
"@dxos/echo-signals": "0.8.4-main.ead640a",
|
|
52
|
+
"@dxos/graph": "0.8.4-main.ead640a",
|
|
53
|
+
"@dxos/node-std": "0.8.4-main.ead640a",
|
|
54
|
+
"@dxos/invariant": "0.8.4-main.ead640a",
|
|
55
|
+
"@dxos/log": "0.8.4-main.ead640a"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/core": "^7.18.13",
|
|
59
59
|
"@types/d3": "^7.4.3",
|
|
60
60
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
61
|
-
"@types/react": "~
|
|
62
|
-
"@types/react-dom": "~
|
|
61
|
+
"@types/react": "~19.2.2",
|
|
62
|
+
"@types/react-dom": "~19.2.1",
|
|
63
63
|
"@types/topojson-client": "^3.1.4",
|
|
64
64
|
"@types/topojson-specification": "^1.0.5",
|
|
65
65
|
"postcss": "^8.4.41",
|
|
66
|
-
"react": "~
|
|
67
|
-
"react-dom": "~
|
|
68
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
69
|
-
"@dxos/random": "0.8.4-main.
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/react-ui-
|
|
66
|
+
"react": "~19.2.0",
|
|
67
|
+
"react-dom": "~19.2.0",
|
|
68
|
+
"@dxos/react-ui": "0.8.4-main.ead640a",
|
|
69
|
+
"@dxos/random": "0.8.4-main.ead640a",
|
|
70
|
+
"@dxos/react-ui-stack": "0.8.4-main.ead640a",
|
|
71
|
+
"@dxos/react-ui-theme": "0.8.4-main.ead640a",
|
|
72
|
+
"@dxos/storybook-utils": "0.8.4-main.ead640a",
|
|
73
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.ead640a"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"react": "
|
|
77
|
-
"react-dom": "
|
|
78
|
-
"@dxos/react-ui
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
76
|
+
"react": "^19.0.0",
|
|
77
|
+
"react-dom": "^19.0.0",
|
|
78
|
+
"@dxos/react-ui": "0.8.4-main.ead640a",
|
|
79
|
+
"@dxos/react-ui-theme": "0.8.4-main.ead640a"
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
|
-
"@dxos/random": "0.8.4-main.
|
|
82
|
+
"@dxos/random": "0.8.4-main.ead640a"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { effect } from '@preact/signals-core';
|
|
8
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
7
|
import { select } from 'd3';
|
|
@@ -11,10 +9,10 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
11
9
|
|
|
12
10
|
import { type Graph, type GraphModel, SelectionModel } from '@dxos/graph';
|
|
13
11
|
import { IconButton, Popover, Toolbar } from '@dxos/react-ui';
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
13
|
import { Card } from '@dxos/react-ui-stack';
|
|
15
14
|
import { JsonFilter, SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
16
|
-
import {
|
|
17
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
|
+
import { getHashStyles, mx } from '@dxos/react-ui-theme';
|
|
18
16
|
|
|
19
17
|
import { Pulsar } from '../../fx';
|
|
20
18
|
import {
|
|
@@ -217,7 +215,7 @@ const DefaultStory = ({
|
|
|
217
215
|
attributes={{
|
|
218
216
|
node: (node: GraphLayoutNode<TestNode>) => ({
|
|
219
217
|
data: {
|
|
220
|
-
color:
|
|
218
|
+
color: getHashStyles(node.data?.type ?? node.type)?.hue,
|
|
221
219
|
},
|
|
222
220
|
classes: {
|
|
223
221
|
'dx-selected': selection.contains(node.id),
|
|
@@ -225,7 +223,7 @@ const DefaultStory = ({
|
|
|
225
223
|
}),
|
|
226
224
|
edge: (edge: GraphLayoutEdge<TestNode>) => ({
|
|
227
225
|
data: {
|
|
228
|
-
color:
|
|
226
|
+
color: getHashStyles(edge.data?.type ?? edge.type)?.hue,
|
|
229
227
|
},
|
|
230
228
|
}),
|
|
231
229
|
}}
|
|
@@ -326,8 +324,9 @@ const Debug = ({
|
|
|
326
324
|
const meta = {
|
|
327
325
|
title: 'ui/react-ui-graph/Graph',
|
|
328
326
|
render: DefaultStory,
|
|
329
|
-
decorators: [withTheme
|
|
327
|
+
decorators: [withTheme],
|
|
330
328
|
parameters: {
|
|
329
|
+
layout: 'fullscreen',
|
|
331
330
|
controls: { disable: true },
|
|
332
331
|
},
|
|
333
332
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -54,7 +54,7 @@ export const GraphInner = <Node extends BaseGraphNode = any, Edge extends BaseGr
|
|
|
54
54
|
forwardedRef: Ref<GraphController>,
|
|
55
55
|
) => {
|
|
56
56
|
const context = useSvgContext();
|
|
57
|
-
const graphRef = useRef<SVGGElement>();
|
|
57
|
+
const graphRef = useRef<SVGGElement>(null);
|
|
58
58
|
|
|
59
59
|
const { projector, renderer } = useMemo(() => {
|
|
60
60
|
let projector = _projector;
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { SVG, type SVGRootProps } from '../SVG';
|
|
13
11
|
|
|
@@ -39,7 +37,10 @@ const DefaultStory = (props: SVGRootProps) => {
|
|
|
39
37
|
const meta = {
|
|
40
38
|
title: 'ui/react-ui-graph/Mesh',
|
|
41
39
|
render: DefaultStory,
|
|
42
|
-
decorators: [withTheme
|
|
40
|
+
decorators: [withTheme],
|
|
41
|
+
parameters: {
|
|
42
|
+
layout: 'fullscreen',
|
|
43
|
+
},
|
|
43
44
|
} satisfies Meta<typeof DefaultStory>;
|
|
44
45
|
|
|
45
46
|
export default meta;
|
|
@@ -16,7 +16,7 @@ export type MarkersProps = {
|
|
|
16
16
|
* SVG markers wrapper.
|
|
17
17
|
*/
|
|
18
18
|
export const Markers = ({ arrowSize, className }: MarkersProps) => {
|
|
19
|
-
const ref = useRef();
|
|
19
|
+
const ref = useRef(null);
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
select(ref.current).call(createMarkers({ arrowSize }));
|
|
22
22
|
}, [ref]);
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useRef } from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { type SVGContext, useGrid, useZoom } from '../../hooks';
|
|
13
11
|
|
|
@@ -47,7 +45,10 @@ const DefaultStory = (props: ComponentProps) => {
|
|
|
47
45
|
const meta = {
|
|
48
46
|
title: 'ui/react-ui-graph/SVGRoot',
|
|
49
47
|
render: DefaultStory,
|
|
50
|
-
decorators: [withTheme
|
|
48
|
+
decorators: [withTheme],
|
|
49
|
+
parameters: {
|
|
50
|
+
layout: 'fullscreen',
|
|
51
|
+
},
|
|
51
52
|
} satisfies Meta<typeof DefaultStory>;
|
|
52
53
|
|
|
53
54
|
export default meta;
|
package/src/fx/fx.stories.tsx
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import { select } from 'd3';
|
|
9
7
|
import React, { type FC, useEffect, useMemo, useRef } from 'react';
|
|
10
8
|
|
|
11
|
-
import {
|
|
9
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
10
|
|
|
13
11
|
import { SVG } from '../components';
|
|
14
12
|
import { useGrid, useZoom } from '../hooks';
|
|
@@ -54,7 +52,7 @@ const StoryComponent: FC<StoryProps> = ({ count = 1, ...options }) => {
|
|
|
54
52
|
const grid = useGrid({ axis: true, grid: false });
|
|
55
53
|
const zoom = useZoom();
|
|
56
54
|
|
|
57
|
-
const root = useRef<SVGGElement>();
|
|
55
|
+
const root = useRef<SVGGElement>(null);
|
|
58
56
|
useEffect(() => {
|
|
59
57
|
select(root.current)
|
|
60
58
|
.selectAll('g')
|
|
@@ -96,7 +94,10 @@ const createNode: D3Callable<SVGGElement, Datum> = (group, classNames, options)
|
|
|
96
94
|
const meta = {
|
|
97
95
|
title: 'ui/react-ui-graph/fx',
|
|
98
96
|
render: DefaultStory,
|
|
99
|
-
decorators: [withTheme
|
|
97
|
+
decorators: [withTheme],
|
|
98
|
+
parameters: {
|
|
99
|
+
layout: 'fullscreen',
|
|
100
|
+
},
|
|
100
101
|
} satisfies Meta<typeof DefaultStory>;
|
|
101
102
|
|
|
102
103
|
export default meta;
|
package/src/hooks/useStateRef.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const useStateRef = <V>(
|
|
|
16
16
|
initialValue?: V | (() => V),
|
|
17
17
|
): [V | undefined, Dispatch<SetStateAction<V | undefined>>, RefObject<V | undefined>] => {
|
|
18
18
|
const [value, setValue] = useState<V | undefined>(initialValue);
|
|
19
|
-
const ref = useRef<V>();
|
|
19
|
+
const ref = useRef<V>(null);
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
ref.current = value;
|
|
22
22
|
}, [initialValue, value]);
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import { select } from 'd3';
|
|
9
7
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef } from 'react';
|
|
10
8
|
|
|
11
9
|
import { combine } from '@dxos/async';
|
|
12
10
|
import { log } from '@dxos/log';
|
|
13
|
-
import {
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
|
|
15
13
|
import { SVG } from '../components';
|
|
16
14
|
import {
|
|
@@ -46,8 +44,8 @@ const Component = ({
|
|
|
46
44
|
grid: showGrid = false,
|
|
47
45
|
}: ComponentProps) => {
|
|
48
46
|
const context = useSvgContext();
|
|
49
|
-
const graphRef = useRef<SVGGElement>();
|
|
50
|
-
const markersRef = useRef<SVGGElement>();
|
|
47
|
+
const graphRef = useRef<SVGGElement>(null);
|
|
48
|
+
const markersRef = useRef<SVGGElement>(null);
|
|
51
49
|
const grid = useGrid({ visible: showGrid });
|
|
52
50
|
const zoom = useZoom();
|
|
53
51
|
|
|
@@ -154,7 +152,10 @@ const DefaultStory = ({ children, ...props }: ComponentProps) => {
|
|
|
154
152
|
const meta = {
|
|
155
153
|
title: 'ui/react-ui-graph/hooks',
|
|
156
154
|
render: DefaultStory,
|
|
157
|
-
decorators: [withTheme
|
|
155
|
+
decorators: [withTheme],
|
|
156
|
+
parameters: {
|
|
157
|
+
layout: 'fullscreen',
|
|
158
|
+
},
|
|
158
159
|
} satisfies Meta<typeof DefaultStory>;
|
|
159
160
|
|
|
160
161
|
export default meta;
|