@dxos/plugin-explorer 0.8.4-main.3c1ae3b → 0.8.4-main.52d7546f51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs +45 -0
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P6FFFVPM.mjs → chunk-HIFLWHXR.mjs} +35 -52
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ARBGXQFH.mjs → chunk-JZSBQYJQ.mjs} +135 -148
- package/dist/lib/{node-esm/chunk-NPIP4VEH.mjs.map → browser/chunk-JZSBQYJQ.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-2MKBRIUT.mjs → chunk-KIXHZZ2C.mjs} +8 -4
- package/dist/lib/browser/chunk-KIXHZZ2C.mjs.map +7 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +177 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UBHZGWZQ.mjs → chunk-YNQF4CPY.mjs} +1 -1
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +43 -54
- 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/react-surface-TPQAT5EI.mjs +36 -0
- package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -2
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs +46 -0
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4BY2XZET.mjs → chunk-3OE6TBJI.mjs} +35 -52
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3ODK27PU.mjs → chunk-ASRWO2N5.mjs} +8 -4
- package/dist/lib/node-esm/chunk-ASRWO2N5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UXZM5VJB.mjs → chunk-DK77RB6M.mjs} +1 -1
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NPIP4VEH.mjs → chunk-K5BYG7BW.mjs} +135 -148
- package/dist/lib/{browser/chunk-ARBGXQFH.mjs.map → node-esm/chunk-K5BYG7BW.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +179 -0
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +43 -54
- 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/react-surface-CYHGJJDU.mjs +37 -0
- package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -2
- package/dist/types/src/ExplorerPlugin.d.ts +2 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ExplorerContainer.d.ts +3 -5
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +16 -14
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphModel.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/translations.d.ts +4 -4
- package/dist/types/src/types/ExplorerAction.d.ts +0 -17
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +16 -18
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +53 -48
- package/src/ExplorerPlugin.tsx +27 -40
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +31 -0
- package/src/components/Chart/Chart.stories.tsx +2 -2
- package/src/components/ExplorerContainer.tsx +9 -11
- package/src/components/Globe/Globe.stories.tsx +2 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +8 -5
- package/src/components/Graph/D3ForceGraph.tsx +2 -2
- package/src/components/Graph/ForceGraph.stories.tsx +8 -5
- package/src/components/Graph/adapter.ts +14 -8
- package/src/components/Graph/testing.ts +3 -3
- package/src/components/Tree/Tree.stories.tsx +3 -2
- package/src/components/Tree/Tree.tsx +8 -3
- package/src/components/Tree/testing/generator.ts +4 -2
- package/src/components/Tree/types/tree.test.ts +3 -1
- package/src/components/Tree/types/tree.ts +39 -18
- package/src/components/Tree/types/types.ts +1 -1
- package/src/hooks/useGraphModel.ts +6 -3
- package/src/meta.ts +2 -2
- package/src/types/ExplorerAction.ts +0 -16
- package/src/types/Graph.ts +5 -6
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs +0 -50
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-6BVXZQPP.mjs +0 -188
- package/dist/lib/browser/chunk-6BVXZQPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-P6FFFVPM.mjs.map +0 -7
- package/dist/lib/browser/chunk-UBHZGWZQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XAMO4BLV.mjs +0 -32
- package/dist/lib/browser/intent-resolver-XAMO4BLV.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs +0 -34
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs +0 -51
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BY2XZET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs +0 -190
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UXZM5VJB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YNS4MM2C.mjs +0 -33
- package/dist/lib/node-esm/intent-resolver-YNS4MM2C.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs +0 -35
- package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs.map +0 -7
- 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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -21
- package/src/capabilities/react-surface.tsx +0 -26
|
@@ -0,0 +1,45 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-UBHZGWZQ.mjs";
|
|
4
1
|
import {
|
|
5
2
|
__export
|
|
6
3
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -8,12 +5,28 @@ import {
|
|
|
8
5
|
// src/types/ExplorerAction.ts
|
|
9
6
|
var ExplorerAction_exports = {};
|
|
10
7
|
__export(ExplorerAction_exports, {
|
|
11
|
-
CreateGraph: () => CreateGraph,
|
|
12
8
|
GraphProps: () => GraphProps
|
|
13
9
|
});
|
|
14
|
-
import * as
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
15
11
|
import { TypeInputOptionsAnnotation } from "@dxos/plugin-space/types";
|
|
16
|
-
|
|
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
|
+
});
|
|
17
30
|
|
|
18
31
|
// src/types/Graph.ts
|
|
19
32
|
var Graph_exports = {};
|
|
@@ -22,18 +35,18 @@ __export(Graph_exports, {
|
|
|
22
35
|
GraphV1: () => GraphV1,
|
|
23
36
|
make: () => make
|
|
24
37
|
});
|
|
25
|
-
import * as
|
|
38
|
+
import * as Schema2 from "effect/Schema";
|
|
26
39
|
import { Filter, Obj, Query, QueryAST, Ref, Type } from "@dxos/echo";
|
|
27
40
|
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
28
41
|
import { View, ViewAnnotation } from "@dxos/schema";
|
|
29
|
-
var GraphSchema =
|
|
30
|
-
name:
|
|
42
|
+
var GraphSchema = Schema2.Struct({
|
|
43
|
+
name: Schema2.optional(Schema2.String),
|
|
31
44
|
view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
32
|
-
query:
|
|
33
|
-
raw:
|
|
45
|
+
query: Schema2.Struct({
|
|
46
|
+
raw: Schema2.optional(Schema2.String),
|
|
34
47
|
ast: QueryAST.Query
|
|
35
|
-
}).pipe(
|
|
36
|
-
}).pipe(Type.
|
|
48
|
+
}).pipe(FormInputAnnotation.set(false))
|
|
49
|
+
}).pipe(Type.object({
|
|
37
50
|
typename: "dxos.org/type/Graph",
|
|
38
51
|
version: "0.2.0"
|
|
39
52
|
}), LabelAnnotation.set([
|
|
@@ -50,51 +63,21 @@ var make = ({ name, query = {
|
|
|
50
63
|
query
|
|
51
64
|
});
|
|
52
65
|
};
|
|
53
|
-
var GraphV1 =
|
|
54
|
-
name:
|
|
55
|
-
query:
|
|
56
|
-
raw:
|
|
66
|
+
var GraphV1 = Schema2.Struct({
|
|
67
|
+
name: Schema2.optional(Schema2.String),
|
|
68
|
+
query: Schema2.Struct({
|
|
69
|
+
raw: Schema2.optional(Schema2.String),
|
|
57
70
|
ast: QueryAST.Query
|
|
58
|
-
})
|
|
59
|
-
}).pipe(Type.
|
|
71
|
+
})
|
|
72
|
+
}).pipe(Type.object({
|
|
60
73
|
typename: "dxos.org/type/Graph",
|
|
61
74
|
version: "0.1.0"
|
|
62
75
|
}), LabelAnnotation.set([
|
|
63
76
|
"name"
|
|
64
77
|
]));
|
|
65
78
|
|
|
66
|
-
// src/types/ExplorerAction.ts
|
|
67
|
-
var EXPLORER_ACTION = `${meta.id}/action`;
|
|
68
|
-
var GraphProps = Schema2.Struct({
|
|
69
|
-
name: Schema2.optional(Schema2.String),
|
|
70
|
-
// TODO(wittjosiah): This should be a query input instead.
|
|
71
|
-
typename: Schema2.String.pipe(Schema2.annotations({
|
|
72
|
-
title: "Select type"
|
|
73
|
-
}), TypeInputOptionsAnnotation.set({
|
|
74
|
-
location: [
|
|
75
|
-
"database",
|
|
76
|
-
"runtime"
|
|
77
|
-
],
|
|
78
|
-
kind: [
|
|
79
|
-
"user"
|
|
80
|
-
],
|
|
81
|
-
registered: [
|
|
82
|
-
"registered"
|
|
83
|
-
]
|
|
84
|
-
}), Schema2.optional)
|
|
85
|
-
});
|
|
86
|
-
var CreateGraph = class extends Schema2.TaggedClass()(`${EXPLORER_ACTION}/create-graph`, {
|
|
87
|
-
input: Schema2.Struct({
|
|
88
|
-
space: SpaceSchema
|
|
89
|
-
}).pipe(Schema2.extend(GraphProps)),
|
|
90
|
-
output: Schema2.Struct({
|
|
91
|
-
object: Graph
|
|
92
|
-
})
|
|
93
|
-
}) {
|
|
94
|
-
};
|
|
95
|
-
|
|
96
79
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
80
|
+
ExplorerAction_exports,
|
|
81
|
+
Graph_exports
|
|
99
82
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-HIFLWHXR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n 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
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/components/Chart/Chart.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
2
|
import * as Plot from "@observablehq/plot";
|
|
4
3
|
import React, { useEffect } from "react";
|
|
5
4
|
import { useResizeDetector } from "react-resize-detector";
|
|
@@ -17,49 +16,43 @@ var defaultOptions = {
|
|
|
17
16
|
fillOpacity: 0.2
|
|
18
17
|
};
|
|
19
18
|
var Chart = ({ items = [], accessor, options = defaultOptions }) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const plot3 = Plot.plot({
|
|
30
|
-
grid: true,
|
|
31
|
-
width,
|
|
32
|
-
height,
|
|
33
|
-
style: {
|
|
34
|
-
background: "transparent"
|
|
35
|
-
},
|
|
36
|
-
marks: [
|
|
37
|
-
Plot.frame(),
|
|
38
|
-
Plot.dot(items, {
|
|
39
|
-
x: createAdapter("x", accessor),
|
|
40
|
-
y: createAdapter("y", accessor),
|
|
41
|
-
...options
|
|
42
|
-
})
|
|
43
|
-
]
|
|
44
|
-
});
|
|
45
|
-
containerRef.current.append(plot3);
|
|
46
|
-
return () => plot3?.remove();
|
|
47
|
-
}, [
|
|
48
|
-
items,
|
|
19
|
+
const { ref: containerRef, width = 0, height = 0 } = useResizeDetector({
|
|
20
|
+
refreshRate: 200
|
|
21
|
+
});
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!width || !height) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const plot3 = Plot.plot({
|
|
27
|
+
grid: true,
|
|
49
28
|
width,
|
|
50
|
-
height
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
height,
|
|
30
|
+
style: {
|
|
31
|
+
background: "transparent"
|
|
32
|
+
},
|
|
33
|
+
marks: [
|
|
34
|
+
Plot.frame(),
|
|
35
|
+
Plot.dot(items, {
|
|
36
|
+
x: createAdapter("x", accessor),
|
|
37
|
+
y: createAdapter("y", accessor),
|
|
38
|
+
...options
|
|
39
|
+
})
|
|
40
|
+
]
|
|
55
41
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
42
|
+
containerRef.current.append(plot3);
|
|
43
|
+
return () => plot3?.remove();
|
|
44
|
+
}, [
|
|
45
|
+
items,
|
|
46
|
+
width,
|
|
47
|
+
height
|
|
48
|
+
]);
|
|
49
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
50
|
+
ref: containerRef,
|
|
51
|
+
className: "grow"
|
|
52
|
+
});
|
|
59
53
|
};
|
|
60
54
|
|
|
61
55
|
// src/components/Globe/Globe.tsx
|
|
62
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
63
56
|
import * as Plot2 from "@observablehq/plot";
|
|
64
57
|
import React2, { useEffect as useEffect2 } from "react";
|
|
65
58
|
import { useResizeDetector as useResizeDetector2 } from "react-resize-detector";
|
|
@@ -10773,68 +10766,63 @@ var defaultOptions2 = {
|
|
|
10773
10766
|
fill: "#003300"
|
|
10774
10767
|
};
|
|
10775
10768
|
var Globe = ({ items = [], accessor, projection = "orthographic", options = defaultOptions2 }) => {
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
-100,
|
|
10792
|
-
-20
|
|
10793
|
-
]
|
|
10794
|
-
},
|
|
10795
|
-
// projection: { type: 'equirectangular', rotate: [-140, -30] },
|
|
10796
|
-
width,
|
|
10797
|
-
height,
|
|
10798
|
-
style: {
|
|
10799
|
-
background: "transparent"
|
|
10800
|
-
},
|
|
10801
|
-
// TODO(burdon): Create simple wrapper for Plot with good defaults.
|
|
10802
|
-
marks: [
|
|
10803
|
-
Plot2.sphere({
|
|
10804
|
-
fill: "lightblue",
|
|
10805
|
-
fillOpacity: 0.5
|
|
10806
|
-
}),
|
|
10807
|
-
Plot2.geo(land, {
|
|
10808
|
-
fill: "darkgreen",
|
|
10809
|
-
fillOpacity: 0.5
|
|
10810
|
-
}),
|
|
10811
|
-
Plot2.graticule(),
|
|
10812
|
-
Plot2.dot(items, {
|
|
10813
|
-
x: createAdapter("lat", accessor),
|
|
10814
|
-
y: createAdapter("lng", accessor),
|
|
10815
|
-
...options
|
|
10816
|
-
})
|
|
10769
|
+
const { ref: containerRef, width = 0, height = 0 } = useResizeDetector2({
|
|
10770
|
+
refreshRate: 200
|
|
10771
|
+
});
|
|
10772
|
+
const land = topojson.feature(countries_110m_default, countries_110m_default.objects.land);
|
|
10773
|
+
useEffect2(() => {
|
|
10774
|
+
if (!width || !height) {
|
|
10775
|
+
return;
|
|
10776
|
+
}
|
|
10777
|
+
const plot3 = Plot2.plot({
|
|
10778
|
+
// https://observablehq.com/plot/features/projections
|
|
10779
|
+
projection: {
|
|
10780
|
+
type: projection,
|
|
10781
|
+
rotate: [
|
|
10782
|
+
-100,
|
|
10783
|
+
-20
|
|
10817
10784
|
]
|
|
10818
|
-
}
|
|
10819
|
-
|
|
10820
|
-
return () => plot3?.remove();
|
|
10821
|
-
}, [
|
|
10822
|
-
items,
|
|
10785
|
+
},
|
|
10786
|
+
// projection: { type: 'equirectangular', rotate: [-140, -30] },
|
|
10823
10787
|
width,
|
|
10824
|
-
height
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10788
|
+
height,
|
|
10789
|
+
style: {
|
|
10790
|
+
background: "transparent"
|
|
10791
|
+
},
|
|
10792
|
+
// TODO(burdon): Create simple wrapper for Plot with good defaults.
|
|
10793
|
+
marks: [
|
|
10794
|
+
Plot2.sphere({
|
|
10795
|
+
fill: "lightblue",
|
|
10796
|
+
fillOpacity: 0.5
|
|
10797
|
+
}),
|
|
10798
|
+
Plot2.geo(land, {
|
|
10799
|
+
fill: "darkgreen",
|
|
10800
|
+
fillOpacity: 0.5
|
|
10801
|
+
}),
|
|
10802
|
+
Plot2.graticule(),
|
|
10803
|
+
Plot2.dot(items, {
|
|
10804
|
+
x: createAdapter("lat", accessor),
|
|
10805
|
+
y: createAdapter("lng", accessor),
|
|
10806
|
+
...options
|
|
10807
|
+
})
|
|
10808
|
+
]
|
|
10829
10809
|
});
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
}
|
|
10810
|
+
containerRef.current.append(plot3);
|
|
10811
|
+
return () => plot3?.remove();
|
|
10812
|
+
}, [
|
|
10813
|
+
items,
|
|
10814
|
+
width,
|
|
10815
|
+
height
|
|
10816
|
+
]);
|
|
10817
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
10818
|
+
ref: containerRef,
|
|
10819
|
+
className: "grow p-4"
|
|
10820
|
+
});
|
|
10833
10821
|
};
|
|
10834
10822
|
|
|
10835
10823
|
// src/components/Tree/Tree.tsx
|
|
10836
|
-
import {
|
|
10837
|
-
import React3, { useEffect as useEffect3, useRef, useState } from "react";
|
|
10824
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
10825
|
+
import React3, { useContext, useEffect as useEffect3, useRef, useState } from "react";
|
|
10838
10826
|
import { useAsyncState } from "@dxos/react-ui";
|
|
10839
10827
|
import { SVG } from "@dxos/react-ui-graph";
|
|
10840
10828
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
@@ -10975,6 +10963,7 @@ var TidyTree_default = TidyTree;
|
|
|
10975
10963
|
// src/components/Tree/types/tree.ts
|
|
10976
10964
|
import * as Schema from "effect/Schema";
|
|
10977
10965
|
import { Key, Obj, Type } from "@dxos/echo";
|
|
10966
|
+
import { TestSchema } from "@dxos/echo/testing";
|
|
10978
10967
|
import { invariant } from "@dxos/invariant";
|
|
10979
10968
|
var TreeNodeType = Schema.Struct({
|
|
10980
10969
|
id: Key.ObjectId,
|
|
@@ -10983,7 +10972,7 @@ var TreeNodeType = Schema.Struct({
|
|
|
10983
10972
|
key: Schema.String,
|
|
10984
10973
|
value: Schema.Any
|
|
10985
10974
|
})),
|
|
10986
|
-
ref: Schema.optional(Type.Ref(
|
|
10975
|
+
ref: Schema.optional(Type.Ref(TestSchema.Expando))
|
|
10987
10976
|
}).pipe(Schema.mutable);
|
|
10988
10977
|
var TreeType = Schema.Struct({
|
|
10989
10978
|
root: Key.ObjectId,
|
|
@@ -10991,7 +10980,7 @@ var TreeType = Schema.Struct({
|
|
|
10991
10980
|
key: Key.ObjectId,
|
|
10992
10981
|
value: TreeNodeType
|
|
10993
10982
|
}))
|
|
10994
|
-
}).pipe(Type.
|
|
10983
|
+
}).pipe(Type.object({
|
|
10995
10984
|
typename: "dxos.org/type/Tree",
|
|
10996
10985
|
version: "0.1.0"
|
|
10997
10986
|
}));
|
|
@@ -11023,61 +11012,59 @@ var renderers = /* @__PURE__ */ new Map([
|
|
|
11023
11012
|
]
|
|
11024
11013
|
]);
|
|
11025
11014
|
var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
}
|
|
11015
|
+
const registry = useContext(RegistryContext);
|
|
11016
|
+
const [model] = useAsyncState(async () => space ? new SpaceGraphModel(registry).open(space.db) : void 0, [
|
|
11017
|
+
space,
|
|
11018
|
+
selected,
|
|
11019
|
+
registry
|
|
11020
|
+
]);
|
|
11021
|
+
const [tree3, setTree] = useState();
|
|
11022
|
+
useEffect3(() => {
|
|
11023
|
+
return model?.subscribe(() => {
|
|
11024
|
+
const tree4 = mapGraphToTreeData(model);
|
|
11025
|
+
setTree(tree4);
|
|
11026
|
+
}, true);
|
|
11027
|
+
}, [
|
|
11028
|
+
model
|
|
11029
|
+
]);
|
|
11030
|
+
const context = useRef(null);
|
|
11031
|
+
useEffect3(() => {
|
|
11032
|
+
if (context.current?.size) {
|
|
11033
|
+
const { width, height } = context.current.size;
|
|
11034
|
+
const size = Math.min(width, height);
|
|
11035
|
+
const radius = size * 0.4;
|
|
11036
|
+
const options = {
|
|
11037
|
+
// TODO(burdon): Type.
|
|
11038
|
+
label: (d) => d.label ?? d.id,
|
|
11039
|
+
width,
|
|
11040
|
+
height,
|
|
11041
|
+
radius,
|
|
11042
|
+
marginLeft: (width - radius * 2) / 2,
|
|
11043
|
+
marginRight: (width - radius * 2) / 2,
|
|
11044
|
+
marginTop: (height - radius * 2) / 2,
|
|
11045
|
+
marginBottom: (height - radius * 2) / 2,
|
|
11046
|
+
slots: defaultTreeLayoutSlots
|
|
11047
|
+
};
|
|
11048
|
+
if (tree3) {
|
|
11049
|
+
const renderer = renderers.get(variant);
|
|
11050
|
+
renderer?.(context.current.svg, tree3, options);
|
|
11063
11051
|
}
|
|
11064
|
-
}
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
}
|
|
11052
|
+
}
|
|
11053
|
+
}, [
|
|
11054
|
+
context.current,
|
|
11055
|
+
tree3
|
|
11056
|
+
]);
|
|
11057
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
11058
|
+
className: "grow",
|
|
11059
|
+
onClick: () => onNodeClick?.()
|
|
11060
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Root, {
|
|
11061
|
+
ref: context
|
|
11062
|
+
}));
|
|
11076
11063
|
};
|
|
11077
11064
|
|
|
11078
11065
|
// src/components/index.ts
|
|
11079
11066
|
import { lazy } from "react";
|
|
11080
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-
|
|
11067
|
+
var ExplorerContainer = lazy(() => import("./ExplorerContainer-46BHUF6R.mjs"));
|
|
11081
11068
|
|
|
11082
11069
|
export {
|
|
11083
11070
|
Chart,
|
|
@@ -11086,4 +11073,4 @@ export {
|
|
|
11086
11073
|
Tree,
|
|
11087
11074
|
ExplorerContainer
|
|
11088
11075
|
};
|
|
11089
|
-
//# sourceMappingURL=chunk-
|
|
11076
|
+
//# sourceMappingURL=chunk-JZSBQYJQ.mjs.map
|