@dxos/plugin-explorer 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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-BFAWRIAJ.mjs → ExplorerContainer-JBCVWH3M.mjs} +19 -16
- package/dist/lib/browser/ExplorerContainer-JBCVWH3M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HIFLWHXR.mjs → chunk-3Y7INKYN.mjs} +6 -21
- package/dist/lib/browser/chunk-3Y7INKYN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YNQF4CPY.mjs → chunk-LSUP47BZ.mjs} +2 -2
- package/dist/lib/browser/{chunk-YNQF4CPY.mjs.map → chunk-LSUP47BZ.mjs.map} +1 -1
- package/dist/lib/{node-esm/chunk-QLMTN2XI.mjs → browser/chunk-WX7QIZMF.mjs} +218 -18
- package/dist/lib/browser/{chunk-AGZAGILW.mjs.map → chunk-WX7QIZMF.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +18 -22
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/{react-surface-RWVHQL3J.mjs → react-surface-FWNW2HFX.mjs} +13 -10
- package/dist/lib/browser/react-surface-FWNW2HFX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{ExplorerContainer-YQ2KKBVS.mjs → ExplorerContainer-5JTSMOCL.mjs} +19 -16
- package/dist/lib/node-esm/ExplorerContainer-5JTSMOCL.mjs.map +7 -0
- package/dist/lib/{browser/chunk-AGZAGILW.mjs → node-esm/chunk-3Z2WBI3N.mjs} +220 -16
- package/dist/lib/node-esm/{chunk-QLMTN2XI.mjs.map → chunk-3Z2WBI3N.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-3OE6TBJI.mjs → chunk-6OG6G75N.mjs} +6 -21
- package/dist/lib/node-esm/chunk-6OG6G75N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs → chunk-EN3JZNEY.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs.map → chunk-EN3JZNEY.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +18 -22
- package/dist/lib/node-esm/index.mjs.map +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-3REUS7KW.mjs → react-surface-BDRG4ZLM.mjs} +13 -10
- package/dist/lib/node-esm/react-surface-BDRG4ZLM.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +3 -3
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +2 -2
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +3 -3
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +2 -9
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -37
- package/src/ExplorerPlugin.tsx +8 -7
- package/src/capabilities/react-surface/react-surface.tsx +7 -6
- package/src/components/Chart/Chart.stories.tsx +2 -2
- package/src/components/Globe/Globe.stories.tsx +2 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +10 -10
- package/src/components/Graph/D3ForceGraph.tsx +6 -5
- package/src/components/Graph/ForceGraph.stories.tsx +10 -10
- package/src/components/Graph/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +2 -2
- package/src/components/Tree/types/tree.ts +3 -3
- package/src/components/index.ts +0 -4
- package/src/{components → containers/ExplorerContainer}/ExplorerContainer.tsx +19 -18
- package/src/containers/ExplorerContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +4 -3
- package/src/meta.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/ExplorerAction.ts +0 -1
- package/src/types/Graph.ts +5 -22
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-BZMTFAP3.mjs +0 -34
- package/dist/lib/browser/chunk-BZMTFAP3.mjs.map +0 -7
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +0 -7
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +0 -177
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs +0 -36
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +0 -179
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3REUS7KW.mjs.map +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
D3ForceGraph,
|
|
2
3
|
useGraphModel
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
D3ForceGraph
|
|
6
|
-
} from "./chunk-MGBT2ZFU.mjs";
|
|
4
|
+
} from "./chunk-WX7QIZMF.mjs";
|
|
7
5
|
import "./chunk-J5LGTIGS.mjs";
|
|
8
6
|
|
|
9
|
-
// src/
|
|
7
|
+
// src/containers/ExplorerContainer/ExplorerContainer.tsx
|
|
10
8
|
import React, { useCallback, useMemo, useState } from "react";
|
|
11
9
|
import { QueryBuilder } from "@dxos/echo-query";
|
|
12
10
|
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
13
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
14
|
-
import { Toolbar } from "@dxos/react-ui";
|
|
11
|
+
import { getSpace, useObject } from "@dxos/react-client/echo";
|
|
12
|
+
import { Panel, Toolbar } from "@dxos/react-ui";
|
|
15
13
|
import { QueryEditor } from "@dxos/react-ui-components";
|
|
16
|
-
import { Layout } from "@dxos/react-ui-mosaic";
|
|
17
14
|
var ExplorerContainer = ({ role, subject: view }) => {
|
|
18
|
-
|
|
15
|
+
useObject(view);
|
|
16
|
+
const space = view && getSpace(view);
|
|
19
17
|
const [filter, setFilter] = useState();
|
|
20
18
|
const model = useGraphModel(space, filter);
|
|
21
19
|
const { match } = useGlobalSearch();
|
|
@@ -27,19 +25,24 @@ var ExplorerContainer = ({ role, subject: view }) => {
|
|
|
27
25
|
if (!space || !model) {
|
|
28
26
|
return null;
|
|
29
27
|
}
|
|
30
|
-
return /* @__PURE__ */ React.createElement(
|
|
31
|
-
role
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
return /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
29
|
+
role
|
|
30
|
+
}, showToolbar && /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
31
|
+
asChild: true
|
|
32
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(QueryEditor, {
|
|
34
33
|
db: space.db,
|
|
35
34
|
onChange: handleChange
|
|
36
|
-
})), /* @__PURE__ */ React.createElement(
|
|
35
|
+
}))), /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
36
|
+
asChild: true
|
|
37
|
+
}, /* @__PURE__ */ React.createElement(D3ForceGraph, {
|
|
37
38
|
model,
|
|
38
39
|
match
|
|
39
|
-
}));
|
|
40
|
+
})));
|
|
40
41
|
};
|
|
42
|
+
|
|
43
|
+
// src/containers/ExplorerContainer/index.ts
|
|
41
44
|
var ExplorerContainer_default = ExplorerContainer;
|
|
42
45
|
export {
|
|
43
46
|
ExplorerContainer_default as default
|
|
44
47
|
};
|
|
45
|
-
//# sourceMappingURL=ExplorerContainer-
|
|
48
|
+
//# sourceMappingURL=ExplorerContainer-JBCVWH3M.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ExplorerContainer/ExplorerContainer.tsx", "../../../src/containers/ExplorerContainer/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\nimport { type Filter } from '@dxos/echo';\nimport { type View } from '@dxos/echo';\nimport { QueryBuilder } from '@dxos/echo-query';\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace, useObject } from '@dxos/react-client/echo';\nimport { Panel, Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\n\nimport { D3ForceGraph } from '../../components';\nimport { useGraphModel } from '../../hooks';\n\nexport type ExplorerContainerProps = SurfaceComponentProps<View.View>;\n\nexport const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {\n useObject(view);\n const space = view && getSpace(view);\n const [filter, setFilter] = useState<Filter.Any>();\n const model = useGraphModel(space, filter);\n const { match } = useGlobalSearch();\n\n const builder = useMemo(() => new QueryBuilder(), []);\n const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {\n setFilter(builder.build(value).filter);\n }, []);\n\n const showToolbar = role === 'article';\n\n if (!space || !model) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n {showToolbar && (\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <QueryEditor db={space.db} onChange={handleChange} />\n </Toolbar.Root>\n </Panel.Toolbar>\n )}\n <Panel.Content asChild>\n <D3ForceGraph model={model} match={match} />\n </Panel.Content>\n </Panel.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ExplorerContainer } from './ExplorerContainer';\n\nexport default ExplorerContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,OAAOA,SAASC,aAAaC,SAASC,gBAAgB;AAKtD,SAASC,oBAAoB;AAC7B,SAASC,uBAAuB;AAChC,SAASC,UAAUC,iBAAiB;AACpC,SAASC,OAAOC,eAAe;AAC/B,SAASC,mBAA0C;AAO5C,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAA0B;AAC/EC,YAAUD,IAAAA;AACV,QAAME,QAAQF,QAAQG,SAASH,IAAAA;AAC/B,QAAM,CAACI,QAAQC,SAAAA,IAAaC,SAAAA;AAC5B,QAAMC,QAAQC,cAAcN,OAAOE,MAAAA;AACnC,QAAM,EAAEK,MAAK,IAAKC,gBAAAA;AAElB,QAAMC,UAAUC,QAAQ,MAAM,IAAIC,aAAAA,GAAgB,CAAA,CAAE;AACpD,QAAMC,eAAeC,YAAuD,CAACC,UAAAA;AAC3EX,cAAUM,QAAQM,MAAMD,KAAAA,EAAOZ,MAAM;EACvC,GAAG,CAAA,CAAE;AAEL,QAAMc,cAAcpB,SAAS;AAE7B,MAAI,CAACI,SAAS,CAACK,OAAO;AACpB,WAAO;EACT;AAEA,SACE,sBAAA,cAACY,MAAMC,MAAI;IAACtB;KACToB,eACC,sBAAA,cAACC,MAAME,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACD,QAAQD,MAAI,MACX,sBAAA,cAACG,aAAAA;IAAYC,IAAItB,MAAMsB;IAAIC,UAAUX;QAI3C,sBAAA,cAACK,MAAMO,SAAO;IAACJ,SAAAA;KACb,sBAAA,cAACK,cAAAA;IAAapB;IAAcE;;AAIpC;;;AC9CA,IAAA,4BAAemB;",
|
|
6
|
+
"names": ["React", "useCallback", "useMemo", "useState", "QueryBuilder", "useGlobalSearch", "getSpace", "useObject", "Panel", "Toolbar", "QueryEditor", "ExplorerContainer", "role", "subject", "view", "useObject", "space", "getSpace", "filter", "setFilter", "useState", "model", "useGraphModel", "match", "useGlobalSearch", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "showToolbar", "Panel", "Root", "Toolbar", "asChild", "QueryEditor", "db", "onChange", "Content", "D3ForceGraph", "ExplorerContainer"]
|
|
7
|
+
}
|
|
@@ -21,9 +21,6 @@ var GraphProps = Schema.Struct({
|
|
|
21
21
|
],
|
|
22
22
|
kind: [
|
|
23
23
|
"user"
|
|
24
|
-
],
|
|
25
|
-
registered: [
|
|
26
|
-
"registered"
|
|
27
24
|
]
|
|
28
25
|
}), Schema.optional)
|
|
29
26
|
});
|
|
@@ -32,23 +29,23 @@ var GraphProps = Schema.Struct({
|
|
|
32
29
|
var Graph_exports = {};
|
|
33
30
|
__export(Graph_exports, {
|
|
34
31
|
Graph: () => Graph,
|
|
35
|
-
GraphV1: () => GraphV1,
|
|
36
32
|
make: () => make
|
|
37
33
|
});
|
|
38
34
|
import * as Schema2 from "effect/Schema";
|
|
39
35
|
import { Filter, Obj, Query, QueryAST, Ref, Type } from "@dxos/echo";
|
|
36
|
+
import { View } from "@dxos/echo";
|
|
40
37
|
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
41
|
-
import {
|
|
38
|
+
import { ViewAnnotation } from "@dxos/schema";
|
|
42
39
|
var GraphSchema = Schema2.Struct({
|
|
43
40
|
name: Schema2.optional(Schema2.String),
|
|
44
|
-
view:
|
|
41
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
45
42
|
query: Schema2.Struct({
|
|
46
43
|
raw: Schema2.optional(Schema2.String),
|
|
47
44
|
ast: QueryAST.Query
|
|
48
45
|
}).pipe(FormInputAnnotation.set(false))
|
|
49
46
|
}).pipe(Type.object({
|
|
50
|
-
typename: "dxos.
|
|
51
|
-
version: "0.
|
|
47
|
+
typename: "org.dxos.type.graph",
|
|
48
|
+
version: "0.1.0"
|
|
52
49
|
}), LabelAnnotation.set([
|
|
53
50
|
"name"
|
|
54
51
|
]), ViewAnnotation.set(true));
|
|
@@ -63,21 +60,9 @@ var make = ({ name, query = {
|
|
|
63
60
|
query
|
|
64
61
|
});
|
|
65
62
|
};
|
|
66
|
-
var GraphV1 = Schema2.Struct({
|
|
67
|
-
name: Schema2.optional(Schema2.String),
|
|
68
|
-
query: Schema2.Struct({
|
|
69
|
-
raw: Schema2.optional(Schema2.String),
|
|
70
|
-
ast: QueryAST.Query
|
|
71
|
-
})
|
|
72
|
-
}).pipe(Type.object({
|
|
73
|
-
typename: "dxos.org/type/Graph",
|
|
74
|
-
version: "0.1.0"
|
|
75
|
-
}), LabelAnnotation.set([
|
|
76
|
-
"name"
|
|
77
|
-
]));
|
|
78
63
|
|
|
79
64
|
export {
|
|
80
65
|
ExplorerAction_exports,
|
|
81
66
|
Graph_exports
|
|
82
67
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-3Y7INKYN.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n }),\n Schema.optional,\n ),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\nexport interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}\nexport const Graph: Type.Obj<Graph> = GraphSchema as any;\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps): Graph => {\n return Obj.make(Graph, { name, view: Ref.make(view), query });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kCAAkC;AAEpC,IAAMC,aAAoBC,cAAO;EACtCC,MAAaC,gBAAgBC,aAAM;;EAEnCC,UAAiBD,cAAOE,KACfC,mBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;EACT,CAAA,GACOT,eAAQ;AAEnB,CAAA;;;ACnBA;;;;;AAIA,YAAYU,aAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,YAAY;AACxD,SAASC,YAAY;AACrB,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,sBAAsB;AAE/B,IAAMC,cAAqBC,eAAO;EAChCC,MAAaC,iBAAgBC,cAAM;EAEnCC,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEtDC,OAAcV,eAAO;IACnBW,KAAYT,iBAAgBC,cAAM;IAClCS,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;AAClC,CAAA,EAAGF,KACDQ,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,GAC5BW,eAAeX,IAAI,IAAA,CAAA;AAGd,IAAMY,QAAyBtB;AAS/B,IAAMuB,OAAO,CAAC,EACnBrB,MACAS,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMS,OAAOC,OAAOC,QAAO,CAAA,EAAIb;AAAI,GAC3DR,KAAI,MACM;AACV,SAAOsB,IAAIJ,KAAKD,OAAO;IAAEpB;IAAMG,MAAMC,IAAIiB,KAAKlB,IAAAA;IAAOM;EAAM,CAAA;AAC7D;",
|
|
6
|
+
"names": ["Schema", "TypeInputOptionsAnnotation", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "Schema", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "Obj"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/meta.ts
|
|
2
2
|
import { trim } from "@dxos/util";
|
|
3
3
|
var meta = {
|
|
4
|
-
id: "dxos.
|
|
4
|
+
id: "org.dxos.plugin.explorer",
|
|
5
5
|
name: "Explorer",
|
|
6
6
|
description: trim`
|
|
7
7
|
Interactive hypergraph visualization that reveals relationships between objects in your workspace.
|
|
@@ -21,4 +21,4 @@ var meta = {
|
|
|
21
21
|
export {
|
|
22
22
|
meta
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-LSUP47BZ.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.explorer',\n name: 'Explorer',\n description: trim`\n Interactive hypergraph visualization that reveals relationships between objects in your workspace.\n Navigate complex data structures and discover connections through a dynamic network view.\n `,\n icon: 'ph--graph--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
|
|
5
5
|
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
6
|
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags", "screenshots"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
1
|
// src/components/Chart/Chart.tsx
|
|
4
2
|
import * as Plot from "@observablehq/plot";
|
|
5
3
|
import React, { useEffect } from "react";
|
|
@@ -10822,11 +10820,184 @@ var Globe = ({ items = [], accessor, projection = "orthographic", options = defa
|
|
|
10822
10820
|
});
|
|
10823
10821
|
};
|
|
10824
10822
|
|
|
10823
|
+
// src/components/Graph/D3ForceGraph.tsx
|
|
10824
|
+
import React3, { useCallback, useEffect as useEffect3, useMemo, useRef } from "react";
|
|
10825
|
+
import { Obj } from "@dxos/echo";
|
|
10826
|
+
import { SelectionModel } from "@dxos/graph";
|
|
10827
|
+
import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
|
|
10828
|
+
import { getHashStyles } from "@dxos/ui-theme";
|
|
10829
|
+
import "@dxos/react-ui-graph/styles/graph.css";
|
|
10830
|
+
var D3ForceGraph = ({ classNames, model, selection: _selection, grid, drag, ...props }) => {
|
|
10831
|
+
const context = useRef(null);
|
|
10832
|
+
const projector = useMemo(() => {
|
|
10833
|
+
if (context.current) {
|
|
10834
|
+
return new GraphForceProjector(context.current, {
|
|
10835
|
+
attributes: {
|
|
10836
|
+
linkForce: (edge) => {
|
|
10837
|
+
return edge.data?.object?.active !== false;
|
|
10838
|
+
}
|
|
10839
|
+
},
|
|
10840
|
+
forces: {
|
|
10841
|
+
point: {
|
|
10842
|
+
strength: 0.01
|
|
10843
|
+
}
|
|
10844
|
+
}
|
|
10845
|
+
});
|
|
10846
|
+
}
|
|
10847
|
+
}, [
|
|
10848
|
+
context.current
|
|
10849
|
+
]);
|
|
10850
|
+
const graph = useRef(null);
|
|
10851
|
+
const selection = useMemo(() => _selection ?? new SelectionModel(), [
|
|
10852
|
+
_selection
|
|
10853
|
+
]);
|
|
10854
|
+
useEffect3(() => selection.subscribe(() => graph.current?.repaint()), [
|
|
10855
|
+
selection
|
|
10856
|
+
]);
|
|
10857
|
+
const handleSelect = useCallback((node) => {
|
|
10858
|
+
if (selection.contains(node.id)) {
|
|
10859
|
+
selection.remove(node.id);
|
|
10860
|
+
} else {
|
|
10861
|
+
selection.add(node.id);
|
|
10862
|
+
}
|
|
10863
|
+
}, [
|
|
10864
|
+
selection
|
|
10865
|
+
]);
|
|
10866
|
+
return /* @__PURE__ */ React3.createElement(SVG.Root, {
|
|
10867
|
+
ref: context,
|
|
10868
|
+
classNames,
|
|
10869
|
+
...props
|
|
10870
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React3.createElement(SVG.Grid, {
|
|
10871
|
+
axis: true
|
|
10872
|
+
}), /* @__PURE__ */ React3.createElement(SVG.Zoom, {
|
|
10873
|
+
extent: [
|
|
10874
|
+
1 / 2,
|
|
10875
|
+
2
|
|
10876
|
+
]
|
|
10877
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Graph, {
|
|
10878
|
+
drag,
|
|
10879
|
+
ref: graph,
|
|
10880
|
+
model,
|
|
10881
|
+
projector,
|
|
10882
|
+
labels: {
|
|
10883
|
+
text: (node) => {
|
|
10884
|
+
return node.data?.data.label ?? node.id;
|
|
10885
|
+
}
|
|
10886
|
+
},
|
|
10887
|
+
attributes: {
|
|
10888
|
+
node: (node) => {
|
|
10889
|
+
const obj = node.data?.data.object;
|
|
10890
|
+
return {
|
|
10891
|
+
data: {
|
|
10892
|
+
color: getHashStyles(obj && Obj.getTypename(obj))?.hue
|
|
10893
|
+
},
|
|
10894
|
+
classes: {
|
|
10895
|
+
"dx-selected": selection.contains(node.id)
|
|
10896
|
+
}
|
|
10897
|
+
};
|
|
10898
|
+
}
|
|
10899
|
+
},
|
|
10900
|
+
onSelect: handleSelect
|
|
10901
|
+
})));
|
|
10902
|
+
};
|
|
10903
|
+
|
|
10904
|
+
// src/components/Graph/ForceGraph.tsx
|
|
10905
|
+
import { forceLink, forceManyBody } from "d3";
|
|
10906
|
+
import NativeForceGraph from "force-graph";
|
|
10907
|
+
import React4, { useEffect as useEffect4, useRef as useRef2, useState } from "react";
|
|
10908
|
+
import { useResizeDetector as useResizeDetector3 } from "react-resize-detector";
|
|
10909
|
+
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
10910
|
+
|
|
10911
|
+
// src/components/Graph/adapter.ts
|
|
10912
|
+
var GraphAdapter = class {
|
|
10913
|
+
graph;
|
|
10914
|
+
_nodes = [];
|
|
10915
|
+
_links = [];
|
|
10916
|
+
constructor(graph) {
|
|
10917
|
+
this.graph = graph;
|
|
10918
|
+
this._nodes = graph.nodes.map((node) => ({
|
|
10919
|
+
id: node.id,
|
|
10920
|
+
type: node.type,
|
|
10921
|
+
data: node.data
|
|
10922
|
+
}));
|
|
10923
|
+
const nodeIds = new Set(this._nodes.map((node) => node.id));
|
|
10924
|
+
this._links = graph.edges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target)).map((edge) => ({
|
|
10925
|
+
type: edge.type,
|
|
10926
|
+
source: edge.source,
|
|
10927
|
+
target: edge.target,
|
|
10928
|
+
data: edge.data
|
|
10929
|
+
}));
|
|
10930
|
+
}
|
|
10931
|
+
get nodes() {
|
|
10932
|
+
return this._nodes;
|
|
10933
|
+
}
|
|
10934
|
+
get links() {
|
|
10935
|
+
return this._links;
|
|
10936
|
+
}
|
|
10937
|
+
};
|
|
10938
|
+
|
|
10939
|
+
// src/components/Graph/ForceGraph.tsx
|
|
10940
|
+
var ForceGraph = ({ model, match }) => {
|
|
10941
|
+
const { ref, width, height } = useResizeDetector3({
|
|
10942
|
+
refreshRate: 200
|
|
10943
|
+
});
|
|
10944
|
+
const rootRef = useRef2(null);
|
|
10945
|
+
const forceGraph = useRef2(null);
|
|
10946
|
+
const filteredRef = useRef2([]);
|
|
10947
|
+
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
10948
|
+
const [data, setData] = useState();
|
|
10949
|
+
useEffect4(() => {
|
|
10950
|
+
return model?.subscribe((model2) => {
|
|
10951
|
+
setData(new GraphAdapter(model2.graph));
|
|
10952
|
+
});
|
|
10953
|
+
}, [
|
|
10954
|
+
model
|
|
10955
|
+
]);
|
|
10956
|
+
useEffect4(() => {
|
|
10957
|
+
if (rootRef.current) {
|
|
10958
|
+
forceGraph.current = new NativeForceGraph(rootRef.current).nodeRelSize(6).nodeLabel((node) => node.type === "schema" ? node.data.typename : node.data.label ?? node.id).nodeAutoColorBy((node) => node.type === "schema" ? "schema" : node.data.typename).linkAutoColorBy((link2) => link2.type);
|
|
10959
|
+
}
|
|
10960
|
+
return () => {
|
|
10961
|
+
forceGraph.current?.pauseAnimation().graphData({
|
|
10962
|
+
nodes: [],
|
|
10963
|
+
links: []
|
|
10964
|
+
});
|
|
10965
|
+
forceGraph.current = null;
|
|
10966
|
+
};
|
|
10967
|
+
}, []);
|
|
10968
|
+
useEffect4(() => {
|
|
10969
|
+
if (!data || !width || !height || !forceGraph.current) {
|
|
10970
|
+
return;
|
|
10971
|
+
}
|
|
10972
|
+
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
|
|
10973
|
+
handleZoomToFit();
|
|
10974
|
+
}).onNodeClick((node) => {
|
|
10975
|
+
forceGraph.current?.emitParticle(node);
|
|
10976
|
+
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
|
|
10977
|
+
}, [
|
|
10978
|
+
data,
|
|
10979
|
+
width,
|
|
10980
|
+
height,
|
|
10981
|
+
forceGraph.current
|
|
10982
|
+
]);
|
|
10983
|
+
const handleZoomToFit = () => {
|
|
10984
|
+
forceGraph.current?.zoomToFit(400, 40);
|
|
10985
|
+
};
|
|
10986
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
10987
|
+
ref,
|
|
10988
|
+
className: "relative grow",
|
|
10989
|
+
onClick: handleZoomToFit
|
|
10990
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
10991
|
+
ref: rootRef,
|
|
10992
|
+
className: "absolute inset-0"
|
|
10993
|
+
}));
|
|
10994
|
+
};
|
|
10995
|
+
|
|
10825
10996
|
// src/components/Tree/Tree.tsx
|
|
10826
10997
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
10827
|
-
import
|
|
10998
|
+
import React5, { useContext, useEffect as useEffect5, useRef as useRef3, useState as useState2 } from "react";
|
|
10828
10999
|
import { useAsyncState } from "@dxos/react-ui";
|
|
10829
|
-
import { SVG } from "@dxos/react-ui-graph";
|
|
11000
|
+
import { SVG as SVG2 } from "@dxos/react-ui-graph";
|
|
10830
11001
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
10831
11002
|
|
|
10832
11003
|
// src/components/Tree/layout/HierarchicalEdgeBundling.ts
|
|
@@ -10964,7 +11135,7 @@ var TidyTree_default = TidyTree;
|
|
|
10964
11135
|
|
|
10965
11136
|
// src/components/Tree/types/tree.ts
|
|
10966
11137
|
import * as Schema from "effect/Schema";
|
|
10967
|
-
import { Key, Obj, Type } from "@dxos/echo";
|
|
11138
|
+
import { Key, Obj as Obj2, Ref, Type } from "@dxos/echo";
|
|
10968
11139
|
import { TestSchema } from "@dxos/echo/testing";
|
|
10969
11140
|
import { invariant } from "@dxos/invariant";
|
|
10970
11141
|
var TreeNodeType = Schema.Struct({
|
|
@@ -10974,7 +11145,7 @@ var TreeNodeType = Schema.Struct({
|
|
|
10974
11145
|
key: Schema.String,
|
|
10975
11146
|
value: Schema.Any
|
|
10976
11147
|
})),
|
|
10977
|
-
ref: Schema.optional(
|
|
11148
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando))
|
|
10978
11149
|
}).pipe(Schema.mutable);
|
|
10979
11150
|
var TreeType = Schema.Struct({
|
|
10980
11151
|
root: Key.ObjectId,
|
|
@@ -10983,7 +11154,7 @@ var TreeType = Schema.Struct({
|
|
|
10983
11154
|
value: TreeNodeType
|
|
10984
11155
|
}))
|
|
10985
11156
|
}).pipe(Type.object({
|
|
10986
|
-
typename: "dxos.
|
|
11157
|
+
typename: "org.dxos.type.tree",
|
|
10987
11158
|
version: "0.1.0"
|
|
10988
11159
|
}));
|
|
10989
11160
|
|
|
@@ -11020,8 +11191,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11020
11191
|
selected,
|
|
11021
11192
|
registry
|
|
11022
11193
|
]);
|
|
11023
|
-
const [tree3, setTree] =
|
|
11024
|
-
|
|
11194
|
+
const [tree3, setTree] = useState2();
|
|
11195
|
+
useEffect5(() => {
|
|
11025
11196
|
return model?.subscribe(() => {
|
|
11026
11197
|
const tree4 = mapGraphToTreeData(model);
|
|
11027
11198
|
setTree(tree4);
|
|
@@ -11029,8 +11200,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11029
11200
|
}, [
|
|
11030
11201
|
model
|
|
11031
11202
|
]);
|
|
11032
|
-
const context =
|
|
11033
|
-
|
|
11203
|
+
const context = useRef3(null);
|
|
11204
|
+
useEffect5(() => {
|
|
11034
11205
|
if (context.current?.size) {
|
|
11035
11206
|
const { width, height } = context.current.size;
|
|
11036
11207
|
const size = Math.min(width, height);
|
|
@@ -11056,23 +11227,52 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11056
11227
|
context.current,
|
|
11057
11228
|
tree3
|
|
11058
11229
|
]);
|
|
11059
|
-
return /* @__PURE__ */
|
|
11230
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
11060
11231
|
className: "grow",
|
|
11061
11232
|
onClick: () => onNodeClick?.()
|
|
11062
|
-
}, /* @__PURE__ */
|
|
11233
|
+
}, /* @__PURE__ */ React5.createElement(SVG2.Root, {
|
|
11063
11234
|
ref: context
|
|
11064
11235
|
}));
|
|
11065
11236
|
};
|
|
11066
11237
|
|
|
11067
|
-
// src/
|
|
11068
|
-
import {
|
|
11069
|
-
|
|
11238
|
+
// src/hooks/useGraphModel.ts
|
|
11239
|
+
import { useEffect as useEffect6, useState as useState3 } from "react";
|
|
11240
|
+
import { Capabilities } from "@dxos/app-framework";
|
|
11241
|
+
import { useCapability } from "@dxos/app-framework/ui";
|
|
11242
|
+
import { SpaceGraphModel as SpaceGraphModel2 } from "@dxos/schema";
|
|
11243
|
+
var useGraphModel = (space, filter, options, queue) => {
|
|
11244
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
11245
|
+
const [model, setModel] = useState3(void 0);
|
|
11246
|
+
useEffect6(() => {
|
|
11247
|
+
if (!space) {
|
|
11248
|
+
void model?.close();
|
|
11249
|
+
setModel(void 0);
|
|
11250
|
+
return;
|
|
11251
|
+
}
|
|
11252
|
+
if (!model || model.queue !== queue) {
|
|
11253
|
+
const model2 = new SpaceGraphModel2(registry).setFilter(filter).setOptions(options);
|
|
11254
|
+
void model2.open(space.db, queue);
|
|
11255
|
+
setModel(model2);
|
|
11256
|
+
} else {
|
|
11257
|
+
model.setFilter(filter).setOptions(options);
|
|
11258
|
+
}
|
|
11259
|
+
}, [
|
|
11260
|
+
space,
|
|
11261
|
+
filter,
|
|
11262
|
+
options,
|
|
11263
|
+
queue,
|
|
11264
|
+
registry
|
|
11265
|
+
]);
|
|
11266
|
+
return model;
|
|
11267
|
+
};
|
|
11070
11268
|
|
|
11071
11269
|
export {
|
|
11072
11270
|
Chart,
|
|
11073
11271
|
Globe,
|
|
11272
|
+
D3ForceGraph,
|
|
11273
|
+
ForceGraph,
|
|
11074
11274
|
defaultTreeLayoutSlots,
|
|
11075
11275
|
Tree,
|
|
11076
|
-
|
|
11276
|
+
useGraphModel
|
|
11077
11277
|
};
|
|
11078
|
-
//# sourceMappingURL=chunk-
|
|
11278
|
+
//# sourceMappingURL=chunk-WX7QIZMF.mjs.map
|