@dxos/plugin-graph 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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/{graph-5AJD2WYC.mjs → graph-TD2RDQ7V.mjs} +3 -8
- package/dist/lib/browser/graph-TD2RDQ7V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/{graph-IZROFGJQ.cjs → graph-Q4KLVTNI.cjs} +5 -10
- package/dist/lib/node/graph-Q4KLVTNI.cjs.map +7 -0
- package/dist/lib/node/index.cjs +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/{graph-NJMEGQY3.mjs → graph-J5YUB3RG.mjs} +3 -8
- package/dist/lib/node-esm/graph-J5YUB3RG.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/graph.ts +3 -8
- package/dist/lib/browser/graph-5AJD2WYC.mjs.map +0 -7
- package/dist/lib/node/graph-IZROFGJQ.cjs.map +0 -7
- package/dist/lib/node-esm/graph-NJMEGQY3.mjs.map +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/plugins/plugin-graph/src/graph.ts
|
|
2
|
-
import {
|
|
2
|
+
import { Record } from "effect";
|
|
3
3
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
4
4
|
import { flattenExtensions, GraphBuilder, ROOT_ID } from "@dxos/app-graph";
|
|
5
5
|
var graph_default = async (context) => {
|
|
@@ -18,12 +18,7 @@ var graph_default = async (context) => {
|
|
|
18
18
|
}, {
|
|
19
19
|
immediate: true
|
|
20
20
|
});
|
|
21
|
-
builder.graph.
|
|
22
|
-
if (Option.isSome(node)) {
|
|
23
|
-
builder.graph.expand(id);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
builder.graph.expand(ROOT_ID);
|
|
21
|
+
void builder.graph.expand(ROOT_ID);
|
|
27
22
|
setupDevtools(builder.graph);
|
|
28
23
|
return contributes(Capabilities.AppGraph, {
|
|
29
24
|
graph: builder.graph,
|
|
@@ -39,4 +34,4 @@ var setupDevtools = (graph) => {
|
|
|
39
34
|
export {
|
|
40
35
|
graph_default as default
|
|
41
36
|
};
|
|
42
|
-
//# sourceMappingURL=graph-
|
|
37
|
+
//# sourceMappingURL=graph-TD2RDQ7V.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/graph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AAEvB,SAASC,cAAcC,mBAAuC;AAC9D,SAASC,mBAAmBC,cAAoCC,eAAe;AAO/E,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,UAAU;AAC9D,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,OAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKxB,QAAQyB,MAAMC,OAAOC,OAAAA;AAE1BC,gBAAc5B,QAAQyB,KAAK;AAE3B,SAAOI,YAAY/B,aAAagC,UAAU;IAAEL,OAAOzB,QAAQyB;IAAOM,SAAS/B,QAAQ+B;EAAQ,GAAG,MAAA;AAE5F3B,gBAAAA;EACF,CAAA;AACF;AAGA,IAAMwB,gBAAgB,CAACH,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
|
|
6
|
+
"names": ["Record", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "ROOT_ID", "context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":914,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6317,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2750,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-graph/src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytes":3137,"imports":[{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytes":474,"imports":[{"path":"packages/plugins/plugin-graph/src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":746,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"packages/plugins/plugin-graph/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3458},"packages/plugins/plugin-graph/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/dist/lib/browser/graph-TD2RDQ7V.mjs","kind":"dynamic-import"},{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"packages/plugins/plugin-graph/src/index.ts","inputs":{"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":33},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytesInOutput":417},"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":96},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytesInOutput":386},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1313},"packages/plugins/plugin-graph/dist/lib/browser/graph-TD2RDQ7V.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3328},"packages/plugins/plugin-graph/dist/lib/browser/graph-TD2RDQ7V.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-graph/src/graph.ts","inputs":{"packages/plugins/plugin-graph/src/graph.ts":{"bytesInOutput":1200}},"bytes":1329}}}
|
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var graph_Q4KLVTNI_exports = {};
|
|
20
|
+
__export(graph_Q4KLVTNI_exports, {
|
|
21
21
|
default: () => graph_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(graph_Q4KLVTNI_exports);
|
|
24
24
|
var import_effect = require("effect");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var import_app_graph = require("@dxos/app-graph");
|
|
@@ -40,12 +40,7 @@ var graph_default = async (context) => {
|
|
|
40
40
|
}, {
|
|
41
41
|
immediate: true
|
|
42
42
|
});
|
|
43
|
-
builder.graph.
|
|
44
|
-
if (import_effect.Option.isSome(node)) {
|
|
45
|
-
builder.graph.expand(id);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
builder.graph.expand(import_app_graph.ROOT_ID);
|
|
43
|
+
void builder.graph.expand(import_app_graph.ROOT_ID);
|
|
49
44
|
setupDevtools(builder.graph);
|
|
50
45
|
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.AppGraph, {
|
|
51
46
|
graph: builder.graph,
|
|
@@ -58,4 +53,4 @@ var setupDevtools = (graph) => {
|
|
|
58
53
|
globalThis.composer ??= {};
|
|
59
54
|
globalThis.composer.graph = graph;
|
|
60
55
|
};
|
|
61
|
-
//# sourceMappingURL=graph-
|
|
56
|
+
//# sourceMappingURL=graph-Q4KLVTNI.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/graph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAAuB;AAEvB,2BAA8D;AAC9D,uBAA+E;AAO/E,IAAA,gBAAe,OAAOA,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,kCAAaC,UAAU;AAC9D,QAAMC,UAAUC,8BAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,kCAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,WAAOC,oCAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,qBAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKxB,QAAQyB,MAAMC,OAAOC,wBAAAA;AAE1BC,gBAAc5B,QAAQyB,KAAK;AAE3B,aAAOI,kCAAY/B,kCAAagC,UAAU;IAAEL,OAAOzB,QAAQyB;IAAOM,SAAS/B,QAAQ+B;EAAQ,GAAG,MAAA;AAE5F3B,gBAAAA;EACF,CAAA;AACF;AAGA,IAAMwB,gBAAgB,CAACH,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
|
|
6
|
+
"names": ["context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -57,7 +57,7 @@ var GraphPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
57
57
|
activatesAfter: [
|
|
58
58
|
import_app_framework.Events.AppGraphReady
|
|
59
59
|
],
|
|
60
|
-
activate: (0, import_app_framework.lazy)(() => import("./graph-
|
|
60
|
+
activate: (0, import_app_framework.lazy)(() => import("./graph-Q4KLVTNI.cjs"))
|
|
61
61
|
})
|
|
62
62
|
]);
|
|
63
63
|
var useNode = (graph, id) => {
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":914,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6317,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2750,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-graph/src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytes":3137,"imports":[{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytes":474,"imports":[{"path":"packages/plugins/plugin-graph/src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":746,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"packages/plugins/plugin-graph/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3458},"packages/plugins/plugin-graph/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/dist/lib/node/graph-Q4KLVTNI.cjs","kind":"dynamic-import"},{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"packages/plugins/plugin-graph/src/index.ts","inputs":{"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":33},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytesInOutput":417},"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":96},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytesInOutput":386},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1313},"packages/plugins/plugin-graph/dist/lib/node/graph-Q4KLVTNI.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3328},"packages/plugins/plugin-graph/dist/lib/node/graph-Q4KLVTNI.cjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-graph/src/graph.ts","inputs":{"packages/plugins/plugin-graph/src/graph.ts":{"bytesInOutput":1200}},"bytes":1329}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/plugins/plugin-graph/src/graph.ts
|
|
4
|
-
import {
|
|
4
|
+
import { Record } from "effect";
|
|
5
5
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
6
6
|
import { flattenExtensions, GraphBuilder, ROOT_ID } from "@dxos/app-graph";
|
|
7
7
|
var graph_default = async (context) => {
|
|
@@ -20,12 +20,7 @@ var graph_default = async (context) => {
|
|
|
20
20
|
}, {
|
|
21
21
|
immediate: true
|
|
22
22
|
});
|
|
23
|
-
builder.graph.
|
|
24
|
-
if (Option.isSome(node)) {
|
|
25
|
-
builder.graph.expand(id);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
builder.graph.expand(ROOT_ID);
|
|
23
|
+
void builder.graph.expand(ROOT_ID);
|
|
29
24
|
setupDevtools(builder.graph);
|
|
30
25
|
return contributes(Capabilities.AppGraph, {
|
|
31
26
|
graph: builder.graph,
|
|
@@ -41,4 +36,4 @@ var setupDevtools = (graph) => {
|
|
|
41
36
|
export {
|
|
42
37
|
graph_default as default
|
|
43
38
|
};
|
|
44
|
-
//# sourceMappingURL=graph-
|
|
39
|
+
//# sourceMappingURL=graph-J5YUB3RG.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/graph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,cAAc;AAEvB,SAASC,cAAcC,mBAAuC;AAC9D,SAASC,mBAAmBC,cAAoCC,eAAe;AAO/E,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,UAAU;AAC9D,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,OAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKxB,QAAQyB,MAAMC,OAAOC,OAAAA;AAE1BC,gBAAc5B,QAAQyB,KAAK;AAE3B,SAAOI,YAAY/B,aAAagC,UAAU;IAAEL,OAAOzB,QAAQyB;IAAOM,SAAS/B,QAAQ+B;EAAQ,GAAG,MAAA;AAE5F3B,gBAAAA;EACF,CAAA;AACF;AAGA,IAAMwB,gBAAgB,CAACH,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
|
|
6
|
+
"names": ["Record", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "ROOT_ID", "context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":914,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6317,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2750,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-graph/src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytes":3137,"imports":[{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytes":474,"imports":[{"path":"packages/plugins/plugin-graph/src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":746,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"packages/plugins/plugin-graph/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3460},"packages/plugins/plugin-graph/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/graph-J5YUB3RG.mjs","kind":"dynamic-import"},{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"packages/plugins/plugin-graph/src/index.ts","inputs":{"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":33},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytesInOutput":417},"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":96},"packages/plugins/plugin-graph/src/hooks/useNode.ts":{"bytesInOutput":386},"packages/plugins/plugin-graph/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1406},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-J5YUB3RG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3330},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-J5YUB3RG.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-graph/src/graph.ts","inputs":{"packages/plugins/plugin-graph/src/graph.ts":{"bytesInOutput":1200}},"bytes":1422}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAmC,KAAK,eAAe,EAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAmC,KAAK,eAAe,EAAW,MAAM,iBAAiB,CAAC;yBAO3E,SAAS,aAAa;;;;AAA5C,wBA4BE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-graph",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.4d6ad0f",
|
|
4
4
|
"description": "DXOS Surface plugin for constructing knowledge graphs",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"src"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/app-graph": "0.8.2-
|
|
30
|
-
"@dxos/
|
|
27
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
28
|
+
"@dxos/app-framework": "0.8.2-staging.4d6ad0f",
|
|
29
|
+
"@dxos/app-graph": "0.8.2-staging.4d6ad0f",
|
|
30
|
+
"@dxos/async": "0.8.2-staging.4d6ad0f",
|
|
31
|
+
"@dxos/debug": "0.8.2-staging.4d6ad0f"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -38,8 +39,8 @@
|
|
|
38
39
|
"react": "~18.2.0",
|
|
39
40
|
"react-dom": "~18.2.0",
|
|
40
41
|
"vite": "5.4.7",
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
42
|
+
"@dxos/storybook-utils": "0.8.2-staging.4d6ad0f",
|
|
43
|
+
"@dxos/react-client": "0.8.2-staging.4d6ad0f"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"@effect-rx/rx-react": "^0.34.1",
|
package/src/graph.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Record } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
8
8
|
import { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';
|
|
9
9
|
|
|
10
|
+
// TODO(wittjosiah): Remove or restore graph caching.
|
|
10
11
|
// import { GRAPH_PLUGIN } from './meta';
|
|
11
12
|
|
|
12
13
|
// const KEY = `${GRAPH_PLUGIN}/app-graph`;
|
|
@@ -30,14 +31,8 @@ export default async (context: PluginContext) => {
|
|
|
30
31
|
{ immediate: true },
|
|
31
32
|
);
|
|
32
33
|
|
|
33
|
-
// TODO(wittjosiah): Stop expanding the graph eagerly.
|
|
34
|
-
builder.graph.onNodeChanged.on(({ id, node }) => {
|
|
35
|
-
if (Option.isSome(node)) {
|
|
36
|
-
builder.graph.expand(id);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
34
|
// await builder.initialize();
|
|
40
|
-
builder.graph.expand(ROOT_ID);
|
|
35
|
+
void builder.graph.expand(ROOT_ID);
|
|
41
36
|
|
|
42
37
|
setupDevtools(builder.graph);
|
|
43
38
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Option, Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // TODO(wittjosiah): Stop expanding the graph eagerly.\n builder.graph.onNodeChanged.on(({ id, node }) => {\n if (Option.isSome(node)) {\n builder.graph.expand(id);\n }\n });\n // await builder.initialize();\n builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,QAAQC,cAAc;AAE/B,SAASC,cAAcC,mBAAuC;AAC9D,SAASC,mBAAmBC,cAAoCC,eAAe;AAM/E,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,UAAU;AAC9D,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,OAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpBxB,UAAQyB,MAAMC,cAAcC,GAAG,CAAC,EAAEV,IAAIW,KAAI,MAAE;AAC1C,QAAIC,OAAOC,OAAOF,IAAAA,GAAO;AACvB5B,cAAQyB,MAAMM,OAAOd,EAAAA;IACvB;EACF,CAAA;AAEAjB,UAAQyB,MAAMM,OAAOC,OAAAA;AAErBC,gBAAcjC,QAAQyB,KAAK;AAE3B,SAAOS,YAAYpC,aAAaqC,UAAU;IAAEV,OAAOzB,QAAQyB;IAAOW,SAASpC,QAAQoC;EAAQ,GAAG,MAAA;AAE5FhC,gBAAAA;EACF,CAAA;AACF;AAGA,IAAM6B,gBAAgB,CAACR,UAAAA;AACpBY,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASb,QAAQA;AACvC;",
|
|
6
|
-
"names": ["Option", "Record", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "ROOT_ID", "context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "onNodeChanged", "on", "node", "Option", "isSome", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Option, Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // TODO(wittjosiah): Stop expanding the graph eagerly.\n builder.graph.onNodeChanged.on(({ id, node }) => {\n if (Option.isSome(node)) {\n builder.graph.expand(id);\n }\n });\n // await builder.initialize();\n builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAA+B;AAE/B,2BAA8D;AAC9D,uBAA+E;AAM/E,IAAA,gBAAe,OAAOA,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,kCAAaC,UAAU;AAC9D,QAAMC,UAAUC,8BAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,kCAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,WAAOC,oCAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,qBAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpBxB,UAAQyB,MAAMC,cAAcC,GAAG,CAAC,EAAEV,IAAIW,KAAI,MAAE;AAC1C,QAAIC,qBAAOC,OAAOF,IAAAA,GAAO;AACvB5B,cAAQyB,MAAMM,OAAOd,EAAAA;IACvB;EACF,CAAA;AAEAjB,UAAQyB,MAAMM,OAAOC,wBAAAA;AAErBC,gBAAcjC,QAAQyB,KAAK;AAE3B,aAAOS,kCAAYpC,kCAAaqC,UAAU;IAAEV,OAAOzB,QAAQyB;IAAOW,SAASpC,QAAQoC;EAAQ,GAAG,MAAA;AAE5FhC,gBAAAA;EACF,CAAA;AACF;AAGA,IAAM6B,gBAAgB,CAACR,UAAAA;AACpBY,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASb,QAAQA;AACvC;",
|
|
6
|
-
"names": ["context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "onNodeChanged", "on", "node", "Option", "isSome", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Option, Record } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { flattenExtensions, GraphBuilder, type ExpandableGraph, ROOT_ID } from '@dxos/app-graph';\n\n// import { GRAPH_PLUGIN } from './meta';\n\n// const KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.RxRegistry);\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // TODO(wittjosiah): Stop expanding the graph eagerly.\n builder.graph.onNodeChanged.on(({ id, node }) => {\n if (Option.isSome(node)) {\n builder.graph.expand(id);\n }\n });\n // await builder.initialize();\n builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,QAAQC,cAAc;AAE/B,SAASC,cAAcC,mBAAuC;AAC9D,SAASC,mBAAmBC,cAAoCC,eAAe;AAM/E,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,UAAU;AAC9D,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAUC,OAAOC,OAAOjB,SAASkB,IAAId,QAAQQ,UAAU,CAAA;AAC7D,UAAMO,UAAUJ,QAAQK,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACR,KAAKS,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcrB,QAAQsB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnER,SAAKW,QAAQ,CAACC,cAAcrB,QAAQuB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpBxB,UAAQyB,MAAMC,cAAcC,GAAG,CAAC,EAAEV,IAAIW,KAAI,MAAE;AAC1C,QAAIC,OAAOC,OAAOF,IAAAA,GAAO;AACvB5B,cAAQyB,MAAMM,OAAOd,EAAAA;IACvB;EACF,CAAA;AAEAjB,UAAQyB,MAAMM,OAAOC,OAAAA;AAErBC,gBAAcjC,QAAQyB,KAAK;AAE3B,SAAOS,YAAYpC,aAAaqC,UAAU;IAAEV,OAAOzB,QAAQyB;IAAOW,SAASpC,QAAQoC;EAAQ,GAAG,MAAA;AAE5FhC,gBAAAA;EACF,CAAA;AACF;AAGA,IAAM6B,gBAAgB,CAACR,UAAAA;AACpBY,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASb,QAAQA;AACvC;",
|
|
6
|
-
"names": ["Option", "Record", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "ROOT_ID", "context", "registry", "getCapability", "Capabilities", "RxRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "Record", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "onNodeChanged", "on", "node", "Option", "isSome", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
-
}
|