@dxos/plugin-graph 0.7.4-staging.f7e8224 → 0.7.5-feature-compute.4d9d99a

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.
Files changed (58) hide show
  1. package/dist/lib/browser/GraphContext-VQKUKWLP.mjs +10 -0
  2. package/dist/lib/browser/{chunk-SYPRW7IK.mjs → chunk-7LNMG3EB.mjs} +3 -3
  3. package/dist/lib/browser/chunk-7LNMG3EB.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-L7JM5AMI.mjs +25 -0
  5. package/dist/lib/browser/chunk-L7JM5AMI.mjs.map +7 -0
  6. package/dist/lib/browser/graph-WNFVYZKZ.mjs +30 -0
  7. package/dist/lib/browser/graph-WNFVYZKZ.mjs.map +7 -0
  8. package/dist/lib/browser/index.mjs +28 -51
  9. package/dist/lib/browser/index.mjs.map +4 -4
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/node/{meta.cjs → GraphContext-MUIA2AJE.cjs} +9 -8
  12. package/dist/lib/node/GraphContext-MUIA2AJE.cjs.map +7 -0
  13. package/dist/lib/node/chunk-3QIHDIIS.cjs +55 -0
  14. package/dist/lib/node/chunk-3QIHDIIS.cjs.map +7 -0
  15. package/dist/lib/node/{chunk-PIWXSWR4.cjs → chunk-KHIPMH35.cjs} +7 -7
  16. package/dist/lib/node/chunk-KHIPMH35.cjs.map +7 -0
  17. package/dist/lib/node/graph-HXCMZDUQ.cjs +46 -0
  18. package/dist/lib/node/graph-HXCMZDUQ.cjs.map +7 -0
  19. package/dist/lib/node/index.cjs +26 -46
  20. package/dist/lib/node/index.cjs.map +4 -4
  21. package/dist/lib/node/meta.json +1 -1
  22. package/dist/lib/node-esm/GraphContext-VNVZEAJK.mjs +11 -0
  23. package/dist/lib/node-esm/{chunk-H3EEX7DI.mjs → chunk-IHM26RSC.mjs} +3 -3
  24. package/dist/lib/node-esm/chunk-IHM26RSC.mjs.map +7 -0
  25. package/dist/lib/node-esm/chunk-XY43PHPY.mjs +26 -0
  26. package/dist/lib/node-esm/chunk-XY43PHPY.mjs.map +7 -0
  27. package/dist/lib/node-esm/graph-UQRZMBQ5.mjs +31 -0
  28. package/dist/lib/node-esm/graph-UQRZMBQ5.mjs.map +7 -0
  29. package/dist/lib/node-esm/index.mjs +28 -51
  30. package/dist/lib/node-esm/index.mjs.map +4 -4
  31. package/dist/lib/node-esm/meta.json +1 -1
  32. package/dist/types/src/GraphContext.d.ts +10 -7
  33. package/dist/types/src/GraphContext.d.ts.map +1 -1
  34. package/dist/types/src/GraphPlugin.d.ts +1 -2
  35. package/dist/types/src/GraphPlugin.d.ts.map +1 -1
  36. package/dist/types/src/graph.d.ts +8 -0
  37. package/dist/types/src/graph.d.ts.map +1 -0
  38. package/dist/types/src/index.d.ts +1 -2
  39. package/dist/types/src/index.d.ts.map +1 -1
  40. package/dist/types/src/meta.d.ts +1 -2
  41. package/dist/types/src/meta.d.ts.map +1 -1
  42. package/dist/types/tsconfig.tsbuildinfo +1 -0
  43. package/package.json +8 -17
  44. package/src/GraphContext.tsx +25 -0
  45. package/src/GraphPlugin.ts +28 -0
  46. package/src/graph.ts +36 -0
  47. package/src/index.ts +1 -4
  48. package/src/meta.ts +1 -1
  49. package/dist/lib/browser/chunk-SYPRW7IK.mjs.map +0 -7
  50. package/dist/lib/browser/meta.mjs +0 -9
  51. package/dist/lib/node/chunk-PIWXSWR4.cjs.map +0 -7
  52. package/dist/lib/node/meta.cjs.map +0 -7
  53. package/dist/lib/node-esm/chunk-H3EEX7DI.mjs.map +0 -7
  54. package/dist/lib/node-esm/meta.mjs +0 -10
  55. package/src/GraphContext.ts +0 -15
  56. package/src/GraphPlugin.tsx +0 -56
  57. /package/dist/lib/browser/{meta.mjs.map → GraphContext-VQKUKWLP.mjs.map} +0 -0
  58. /package/dist/lib/node-esm/{meta.mjs.map → GraphContext-VNVZEAJK.mjs.map} +0 -0
