@dxos/app-graph 0.3.3-main.052ad73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +13 -0
- package/dist/lib/browser/index.mjs +252 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/testing.mjs +98 -0
- package/dist/lib/browser/testing.mjs.map +7 -0
- package/dist/lib/node/index.cjs +290 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/testing.cjs +124 -0
- package/dist/lib/node/testing.cjs.map +7 -0
- package/dist/types/src/action.d.ts +53 -0
- package/dist/types/src/action.d.ts.map +1 -0
- package/dist/types/src/graph-builder.d.ts +31 -0
- package/dist/types/src/graph-builder.d.ts.map +1 -0
- package/dist/types/src/graph.d.ts +45 -0
- package/dist/types/src/graph.d.ts.map +1 -0
- package/dist/types/src/graph.test.d.ts +2 -0
- package/dist/types/src/graph.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/node.d.ts +71 -0
- package/dist/types/src/node.d.ts.map +1 -0
- package/dist/types/src/stories/EchoGraph.stories.d.ts +10 -0
- package/dist/types/src/stories/EchoGraph.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Tree.d.ts +14 -0
- package/dist/types/src/stories/Tree.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +52 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/package.json +74 -0
- package/src/action.ts +69 -0
- package/src/graph-builder.ts +200 -0
- package/src/graph.test.ts +220 -0
- package/src/graph.ts +110 -0
- package/src/index.ts +8 -0
- package/src/node.ts +101 -0
- package/src/stories/EchoGraph.stories.tsx +233 -0
- package/src/stories/Tree.tsx +79 -0
- package/src/testing.ts +152 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @dxos/app-graph
|
|
2
|
+
|
|
3
|
+
## DXOS Resources
|
|
4
|
+
|
|
5
|
+
- [Website](https://dxos.org)
|
|
6
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
7
|
+
- Talk to us on [Discord](https://discord.gg/eXVfryv3sW)
|
|
8
|
+
|
|
9
|
+
## Contributions
|
|
10
|
+
|
|
11
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
12
|
+
|
|
13
|
+
License: [MIT](./LICENSE) Copyright 2023 © DXOS
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// packages/sdk/app-graph/src/graph.ts
|
|
2
|
+
import { deepSignal } from "deepsignal/react";
|
|
3
|
+
import get from "lodash.get";
|
|
4
|
+
var Graph = class {
|
|
5
|
+
constructor(_root) {
|
|
6
|
+
this._root = _root;
|
|
7
|
+
this._index = deepSignal({});
|
|
8
|
+
}
|
|
9
|
+
toJSON() {
|
|
10
|
+
const toLabel = (label) => Array.isArray(label) ? `${label[1].ns}[${label[0]}]` : label;
|
|
11
|
+
const toJSON = (node) => {
|
|
12
|
+
return {
|
|
13
|
+
id: node.id.slice(0, 16),
|
|
14
|
+
label: toLabel(node.label),
|
|
15
|
+
children: node.children.length ? node.children.map((node2) => toJSON(node2)) : void 0,
|
|
16
|
+
actions: node.actions.length ? node.actions.map(({ id, label }) => ({
|
|
17
|
+
id,
|
|
18
|
+
label: toLabel(label)
|
|
19
|
+
})) : void 0
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
return toJSON(this._root);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The root node of the graph which is the entry point for all knowledge.
|
|
26
|
+
*/
|
|
27
|
+
get root() {
|
|
28
|
+
return this._root;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the path through the graph from the root to the node with the given id.
|
|
32
|
+
*/
|
|
33
|
+
getPath(id) {
|
|
34
|
+
return this._index[id];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
_setPath(id, path) {
|
|
40
|
+
this._index[id] = path;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Find the node with the given id in the graph.
|
|
44
|
+
*/
|
|
45
|
+
findNode(id) {
|
|
46
|
+
const path = this.getPath(id);
|
|
47
|
+
if (!path) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
return path.length > 0 ? get(this._root, path) : this._root;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Recursive breadth-first traversal.
|
|
54
|
+
*/
|
|
55
|
+
traverse({ node = this._root, direction = "down", filter, visitor }, depth = 0) {
|
|
56
|
+
if (!filter || filter(node)) {
|
|
57
|
+
visitor?.(node);
|
|
58
|
+
}
|
|
59
|
+
if (direction === "down") {
|
|
60
|
+
Object.values(node.children).forEach((child) => this.traverse({
|
|
61
|
+
node: child,
|
|
62
|
+
filter,
|
|
63
|
+
visitor
|
|
64
|
+
}));
|
|
65
|
+
} else if (direction === "up" && node.parent) {
|
|
66
|
+
this.traverse({
|
|
67
|
+
node: node.parent,
|
|
68
|
+
direction,
|
|
69
|
+
filter,
|
|
70
|
+
visitor
|
|
71
|
+
}, depth + 1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// packages/sdk/app-graph/src/graph-builder.ts
|
|
77
|
+
import { untracked } from "@preact/signals-react";
|
|
78
|
+
import { deepSignal as deepSignal2 } from "deepsignal/react";
|
|
79
|
+
import Mousetrap from "mousetrap";
|
|
80
|
+
import { EventSubscriptions } from "@dxos/async";
|
|
81
|
+
var GraphBuilder = class {
|
|
82
|
+
constructor() {
|
|
83
|
+
this._nodeBuilders = /* @__PURE__ */ new Map();
|
|
84
|
+
this._unsubscribe = /* @__PURE__ */ new Map();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Register a node builder which will be called in order to construct the graph.
|
|
88
|
+
*/
|
|
89
|
+
addNodeBuilder(id, builder) {
|
|
90
|
+
this._nodeBuilders.set(id, builder);
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Remove a node builder from the graph builder.
|
|
95
|
+
*/
|
|
96
|
+
removeNodeBuilder(id) {
|
|
97
|
+
this._nodeBuilders.delete(id);
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Construct the graph, starting by calling all registered node builders on the root node.
|
|
102
|
+
* Node builders will be filtered out as they are used such that they are only used once on any given path.
|
|
103
|
+
* @param root
|
|
104
|
+
* @param path
|
|
105
|
+
*/
|
|
106
|
+
build(root, path = []) {
|
|
107
|
+
const graph = new Graph(root ?? this._createNode(() => graph, {
|
|
108
|
+
id: "root",
|
|
109
|
+
label: "Root"
|
|
110
|
+
}));
|
|
111
|
+
return this._build(graph, graph.root, path);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Called recursively.
|
|
115
|
+
*/
|
|
116
|
+
_build(graph, node, path = [], ignoreBuilders = []) {
|
|
117
|
+
graph._setPath(node.id, path);
|
|
118
|
+
const subscriptions = this._unsubscribe.get(node.id) ?? new EventSubscriptions();
|
|
119
|
+
subscriptions.clear();
|
|
120
|
+
Array.from(this._nodeBuilders.entries()).filter(([id]) => ignoreBuilders.findIndex((ignore) => ignore === id) === -1).forEach(([_, builder]) => {
|
|
121
|
+
const unsubscribe = builder(node);
|
|
122
|
+
unsubscribe && subscriptions.add(unsubscribe);
|
|
123
|
+
});
|
|
124
|
+
this._unsubscribe.set(node.id, subscriptions);
|
|
125
|
+
return graph;
|
|
126
|
+
}
|
|
127
|
+
_createNode(getGraph, partial, path = [], ignoreBuilders = []) {
|
|
128
|
+
const node = deepSignal2({
|
|
129
|
+
parent: null,
|
|
130
|
+
data: null,
|
|
131
|
+
properties: {},
|
|
132
|
+
childrenMap: {},
|
|
133
|
+
actionsMap: {},
|
|
134
|
+
// TODO(burdon): Document.
|
|
135
|
+
...partial,
|
|
136
|
+
// TODO(wittjosiah): Default sort.
|
|
137
|
+
get children() {
|
|
138
|
+
return Object.values(node.childrenMap);
|
|
139
|
+
},
|
|
140
|
+
get actions() {
|
|
141
|
+
return Object.values(node.actionsMap);
|
|
142
|
+
},
|
|
143
|
+
addProperty: (key, value) => {
|
|
144
|
+
untracked(() => {
|
|
145
|
+
node.properties[key] = value;
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
removeProperty: (key) => {
|
|
149
|
+
untracked(() => {
|
|
150
|
+
delete node.properties[key];
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
addNode: (builder, ...partials) => {
|
|
154
|
+
return untracked(() => {
|
|
155
|
+
return partials.map((partial2) => {
|
|
156
|
+
const builders = [
|
|
157
|
+
...ignoreBuilders,
|
|
158
|
+
builder
|
|
159
|
+
];
|
|
160
|
+
const childPath = [
|
|
161
|
+
...path,
|
|
162
|
+
"childrenMap",
|
|
163
|
+
partial2.id
|
|
164
|
+
];
|
|
165
|
+
const child = this._createNode(getGraph, {
|
|
166
|
+
...partial2,
|
|
167
|
+
parent: node
|
|
168
|
+
}, childPath, builders);
|
|
169
|
+
node.childrenMap[child.id] = child;
|
|
170
|
+
this._build(getGraph(), child, childPath, builders);
|
|
171
|
+
return child;
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
removeNode: (id) => {
|
|
176
|
+
return untracked(() => {
|
|
177
|
+
const child = node.childrenMap[id];
|
|
178
|
+
delete node.childrenMap[id];
|
|
179
|
+
return child;
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
addAction: (...partials) => {
|
|
183
|
+
return untracked(() => {
|
|
184
|
+
return partials.map((partial2) => {
|
|
185
|
+
const action = this._createAction(partial2);
|
|
186
|
+
if (action.keyBinding) {
|
|
187
|
+
Mousetrap.bind(action.keyBinding, () => {
|
|
188
|
+
action.invoke();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
node.actionsMap[action.id] = action;
|
|
192
|
+
return action;
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
removeAction: (id) => {
|
|
197
|
+
return untracked(() => {
|
|
198
|
+
const action = node.actionsMap[id];
|
|
199
|
+
if (action.keyBinding) {
|
|
200
|
+
Mousetrap.unbind(action.keyBinding);
|
|
201
|
+
}
|
|
202
|
+
delete node.actionsMap[id];
|
|
203
|
+
return action;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return node;
|
|
208
|
+
}
|
|
209
|
+
_createAction(partial) {
|
|
210
|
+
const action = deepSignal2({
|
|
211
|
+
properties: {},
|
|
212
|
+
actionsMap: {},
|
|
213
|
+
...partial,
|
|
214
|
+
// TODO(wittjosiah): Default sort.
|
|
215
|
+
get actions() {
|
|
216
|
+
return Object.values(action.actionsMap);
|
|
217
|
+
},
|
|
218
|
+
addAction: (...partials) => {
|
|
219
|
+
return untracked(() => {
|
|
220
|
+
return partials.map((partial2) => {
|
|
221
|
+
const subAction = this._createAction(partial2);
|
|
222
|
+
action.actionsMap[subAction.id] = subAction;
|
|
223
|
+
return subAction;
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
removeAction: (id) => {
|
|
228
|
+
return untracked(() => {
|
|
229
|
+
const subAction = action.actionsMap[id];
|
|
230
|
+
delete action.actionsMap[id];
|
|
231
|
+
return subAction;
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
addProperty: (key, value) => {
|
|
235
|
+
return untracked(() => {
|
|
236
|
+
action.properties[key] = value;
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
removeProperty: (key) => {
|
|
240
|
+
return untracked(() => {
|
|
241
|
+
delete action.properties[key];
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return action;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
export {
|
|
249
|
+
Graph,
|
|
250
|
+
GraphBuilder
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/graph.ts", "../../../src/graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { deepSignal } from 'deepsignal/react';\n// TODO(wittjosiah): Remove lodash dependency.\nimport get from 'lodash.get';\n\nimport { type Label } from './action';\nimport { type Node } from './node';\n\nexport type TraversalOptions = {\n /**\n * The node to start traversing from. Defaults to the root node.\n */\n node?: Node;\n\n /**\n * The direction to traverse the graph. Defaults to 'down'.\n */\n direction?: 'up' | 'down';\n\n /**\n * A predicate to filter nodes which are passed to the `visitor` callback.\n */\n filter?: (node: Node) => boolean;\n\n /**\n * A callback which is called for each node visited during traversal.\n */\n visitor?: (node: Node) => void;\n};\n\n/**\n * The Graph represents...\n */\nexport class Graph {\n // TODO(burdon): Document.\n // TODO(wittjosiah): Should this support multiple paths to the same node?\n private readonly _index = deepSignal<{ [key: string]: string[] }>({});\n\n constructor(private readonly _root: Node) {}\n\n toJSON() {\n const toLabel = (label: Label) => (Array.isArray(label) ? `${label[1].ns}[${label[0]}]` : label);\n const toJSON = (node: Node): any => {\n return {\n id: node.id.slice(0, 16),\n label: toLabel(node.label),\n children: node.children.length ? node.children.map((node) => toJSON(node)) : undefined,\n actions: node.actions.length\n ? node.actions.map(({ id, label }) => ({\n id,\n label: toLabel(label),\n }))\n : undefined,\n };\n };\n\n return toJSON(this._root);\n }\n\n /**\n * The root node of the graph which is the entry point for all knowledge.\n */\n get root(): Node {\n return this._root;\n }\n\n /**\n * Get the path through the graph from the root to the node with the given id.\n */\n getPath(id: string): string[] | undefined {\n return this._index[id];\n }\n\n /**\n * @internal\n */\n _setPath(id: string, path: string[]) {\n this._index[id] = path;\n }\n\n /**\n * Find the node with the given id in the graph.\n */\n findNode(id: string): Node | undefined {\n const path = this.getPath(id);\n if (!path) {\n return undefined;\n }\n\n return path.length > 0 ? get(this._root, path) : this._root;\n }\n\n /**\n * Recursive breadth-first traversal.\n */\n traverse({ node = this._root, direction = 'down', filter, visitor }: TraversalOptions, depth = 0): void {\n if (!filter || filter(node)) {\n visitor?.(node);\n }\n\n if (direction === 'down') {\n Object.values(node.children).forEach((child) => this.traverse({ node: child, filter, visitor }));\n } else if (direction === 'up' && node.parent) {\n this.traverse({ node: node.parent, direction, filter, visitor }, depth + 1);\n }\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-react';\nimport { type RevertDeepSignal, deepSignal } from 'deepsignal/react';\nimport Mousetrap from 'mousetrap';\n\nimport { EventSubscriptions } from '@dxos/async';\n\nimport { type Action } from './action';\nimport { Graph } from './graph';\nimport { type Node, type NodeBuilder } from './node';\n\n/**\n * The builder...\n */\nexport class GraphBuilder {\n private readonly _nodeBuilders = new Map<string, NodeBuilder>();\n private readonly _unsubscribe = new Map<string, EventSubscriptions>();\n\n /**\n * Register a node builder which will be called in order to construct the graph.\n */\n addNodeBuilder(id: string, builder: NodeBuilder): GraphBuilder {\n this._nodeBuilders.set(id, builder);\n return this;\n }\n\n /**\n * Remove a node builder from the graph builder.\n */\n removeNodeBuilder(id: string): GraphBuilder {\n this._nodeBuilders.delete(id);\n return this;\n }\n\n /**\n * Construct the graph, starting by calling all registered node builders on the root node.\n * Node builders will be filtered out as they are used such that they are only used once on any given path.\n * @param root\n * @param path\n */\n build(root?: Node, path: string[] = []): Graph {\n const graph: Graph = new Graph(root ?? this._createNode(() => graph, { id: 'root', label: 'Root' }));\n return this._build(graph, graph.root, path);\n }\n\n /**\n * Called recursively.\n */\n private _build(graph: Graph, node: Node, path: string[] = [], ignoreBuilders: string[] = []): Graph {\n // TODO(wittjosiah): Should this support multiple paths to the same node?\n graph._setPath(node.id, path);\n\n // TODO(burdon): Document.\n const subscriptions = this._unsubscribe.get(node.id) ?? new EventSubscriptions();\n subscriptions.clear();\n\n Array.from(this._nodeBuilders.entries())\n .filter(([id]) => ignoreBuilders.findIndex((ignore) => ignore === id) === -1)\n .forEach(([_, builder]) => {\n const unsubscribe = builder(node);\n unsubscribe && subscriptions.add(unsubscribe);\n });\n\n this._unsubscribe.set(node.id, subscriptions);\n\n return graph;\n }\n\n private _createNode<TData = null, TProperties extends Record<string, any> = Record<string, any>>(\n getGraph: () => Graph,\n partial: Pick<Node, 'id' | 'label'> & Partial<Node<TData, TProperties>>,\n path: string[] = [],\n ignoreBuilders: string[] = [],\n ): Node<TData, TProperties> {\n // TODO(burdon): Document implications and rationale of deepSignal.\n const node: Node<TData, TProperties> = deepSignal({\n parent: null,\n data: null as TData, // TODO(burdon): Allow null property?\n properties: {} as TProperties,\n childrenMap: {},\n actionsMap: {},\n // TODO(burdon): Document.\n ...partial,\n\n // TODO(wittjosiah): Default sort.\n get children() {\n return Object.values(node.childrenMap);\n },\n get actions() {\n return Object.values(node.actionsMap);\n },\n\n addProperty: (key, value) => {\n untracked(() => {\n (node.properties as Record<string, any>)[key] = value;\n });\n },\n removeProperty: (key) => {\n untracked(() => {\n delete (node.properties as Record<string, any>)[key];\n });\n },\n\n addNode: (builder, ...partials) => {\n return untracked(() => {\n return partials.map((partial) => {\n const builders = [...ignoreBuilders, builder];\n const childPath = [...path, 'childrenMap', partial.id];\n const child = this._createNode(getGraph, { ...partial, parent: node }, childPath, builders);\n node.childrenMap[child.id] = child;\n // TOOD(burdon): Defer triggering recursive updates until task has completed.\n this._build(getGraph(), child, childPath, builders);\n return child;\n });\n });\n },\n removeNode: (id) => {\n return untracked(() => {\n const child = node.childrenMap[id];\n delete node.childrenMap[id];\n return child;\n });\n },\n\n addAction: (...partials) => {\n return untracked(() => {\n return partials.map((partial) => {\n const action = this._createAction(partial);\n if (action.keyBinding) {\n Mousetrap.bind(action.keyBinding, () => {\n action.invoke();\n });\n }\n\n node.actionsMap[action.id] = action;\n return action;\n });\n });\n },\n removeAction: (id) => {\n return untracked(() => {\n const action = node.actionsMap[id];\n if (action.keyBinding) {\n Mousetrap.unbind(action.keyBinding);\n }\n\n delete node.actionsMap[id];\n return action;\n });\n },\n }) as RevertDeepSignal<Node<TData, TProperties>>;\n\n return node;\n }\n\n private _createAction<TProperties extends Record<string, any> = Record<string, any>>(\n partial: Pick<Action, 'id' | 'label' | 'invoke'> & Partial<Action<TProperties>>,\n ): Action<TProperties> {\n const action: Action<TProperties> = deepSignal({\n properties: {} as TProperties,\n actionsMap: {},\n ...partial,\n // TODO(wittjosiah): Default sort.\n get actions() {\n return Object.values(action.actionsMap);\n },\n addAction: (...partials) => {\n return untracked(() => {\n return partials.map((partial) => {\n const subAction = this._createAction(partial);\n action.actionsMap[subAction.id] = subAction;\n return subAction;\n });\n });\n },\n removeAction: (id) => {\n return untracked(() => {\n const subAction = action.actionsMap[id];\n delete action.actionsMap[id];\n return subAction;\n });\n },\n addProperty: (key, value) => {\n return untracked(() => {\n (action.properties as Record<string, any>)[key] = value;\n });\n },\n removeProperty: (key) => {\n return untracked(() => {\n delete (action.properties as Record<string, any>)[key];\n });\n },\n }) as RevertDeepSignal<Action<TProperties>>;\n\n return action;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,kBAAkB;AAE3B,OAAOC,SAAS;AA8BT,IAAMC,QAAN,MAAMA;EAKXC,YAA6BC,OAAa;iBAAbA;SAFZC,SAASC,WAAwC,CAAC,CAAA;EAExB;EAE3CC,SAAS;AACP,UAAMC,UAAU,CAACC,UAAkBC,MAAMC,QAAQF,KAAAA,IAAS,GAAGA,MAAM,CAAA,EAAGG,EAAE,IAAIH,MAAM,CAAA,CAAE,MAAMA;AAC1F,UAAMF,SAAS,CAACM,SAAAA;AACd,aAAO;QACLC,IAAID,KAAKC,GAAGC,MAAM,GAAG,EAAA;QACrBN,OAAOD,QAAQK,KAAKJ,KAAK;QACzBO,UAAUH,KAAKG,SAASC,SAASJ,KAAKG,SAASE,IAAI,CAACL,UAASN,OAAOM,KAAAA,CAAAA,IAASM;QAC7EC,SAASP,KAAKO,QAAQH,SAClBJ,KAAKO,QAAQF,IAAI,CAAC,EAAEJ,IAAIL,MAAK,OAAQ;UACnCK;UACAL,OAAOD,QAAQC,KAAAA;QACjB,EAAA,IACAU;MACN;IACF;AAEA,WAAOZ,OAAO,KAAKH,KAAK;EAC1B;;;;EAKA,IAAIiB,OAAa;AACf,WAAO,KAAKjB;EACd;;;;EAKAkB,QAAQR,IAAkC;AACxC,WAAO,KAAKT,OAAOS,EAAAA;EACrB;;;;EAK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zB,SACqB;AACrB,UAAMwB,SAA8BvB,YAAW;MAC7CG,YAAY,CAAC;MACbE,YAAY,CAAC;MACb,GAAGN;;MAEH,IAAIU,UAAU;AACZ,eAAOF,OAAOC,OAAOe,OAAOlB,UAAU;MACxC;MACAiB,WAAW,IAAIN,aAAAA;AACb,eAAOH,UAAU,MAAA;AACf,iBAAOG,SAASC,IAAI,CAAClB,aAAAA;AACnB,kBAAMgC,YAAY,KAAKP,cAAczB,QAAAA;AACrCwB,mBAAOlB,WAAW0B,UAAU/D,EAAE,IAAI+D;AAClC,mBAAOA;UACT,CAAA;QACF,CAAA;MACF;MACAF,cAAc,CAAC7D,OAAAA;AACb,eAAO6C,UAAU,MAAA;AACf,gBAAMkB,YAAYR,OAAOlB,WAAWrC,EAAAA;AACpC,iBAAOuD,OAAOlB,WAAWrC,EAAAA;AACzB,iBAAO+D;QACT,CAAA;MACF;MACArB,aAAa,CAACC,KAAKC,UAAAA;AACjB,eAAOC,UAAU,MAAA;AACdU,iBAAOpB,WAAmCQ,GAAAA,IAAOC;QACpD,CAAA;MACF;MACAE,gBAAgB,CAACH,QAAAA;AACf,eAAOE,UAAU,MAAA;AACf,iBAAQU,OAAOpB,WAAmCQ,GAAAA;QACpD,CAAA;MACF;IACF,CAAA;AAEA,WAAOY;EACT;AACF;",
|
|
6
|
+
"names": ["deepSignal", "get", "Graph", "constructor", "_root", "_index", "deepSignal", "toJSON", "toLabel", "label", "Array", "isArray", "ns", "node", "id", "slice", "children", "length", "map", "undefined", "actions", "root", "getPath", "_setPath", "path", "findNode", "get", "traverse", "direction", "filter", "visitor", "depth", "Object", "values", "forEach", "child", "parent", "untracked", "deepSignal", "Mousetrap", "EventSubscriptions", "GraphBuilder", "_nodeBuilders", "Map", "_unsubscribe", "addNodeBuilder", "id", "builder", "set", "removeNodeBuilder", "delete", "build", "root", "path", "graph", "Graph", "_createNode", "label", "_build", "node", "ignoreBuilders", "_setPath", "subscriptions", "get", "EventSubscriptions", "clear", "Array", "from", "entries", "filter", "findIndex", "ignore", "forEach", "_", "unsubscribe", "add", "getGraph", "partial", "deepSignal", "parent", "data", "properties", "childrenMap", "actionsMap", "children", "Object", "values", "actions", "addProperty", "key", "value", "untracked", "removeProperty", "addNode", "partials", "map", "builders", "childPath", "child", "removeNode", "addAction", "action", "_createAction", "keyBinding", "Mousetrap", "bind", "invoke", "removeAction", "unbind", "subAction"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/sdk/app-graph/src/action.ts":{"bytes":2779,"imports":[],"format":"esm"},"packages/sdk/app-graph/src/graph.ts":{"bytes":9066,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-graph/src/graph-builder.ts":{"bytes":21055,"imports":[{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"mousetrap","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"packages/sdk/app-graph/src/graph.ts","kind":"import-statement","original":"./graph"}],"format":"esm"},"packages/sdk/app-graph/src/node.ts":{"bytes":4185,"imports":[],"format":"esm"},"packages/sdk/app-graph/src/index.ts":{"bytes":722,"imports":[{"path":"packages/sdk/app-graph/src/action.ts","kind":"import-statement","original":"./action"},{"path":"packages/sdk/app-graph/src/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-graph/src/graph-builder.ts","kind":"import-statement","original":"./graph-builder"},{"path":"packages/sdk/app-graph/src/node.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/sdk/app-graph/src/testing.ts":{"bytes":11884,"imports":[],"format":"esm"}},"outputs":{"packages/sdk/app-graph/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15267},"packages/sdk/app-graph/dist/lib/browser/index.mjs":{"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"mousetrap","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true}],"exports":["Graph","GraphBuilder"],"entryPoint":"packages/sdk/app-graph/src/index.ts","inputs":{"packages/sdk/app-graph/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-graph/src/graph.ts":{"bytesInOutput":1818},"packages/sdk/app-graph/src/graph-builder.ts":{"bytesInOutput":5033}},"bytes":7009},"packages/sdk/app-graph/dist/lib/browser/testing.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6167},"packages/sdk/app-graph/dist/lib/browser/testing.mjs":{"imports":[],"exports":["buildGraph","createTestNodeBuilder"],"entryPoint":"packages/sdk/app-graph/src/testing.ts","inputs":{"packages/sdk/app-graph/src/testing.ts":{"bytesInOutput":2180}},"bytes":2308}}}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// packages/sdk/app-graph/src/testing.ts
|
|
2
|
+
var createTestNodeBuilder = (id, depth = 1) => {
|
|
3
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
4
|
+
const nodeBuilder = (parent) => {
|
|
5
|
+
if (checkDepth(parent) >= depth) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const [child] = parent.addNode(id, {
|
|
9
|
+
id: `${parent.id}-${id}`,
|
|
10
|
+
label: `${parent.id}-${id}`,
|
|
11
|
+
data: null,
|
|
12
|
+
parent
|
|
13
|
+
});
|
|
14
|
+
parent.addAction({
|
|
15
|
+
id: `${parent.id}-${id}`,
|
|
16
|
+
label: `${parent.id}-${id}`,
|
|
17
|
+
invoke: () => {
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
nodes.set(parent.id, parent);
|
|
21
|
+
nodes.set(child.id, child);
|
|
22
|
+
};
|
|
23
|
+
const addNode = (parentId, node) => {
|
|
24
|
+
const parent = nodes.get(parentId);
|
|
25
|
+
if (!parent) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const [child] = parent.addNode(id, node);
|
|
29
|
+
nodes.set(child.id, child);
|
|
30
|
+
return child;
|
|
31
|
+
};
|
|
32
|
+
const removeNode = (parentId, id2) => {
|
|
33
|
+
const parent = nodes.get(parentId);
|
|
34
|
+
if (!parent) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
return parent.removeNode(id2);
|
|
38
|
+
};
|
|
39
|
+
const addAction = (parentId, action) => {
|
|
40
|
+
const parent = nodes.get(parentId);
|
|
41
|
+
if (!parent) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return parent.addAction(action);
|
|
45
|
+
};
|
|
46
|
+
const removeAction = (parentId, id2) => {
|
|
47
|
+
const parent = nodes.get(parentId);
|
|
48
|
+
if (!parent) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
return parent.removeAction(id2);
|
|
52
|
+
};
|
|
53
|
+
const addProperty = (parentId, key, value) => {
|
|
54
|
+
const parent = nodes.get(parentId);
|
|
55
|
+
if (!parent) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
return parent.addProperty(key, value);
|
|
59
|
+
};
|
|
60
|
+
const removeProperty = (parentId, key) => {
|
|
61
|
+
const parent = nodes.get(parentId);
|
|
62
|
+
if (!parent) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return parent.removeProperty(key);
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
nodeBuilder,
|
|
69
|
+
addNode,
|
|
70
|
+
removeNode,
|
|
71
|
+
addAction,
|
|
72
|
+
removeAction,
|
|
73
|
+
addProperty,
|
|
74
|
+
removeProperty
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
var buildGraph = (graph, id, nodes) => {
|
|
78
|
+
addNodes(graph.root, id, nodes);
|
|
79
|
+
return graph;
|
|
80
|
+
};
|
|
81
|
+
var addNodes = (root, id, nodes) => {
|
|
82
|
+
nodes.forEach((node) => {
|
|
83
|
+
const [child] = root.addNode(id, node);
|
|
84
|
+
addNodes(child, id, node.children || []);
|
|
85
|
+
node.actions?.forEach((action) => child.addAction(action));
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var checkDepth = (node, depth = 0) => {
|
|
89
|
+
if (!node.parent) {
|
|
90
|
+
return depth;
|
|
91
|
+
}
|
|
92
|
+
return checkDepth(node.parent, depth + 1);
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
buildGraph,
|
|
96
|
+
createTestNodeBuilder
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=testing.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/testing.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Action } from './action';\nimport { type Graph } from './graph';\nimport { type NodeBuilder, type Node } from './node';\n\n/**\n * Create a test node builder that always adds nodes and actions to the specified depth.\n *\n * @param id The id of the node builder, used to identify nodes created by this builder.\n * @param depth The depth at which to add nodes and actions.\n * @default 1\n *\n * @returns A test node builder\n */\n// TODO(burdon): Change to TestNodeBuilder class (see other builder/generator patterns in client/echo).\nexport const createTestNodeBuilder = (id: string, depth = 1) => {\n const nodes = new Map<string, Node>();\n const nodeBuilder: NodeBuilder = (parent) => {\n if (checkDepth(parent) >= depth) {\n return;\n }\n\n const [child] = parent.addNode(id, {\n id: `${parent.id}-${id}`,\n label: `${parent.id}-${id}`,\n data: null,\n parent,\n });\n\n parent.addAction({\n id: `${parent.id}-${id}`,\n label: `${parent.id}-${id}`,\n invoke: () => {},\n });\n\n nodes.set(parent.id, parent);\n nodes.set(child.id, child);\n };\n\n const addNode = (parentId: string, node: Pick<Node, 'id' | 'label'> & Partial<Node>) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n const [child] = parent.addNode(id, node);\n nodes.set(child.id, child);\n return child;\n };\n\n const removeNode = (parentId: string, id: string) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n return parent.removeNode(id);\n };\n\n const addAction = (parentId: string, action: Pick<Action, 'id' | 'label' | 'invoke'> & Partial<Action>) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n return parent.addAction(action);\n };\n\n const removeAction = (parentId: string, id: string) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n return parent.removeAction(id);\n };\n\n const addProperty = (parentId: string, key: string, value: any) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n return parent.addProperty(key, value);\n };\n\n const removeProperty = (parentId: string, key: string) => {\n const parent = nodes.get(parentId);\n if (!parent) {\n return;\n }\n\n return parent.removeProperty(key);\n };\n\n return { nodeBuilder, addNode, removeNode, addAction, removeAction, addProperty, removeProperty };\n};\n\n/**\n * Build a graph from a nested list of nodes.\n *\n * @param graph Graph to add nodes to.\n * @param nodes Nodes to add to the\n *\n * @example\n * const graph = new GraphStore();\n * buildGraph(graph, [\n * {\n * id: 'test1',\n * label: 'test1',\n * children: [\n * {\n * id: 'test1.1',\n * label: 'test1.1',\n * },\n * {\n * id: 'test1.2',\n * label: 'test1.2',\n * },\n * ],\n * },\n * {\n * id: 'test2',\n * label: 'test2',\n * },\n * ]);\n */\n\n// TODO(wittjosiah): Type nodes.\nexport const buildGraph = (graph: Graph, id: string, nodes: any[]) => {\n addNodes(graph.root, id, nodes);\n return graph;\n};\n\nconst addNodes = (root: Node, id: string, nodes: any[]) => {\n nodes.forEach((node) => {\n const [child] = root.addNode(id, node);\n addNodes(child, id, node.children || []);\n node.actions?.forEach((action: any) => child.addAction(action));\n });\n};\n\nconst checkDepth = (node: Node, depth = 0): number => {\n if (!node.parent) {\n return depth;\n }\n\n return checkDepth(node.parent, depth + 1);\n};\n"],
|
|
5
|
+
"mappings": ";AAkBO,IAAMA,wBAAwB,CAACC,IAAYC,QAAQ,MAAC;AACzD,QAAMC,QAA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anB,GAAAA;EAC7B;AAEA,QAAMoB,cAAc,CAACN,UAAkBO,KAAaC,UAAAA;AAClD,UAAMjB,SAASH,MAAMc,IAAIF,QAAAA;AACzB,QAAI,CAACT,QAAQ;AACX;IACF;AAEA,WAAOA,OAAOe,YAAYC,KAAKC,KAAAA;EACjC;AAEA,QAAMC,iBAAiB,CAACT,UAAkBO,QAAAA;AACxC,UAAMhB,SAASH,MAAMc,IAAIF,QAAAA;AACzB,QAAI,CAACT,QAAQ;AACX;IACF;AAEA,WAAOA,OAAOkB,eAAeF,GAAAA;EAC/B;AAEA,SAAO;IAAEjB;IAAaI;IAASS;IAAYN;IAAWQ;IAAcC;IAAaG;EAAe;AAClG;AAiCO,IAAMC,aAAa,CAACC,OAAczB,IAAYE,UAAAA;AACnDwB,WAASD,MAAME,MAAM3B,IAAIE,KAAAA;AACzB,SAAOuB;AACT;AAEA,IAAMC,WAAW,CAACC,MAAY3B,IAAYE,UAAAA;AACxCA,QAAM0B,QAAQ,CAACb,SAAAA;AACb,UAAM,CAACR,KAAAA,IAASoB,KAAKnB,QAAQR,IAAIe,IAAAA;AACjCW,aAASnB,OAAOP,IAAIe,KAAKc,YAAY,CAAA,CAAE;AACvCd,SAAKe,SAASF,QAAQ,CAACV,WAAgBX,MAAMI,UAAUO,MAAAA,CAAAA;EACzD,CAAA;AACF;AAEA,IAAMZ,aAAa,CAACS,MAAYd,QAAQ,MAAC;AACvC,MAAI,CAACc,KAAKV,QAAQ;AAChB,WAAOJ;EACT;AAEA,SAAOK,WAAWS,KAAKV,QAAQJ,QAAQ,CAAA;AACzC;",
|
|
6
|
+
"names": ["createTestNodeBuilder", "id", "depth", "nodes", "Map", "nodeBuilder", "parent", "checkDepth", "child", "addNode", "label", "data", "addAction", "invoke", "set", "parentId", "node", "get", "removeNode", "action", "removeAction", "addProperty", "key", "value", "removeProperty", "buildGraph", "graph", "addNodes", "root", "forEach", "children", "actions"]
|
|
7
|
+
}
|