@dxos/plugin-explorer 0.8.0 → 0.8.1-main.81238a8
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/{ExplorerContainer-GJTCBEM4.mjs → ExplorerContainer-3FC557MG.mjs} +2 -2
- package/dist/lib/browser/{chunk-S3QNIEBS.mjs → chunk-4OFGICWF.mjs} +241 -2
- package/dist/lib/{node-esm/chunk-BRJI3QC2.mjs.map → browser/chunk-4OFGICWF.mjs.map} +4 -4
- package/dist/lib/browser/{chunk-PMHCTMKT.mjs → chunk-B3EX52V3.mjs} +2 -2
- package/dist/lib/browser/{chunk-QOKAZK4V.mjs → chunk-KYB47PZA.mjs} +1 -1
- package/dist/lib/browser/chunk-KYB47PZA.mjs.map +7 -0
- package/dist/lib/browser/chunk-X5CI43J6.mjs +205 -0
- package/dist/lib/browser/chunk-X5CI43J6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -12
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-UJNDAIDZ.mjs → intent-resolver-5UXBTZAM.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/{react-surface-3X2V3VPN.mjs → react-surface-7HHUAS3J.mjs} +7 -6
- package/dist/lib/browser/react-surface-7HHUAS3J.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node/{ExplorerContainer-RJT54IOS.cjs → ExplorerContainer-2DQFUEG7.cjs} +6 -6
- package/dist/lib/node/{chunk-5MTMJYC4.cjs → chunk-6VLMSRD5.cjs} +4 -4
- package/dist/lib/node/chunk-6VLMSRD5.cjs.map +7 -0
- package/dist/lib/node/chunk-AABHIUUW.cjs +236 -0
- package/dist/lib/node/chunk-AABHIUUW.cjs.map +7 -0
- package/dist/lib/node/{chunk-YUY7P7R2.cjs → chunk-C4DXEIBU.cjs} +6 -6
- package/dist/lib/node/{chunk-VSACDC6F.cjs → chunk-ZJL53DLS.cjs} +234 -8
- package/dist/lib/node/chunk-ZJL53DLS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +31 -31
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/{intent-resolver-XQV24IAA.cjs → intent-resolver-WDMZJTJ5.cjs} +8 -8
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-36YIY7NA.cjs → react-surface-UKU6NFBS.cjs} +12 -11
- package/dist/lib/node/react-surface-UKU6NFBS.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +4 -4
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{ExplorerContainer-TM3VIXVK.mjs → ExplorerContainer-RBGUFI5X.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-BRJI3QC2.mjs → chunk-PIOV7IOO.mjs} +240 -2
- package/dist/lib/{browser/chunk-S3QNIEBS.mjs.map → node-esm/chunk-PIOV7IOO.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-UHJZUVRI.mjs → chunk-RKQR2GVZ.mjs} +1 -1
- package/dist/lib/node-esm/chunk-RKQR2GVZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TI3P4L2P.mjs +207 -0
- package/dist/lib/node-esm/chunk-TI3P4L2P.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-57K7ORAW.mjs → chunk-WJ6AML7W.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +12 -12
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/{intent-resolver-RZQ3EEOE.mjs → intent-resolver-KBRYGW6I.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/{react-surface-YDY7IBMY.mjs → react-surface-UZYRBRXP.mjs} +7 -6
- package/dist/lib/node-esm/react-surface-UZYRBRXP.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts +2 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +2 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +2 -1
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +2 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +3 -2
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/Graph.d.ts +0 -3
- package/dist/types/src/components/Graph/Graph.d.ts.map +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/Graph/graph-model.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts +2 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types.d.ts +1 -1
- package/dist/types/src/components/Tree/types.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/package.json +26 -26
- package/src/ExplorerPlugin.tsx +1 -1
- package/src/capabilities/react-surface.tsx +2 -1
- package/src/components/Graph/Graph.stories.tsx +2 -2
- package/src/components/Graph/Graph.tsx +16 -142
- package/src/components/Graph/graph-model.ts +2 -0
- package/src/components/Tree/Tree.stories.tsx +3 -36
- package/src/components/Tree/types.ts +2 -1
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -1
- package/dist/lib/browser/chunk-QOKAZK4V.mjs.map +0 -7
- package/dist/lib/browser/chunk-YQL7YE6N.mjs +0 -546
- package/dist/lib/browser/chunk-YQL7YE6N.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3X2V3VPN.mjs.map +0 -7
- package/dist/lib/node/chunk-5MTMJYC4.cjs.map +0 -7
- package/dist/lib/node/chunk-VSACDC6F.cjs.map +0 -7
- package/dist/lib/node/chunk-YH4QYCZH.cjs +0 -567
- package/dist/lib/node/chunk-YH4QYCZH.cjs.map +0 -7
- package/dist/lib/node/react-surface-36YIY7NA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-3KRWHGBM.mjs +0 -548
- package/dist/lib/node-esm/chunk-3KRWHGBM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UHJZUVRI.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-YDY7IBMY.mjs.map +0 -7
- /package/dist/lib/browser/{ExplorerContainer-GJTCBEM4.mjs.map → ExplorerContainer-3FC557MG.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-PMHCTMKT.mjs.map → chunk-B3EX52V3.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-UJNDAIDZ.mjs.map → intent-resolver-5UXBTZAM.mjs.map} +0 -0
- /package/dist/lib/node/{ExplorerContainer-RJT54IOS.cjs.map → ExplorerContainer-2DQFUEG7.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-YUY7P7R2.cjs.map → chunk-C4DXEIBU.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-XQV24IAA.cjs.map → intent-resolver-WDMZJTJ5.cjs.map} +0 -0
- /package/dist/lib/node-esm/{ExplorerContainer-TM3VIXVK.mjs.map → ExplorerContainer-RBGUFI5X.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-57K7ORAW.mjs.map → chunk-WJ6AML7W.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-RZQ3EEOE.mjs.map → intent-resolver-KBRYGW6I.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\n\nimport { ExplorerContainer } from '../components';\nimport { EXPLORER_PLUGIN } from '../meta';\nimport { ViewType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: `${EXPLORER_PLUGIN}/article`,\n role: ['article', 'section'],\n filter: (data): data is { subject: ViewType } => isInstanceOf(ViewType, data.subject),\n component: ({ data, role }) => <ExplorerContainer view={data.subject} role={role} />,\n }),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,oBAAoB;AAM7B,IAAA,wBAAe,MACbC,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAI,GAAGC,eAAAA;EACPC,MAAM;IAAC;IAAW;;EAClBC,QAAQ,CAACC,SAAwCC,aAAaC,UAAUF,KAAKG,OAAO;EACpFC,WAAW,CAAC,EAAEJ,MAAMF,KAAI,MAAO,sBAAA,cAACO,mBAAAA;IAAkBC,MAAMN,KAAKG;IAASL;;AACxE,CAAA,CAAA;",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "isInstanceOf", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "EXPLORER_PLUGIN", "role", "filter", "data", "isInstanceOf", "ViewType", "subject", "component", "ExplorerContainer", "view"]
|
|
7
|
+
}
|
|
@@ -2,8 +2,8 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
ExplorerAction,
|
|
4
4
|
ViewType
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-WJ6AML7W.mjs";
|
|
6
|
+
import "../chunk-RKQR2GVZ.mjs";
|
|
7
7
|
export {
|
|
8
8
|
ExplorerAction,
|
|
9
9
|
ViewType
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;
|
|
1
|
+
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAO/E,wBASI"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type DotOptions } from '@observablehq/plot';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { type Accessor, type Point } from '../plot';
|
|
3
4
|
export type CharProps = {
|
|
4
5
|
items?: any[];
|
|
5
6
|
accessor?: Accessor<Point>;
|
|
6
7
|
options?: DotOptions;
|
|
7
8
|
};
|
|
8
|
-
export declare const Chart: ({ items, accessor, options }: CharProps) =>
|
|
9
|
+
export declare const Chart: ({ items, accessor, options }: CharProps) => React.JSX.Element;
|
|
9
10
|
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chart/Chart.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chart/Chart.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,KAAK,QAAQ,EAAiB,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AASnE,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,KAAK,iCAAwD,SAAS,sBA6BlF,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
2
|
import { type Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import { Chart } from './Chart';
|
|
4
|
-
export declare const Default: () =>
|
|
5
|
+
export declare const Default: () => React.JSX.Element;
|
|
5
6
|
declare const meta: Meta<typeof Chart>;
|
|
6
7
|
export default meta;
|
|
7
8
|
//# sourceMappingURL=Chart.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chart/Chart.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Chart.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chart/Chart.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAoBhC,eAAO,MAAM,OAAO,yBAA6C,CAAC;AAElE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAI5B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { type ViewType } from '../types';
|
|
2
3
|
declare const ExplorerContainer: ({ view, role }: {
|
|
3
4
|
view: ViewType;
|
|
4
5
|
role: string;
|
|
5
|
-
}) =>
|
|
6
|
+
}) => React.JSX.Element | null;
|
|
6
7
|
export default ExplorerContainer;
|
|
7
8
|
//# sourceMappingURL=ExplorerContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ExplorerContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExplorerContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ExplorerContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,iBAAiB,mBAAoB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,6BAa1E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DotOptions } from '@observablehq/plot';
|
|
2
2
|
import * as Plot from '@observablehq/plot';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import { type Accessor, type GeoLocation } from '../plot';
|
|
4
5
|
export type GlobeProps = {
|
|
5
6
|
items?: any[];
|
|
@@ -7,5 +8,5 @@ export type GlobeProps = {
|
|
|
7
8
|
projection?: Plot.ProjectionName;
|
|
8
9
|
options?: DotOptions;
|
|
9
10
|
};
|
|
10
|
-
export declare const Globe: ({ items, accessor, projection, options }: GlobeProps) =>
|
|
11
|
+
export declare const Globe: ({ items, accessor, projection, options }: GlobeProps) => React.JSX.Element;
|
|
11
12
|
//# sourceMappingURL=Globe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Globe.d.ts","sourceRoot":"","sources":["../../../../../src/components/Globe/Globe.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Globe.d.ts","sourceRoot":"","sources":["../../../../../src/components/Globe/Globe.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAE,KAAK,QAAQ,EAAiB,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAOzE,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC;IACjC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,KAAK,6CAAqF,UAAU,sBAsChH,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
2
|
import { type Meta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare const Default: () => React.JSX.Element;
|
|
5
|
+
export declare const Extended: () => React.JSX.Element;
|
|
5
6
|
declare const meta: Meta;
|
|
6
7
|
export default meta;
|
|
7
8
|
//# sourceMappingURL=Globe.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Globe.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Globe/Globe.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Globe.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Globe/Globe.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAoB,MAAM,OAAO,CAAC;AAyEzC,eAAO,MAAM,OAAO,yBAAgE,CAAC;AAErF,eAAO,MAAM,QAAQ,yBAAiE,CAAC;AAEvF,QAAA,MAAM,IAAI,EAAE,IAGX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type Space } from '@dxos/client/echo';
|
|
3
|
-
import '@dxos/gem-spore/styles';
|
|
4
3
|
export type GraphProps = {
|
|
5
4
|
space: Space;
|
|
6
5
|
match?: RegExp;
|
|
7
|
-
grid?: boolean;
|
|
8
|
-
svg?: boolean;
|
|
9
6
|
};
|
|
10
7
|
export declare const Graph: FC<GraphProps>;
|
|
11
8
|
//# sourceMappingURL=Graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/Graph.tsx"],"names":[],"mappings":"AAMA,OAAc,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/Graph.tsx"],"names":[],"mappings":"AAMA,OAAc,EAAE,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM/C,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAqEhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA2C7C,
|
|
1
|
+
{"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA2C7C,QAAA,MAAM,IAAI,EAAE,IAQX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-model.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/graph-model.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7D,OAAO,EAAU,KAAK,kBAAkB,EAAE,KAAK,KAAK,EAAqB,MAAM,yBAAyB,CAAC;AAEzG,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-model.d.ts","sourceRoot":"","sources":["../../../../../src/components/Graph/graph-model.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7D,OAAO,EAAU,KAAK,kBAAkB,EAAE,KAAK,KAAK,EAAqB,MAAM,yBAAyB,CAAC;AAEzG,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,eAAe,CAAC;AAE9D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,UAAU,CAAC,aAAa,CAAC;IAWhD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAVrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGrB;IAEF,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,mBAAmB,CAAC,CAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,CAA4B;IAC7C,OAAO,CAAC,oBAAoB,CAAC,CAAe;gBAEf,QAAQ,GAAE,sBAA2B;IAIlE,IAAa,KAAK,IAAI,SAAS,CAAC,aAAa,CAAC,CAE7C;IAED,IAAI,OAAO,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAEvC;IASK,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM;IAgH1C,KAAK;CAQN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { type Space } from '@dxos/client/echo';
|
|
2
3
|
export type LayoutVariant = 'tidy' | 'radial' | 'edge';
|
|
3
4
|
export type TreeLayoutSlots = {
|
|
@@ -22,5 +23,5 @@ export type TreeComponentProps<N = unknown> = {
|
|
|
22
23
|
variant?: LayoutVariant;
|
|
23
24
|
onNodeClick?: (node?: N) => void;
|
|
24
25
|
};
|
|
25
|
-
export declare const Tree: <N>({ space, selected, variant, onNodeClick }: TreeComponentProps<N>) =>
|
|
26
|
+
export declare const Tree: <N>({ space, selected, variant, onNodeClick }: TreeComponentProps<N>) => React.JSX.Element;
|
|
26
27
|
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAa/C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAGvD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC;IAE1B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAIpC,CAAC;AAQF,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,IAAI,GAAI,CAAC,6CAAuD,kBAAkB,CAAC,CAAC,CAAC,sBAiDjG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/Tree.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tree.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/Tree.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAkC7C,eAAO,MAAM,IAAI;;;;CAIhB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;CAIlB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;CAIhB,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAQX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tree/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,wBAAiB,QAAQ,GAAG,SA0BrF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const ExplorerContainer: import("react").LazyExoticComponent<({ view, role }: {
|
|
2
2
|
view: import("../types").ViewType;
|
|
3
3
|
role: string;
|
|
4
|
-
}) => import("react
|
|
4
|
+
}) => import("react").JSX.Element | null>;
|
|
5
5
|
export * from './Chart';
|
|
6
6
|
export * from './Globe';
|
|
7
7
|
export * from './Graph';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;yCAA4C,CAAC;AAE3E,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
+
import { type PluginMeta } from '@dxos/app-framework';
|
|
1
2
|
export declare const EXPLORER_PLUGIN = "dxos.org/plugin/explorer";
|
|
2
|
-
export declare const meta:
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
icon: string;
|
|
7
|
-
source: string;
|
|
8
|
-
tags: string[];
|
|
9
|
-
screenshots: string[];
|
|
10
|
-
};
|
|
3
|
+
export declare const meta: PluginMeta;
|
|
11
4
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,eAAO,MAAM,IAAI,EAAE,UAQlB,CAAC"}
|
|
@@ -4,19 +4,19 @@ declare const _default: {
|
|
|
4
4
|
'typename label': string;
|
|
5
5
|
'plugin name'?: undefined;
|
|
6
6
|
'object title label'?: undefined;
|
|
7
|
-
'object
|
|
7
|
+
'object placeholder'?: undefined;
|
|
8
8
|
'create object label'?: undefined;
|
|
9
9
|
} | {
|
|
10
10
|
'plugin name': string;
|
|
11
11
|
'object title label': string;
|
|
12
|
-
'object
|
|
12
|
+
'object placeholder': string;
|
|
13
13
|
'create object label': string;
|
|
14
14
|
'typename label'?: undefined;
|
|
15
15
|
};
|
|
16
16
|
"dxos.org/plugin/explorer": {
|
|
17
17
|
'plugin name': string;
|
|
18
18
|
'object title label': string;
|
|
19
|
-
'object
|
|
19
|
+
'object placeholder': string;
|
|
20
20
|
'create object label': string;
|
|
21
21
|
};
|
|
22
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-main.81238a8",
|
|
4
4
|
"description": "Braneframe data visualization plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,30 +33,30 @@
|
|
|
33
33
|
"src"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
36
|
+
"3d-force-graph": "^1.76.1",
|
|
37
37
|
"@observablehq/plot": "^0.6.11",
|
|
38
38
|
"@preact/signals-core": "^1.6.0",
|
|
39
39
|
"d3": "^7.9.0",
|
|
40
|
-
"force-graph": "1.49.
|
|
40
|
+
"force-graph": "^1.49.4",
|
|
41
41
|
"lodash.defaultsdeep": "^4.6.1",
|
|
42
42
|
"lodash.get": "^4.4.2",
|
|
43
43
|
"react-resize-detector": "^11.0.1",
|
|
44
44
|
"topojson-client": "^3.1.0",
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/gem-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/plugin-
|
|
56
|
-
"@dxos/plugin-
|
|
57
|
-
"@dxos/react-client": "0.8.
|
|
58
|
-
"@dxos/react-ui-stack": "0.8.
|
|
59
|
-
"@dxos/util": "0.8.
|
|
45
|
+
"@dxos/client": "0.8.1-main.81238a8",
|
|
46
|
+
"@dxos/async": "0.8.1-main.81238a8",
|
|
47
|
+
"@dxos/app-framework": "0.8.1-main.81238a8",
|
|
48
|
+
"@dxos/echo-schema": "0.8.1-main.81238a8",
|
|
49
|
+
"@dxos/gem-spore": "0.8.1-main.81238a8",
|
|
50
|
+
"@dxos/gem-core": "0.8.1-main.81238a8",
|
|
51
|
+
"@dxos/log": "0.8.1-main.81238a8",
|
|
52
|
+
"@dxos/plugin-client": "0.8.1-main.81238a8",
|
|
53
|
+
"@dxos/plugin-graph": "0.8.1-main.81238a8",
|
|
54
|
+
"@dxos/live-object": "0.8.1-main.81238a8",
|
|
55
|
+
"@dxos/plugin-search": "0.8.1-main.81238a8",
|
|
56
|
+
"@dxos/plugin-space": "0.8.1-main.81238a8",
|
|
57
|
+
"@dxos/react-client": "0.8.1-main.81238a8",
|
|
58
|
+
"@dxos/react-ui-stack": "0.8.1-main.81238a8",
|
|
59
|
+
"@dxos/util": "0.8.1-main.81238a8"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -71,19 +71,19 @@
|
|
|
71
71
|
"react": "~18.2.0",
|
|
72
72
|
"react-dom": "~18.2.0",
|
|
73
73
|
"vite": "5.4.7",
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/random": "0.8.
|
|
77
|
-
"@dxos/react-ui": "0.8.
|
|
78
|
-
"@dxos/react-ui-theme": "0.8.
|
|
79
|
-
"@dxos/storybook-utils": "0.8.
|
|
74
|
+
"@dxos/plugin-outliner": "0.8.1-main.81238a8",
|
|
75
|
+
"@dxos/echo-generator": "0.8.1-main.81238a8",
|
|
76
|
+
"@dxos/random": "0.8.1-main.81238a8",
|
|
77
|
+
"@dxos/react-ui": "0.8.1-main.81238a8",
|
|
78
|
+
"@dxos/react-ui-theme": "0.8.1-main.81238a8",
|
|
79
|
+
"@dxos/storybook-utils": "0.8.1-main.81238a8"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@phosphor-icons/react": "^2.1.5",
|
|
83
83
|
"react": "~18.2.0",
|
|
84
84
|
"react-dom": "~18.2.0",
|
|
85
|
-
"@dxos/react-ui
|
|
86
|
-
"@dxos/react-ui": "0.8.
|
|
85
|
+
"@dxos/react-ui": "0.8.1-main.81238a8",
|
|
86
|
+
"@dxos/react-ui-theme": "0.8.1-main.81238a8"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
package/src/ExplorerPlugin.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export const ExplorerPlugin = () =>
|
|
|
26
26
|
contributes(Capabilities.Metadata, {
|
|
27
27
|
id: ViewType.typename,
|
|
28
28
|
metadata: {
|
|
29
|
-
placeholder: ['object
|
|
29
|
+
placeholder: ['object placeholder', { ns: EXPLORER_PLUGIN }],
|
|
30
30
|
icon: 'ph--graph--regular',
|
|
31
31
|
},
|
|
32
32
|
}),
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
+
import { isInstanceOf } from '@dxos/echo-schema';
|
|
8
9
|
|
|
9
10
|
import { ExplorerContainer } from '../components';
|
|
10
11
|
import { EXPLORER_PLUGIN } from '../meta';
|
|
@@ -16,7 +17,7 @@ export default () =>
|
|
|
16
17
|
createSurface({
|
|
17
18
|
id: `${EXPLORER_PLUGIN}/article`,
|
|
18
19
|
role: ['article', 'section'],
|
|
19
|
-
filter: (data): data is { subject: ViewType } => data.subject
|
|
20
|
+
filter: (data): data is { subject: ViewType } => isInstanceOf(ViewType, data.subject),
|
|
20
21
|
component: ({ data, role }) => <ExplorerContainer view={data.subject} role={role} />,
|
|
21
22
|
}),
|
|
22
23
|
);
|
|
@@ -47,8 +47,6 @@ const Story = () => {
|
|
|
47
47
|
return <Graph space={space} />;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
export const Default = {};
|
|
51
|
-
|
|
52
50
|
const meta: Meta = {
|
|
53
51
|
title: 'plugins/plugin-explorer/Graph',
|
|
54
52
|
component: Graph,
|
|
@@ -60,3 +58,5 @@ const meta: Meta = {
|
|
|
60
58
|
};
|
|
61
59
|
|
|
62
60
|
export default meta;
|
|
61
|
+
|
|
62
|
+
export const Default = {};
|
|
@@ -4,100 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
import { forceLink, forceManyBody } from 'd3';
|
|
6
6
|
import ForceGraph from 'force-graph';
|
|
7
|
-
import React, { type FC, useEffect,
|
|
7
|
+
import React, { type FC, useEffect, useRef } from 'react';
|
|
8
8
|
import { useResizeDetector } from 'react-resize-detector';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { createSvgContext, defaultGridStyles, Grid, SVG, SVGRoot, Zoom } from '@dxos/gem-core';
|
|
12
|
-
import {
|
|
13
|
-
defaultStyles,
|
|
14
|
-
Graph as GraphComponent,
|
|
15
|
-
GraphForceProjector,
|
|
16
|
-
type GraphLayoutNode,
|
|
17
|
-
Markers,
|
|
18
|
-
} from '@dxos/gem-spore';
|
|
10
|
+
import { type Space } from '@dxos/client/echo';
|
|
19
11
|
import { filterObjectsSync, type SearchResult } from '@dxos/plugin-search';
|
|
20
|
-
import { useAsyncState
|
|
21
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
22
|
-
import '@dxos/gem-spore/styles';
|
|
12
|
+
import { useAsyncState } from '@dxos/react-ui';
|
|
23
13
|
|
|
24
|
-
import {
|
|
25
|
-
import { Tree } from '../Tree';
|
|
26
|
-
|
|
27
|
-
type Slots = {
|
|
28
|
-
root?: { className?: string };
|
|
29
|
-
grid?: { className?: string };
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const slots: Slots = {};
|
|
33
|
-
|
|
34
|
-
const colors = [
|
|
35
|
-
'[&>circle]:!fill-black-300 [&>circle]:!stroke-black-600',
|
|
36
|
-
'[&>circle]:!fill-slate-300 [&>circle]:!stroke-slate-600',
|
|
37
|
-
'[&>circle]:!fill-green-300 [&>circle]:!stroke-green-600',
|
|
38
|
-
'[&>circle]:!fill-sky-300 [&>circle]:!stroke-sky-600',
|
|
39
|
-
'[&>circle]:!fill-cyan-300 [&>circle]:!stroke-cyan-600',
|
|
40
|
-
'[&>circle]:!fill-rose-300 [&>circle]:!stroke-rose-600',
|
|
41
|
-
'[&>circle]:!fill-purple-300 [&>circle]:!stroke-purple-600',
|
|
42
|
-
'[&>circle]:!fill-orange-300 [&>circle]:!stroke-orange-600',
|
|
43
|
-
'[&>circle]:!fill-teal-300 [&>circle]:!stroke-teal-600',
|
|
44
|
-
'[&>circle]:!fill-indigo-300 [&>circle]:!stroke-indigo-600',
|
|
45
|
-
];
|
|
14
|
+
import { SpaceGraphModel } from './graph-model';
|
|
46
15
|
|
|
47
16
|
export type GraphProps = {
|
|
48
17
|
space: Space;
|
|
49
18
|
match?: RegExp;
|
|
50
|
-
grid?: boolean;
|
|
51
|
-
svg?: boolean;
|
|
52
19
|
};
|
|
53
20
|
|
|
54
|
-
export const Graph: FC<GraphProps> = ({ space, match
|
|
55
|
-
const {
|
|
56
|
-
const
|
|
21
|
+
export const Graph: FC<GraphProps> = ({ space, match }) => {
|
|
22
|
+
const { ref, width, height } = useResizeDetector({ refreshRate: 200 });
|
|
23
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
24
|
+
const forceGraph = useRef<ForceGraph>();
|
|
57
25
|
|
|
58
26
|
const [model] = useAsyncState(
|
|
59
27
|
async () => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined),
|
|
60
28
|
[space],
|
|
61
29
|
);
|
|
62
30
|
|
|
63
|
-
const context = createSvgContext();
|
|
64
|
-
const projector = useMemo(
|
|
65
|
-
() =>
|
|
66
|
-
new GraphForceProjector<EchoGraphNode>(context, {
|
|
67
|
-
forces: {
|
|
68
|
-
manyBody: {
|
|
69
|
-
strength: -100,
|
|
70
|
-
},
|
|
71
|
-
link: {
|
|
72
|
-
distance: 100,
|
|
73
|
-
},
|
|
74
|
-
radial: {
|
|
75
|
-
radius: 150,
|
|
76
|
-
strength: 0.05,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
attributes: {
|
|
80
|
-
radius: (node: GraphLayoutNode<EchoGraphNode>) => (node.data?.type === 'schema' ? 12 : 8),
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
83
|
-
[],
|
|
84
|
-
);
|
|
85
|
-
|
|
86
31
|
const filteredRef = useRef<SearchResult[]>();
|
|
87
32
|
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
void projector.start();
|
|
90
|
-
}, [match]);
|
|
91
|
-
|
|
92
|
-
const [colorMap] = useState(new Map<string, string>());
|
|
93
|
-
|
|
94
|
-
// https://github.com/vasturiano/force-graph
|
|
95
|
-
const { ref, width, height } = useResizeDetector();
|
|
96
|
-
const rootRef = useRef<HTMLDivElement>(null);
|
|
97
|
-
const forceGraph = useRef<ForceGraph>();
|
|
98
33
|
|
|
99
34
|
useEffect(() => {
|
|
100
35
|
if (rootRef.current) {
|
|
36
|
+
// https://github.com/vasturiano/force-graph
|
|
37
|
+
// https://github.com/vasturiano/3d-force-graph
|
|
101
38
|
forceGraph.current = new ForceGraph(rootRef.current)
|
|
102
39
|
.nodeRelSize(6)
|
|
103
40
|
.nodeLabel((node: any) => {
|
|
@@ -117,7 +54,6 @@ export const Graph: FC<GraphProps> = ({ space, match, grid, svg }) => {
|
|
|
117
54
|
};
|
|
118
55
|
}, []);
|
|
119
56
|
|
|
120
|
-
// Update.
|
|
121
57
|
useEffect(() => {
|
|
122
58
|
if (forceGraph.current && width && height && model) {
|
|
123
59
|
forceGraph.current
|
|
@@ -125,7 +61,7 @@ export const Graph: FC<GraphProps> = ({ space, match, grid, svg }) => {
|
|
|
125
61
|
.width(width)
|
|
126
62
|
.height(height)
|
|
127
63
|
.onEngineStop(() => {
|
|
128
|
-
|
|
64
|
+
handleZoomToFit();
|
|
129
65
|
})
|
|
130
66
|
|
|
131
67
|
// https://github.com/vasturiano/force-graph?tab=readme-ov-file#force-engine-d3-force-configuration
|
|
@@ -134,11 +70,10 @@ export const Graph: FC<GraphProps> = ({ space, match, grid, svg }) => {
|
|
|
134
70
|
.d3Force('charge', forceManyBody().strength(-30))
|
|
135
71
|
// .d3AlphaDecay(0.0228)
|
|
136
72
|
// .d3VelocityDecay(0.4)
|
|
137
|
-
.warmupTicks(100)
|
|
138
|
-
// .cooldownTime(1000)
|
|
139
73
|
|
|
140
|
-
//
|
|
141
74
|
.graphData(model.graph)
|
|
75
|
+
.warmupTicks(100)
|
|
76
|
+
.cooldownTime(1000)
|
|
142
77
|
.resumeAnimation();
|
|
143
78
|
}
|
|
144
79
|
}, [model, width, height]);
|
|
@@ -147,70 +82,9 @@ export const Graph: FC<GraphProps> = ({ space, match, grid, svg }) => {
|
|
|
147
82
|
forceGraph.current?.zoomToFit(400, 40);
|
|
148
83
|
};
|
|
149
84
|
|
|
150
|
-
if (!svg) {
|
|
151
|
-
return (
|
|
152
|
-
<div ref={ref} className='relative grow' onClick={handleZoomToFit}>
|
|
153
|
-
<div ref={rootRef} className='absolute inset-0' />
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (selected) {
|
|
159
|
-
return <Tree space={space} selected={selected} variant='tidy' onNodeClick={() => setSelected(undefined)} />;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
85
|
return (
|
|
163
|
-
<
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
{grid && <Grid className={slots?.grid?.className ?? defaultGridStyles(themeMode)} />}
|
|
167
|
-
<Zoom extent={[1 / 2, 4]}>
|
|
168
|
-
<GraphComponent
|
|
169
|
-
model={model}
|
|
170
|
-
projector={projector}
|
|
171
|
-
drag
|
|
172
|
-
arrows
|
|
173
|
-
onSelect={(node) => setSelected(node?.data?.id)}
|
|
174
|
-
labels={{
|
|
175
|
-
text: (node: GraphLayoutNode<ReactiveEchoObject<any>>) => {
|
|
176
|
-
if (filteredRef.current?.length && !filteredRef.current.some((object) => object.id === node.data?.id)) {
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// TODO(burdon): Use schema.
|
|
181
|
-
return node.data?.label ?? node.data?.title ?? node.data?.name ?? node.data?.id.slice(0, 8);
|
|
182
|
-
},
|
|
183
|
-
}}
|
|
184
|
-
attributes={{
|
|
185
|
-
node: (node: GraphLayoutNode<ReactiveEchoObject<any>>) => {
|
|
186
|
-
let className: string | undefined;
|
|
187
|
-
if (node.data) {
|
|
188
|
-
const { object } = node.data;
|
|
189
|
-
if (object) {
|
|
190
|
-
const typename = getTypename(object);
|
|
191
|
-
if (typename) {
|
|
192
|
-
className = colorMap.get(typename);
|
|
193
|
-
if (!className) {
|
|
194
|
-
className = colors[colorMap.size % colors.length];
|
|
195
|
-
colorMap.set(typename, className);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const selected = filteredRef.current?.some((object) => object.id === node.data?.id);
|
|
202
|
-
const blur = !selected && !!filteredRef.current?.length;
|
|
203
|
-
return {
|
|
204
|
-
class: mx(className, blur && 'opacity-70'),
|
|
205
|
-
};
|
|
206
|
-
},
|
|
207
|
-
link: () => ({
|
|
208
|
-
class: '[&>path]:!stroke-neutral-300 dark:[&>path]:!stroke-neutral-700',
|
|
209
|
-
}),
|
|
210
|
-
}}
|
|
211
|
-
/>
|
|
212
|
-
</Zoom>
|
|
213
|
-
</SVG>
|
|
214
|
-
</SVGRoot>
|
|
86
|
+
<div ref={ref} className='relative grow' onClick={handleZoomToFit}>
|
|
87
|
+
<div ref={rootRef} className='absolute inset-0' />
|
|
88
|
+
</div>
|
|
215
89
|
);
|
|
216
90
|
};
|