@@ -1 +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":854,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytes":6615,"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":4417},"packages/plugins/plugin-graph/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-PIWXSWR4.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":1293},"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytesInOutput":219},"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":64}},"bytes":1971},"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-PIWXSWR4.cjs","kind":"import-statement"}],"exports":["GRAPH_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-graph/src/meta.ts","inputs":{},"bytes":159},"packages/plugins/plugin-graph/dist/lib/node/chunk-PIWXSWR4.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":403},"packages/plugins/plugin-graph/dist/lib/node/chunk-PIWXSWR4.cjs":{"imports":[],"exports":["GRAPH_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":87}},"bytes":220}}}
1
+ {"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphContext.tsx":{"bytes":3234,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":4364,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":3276,"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/GraphContext.tsx","kind":"dynamic-import","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":797,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.tsx","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"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":1757},"packages/plugins/plugin-graph/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-3QIHDIIS.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs","kind":"import-statement"},{"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/GraphContext-MUIA2AJE.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-graph/dist/lib/node/graph-HXCMZDUQ.cjs","kind":"dynamic-import"}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useGraph"],"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":552}},"bytes":896},"packages/plugins/plugin-graph/dist/lib/node/GraphContext-MUIA2AJE.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-graph/dist/lib/node/GraphContext-MUIA2AJE.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-3QIHDIIS.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs","kind":"import-statement"}],"exports":["default","useGraph"],"entryPoint":"packages/plugins/plugin-graph/src/GraphContext.tsx","inputs":{},"bytes":215},"packages/plugins/plugin-graph/dist/lib/node/chunk-3QIHDIIS.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1766},"packages/plugins/plugin-graph/dist/lib/node/chunk-3QIHDIIS.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["GraphContext_default","useGraph"],"inputs":{"packages/plugins/plugin-graph/src/GraphContext.tsx":{"bytesInOutput":612}},"bytes":814},"packages/plugins/plugin-graph/dist/lib/node/graph-HXCMZDUQ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2342},"packages/plugins/plugin-graph/dist/lib/node/graph-HXCMZDUQ.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs","kind":"import-statement"},{"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":867}},"bytes":1052},"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":418},"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs":{"imports":[],"exports":["GRAPH_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":79}},"bytes":204}}}
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ GraphContext_default,
4
+ useGraph
5
+ } from "./chunk-XY43PHPY.mjs";
6
+ import "./chunk-IHM26RSC.mjs";
7
+ export {
8
+ GraphContext_default as default,
9
+ useGraph
10
+ };
11
+ //# sourceMappingURL=GraphContext-VNVZEAJK.mjs.map
@@ -2,12 +2,12 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
 
3
3
  // packages/plugins/plugin-graph/src/meta.ts
4
4
  var GRAPH_PLUGIN = "dxos.org/plugin/graph";
