@dxos/plugin-explorer 0.8.4-main.3eb6e50203 → 0.8.4-main.422d1c7879
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-YNQF4CPY.mjs → chunk-LSUP47BZ.mjs} +2 -2
- package/dist/lib/browser/{chunk-YNQF4CPY.mjs.map → chunk-LSUP47BZ.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +11325 -52
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +64 -4
- package/dist/lib/browser/types/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs → chunk-EN3JZNEY.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs.map → chunk-EN3JZNEY.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +11325 -52
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +64 -4
- package/dist/lib/node-esm/types/index.mjs.map +4 -4
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +6 -5
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +4 -2
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +3 -3
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +2 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +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 +2 -9
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -47
- package/src/ExplorerPlugin.tsx +23 -11
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +10 -9
- package/src/components/Chart/Chart.stories.tsx +1 -2
- package/src/components/Globe/Globe.stories.tsx +1 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +13 -13
- package/src/components/Graph/D3ForceGraph.tsx +82 -75
- package/src/components/Graph/ForceGraph.stories.tsx +13 -13
- package/src/components/Tree/Tree.stories.tsx +6 -4
- package/src/components/Tree/types/tree.test.ts +2 -3
- package/src/components/Tree/types/tree.ts +9 -9
- package/src/components/index.ts +0 -4
- package/src/{components → containers/ExplorerContainer}/ExplorerContainer.tsx +17 -16
- package/src/containers/ExplorerContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +14 -10
- package/src/meta.ts +1 -1
- package/src/translations.ts +13 -12
- package/src/types/ExplorerAction.ts +0 -1
- package/src/types/Graph.ts +10 -23
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs +0 -45
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs.map +0 -7
- package/dist/lib/browser/chunk-HIFLWHXR.mjs +0 -83
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +0 -7
- package/dist/lib/browser/chunk-JZSBQYJQ.mjs +0 -11076
- package/dist/lib/browser/chunk-JZSBQYJQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-KIXHZZ2C.mjs +0 -35
- package/dist/lib/browser/chunk-KIXHZZ2C.mjs.map +0 -7
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +0 -177
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TPQAT5EI.mjs +0 -36
- package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs +0 -46
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs +0 -84
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ASRWO2N5.mjs +0 -37
- package/dist/lib/node-esm/chunk-ASRWO2N5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K5BYG7BW.mjs +0 -11078
- package/dist/lib/node-esm/chunk-K5BYG7BW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +0 -179
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs +0 -37
- package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs.map +0 -7
- 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 +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Key, Obj, Type } from '@dxos/echo';
|
|
7
|
+
import { Key, Obj, Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { TestSchema } from '@dxos/echo/testing';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ export const TreeNodeType = Schema.Struct({
|
|
|
14
14
|
id: Key.ObjectId,
|
|
15
15
|
children: Schema.mutable(Schema.Array(Key.ObjectId)),
|
|
16
16
|
data: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
17
|
-
ref: Schema.optional(
|
|
17
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando)),
|
|
18
18
|
}).pipe(Schema.mutable);
|
|
19
19
|
|
|
20
20
|
export interface TreeNodeType extends Schema.Schema.Type<typeof TreeNodeType> {}
|
|
@@ -24,7 +24,7 @@ export const TreeType = Schema.Struct({
|
|
|
24
24
|
nodes: Schema.mutable(Schema.Record({ key: Key.ObjectId, value: TreeNodeType })),
|
|
25
25
|
}).pipe(
|
|
26
26
|
Type.object({
|
|
27
|
-
typename: 'dxos.
|
|
27
|
+
typename: 'org.dxos.type.tree',
|
|
28
28
|
version: '0.1.0',
|
|
29
29
|
}),
|
|
30
30
|
);
|
|
@@ -185,8 +185,8 @@ export class Tree {
|
|
|
185
185
|
clear(): void {
|
|
186
186
|
const root = this._tree.nodes[this._tree.root];
|
|
187
187
|
root.children.length = 0;
|
|
188
|
-
Obj.change(this._tree, (
|
|
189
|
-
|
|
188
|
+
Obj.change(this._tree, (obj) => {
|
|
189
|
+
obj.nodes = {
|
|
190
190
|
[root.id]: root,
|
|
191
191
|
};
|
|
192
192
|
});
|
|
@@ -202,8 +202,8 @@ export class Tree {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
const nodeToAdd = node;
|
|
205
|
-
Obj.change(this._tree, (
|
|
206
|
-
|
|
205
|
+
Obj.change(this._tree, (obj) => {
|
|
206
|
+
obj.nodes[nodeToAdd.id] = nodeToAdd;
|
|
207
207
|
parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);
|
|
208
208
|
});
|
|
209
209
|
return node;
|
|
@@ -218,8 +218,8 @@ export class Tree {
|
|
|
218
218
|
return undefined;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
Obj.change(this._tree, (
|
|
222
|
-
delete
|
|
221
|
+
Obj.change(this._tree, (obj) => {
|
|
222
|
+
delete obj.nodes[node.id];
|
|
223
223
|
});
|
|
224
224
|
const idx = parent.children.findIndex((child) => child === id);
|
|
225
225
|
if (idx !== -1) {
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ComponentType, lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './Chart';
|
|
8
6
|
export * from './Globe';
|
|
9
7
|
export * from './Graph';
|
|
10
8
|
export * from './Tree';
|
|
11
|
-
|
|
12
|
-
export const ExplorerContainer: ComponentType<any> = lazy(() => import('./ExplorerContainer'));
|
|
@@ -4,22 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { type Filter } from '@dxos/echo';
|
|
9
|
+
import { type View } from '@dxos/echo';
|
|
9
10
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
10
11
|
import { useGlobalSearch } from '@dxos/plugin-search';
|
|
11
12
|
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
12
|
-
import {
|
|
13
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
13
14
|
import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
|
|
14
|
-
import { type View } from '@dxos/schema';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { D3ForceGraph } from '#components';
|
|
17
|
+
import { useGraphModel } from '#hooks';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
export type ExplorerContainerProps = AppSurface.ObjectArticleProps<View.View>;
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
21
|
+
export const ExplorerContainer = ({ role, subject: view, attendableId: _attendableId }: ExplorerContainerProps) => {
|
|
23
22
|
useObject(view);
|
|
24
23
|
const space = view && getSpace(view);
|
|
25
24
|
const [filter, setFilter] = useState<Filter.Any>();
|
|
@@ -38,15 +37,17 @@ const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
return (
|
|
41
|
-
<
|
|
40
|
+
<Panel.Root role={role}>
|
|
42
41
|
{showToolbar && (
|
|
43
|
-
<Toolbar
|
|
44
|
-
<
|
|
45
|
-
|
|
42
|
+
<Panel.Toolbar asChild>
|
|
43
|
+
<Toolbar.Root>
|
|
44
|
+
<QueryEditor db={space.db} onChange={handleChange} />
|
|
45
|
+
</Toolbar.Root>
|
|
46
|
+
</Panel.Toolbar>
|
|
46
47
|
)}
|
|
47
|
-
<
|
|
48
|
-
|
|
48
|
+
<Panel.Content asChild>
|
|
49
|
+
<D3ForceGraph model={model} match={match} />
|
|
50
|
+
</Panel.Content>
|
|
51
|
+
</Panel.Root>
|
|
49
52
|
);
|
|
50
53
|
};
|
|
51
|
-
|
|
52
|
-
export default ExplorerContainer;
|
|
@@ -18,22 +18,26 @@ export const useGraphModel = (
|
|
|
18
18
|
): SpaceGraphModel | undefined => {
|
|
19
19
|
const registry = useCapability(Capabilities.AtomRegistry);
|
|
20
20
|
const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);
|
|
21
|
+
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
if (!space) {
|
|
23
|
-
void model?.close();
|
|
24
24
|
setModel(undefined);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}, [space,
|
|
28
|
+
const newModel = new SpaceGraphModel(registry);
|
|
29
|
+
void newModel.open(space.db, queue);
|
|
30
|
+
setModel(newModel);
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
setModel(undefined);
|
|
34
|
+
void newModel.close();
|
|
35
|
+
};
|
|
36
|
+
}, [space, registry, queue]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
model?.setFilter(filter).setOptions(options);
|
|
40
|
+
}, [model, filter, options]);
|
|
37
41
|
|
|
38
42
|
return model;
|
|
39
43
|
};
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.explorer',
|
|
10
10
|
name: 'Explorer',
|
|
11
11
|
description: trim`
|
|
12
12
|
Interactive hypergraph visualization that reveals relationships between objects in your workspace.
|
package/src/translations.ts
CHANGED
|
@@ -6,25 +6,26 @@ import { Type } from '@dxos/echo';
|
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
import { translations as componentsTranslations } from '@dxos/react-ui-components';
|
|
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
|
},
|
package/src/types/Graph.ts
CHANGED
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';
|
|
7
|
+
import { Annotation, Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { View } from '@dxos/echo';
|
|
8
9
|
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
-
import {
|
|
10
|
+
import { ViewAnnotation } from '@dxos/schema';
|
|
10
11
|
|
|
11
12
|
const GraphSchema = Schema.Struct({
|
|
12
13
|
name: Schema.optional(Schema.String),
|
|
13
14
|
|
|
14
|
-
view:
|
|
15
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
15
16
|
|
|
16
17
|
query: Schema.Struct({
|
|
17
18
|
raw: Schema.optional(Schema.String),
|
|
@@ -19,11 +20,15 @@ const GraphSchema = Schema.Struct({
|
|
|
19
20
|
}).pipe(FormInputAnnotation.set(false)),
|
|
20
21
|
}).pipe(
|
|
21
22
|
Type.object({
|
|
22
|
-
typename: 'dxos.
|
|
23
|
-
version: '0.
|
|
23
|
+
typename: 'org.dxos.type.graph',
|
|
24
|
+
version: '0.1.0',
|
|
24
25
|
}),
|
|
25
26
|
LabelAnnotation.set(['name']),
|
|
26
27
|
ViewAnnotation.set(true),
|
|
28
|
+
Annotation.IconAnnotation.set({
|
|
29
|
+
icon: 'ph--graph--regular',
|
|
30
|
+
hue: 'green',
|
|
31
|
+
}),
|
|
27
32
|
);
|
|
28
33
|
export interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}
|
|
29
34
|
export const Graph: Type.Obj<Graph> = GraphSchema as any;
|
|
@@ -42,21 +47,3 @@ export const make = ({
|
|
|
42
47
|
}: MakeProps): Graph => {
|
|
43
48
|
return Obj.make(Graph, { name, view: Ref.make(view), query });
|
|
44
49
|
};
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
// V1
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
export const GraphV1 = Schema.Struct({
|
|
51
|
-
name: Schema.optional(Schema.String),
|
|
52
|
-
query: Schema.Struct({
|
|
53
|
-
raw: Schema.optional(Schema.String),
|
|
54
|
-
ast: QueryAST.Query,
|
|
55
|
-
}),
|
|
56
|
-
}).pipe(
|
|
57
|
-
Type.object({
|
|
58
|
-
typename: 'dxos.org/type/Graph',
|
|
59
|
-
version: '0.1.0',
|
|
60
|
-
}),
|
|
61
|
-
LabelAnnotation.set(['name']),
|
|
62
|
-
);
|
package/src/typings.d.ts
ADDED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useGraphModel
|
|
3
|
-
} from "./chunk-KIXHZZ2C.mjs";
|
|
4
|
-
import {
|
|
5
|
-
D3ForceGraph
|
|
6
|
-
} from "./chunk-MGBT2ZFU.mjs";
|
|
7
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
8
|
-
|
|
9
|
-
// src/components/ExplorerContainer.tsx
|
|
10
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
11
|
-
import { QueryBuilder } from "@dxos/echo-query";
|
|
12
|
-
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
13
|
-
import { getSpace, useObject } from "@dxos/react-client/echo";
|
|
14
|
-
import { Layout, Toolbar } from "@dxos/react-ui";
|
|
15
|
-
import { QueryEditor } from "@dxos/react-ui-components";
|
|
16
|
-
var ExplorerContainer = ({ role, subject: view }) => {
|
|
17
|
-
useObject(view);
|
|
18
|
-
const space = view && getSpace(view);
|
|
19
|
-
const [filter, setFilter] = useState();
|
|
20
|
-
const model = useGraphModel(space, filter);
|
|
21
|
-
const { match } = useGlobalSearch();
|
|
22
|
-
const builder = useMemo(() => new QueryBuilder(), []);
|
|
23
|
-
const handleChange = useCallback((value) => {
|
|
24
|
-
setFilter(builder.build(value).filter);
|
|
25
|
-
}, []);
|
|
26
|
-
const showToolbar = role === "article";
|
|
27
|
-
if (!space || !model) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return /* @__PURE__ */ React.createElement(Layout.Main, {
|
|
31
|
-
role,
|
|
32
|
-
toolbar: showToolbar
|
|
33
|
-
}, showToolbar && /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(QueryEditor, {
|
|
34
|
-
db: space.db,
|
|
35
|
-
onChange: handleChange
|
|
36
|
-
})), /* @__PURE__ */ React.createElement(D3ForceGraph, {
|
|
37
|
-
model,
|
|
38
|
-
match
|
|
39
|
-
}));
|
|
40
|
-
};
|
|
41
|
-
var ExplorerContainer_default = ExplorerContainer;
|
|
42
|
-
export {
|
|
43
|
-
ExplorerContainer_default as default
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=ExplorerContainer-46BHUF6R.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ExplorerContainer.tsx"],
|
|
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 { QueryBuilder } from '@dxos/echo-query';\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace, useObject } from '@dxos/react-client/echo';\nimport { Layout, Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { type View } from '@dxos/schema';\n\nimport { useGraphModel } from '../hooks';\n\nimport { D3ForceGraph } from './Graph';\n\nexport type ExplorerContainerProps = SurfaceComponentProps<View.View>;\n\nconst 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 <Layout.Main role={role} toolbar={showToolbar}>\n {showToolbar && (\n <Toolbar.Root>\n <QueryEditor db={space.db} onChange={handleChange} />\n </Toolbar.Root>\n )}\n <D3ForceGraph model={model} match={match} />\n </Layout.Main>\n );\n};\n\nexport default ExplorerContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,SAASC,aAAaC,SAASC,gBAAgB;AAItD,SAASC,oBAAoB;AAC7B,SAASC,uBAAuB;AAChC,SAASC,UAAUC,iBAAiB;AACpC,SAASC,QAAQC,eAAe;AAChC,SAASC,mBAA0C;AASnD,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAA0B;AACxEC,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,OAAOC,MAAI;IAACtB;IAAYuB,SAASH;KAC/BA,eACC,sBAAA,cAACI,QAAQC,MAAI,MACX,sBAAA,cAACC,aAAAA;IAAYC,IAAIvB,MAAMuB;IAAIC,UAAUZ;OAGzC,sBAAA,cAACa,cAAAA;IAAapB;IAAcE;;AAGlC;AAEA,IAAA,4BAAeZ;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useState", "QueryBuilder", "useGlobalSearch", "getSpace", "useObject", "Layout", "Toolbar", "QueryEditor", "ExplorerContainer", "role", "subject", "view", "useObject", "space", "getSpace", "filter", "setFilter", "useState", "model", "useGraphModel", "match", "useGlobalSearch", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "showToolbar", "Layout", "Main", "toolbar", "Toolbar", "Root", "QueryEditor", "db", "onChange", "D3ForceGraph"]
|
|
7
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
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/types";
|
|
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
|
-
registered: [
|
|
26
|
-
"registered"
|
|
27
|
-
]
|
|
28
|
-
}), Schema.optional)
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// src/types/Graph.ts
|
|
32
|
-
var Graph_exports = {};
|
|
33
|
-
__export(Graph_exports, {
|
|
34
|
-
Graph: () => Graph,
|
|
35
|
-
GraphV1: () => GraphV1,
|
|
36
|
-
make: () => make
|
|
37
|
-
});
|
|
38
|
-
import * as Schema2 from "effect/Schema";
|
|
39
|
-
import { Filter, Obj, Query, QueryAST, Ref, Type } from "@dxos/echo";
|
|
40
|
-
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
41
|
-
import { View, ViewAnnotation } from "@dxos/schema";
|
|
42
|
-
var GraphSchema = Schema2.Struct({
|
|
43
|
-
name: Schema2.optional(Schema2.String),
|
|
44
|
-
view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
45
|
-
query: Schema2.Struct({
|
|
46
|
-
raw: Schema2.optional(Schema2.String),
|
|
47
|
-
ast: QueryAST.Query
|
|
48
|
-
}).pipe(FormInputAnnotation.set(false))
|
|
49
|
-
}).pipe(Type.object({
|
|
50
|
-
typename: "dxos.org/type/Graph",
|
|
51
|
-
version: "0.2.0"
|
|
52
|
-
}), LabelAnnotation.set([
|
|
53
|
-
"name"
|
|
54
|
-
]), ViewAnnotation.set(true));
|
|
55
|
-
var Graph = GraphSchema;
|
|
56
|
-
var make = ({ name, query = {
|
|
57
|
-
raw: "",
|
|
58
|
-
ast: Query.select(Filter.nothing()).ast
|
|
59
|
-
}, view }) => {
|
|
60
|
-
return Obj.make(Graph, {
|
|
61
|
-
name,
|
|
62
|
-
view: Ref.make(view),
|
|
63
|
-
query
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
var GraphV1 = Schema2.Struct({
|
|
67
|
-
name: Schema2.optional(Schema2.String),
|
|
68
|
-
query: Schema2.Struct({
|
|
69
|
-
raw: Schema2.optional(Schema2.String),
|
|
70
|
-
ast: QueryAST.Query
|
|
71
|
-
})
|
|
72
|
-
}).pipe(Type.object({
|
|
73
|
-
typename: "dxos.org/type/Graph",
|
|
74
|
-
version: "0.1.0"
|
|
75
|
-
}), LabelAnnotation.set([
|
|
76
|
-
"name"
|
|
77
|
-
]));
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
ExplorerAction_exports,
|
|
81
|
-
Graph_exports
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=chunk-HIFLWHXR.mjs.map
|
|
@@ -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 { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Type.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,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAErC,IAAMC,cAAqBC,eAAO;EAChCC,MAAaC,iBAAgBC,cAAM;EAEnCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,OAAcX,eAAO;IACnBY,KAAYV,iBAAgBC,cAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;AAClC,CAAA,EAAGF,KACDH,KAAKW,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBT,IAAI;EAAC;CAAO,GAC5BU,eAAeV,IAAI,IAAA,CAAA;AAGd,IAAMW,QAAyBtB;AAS/B,IAAMuB,OAAO,CAAC,EACnBrB,MACAU,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMQ,OAAOC,OAAOC,QAAO,CAAA,EAAIZ;AAAI,GAC3DT,KAAI,MACM;AACV,SAAOsB,IAAIJ,KAAKD,OAAO;IAAEpB;IAAMG,MAAME,IAAIgB,KAAKlB,IAAAA;IAAOO;EAAM,CAAA;AAC7D;AAMO,IAAMgB,UAAiB3B,eAAO;EACnCC,MAAaC,iBAAgBC,cAAM;EACnCQ,OAAcX,eAAO;IACnBY,KAAYV,iBAAgBC,cAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA;AACF,CAAA,EAAGP,KACDH,KAAKW,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBT,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", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Type", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "Obj", "GraphV1"]
|
|
7
|
-
}
|