@dxos/plugin-explorer 0.8.4-main.ead640a → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/dist/lib/neutral/ExplorerArticle-LLNHXWNG.mjs +420 -0
- package/dist/lib/neutral/ExplorerArticle-LLNHXWNG.mjs.map +7 -0
- package/dist/lib/neutral/ExplorerPlugin.mjs +10 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7FSP4SPO.mjs +69 -0
- package/dist/lib/neutral/chunk-7FSP4SPO.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CWN2BELW.mjs +287 -0
- package/dist/lib/neutral/chunk-CWN2BELW.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GRJXLL4Z.mjs +25 -0
- package/dist/lib/neutral/chunk-GRJXLL4Z.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IKHJV3Q4.mjs +20 -0
- package/dist/lib/neutral/chunk-IKHJV3Q4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LL3PXKB5.mjs +40 -0
- package/dist/lib/neutral/chunk-LL3PXKB5.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MOM5KCKC.mjs → neutral/components/index.mjs} +882 -556
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F6TKVAGV.mjs +39 -0
- package/dist/lib/neutral/create-object-F6TKVAGV.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +45 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +14 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/meta.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-APBW2VQG.mjs +26 -0
- package/dist/lib/neutral/react-surface-APBW2VQG.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +193 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +33 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +1 -2
- package/dist/types/data/cities.d.ts +4 -4
- package/dist/types/data/cities.d.ts.map +1 -1
- package/dist/types/data/countries-110m.d.ts +19 -22
- package/dist/types/data/countries-110m.d.ts.map +1 -1
- package/dist/types/src/ExplorerPlugin.d.ts +3 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/ExplorerPlugin.test.d.ts +2 -0
- package/dist/types/src/ExplorerPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +4 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +5 -2
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/CanvasForceGraph.d.ts +13 -0
- package/dist/types/src/components/Graph/CanvasForceGraph.d.ts.map +1 -0
- package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts +17 -0
- package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts.map +1 -0
- package/dist/types/src/components/Graph/ForceGraph.d.ts +12 -5
- package/dist/types/src/components/Graph/ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +4 -2
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/{adapter.d.ts → graph-adapter.d.ts} +2 -2
- package/dist/types/src/components/Graph/graph-adapter.d.ts.map +1 -0
- package/dist/types/src/components/Graph/index.d.ts +1 -1
- package/dist/types/src/components/Graph/index.d.ts.map +1 -1
- package/dist/types/src/components/Lattice/Lattice.d.ts +20 -0
- package/dist/types/src/components/Lattice/Lattice.d.ts.map +1 -0
- package/dist/types/src/components/Lattice/Lattice.stories.d.ts +8 -0
- package/dist/types/src/components/Lattice/Lattice.stories.d.ts.map +1 -0
- package/dist/types/src/components/Lattice/index.d.ts +2 -0
- package/dist/types/src/components/Lattice/index.d.ts.map +1 -0
- package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts +21 -0
- package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts.map +1 -0
- package/dist/types/src/components/Tree/Tree.d.ts +20 -23
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +5 -12
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/index.d.ts +2 -0
- package/dist/types/src/components/Tree/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts +37 -2
- package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/RadialTree.d.ts +35 -2
- package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/TidyTree.d.ts +24 -2
- package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/hierarchy.d.ts +17 -0
- package/dist/types/src/components/Tree/layout/hierarchy.d.ts.map +1 -0
- package/dist/types/src/components/Tree/layout/index.d.ts +5 -4
- package/dist/types/src/components/Tree/layout/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/slots.d.ts +7 -0
- package/dist/types/src/components/Tree/layout/slots.d.ts.map +1 -0
- package/dist/types/src/components/Tree/layout/useContainerSize.d.ts +15 -0
- package/dist/types/src/components/Tree/layout/useContainerSize.d.ts.map +1 -0
- package/dist/types/src/components/Tree/types/tree.d.ts +45 -22
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts +14 -4
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +13 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts +30 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts +24 -0
- package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/experimental.stories.d.ts +7 -0
- package/dist/types/src/containers/ExplorerArticle/experimental.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ExplorerArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/variants.d.ts +9 -0
- package/dist/types/src/containers/ExplorerArticle/variants.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 +2 -2
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/{components/Tree/testing → testing}/generator.d.ts +1 -1
- package/dist/types/src/testing/generator.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/relations.d.ts +47 -0
- package/dist/types/src/testing/relations.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +31 -22
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts +1 -18
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +14 -25
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +3 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/node-color.d.ts +13 -0
- package/dist/types/src/util/node-color.d.ts.map +1 -0
- package/dist/types/src/{components → util}/plot.d.ts +1 -1
- package/dist/types/src/util/plot.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +114 -61
- package/src/ExplorerPlugin.test.ts +26 -0
- package/src/ExplorerPlugin.tsx +15 -56
- package/src/capabilities/create-object.ts +36 -0
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/react-surface.tsx +24 -19
- package/src/components/Chart/Chart.stories.tsx +16 -23
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/Globe/Globe.stories.tsx +19 -22
- package/src/components/Globe/Globe.tsx +1 -1
- package/src/components/Graph/CanvasForceGraph.stories.tsx +83 -0
- package/src/components/Graph/CanvasForceGraph.tsx +124 -0
- package/src/components/Graph/ForceGraph.stories.tsx +83 -41
- package/src/components/Graph/ForceGraph.tsx +105 -85
- package/src/components/Graph/{adapter.ts → graph-adapter.ts} +14 -8
- package/src/components/Graph/index.ts +1 -1
- package/src/components/Lattice/Lattice.stories.tsx +90 -0
- package/src/components/Lattice/Lattice.tsx +182 -0
- package/src/components/Lattice/index.ts +5 -0
- package/src/components/Tree/EdgeBundling.stories.tsx +144 -0
- package/src/components/Tree/Tree.stories.tsx +20 -38
- package/src/components/Tree/Tree.tsx +69 -95
- package/src/components/Tree/index.ts +2 -0
- package/src/components/Tree/layout/HierarchicalEdgeBundling.tsx +335 -0
- package/src/components/Tree/layout/RadialTree.tsx +242 -0
- package/src/components/Tree/layout/TidyTree.tsx +246 -0
- package/src/components/Tree/layout/hierarchy.ts +32 -0
- package/src/components/Tree/layout/index.ts +5 -5
- package/src/components/Tree/layout/slots.ts +19 -0
- package/src/components/Tree/layout/useContainerSize.ts +43 -0
- package/src/components/Tree/types/tree.test.ts +8 -7
- package/src/components/Tree/types/tree.ts +42 -26
- package/src/components/Tree/types/types.ts +38 -29
- package/src/components/index.ts +1 -4
- package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +142 -0
- package/src/containers/ExplorerArticle/ExplorerArticle.tsx +112 -0
- package/src/containers/ExplorerArticle/Visualization.tsx +497 -0
- package/src/containers/ExplorerArticle/experimental.stories.tsx +446 -0
- package/src/containers/ExplorerArticle/index.ts +5 -0
- package/src/containers/ExplorerArticle/variants.ts +37 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +25 -14
- package/src/index.ts +1 -4
- package/src/meta.ts +28 -5
- package/src/plugin.ts +9 -0
- package/src/{components/Tree/testing → testing}/generator.ts +5 -3
- package/src/testing/index.ts +9 -0
- package/src/testing/relations.ts +192 -0
- package/src/translations.ts +16 -13
- package/src/types/ExplorerAction.ts +10 -19
- package/src/types/Graph.ts +25 -24
- package/src/typings.d.ts +8 -0
- package/src/util/index.ts +6 -0
- package/src/util/node-color.ts +23 -0
- package/src/{components → util}/plot.ts +16 -4
- package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs +0 -50
- package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs.map +0 -7
- package/dist/lib/browser/chunk-2DGFNLRO.mjs +0 -19
- package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-BZ65T5M3.mjs +0 -79
- package/dist/lib/browser/chunk-BZ65T5M3.mjs.map +0 -7
- package/dist/lib/browser/chunk-MOM5KCKC.mjs.map +0 -7
- package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
- package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -119
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-K57C3LIX.mjs +0 -31
- package/dist/lib/browser/intent-resolver-K57C3LIX.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-OPBND5W3.mjs +0 -35
- package/dist/lib/browser/react-surface-OPBND5W3.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs +0 -51
- package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ES6AOMCY.mjs +0 -80
- package/dist/lib/node-esm/chunk-ES6AOMCY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PX6LHR2N.mjs +0 -21
- package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs +0 -11343
- package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -120
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs +0 -32
- package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/meta.mjs +0 -9
- package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs +0 -36
- package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -12
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +0 -9
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +0 -14
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +0 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +0 -15
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +0 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +0 -1
- package/dist/types/src/components/Graph/testing.d.ts +0 -14
- package/dist/types/src/components/Graph/testing.d.ts.map +0 -1
- package/dist/types/src/components/Tree/testing/generator.d.ts.map +0 -1
- package/dist/types/src/components/Tree/testing/index.d.ts +0 -2
- package/dist/types/src/components/Tree/testing/index.d.ts.map +0 -1
- package/dist/types/src/components/plot.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -21
- package/src/components/ExplorerContainer.tsx +0 -54
- package/src/components/Graph/D3ForceGraph.stories.tsx +0 -77
- package/src/components/Graph/D3ForceGraph.tsx +0 -101
- package/src/components/Graph/testing.ts +0 -55
- package/src/components/Tree/layout/HierarchicalEdgeBundling.ts +0 -162
- package/src/components/Tree/layout/RadialTree.ts +0 -94
- package/src/components/Tree/layout/TidyTree.ts +0 -101
- package/src/components/Tree/testing/index.ts +0 -5
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/ExplorerPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser/meta.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/meta.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/ExplorerAction.ts
|
|
6
|
+
var ExplorerAction_exports = {};
|
|
7
|
+
__export(ExplorerAction_exports, {
|
|
8
|
+
GraphProps: () => GraphProps
|
|
9
|
+
});
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import { TypeInputOptionsAnnotation } from "@dxos/plugin-space";
|
|
12
|
+
var GraphProps = Schema.Struct({
|
|
13
|
+
name: Schema.optional(Schema.String),
|
|
14
|
+
// TODO(wittjosiah): This should be a query input instead.
|
|
15
|
+
typename: Schema.String.pipe(Schema.annotations({
|
|
16
|
+
title: "Select type"
|
|
17
|
+
}), TypeInputOptionsAnnotation.set({
|
|
18
|
+
location: [
|
|
19
|
+
"database",
|
|
20
|
+
"runtime"
|
|
21
|
+
],
|
|
22
|
+
kind: [
|
|
23
|
+
"user"
|
|
24
|
+
]
|
|
25
|
+
}), Schema.optional)
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/types/Graph.ts
|
|
29
|
+
var Graph_exports = {};
|
|
30
|
+
__export(Graph_exports, {
|
|
31
|
+
Graph: () => Graph,
|
|
32
|
+
make: () => make
|
|
33
|
+
});
|
|
34
|
+
import * as Schema2 from "effect/Schema";
|
|
35
|
+
import { DXN, Annotation, Filter, Obj, Query, QueryAST, Ref, Type, View } from "@dxos/echo";
|
|
36
|
+
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
37
|
+
import { ViewAnnotation } from "@dxos/schema";
|
|
38
|
+
var GraphSchema = Schema2.Struct({
|
|
39
|
+
name: Schema2.optional(Schema2.String),
|
|
40
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
41
|
+
query: Schema2.Struct({
|
|
42
|
+
raw: Schema2.optional(Schema2.String),
|
|
43
|
+
ast: QueryAST.Query
|
|
44
|
+
}).pipe(FormInputAnnotation.set(false))
|
|
45
|
+
}).pipe(LabelAnnotation.set([
|
|
46
|
+
"name"
|
|
47
|
+
]), ViewAnnotation.set([
|
|
48
|
+
"view"
|
|
49
|
+
]), Annotation.IconAnnotation.set({
|
|
50
|
+
icon: "ph--graph--regular",
|
|
51
|
+
hue: "green"
|
|
52
|
+
}), Type.makeObject(DXN.make("org.dxos.type.graph", "0.1.0")));
|
|
53
|
+
var Graph = GraphSchema;
|
|
54
|
+
var make = ({ name, query = {
|
|
55
|
+
raw: "",
|
|
56
|
+
ast: Query.select(Filter.nothing()).ast
|
|
57
|
+
}, view }) => {
|
|
58
|
+
return Obj.make(Graph, {
|
|
59
|
+
name,
|
|
60
|
+
view: Ref.make(view),
|
|
61
|
+
query
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
ExplorerAction_exports,
|
|
67
|
+
Graph_exports
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=chunk-7FSP4SPO.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';\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 { DXN, Annotation, Filter, Obj, Query, QueryAST, Ref, Type, 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 LabelAnnotation.set(['name']),\n ViewAnnotation.set(['view']),\n Annotation.IconAnnotation.set({\n icon: 'ph--graph--regular',\n hue: 'green',\n }),\n Type.makeObject(DXN.make('org.dxos.type.graph', '0.1.0')),\n);\n// TODO(wittjosiah): Try to clean up this type inference.\nexport interface Graph extends Type.InstanceType<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,GAC1CT,2BAA2BU,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;EACT,CAAA,GACOR,eAAQ;AAEnB,CAAA;;;ACnBA;;;;;AAIA,YAAYS,aAAY;AAExB,SAASC,KAAKC,YAAYC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,MAAMC,YAAY;AAC/E,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,sBAAsB;AAE/B,IAAMC,cAAqBC,eAAO;EAChCC,MAAaC,iBAAgBC,cAAM;EAEnCC,MAAMX,IAAIA,IAAIE,KAAKA,IAAI,EAAEU,KAAKT,oBAAoBU,IAAI,KAAA,CAAA;EAEtDC,OAAcP,eAAO;IACnBQ,KAAYN,iBAAgBC,cAAM;IAClCM,KAAKjB,SAASD;EAChB,CAAA,EAAGc,KAAKT,oBAAoBU,IAAI,KAAA,CAAA;AAClC,CAAA,EAAGD,KACDR,gBAAgBS,IAAI;EAAC;CAAO,GAC5BR,eAAeQ,IAAI;EAAC;CAAO,GAC3BlB,WAAWsB,eAAeJ,IAAI;EAC5BK,MAAM;EACNC,KAAK;AACP,CAAA,GACAlB,KAAKmB,WAAW1B,IAAI2B,KAAK,uBAAuB,OAAA,CAAA,CAAA;AAI3C,IAAMC,QAAyBhB;AAS/B,IAAMe,OAAO,CAAC,EACnBb,MACAM,QAAQ;EAAEC,KAAK;EAAIC,KAAKlB,MAAMyB,OAAO3B,OAAO4B,QAAO,CAAA,EAAIR;AAAI,GAC3DL,KAAI,MACM;AACV,SAAOd,IAAIwB,KAAKC,OAAO;IAAEd;IAAMG,MAAMX,IAAIqB,KAAKV,IAAAA;IAAOG;EAAM,CAAA;AAC7D;",
|
|
6
|
+
"names": ["Schema", "TypeInputOptionsAnnotation", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "set", "location", "kind", "Schema", "DXN", "Annotation", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "pipe", "set", "query", "raw", "ast", "IconAnnotation", "icon", "hue", "makeObject", "make", "Graph", "select", "nothing"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// src/components/Tree/types/types.ts
|
|
2
|
+
var treeTypeToTreeNode = (tree, rootId = tree.root, visited = /* @__PURE__ */ new Set()) => {
|
|
3
|
+
const node = tree.nodes[rootId];
|
|
4
|
+
if (!node) {
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
if (visited.has(rootId)) {
|
|
8
|
+
return {
|
|
9
|
+
id: rootId,
|
|
10
|
+
label: labelOf(node),
|
|
11
|
+
data: node.data
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
visited.add(rootId);
|
|
15
|
+
return {
|
|
16
|
+
id: rootId,
|
|
17
|
+
label: labelOf(node),
|
|
18
|
+
data: node.data,
|
|
19
|
+
children: node.children.map((childId) => treeTypeToTreeNode(tree, childId, visited)).filter((c) => Boolean(c))
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var labelOf = (node) => {
|
|
23
|
+
return typeof node.data?.text === "string" ? node.data.text : void 0;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/components/Tree/types/tree.ts
|
|
27
|
+
import * as Schema from "effect/Schema";
|
|
28
|
+
import { DXN, Key, Obj, Ref, Type } from "@dxos/echo";
|
|
29
|
+
import { TestSchema } from "@dxos/echo/testing";
|
|
30
|
+
import { invariant } from "@dxos/invariant";
|
|
31
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-explorer/src/components/Tree/types/tree.ts";
|
|
32
|
+
var TreeNodeType = Schema.Struct({
|
|
33
|
+
id: Key.ObjectId,
|
|
34
|
+
children: Schema.mutable(Schema.Array(Key.ObjectId)),
|
|
35
|
+
data: Schema.mutable(Schema.Record({
|
|
36
|
+
key: Schema.String,
|
|
37
|
+
value: Schema.Any
|
|
38
|
+
})),
|
|
39
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando))
|
|
40
|
+
}).pipe(Schema.mutable);
|
|
41
|
+
var TreeType = Schema.Struct({
|
|
42
|
+
root: Key.ObjectId,
|
|
43
|
+
nodes: Schema.mutable(Schema.Record({
|
|
44
|
+
key: Key.ObjectId,
|
|
45
|
+
value: TreeNodeType
|
|
46
|
+
}))
|
|
47
|
+
}).pipe(Type.makeObject(DXN.make("org.dxos.type.tree", "0.1.0")));
|
|
48
|
+
var Tree = class _Tree {
|
|
49
|
+
static create = () => {
|
|
50
|
+
const id = Key.ObjectId.random();
|
|
51
|
+
return Obj.make(TreeType, {
|
|
52
|
+
root: id,
|
|
53
|
+
nodes: {
|
|
54
|
+
[id]: {
|
|
55
|
+
id,
|
|
56
|
+
children: [],
|
|
57
|
+
data: {
|
|
58
|
+
text: ""
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
_tree;
|
|
65
|
+
constructor(tree) {
|
|
66
|
+
this._tree = tree ?? _Tree.create();
|
|
67
|
+
}
|
|
68
|
+
get tree() {
|
|
69
|
+
return this._tree;
|
|
70
|
+
}
|
|
71
|
+
// TODO(burdon): Make reactive.
|
|
72
|
+
get size() {
|
|
73
|
+
return Object.keys(this._tree.nodes).length;
|
|
74
|
+
}
|
|
75
|
+
get root() {
|
|
76
|
+
return this.getNode(this._tree.root);
|
|
77
|
+
}
|
|
78
|
+
//
|
|
79
|
+
// Traversal
|
|
80
|
+
//
|
|
81
|
+
/**
|
|
82
|
+
* Recursively traverse the tree until the callback returns a value.
|
|
83
|
+
*/
|
|
84
|
+
tranverse(callback, root = this._tree.root, depth = 0) {
|
|
85
|
+
const node = this._tree.nodes[root];
|
|
86
|
+
const result = callback(node, depth);
|
|
87
|
+
if (result !== void 0) {
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
for (const childId of node.children) {
|
|
91
|
+
const result2 = this.tranverse(callback, childId, depth + 1);
|
|
92
|
+
if (result2 !== void 0) {
|
|
93
|
+
return result2;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
getNode(id) {
|
|
98
|
+
const node = this._tree.nodes[id];
|
|
99
|
+
invariant(node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 77, S: this, A: ["node", ""] });
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the children of a node.
|
|
104
|
+
*/
|
|
105
|
+
getChildNodes(node) {
|
|
106
|
+
return node.children.map((id) => this.getNode(id));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get the parent of a node.
|
|
110
|
+
*/
|
|
111
|
+
getParent(node) {
|
|
112
|
+
const parent = this.tranverse((n) => {
|
|
113
|
+
if (n.children.includes(node.id)) {
|
|
114
|
+
return n;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return parent ?? null;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the next node in the tree.
|
|
121
|
+
*/
|
|
122
|
+
getNext(node, hierarchical = true) {
|
|
123
|
+
if (hierarchical && node.children.length) {
|
|
124
|
+
return this.getChildNodes(node)[0];
|
|
125
|
+
} else {
|
|
126
|
+
const parent = this.getParent(node);
|
|
127
|
+
if (parent) {
|
|
128
|
+
const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
|
|
129
|
+
if (idx < parent.children.length - 1) {
|
|
130
|
+
return this.getNode(parent.children[idx + 1]);
|
|
131
|
+
} else {
|
|
132
|
+
return this.getNext(parent, false);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the previous node in the tree.
|
|
139
|
+
*/
|
|
140
|
+
getPrevious(node, hierarchical = true) {
|
|
141
|
+
const parent = this.getParent(node);
|
|
142
|
+
const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
|
|
143
|
+
if (idx === 0) {
|
|
144
|
+
if (hierarchical) {
|
|
145
|
+
return parent;
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
const previous = this.getNode(parent.children[idx - 1]);
|
|
149
|
+
if (hierarchical && previous.children.length) {
|
|
150
|
+
return this.getLastDescendent(previous);
|
|
151
|
+
}
|
|
152
|
+
return previous;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get the last descendent of a node.
|
|
157
|
+
*/
|
|
158
|
+
getLastDescendent(node) {
|
|
159
|
+
const children = this.getChildNodes(node);
|
|
160
|
+
const last = children.length ? children[children.length - 1] : void 0;
|
|
161
|
+
if (last) {
|
|
162
|
+
return this.getLastDescendent(last);
|
|
163
|
+
}
|
|
164
|
+
return node;
|
|
165
|
+
}
|
|
166
|
+
//
|
|
167
|
+
// Mutations
|
|
168
|
+
//
|
|
169
|
+
/**
|
|
170
|
+
* Clear tree.
|
|
171
|
+
*/
|
|
172
|
+
clear() {
|
|
173
|
+
const root = this._tree.nodes[this._tree.root];
|
|
174
|
+
root.children.length = 0;
|
|
175
|
+
Obj.update(this._tree, (obj) => {
|
|
176
|
+
obj.nodes = {
|
|
177
|
+
[root.id]: root
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Add node.
|
|
183
|
+
*/
|
|
184
|
+
addNode(parent, node, index) {
|
|
185
|
+
if (!node) {
|
|
186
|
+
const id = Key.ObjectId.random();
|
|
187
|
+
node = {
|
|
188
|
+
id,
|
|
189
|
+
children: [],
|
|
190
|
+
data: {
|
|
191
|
+
text: ""
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const nodeToAdd = node;
|
|
196
|
+
Obj.update(this._tree, (obj) => {
|
|
197
|
+
obj.nodes[nodeToAdd.id] = nodeToAdd;
|
|
198
|
+
parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);
|
|
199
|
+
});
|
|
200
|
+
return node;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Delete node.
|
|
204
|
+
*/
|
|
205
|
+
deleteNode(parent, id) {
|
|
206
|
+
const node = this._tree.nodes[id];
|
|
207
|
+
if (!node) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
Obj.update(this._tree, (obj) => {
|
|
211
|
+
delete obj.nodes[node.id];
|
|
212
|
+
});
|
|
213
|
+
const idx = parent.children.findIndex((child) => child === id);
|
|
214
|
+
if (idx !== -1) {
|
|
215
|
+
Obj.update(this._tree, () => {
|
|
216
|
+
parent.children.splice(idx, 1);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return node;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Move child node.
|
|
223
|
+
*/
|
|
224
|
+
moveNode(node, from, to) {
|
|
225
|
+
invariant(from >= 0 && from < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 197, S: this, A: ["from >= 0 && from < node.children.length", ""] });
|
|
226
|
+
invariant(to >= 0 && to < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 198, S: this, A: ["to >= 0 && to < node.children.length", ""] });
|
|
227
|
+
if (from === to) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
const child = node.children[from];
|
|
231
|
+
Obj.update(this._tree, () => {
|
|
232
|
+
node.children.splice(from, 1);
|
|
233
|
+
node.children.splice(to, 0, child);
|
|
234
|
+
});
|
|
235
|
+
return this.getNode(child);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Indent node.
|
|
239
|
+
*/
|
|
240
|
+
indentNode(node) {
|
|
241
|
+
const parent = this.getParent(node);
|
|
242
|
+
if (!parent) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const idx = parent.children.findIndex((child) => child === node.id);
|
|
246
|
+
if (idx < 1 || idx >= parent.children.length) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const previous = this.getNode(parent.children[idx - 1]);
|
|
250
|
+
Obj.update(this._tree, () => {
|
|
251
|
+
parent.children.splice(idx, 1);
|
|
252
|
+
previous.children.push(node.id);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Unindent node.
|
|
257
|
+
*/
|
|
258
|
+
unindentNode(node) {
|
|
259
|
+
const parent = this.getParent(node);
|
|
260
|
+
if (!parent) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const ancestor = this.getParent(parent);
|
|
264
|
+
if (!ancestor) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const nodeIdx = parent.children.findIndex((id) => id === node.id);
|
|
268
|
+
let rest = [];
|
|
269
|
+
Obj.update(this._tree, () => {
|
|
270
|
+
const removed = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);
|
|
271
|
+
rest = removed.slice(1);
|
|
272
|
+
});
|
|
273
|
+
const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);
|
|
274
|
+
Obj.update(this._tree, () => {
|
|
275
|
+
ancestor.children.splice(parentIdx + 1, 0, node.id);
|
|
276
|
+
});
|
|
277
|
+
Obj.update(this._tree, () => {
|
|
278
|
+
node.children.push(...rest);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export {
|
|
284
|
+
Tree,
|
|
285
|
+
treeTypeToTreeNode
|
|
286
|
+
};
|
|
287
|
+
//# sourceMappingURL=chunk-CWN2BELW.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Tree/types/types.ts", "../../../src/components/Tree/types/tree.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Key } from '@dxos/echo';\n\nimport { type TreeType } from './tree';\n\n/**\n * In-memory tree shape used by the d3 layouts.\n * `data` carries through to layout callbacks (e.g. hover/inspect) — typically an ECHO object on leaves.\n */\nexport type TreeNode<TData = unknown> = {\n id: string;\n label?: string;\n data?: TData;\n children?: TreeNode<TData>[];\n};\n\n/**\n * Convert an ECHO `TreeType` (id-keyed node map) into a nested `TreeNode` hierarchy.\n * Returns `undefined` if the root id is missing — the tree is then incomplete and shouldn't render.\n */\nexport const treeTypeToTreeNode = (\n tree: TreeType,\n rootId: Key.ObjectId = tree.root,\n visited: Set<string> = new Set(),\n): TreeNode | undefined => {\n const node = tree.nodes[rootId];\n if (!node) {\n return undefined;\n }\n if (visited.has(rootId)) {\n return { id: rootId, label: labelOf(node), data: node.data };\n }\n visited.add(rootId);\n\n return {\n id: rootId,\n label: labelOf(node),\n data: node.data,\n children: node.children\n .map((childId) => treeTypeToTreeNode(tree, childId, visited))\n .filter((c): c is TreeNode => Boolean(c)),\n };\n};\n\nconst labelOf = (node: { data: Record<string, any> }): string | undefined => {\n return typeof node.data?.text === 'string' ? node.data.text : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Key, Obj, Ref, Type } from '@dxos/echo';\nimport { TestSchema } from '@dxos/echo/testing';\nimport { invariant } from '@dxos/invariant';\n\n// TODO(burdon): Reconcile with @dxos/graph (i.e., common types).\n\nexport const TreeNodeType = Schema.Struct({\n id: Key.ObjectId,\n children: Schema.mutable(Schema.Array(Key.ObjectId)),\n data: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any })),\n ref: Schema.optional(Ref.Ref(TestSchema.Expando)),\n}).pipe(Schema.mutable);\n\nexport type TreeNodeType = Schema.Schema.Type<typeof TreeNodeType>;\n\nexport const TreeType = Schema.Struct({\n root: Key.ObjectId,\n nodes: Schema.mutable(Schema.Record({ key: Key.ObjectId, value: TreeNodeType })),\n}).pipe(Type.makeObject(DXN.make('org.dxos.type.tree', '0.1.0')));\n\nexport type TreeType = Type.InstanceType<typeof TreeType>;\n\n/**\n * Wrapper object for tree.\n */\nexport class Tree {\n static create = (): TreeType => {\n const id = Key.ObjectId.random();\n return Obj.make(TreeType, {\n root: id,\n nodes: {\n [id]: {\n id,\n children: [],\n data: { text: '' }, // TODO(burdon): Generic.\n },\n },\n });\n };\n\n private _tree: TreeType;\n\n constructor(tree?: TreeType) {\n this._tree = tree ?? Tree.create();\n }\n\n get tree() {\n return this._tree;\n }\n\n // TODO(burdon): Make reactive.\n get size() {\n return Object.keys(this._tree.nodes).length;\n }\n\n get root() {\n return this.getNode(this._tree.root);\n }\n\n //\n // Traversal\n //\n\n /**\n * Recursively traverse the tree until the callback returns a value.\n */\n tranverse<T>(\n callback: (node: TreeNodeType, depth: number) => T | void,\n root: Key.ObjectId = this._tree.root,\n depth = 0,\n ): T | void {\n const node = this._tree.nodes[root];\n const result = callback(node, depth);\n if (result !== undefined) {\n return result;\n }\n\n for (const childId of node.children) {\n const result = this.tranverse(callback, childId, depth + 1);\n if (result !== undefined) {\n return result;\n }\n }\n }\n\n getNode(id: Key.ObjectId): TreeNodeType {\n const node = this._tree.nodes[id];\n invariant(node);\n return node;\n }\n\n /**\n * Get the children of a node.\n */\n getChildNodes(node: TreeNodeType): Array<TreeNodeType> {\n return node.children.map((id) => this.getNode(id));\n }\n\n /**\n * Get the parent of a node.\n */\n getParent(node: TreeNodeType): TreeNodeType | null {\n const parent = this.tranverse((n) => {\n if (n.children.includes(node.id)) {\n return n;\n }\n });\n\n return parent ?? null;\n }\n\n /**\n * Get the next node in the tree.\n */\n getNext(node: TreeNodeType, hierarchical = true): TreeNodeType | undefined {\n if (hierarchical && node.children.length) {\n // First child.\n return this.getChildNodes(node)[0];\n } else {\n const parent = this.getParent(node);\n if (parent) {\n const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);\n if (idx < parent.children.length - 1) {\n // Next sibling.\n return this.getNode(parent.children[idx + 1]);\n } else {\n // Get parent's next sibling.\n return this.getNext(parent, false);\n }\n }\n }\n }\n\n /**\n * Get the previous node in the tree.\n */\n getPrevious(node: TreeNodeType, hierarchical = true): TreeNodeType | undefined {\n const parent = this.getParent(node)!;\n const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);\n if (idx === 0) {\n if (hierarchical) {\n return parent;\n }\n } else {\n const previous = this.getNode(parent.children[idx - 1]);\n if (hierarchical && previous.children.length) {\n return this.getLastDescendent(previous);\n }\n\n return previous;\n }\n }\n\n /**\n * Get the last descendent of a node.\n */\n getLastDescendent(node: TreeNodeType): TreeNodeType | undefined {\n const children = this.getChildNodes(node);\n const last = children.length ? children[children.length - 1] : undefined;\n if (last) {\n return this.getLastDescendent(last);\n }\n\n return node;\n }\n\n //\n // Mutations\n //\n\n /**\n * Clear tree.\n */\n clear(): void {\n const root = this._tree.nodes[this._tree.root];\n root.children.length = 0;\n Obj.update(this._tree, (obj) => {\n obj.nodes = {\n [root.id]: root,\n };\n });\n }\n\n /**\n * Add node.\n */\n addNode(parent: TreeNodeType, node?: TreeNodeType, index?: number): TreeNodeType {\n if (!node) {\n const id = Key.ObjectId.random();\n node = { id, children: [], data: { text: '' } }; // TODO(burdon): Generic.\n }\n\n const nodeToAdd = node;\n Obj.update(this._tree, (obj) => {\n obj.nodes[nodeToAdd.id] = nodeToAdd;\n parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);\n });\n return node;\n }\n\n /**\n * Delete node.\n */\n deleteNode(parent: TreeNodeType, id: Key.ObjectId): TreeNodeType | undefined {\n const node = this._tree.nodes[id];\n if (!node) {\n return undefined;\n }\n\n Obj.update(this._tree, (obj) => {\n delete obj.nodes[node.id];\n });\n const idx = parent.children.findIndex((child) => child === id);\n if (idx !== -1) {\n Obj.update(this._tree, () => {\n parent.children.splice(idx, 1);\n });\n }\n\n return node;\n }\n\n /**\n * Move child node.\n */\n moveNode(node: TreeNodeType, from: number, to: number): TreeNodeType | null {\n invariant(from >= 0 && from < node.children.length);\n invariant(to >= 0 && to < node.children.length);\n if (from === to) {\n return null;\n }\n\n const child = node.children[from];\n Obj.update(this._tree, () => {\n node.children.splice(from, 1);\n node.children.splice(to, 0, child);\n });\n return this.getNode(child);\n }\n\n /**\n * Indent node.\n */\n indentNode(node: TreeNodeType): void {\n const parent = this.getParent(node);\n if (!parent) {\n return;\n }\n\n const idx = parent.children.findIndex((child) => child === node.id);\n if (idx < 1 || idx >= parent.children.length) {\n return;\n }\n\n const previous = this.getNode(parent.children[idx - 1]);\n Obj.update(this._tree, () => {\n parent.children.splice(idx, 1);\n previous.children.push(node.id);\n });\n }\n\n /**\n * Unindent node.\n */\n unindentNode(node: TreeNodeType): void {\n const parent = this.getParent(node);\n if (!parent) {\n return;\n }\n\n const ancestor = this.getParent(parent);\n if (!ancestor) {\n return;\n }\n\n // Remove node from parent and get following siblings.\n const nodeIdx = parent.children.findIndex((id) => id === node.id);\n let rest: Key.ObjectId[] = [];\n Obj.update(this._tree, () => {\n const removed = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);\n rest = removed.slice(1); // Skip the node itself.\n });\n\n // Add to ancestor.\n const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);\n Obj.update(this._tree, () => {\n ancestor.children.splice(parentIdx + 1, 0, node.id);\n });\n\n // Transplant following siblings to current node.\n Obj.update(this._tree, () => {\n node.children.push(...rest);\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAuBO,IAAMA,qBAAqB,CAChCC,MACAC,SAAuBD,KAAKE,MAC5BC,UAAuB,oBAAIC,IAAAA,MAAK;AAEhC,QAAMC,OAAOL,KAAKM,MAAML,MAAAA;AACxB,MAAI,CAACI,MAAM;AACT,WAAOE;EACT;AACA,MAAIJ,QAAQK,IAAIP,MAAAA,GAAS;AACvB,WAAO;MAAEQ,IAAIR;MAAQS,OAAOC,QAAQN,IAAAA;MAAOO,MAAMP,KAAKO;IAAK;EAC7D;A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QAAA,CAAA,QAAA;AAEA;IACA;UACE,WAAA,KAAA,UAAA,MAAA;AACF,QAAA,CAAA,UAAA;AAEA;IACA;AAEAjC,UAAIyC,UAAYnB,OAAO,SAAA,UAAA,CAAA,OAAA,OAAA,KAAA,EAAA;QACrB,OAAM6B,CAAAA;QACNC,OAAOD,KAAAA,OAAQE,MAAM;AACvB,YAAA,UAAA,OAAA,SAAA,OAAA,SAAA,OAAA,SAAA,SAAA,OAAA;AAEA,aAAA,QAAmB,MAAA,CAAA;IACnB,CAAA;UAEEC,YAASjD,KAASuC,cAAOW,QAAe,EAAG7B,UAAO,CAAA,MAAA,EAAA,OAAA,OAAA,EAAA;AACpD,QAAA,OAAA,KAAA,OAAA,MAAA;AAEA,eAAA,SAAA,OAAA,YAAA,GAAA,GAAA,KAAiD,EAAA;IACjD1B,CAAAA;AAEA,QAAA,OAAA,KAAA,OAAA,MAAA;AACF,WAAA,SAAA,KAAA,GAAA,IAAA;IACF,CAAA;;;",
|
|
6
|
+
"names": ["treeTypeToTreeNode", "tree", "rootId", "root", "visited", "Set", "node", "nodes", "undefined", "has", "id", "label", "labelOf", "data", "add", "children", "map", "childId", "filter", "c", "Boolean", "text", "Schema", "DXN", "Key", "Obj", "Ref", "Type", "TestSchema", "invariant", "children", "data", "String", "ref", "optional", "pipe", "TreeType", "Struct", "ObjectId", "nodes", "Record", "key", "TreeNodeType", "makeObject", "id", "make", "root", "_tree", "tree", "result", "callback", "node", "depth", "undefined", "childId", "getNode", "n", "getChildNodes", "parent", "getParent", "idx", "hierarchical", "getLastDescendent", "previous", "length", "last", "update", "obj", "nodeToAdd", "splice", "index", "findIndex", "to", "from", "child", "push", "removed", "rest", "slice", "ancestor", "parentIdx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/ExplorerPlugin.tsx
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
4
|
+
import { CreateObject, ReactSurface } from "#capabilities";
|
|
5
|
+
import { meta } from "#meta";
|
|
6
|
+
import { translations } from "#translations";
|
|
7
|
+
import { Graph } from "#types";
|
|
8
|
+
var ExplorerPlugin = Plugin.define(meta).pipe(AppPlugin.addCreateObjectModule({
|
|
9
|
+
activate: CreateObject
|
|
10
|
+
}), AppPlugin.addSchemaModule({
|
|
11
|
+
schema: [
|
|
12
|
+
Graph.Graph
|
|
13
|
+
]
|
|
14
|
+
}), AppPlugin.addSurfaceModule({
|
|
15
|
+
activate: ReactSurface
|
|
16
|
+
}), AppPlugin.addTranslationsModule({
|
|
17
|
+
translations
|
|
18
|
+
}), Plugin.make);
|
|
19
|
+
var ExplorerPlugin_default = ExplorerPlugin;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
ExplorerPlugin,
|
|
23
|
+
ExplorerPlugin_default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-GRJXLL4Z.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ExplorerPlugin.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { CreateObject, ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Graph } from '#types';\n\nexport const ExplorerPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default ExplorerPlugin;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,cAAcC,oBAAoB;AAC3C,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;AAEf,IAAMC,iBAAiBP,OAAOQ,OAAOJ,IAAAA,EAAMK,KAChDR,UAAUS,sBAAsB;EAAEC,UAAUT;AAAa,CAAA,GACzDD,UAAUW,gBAAgB;EAAEC,QAAQ;IAACP,MAAMA;;AAAO,CAAA,GAClDL,UAAUa,iBAAiB;EAAEH,UAAUR;AAAa,CAAA,GACpDF,UAAUc,sBAAsB;EAAEV;AAAa,CAAA,GAC/CL,OAAOgB,IAAI;AAGb,IAAA,yBAAeT;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "CreateObject", "ReactSurface", "meta", "translations", "Graph", "ExplorerPlugin", "define", "pipe", "addCreateObjectModule", "activate", "addSchemaModule", "schema", "addSurfaceModule", "addTranslationsModule", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/util/node-color.ts
|
|
2
|
+
import { Obj } from "@dxos/echo";
|
|
3
|
+
import { getHashHue } from "@dxos/ui-theme";
|
|
4
|
+
var getNodeFillForTypename = (typename) => {
|
|
5
|
+
return `var(--color-${getHashHue(typename)}-400)`;
|
|
6
|
+
};
|
|
7
|
+
var getNodeFillForObject = (object) => {
|
|
8
|
+
return getNodeFillForTypename(object && Obj.getTypename(object));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/util/plot.ts
|
|
12
|
+
var createAdapter = (prop, accessor) => accessor ? {
|
|
13
|
+
transform: (values) => values.map((value) => accessor(value)[prop])
|
|
14
|
+
} : prop;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
getNodeFillForObject,
|
|
18
|
+
createAdapter
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-IKHJV3Q4.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/node-color.ts", "../../../src/util/plot.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Obj } from '@dxos/echo';\nimport { getHashHue } from '@dxos/ui-theme';\n\n/**\n * Returns the SVG `fill` value for a node, derived from its typename via the\n * same hue-hash used by the force-directed renderer. Resolves to a Tailwind\n * color token CSS variable so the value reads consistently across themes.\n *\n * Used by every variant of `ExplorerArticle` so nodes are colored consistently\n * regardless of which layout is rendering them.\n */\nexport const getNodeFillForTypename = (typename: string | undefined): string => {\n return `var(--color-${getHashHue(typename)}-400)`;\n};\n\n/** Convenience: derive the fill from an ECHO object's typename. */\nexport const getNodeFillForObject = (object: Obj.Unknown | undefined): string => {\n return getNodeFillForTypename(object && Obj.getTypename(object));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { ChannelValueSpec } from '@observablehq/plot';\n\nexport type Accessor<T> = (object: any) => T;\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport type GeoLocation = {\n lat: number;\n lng: number;\n};\n\nexport const createAdapter = <T extends Record<string, any>>(\n prop: string,\n accessor: Accessor<T> | undefined,\n): ChannelValueSpec =>\n accessor\n ? {\n transform: (values) => values.map((value) => accessor(value)[prop]),\n }\n : prop;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,WAAW;AACpB,SAASC,kBAAkB;AAUpB,IAAMC,yBAAyB,CAACC,aAAAA;AACrC,SAAO,eAAeF,WAAWE,QAAAA,CAAAA;AACnC;AAGO,IAAMC,uBAAuB,CAACC,WAAAA;AACnC,SAAOH,uBAAuBG,UAAUL,IAAIM,YAAYD,MAAAA,CAAAA;AAC1D;;;ACJO,IAAME,gBAAgB,CAC3BC,MACAC,aAEAA,WACI;EACEC,WAAW,CAACC,WAAWA,OAAOC,IAAI,CAACC,UAAUJ,SAASI,KAAAA,EAAOL,IAAAA,CAAK;AACpE,IACAA;",
|
|
6
|
+
"names": ["Obj", "getHashHue", "getNodeFillForTypename", "typename", "getNodeFillForObject", "object", "getTypename", "createAdapter", "prop", "accessor", "transform", "values", "map", "value"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
|
+
var meta = {
|
|
4
|
+
id: "org.dxos.plugin.explorer",
|
|
5
|
+
name: "Explorer",
|
|
6
|
+
author: "DXOS",
|
|
7
|
+
description: trim`
|
|
8
|
+
Explorer is an interactive hypergraph visualization plugin that reveals the relationships
|
|
9
|
+
between objects stored in your DXOS workspace. Each Graph document is backed by a live
|
|
10
|
+
ECHO query and a View that you configure — Explorer keeps the visualization synchronized
|
|
11
|
+
with the database in real time so every peer immediately sees changes made by collaborators.
|
|
12
|
+
|
|
13
|
+
The plugin offers four switchable layout algorithms for the same data set: a physics-based
|
|
14
|
+
force-directed graph for freeform exploration, a radial cluster layout that groups objects
|
|
15
|
+
by type around a central root, an edge-bundling layout that tames visual clutter on dense
|
|
16
|
+
graphs, and a lattice grid that arranges objects in a sorted matrix sorted by type and label.
|
|
17
|
+
Switching between layouts smoothly tweens node positions so spatial context is preserved.
|
|
18
|
+
|
|
19
|
+
Nodes are coloured by their ECHO object type, and hovering any node opens an anchor-card
|
|
20
|
+
preview panel with the object's details without leaving the graph view.
|
|
21
|
+
The toolbar's query editor lets you filter the visible node set on the fly using
|
|
22
|
+
the same query syntax available across Composer.
|
|
23
|
+
|
|
24
|
+
A new Graph document can be created from the object-creation dialog; Explorer automatically
|
|
25
|
+
derives an initial View from the chosen type and persists both to ECHO so the graph is
|
|
26
|
+
immediately shareable and replicable across the space.
|
|
27
|
+
`,
|
|
28
|
+
icon: "ph--graph--regular",
|
|
29
|
+
iconHue: "green",
|
|
30
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer",
|
|
31
|
+
spec: "PLUGIN.mdl",
|
|
32
|
+
screenshots: [
|
|
33
|
+
"https://dxos.network/plugin-details-explorer-dark.png"
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
meta
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-LL3PXKB5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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: 'org.dxos.plugin.explorer',\n name: 'Explorer',\n author: 'DXOS',\n description: trim`\n Explorer is an interactive hypergraph visualization plugin that reveals the relationships\n between objects stored in your DXOS workspace. Each Graph document is backed by a live\n ECHO query and a View that you configure — Explorer keeps the visualization synchronized\n with the database in real time so every peer immediately sees changes made by collaborators.\n\n The plugin offers four switchable layout algorithms for the same data set: a physics-based\n force-directed graph for freeform exploration, a radial cluster layout that groups objects\n by type around a central root, an edge-bundling layout that tames visual clutter on dense\n graphs, and a lattice grid that arranges objects in a sorted matrix sorted by type and label.\n Switching between layouts smoothly tweens node positions so spatial context is preserved.\n\n Nodes are coloured by their ECHO object type, and hovering any node opens an anchor-card\n preview panel with the object's details without leaving the graph view.\n The toolbar's query editor lets you filter the visible node set on the fly using\n the same query syntax available across Composer.\n\n A new Graph document can be created from the object-creation dialog; Explorer automatically\n derives an initial View from the chosen type and persists both to ECHO so the graph is\n immediately shareable and replicable across the space.\n `,\n icon: 'ph--graph--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n spec: 'PLUGIN.mdl',\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC,aAAaL;;;;;;;;;;;;;;;;;;;;;EAqBbM,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "author", "description", "icon", "iconHue", "source", "spec", "screenshots"]
|
|
7
|
+
}
|