5
- var meta_default = {
5
+ var meta = {
6
6
  id: GRAPH_PLUGIN
7
7
  };
8
8
 
9
9
  export {
10
10
  GRAPH_PLUGIN,
11
- meta_default
11
+ meta
12
12
  };
13
- //# sourceMappingURL=chunk-H3EEX7DI.mjs.map
13
+ //# sourceMappingURL=chunk-IHM26RSC.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 GRAPH_PLUGIN = 'dxos.org/plugin/graph';\n\nexport const meta = {\n id: GRAPH_PLUGIN,\n} satisfies PluginMeta;\n"],
5
+ "mappings": ";;;AAMO,IAAMA,eAAe;AAErB,IAAMC,OAAO;EAClBC,IAAIF;AACN;",
6
+ "names": ["GRAPH_PLUGIN", "meta", "id"]
7
+ }
@@ -0,0 +1,26 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ GRAPH_PLUGIN
4
+ } from "./chunk-IHM26RSC.mjs";
5
+
6
+ // packages/plugins/plugin-graph/src/GraphContext.tsx
7
+ import React, { createContext, useContext } from "react";
8
+ import { Capabilities, contributes, useCapability } from "@dxos/app-framework";
9
+ import { raise } from "@dxos/debug";
10
+ var GraphContext = /* @__PURE__ */ createContext(null);
11
+ var useGraph = () => useContext(GraphContext) ?? raise(new Error("Missing GraphContext"));
12
+ var GraphContext_default = () => contributes(Capabilities.ReactContext, {
13
+ id: GRAPH_PLUGIN,
14
+ context: (props) => {
15
+ const value = useCapability(Capabilities.AppGraph);
16
+ return /* @__PURE__ */ React.createElement(GraphContext.Provider, {
17
+ value
18
+ }, props.children);
19
+ }
20
+ });
21
+
22
+ export {
23
+ useGraph,
24
+ GraphContext_default
25
+ };
26
+ //# sourceMappingURL=chunk-XY43PHPY.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/GraphContext.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type Context, createContext, type PropsWithChildren, useContext } from 'react';\n\nimport { Capabilities, contributes, useCapability } from '@dxos/app-framework';\nimport { type GraphBuilder } from '@dxos/app-graph';\nimport { raise } from '@dxos/debug';\n\nimport { GRAPH_PLUGIN } from './meta';\n\ntype GraphContextType = Pick<GraphBuilder, 'graph' | 'explore'>;\nconst GraphContext: Context<GraphContextType | null> = createContext<GraphContextType | null>(null);\n\nexport const useGraph = (): GraphContextType => useContext(GraphContext) ?? raise(new Error('Missing GraphContext'));\n\nexport default () =>\n contributes(Capabilities.ReactContext, {\n id: GRAPH_PLUGIN,\n context: (props: PropsWithChildren) => {\n const value = useCapability(Capabilities.AppGraph);\n return <GraphContext.Provider value={value}>{props.children}</GraphContext.Provider>;\n },\n });\n"],
5
+ "mappings": ";;;;;;AAIA,OAAOA,SAAuBC,eAAuCC,kBAAkB;AAEvF,SAASC,cAAcC,aAAaC,qBAAqB;AAEzD,SAASC,aAAa;AAKtB,IAAMC,eAAiDC,8BAAuC,IAAA;AAEvF,IAAMC,WAAW,MAAwBC,WAAWH,YAAAA,KAAiBI,MAAM,IAAIC,MAAM,sBAAA,CAAA;AAE5F,IAAA,uBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,IAAIC;EACJC,SAAS,CAACC,UAAAA;AACR,UAAMC,QAAQC,cAAcP,aAAaQ,QAAQ;AACjD,WAAO,sBAAA,cAACf,aAAagB,UAAQ;MAACH;OAAeD,MAAMK,QAAQ;EAC7D;AACF,CAAA;",
6
+ "names": ["React", "createContext", "useContext", "Capabilities", "contributes", "useCapability", "raise", "GraphContext", "createContext", "useGraph", "useContext", "raise", "Error", "contributes", "Capabilities", "ReactContext", "id", "GRAPH_PLUGIN", "context", "props", "value", "useCapability", "AppGraph", "Provider", "children"]
7
+ }
@@ -0,0 +1,31 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ GRAPH_PLUGIN
4
+ } from "./chunk-IHM26RSC.mjs";
5
+
6
+ // packages/plugins/plugin-graph/src/graph.ts
7
+ import { Capabilities, contributes } from "@dxos/app-framework";
8
+ import { GraphBuilder } from "@dxos/app-graph";
9
+ var KEY = `${GRAPH_PLUGIN}/app-graph`;
10
+ var graph_default = async (context) => {
11
+ const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? void 0);
12
+ const interval = setInterval(() => {
13
+ localStorage.setItem(KEY, builder.graph.pickle());
14
+ }, 5e3);
15
+ context.requestCapabilities(Capabilities.AppGraphBuilder).forEach((extension) => builder.addExtension(extension));
16
+ await builder.initialize();
17
+ await builder.graph.expand(builder.graph.root);
18
+ setupDevtools(builder.graph);
19
+ return contributes(Capabilities.AppGraph, {
20
+ graph: builder.graph,
21
+ explore: (options) => builder.explore(options)
22
+ }, () => clearInterval(interval));
23
+ };
24
+ var setupDevtools = (graph) => {
25
+ globalThis.composer ??= {};
26
+ globalThis.composer.graph = graph;
27
+ };
28
+ export {
29
+ graph_default as default
30
+ };
31
+ //# sourceMappingURL=graph-UQRZMBQ5.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 { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { type Graph, GraphBuilder } from '@dxos/app-graph';\n\nimport { GRAPH_PLUGIN } from './meta';\n\nconst KEY = `${GRAPH_PLUGIN}/app-graph`;\n\nexport default async (context: PluginsContext) => {\n const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? undefined);\n const interval = setInterval(() => {\n localStorage.setItem(KEY, builder.graph.pickle());\n }, 5_000);\n\n context.requestCapabilities(Capabilities.AppGraphBuilder).forEach((extension) => builder.addExtension(extension));\n\n await builder.initialize();\n await builder.graph.expand(builder.graph.root);\n\n setupDevtools(builder.graph);\n\n return contributes(\n Capabilities.AppGraph,\n { graph: builder.graph, explore: (options) => builder.explore(options) },\n () => clearInterval(interval),\n );\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: Graph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,cAAcC,mBAAwC;AAC/D,SAAqBC,oBAAoB;AAIzC,IAAMC,MAAM,GAAGC,YAAAA;AAEf,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,UAAUC,aAAaC,KAAKC,aAAaC,QAAQP,GAAAA,KAAQQ,MAAAA;AAC/D,QAAMC,WAAWC,YAAY,MAAA;AAC3BJ,iBAAaK,QAAQX,KAAKG,QAAQS,MAAMC,OAAM,CAAA;EAChD,GAAG,GAAA;AAEHX,UAAQY,oBAAoBC,aAAaC,eAAe,EAAEC,QAAQ,CAACC,cAAcf,QAAQgB,aAAaD,SAAAA,CAAAA;AAEtG,QAAMf,QAAQiB,WAAU;AACxB,QAAMjB,QAAQS,MAAMS,OAAOlB,QAAQS,MAAMU,IAAI;AAE7CC,gBAAcpB,QAAQS,KAAK;AAE3B,SAAOY,YACLT,aAAaU,UACb;IAAEb,OAAOT,QAAQS;IAAOc,SAAS,CAACC,YAAYxB,QAAQuB,QAAQC,OAAAA;EAAS,GACvE,MAAMC,cAAcnB,QAAAA,CAAAA;AAExB;AAGA,IAAMc,gBAAgB,CAACX,UAAAA;AACpBiB,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASlB,QAAQA;AACvC;",
6
+ "names": ["Capabilities", "contributes", "GraphBuilder", "KEY", "GRAPH_PLUGIN", "context", "builder", "GraphBuilder", "from", "localStorage", "getItem", "undefined", "interval", "setInterval", "setItem", "graph", "pickle", "requestCapabilities", "Capabilities", "AppGraphBuilder", "forEach", "extension", "addExtension", "initialize", "expand", "root", "setupDevtools", "contributes", "AppGraph", "explore", "options", "clearInterval", "globalThis", "composer"]
7
+ }
@@ -1,62 +1,39 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ useGraph
4
+ } from "./chunk-XY43PHPY.mjs";
2
5
  import {
3
6
  GRAPH_PLUGIN,
4
- meta_default
5
- } from "./chunk-H3EEX7DI.mjs";
6
-
7
- // packages/plugins/plugin-graph/src/GraphPlugin.tsx
8
- import React from "react";
9
- import { filterPlugins, parseGraphBuilderPlugin } from "@dxos/app-framework";
10
- import { GraphBuilder } from "@dxos/app-graph";
11
-
12
- // packages/plugins/plugin-graph/src/GraphContext.ts
13
- import { createContext, useContext } from "react";
14
- import { raise } from "@dxos/debug";
15
- var GraphContext = createContext(null);
16
- var useGraph = () => useContext(GraphContext) ?? raise(new Error("Missing GraphContext"));
17
-
18
- // packages/plugins/plugin-graph/src/GraphPlugin.tsx
19
- var KEY = `${GRAPH_PLUGIN}/app-graph`;
20
- var GraphPlugin = () => {
21
- const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? void 0);
22
- let interval;
23
- return {
24
- meta: meta_default,
25
- ready: async (plugins) => {
26
- interval = setInterval(() => {
27
- localStorage.setItem(`${GRAPH_PLUGIN}/graph`, builder.graph.pickle());
28
- }, 5e3);
29
- filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) => builder.addExtension(plugin.provides.graph.builder(plugins)));
30
- await builder.initialize();
31
- await builder.graph.expand(builder.graph.root);
32
- const composer = window.composer;
33
- if (typeof composer === "object") {
34
- composer.graph = builder.graph;
35
- }
36
- },
37
- unload: async () => {
38
- clearInterval(interval);
39
- },
40
- provides: {
41
- graph: builder.graph,
42
- // TODO(wittjosiah): This is janky to expose this function in this way.
43
- explore: (options) => builder.explore(options),
44
- context: ({ children }) => /* @__PURE__ */ React.createElement(GraphContext.Provider, {
45
- value: {
46
- graph: builder.graph
47
- }
48
- }, children)
49
- }
50
- };
51
- };
7
+ meta
8
+ } from "./chunk-IHM26RSC.mjs";
52
9
 
