@dxos/plugin-graph 0.6.8-main.046e6cf
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 +8 -0
- package/README.md +15 -0
- package/dist/lib/browser/chunk-BCEDFTWC.mjs +9 -0
- package/dist/lib/browser/chunk-BCEDFTWC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +46 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/meta.mjs +7 -0
- package/dist/lib/browser/meta.mjs.map +7 -0
- package/dist/lib/node/chunk-IJSAFR4A.cjs +31 -0
- package/dist/lib/node/chunk-IJSAFR4A.cjs.map +7 -0
- package/dist/lib/node/index.cjs +74 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.cjs +25 -0
- package/dist/lib/node/meta.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/types/src/GraphContext.d.ts +8 -0
- package/dist/types/src/GraphContext.d.ts.map +1 -0
- package/dist/types/src/GraphPlugin.d.ts +8 -0
- package/dist/types/src/GraphPlugin.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +6 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +5 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/package.json +58 -0
- package/src/GraphContext.ts +15 -0
- package/src/GraphPlugin.tsx +37 -0
- package/src/index.ts +12 -0
- package/src/meta.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @dxos/plugin-client
|
|
2
|
+
|
|
3
|
+
Surface plugin for DXOS Client.
|
|
4
|
+
|
|
5
|
+
## DXOS Resources
|
|
6
|
+
|
|
7
|
+
- [Website](https://dxos.org)
|
|
8
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
9
|
+
- Talk to us on [Discord](https://dxos.org/discord)
|
|
10
|
+
|
|
11
|
+
## Contributions
|
|
12
|
+
|
|
13
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
14
|
+
|
|
15
|
+
License: [MIT](./LICENSE) Copyright 2023 © DXOS
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
meta_default
|
|
3
|
+
} from "./chunk-BCEDFTWC.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-graph/src/GraphPlugin.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { filterPlugins, parseGraphBuilderPlugin } from "@dxos/app-framework";
|
|
8
|
+
import { GraphBuilder } from "@dxos/app-graph";
|
|
9
|
+
|
|
10
|
+
// packages/plugins/plugin-graph/src/GraphContext.ts
|
|
11
|
+
import { createContext, useContext } from "react";
|
|
12
|
+
import { raise } from "@dxos/debug";
|
|
13
|
+
var GraphContext = createContext(null);
|
|
14
|
+
var useGraph = () => useContext(GraphContext) ?? raise(new Error("Missing GraphContext"));
|
|
15
|
+
|
|
16
|
+
// packages/plugins/plugin-graph/src/GraphPlugin.tsx
|
|
17
|
+
var GraphPlugin = () => {
|
|
18
|
+
const builder = new GraphBuilder();
|
|
19
|
+
return {
|
|
20
|
+
meta: meta_default,
|
|
21
|
+
ready: async (plugins) => {
|
|
22
|
+
filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) => builder.addExtension(plugin.provides.graph.builder(plugins)));
|
|
23
|
+
},
|
|
24
|
+
provides: {
|
|
25
|
+
graph: builder.graph,
|
|
26
|
+
// TODO(wittjosiah): This is janky.
|
|
27
|
+
explore: (options) => builder.explore(options),
|
|
28
|
+
context: ({ children }) => /* @__PURE__ */ React.createElement(GraphContext.Provider, {
|
|
29
|
+
value: {
|
|
30
|
+
graph: builder.graph
|
|
31
|
+
}
|
|
32
|
+
}, children)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// packages/plugins/plugin-graph/src/index.ts
|
|
38
|
+
export * from "@dxos/app-graph";
|
|
39
|
+
var src_default = GraphPlugin;
|
|
40
|
+
export {
|
|
41
|
+
GraphContext,
|
|
42
|
+
GraphPlugin,
|
|
43
|
+
src_default as default,
|
|
44
|
+
useGraph
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/GraphPlugin.tsx", "../../../src/GraphContext.ts", "../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { filterPlugins, type GraphProvides, type PluginDefinition, parseGraphBuilderPlugin } from '@dxos/app-framework';\nimport { GraphBuilder } from '@dxos/app-graph';\n\nimport { GraphContext } from './GraphContext';\nimport meta from './meta';\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = (): PluginDefinition<GraphProvides> => {\n const builder = new GraphBuilder();\n\n return {\n meta,\n ready: async (plugins) => {\n filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) =>\n builder.addExtension(plugin.provides.graph.builder(plugins)),\n );\n },\n provides: {\n graph: builder.graph,\n // TODO(wittjosiah): This is janky.\n explore: (options) => builder.explore(options),\n context: ({ children }) => (\n <GraphContext.Provider value={{ graph: builder.graph }}>{children}</GraphContext.Provider>\n ),\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(wittjosiah): State can be a GraphNode.\nimport { type Context, createContext, useContext } from 'react';\n\nimport { type Graph } from '@dxos/app-graph';\nimport { raise } from '@dxos/debug';\n\nexport type GraphContext = { graph: Graph };\n\nexport const GraphContext: Context<GraphContext | null> = createContext<GraphContext | null>(null);\n\nexport const useGraph = (): GraphContext => useContext(GraphContext) ?? raise(new Error('Missing GraphContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { GraphPlugin } from './GraphPlugin';\n\nexport default GraphPlugin;\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphContext';\nexport * from './GraphPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,eAA0DC,+BAA+B;AAClG,SAASC,oBAAoB;;;ACF7B,SAAuBC,eAAeC,kBAAkB;AAGxD,SAASC,aAAa;AAIf,IAAMC,eAA6CC,cAAmC,IAAA;AAEtF,IAAMC,WAAW,MAAoBC,WAAWH,YAAAA,KAAiBI,MAAM,IAAIC,MAAM,sBAAA,CAAA;;;ADGjF,IAAMC,cAAc,MAAA;AACzB,QAAMC,UAAU,IAAIC,aAAAA;AAEpB,SAAO;IACLC;IACAC,OAAO,OAAOC,YAAAA;AACZC,oBAAcD,SAASE,uBAAAA,EAAyBC,QAAQ,CAACC,WACvDR,QAAQS,aAAaD,OAAOE,SAASC,MAAMX,QAAQI,OAAAA,CAAAA,CAAAA;IAEvD;IACAM,UAAU;MACRC,OAAOX,QAAQW;;MAEfC,SAAS,CAACC,YAAYb,QAAQY,QAAQC,OAAAA;MACtCC,SAAS,CAAC,EAAEC,SAAQ,MAClB,sBAAA,cAACC,aAAaC,UAAQ;QAACC,OAAO;UAAEP,OAAOX,QAAQW;QAAM;SAAII,QAAAA;IAE7D;EACF;AACF;;;AE5BA,cAAc;AAFd,IAAA,cAAeI;",
|
|
6
|
+
"names": ["React", "filterPlugins", "parseGraphBuilderPlugin", "GraphBuilder", "createContext", "useContext", "raise", "GraphContext", "createContext", "useGraph", "useContext", "raise", "Error", "GraphPlugin", "builder", "GraphBuilder", "meta", "ready", "plugins", "filterPlugins", "parseGraphBuilderPlugin", "forEach", "plugin", "addExtension", "provides", "graph", "explore", "options", "context", "children", "GraphContext", "Provider", "value", "GraphPlugin"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytes":1674,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/meta.ts":{"bytes":584,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytes":4155,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.ts","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":978,"imports":[{"path":"packages/plugins/plugin-graph/src/GraphPlugin.tsx","kind":"import-statement","original":"./GraphPlugin"},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.ts","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.tsx","kind":"import-statement","original":"./GraphPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3164},"packages/plugins/plugin-graph/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/browser/chunk-BCEDFTWC.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["GraphContext","GraphPlugin","default","useGraph"],"entryPoint":"packages/plugins/plugin-graph/src/index.ts","inputs":{"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytesInOutput":753},"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytesInOutput":219},"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":64}},"bytes":1415},"packages/plugins/plugin-graph/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-graph/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/browser/chunk-BCEDFTWC.mjs","kind":"import-statement"}],"exports":["default"],"entryPoint":"packages/plugins/plugin-graph/src/meta.ts","inputs":{},"bytes":127},"packages/plugins/plugin-graph/dist/lib/browser/chunk-BCEDFTWC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":245},"packages/plugins/plugin-graph/dist/lib/browser/chunk-BCEDFTWC.mjs":{"imports":[],"exports":["meta_default"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":54}},"bytes":171}}}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_IJSAFR4A_exports = {};
|
|
20
|
+
__export(chunk_IJSAFR4A_exports, {
|
|
21
|
+
meta_default: () => meta_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_IJSAFR4A_exports);
|
|
24
|
+
var meta_default = {
|
|
25
|
+
id: "dxos.org/plugin/graph"
|
|
26
|
+
};
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
meta_default
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=chunk-IJSAFR4A.cjs.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var node_exports = {};
|
|
31
|
+
__export(node_exports, {
|
|
32
|
+
GraphContext: () => GraphContext,
|
|
33
|
+
GraphPlugin: () => GraphPlugin,
|
|
34
|
+
default: () => src_default,
|
|
35
|
+
useGraph: () => useGraph
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(node_exports);
|
|
38
|
+
var import_chunk_IJSAFR4A = require("./chunk-IJSAFR4A.cjs");
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
41
|
+
var import_app_graph = require("@dxos/app-graph");
|
|
42
|
+
var import_react2 = require("react");
|
|
43
|
+
var import_debug = require("@dxos/debug");
|
|
44
|
+
__reExport(node_exports, require("@dxos/app-graph"), module.exports);
|
|
45
|
+
var GraphContext = (0, import_react2.createContext)(null);
|
|
46
|
+
var useGraph = () => (0, import_react2.useContext)(GraphContext) ?? (0, import_debug.raise)(new Error("Missing GraphContext"));
|
|
47
|
+
var GraphPlugin = () => {
|
|
48
|
+
const builder = new import_app_graph.GraphBuilder();
|
|
49
|
+
return {
|
|
50
|
+
meta: import_chunk_IJSAFR4A.meta_default,
|
|
51
|
+
ready: async (plugins) => {
|
|
52
|
+
(0, import_app_framework.filterPlugins)(plugins, import_app_framework.parseGraphBuilderPlugin).forEach((plugin) => builder.addExtension(plugin.provides.graph.builder(plugins)));
|
|
53
|
+
},
|
|
54
|
+
provides: {
|
|
55
|
+
graph: builder.graph,
|
|
56
|
+
// TODO(wittjosiah): This is janky.
|
|
57
|
+
explore: (options) => builder.explore(options),
|
|
58
|
+
context: ({ children }) => /* @__PURE__ */ import_react.default.createElement(GraphContext.Provider, {
|
|
59
|
+
value: {
|
|
60
|
+
graph: builder.graph
|
|
61
|
+
}
|
|
62
|
+
}, children)
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var src_default = GraphPlugin;
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
GraphContext,
|
|
70
|
+
GraphPlugin,
|
|
71
|
+
useGraph,
|
|
72
|
+
...require("@dxos/app-graph")
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/GraphPlugin.tsx", "../../../src/GraphContext.ts", "../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { filterPlugins, type GraphProvides, type PluginDefinition, parseGraphBuilderPlugin } from '@dxos/app-framework';\nimport { GraphBuilder } from '@dxos/app-graph';\n\nimport { GraphContext } from './GraphContext';\nimport meta from './meta';\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = (): PluginDefinition<GraphProvides> => {\n const builder = new GraphBuilder();\n\n return {\n meta,\n ready: async (plugins) => {\n filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) =>\n builder.addExtension(plugin.provides.graph.builder(plugins)),\n );\n },\n provides: {\n graph: builder.graph,\n // TODO(wittjosiah): This is janky.\n explore: (options) => builder.explore(options),\n context: ({ children }) => (\n <GraphContext.Provider value={{ graph: builder.graph }}>{children}</GraphContext.Provider>\n ),\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(wittjosiah): State can be a GraphNode.\nimport { type Context, createContext, useContext } from 'react';\n\nimport { type Graph } from '@dxos/app-graph';\nimport { raise } from '@dxos/debug';\n\nexport type GraphContext = { graph: Graph };\n\nexport const GraphContext: Context<GraphContext | null> = createContext<GraphContext | null>(null);\n\nexport const useGraph = (): GraphContext => useContext(GraphContext) ?? raise(new Error('Missing GraphContext'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { GraphPlugin } from './GraphPlugin';\n\nexport default GraphPlugin;\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphContext';\nexport * from './GraphPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,2BAAkG;AAClG,uBAA6B;ACF7B,IAAAA,gBAAwD;AAGxD,mBAAsB;ACAtB,yBAAc;ADIP,IAAMC,mBAA6CC,6BAAmC,IAAA;AAEtF,IAAMC,WAAW,UAAoBC,0BAAWH,YAAAA,SAAiBI,oBAAM,IAAIC,MAAM,sBAAA,CAAA;ADGjF,IAAMC,cAAc,MAAA;AACzB,QAAMC,UAAU,IAAIC,8BAAAA;AAEpB,SAAO;IACLC,MAAAA;IACAC,OAAO,OAAOC,YAAAA;AACZC,8CAAcD,SAASE,4CAAAA,EAAyBC,QAAQ,CAACC,WACvDR,QAAQS,aAAaD,OAAOE,SAASC,MAAMX,QAAQI,OAAAA,CAAAA,CAAAA;IAEvD;IACAM,UAAU;MACRC,OAAOX,QAAQW;;MAEfC,SAAS,CAACC,YAAYb,QAAQY,QAAQC,OAAAA;MACtCC,SAAS,CAAC,EAAEC,SAAQ,MAClB,6BAAAC,QAAA,cAACvB,aAAawB,UAAQ;QAACC,OAAO;UAAEP,OAAOX,QAAQW;QAAM;SAAII,QAAAA;IAE7D;EACF;AACF;AE9BA,IAAA,cAAehB;",
|
|
6
|
+
"names": ["import_react", "GraphContext", "createContext", "useGraph", "useContext", "raise", "Error", "GraphPlugin", "builder", "GraphBuilder", "meta", "ready", "plugins", "filterPlugins", "parseGraphBuilderPlugin", "forEach", "plugin", "addExtension", "provides", "graph", "explore", "options", "context", "children", "React", "Provider", "value"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var meta_exports = {};
|
|
20
|
+
__export(meta_exports, {
|
|
21
|
+
default: () => import_chunk_IJSAFR4A.meta_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(meta_exports);
|
|
24
|
+
var import_chunk_IJSAFR4A = require("./chunk-IJSAFR4A.cjs");
|
|
25
|
+
//# sourceMappingURL=meta.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["meta.cjs"],
|
|
4
|
+
"sourcesContent": ["import {\n meta_default\n} from \"./chunk-IJSAFR4A.cjs\";\nexport {\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAEO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytes":1674,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/meta.ts":{"bytes":584,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytes":4155,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.ts","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":978,"imports":[{"path":"packages/plugins/plugin-graph/src/GraphPlugin.tsx","kind":"import-statement","original":"./GraphPlugin"},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.ts","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.tsx","kind":"import-statement","original":"./GraphPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3164},"packages/plugins/plugin-graph/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-IJSAFR4A.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["GraphContext","GraphPlugin","default","useGraph"],"entryPoint":"packages/plugins/plugin-graph/src/index.ts","inputs":{"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytesInOutput":753},"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytesInOutput":219},"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":64}},"bytes":1415},"packages/plugins/plugin-graph/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-graph/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-IJSAFR4A.cjs","kind":"import-statement"}],"exports":["default"],"entryPoint":"packages/plugins/plugin-graph/src/meta.ts","inputs":{},"bytes":127},"packages/plugins/plugin-graph/dist/lib/node/chunk-IJSAFR4A.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":245},"packages/plugins/plugin-graph/dist/lib/node/chunk-IJSAFR4A.cjs":{"imports":[],"exports":["meta_default"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":54}},"bytes":171}}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Context } from 'react';
|
|
2
|
+
import { type Graph } from '@dxos/app-graph';
|
|
3
|
+
export type GraphContext = {
|
|
4
|
+
graph: Graph;
|
|
5
|
+
};
|
|
6
|
+
export declare const GraphContext: Context<GraphContext | null>;
|
|
7
|
+
export declare const useGraph: () => GraphContext;
|
|
8
|
+
//# sourceMappingURL=GraphContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphContext.d.ts","sourceRoot":"","sources":["../../../src/GraphContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAE5C,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,YAAY,GAAG,IAAI,CAA4C,CAAC;AAEnG,eAAO,MAAM,QAAQ,QAAO,YAAoF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type GraphProvides, type PluginDefinition } from '@dxos/app-framework';
|
|
2
|
+
/**
|
|
3
|
+
* Manages the state of the graph for the application.
|
|
4
|
+
* Enables other plugins to register node builders to add nodes to the graph.
|
|
5
|
+
* This includes actions and annotation each other's nodes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GraphPlugin: () => PluginDefinition<GraphProvides>;
|
|
8
|
+
//# sourceMappingURL=GraphPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAA2B,MAAM,qBAAqB,CAAC;AAMxH;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,gBAAgB,CAAC,aAAa,CAmB5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAe,WAAW,CAAC;AAE3B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":";;;AAIA,wBAEE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dxos/plugin-graph",
|
|
3
|
+
"version": "0.6.8-main.046e6cf",
|
|
4
|
+
"description": "DXOS Surface plugin for constructing knowledge graphs",
|
|
5
|
+
"homepage": "https://dxos.org",
|
|
6
|
+
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "DXOS.org",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
12
|
+
"node": {
|
|
13
|
+
"default": "./dist/lib/node/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"types": "./dist/types/src/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./meta": {
|
|
18
|
+
"browser": "./dist/lib/browser/meta.mjs",
|
|
19
|
+
"node": {
|
|
20
|
+
"default": "./dist/lib/node/meta.cjs"
|
|
21
|
+
},
|
|
22
|
+
"types": "./dist/types/src/meta.d.ts"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"types": "dist/types/src/index.d.ts",
|
|
26
|
+
"typesVersions": {
|
|
27
|
+
"*": {
|
|
28
|
+
"meta": [
|
|
29
|
+
"dist/types/src/meta.d.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"src"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@dxos/app-framework": "0.6.8-main.046e6cf",
|
|
39
|
+
"@dxos/app-graph": "0.6.8-main.046e6cf",
|
|
40
|
+
"@dxos/debug": "0.6.8-main.046e6cf"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/react": "~18.2.0",
|
|
44
|
+
"@types/react-dom": "~18.2.0",
|
|
45
|
+
"react": "~18.2.0",
|
|
46
|
+
"react-dom": "~18.2.0",
|
|
47
|
+
"vite": "^5.3.4",
|
|
48
|
+
"@dxos/react-client": "0.6.8-main.046e6cf",
|
|
49
|
+
"@dxos/storybook-utils": "0.6.8-main.046e6cf"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^18.0.0",
|
|
53
|
+
"react-dom": "^18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// TODO(wittjosiah): State can be a GraphNode.
|
|
6
|
+
import { type Context, createContext, useContext } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Graph } from '@dxos/app-graph';
|
|
9
|
+
import { raise } from '@dxos/debug';
|
|
10
|
+
|
|
11
|
+
export type GraphContext = { graph: Graph };
|
|
12
|
+
|
|
13
|
+
export const GraphContext: Context<GraphContext | null> = createContext<GraphContext | null>(null);
|
|
14
|
+
|
|
15
|
+
export const useGraph = (): GraphContext => useContext(GraphContext) ?? raise(new Error('Missing GraphContext'));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { filterPlugins, type GraphProvides, type PluginDefinition, parseGraphBuilderPlugin } from '@dxos/app-framework';
|
|
8
|
+
import { GraphBuilder } from '@dxos/app-graph';
|
|
9
|
+
|
|
10
|
+
import { GraphContext } from './GraphContext';
|
|
11
|
+
import meta from './meta';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Manages the state of the graph for the application.
|
|
15
|
+
* Enables other plugins to register node builders to add nodes to the graph.
|
|
16
|
+
* This includes actions and annotation each other's nodes.
|
|
17
|
+
*/
|
|
18
|
+
export const GraphPlugin = (): PluginDefinition<GraphProvides> => {
|
|
19
|
+
const builder = new GraphBuilder();
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
meta,
|
|
23
|
+
ready: async (plugins) => {
|
|
24
|
+
filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) =>
|
|
25
|
+
builder.addExtension(plugin.provides.graph.builder(plugins)),
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
provides: {
|
|
29
|
+
graph: builder.graph,
|
|
30
|
+
// TODO(wittjosiah): This is janky.
|
|
31
|
+
explore: (options) => builder.explore(options),
|
|
32
|
+
context: ({ children }) => (
|
|
33
|
+
<GraphContext.Provider value={{ graph: builder.graph }}>{children}</GraphContext.Provider>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
};
|
package/src/index.ts
ADDED