@dxos/plugin-graph 0.7.4 → 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,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,10 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- GRAPH_PLUGIN,
4
- meta_default
5
- } from "./chunk-H3EEX7DI.mjs";
6
- export {
7
- GRAPH_PLUGIN,
8
- meta_default as default
9
- };
10
- //# sourceMappingURL=meta.mjs.map
@@ -1,15 +0,0 @@
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'));
@@ -1,56 +0,0 @@
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, { GRAPH_PLUGIN } from './meta';
12
-
13
- const KEY = `${GRAPH_PLUGIN}/app-graph`;
14
-
15
- /**
16
- * Manages the state of the graph for the application.
17
- * Enables other plugins to register node builders to add nodes to the graph.
18
- * This includes actions and annotation each other's nodes.
19
- */
20
- export const GraphPlugin = (): PluginDefinition<GraphProvides> => {
21
- const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? undefined);
22
- let interval: NodeJS.Timeout | undefined;
23
-
24
- return {
25
- meta,
26
- ready: async (plugins) => {
27
- interval = setInterval(() => {
28
- localStorage.setItem(`${GRAPH_PLUGIN}/graph`, builder.graph.pickle());
29
- }, 5_000);
30
-
31
- filterPlugins(plugins, parseGraphBuilderPlugin).forEach((plugin) =>
32
- builder.addExtension(plugin.provides.graph.builder(plugins)),
33
- );
34
-
35
- await builder.initialize();
36
- await builder.graph.expand(builder.graph.root);
37
-
38
- // Expose the graph to the window for debugging.
39
- const composer = (window as any).composer;
40
- if (typeof composer === 'object') {
41
- composer.graph = builder.graph;
42
- }
43
- },
44
- unload: async () => {
45
- clearInterval(interval);
46
- },
47
- provides: {
48
- graph: builder.graph,
49
- // TODO(wittjosiah): This is janky to expose this function in this way.
50
- explore: (options) => builder.explore(options),
51
- context: ({ children }) => (
52
- <GraphContext.Provider value={{ graph: builder.graph }}>{children}</GraphContext.Provider>
53
- ),
54
- },
55
- };
56
- };