53
10
  // packages/plugins/plugin-graph/src/index.ts
54
11
  export * from "@dxos/app-graph";
55
- var src_default = GraphPlugin;
12
+
13
+ // packages/plugins/plugin-graph/src/GraphPlugin.ts
14
+ import { defineModule, lazy, Events, definePlugin } from "@dxos/app-framework";
15
+ var GraphPlugin = () => definePlugin(meta, [
16
+ defineModule({
17
+ id: `${meta.id}/module/react-context`,
18
+ activatesOn: Events.Startup,
19
+ activate: lazy(() => import("./GraphContext-VNVZEAJK.mjs"))
20
+ }),
21
+ defineModule({
22
+ id: `${meta.id}/module/graph`,
23
+ activatesOn: Events.Startup,
24
+ activatesBefore: [
25
+ Events.SetupAppGraph
26
+ ],
27
+ activatesAfter: [
28
+ Events.AppGraphReady
29
+ ],
30
+ activate: lazy(() => import("./graph-UQRZMBQ5.mjs"))
31
+ })
32
+ ]);
56
33
  export {
57
- GraphContext,
34
+ GRAPH_PLUGIN,
58
35
  GraphPlugin,
59
- src_default as default,
36
+ meta,
60
37
  useGraph
61
38
  };
62
39
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
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, { GRAPH_PLUGIN } from './meta';\n\nconst KEY = `${GRAPH_PLUGIN}/app-graph`;\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 = GraphBuilder.from(localStorage.getItem(KEY) ?? undefined);\n let interval: NodeJS.Timeout | undefined;\n\n return {\n meta,\n ready: async (plugins) => {\n interval = setInterval(() => {\n localStorage.setItem(`${GRAPH_PLUGIN}/graph`, builder.graph.pickle());\n }, 5_000);\n\n filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) =>\n builder.addExtension(plugin.provides.graph.builder(plugins)),\n );\n\n await builder.initialize();\n await builder.graph.expand(builder.graph.root);\n\n // Expose the graph to the window for debugging.\n const composer = (window as any).composer;\n if (typeof composer === 'object') {\n composer.graph = builder.graph;\n }\n },\n unload: async () => {\n clearInterval(interval);\n },\n provides: {\n graph: builder.graph,\n // TODO(wittjosiah): This is janky to expose this function in this way.\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;;;ADFxF,IAAMC,MAAM,GAAGC,YAAAA;AAOR,IAAMC,cAAc,MAAA;AACzB,QAAMC,UAAUC,aAAaC,KAAKC,aAAaC,QAAQP,GAAAA,KAAQQ,MAAAA;AAC/D,MAAIC;AAEJ,SAAO;IACLC;IACAC,OAAO,OAAOC,YAAAA;AACZH,iBAAWI,YAAY,MAAA;AACrBP,qBAAaQ,QAAQ,GAAGb,YAAAA,UAAsBE,QAAQY,MAAMC,OAAM,CAAA;MACpE,GAAG,GAAA;AAEHC,oBAAcL,SAASM,uBAAAA,EAAyBC,QAAQ,CAACC,WACvDjB,QAAQkB,aAAaD,OAAOE,SAASP,MAAMZ,QAAQS,OAAAA,CAAAA,CAAAA;AAGrD,YAAMT,QAAQoB,WAAU;AACxB,YAAMpB,QAAQY,MAAMS,OAAOrB,QAAQY,MAAMU,IAAI;AAG7C,YAAMC,WAAYC,OAAeD;AACjC,UAAI,OAAOA,aAAa,UAAU;AAChCA,iBAASX,QAAQZ,QAAQY;MAC3B;IACF;IACAa,QAAQ,YAAA;AACNC,oBAAcpB,QAAAA;IAChB;IACAa,UAAU;MACRP,OAAOZ,QAAQY;;MAEfe,SAAS,CAACC,YAAY5B,QAAQ2B,QAAQC,OAAAA;MACtCC,SAAS,CAAC,EAAEC,SAAQ,MAClB,sBAAA,cAACC,aAAaC,UAAQ;QAACC,OAAO;UAAErB,OAAOZ,QAAQY;QAAM;SAAIkB,QAAAA;IAE7D;EACF;AACF;;;AE/CA,cAAc;AAFd,IAAA,cAAeI;",
6
- "names": ["React", "filterPlugins", "parseGraphBuilderPlugin", "GraphBuilder", "createContext", "useContext", "raise", "GraphContext", "createContext", "useGraph", "useContext", "raise", "Error", "KEY", "GRAPH_PLUGIN", "GraphPlugin", "builder", "GraphBuilder", "from", "localStorage", "getItem", "undefined", "interval", "meta", "ready", "plugins", "setInterval", "setItem", "graph", "pickle", "filterPlugins", "parseGraphBuilderPlugin", "forEach", "plugin", "addExtension", "provides", "initialize", "expand", "root", "composer", "window", "unload", "clearInterval", "explore", "options", "context", "children", "GraphContext", "Provider", "value", "GraphPlugin"]
3
+ "sources": ["../../../src/index.ts", "../../../src/GraphPlugin.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphContext';\nexport * from './GraphPlugin';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineModule, lazy, Events, definePlugin } from '@dxos/app-framework';\n\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 = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: lazy(() => import('./GraphContext')),\n }),\n defineModule({\n id: `${meta.id}/module/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n ]);\n"],
5
+ "mappings": ";;;;;;;;;;AAIA,cAAc;;;ACAd,SAASA,cAAcC,MAAMC,QAAQC,oBAAoB;AASlD,IAAMC,cAAc,MACzBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAUC,KAAK,MAAM,OAAO,6BAAA,CAAA;EAC9B,CAAA;EACAN,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBG,iBAAiB;MAACJ,OAAOK;;IACzBC,gBAAgB;MAACN,OAAOO;;IACxBL,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;",
6
+ "names": ["defineModule", "lazy", "Events", "definePlugin", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activate", "lazy", "activatesBefore", "SetupAppGraph", "activatesAfter", "AppGraphReady"]
7
7
  }
