@dxos/plugin-graph 0.7.5-main.9d2a38b → 0.7.5-main.b19bfc8
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-WNFVYZKZ.mjs → graph-U2AHH24Q.mjs} +16 -4
- package/dist/lib/browser/graph-U2AHH24Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/{graph-HXCMZDUQ.cjs → graph-AOAAITHV.cjs} +18 -6
- package/dist/lib/node/graph-AOAAITHV.cjs.map +7 -0
- package/dist/lib/node/index.cjs +4 -11
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/{graph-UQRZMBQ5.mjs → graph-VC422POI.mjs} +16 -4
- package/dist/lib/node-esm/graph-VC422POI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/GraphPlugin.d.ts.map +1 -1
- package/dist/types/src/graph.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/GraphPlugin.ts +1 -6
- package/src/graph.ts +16 -3
- package/src/index.ts +0 -1
- package/dist/lib/browser/GraphContext-VQKUKWLP.mjs +0 -10
- package/dist/lib/browser/GraphContext-VQKUKWLP.mjs.map +0 -7
- package/dist/lib/browser/chunk-L7JM5AMI.mjs +0 -25
- package/dist/lib/browser/chunk-L7JM5AMI.mjs.map +0 -7
- package/dist/lib/browser/graph-WNFVYZKZ.mjs.map +0 -7
- package/dist/lib/node/GraphContext-MUIA2AJE.cjs +0 -31
- package/dist/lib/node/GraphContext-MUIA2AJE.cjs.map +0 -7
- package/dist/lib/node/chunk-3QIHDIIS.cjs +0 -55
- package/dist/lib/node/chunk-3QIHDIIS.cjs.map +0 -7
- package/dist/lib/node/graph-HXCMZDUQ.cjs.map +0 -7
- package/dist/lib/node-esm/GraphContext-VNVZEAJK.mjs +0 -11
- package/dist/lib/node-esm/GraphContext-VNVZEAJK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XY43PHPY.mjs +0 -26
- package/dist/lib/node-esm/chunk-XY43PHPY.mjs.map +0 -7
- package/dist/lib/node-esm/graph-UQRZMBQ5.mjs.map +0 -7
- package/dist/types/src/GraphContext.d.ts +0 -11
- package/dist/types/src/GraphContext.d.ts.map +0 -1
- package/src/GraphContext.tsx +0 -25
|
@@ -3,22 +3,34 @@ import {
|
|
|
3
3
|
} from "./chunk-7LNMG3EB.mjs";
|
|
4
4
|
|
|
5
5
|
// packages/plugins/plugin-graph/src/graph.ts
|
|
6
|
+
import { batch, effect, untracked } from "@preact/signals-core";
|
|
6
7
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
7
|
-
import { GraphBuilder } from "@dxos/app-graph";
|
|
8
|
+
import { flattenExtensions, GraphBuilder } from "@dxos/app-graph";
|
|
8
9
|
var KEY = `${GRAPH_PLUGIN}/app-graph`;
|
|
9
10
|
var graph_default = async (context) => {
|
|
10
11
|
const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? void 0);
|
|
11
12
|
const interval = setInterval(() => {
|
|
12
13
|
localStorage.setItem(KEY, builder.graph.pickle());
|
|
13
14
|
}, 5e3);
|
|
14
|
-
|
|
15
|
+
const unsubscribe = effect(() => {
|
|
16
|
+
batch(() => {
|
|
17
|
+
const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));
|
|
18
|
+
const current = untracked(() => builder.extensions);
|
|
19
|
+
const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
|
|
20
|
+
removed.forEach((extension) => builder.removeExtension(extension.id));
|
|
21
|
+
next.forEach((extension) => builder.addExtension(extension));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
15
24
|
await builder.initialize();
|
|
16
25
|
await builder.graph.expand(builder.graph.root);
|
|
17
26
|
setupDevtools(builder.graph);
|
|
18
27
|
return contributes(Capabilities.AppGraph, {
|
|
19
28
|
graph: builder.graph,
|
|
20
29
|
explore: (options) => builder.explore(options)
|
|
21
|
-
}, () =>
|
|
30
|
+
}, () => {
|
|
31
|
+
clearInterval(interval);
|
|
32
|
+
unsubscribe();
|
|
33
|
+
});
|
|
22
34
|
};
|
|
23
35
|
var setupDevtools = (graph) => {
|
|
24
36
|
globalThis.composer ??= {};
|
|
@@ -27,4 +39,4 @@ var setupDevtools = (graph) => {
|
|
|
27
39
|
export {
|
|
28
40
|
graph_default as default
|
|
29
41
|
};
|
|
30
|
-
//# sourceMappingURL=graph-
|
|
42
|
+
//# sourceMappingURL=graph-U2AHH24Q.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 { batch, effect, untracked } from '@preact/signals-core';\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { flattenExtensions, 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 const unsubscribe = effect(() => {\n batch(() => {\n const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));\n const current = untracked(() => 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 });\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 () => {\n clearInterval(interval);\n unsubscribe();\n },\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,OAAOC,QAAQC,iBAAiB;AAEzC,SAASC,cAAcC,mBAAwC;AAC/D,SAASC,mBAA+BC,oBAAoB;AAI5D,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;AAEH,QAAMC,cAAcC,OAAO,MAAA;AACzBC,UAAM,MAAA;AACJ,YAAMC,OAAOC,kBAAkBhB,QAAQiB,oBAAoBC,aAAaC,eAAe,CAAA;AACvF,YAAMC,UAAUC,UAAU,MAAMpB,QAAQqB,UAAU;AAClD,YAAMC,UAAUH,QAAQI,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACV,KAAKW,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,cAAQK,QAAQ,CAACC,cAAc5B,QAAQ6B,gBAAgBD,UAAUJ,EAAE,CAAA;AACnEV,WAAKa,QAAQ,CAACC,cAAc5B,QAAQ8B,aAAaF,SAAAA,CAAAA;IACnD,CAAA;EACF,CAAA;AAEA,QAAM5B,QAAQ+B,WAAU;AACxB,QAAM/B,QAAQS,MAAMuB,OAAOhC,QAAQS,MAAMwB,IAAI;AAE7CC,gBAAclC,QAAQS,KAAK;AAE3B,SAAO0B,YACLlB,aAAamB,UACb;IAAE3B,OAAOT,QAAQS;IAAO4B,SAAS,CAACC,YAAYtC,QAAQqC,QAAQC,OAAAA;EAAS,GACvE,MAAA;AACEC,kBAAcjC,QAAAA;AACdK,gBAAAA;EACF,CAAA;AAEJ;AAGA,IAAMuB,gBAAgB,CAACzB,UAAAA;AACpB+B,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAShC,QAAQA;AACvC;",
|
|
6
|
+
"names": ["batch", "effect", "untracked", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "KEY", "GRAPH_PLUGIN", "context", "builder", "GraphBuilder", "from", "localStorage", "getItem", "undefined", "interval", "setInterval", "setItem", "graph", "pickle", "unsubscribe", "effect", "batch", "next", "flattenExtensions", "requestCapabilities", "Capabilities", "AppGraphBuilder", "current", "untracked", "extensions", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "initialize", "expand", "root", "setupDevtools", "contributes", "AppGraph", "explore", "options", "clearInterval", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useGraph
|
|
3
|
-
} from "./chunk-L7JM5AMI.mjs";
|
|
4
1
|
import {
|
|
5
2
|
GRAPH_PLUGIN,
|
|
6
3
|
meta
|
|
@@ -12,27 +9,22 @@ export * from "@dxos/app-graph";
|
|
|
12
9
|
// packages/plugins/plugin-graph/src/GraphPlugin.ts
|
|
13
10
|
import { defineModule, lazy, Events, definePlugin } from "@dxos/app-framework";
|
|
14
11
|
var GraphPlugin = () => definePlugin(meta, [
|
|
15
|
-
defineModule({
|
|
16
|
-
id: `${meta.id}/module/react-context`,
|
|
17
|
-
activatesOn: Events.Startup,
|
|
18
|
-
activate: lazy(() => import("./GraphContext-VQKUKWLP.mjs"))
|
|
19
|
-
}),
|
|
20
12
|
defineModule({
|
|
21
13
|
id: `${meta.id}/module/graph`,
|
|
22
14
|
activatesOn: Events.Startup,
|
|
23
15
|
activatesBefore: [
|
|
24
|
-
Events.SetupAppGraph
|
|
16
|
+
Events.SetupAppGraph,
|
|
17
|
+
Events.SetupMetadata
|
|
25
18
|
],
|
|
26
19
|
activatesAfter: [
|
|
27
20
|
Events.AppGraphReady
|
|
28
21
|
],
|
|
29
|
-
activate: lazy(() => import("./graph-
|
|
22
|
+
activate: lazy(() => import("./graph-U2AHH24Q.mjs"))
|
|
30
23
|
})
|
|
31
24
|
]);
|
|
32
25
|
export {
|
|
33
26
|
GRAPH_PLUGIN,
|
|
34
27
|
GraphPlugin,
|
|
35
|
-
meta
|
|
36
|
-
useGraph
|
|
28
|
+
meta
|
|
37
29
|
};
|
|
38
30
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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 './
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["defineModule", "lazy", "Events", "definePlugin", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\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/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\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,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;",
|
|
6
|
+
"names": ["defineModule", "lazy", "Events", "definePlugin", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6242,"imports":[{"path":"@preact/signals-core","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/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2810,"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/index.ts":{"bytes":697,"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/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1499},"packages/plugins/plugin-graph/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/browser/chunk-7LNMG3EB.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/browser/graph-U2AHH24Q.mjs","kind":"dynamic-import"}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta"],"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}},"bytes":698},"packages/plugins/plugin-graph/dist/lib/browser/graph-U2AHH24Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3429},"packages/plugins/plugin-graph/dist/lib/browser/graph-U2AHH24Q.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/browser/chunk-7LNMG3EB.mjs","kind":"import-statement"},{"path":"@preact/signals-core","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":1331}},"bytes":1516},"packages/plugins/plugin-graph/dist/lib/browser/chunk-7LNMG3EB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":418},"packages/plugins/plugin-graph/dist/lib/browser/chunk-7LNMG3EB.mjs":{"imports":[],"exports":["GRAPH_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytesInOutput":79}},"bytes":204}}}
|
|
@@ -16,12 +16,13 @@ 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_AOAAITHV_exports = {};
|
|
20
|
+
__export(graph_AOAAITHV_exports, {
|
|
21
21
|
default: () => graph_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(graph_AOAAITHV_exports);
|
|
24
24
|
var import_chunk_KHIPMH35 = require("./chunk-KHIPMH35.cjs");
|
|
25
|
+
var import_signals_core = require("@preact/signals-core");
|
|
25
26
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
27
|
var import_app_graph = require("@dxos/app-graph");
|
|
27
28
|
var KEY = `${import_chunk_KHIPMH35.GRAPH_PLUGIN}/app-graph`;
|
|
@@ -30,17 +31,28 @@ var graph_default = async (context) => {
|
|
|
30
31
|
const interval = setInterval(() => {
|
|
31
32
|
localStorage.setItem(KEY, builder.graph.pickle());
|
|
32
33
|
}, 5e3);
|
|
33
|
-
|
|
34
|
+
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
35
|
+
(0, import_signals_core.batch)(() => {
|
|
36
|
+
const next = (0, import_app_graph.flattenExtensions)(context.requestCapabilities(import_app_framework.Capabilities.AppGraphBuilder));
|
|
37
|
+
const current = (0, import_signals_core.untracked)(() => builder.extensions);
|
|
38
|
+
const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
|
|
39
|
+
removed.forEach((extension) => builder.removeExtension(extension.id));
|
|
40
|
+
next.forEach((extension) => builder.addExtension(extension));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
34
43
|
await builder.initialize();
|
|
35
44
|
await builder.graph.expand(builder.graph.root);
|
|
36
45
|
setupDevtools(builder.graph);
|
|
37
46
|
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.AppGraph, {
|
|
38
47
|
graph: builder.graph,
|
|
39
48
|
explore: (options) => builder.explore(options)
|
|
40
|
-
}, () =>
|
|
49
|
+
}, () => {
|
|
50
|
+
clearInterval(interval);
|
|
51
|
+
unsubscribe();
|
|
52
|
+
});
|
|
41
53
|
};
|
|
42
54
|
var setupDevtools = (graph) => {
|
|
43
55
|
globalThis.composer ??= {};
|
|
44
56
|
globalThis.composer.graph = graph;
|
|
45
57
|
};
|
|
46
|
-
//# sourceMappingURL=graph-
|
|
58
|
+
//# sourceMappingURL=graph-AOAAITHV.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 { batch, effect, untracked } from '@preact/signals-core';\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { flattenExtensions, 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 const unsubscribe = effect(() => {\n batch(() => {\n const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));\n const current = untracked(() => 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 });\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 () => {\n clearInterval(interval);\n unsubscribe();\n },\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,0BAAyC;AAEzC,2BAA+D;AAC/D,uBAA4D;AAI5D,IAAMA,MAAM,GAAGC,kCAAAA;AAEf,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,UAAUC,8BAAaC,KAAKC,aAAaC,QAAQP,GAAAA,KAAQQ,MAAAA;AAC/D,QAAMC,WAAWC,YAAY,MAAA;AAC3BJ,iBAAaK,QAAQX,KAAKG,QAAQS,MAAMC,OAAM,CAAA;EAChD,GAAG,GAAA;AAEH,QAAMC,kBAAcC,4BAAO,MAAA;AACzBC,mCAAM,MAAA;AACJ,YAAMC,WAAOC,oCAAkBhB,QAAQiB,oBAAoBC,kCAAaC,eAAe,CAAA;AACvF,YAAMC,cAAUC,+BAAU,MAAMpB,QAAQqB,UAAU;AAClD,YAAMC,UAAUH,QAAQI,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACV,KAAKW,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,cAAQK,QAAQ,CAACC,cAAc5B,QAAQ6B,gBAAgBD,UAAUJ,EAAE,CAAA;AACnEV,WAAKa,QAAQ,CAACC,cAAc5B,QAAQ8B,aAAaF,SAAAA,CAAAA;IACnD,CAAA;EACF,CAAA;AAEA,QAAM5B,QAAQ+B,WAAU;AACxB,QAAM/B,QAAQS,MAAMuB,OAAOhC,QAAQS,MAAMwB,IAAI;AAE7CC,gBAAclC,QAAQS,KAAK;AAE3B,aAAO0B,kCACLlB,kCAAamB,UACb;IAAE3B,OAAOT,QAAQS;IAAO4B,SAAS,CAACC,YAAYtC,QAAQqC,QAAQC,OAAAA;EAAS,GACvE,MAAA;AACEC,kBAAcjC,QAAAA;AACdK,gBAAAA;EACF,CAAA;AAEJ;AAGA,IAAMuB,gBAAgB,CAACzB,UAAAA;AACpB+B,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAShC,QAAQA;AACvC;",
|
|
6
|
+
"names": ["KEY", "GRAPH_PLUGIN", "context", "builder", "GraphBuilder", "from", "localStorage", "getItem", "undefined", "interval", "setInterval", "setItem", "graph", "pickle", "unsubscribe", "effect", "batch", "next", "flattenExtensions", "requestCapabilities", "Capabilities", "AppGraphBuilder", "current", "untracked", "extensions", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "initialize", "expand", "root", "setupDevtools", "contributes", "AppGraph", "explore", "options", "clearInterval", "globalThis", "composer"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -31,30 +31,24 @@ var node_exports = {};
|
|
|
31
31
|
__export(node_exports, {
|
|
32
32
|
GRAPH_PLUGIN: () => import_chunk_KHIPMH35.GRAPH_PLUGIN,
|
|
33
33
|
GraphPlugin: () => GraphPlugin,
|
|
34
|
-
meta: () => import_chunk_KHIPMH35.meta
|
|
35
|
-
useGraph: () => import_chunk_3QIHDIIS.useGraph
|
|
34
|
+
meta: () => import_chunk_KHIPMH35.meta
|
|
36
35
|
});
|
|
37
36
|
module.exports = __toCommonJS(node_exports);
|
|
38
|
-
var import_chunk_3QIHDIIS = require("./chunk-3QIHDIIS.cjs");
|
|
39
37
|
var import_chunk_KHIPMH35 = require("./chunk-KHIPMH35.cjs");
|
|
40
38
|
__reExport(node_exports, require("@dxos/app-graph"), module.exports);
|
|
41
39
|
var import_app_framework = require("@dxos/app-framework");
|
|
42
40
|
var GraphPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_KHIPMH35.meta, [
|
|
43
|
-
(0, import_app_framework.defineModule)({
|
|
44
|
-
id: `${import_chunk_KHIPMH35.meta.id}/module/react-context`,
|
|
45
|
-
activatesOn: import_app_framework.Events.Startup,
|
|
46
|
-
activate: (0, import_app_framework.lazy)(() => import("./GraphContext-MUIA2AJE.cjs"))
|
|
47
|
-
}),
|
|
48
41
|
(0, import_app_framework.defineModule)({
|
|
49
42
|
id: `${import_chunk_KHIPMH35.meta.id}/module/graph`,
|
|
50
43
|
activatesOn: import_app_framework.Events.Startup,
|
|
51
44
|
activatesBefore: [
|
|
52
|
-
import_app_framework.Events.SetupAppGraph
|
|
45
|
+
import_app_framework.Events.SetupAppGraph,
|
|
46
|
+
import_app_framework.Events.SetupMetadata
|
|
53
47
|
],
|
|
54
48
|
activatesAfter: [
|
|
55
49
|
import_app_framework.Events.AppGraphReady
|
|
56
50
|
],
|
|
57
|
-
activate: (0, import_app_framework.lazy)(() => import("./graph-
|
|
51
|
+
activate: (0, import_app_framework.lazy)(() => import("./graph-AOAAITHV.cjs"))
|
|
58
52
|
})
|
|
59
53
|
]);
|
|
60
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -62,7 +56,6 @@ var GraphPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_KHIP
|
|
|
62
56
|
GRAPH_PLUGIN,
|
|
63
57
|
GraphPlugin,
|
|
64
58
|
meta,
|
|
65
|
-
useGraph,
|
|
66
59
|
...require("@dxos/app-graph")
|
|
67
60
|
});
|
|
68
61
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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 './
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\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/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAc;ACAd,2BAAyD;AASlD,IAAMA,cAAc,UACzBC,mCAAaC,4BAAM;MACjBC,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOC;IACpBC,iBAAiB;MAACF,4BAAOG;MAAeH,4BAAOI;;IAC/CC,gBAAgB;MAACL,4BAAOM;;IACxBC,cAAUC,2BAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;",
|
|
6
|
+
"names": ["GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6242,"imports":[{"path":"@preact/signals-core","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/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2810,"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/index.ts":{"bytes":697,"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/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-graph/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1499},"packages/plugins/plugin-graph/dist/lib/node/index.cjs":{"imports":[{"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/graph-AOAAITHV.cjs","kind":"dynamic-import"}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta"],"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}},"bytes":698},"packages/plugins/plugin-graph/dist/lib/node/graph-AOAAITHV.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3429},"packages/plugins/plugin-graph/dist/lib/node/graph-AOAAITHV.cjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node/chunk-KHIPMH35.cjs","kind":"import-statement"},{"path":"@preact/signals-core","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":1331}},"bytes":1516},"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}}}
|
|
@@ -4,22 +4,34 @@ import {
|
|
|
4
4
|
} from "./chunk-IHM26RSC.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-graph/src/graph.ts
|
|
7
|
+
import { batch, effect, untracked } from "@preact/signals-core";
|
|
7
8
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
8
|
-
import { GraphBuilder } from "@dxos/app-graph";
|
|
9
|
+
import { flattenExtensions, GraphBuilder } from "@dxos/app-graph";
|
|
9
10
|
var KEY = `${GRAPH_PLUGIN}/app-graph`;
|
|
10
11
|
var graph_default = async (context) => {
|
|
11
12
|
const builder = GraphBuilder.from(localStorage.getItem(KEY) ?? void 0);
|
|
12
13
|
const interval = setInterval(() => {
|
|
13
14
|
localStorage.setItem(KEY, builder.graph.pickle());
|
|
14
15
|
}, 5e3);
|
|
15
|
-
|
|
16
|
+
const unsubscribe = effect(() => {
|
|
17
|
+
batch(() => {
|
|
18
|
+
const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));
|
|
19
|
+
const current = untracked(() => builder.extensions);
|
|
20
|
+
const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
|
|
21
|
+
removed.forEach((extension) => builder.removeExtension(extension.id));
|
|
22
|
+
next.forEach((extension) => builder.addExtension(extension));
|
|
23
|
+
});
|
|
24
|
+
});
|
|
16
25
|
await builder.initialize();
|
|
17
26
|
await builder.graph.expand(builder.graph.root);
|
|
18
27
|
setupDevtools(builder.graph);
|
|
19
28
|
return contributes(Capabilities.AppGraph, {
|
|
20
29
|
graph: builder.graph,
|
|
21
30
|
explore: (options) => builder.explore(options)
|
|
22
|
-
}, () =>
|
|
31
|
+
}, () => {
|
|
32
|
+
clearInterval(interval);
|
|
33
|
+
unsubscribe();
|
|
34
|
+
});
|
|
23
35
|
};
|
|
24
36
|
var setupDevtools = (graph) => {
|
|
25
37
|
globalThis.composer ??= {};
|
|
@@ -28,4 +40,4 @@ var setupDevtools = (graph) => {
|
|
|
28
40
|
export {
|
|
29
41
|
graph_default as default
|
|
30
42
|
};
|
|
31
|
-
//# sourceMappingURL=graph-
|
|
43
|
+
//# sourceMappingURL=graph-VC422POI.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 { batch, effect, untracked } from '@preact/signals-core';\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { flattenExtensions, 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 const unsubscribe = effect(() => {\n batch(() => {\n const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));\n const current = untracked(() => 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 });\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 () => {\n clearInterval(interval);\n unsubscribe();\n },\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,OAAOC,QAAQC,iBAAiB;AAEzC,SAASC,cAAcC,mBAAwC;AAC/D,SAASC,mBAA+BC,oBAAoB;AAI5D,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;AAEH,QAAMC,cAAcC,OAAO,MAAA;AACzBC,UAAM,MAAA;AACJ,YAAMC,OAAOC,kBAAkBhB,QAAQiB,oBAAoBC,aAAaC,eAAe,CAAA;AACvF,YAAMC,UAAUC,UAAU,MAAMpB,QAAQqB,UAAU;AAClD,YAAMC,UAAUH,QAAQI,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACV,KAAKW,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,cAAQK,QAAQ,CAACC,cAAc5B,QAAQ6B,gBAAgBD,UAAUJ,EAAE,CAAA;AACnEV,WAAKa,QAAQ,CAACC,cAAc5B,QAAQ8B,aAAaF,SAAAA,CAAAA;IACnD,CAAA;EACF,CAAA;AAEA,QAAM5B,QAAQ+B,WAAU;AACxB,QAAM/B,QAAQS,MAAMuB,OAAOhC,QAAQS,MAAMwB,IAAI;AAE7CC,gBAAclC,QAAQS,KAAK;AAE3B,SAAO0B,YACLlB,aAAamB,UACb;IAAE3B,OAAOT,QAAQS;IAAO4B,SAAS,CAACC,YAAYtC,QAAQqC,QAAQC,OAAAA;EAAS,GACvE,MAAA;AACEC,kBAAcjC,QAAAA;AACdK,gBAAAA;EACF,CAAA;AAEJ;AAGA,IAAMuB,gBAAgB,CAACzB,UAAAA;AACpB+B,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAShC,QAAQA;AACvC;",
|
|
6
|
+
"names": ["batch", "effect", "untracked", "Capabilities", "contributes", "flattenExtensions", "GraphBuilder", "KEY", "GRAPH_PLUGIN", "context", "builder", "GraphBuilder", "from", "localStorage", "getItem", "undefined", "interval", "setInterval", "setItem", "graph", "pickle", "unsubscribe", "effect", "batch", "next", "flattenExtensions", "requestCapabilities", "Capabilities", "AppGraphBuilder", "current", "untracked", "extensions", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "initialize", "expand", "root", "setupDevtools", "contributes", "AppGraph", "explore", "options", "clearInterval", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
useGraph
|
|
4
|
-
} from "./chunk-XY43PHPY.mjs";
|
|
5
2
|
import {
|
|
6
3
|
GRAPH_PLUGIN,
|
|
7
4
|
meta
|
|
@@ -13,27 +10,22 @@ export * from "@dxos/app-graph";
|
|
|
13
10
|
// packages/plugins/plugin-graph/src/GraphPlugin.ts
|
|
14
11
|
import { defineModule, lazy, Events, definePlugin } from "@dxos/app-framework";
|
|
15
12
|
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
13
|
defineModule({
|
|
22
14
|
id: `${meta.id}/module/graph`,
|
|
23
15
|
activatesOn: Events.Startup,
|
|
24
16
|
activatesBefore: [
|
|
25
|
-
Events.SetupAppGraph
|
|
17
|
+
Events.SetupAppGraph,
|
|
18
|
+
Events.SetupMetadata
|
|
26
19
|
],
|
|
27
20
|
activatesAfter: [
|
|
28
21
|
Events.AppGraphReady
|
|
29
22
|
],
|
|
30
|
-
activate: lazy(() => import("./graph-
|
|
23
|
+
activate: lazy(() => import("./graph-VC422POI.mjs"))
|
|
31
24
|
})
|
|
32
25
|
]);
|
|
33
26
|
export {
|
|
34
27
|
GRAPH_PLUGIN,
|
|
35
28
|
GraphPlugin,
|
|
36
|
-
meta
|
|
37
|
-
useGraph
|
|
29
|
+
meta
|
|
38
30
|
};
|
|
39
31
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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 './
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["defineModule", "lazy", "Events", "definePlugin", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\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/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\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,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;",
|
|
6
|
+
"names": ["defineModule", "lazy", "Events", "definePlugin", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-graph/src/meta.ts":{"bytes":891,"imports":[],"format":"esm"},"packages/plugins/plugin-graph/src/graph.ts":{"bytes":6242,"imports":[{"path":"@preact/signals-core","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/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-graph/src/GraphPlugin.ts":{"bytes":2810,"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/index.ts":{"bytes":697,"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/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":1500},"packages/plugins/plugin-graph/dist/lib/node-esm/index.mjs":{"imports":[{"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/graph-VC422POI.mjs","kind":"dynamic-import"}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta"],"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}},"bytes":790},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-VC422POI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3430},"packages/plugins/plugin-graph/dist/lib/node-esm/graph-VC422POI.mjs":{"imports":[{"path":"packages/plugins/plugin-graph/dist/lib/node-esm/chunk-IHM26RSC.mjs","kind":"import-statement"},{"path":"@preact/signals-core","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":1331}},"bytes":1608},"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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,4CASpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAqB,KAAK,KAAK,EAAgB,MAAM,iBAAiB,CAAC;kCAM/C,cAAc;;;;AAA7C,wBA6BE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAEhC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAEhC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-graph",
|
|
3
|
-
"version": "0.7.5-main.
|
|
3
|
+
"version": "0.7.5-main.b19bfc8",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"sideEffects": true,
|
|
10
|
+
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -24,10 +25,10 @@
|
|
|
24
25
|
],
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@preact/signals-core": "^1.6.0",
|
|
27
|
-
"@dxos/app-graph": "0.7.5-main.
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/debug": "0.7.5-main.
|
|
28
|
+
"@dxos/app-graph": "0.7.5-main.b19bfc8",
|
|
29
|
+
"@dxos/app-framework": "0.7.5-main.b19bfc8",
|
|
30
|
+
"@dxos/async": "0.7.5-main.b19bfc8",
|
|
31
|
+
"@dxos/debug": "0.7.5-main.b19bfc8"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/react": "~18.2.0",
|
|
@@ -35,8 +36,8 @@
|
|
|
35
36
|
"react": "~18.2.0",
|
|
36
37
|
"react-dom": "~18.2.0",
|
|
37
38
|
"vite": "5.4.7",
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
39
|
+
"@dxos/react-client": "0.7.5-main.b19bfc8",
|
|
40
|
+
"@dxos/storybook-utils": "0.7.5-main.b19bfc8"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"react": "~18.2.0",
|
package/src/GraphPlugin.ts
CHANGED
|
@@ -13,15 +13,10 @@ import { meta } from './meta';
|
|
|
13
13
|
*/
|
|
14
14
|
export const GraphPlugin = () =>
|
|
15
15
|
definePlugin(meta, [
|
|
16
|
-
defineModule({
|
|
17
|
-
id: `${meta.id}/module/react-context`,
|
|
18
|
-
activatesOn: Events.Startup,
|
|
19
|
-
activate: lazy(() => import('./GraphContext')),
|
|
20
|
-
}),
|
|
21
16
|
defineModule({
|
|
22
17
|
id: `${meta.id}/module/graph`,
|
|
23
18
|
activatesOn: Events.Startup,
|
|
24
|
-
activatesBefore: [Events.SetupAppGraph],
|
|
19
|
+
activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],
|
|
25
20
|
activatesAfter: [Events.AppGraphReady],
|
|
26
21
|
activate: lazy(() => import('./graph')),
|
|
27
22
|
}),
|
package/src/graph.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { batch, effect, untracked } from '@preact/signals-core';
|
|
6
|
+
|
|
5
7
|
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
-
import { type Graph, GraphBuilder } from '@dxos/app-graph';
|
|
8
|
+
import { flattenExtensions, type Graph, GraphBuilder } from '@dxos/app-graph';
|
|
7
9
|
|
|
8
10
|
import { GRAPH_PLUGIN } from './meta';
|
|
9
11
|
|
|
@@ -15,7 +17,15 @@ export default async (context: PluginsContext) => {
|
|
|
15
17
|
localStorage.setItem(KEY, builder.graph.pickle());
|
|
16
18
|
}, 5_000);
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
const unsubscribe = effect(() => {
|
|
21
|
+
batch(() => {
|
|
22
|
+
const next = flattenExtensions(context.requestCapabilities(Capabilities.AppGraphBuilder));
|
|
23
|
+
const current = untracked(() => builder.extensions);
|
|
24
|
+
const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
|
|
25
|
+
removed.forEach((extension) => builder.removeExtension(extension.id));
|
|
26
|
+
next.forEach((extension) => builder.addExtension(extension));
|
|
27
|
+
});
|
|
28
|
+
});
|
|
19
29
|
|
|
20
30
|
await builder.initialize();
|
|
21
31
|
await builder.graph.expand(builder.graph.root);
|
|
@@ -25,7 +35,10 @@ export default async (context: PluginsContext) => {
|
|
|
25
35
|
return contributes(
|
|
26
36
|
Capabilities.AppGraph,
|
|
27
37
|
{ graph: builder.graph, explore: (options) => builder.explore(options) },
|
|
28
|
-
() =>
|
|
38
|
+
() => {
|
|
39
|
+
clearInterval(interval);
|
|
40
|
+
unsubscribe();
|
|
41
|
+
},
|
|
29
42
|
);
|
|
30
43
|
};
|
|
31
44
|
|
package/src/index.ts
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GRAPH_PLUGIN
|
|
3
|
-
} from "./chunk-7LNMG3EB.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/plugin-graph/src/GraphContext.tsx
|
|
6
|
-
import React, { createContext, useContext } from "react";
|
|
7
|
-
import { Capabilities, contributes, useCapability } from "@dxos/app-framework";
|
|
8
|
-
import { raise } from "@dxos/debug";
|
|
9
|
-
var GraphContext = /* @__PURE__ */ createContext(null);
|
|
10
|
-
var useGraph = () => useContext(GraphContext) ?? raise(new Error("Missing GraphContext"));
|
|
11
|
-
var GraphContext_default = () => contributes(Capabilities.ReactContext, {
|
|
12
|
-
id: GRAPH_PLUGIN,
|
|
13
|
-
context: (props) => {
|
|
14
|
-
const value = useCapability(Capabilities.AppGraph);
|
|
15
|
-
return /* @__PURE__ */ React.createElement(GraphContext.Provider, {
|
|
16
|
-
value
|
|
17
|
-
}, props.children);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
useGraph,
|
|
23
|
-
GraphContext_default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-L7JM5AMI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var GraphContext_MUIA2AJE_exports = {};
|
|
20
|
-
__export(GraphContext_MUIA2AJE_exports, {
|
|
21
|
-
default: () => import_chunk_3QIHDIIS.GraphContext_default,
|
|
22
|
-
useGraph: () => import_chunk_3QIHDIIS.useGraph
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(GraphContext_MUIA2AJE_exports);
|
|
25
|
-
var import_chunk_3QIHDIIS = require("./chunk-3QIHDIIS.cjs");
|
|
26
|
-
var import_chunk_KHIPMH35 = require("./chunk-KHIPMH35.cjs");
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
useGraph
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=GraphContext-MUIA2AJE.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["GraphContext-MUIA2AJE.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n GraphContext_default,\n useGraph\n} from \"./chunk-3QIHDIIS.cjs\";\nimport \"./chunk-KHIPMH35.cjs\";\nexport {\n GraphContext_default as default,\n useGraph\n};\n//# sourceMappingURL=GraphContext-MUIA2AJE.cjs.map\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;AACP,4BAAO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var chunk_3QIHDIIS_exports = {};
|
|
30
|
-
__export(chunk_3QIHDIIS_exports, {
|
|
31
|
-
GraphContext_default: () => GraphContext_default,
|
|
32
|
-
useGraph: () => useGraph
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(chunk_3QIHDIIS_exports);
|
|
35
|
-
var import_chunk_KHIPMH35 = require("./chunk-KHIPMH35.cjs");
|
|
36
|
-
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
38
|
-
var import_debug = require("@dxos/debug");
|
|
39
|
-
var GraphContext = /* @__PURE__ */ (0, import_react.createContext)(null);
|
|
40
|
-
var useGraph = () => (0, import_react.useContext)(GraphContext) ?? (0, import_debug.raise)(new Error("Missing GraphContext"));
|
|
41
|
-
var GraphContext_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.ReactContext, {
|
|
42
|
-
id: import_chunk_KHIPMH35.GRAPH_PLUGIN,
|
|
43
|
-
context: (props) => {
|
|
44
|
-
const value = (0, import_app_framework.useCapability)(import_app_framework.Capabilities.AppGraph);
|
|
45
|
-
return /* @__PURE__ */ import_react.default.createElement(GraphContext.Provider, {
|
|
46
|
-
value
|
|
47
|
-
}, props.children);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
GraphContext_default,
|
|
53
|
-
useGraph
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=chunk-3QIHDIIS.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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,mBAAuF;AAEvF,2BAAyD;AAEzD,mBAAsB;AAKtB,IAAMA,eAAiDC,gDAAuC,IAAA;AAEvF,IAAMC,WAAW,UAAwBC,yBAAWH,YAAAA,SAAiBI,oBAAM,IAAIC,MAAM,sBAAA,CAAA;AAE5F,IAAA,uBAAe,UACbC,kCAAYC,kCAAaC,cAAc;EACrCC,IAAIC;EACJC,SAAS,CAACC,UAAAA;AACR,UAAMC,YAAQC,oCAAcP,kCAAaQ,QAAQ;AACjD,WAAO,6BAAAC,QAAA,cAAChB,aAAaiB,UAAQ;MAACJ;OAAeD,MAAMM,QAAQ;EAC7D;AACF,CAAA;",
|
|
6
|
-
"names": ["GraphContext", "createContext", "useGraph", "useContext", "raise", "Error", "contributes", "Capabilities", "ReactContext", "id", "GRAPH_PLUGIN", "context", "props", "value", "useCapability", "AppGraph", "React", "Provider", "children"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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,2BAA+D;AAC/D,uBAAyC;AAIzC,IAAMA,MAAM,GAAGC,kCAAAA;AAEf,IAAA,gBAAe,OAAOC,YAAAA;AACpB,QAAMC,UAAUC,8BAAaC,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,kCAAaC,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,aAAOY,kCACLT,kCAAaU,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": ["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,11 +0,0 @@
|
|
|
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
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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;
|
|
11
|
-
//# sourceMappingURL=GraphContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/src/GraphContext.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
});
|