@dxos/plugin-explorer 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/PLUGIN.mdl +340 -0
- package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.mjs +459 -0
- package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.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-3D7BYXOR.mjs +37 -0
- package/dist/lib/neutral/chunk-3D7BYXOR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-42BYLQQA.mjs +42 -0
- package/dist/lib/neutral/chunk-42BYLQQA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7XUDLV6E.mjs +287 -0
- package/dist/lib/neutral/chunk-7XUDLV6E.mjs.map +7 -0
- package/dist/lib/{browser/chunk-4NFGHCGO.mjs → neutral/chunk-HI324IB4.mjs} +10 -25
- package/dist/lib/neutral/chunk-HI324IB4.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/{browser/chunk-6AZY4CDH.mjs → neutral/components/index.mjs} +747 -358
- 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 +139 -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 -1
- 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 +1 -0
- 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 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- 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} +1 -1
- 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 +41 -20
- 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 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +8 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts +15 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts +18 -0
- package/dist/types/src/containers/ExplorerArticle/Visualization.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 +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- 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 +1 -1
- 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 +32 -0
- package/dist/types/src/testing/relations.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +28 -26
- 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 +5 -13
- 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 +104 -62
- package/src/ExplorerPlugin.test.ts +26 -0
- package/src/ExplorerPlugin.tsx +13 -24
- package/src/capabilities/create-object.ts +36 -0
- package/src/capabilities/index.ts +4 -1
- package/src/capabilities/react-surface.tsx +32 -0
- package/src/components/Chart/Chart.stories.tsx +14 -21
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/Globe/Globe.stories.tsx +17 -20
- package/src/components/Globe/Globe.tsx +1 -1
- package/src/components/Graph/CanvasForceGraph.stories.tsx +97 -0
- package/src/components/Graph/CanvasForceGraph.tsx +124 -0
- package/src/components/Graph/ForceGraph.stories.tsx +95 -46
- package/src/components/Graph/ForceGraph.tsx +105 -85
- package/src/components/Graph/index.ts +1 -1
- package/src/components/Lattice/Lattice.stories.tsx +104 -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 +19 -38
- package/src/components/Tree/Tree.tsx +69 -100
- 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 +4 -5
- package/src/components/Tree/types/tree.ts +26 -31
- package/src/components/Tree/types/types.ts +38 -29
- package/src/components/index.ts +1 -0
- package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +152 -0
- package/src/containers/ExplorerArticle/ExplorerArticle.tsx +120 -0
- package/src/containers/ExplorerArticle/Visualization.tsx +523 -0
- package/src/containers/ExplorerArticle/index.ts +5 -0
- package/src/containers/ExplorerArticle/variants.ts +47 -0
- package/src/containers/index.ts +1 -1
- package/src/hooks/useGraphModel.ts +22 -14
- package/src/index.ts +1 -4
- package/src/meta.ts +26 -7
- package/src/plugin.ts +9 -0
- package/src/{components/Tree/testing → testing}/generator.ts +3 -3
- package/src/testing/index.ts +9 -0
- package/src/testing/relations.ts +117 -0
- package/src/translations.ts +14 -13
- package/src/types/ExplorerAction.ts +1 -2
- package/src/types/Graph.ts +6 -28
- 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/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs +0 -48
- package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs.map +0 -7
- package/dist/lib/browser/chunk-4NFGHCGO.mjs.map +0 -7
- package/dist/lib/browser/chunk-6AZY4CDH.mjs.map +0 -7
- package/dist/lib/browser/chunk-YNQF4CPY.mjs +0 -24
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -95
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-KAHVDMFX.mjs +0 -38
- package/dist/lib/browser/react-surface-KAHVDMFX.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs +0 -49
- package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs +0 -26
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DOXAIJEC.mjs +0 -11280
- package/dist/lib/node-esm/chunk-DOXAIJEC.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-V42OFY7B.mjs +0 -85
- package/dist/lib/node-esm/chunk-V42OFY7B.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -96
- package/dist/lib/node-esm/index.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-7XILIUI4.mjs +0 -39
- package/dist/lib/node-esm/react-surface-7XILIUI4.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -11
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.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/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +0 -6
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +0 -3
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -31
- package/src/components/Graph/D3ForceGraph.stories.tsx +0 -84
- package/src/components/Graph/D3ForceGraph.tsx +0 -102
- package/src/components/Graph/testing.ts +0 -58
- 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/src/containers/ExplorerContainer/ExplorerContainer.tsx +0 -53
- package/src/containers/ExplorerContainer/index.ts +0 -7
- /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
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/src/components/Graph/{adapter.ts → graph-adapter.ts} +0 -0
package/src/meta.ts
CHANGED
|
@@ -2,19 +2,38 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.explorer'),
|
|
10
11
|
name: 'Explorer',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Explorer is an interactive hypergraph visualization plugin that reveals the relationships
|
|
15
|
+
between objects stored in your DXOS workspace. Each Graph document is backed by a live
|
|
16
|
+
ECHO query and a View that you configure — Explorer keeps the visualization synchronized
|
|
17
|
+
with the database in real time so every peer immediately sees changes made by collaborators.
|
|
18
|
+
|
|
19
|
+
The plugin offers four switchable layout algorithms for the same data set: a physics-based
|
|
20
|
+
force-directed graph for freeform exploration, a radial cluster layout that groups objects
|
|
21
|
+
by type around a central root, an edge-bundling layout that tames visual clutter on dense
|
|
22
|
+
graphs, and a lattice grid that arranges objects in a sorted matrix sorted by type and label.
|
|
23
|
+
Switching between layouts smoothly tweens node positions so spatial context is preserved.
|
|
24
|
+
|
|
25
|
+
Nodes are coloured by their ECHO object type, and hovering any node opens an anchor-card
|
|
26
|
+
preview panel with the object's details without leaving the graph view.
|
|
27
|
+
The toolbar's query editor lets you filter the visible node set on the fly using
|
|
28
|
+
the same query syntax available across Composer.
|
|
29
|
+
|
|
30
|
+
A new Graph document can be created from the object-creation dialog; Explorer automatically
|
|
31
|
+
derives an initial View from the chosen type and persists both to ECHO so the graph is
|
|
32
|
+
immediately shareable and replicable across the space.
|
|
14
33
|
`,
|
|
15
34
|
icon: 'ph--graph--regular',
|
|
16
35
|
iconHue: 'green',
|
|
17
36
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',
|
|
18
|
-
|
|
37
|
+
spec: 'PLUGIN.mdl',
|
|
19
38
|
screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],
|
|
20
|
-
};
|
|
39
|
+
});
|
package/src/plugin.ts
ADDED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Key, Obj } from '@dxos/echo';
|
|
6
6
|
import { range } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
import { Tree, type TreeNodeType } from '../types';
|
|
8
|
+
import { Tree, type TreeNodeType } from '../components/Tree/types';
|
|
9
9
|
|
|
10
10
|
type NumberOrNumberArray = number | number[];
|
|
11
11
|
|
|
@@ -16,14 +16,14 @@ const random = (min: number, max: number) => Math.floor(Math.random() * (max - m
|
|
|
16
16
|
*/
|
|
17
17
|
export const createTree = (spec: NumberOrNumberArray[] = [], createText?: () => string): Tree => {
|
|
18
18
|
const tree = new Tree();
|
|
19
|
-
Obj.
|
|
19
|
+
Obj.update(tree.tree, () => {
|
|
20
20
|
tree.root.data = { text: 'root' };
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
const createNodes = (parent: TreeNodeType, spec: NumberOrNumberArray = 0): TreeNodeType[] => {
|
|
24
24
|
const count = Array.isArray(spec) ? random(spec[0], spec[1]) : spec;
|
|
25
25
|
return range(count, (i) => ({
|
|
26
|
-
id: Key.
|
|
26
|
+
id: Key.EntityId.random(),
|
|
27
27
|
children: [],
|
|
28
28
|
data: {
|
|
29
29
|
text: createText?.() ?? [parent.data.text, i + 1].join('.'),
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Space } from '@dxos/client/echo';
|
|
6
|
+
import { Obj, Query, Relation } from '@dxos/echo';
|
|
7
|
+
import {
|
|
8
|
+
type RelationSpec,
|
|
9
|
+
type TypeSpec,
|
|
10
|
+
type ValueGenerator,
|
|
11
|
+
createObjectFactory,
|
|
12
|
+
createRelationFactory,
|
|
13
|
+
} from '@dxos/schema/testing';
|
|
14
|
+
import { HasConnection, Organization, Person } from '@dxos/types';
|
|
15
|
+
|
|
16
|
+
import { type BundleEdge } from '../components/Tree/layout';
|
|
17
|
+
import { type TreeNode } from '../components/Tree/types';
|
|
18
|
+
|
|
19
|
+
const SECTORS = ['Technology', 'Finance', 'Research', 'Media'];
|
|
20
|
+
const CONNECTION_KINDS = ['partner', 'investor', 'vendor', 'customer'];
|
|
21
|
+
|
|
22
|
+
export type ConnectedOrgsResult = {
|
|
23
|
+
organizations: Obj.Any[];
|
|
24
|
+
people: Obj.Any[];
|
|
25
|
+
connections: Obj.Any[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ConnectedOrgsOptions = {
|
|
29
|
+
organizationCount?: number;
|
|
30
|
+
personCount?: number;
|
|
31
|
+
connectionCount?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Populate a space with Organizations, People, and HasConnection relations between organizations.
|
|
36
|
+
* Uses `createObjectFactory` to generate Org/Person properties from their `GeneratorAnnotation`s,
|
|
37
|
+
* then `createRelationFactory` to wire HasConnection relations (Org→Org) between them, spreading
|
|
38
|
+
* the connections across the available kinds.
|
|
39
|
+
*/
|
|
40
|
+
export const generateConnectedOrgs = async (
|
|
41
|
+
space: Space,
|
|
42
|
+
generator: ValueGenerator,
|
|
43
|
+
{ organizationCount = 12, personCount = 24, connectionCount = 18 }: ConnectedOrgsOptions = {},
|
|
44
|
+
): Promise<ConnectedOrgsResult> => {
|
|
45
|
+
const specs: TypeSpec[] = [
|
|
46
|
+
{ type: Organization.Organization, count: organizationCount },
|
|
47
|
+
// Person has a Ref to Organization — generator fills it from objects already in db.
|
|
48
|
+
{ type: Person.Person, count: personCount },
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
await createObjectFactory(space.db, generator)(specs);
|
|
52
|
+
|
|
53
|
+
// Distribute the requested connections evenly across the connection kinds.
|
|
54
|
+
const relationSpecs: RelationSpec[] = CONNECTION_KINDS.map((kind, index) => ({
|
|
55
|
+
type: HasConnection.HasConnection,
|
|
56
|
+
count:
|
|
57
|
+
Math.floor(connectionCount / CONNECTION_KINDS.length) +
|
|
58
|
+
(index < connectionCount % CONNECTION_KINDS.length ? 1 : 0),
|
|
59
|
+
data: { kind },
|
|
60
|
+
}));
|
|
61
|
+
const connections = await createRelationFactory(space.db, generator)(relationSpecs);
|
|
62
|
+
|
|
63
|
+
const organizations = await space.db.query(Query.type(Organization.Organization)).run();
|
|
64
|
+
const people = await space.db.query(Query.type(Person.Person)).run();
|
|
65
|
+
return { organizations, people, connections };
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build a TreeNode hierarchy: Root → Sector → Organization (leaf).
|
|
70
|
+
* Organizations are deterministically bucketed into `SECTORS` so the demo has visible groups.
|
|
71
|
+
*/
|
|
72
|
+
export const buildOrgHierarchy = (organizations: Obj.Any[], sectors: readonly string[] = SECTORS): TreeNode => {
|
|
73
|
+
// Avoid modulo-by-zero / missing-bucket crashes when the caller passes an empty sectors list.
|
|
74
|
+
const activeSectors = sectors.length > 0 ? sectors : ['Uncategorized'];
|
|
75
|
+
const buckets = new Map<string, TreeNode[]>();
|
|
76
|
+
for (const sector of activeSectors) {
|
|
77
|
+
buckets.set(sector, []);
|
|
78
|
+
}
|
|
79
|
+
for (let i = 0; i < organizations.length; i++) {
|
|
80
|
+
const org = organizations[i] as any;
|
|
81
|
+
const sector = activeSectors[i % activeSectors.length];
|
|
82
|
+
buckets.get(sector)!.push({
|
|
83
|
+
id: org.id,
|
|
84
|
+
label: org.name ?? org.id.slice(0, 6),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
id: 'root',
|
|
90
|
+
label: 'Organizations',
|
|
91
|
+
children: activeSectors.map((sector) => ({
|
|
92
|
+
id: `sector:${sector}`,
|
|
93
|
+
label: sector,
|
|
94
|
+
children: buckets.get(sector) ?? [],
|
|
95
|
+
})),
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Convert HasConnection relations into bundle edges between organization ids.
|
|
101
|
+
*/
|
|
102
|
+
export const connectionsToEdges = (connections: Obj.Any[]): BundleEdge[] => {
|
|
103
|
+
return connections
|
|
104
|
+
.map((relation): BundleEdge | undefined => {
|
|
105
|
+
const source = Relation.getSource(relation as any) as any;
|
|
106
|
+
const target = Relation.getTarget(relation as any) as any;
|
|
107
|
+
if (!source?.id || !target?.id) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
source: source.id,
|
|
112
|
+
target: target.id,
|
|
113
|
+
kind: (relation as any).kind,
|
|
114
|
+
};
|
|
115
|
+
})
|
|
116
|
+
.filter((e): e is BundleEdge => Boolean(e));
|
|
117
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -4,27 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import { Type } from '@dxos/echo';
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
|
-
import { translations as componentsTranslations } from '@dxos/react-ui-components';
|
|
7
|
+
import { translations as componentsTranslations } from '@dxos/react-ui-components/translations';
|
|
8
8
|
|
|
9
|
-
import { meta } from '
|
|
10
|
-
import { Graph } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { Graph } from '#types';
|
|
11
11
|
|
|
12
12
|
export const translations = [
|
|
13
13
|
{
|
|
14
14
|
'en-US': {
|
|
15
15
|
[Type.getTypename(Graph.Graph)]: {
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'typename
|
|
19
|
-
'typename
|
|
20
|
-
'object
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'object
|
|
16
|
+
'typename.label': 'Explorer',
|
|
17
|
+
'typename.label_zero': 'Explorers',
|
|
18
|
+
'typename.label_one': 'Explorer',
|
|
19
|
+
'typename.label_other': 'Explorers',
|
|
20
|
+
'object-name.placeholder': 'New explorer',
|
|
21
|
+
'add-object.label': 'Add explorer',
|
|
22
|
+
'rename-object.label': 'Rename explorer',
|
|
23
|
+
'delete-object.label': 'Delete explorer',
|
|
24
|
+
'object-deleted.label': 'Explorer deleted',
|
|
24
25
|
},
|
|
25
26
|
[meta.id]: {
|
|
26
|
-
'plugin
|
|
27
|
-
'object
|
|
27
|
+
'plugin.name': 'Explorer',
|
|
28
|
+
'object-title.label': 'Title',
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space
|
|
7
|
+
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space';
|
|
8
8
|
|
|
9
9
|
export const GraphProps = Schema.Struct({
|
|
10
10
|
name: Schema.optional(Schema.String),
|
|
@@ -14,7 +14,6 @@ export const GraphProps = Schema.Struct({
|
|
|
14
14
|
TypeInputOptionsAnnotation.set({
|
|
15
15
|
location: ['database', 'runtime'],
|
|
16
16
|
kind: ['user'],
|
|
17
|
-
registered: ['registered'],
|
|
18
17
|
}),
|
|
19
18
|
Schema.optional,
|
|
20
19
|
),
|
package/src/types/Graph.ts
CHANGED
|
@@ -4,29 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { View } from '@dxos/echo';
|
|
7
|
+
import { DXN, Annotation, Filter, Obj, Query, QueryAST, Ref, Type, View } from '@dxos/echo';
|
|
9
8
|
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
10
9
|
import { ViewAnnotation } from '@dxos/schema';
|
|
11
10
|
|
|
12
11
|
const GraphSchema = Schema.Struct({
|
|
13
12
|
name: Schema.optional(Schema.String),
|
|
14
|
-
|
|
15
13
|
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
16
|
-
|
|
17
14
|
query: Schema.Struct({
|
|
18
15
|
raw: Schema.optional(Schema.String),
|
|
19
16
|
ast: QueryAST.Query,
|
|
20
17
|
}).pipe(FormInputAnnotation.set(false)),
|
|
21
18
|
}).pipe(
|
|
22
|
-
Type.object({
|
|
23
|
-
typename: 'dxos.org/type/Graph',
|
|
24
|
-
version: '0.2.0',
|
|
25
|
-
}),
|
|
26
19
|
LabelAnnotation.set(['name']),
|
|
27
|
-
ViewAnnotation.set(
|
|
20
|
+
ViewAnnotation.set(['view']),
|
|
21
|
+
Annotation.IconAnnotation.set({ icon: 'ph--graph--regular', hue: 'green' }),
|
|
22
|
+
Type.makeObject(DXN.make('org.dxos.type.graph', '0.1.0')),
|
|
28
23
|
);
|
|
29
|
-
|
|
24
|
+
// TODO(wittjosiah): Try to clean up this type inference.
|
|
25
|
+
export interface Graph extends Type.InstanceType<typeof GraphSchema> {}
|
|
30
26
|
export const Graph: Type.Obj<Graph> = GraphSchema as any;
|
|
31
27
|
|
|
32
28
|
type MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {
|
|
@@ -43,21 +39,3 @@ export const make = ({
|
|
|
43
39
|
}: MakeProps): Graph => {
|
|
44
40
|
return Obj.make(Graph, { name, view: Ref.make(view), query });
|
|
45
41
|
};
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
// V1
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
export const GraphV1 = Schema.Struct({
|
|
52
|
-
name: Schema.optional(Schema.String),
|
|
53
|
-
query: Schema.Struct({
|
|
54
|
-
raw: Schema.optional(Schema.String),
|
|
55
|
-
ast: QueryAST.Query,
|
|
56
|
-
}),
|
|
57
|
-
}).pipe(
|
|
58
|
-
Type.object({
|
|
59
|
-
typename: 'dxos.org/type/Graph',
|
|
60
|
-
version: '0.1.0',
|
|
61
|
-
}),
|
|
62
|
-
LabelAnnotation.set(['name']),
|
|
63
|
-
);
|
package/src/typings.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Obj } from '@dxos/echo';
|
|
6
|
+
import { getHashHue } from '@dxos/ui-theme';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns the SVG `fill` value for a node, derived from its typename via the
|
|
10
|
+
* same hue-hash used by the force-directed renderer. Resolves to a Tailwind
|
|
11
|
+
* color token CSS variable so the value reads consistently across themes.
|
|
12
|
+
*
|
|
13
|
+
* Used by every variant of `ExplorerArticle` so nodes are colored consistently
|
|
14
|
+
* regardless of which layout is rendering them.
|
|
15
|
+
*/
|
|
16
|
+
export const getNodeFillForTypename = (typename: string | undefined): string => {
|
|
17
|
+
return `var(--color-${getHashHue(typename)}-400)`;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Convenience: derive the fill from an ECHO object's typename. */
|
|
21
|
+
export const getNodeFillForObject = (object: Obj.Unknown | undefined): string => {
|
|
22
|
+
return getNodeFillForTypename(object && Obj.getTypename(object));
|
|
23
|
+
};
|
|
@@ -4,12 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
import type { ChannelValueSpec } from '@observablehq/plot';
|
|
6
6
|
|
|
7
|
-
export type Point = { x: number; y: number };
|
|
8
|
-
export type GeoLocation = { lat: number; lng: number };
|
|
9
|
-
|
|
10
7
|
export type Accessor<T> = (object: any) => T;
|
|
11
8
|
|
|
9
|
+
export type Point = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type GeoLocation = {
|
|
15
|
+
lat: number;
|
|
16
|
+
lng: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
12
19
|
export const createAdapter = <T extends Record<string, any>>(
|
|
13
20
|
prop: string,
|
|
14
21
|
accessor: Accessor<T> | undefined,
|
|
15
|
-
): ChannelValueSpec =>
|
|
22
|
+
): ChannelValueSpec =>
|
|
23
|
+
accessor
|
|
24
|
+
? {
|
|
25
|
+
transform: (values) => values.map((value) => accessor(value)[prop]),
|
|
26
|
+
}
|
|
27
|
+
: prop;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
D3ForceGraph,
|
|
3
|
-
useGraphModel
|
|
4
|
-
} from "./chunk-6AZY4CDH.mjs";
|
|
5
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
6
|
-
|
|
7
|
-
// src/containers/ExplorerContainer/ExplorerContainer.tsx
|
|
8
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
9
|
-
import { QueryBuilder } from "@dxos/echo-query";
|
|
10
|
-
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
11
|
-
import { getSpace, useObject } from "@dxos/react-client/echo";
|
|
12
|
-
import { Panel, Toolbar } from "@dxos/react-ui";
|
|
13
|
-
import { QueryEditor } from "@dxos/react-ui-components";
|
|
14
|
-
var ExplorerContainer = ({ role, subject: view }) => {
|
|
15
|
-
useObject(view);
|
|
16
|
-
const space = view && getSpace(view);
|
|
17
|
-
const [filter, setFilter] = useState();
|
|
18
|
-
const model = useGraphModel(space, filter);
|
|
19
|
-
const { match } = useGlobalSearch();
|
|
20
|
-
const builder = useMemo(() => new QueryBuilder(), []);
|
|
21
|
-
const handleChange = useCallback((value) => {
|
|
22
|
-
setFilter(builder.build(value).filter);
|
|
23
|
-
}, []);
|
|
24
|
-
const showToolbar = role === "article";
|
|
25
|
-
if (!space || !model) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
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, {
|
|
33
|
-
db: space.db,
|
|
34
|
-
onChange: handleChange
|
|
35
|
-
}))), /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
36
|
-
asChild: true
|
|
37
|
-
}, /* @__PURE__ */ React.createElement(D3ForceGraph, {
|
|
38
|
-
model,
|
|
39
|
-
match
|
|
40
|
-
})));
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// src/containers/ExplorerContainer/index.ts
|
|
44
|
-
var ExplorerContainer_default = ExplorerContainer;
|
|
45
|
-
export {
|
|
46
|
-
ExplorerContainer_default as default
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=ExplorerContainer-4RB2TY3G.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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 registered: ['registered'],\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: 'dxos.org/type/Graph',\n version: '0.2.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\n//\n// V1\n//\n\nexport const GraphV1 = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\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;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,eAAQ;AAEnB,CAAA;;;ACpBA;;;;;;AAIA,YAAYW,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;AAMO,IAAMiB,UAAiB3B,eAAO;EACnCC,MAAaC,iBAAgBC,cAAM;EACnCO,OAAcV,eAAO;IACnBW,KAAYT,iBAAgBC,cAAM;IAClCS,KAAKC,SAASC;EAChB,CAAA;AACF,CAAA,EAAGP,KACDQ,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,CAAA;",
|
|
6
|
-
"names": ["Schema", "TypeInputOptionsAnnotation", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered", "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", "GraphV1"]
|
|
7
|
-
}
|