@@ -1 +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":854,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.tsx":{"bytes":6615,"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-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4418},"packages/plugins/plugin-graph/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-H3EEX7DI.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":1293},"packages/plugins/plugin-graph/src/GraphContext.ts":{"bytesInOutput":219},"packages/plugins/plugin-graph/src/index.ts":{"bytesInOutput":64}},"bytes":2063},"packages/plugins/plugin-graph/dist/lib/node-esm/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-graph/dist/lib/node-esm/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-H3EEX7DI.mjs","kind":"import-statement"}],"exports":["GRAPH_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-graph/src/meta.ts","inputs":{},"bytes":251},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-H3EEX7DI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":405},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-H3EEX7DI.mjs":{"imports":[],"exports":["GRAPH_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":87}},"bytes":313}}}
1
+ {"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/GraphContext.tsx":{"bytes":3234,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":4364,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":3276,"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/GraphContext.tsx","kind":"dynamic-import","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-graph/src/index.ts":{"bytes":797,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-graph/src/GraphContext.tsx","kind":"import-statement","original":"./GraphContext"},{"path":"packages/plugins/plugin-graph/src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"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":1758},"packages/plugins/plugin-graph/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-XY43PHPY.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs","kind":"import-statement"},{"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/GraphContext-VNVZEAJK.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/graph-UQRZMBQ5.mjs","kind":"dynamic-import"}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useGraph"],"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":552}},"bytes":988},"packages/plugins/plugin-graph/dist/lib/node-esm/GraphContext-VNVZEAJK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-graph/dist/lib/node-esm/GraphContext-VNVZEAJK.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-XY43PHPY.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs","kind":"import-statement"}],"exports":["default","useGraph"],"entryPoint":"packages/plugins/plugin-graph/src/GraphContext.tsx","inputs":{},"bytes":307},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-XY43PHPY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1767},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-XY43PHPY.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["GraphContext_default","useGraph"],"inputs":{"packages/plugins/plugin-graph/src/GraphContext.tsx":{"bytesInOutput":612}},"bytes":906},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-UQRZMBQ5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2343},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-UQRZMBQ5.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs","kind":"import-statement"},{"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":867}},"bytes":1144},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":420},"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs":{"imports":[],"exports":["GRAPH_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":79}},"bytes":297}}}
@@ -1,8 +1,11 @@
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;
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import { type GraphBuilder } from '@dxos/app-graph';
3
+ type GraphContextType = Pick<GraphBuilder, 'graph' | 'explore'>;
4
+ export declare const useGraph: () => GraphContextType;
5
+ declare const _default: () => import("@dxos/app-framework").Capability<Readonly<{
6
+ id: string;
7
+ dependsOn?: string[];
8
+ context: React.FC<PropsWithChildren>;
9
+ }>>;
10
+ export default _default;
8
11
  //# sourceMappingURL=GraphContext.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"GraphContext.d.ts","sourceRoot":"","sources":["../../../src/GraphContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAA+B,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,KAAK,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAGhE,eAAO,MAAM,QAAQ,QAAO,gBAAwF,CAAC;;;;;;AAErH,wBAOK"}
