@dxos/plugin-debug 0.7.5-labs.a279d8c → 0.7.5-labs.d453967
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/SpaceGenerator-KYSK77VG.mjs +1100 -0
- package/dist/lib/browser/SpaceGenerator-KYSK77VG.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-FXELWOFS.mjs → app-graph-builder-DCMGZAT3.mjs} +8 -4
- package/dist/lib/browser/app-graph-builder-DCMGZAT3.mjs.map +7 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs +21 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-ACHNR2UU.mjs → react-surface-6GVTLM4O.mjs} +54 -51
- package/dist/lib/browser/react-surface-6GVTLM4O.mjs.map +7 -0
- package/dist/lib/browser/{settings-JCZUA643.mjs → settings-OIMSBZUC.mjs} +2 -2
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +22 -22
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +26 -31
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +21 -0
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -46
- package/src/DebugPlugin.tsx +2 -7
- package/src/capabilities/app-graph-builder.ts +7 -9
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/react-surface.tsx +7 -15
- package/src/components/DebugSettings.tsx +7 -9
- package/src/components/DebugStatus.tsx +17 -21
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +0 -81
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -6
- package/src/components/SpaceGenerator/presets.ts +493 -0
- package/src/meta.ts +3 -1
- package/dist/lib/browser/SpaceGenerator-YNT3WDFI.mjs +0 -479
- package/dist/lib/browser/SpaceGenerator-YNT3WDFI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-FXELWOFS.mjs.map +0 -7
- package/dist/lib/browser/chunk-I3ON45JK.mjs +0 -18
- package/dist/lib/browser/chunk-I3ON45JK.mjs.map +0 -7
- package/dist/lib/browser/react-context-OZU6J7G3.mjs +0 -37
- package/dist/lib/browser/react-context-OZU6J7G3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ACHNR2UU.mjs.map +0 -7
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/src/capabilities/react-context.tsx +0 -38
- /package/dist/lib/browser/{settings-JCZUA643.mjs.map → settings-OIMSBZUC.mjs.map} +0 -0
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useAppGraph, useLayout } from '@dxos/app-framework';
|
|
8
8
|
import { TimeoutError } from '@dxos/async';
|
|
9
9
|
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
10
10
|
import { getActiveSpace } from '@dxos/plugin-space';
|
|
11
11
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
12
12
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
13
13
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
14
|
-
import { Icon } from '@dxos/react-ui';
|
|
15
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
16
15
|
|
|
17
16
|
const styles = {
|
|
18
17
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -136,9 +135,9 @@ const SwarmIndicator = () => {
|
|
|
136
135
|
// TODO(burdon): Merge with SaveStatus.
|
|
137
136
|
const SavingIndicator = () => {
|
|
138
137
|
const [state, _setState] = useState(0);
|
|
139
|
-
const
|
|
140
|
-
const { graph } =
|
|
141
|
-
const _space =
|
|
138
|
+
const layout = useLayout();
|
|
139
|
+
const { graph } = useAppGraph();
|
|
140
|
+
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
142
141
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
143
142
|
// useEffect(() => {
|
|
144
143
|
// if (!space) {
|
|
@@ -186,22 +185,19 @@ const PerformanceIndicator = () => {
|
|
|
186
185
|
const [stats, refreshStats] = useStats();
|
|
187
186
|
|
|
188
187
|
return (
|
|
189
|
-
|
|
190
|
-
<
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
'overflow-x-hidden overflow-y-auto scrollbar-thin',
|
|
198
|
-
'border-x border-y border-separator',
|
|
199
|
-
)}
|
|
200
|
-
>
|
|
188
|
+
<Popover.Root open={visible} onOpenChange={setVisible}>
|
|
189
|
+
<Popover.Trigger asChild>
|
|
190
|
+
<StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>
|
|
191
|
+
<Icon icon='ph--chart-bar--regular' size={4} />
|
|
192
|
+
</StatusBar.Button>
|
|
193
|
+
</Popover.Trigger>
|
|
194
|
+
<Popover.Portal>
|
|
195
|
+
<Popover.Content classNames='max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]'>
|
|
201
196
|
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
<Popover.Arrow />
|
|
198
|
+
</Popover.Content>
|
|
199
|
+
</Popover.Portal>
|
|
200
|
+
</Popover.Root>
|
|
205
201
|
);
|
|
206
202
|
};
|
|
207
203
|
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import { addressToA1Notation } from '@dxos/compute';
|
|
6
6
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
7
7
|
import { ObjectId, type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
8
|
-
import { type FunctionTrigger, TriggerKind } from '@dxos/functions/types';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
8
|
import { DXN, SpaceId } from '@dxos/keys';
|
|
11
9
|
import { create, makeRef, type ReactiveObject } from '@dxos/live-object';
|
|
12
10
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
@@ -15,23 +13,6 @@ import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
|
15
13
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
16
14
|
import { faker } from '@dxos/random';
|
|
17
15
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
18
|
-
import {
|
|
19
|
-
type ComputeShape,
|
|
20
|
-
createAppend,
|
|
21
|
-
createComputeGraph,
|
|
22
|
-
createConstant,
|
|
23
|
-
createGpt,
|
|
24
|
-
createQueue,
|
|
25
|
-
createText,
|
|
26
|
-
createTrigger,
|
|
27
|
-
} from '@dxos/react-ui-canvas-compute';
|
|
28
|
-
import {
|
|
29
|
-
pointMultiply,
|
|
30
|
-
pointsToRect,
|
|
31
|
-
rectToPoints,
|
|
32
|
-
CanvasBoardType,
|
|
33
|
-
CanvasGraphModel,
|
|
34
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
35
16
|
import { TableType } from '@dxos/react-ui-table';
|
|
36
17
|
import { createView, TextType } from '@dxos/schema';
|
|
37
18
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
@@ -155,70 +136,8 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
155
136
|
return objects;
|
|
156
137
|
},
|
|
157
138
|
],
|
|
158
|
-
[
|
|
159
|
-
CanvasBoardType.typename,
|
|
160
|
-
async (space, n, cb) => {
|
|
161
|
-
const objects = range(n, () => {
|
|
162
|
-
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
163
|
-
|
|
164
|
-
let functionTrigger: FunctionTrigger | undefined;
|
|
165
|
-
canvasModel.builder.call((builder) => {
|
|
166
|
-
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
167
|
-
const triggerShape = createTrigger({ triggerKind: TriggerKind.Webhook, ...position({ x: -18, y: -2 }) });
|
|
168
|
-
const trigger = canvasModel.createNode(triggerShape);
|
|
169
|
-
const text = canvasModel.createNode(createText(position({ x: 19, y: 3, width: 10, height: 10 })));
|
|
170
|
-
const queueId = canvasModel.createNode(
|
|
171
|
-
createConstant({
|
|
172
|
-
value: new DXN(DXN.kind.QUEUE, ['data', SpaceId.random(), ObjectId.random()]).toString(),
|
|
173
|
-
...position({ x: -18, y: 5, width: 8, height: 6 }),
|
|
174
|
-
}),
|
|
175
|
-
);
|
|
176
|
-
const queue = canvasModel.createNode(createQueue(position({ x: -3, y: 3, width: 14, height: 10 })));
|
|
177
|
-
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
178
|
-
|
|
179
|
-
builder
|
|
180
|
-
.createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'bodyText' })
|
|
181
|
-
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
182
|
-
.createEdge({ source: queueId.id, target: queue.id })
|
|
183
|
-
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
184
|
-
.createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
|
|
185
|
-
|
|
186
|
-
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
const computeModel = createComputeGraph(canvasModel);
|
|
190
|
-
const computeGraph = computeModel.root;
|
|
191
|
-
|
|
192
|
-
invariant(functionTrigger);
|
|
193
|
-
functionTrigger.function = DXN.fromLocalObjectId(computeGraph.id).toString();
|
|
194
|
-
functionTrigger.meta ??= {};
|
|
195
|
-
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
196
|
-
functionTrigger.meta.computeNodeId = inputNode.id;
|
|
197
|
-
|
|
198
|
-
return space.db.add(
|
|
199
|
-
create(CanvasBoardType, {
|
|
200
|
-
computeGraph: makeRef(computeGraph),
|
|
201
|
-
layout: canvasModel.graph,
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
|
-
});
|
|
205
|
-
cb?.(objects);
|
|
206
|
-
return objects;
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
139
|
]);
|
|
210
140
|
|
|
211
|
-
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
212
|
-
const snap = 32;
|
|
213
|
-
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
214
|
-
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
215
|
-
if (width && height) {
|
|
216
|
-
return { center: { x, y }, size: width && height ? { width, height } : undefined };
|
|
217
|
-
} else {
|
|
218
|
-
return { center: { x, y } };
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
141
|
export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {
|
|
223
142
|
return async (
|
|
224
143
|
space: Space,
|
|
@@ -12,13 +12,13 @@ import { DiagramType } from '@dxos/plugin-sketch/types';
|
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { getTypename, type Space } from '@dxos/react-client/echo';
|
|
14
14
|
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
-
import { CanvasBoardType } from '@dxos/react-ui-canvas-editor';
|
|
16
15
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
16
|
import { Testing } from '@dxos/schema/testing';
|
|
18
17
|
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
19
18
|
|
|
20
19
|
import { type ObjectGenerator, createGenerator, staticGenerators } from './ObjectGenerator';
|
|
21
20
|
import { SchemaTable } from './SchemaTable';
|
|
21
|
+
import { presets } from './presets';
|
|
22
22
|
|
|
23
23
|
export type SpaceGeneratorProps = {
|
|
24
24
|
space: Space;
|
|
@@ -27,19 +27,19 @@ export type SpaceGeneratorProps = {
|
|
|
27
27
|
|
|
28
28
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
29
29
|
const client = useClient();
|
|
30
|
-
const staticTypes = [DocumentType, DiagramType, SheetType, ComputeGraph
|
|
31
|
-
const mutableTypes = [Testing.OrgType, Testing.ProjectType, Testing.ContactType];
|
|
30
|
+
const staticTypes = [DocumentType, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
31
|
+
const mutableTypes = [Testing.OrgType, Testing.ProjectType, Testing.ContactType, Testing.EmailType];
|
|
32
32
|
const [count, setCount] = useState(1);
|
|
33
33
|
const [info, setInfo] = useState<any>({});
|
|
34
34
|
|
|
35
35
|
// Create type generators.
|
|
36
36
|
const typeMap = useMemo(() => {
|
|
37
|
-
client.addTypes(staticTypes);
|
|
37
|
+
client.addTypes([...staticTypes, ...presets.schemas]);
|
|
38
38
|
const mutableGenerators = new Map<string, ObjectGenerator<any>>(
|
|
39
|
-
mutableTypes.map((type) => [type.typename, createGenerator(type)]),
|
|
39
|
+
mutableTypes.map((type) => [type.typename, createGenerator(type as any)]),
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
return new Map([...staticGenerators, ...mutableGenerators]);
|
|
42
|
+
return new Map([...staticGenerators, ...presets.items, ...mutableGenerators]);
|
|
43
43
|
}, [client, mutableTypes]);
|
|
44
44
|
|
|
45
45
|
// Query space to get info.
|
|
@@ -106,6 +106,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
106
106
|
|
|
107
107
|
<SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
|
|
108
108
|
<SchemaTable types={mutableTypes} objects={info.objects} label='Mutable Types' onClick={handleCreateData} />
|
|
109
|
+
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
109
110
|
|
|
110
111
|
<SyntaxHighlighter classNames='flex text-xs' language='json'>
|
|
111
112
|
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|