@dxos/plugin-debug 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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/DebugGraph-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-JXVZVPHN.mjs.map → DevtoolsOverviewContainer-77PKFLYV.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-BED4UXGS.mjs → SpaceGenerator-ZHVZWGM7.mjs} +168 -170
- package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +33 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
- package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs +757 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs.map +7 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -48
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -71
- package/src/DebugPlugin.tsx +16 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +409 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -4
- package/src/components/DebugSettings.tsx +10 -5
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -16
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +15 -10
- package/src/components/SpaceGenerator/presets.ts +128 -27
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +4 -1
- package/src/meta.ts +2 -2
- package/src/types.ts +8 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
- package/dist/lib/browser/SpaceGenerator-BED4UXGS.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JM2H3RZI.mjs +0 -774
- package/dist/lib/browser/react-surface-JM2H3RZI.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -418
- package/src/capabilities/settings.ts +0 -19
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
@@ -32,11 +33,12 @@ const meta = {
|
|
|
32
33
|
withPluginManager({
|
|
33
34
|
plugins: [
|
|
34
35
|
ClientPlugin({
|
|
35
|
-
onClientInitialized:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
onClientInitialized: ({ client }) =>
|
|
37
|
+
Effect.gen(function* () {
|
|
38
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
39
|
+
}),
|
|
38
40
|
}),
|
|
39
|
-
|
|
41
|
+
OperationPlugin(),
|
|
40
42
|
],
|
|
41
43
|
}),
|
|
42
44
|
],
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
-
import { Filter, Obj } from '@dxos/echo';
|
|
9
|
+
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
12
12
|
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
@@ -23,36 +23,40 @@ import { SchemaTable } from './SchemaTable';
|
|
|
23
23
|
|
|
24
24
|
export type SpaceGeneratorProps = {
|
|
25
25
|
space: Space;
|
|
26
|
-
onCreateObjects?: (objects: Obj.
|
|
26
|
+
onCreateObjects?: (objects: Obj.Unknown[]) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
30
|
-
const {
|
|
30
|
+
const { invokePromise } = useOperationInvoker();
|
|
31
31
|
const client = useClient();
|
|
32
32
|
const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
-
const recordTypes = [Organization.Organization, Person.Person, Task.Task];
|
|
33
|
+
const recordTypes: Type.Obj.Any[] = [Organization.Organization, Person.Person, Task.Task];
|
|
34
34
|
const [count, setCount] = useState(1);
|
|
35
35
|
const [info, setInfo] = useState<any>({});
|
|
36
36
|
const presets = useMemo(() => generator(), []);
|
|
37
37
|
|
|
38
|
+
// Register types.
|
|
39
|
+
useAsyncEffect(async () => {
|
|
40
|
+
await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
|
+
}, [client]);
|
|
42
|
+
|
|
38
43
|
// Create type generators.
|
|
39
44
|
const typeMap = useMemo(() => {
|
|
40
|
-
client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
45
|
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
42
|
-
recordTypes.map((type) => [type.typename, createGenerator(client,
|
|
46
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
|
|
43
47
|
);
|
|
44
48
|
|
|
45
49
|
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
46
|
-
}, [client, recordTypes]);
|
|
50
|
+
}, [client, recordTypes, invokePromise]);
|
|
47
51
|
|
|
48
52
|
// Query space to get info.
|
|
49
53
|
const updateInfo = async () => {
|
|
50
54
|
// Create schema map.
|
|
51
55
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
52
|
-
const staticSchema = space.db.graph.schemaRegistry.
|
|
56
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
53
57
|
|
|
54
58
|
// Create object map.
|
|
55
|
-
const
|
|
59
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
56
60
|
const objectMap = sortKeys(
|
|
57
61
|
objects.reduce<Record<string, number>>((map, obj) => {
|
|
58
62
|
const type = Obj.getTypename(obj);
|
|
@@ -60,6 +64,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
60
64
|
const count = map[type] ?? 0;
|
|
61
65
|
map[type] = count + 1;
|
|
62
66
|
}
|
|
67
|
+
|
|
63
68
|
return map;
|
|
64
69
|
}, {}),
|
|
65
70
|
);
|
|
@@ -57,14 +57,19 @@ export enum PresetName {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export const generator = () => ({
|
|
60
|
-
schemas: [CanvasBoardType, Trigger.Trigger],
|
|
60
|
+
schemas: [CanvasBoardType, Trigger.Trigger] as any[],
|
|
61
61
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
62
62
|
items: [
|
|
63
63
|
[
|
|
64
64
|
PresetName.DXOS_TEAM,
|
|
65
65
|
async (space, n, cb) => {
|
|
66
66
|
const objects = range(n, () => {
|
|
67
|
-
const org = space.db.add(
|
|
67
|
+
const org = space.db.add(
|
|
68
|
+
Obj.make(Organization.Organization, {
|
|
69
|
+
name: 'DXOS',
|
|
70
|
+
website: 'https://dxos.org',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
68
73
|
const doc = space.db.add(
|
|
69
74
|
Markdown.make({
|
|
70
75
|
name: 'DXOS Research',
|
|
@@ -74,7 +79,9 @@ export const generator = () => ({
|
|
|
74
79
|
|
|
75
80
|
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
76
81
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
77
|
-
Obj.
|
|
82
|
+
Obj.change(doc, (d) => {
|
|
83
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
84
|
+
});
|
|
78
85
|
|
|
79
86
|
// space.db.add(
|
|
80
87
|
// Relation.make(HasSubject, {
|
|
@@ -85,9 +92,24 @@ export const generator = () => ({
|
|
|
85
92
|
// );
|
|
86
93
|
|
|
87
94
|
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
88
|
-
space.db.add(
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Josiah',
|
|
98
|
+
organization: Ref.make(org),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
space.db.add(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Dima',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
space.db.add(
|
|
108
|
+
Obj.make(Person.Person, {
|
|
109
|
+
fullName: 'Mykola',
|
|
110
|
+
organization: Ref.make(org),
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
91
113
|
|
|
92
114
|
return doc;
|
|
93
115
|
});
|
|
@@ -175,7 +197,9 @@ export const generator = () => ({
|
|
|
175
197
|
|
|
176
198
|
const mailboxView = View.make({
|
|
177
199
|
query: Query.select(
|
|
178
|
-
Filter.type(Message.Message, {
|
|
200
|
+
Filter.type(Message.Message, {
|
|
201
|
+
properties: { labels: Filter.contains('investor') },
|
|
202
|
+
}),
|
|
179
203
|
).options({
|
|
180
204
|
queues: [mailbox.queue.dxn.toString()],
|
|
181
205
|
}),
|
|
@@ -247,10 +271,24 @@ export const generator = () => ({
|
|
|
247
271
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
248
272
|
|
|
249
273
|
builder
|
|
250
|
-
.createEdge({
|
|
274
|
+
.createEdge({
|
|
275
|
+
source: trigger.id,
|
|
276
|
+
target: gpt.id,
|
|
277
|
+
input: 'prompt',
|
|
278
|
+
output: 'bodyText',
|
|
279
|
+
})
|
|
251
280
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
252
|
-
.createEdge({
|
|
253
|
-
|
|
281
|
+
.createEdge({
|
|
282
|
+
source: queueId.id,
|
|
283
|
+
target: append.id,
|
|
284
|
+
input: 'id',
|
|
285
|
+
})
|
|
286
|
+
.createEdge({
|
|
287
|
+
source: gpt.id,
|
|
288
|
+
target: append.id,
|
|
289
|
+
output: 'messages',
|
|
290
|
+
input: 'items',
|
|
291
|
+
});
|
|
254
292
|
|
|
255
293
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
256
294
|
});
|
|
@@ -388,8 +426,17 @@ export const generator = () => ({
|
|
|
388
426
|
builder
|
|
389
427
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
390
428
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
391
|
-
.createEdge({
|
|
392
|
-
|
|
429
|
+
.createEdge({
|
|
430
|
+
source: queueId.id,
|
|
431
|
+
target: append.id,
|
|
432
|
+
input: 'id',
|
|
433
|
+
})
|
|
434
|
+
.createEdge({
|
|
435
|
+
source: gpt.id,
|
|
436
|
+
target: append.id,
|
|
437
|
+
output: 'messages',
|
|
438
|
+
input: 'items',
|
|
439
|
+
});
|
|
393
440
|
});
|
|
394
441
|
|
|
395
442
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -513,9 +560,21 @@ export const generator = () => ({
|
|
|
513
560
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
514
561
|
|
|
515
562
|
builder
|
|
516
|
-
.createEdge({
|
|
517
|
-
|
|
518
|
-
|
|
563
|
+
.createEdge({
|
|
564
|
+
source: sourceCurrency.id,
|
|
565
|
+
target: converter.id,
|
|
566
|
+
input: 'from',
|
|
567
|
+
})
|
|
568
|
+
.createEdge({
|
|
569
|
+
source: targetCurrency.id,
|
|
570
|
+
target: converter.id,
|
|
571
|
+
input: 'to',
|
|
572
|
+
})
|
|
573
|
+
.createEdge({
|
|
574
|
+
source: converter.id,
|
|
575
|
+
target: view.id,
|
|
576
|
+
output: 'rate',
|
|
577
|
+
});
|
|
519
578
|
});
|
|
520
579
|
|
|
521
580
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -543,7 +602,10 @@ export const generator = () => ({
|
|
|
543
602
|
const trigger = canvasModel.createNode(triggerShape);
|
|
544
603
|
// DXOS dev-null channel.
|
|
545
604
|
const channelId = canvasModel.createNode(
|
|
546
|
-
createConstant({
|
|
605
|
+
createConstant({
|
|
606
|
+
value: '1088569858767212554',
|
|
607
|
+
...position({ x: -10, y: 0 }),
|
|
608
|
+
}),
|
|
547
609
|
);
|
|
548
610
|
const queueId = canvasModel.createNode(
|
|
549
611
|
createConstant({
|
|
@@ -556,11 +618,31 @@ export const generator = () => ({
|
|
|
556
618
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
557
619
|
|
|
558
620
|
builder
|
|
559
|
-
.createEdge({
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
621
|
+
.createEdge({
|
|
622
|
+
source: trigger.id,
|
|
623
|
+
target: converter.id,
|
|
624
|
+
input: 'tick',
|
|
625
|
+
})
|
|
626
|
+
.createEdge({
|
|
627
|
+
source: channelId.id,
|
|
628
|
+
target: converter.id,
|
|
629
|
+
input: 'channelId',
|
|
630
|
+
})
|
|
631
|
+
.createEdge({
|
|
632
|
+
source: queueId.id,
|
|
633
|
+
target: converter.id,
|
|
634
|
+
input: 'queueId',
|
|
635
|
+
})
|
|
636
|
+
.createEdge({
|
|
637
|
+
source: converter.id,
|
|
638
|
+
target: view.id,
|
|
639
|
+
output: 'newMessages',
|
|
640
|
+
})
|
|
641
|
+
.createEdge({
|
|
642
|
+
source: queueId.id,
|
|
643
|
+
target: queue.id,
|
|
644
|
+
input: 'input',
|
|
645
|
+
});
|
|
564
646
|
|
|
565
647
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
566
648
|
});
|
|
@@ -663,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
663
745
|
builder
|
|
664
746
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
665
747
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
666
|
-
.createEdge({
|
|
748
|
+
.createEdge({
|
|
749
|
+
source: trigger.id,
|
|
750
|
+
target: template.id,
|
|
751
|
+
output: triggerOutputName,
|
|
752
|
+
input: 'type',
|
|
753
|
+
})
|
|
667
754
|
.createEdge({
|
|
668
755
|
source: random.id,
|
|
669
756
|
target: template.id,
|
|
@@ -680,6 +767,7 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
680
767
|
|
|
681
768
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
682
769
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
770
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
683
771
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
684
772
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
685
773
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -719,15 +807,25 @@ const setupQueue = (
|
|
|
719
807
|
|
|
720
808
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
721
809
|
invariant(functionTrigger);
|
|
722
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
723
810
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
724
|
-
functionTrigger
|
|
811
|
+
Obj.change(functionTrigger, (t) => {
|
|
812
|
+
t.function = Ref.make(computeModel.root);
|
|
813
|
+
t.inputNodeId = inputNode.id;
|
|
814
|
+
});
|
|
725
815
|
};
|
|
726
816
|
|
|
727
|
-
type RawPositionInput = {
|
|
817
|
+
type RawPositionInput = {
|
|
818
|
+
centerX: number;
|
|
819
|
+
centerY: number;
|
|
820
|
+
width: number;
|
|
821
|
+
height: number;
|
|
822
|
+
};
|
|
728
823
|
|
|
729
824
|
const rawPosition = (args: RawPositionInput) => {
|
|
730
|
-
return {
|
|
825
|
+
return {
|
|
826
|
+
center: { x: args.centerX, y: args.centerY },
|
|
827
|
+
size: { width: args.width, height: args.height },
|
|
828
|
+
};
|
|
731
829
|
};
|
|
732
830
|
|
|
733
831
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -735,7 +833,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
735
833
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
736
834
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
737
835
|
if (width && height) {
|
|
738
|
-
return {
|
|
836
|
+
return {
|
|
837
|
+
center: { x, y },
|
|
838
|
+
size: width && height ? { width, height } : undefined,
|
|
839
|
+
};
|
|
739
840
|
} else {
|
|
740
841
|
return { center: { x, y } };
|
|
741
842
|
}
|
|
@@ -9,12 +9,12 @@ import { Obj } from '@dxos/echo';
|
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { mx } from '@dxos/
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
15
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
|
+
object: Obj.Unknown;
|
|
16
17
|
label?: string;
|
|
17
|
-
object: Obj.Any;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
20
|
// TODO(burdon): Make focusable and attendable with input.
|
package/src/components/index.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
|
+
import { type FC } from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import { type DebugGraphProps } from './DebugGraph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: ReturnType<typeof lazy<FC<DebugGraphProps>>> = lazy(() => import('./DebugGraph'));
|
|
8
11
|
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
12
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
13
|
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/debug',
|
|
10
10
|
name: 'Debug',
|
|
11
11
|
description: trim`
|
package/src/types.ts
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { type Context, createContext } from 'react';
|
|
7
8
|
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
10
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
9
11
|
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
10
14
|
export type DebugContextType = {
|
|
11
15
|
running: boolean;
|
|
12
16
|
start: (cb: TimerCallback, options: TimerOptions) => void;
|
|
@@ -27,6 +31,10 @@ export const DebugSettingsSchema = Schema.mutable(
|
|
|
27
31
|
|
|
28
32
|
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
33
|
|
|
34
|
+
export namespace DebugCapabilities {
|
|
35
|
+
export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export namespace Devtools {
|
|
31
39
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
32
40
|
export const id = 'dxos.org.plugin.debug.devtools';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/components/DebugGraph.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Tree } from "@dxos/devtools";
|
|
5
|
-
var DebugGraph = ({ graph, root }) => {
|
|
6
|
-
var _effect = _useSignals();
|
|
7
|
-
try {
|
|
8
|
-
return /* @__PURE__ */ React.createElement(Tree, {
|
|
9
|
-
data: graph.toJSON(root)
|
|
10
|
-
});
|
|
11
|
-
} finally {
|
|
12
|
-
_effect.f();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var DebugGraph_default = DebugGraph;
|
|
16
|
-
export {
|
|
17
|
-
DebugGraph,
|
|
18
|
-
DebugGraph_default as default
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
|
|
6
|
-
"names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
|
|
7
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
5
|
-
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
6
|
-
var DevtoolsOverviewContainer = () => {
|
|
7
|
-
var _effect = _useSignals();
|
|
8
|
-
try {
|
|
9
|
-
const [stats, refreshStats] = useStats();
|
|
10
|
-
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
11
|
-
stats,
|
|
12
|
-
onRefresh: refreshStats
|
|
13
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
14
|
-
role: "devtools-overview"
|
|
15
|
-
}));
|
|
16
|
-
} finally {
|
|
17
|
-
_effect.f();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
21
|
-
export {
|
|
22
|
-
DevtoolsOverviewContainer,
|
|
23
|
-
DevtoolsOverviewContainer_default as default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-JXVZVPHN.mjs.map
|