@@ -1,8 +1,7 @@
1
- import { type GraphProvides, type PluginDefinition } from '@dxos/app-framework';
2
1
  /**
3
2
  * Manages the state of the graph for the application.
4
3
  * Enables other plugins to register node builders to add nodes to the graph.
5
4
  * This includes actions and annotation each other's nodes.
6
5
  */
7
- export declare const GraphPlugin: () => PluginDefinition<GraphProvides>;
6
+ export declare const GraphPlugin: () => import("@dxos/app-framework").Plugin;
8
7
  //# sourceMappingURL=GraphPlugin.d.ts.map
@@ -1 +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;AAQxH;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,gBAAgB,CAAC,aAAa,CAoC5D,CAAC"}
1
+ {"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,4CAcpB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type PluginsContext } from '@dxos/app-framework';
2
+ import { type Graph } from '@dxos/app-graph';
3
+ declare const _default: (context: PluginsContext) => Promise<import("@dxos/app-framework").Capability<{
4
+ graph: Graph;
5
+ explore: (options: import("@dxos/app-graph").GraphBuilderTraverseOptions) => Promise<void>;
6
+ }>>;
7
+ export default _default;
8
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,iBAAiB,CAAC;kCAM5B,cAAc;;;;AAA7C,wBAkBE"}
@@ -1,6 +1,5 @@
1
- import { GraphPlugin } from './GraphPlugin';
2
- export default GraphPlugin;
3
1
  export * from '@dxos/app-graph';
4
2
  export * from './GraphContext';
5
3
  export * from './GraphPlugin';
4
+ export * from './meta';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
@@ -1,6 +1,5 @@
1
1
  export declare const GRAPH_PLUGIN = "dxos.org/plugin/graph";
2
- declare const _default: {
2
+ export declare const meta: {
3
3
  id: string;
4
4
  };
5
- export default _default;
6
5
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0BAA0B,CAAC;;;;AAEpD,wBAEuB"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD,eAAO,MAAM,IAAI;;CAEK,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":"5.7.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-graph",
3
- "version": "0.7.4-staging.f7e8224",
3
+ "version": "0.7.5-feature-compute.4d9d99a",
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",
@@ -12,20 +12,11 @@
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs",
14
14
  "node": "./dist/lib/node-esm/index.mjs"
15
- },
16
- "./meta": {
17
- "types": "./dist/types/src/meta.d.ts",
18
- "browser": "./dist/lib/browser/meta.mjs",
19
- "node": "./dist/lib/node-esm/meta.mjs"
20
15
  }
21
16
  },
