@dxos/plugin-explorer 0.8.4-main.5acf9ea → 0.8.4-main.5ad4a44
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-OGHSHZD5.mjs → ExplorerContainer-S66JDOAF.mjs} +18 -6
- package/dist/lib/browser/ExplorerContainer-S66JDOAF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UL5EDJPE.mjs → chunk-2DGFNLRO.mjs} +2 -4
- package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OAOY7SHY.mjs → chunk-2MKBRIUT.mjs} +6 -5
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EF4BFHTI.mjs → chunk-4ETQJYX4.mjs} +7 -7
- package/dist/lib/browser/chunk-4ETQJYX4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-J2BBZOSF.mjs → chunk-NXGP6NTP.mjs} +28 -12
- package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PVFZFKQ6.mjs → chunk-UCDNCIRV.mjs} +36 -24
- package/dist/lib/browser/{chunk-PVFZFKQ6.mjs.map → chunk-UCDNCIRV.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +12 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-XH2UO2FM.mjs → intent-resolver-OXJJ3PII.mjs} +6 -6
- package/dist/lib/browser/{intent-resolver-XH2UO2FM.mjs.map → intent-resolver-OXJJ3PII.mjs.map} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -3
- package/dist/lib/browser/{react-surface-65VQ42HX.mjs → react-surface-C4EC6ZDZ.mjs} +9 -9
- package/dist/lib/browser/react-surface-C4EC6ZDZ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{ExplorerContainer-6ON5NA2P.mjs → ExplorerContainer-GIJN67DO.mjs} +18 -6
- package/dist/lib/node-esm/ExplorerContainer-GIJN67DO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PPBUWC7F.mjs → chunk-3ODK27PU.mjs} +6 -5
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4VMSNXYL.mjs → chunk-6JACZE7E.mjs} +28 -12
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VKCOKQRG.mjs → chunk-AGHU3KVI.mjs} +7 -7
- package/dist/lib/node-esm/chunk-AGHU3KVI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PIAXA43R.mjs → chunk-PX6LHR2N.mjs} +2 -4
- package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-S5A2EUSJ.mjs → chunk-WHKUQG5M.mjs} +36 -24
- package/dist/lib/node-esm/{chunk-S5A2EUSJ.mjs.map → chunk-WHKUQG5M.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +12 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-AGBBNA67.mjs → intent-resolver-GVM36TJX.mjs} +6 -6
- package/dist/lib/node-esm/{intent-resolver-AGBBNA67.mjs.map → intent-resolver-GVM36TJX.mjs.map} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -3
- package/dist/lib/node-esm/{react-surface-IJIMYAST.mjs → react-surface-YGGLTBF3.mjs} +9 -9
- package/dist/lib/node-esm/react-surface-YGGLTBF3.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/ExplorerPlugin.d.ts +1 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.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 +8 -4
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +8 -4
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +2 -2
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +13 -4
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +13 -4
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/testing.d.ts +1 -1
- package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +13 -16
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +1 -1
- package/dist/types/src/components/Tree/types/tree.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/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +12 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +3 -3
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +3 -3
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -42
- package/src/ExplorerPlugin.tsx +46 -47
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/components/Chart/Chart.stories.tsx +9 -7
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/ExplorerContainer.tsx +18 -4
- package/src/components/Globe/Globe.stories.tsx +14 -12
- package/src/components/Globe/Globe.tsx +1 -1
- package/src/components/Graph/D3ForceGraph.stories.tsx +15 -11
- package/src/components/Graph/D3ForceGraph.tsx +5 -5
- package/src/components/Graph/ForceGraph.stories.tsx +15 -11
- package/src/components/Graph/ForceGraph.tsx +4 -4
- package/src/components/Graph/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +28 -22
- package/src/components/Tree/Tree.tsx +3 -3
- package/src/components/Tree/types/tree.test.ts +2 -1
- package/src/components/Tree/types/tree.ts +1 -1
- package/src/hooks/useGraphModel.ts +5 -4
- package/src/meta.ts +1 -3
- package/src/translations.ts +2 -0
- package/src/types/schema.ts +2 -2
- package/src/types/types.ts +4 -3
- package/dist/lib/browser/ExplorerContainer-OGHSHZD5.mjs.map +0 -7
- package/dist/lib/browser/chunk-EF4BFHTI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J2BBZOSF.mjs.map +0 -7
- package/dist/lib/browser/chunk-OAOY7SHY.mjs.map +0 -7
- package/dist/lib/browser/chunk-UL5EDJPE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-65VQ42HX.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-6ON5NA2P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4VMSNXYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PIAXA43R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PPBUWC7F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VKCOKQRG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-IJIMYAST.mjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Graph/D3ForceGraph.tsx", "../../../src/components/Graph/ForceGraph.tsx", "../../../src/components/Graph/adapter.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { SelectionModel } from '@dxos/graph';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n type GraphController,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProps,\n SVG,\n type SVGContext,\n} from '@dxos/react-ui-graph';\nimport { getHashStyles } from '@dxos/react-ui-theme';\nimport { type SpaceGraphEdge, type SpaceGraphModel, type SpaceGraphNode } from '@dxos/schema';\n\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nexport type D3ForceGraphProps = ThemedClassName<\n {\n model?: SpaceGraphModel;\n match?: RegExp;\n selection?: SelectionModel;\n grid?: boolean;\n } & Pick<GraphProps, 'drag'>\n>;\n\nexport const D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }: D3ForceGraphProps) => {\n const context = useRef<SVGContext>(null);\n const projector = useMemo<GraphForceProjector | undefined>(() => {\n if (context.current) {\n return new GraphForceProjector(context.current, {\n attributes: {\n linkForce: (edge) => {\n // TODO(burdon): Check type (currently assumes Employee property).\n // Edge shouldn't contribute to force if it's not active.\n return edge.data?.object?.active !== false;\n },\n },\n forces: {\n point: {\n strength: 0.01,\n },\n },\n });\n }\n }, [context.current]);\n\n const graph = useRef<GraphController>(null);\n const selection = useMemo(() => _selection ?? new SelectionModel(), [_selection]);\n useEffect(() => graph.current?.repaint(), [selection.selected.value]);\n\n const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(\n (node) => {\n if (selection.contains(node.id)) {\n selection.remove(node.id);\n } else {\n selection.add(node.id);\n }\n },\n [selection],\n );\n\n return (\n <SVG.Root ref={context} classNames={classNames}>\n <SVG.Markers />\n {grid && <SVG.Grid axis />}\n <SVG.Zoom extent={[1 / 2, 2]}>\n <SVG.Graph<SpaceGraphNode, SpaceGraphEdge>\n {...props}\n ref={graph}\n model={model}\n projector={projector}\n labels={{\n text: (node) => {\n return node.data?.data.label ?? node.id;\n },\n }}\n attributes={{\n node: (node: GraphLayoutNode<SpaceGraphNode>) => {\n const obj = node.data?.data.object;\n return {\n data: {\n color: getHashStyles(obj && Obj.getTypename(obj))?.hue,\n },\n classes: {\n 'dx-selected': selection.contains(node.id),\n },\n };\n },\n }}\n onSelect={handleSelect}\n />\n </SVG.Zoom>\n </SVG.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { forceLink, forceManyBody } from 'd3';\nimport NativeForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useRef, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type SearchResult, filterObjectsSync } from '@dxos/plugin-search';\nimport { type SpaceGraphModel } from '@dxos/schema';\n\nimport { GraphAdapter } from './adapter';\n\nexport type ForceGraphProps = {\n model?: SpaceGraphModel;\n match?: RegExp;\n};\n\nexport const ForceGraph: FC<ForceGraphProps> = ({ model, match }) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<NativeForceGraph>(null);\n\n const filteredRef = useRef<SearchResult[]>([]);\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n\n const [data, setData] = useState<GraphAdapter>();\n useEffect(() => {\n return model?.subscribe((model) => {\n setData(new GraphAdapter(model.graph));\n });\n }, [model]);\n\n useEffect(() => {\n if (rootRef.current) {\n // https://github.com/vasturiano/force-graph\n // https://github.com/vasturiano/3d-force-graph\n forceGraph.current = new NativeForceGraph(rootRef.current)\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#node-styling\n .nodeRelSize(6)\n .nodeLabel((node: any) => (node.type === 'schema' ? node.data.typename : (node.data.label ?? node.id)))\n .nodeAutoColorBy((node: any) => (node.type === 'schema' ? 'schema' : node.data.typename))\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#link-styling\n .linkAutoColorBy((link: any) => link.type);\n }\n\n return () => {\n forceGraph.current?.pauseAnimation().graphData({ nodes: [], links: [] });\n forceGraph.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (!data || !width || !height || !forceGraph.current) {\n return;\n }\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#container-layout\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n handleZoomToFit();\n })\n .onNodeClick((node: any) => {\n forceGraph.current?.emitParticle(node);\n })\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#force-engine-d3-force-configuration\n // .d3Force('center', forceCenter().strength(0.9))\n .d3Force('link', forceLink().distance(160).strength(0.5))\n .d3Force('charge', forceManyBody().strength(-30))\n\n .graphData(data)\n .warmupTicks(100)\n .cooldownTime(1_000)\n .resumeAnimation();\n }, [data, width, height, forceGraph.current]);\n\n const handleZoomToFit = () => {\n forceGraph.current?.zoomToFit(400, 40);\n };\n\n return (\n <div ref={ref} className='relative grow' onClick={handleZoomToFit}>\n <div ref={rootRef} className='absolute inset-0' />\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\n\nexport type GraphNode = {\n id?: string;\n};\n\nexport type GraphLink = {\n source?: string;\n target?: string;\n};\n\nexport type GraphData = {\n nodes: GraphNode[];\n links: GraphLink[];\n};\n\n/**\n * Map common graph to force-graph format.\n */\nexport class GraphAdapter implements GraphData {\n private readonly _nodes: GraphNode[] = [];\n private readonly _links: GraphLink[] = [];\n\n constructor(private readonly graph: Graph) {\n this._nodes = graph.nodes.map((node) => ({\n id: node.id,\n type: node.type,\n data: node.data,\n }));\n\n this._links = graph.edges.map((edge) => ({\n type: edge.type,\n source: edge.source,\n target: edge.target,\n data: edge.data,\n }));\n }\n\n get nodes() {\n return this._nodes;\n }\n\n get links() {\n return this._links;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAIA,OAAOA,SAASC,aAAaC,WAAWC,SAASC,cAAc;AAE/D,SAASC,WAAW;AACpB,SAASC,sBAAsB;AAE/B,SAEEC,qBAGAC,WAEK;AACP,SAASC,qBAAqB;AAG9B,OAAO;AAWA,IAAMC,eAAe,CAAC,EAAEC,YAAYC,OAAOC,WAAWC,YAAYC,MAAM,GAAGC,MAAAA,MAA0B;;;AAC1G,UAAMC,UAAUC,OAAmB,IAAA;AACnC,UAAMC,YAAYC,QAAyC,MAAA;AACzD,UAAIH,QAAQI,SAAS;AACnB,eAAO,IAAIC,oBAAoBL,QAAQI,SAAS;UAC9CE,YAAY;YACVC,WAAW,CAACC,SAAAA;AAGV,qBAAOA,KAAKC,MAAMC,QAAQC,WAAW;YACvC;UACF;UACAC,QAAQ;YACNC,OAAO;cACLC,UAAU;YACZ;UACF;QACF,CAAA;MACF;IACF,GAAG;MAACd,QAAQI;KAAQ;AAEpB,UAAMW,QAAQd,OAAwB,IAAA;AACtC,UAAML,YAAYO,QAAQ,MAAMN,cAAc,IAAImB,eAAAA,GAAkB;MAACnB;KAAW;AAChFoB,cAAU,MAAMF,MAAMX,SAASc,QAAAA,GAAW;MAACtB,UAAUuB,SAASC;KAAM;AAEpE,UAAMC,eAAeC,YACnB,CAACC,SAAAA;AACC,UAAI3B,UAAU4B,SAASD,KAAKE,EAAE,GAAG;AAC/B7B,kBAAU8B,OAAOH,KAAKE,EAAE;MAC1B,OAAO;AACL7B,kBAAU+B,IAAIJ,KAAKE,EAAE;MACvB;IACF,GACA;MAAC7B;KAAU;AAGb,WACE,sBAAA,cAACgC,IAAIC,MAAI;MAACC,KAAK9B;MAASN;OACtB,sBAAA,cAACkC,IAAIG,SAAO,IAAA,GACXjC,QAAQ,sBAAA,cAAC8B,IAAII,MAAI;MAACC,MAAAA;QACnB,sBAAA,cAACL,IAAIM,MAAI;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F,CAAA,EACCC,YAAY,CAACd,SAAAA;AACZf,mBAAWE,SAAS4B,aAAaf,IAAAA;MACnC,CAAA,EAICgB,QAAQ,QAAQC,UAAAA,EAAYC,SAAS,GAAA,EAAKC,SAAS,GAAA,CAAA,EACnDH,QAAQ,UAAUI,cAAAA,EAAgBD,SAAS,GAAC,CAAA,EAE5CV,UAAUnB,IAAAA,EACV+B,YAAY,GAAA,EACZC,aAAa,GAAA,EACbC,gBAAe;IACpB,GAAG;MAACjC;MAAMX;MAAOC;MAAQK,WAAWE;KAAQ;AAE5C,UAAM0B,kBAAkB,MAAA;AACtB5B,iBAAWE,SAASqC,UAAU,KAAK,EAAA;IACrC;AAEA,WACE,gBAAAC,OAAA,cAACC,OAAAA;MAAIhD;MAAUiD,WAAU;MAAgBC,SAASf;OAChD,gBAAAY,OAAA,cAACC,OAAAA;MAAIhD,KAAKK;MAAS4C,WAAU;;;;;AAGnC;",
|
|
6
|
+
"names": ["React", "useCallback", "useEffect", "useMemo", "useRef", "Obj", "SelectionModel", "GraphForceProjector", "SVG", "getHashStyles", "D3ForceGraph", "classNames", "model", "selection", "_selection", "grid", "props", "context", "useRef", "projector", "useMemo", "current", "GraphForceProjector", "attributes", "linkForce", "edge", "data", "object", "active", "forces", "point", "strength", "graph", "SelectionModel", "useEffect", "repaint", "selected", "value", "handleSelect", "useCallback", "node", "contains", "id", "remove", "add", "SVG", "Root", "ref", "Markers", "Grid", "axis", "Zoom", "extent", "Graph", "labels", "text", "label", "obj", "color", "getHashStyles", "Obj", "getTypename", "hue", "classes", "onSelect", "forceLink", "forceManyBody", "NativeForceGraph", "React", "useEffect", "useRef", "useState", "useResizeDetector", "filterObjectsSync", "GraphAdapter", "nodes", "_nodes", "links", "_links", "graph", "map", "node", "id", "type", "data", "edges", "edge", "source", "target", "ForceGraph", "model", "match", "ref", "width", "height", "useResizeDetector", "refreshRate", "rootRef", "useRef", "forceGraph", "filteredRef", "current", "filterObjectsSync", "objects", "data", "setData", "useState", "useEffect", "subscribe", "GraphAdapter", "graph", "NativeForceGraph", "nodeRelSize", "nodeLabel", "node", "type", "typename", "label", "id", "nodeAutoColorBy", "linkAutoColorBy", "link", "pauseAnimation", "graphData", "nodes", "links", "onEngineStop", "handleZoomToFit", "onNodeClick", "emitParticle", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
meta
|
|
4
|
+
} from "./chunk-PX6LHR2N.mjs";
|
|
5
5
|
|
|
6
6
|
// src/types/schema.ts
|
|
7
|
-
import
|
|
8
|
-
import { TypedObject } from "@dxos/echo
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import { TypedObject } from "@dxos/echo/internal";
|
|
9
9
|
var ViewType = class extends TypedObject({
|
|
10
10
|
typename: "dxos.org/type/ExplorerView",
|
|
11
11
|
version: "0.1.0"
|
|
@@ -16,9 +16,9 @@ var ViewType = class extends TypedObject({
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// src/types/types.ts
|
|
19
|
-
import
|
|
19
|
+
import * as Schema2 from "effect/Schema";
|
|
20
20
|
(function(ExplorerAction2) {
|
|
21
|
-
const EXPLORER_ACTION = `${
|
|
21
|
+
const EXPLORER_ACTION = `${meta.id}/action`;
|
|
22
22
|
class Create extends Schema2.TaggedClass()(`${EXPLORER_ACTION}/create`, {
|
|
23
23
|
input: Schema2.Struct({
|
|
24
24
|
name: Schema2.optional(Schema2.String)
|
|
@@ -36,4 +36,4 @@ export {
|
|
|
36
36
|
ViewType,
|
|
37
37
|
ExplorerAction
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-AGHU3KVI.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypedObject } from '@dxos/echo/internal';\n\n// TODO(burdon): Clashes with sdk/view.\nexport class ViewType extends TypedObject({\n typename: 'dxos.org/type/ExplorerView',\n version: '0.1.0',\n})({\n name: Schema.optional(Schema.String),\n type: Schema.String,\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { meta } from '../meta';\n\nimport { ViewType } from './schema';\n\nexport namespace ExplorerAction {\n const EXPLORER_ACTION = `${meta.id}/action`;\n\n export class Create extends Schema.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ViewType,\n }),\n }) {}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,mBAAmB;AAGrB,IAAMC,WAAN,cAAuBC,YAAY;EACxCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,MAAaC,gBAAgBC,aAAM;EACnCC,MAAaD;AACf,CAAA,EAAA;AAAI;;;ACXJ,YAAYE,aAAY;UAMPC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,KAAKC,EAAE;EAE3B,MAAMC,eAAsBC,oBAAW,EAAW,GAAGJ,eAAAA,WAA0B;IACpFK,OAAcC,eAAO;MACnBC,MAAaC,iBAAgBC,cAAM;IACrC,CAAA;IACAC,QAAeJ,eAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPST,SAAAA;AAQf,GAXiBJ,mBAAAA,iBAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["Schema", "TypedObject", "ViewType", "TypedObject", "typename", "version", "name", "optional", "String", "type", "Schema", "ExplorerAction", "EXPLORER_ACTION", "meta", "id", "Create", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ViewType"]
|
|
7
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/meta.ts
|
|
4
|
-
var EXPLORER_PLUGIN = "dxos.org/plugin/explorer";
|
|
5
4
|
var meta = {
|
|
6
|
-
id:
|
|
5
|
+
id: "dxos.org/plugin/explorer",
|
|
7
6
|
name: "Explorer",
|
|
8
7
|
description: "Install this plugin to view a hypergraph of all objects inside of your Space.",
|
|
9
8
|
icon: "ph--graph--regular",
|
|
@@ -17,7 +16,6 @@ var meta = {
|
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export {
|
|
20
|
-
EXPLORER_PLUGIN,
|
|
21
19
|
meta
|
|
22
20
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-PX6LHR2N.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/explorer',\n name: 'Explorer',\n description: 'Install this plugin to view a hypergraph of all objects inside of your Space.',\n icon: 'ph--graph--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";;;AAMO,IAAMA,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
|
|
7
|
+
}
|
|
@@ -10975,9 +10975,22 @@ var TidyTree = (s, data, options) => {
|
|
|
10975
10975
|
var TidyTree_default = TidyTree;
|
|
10976
10976
|
|
|
10977
10977
|
// src/components/Tree/types/tree.ts
|
|
10978
|
-
import
|
|
10978
|
+
import * as Schema from "effect/Schema";
|
|
10979
10979
|
import { Key, Obj, Type } from "@dxos/echo";
|
|
10980
10980
|
import { invariant } from "@dxos/invariant";
|
|
10981
|
+
function _define_property(obj, key, value) {
|
|
10982
|
+
if (key in obj) {
|
|
10983
|
+
Object.defineProperty(obj, key, {
|
|
10984
|
+
value,
|
|
10985
|
+
enumerable: true,
|
|
10986
|
+
configurable: true,
|
|
10987
|
+
writable: true
|
|
10988
|
+
});
|
|
10989
|
+
} else {
|
|
10990
|
+
obj[key] = value;
|
|
10991
|
+
}
|
|
10992
|
+
return obj;
|
|
10993
|
+
}
|
|
10981
10994
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-explorer/src/components/Tree/types/tree.ts";
|
|
10982
10995
|
var TreeNodeType = Schema.Struct({
|
|
10983
10996
|
id: Key.ObjectId,
|
|
@@ -10999,26 +11012,6 @@ var TreeType = Schema.Struct({
|
|
|
10999
11012
|
version: "0.1.0"
|
|
11000
11013
|
}));
|
|
11001
11014
|
var Tree = class _Tree {
|
|
11002
|
-
static {
|
|
11003
|
-
this.create = () => {
|
|
11004
|
-
const id = Key.ObjectId.random();
|
|
11005
|
-
return Obj.make(TreeType, {
|
|
11006
|
-
root: id,
|
|
11007
|
-
nodes: {
|
|
11008
|
-
[id]: {
|
|
11009
|
-
id,
|
|
11010
|
-
children: [],
|
|
11011
|
-
data: {
|
|
11012
|
-
text: ""
|
|
11013
|
-
}
|
|
11014
|
-
}
|
|
11015
|
-
}
|
|
11016
|
-
});
|
|
11017
|
-
};
|
|
11018
|
-
}
|
|
11019
|
-
constructor(tree3) {
|
|
11020
|
-
this._tree = tree3 ?? _Tree.create();
|
|
11021
|
-
}
|
|
11022
11015
|
get tree() {
|
|
11023
11016
|
return this._tree;
|
|
11024
11017
|
}
|
|
@@ -11236,7 +11229,26 @@ var Tree = class _Tree {
|
|
|
11236
11229
|
ancestor.children.splice(parentIdx + 1, 0, node.id);
|
|
11237
11230
|
node.children.push(...rest);
|
|
11238
11231
|
}
|
|
11232
|
+
constructor(tree3) {
|
|
11233
|
+
_define_property(this, "_tree", void 0);
|
|
11234
|
+
this._tree = tree3 ?? _Tree.create();
|
|
11235
|
+
}
|
|
11239
11236
|
};
|
|
11237
|
+
_define_property(Tree, "create", () => {
|
|
11238
|
+
const id = Key.ObjectId.random();
|
|
11239
|
+
return Obj.make(TreeType, {
|
|
11240
|
+
root: id,
|
|
11241
|
+
nodes: {
|
|
11242
|
+
[id]: {
|
|
11243
|
+
id,
|
|
11244
|
+
children: [],
|
|
11245
|
+
data: {
|
|
11246
|
+
text: ""
|
|
11247
|
+
}
|
|
11248
|
+
}
|
|
11249
|
+
}
|
|
11250
|
+
});
|
|
11251
|
+
});
|
|
11240
11252
|
|
|
11241
11253
|
// src/components/Tree/types/types.ts
|
|
11242
11254
|
var mapGraphToTreeData = (model, maxDepth = 8) => {
|
|
@@ -11282,7 +11294,7 @@ var Tree2 = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11282
11294
|
]);
|
|
11283
11295
|
const context = useRef(null);
|
|
11284
11296
|
useEffect3(() => {
|
|
11285
|
-
if (context.current) {
|
|
11297
|
+
if (context.current?.size) {
|
|
11286
11298
|
const { width, height } = context.current.size;
|
|
11287
11299
|
const size = Math.min(width, height);
|
|
11288
11300
|
const radius = size * 0.4;
|
|
@@ -11319,7 +11331,7 @@ var Tree2 = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11319
11331
|
|
|
11320
11332
|
// src/components/index.ts
|
|
11321
11333
|
import { lazy } from "react";
|
|
11322
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-
|
|
11334
|
+
var ExplorerContainer = lazy(() => import("./ExplorerContainer-GIJN67DO.mjs"));
|
|
11323
11335
|
|
|
11324
11336
|
export {
|
|
11325
11337
|
Chart,
|
|
@@ -11328,4 +11340,4 @@ export {
|
|
|
11328
11340
|
Tree2 as Tree,
|
|
11329
11341
|
ExplorerContainer
|
|
11330
11342
|
};
|
|
11331
|
-
//# sourceMappingURL=chunk-
|
|
11343
|
+
//# sourceMappingURL=chunk-WHKUQG5M.mjs.map
|