22
17
  "types": "dist/types/src/index.d.ts",
23
18
  "typesVersions": {
24
- "*": {
25
- "meta": [
26
- "dist/types/src/meta.d.ts"
27
- ]
28
- }
19
+ "*": {}
29
20
  },
30
21
  "files": [
31
22
  "dist",
@@ -33,10 +24,10 @@
33
24
  ],
34
25
  "dependencies": {
35
26
  "@preact/signals-core": "^1.6.0",
36
- "@dxos/app-framework": "0.7.4-staging.f7e8224",
37
- "@dxos/app-graph": "0.7.4-staging.f7e8224",
38
- "@dxos/async": "0.7.4-staging.f7e8224",
39
- "@dxos/debug": "0.7.4-staging.f7e8224"
27
+ "@dxos/app-framework": "0.7.5-feature-compute.4d9d99a",
28
+ "@dxos/app-graph": "0.7.5-feature-compute.4d9d99a",
29
+ "@dxos/async": "0.7.5-feature-compute.4d9d99a",
30
+ "@dxos/debug": "0.7.5-feature-compute.4d9d99a"
40
31
  },
41
32
  "devDependencies": {
42
33
  "@types/react": "~18.2.0",
@@ -44,8 +35,8 @@
44
35
  "react": "~18.2.0",
45
36
  "react-dom": "~18.2.0",
46
37
  "vite": "5.4.7",
47
- "@dxos/storybook-utils": "0.7.4-staging.f7e8224",
48
- "@dxos/react-client": "0.7.4-staging.f7e8224"
38
+ "@dxos/react-client": "0.7.5-feature-compute.4d9d99a",
39
+ "@dxos/storybook-utils": "0.7.5-feature-compute.4d9d99a"
49
40
  },
50
41
  "peerDependencies": {
51
42
  "react": "~18.2.0",
@@ -0,0 +1,25 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { type Context, createContext, type PropsWithChildren, useContext } from 'react';
6
+
7
+ import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
+ import { type GraphBuilder } from '@dxos/app-graph';
9
+ import { raise } from '@dxos/debug';
10
+
11
+ import { GRAPH_PLUGIN } from './meta';
12
+
13
+ type GraphContextType = Pick<GraphBuilder, 'graph' | 'explore'>;
14
+ const GraphContext: Context<GraphContextType | null> = createContext<GraphContextType | null>(null);
15
+
16
+ export const useGraph = (): GraphContextType => useContext(GraphContext) ?? raise(new Error('Missing GraphContext'));
17
+
18
+ export default () =>
19
+ contributes(Capabilities.ReactContext, {
20
+ id: GRAPH_PLUGIN,
21
+ context: (props: PropsWithChildren) => {
22
+ const value = useCapability(Capabilities.AppGraph);
23
+ return <GraphContext.Provider value={value}>{props.children}</GraphContext.Provider>;
24
+ },
25
+ });
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineModule, lazy, Events, definePlugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ /**
10
+ * Manages the state of the graph for the application.
11
+ * Enables other plugins to register node builders to add nodes to the graph.
12
+ * This includes actions and annotation each other's nodes.
13
+ */
14
+ export const GraphPlugin = () =>
15
+ definePlugin(meta, [
16
+ defineModule({
17
+ id: `${meta.id}/module/react-context`,
18
+ activatesOn: Events.Startup,
19
+ activate: lazy(() => import('./GraphContext')),
20
+ }),
21
+ defineModule({
22
+ id: `${meta.id}/module/graph`,
23
+ activatesOn: Events.Startup,
24
+ activatesBefore: [Events.SetupAppGraph],
25
+ activatesAfter: [Events.AppGraphReady],
26
+ activate: lazy(() => import('./graph')),
27
+ }),
28
+ ]);
package/src/graph.ts ADDED
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
6
+ import { type Graph, GraphBuilder } from '@dxos/app-graph';
7
+
8
+ import { GRAPH_PLUGIN } from './meta';
9
+
10
+ const KEY = `${GRAPH_PLUGIN}/app-graph`;
11
+
12
+ export default async (context: PluginsContext) => {
13
+ const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? undefined);
14
+ const interval = setInterval(() => {
15
+ localStorage.setItem(KEY, builder.graph.pickle());
16
+ }, 5_000);
17
+
18
+ context.requestCapabilities(Capabilities.AppGraphBuilder).forEach((extension) => builder.addExtension(extension));
19
+
20
+ await builder.initialize();
21
+ await builder.graph.expand(builder.graph.root);
22
+
23
+ setupDevtools(builder.graph);
24
+
25
+ return contributes(
26
+ Capabilities.AppGraph,
27
+ { graph: builder.graph, explore: (options) => builder.explore(options) },
28
+ () => clearInterval(interval),
29
+ );
30
+ };
31
+
32
+ // Expose the graph to the window for debugging.
33
+ const setupDevtools = (graph: Graph) => {
34
+ (globalThis as any).composer ??= {};
35
+ (globalThis as any).composer.graph = graph;
36
+ };
package/src/index.ts CHANGED
@@ -2,11 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { GraphPlugin } from './GraphPlugin';
6
-
7
- export default GraphPlugin;
8
-
9
5
  export * from '@dxos/app-graph';
10
6
 
11
7
  export * from './GraphContext';
12
8
  export * from './GraphPlugin';
9
+ export * from './meta';
package/src/meta.ts CHANGED
@@ -6,6 +6,6 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const GRAPH_PLUGIN = 'dxos.org/plugin/graph';
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: GRAPH_PLUGIN,
11
11
  } satisfies PluginMeta;
@@ -1,7 +0,0 @@
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 GRAPH_PLUGIN = 'dxos.org/plugin/graph';\n\nexport default {\n id: GRAPH_PLUGIN,\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,eAAe;AAE5B,IAAA,eAAe;EACbC,IAAID;AACN;",
6
- "names": ["GRAPH_PLUGIN", "id"]
7
- }
@@ -1,9 +0,0 @@
1
- import {
2
- GRAPH_PLUGIN,
3
- meta_default
4
- } from "./chunk-SYPRW7IK.mjs";
5
- export {
6
- GRAPH_PLUGIN,
7
- meta_default as default
8
- };
9
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
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 GRAPH_PLUGIN = 'dxos.org/plugin/graph';\n\nexport default {\n id: GRAPH_PLUGIN,\n} satisfies PluginMeta;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,eAAe;AAE5B,IAAA,eAAe;EACbC,IAAID;AACN;",
6
- "names": ["GRAPH_PLUGIN", "id"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["meta.cjs"],
4
- "sourcesContent": ["import {\n GRAPH_PLUGIN,\n meta_default\n} from \"./chunk-PIWXSWR4.cjs\";\nexport {\n GRAPH_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
6
- "names": []
7
- }