@dxos/plugin-debug 0.8.3 → 0.8.4-main.1da679c
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-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs → DevtoolsOverviewContainer-EPD6EWT5.mjs} +2 -2
- package/dist/lib/browser/{SpaceGenerator-VB6IB2LL.mjs → SpaceGenerator-SB2YRVRT.mjs} +376 -494
- package/dist/lib/browser/SpaceGenerator-SB2YRVRT.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-6HHJMKVU.mjs → app-graph-builder-7ODCSP7R.mjs} +27 -37
- package/dist/lib/browser/app-graph-builder-7ODCSP7R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-47JOZTT2.mjs → chunk-5XPIRNQS.mjs} +2 -2
- package/dist/lib/browser/{chunk-KS3YBEL7.mjs → chunk-AJA6RYN3.mjs} +2 -2
- package/dist/lib/browser/index.mjs +17 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-ZQRD2WG2.mjs → react-context-Y537DXK5.mjs} +5 -5
- package/dist/lib/browser/{react-context-ZQRD2WG2.mjs.map → react-context-Y537DXK5.mjs.map} +1 -1
- package/dist/lib/browser/{react-surface-UI6OK73H.mjs → react-surface-OP75RFNI.mjs} +45 -40
- package/dist/lib/browser/react-surface-OP75RFNI.mjs.map +7 -0
- package/dist/lib/browser/{settings-SXQWSIM4.mjs → settings-XAUQOU7I.mjs} +6 -6
- package/dist/lib/browser/{settings-SXQWSIM4.mjs.map → settings-XAUQOU7I.mjs.map} +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +3 -1
- 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 +13 -3
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +62 -60
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -59
- package/src/DebugPlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +13 -40
- package/src/capabilities/react-surface.tsx +9 -8
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +1 -1
- package/src/components/DebugSettings.tsx +72 -64
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +32 -26
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +15 -72
- package/src/components/SpaceGenerator/draw-util.ts +3 -3
- package/src/components/SpaceGenerator/presets.ts +346 -221
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/translations.ts +8 -4
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +0 -225
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -77
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
- /package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs.map → DevtoolsOverviewContainer-EPD6EWT5.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-47JOZTT2.mjs.map → chunk-5XPIRNQS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-KS3YBEL7.mjs.map → chunk-AJA6RYN3.mjs.map} +0 -0
|
@@ -4,25 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
-
import { Filter, Obj
|
|
10
|
-
import {
|
|
11
|
-
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
9
|
+
import { Filter, type Obj } from '@dxos/echo';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
12
11
|
import { SheetType } from '@dxos/plugin-sheet/types';
|
|
13
12
|
import { DiagramType } from '@dxos/plugin-sketch/types';
|
|
14
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
13
|
import { useClient } from '@dxos/react-client';
|
|
16
|
-
import {
|
|
14
|
+
import { type Space, getTypename } from '@dxos/react-client/echo';
|
|
17
15
|
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
18
16
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
19
|
-
import { initializeTable, TableType } from '@dxos/react-ui-table';
|
|
20
17
|
import { DataType } from '@dxos/schema';
|
|
21
18
|
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
22
19
|
|
|
23
|
-
import { createGenerator, staticGenerators
|
|
24
|
-
import { SchemaTable } from './SchemaTable';
|
|
20
|
+
import { type ObjectGenerator, createGenerator, staticGenerators } from './ObjectGenerator';
|
|
25
21
|
import { generator } from './presets';
|
|
22
|
+
import { SchemaTable } from './SchemaTable';
|
|
26
23
|
|
|
27
24
|
export type SpaceGeneratorProps = {
|
|
28
25
|
space: Space;
|
|
@@ -32,21 +29,21 @@ export type SpaceGeneratorProps = {
|
|
|
32
29
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
33
30
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
34
31
|
const client = useClient();
|
|
35
|
-
const staticTypes = [
|
|
36
|
-
const
|
|
32
|
+
const staticTypes = [Markdown.Document, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
+
const recordTypes = [DataType.Organization, DataType.Person, DataType.Task];
|
|
37
34
|
const [count, setCount] = useState(1);
|
|
38
35
|
const [info, setInfo] = useState<any>({});
|
|
39
36
|
const presets = useMemo(() => generator(), []);
|
|
40
37
|
|
|
41
38
|
// Create type generators.
|
|
42
39
|
const typeMap = useMemo(() => {
|
|
43
|
-
client.addTypes([...staticTypes, ...presets.schemas]);
|
|
44
|
-
const
|
|
45
|
-
|
|
40
|
+
client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
|
+
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
42
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, dispatch, type as any)]),
|
|
46
43
|
);
|
|
47
44
|
|
|
48
|
-
return new Map([...staticGenerators, ...presets.items, ...
|
|
49
|
-
}, [client,
|
|
45
|
+
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
46
|
+
}, [client, recordTypes]);
|
|
50
47
|
|
|
51
48
|
// Query space to get info.
|
|
52
49
|
const updateInfo = async () => {
|
|
@@ -90,64 +87,10 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
90
87
|
[typeMap, count],
|
|
91
88
|
);
|
|
92
89
|
|
|
93
|
-
// TODO(wittjosiah): Remove. Replace with proper echo import.
|
|
94
|
-
const handleLoadTables = useCallback(async () => {
|
|
95
|
-
const input = document.createElement('input');
|
|
96
|
-
input.type = 'file';
|
|
97
|
-
input.accept = '.json';
|
|
98
|
-
|
|
99
|
-
input.onchange = async (e) => {
|
|
100
|
-
const file = (e.target as HTMLInputElement).files?.[0];
|
|
101
|
-
if (!file) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const content = await file.text();
|
|
107
|
-
const data = JSON.parse(content);
|
|
108
|
-
const schemas = await space.db.schemaRegistry.register(data.schemas.map(Type.toEffectSchema));
|
|
109
|
-
// TODO(wittjosiah): If the schema is already registered this should skip.
|
|
110
|
-
await Promise.all(
|
|
111
|
-
schemas.map(async (schema) => {
|
|
112
|
-
const parts = schema.typename.split('/');
|
|
113
|
-
const name = parts[parts.length - 1];
|
|
114
|
-
const table = Obj.make(TableType, { name, threads: [] });
|
|
115
|
-
await initializeTable({ client, space, table, typename: schema.typename });
|
|
116
|
-
await dispatch(createIntent(SpaceAction.AddObject, { target: space, object: table }));
|
|
117
|
-
return table;
|
|
118
|
-
}),
|
|
119
|
-
);
|
|
120
|
-
// TODO(wittjosiah): This should query the space for schemas.
|
|
121
|
-
await Promise.all(
|
|
122
|
-
data.objects.map(async ({ id, '@type': typename, ...fields }: any) => {
|
|
123
|
-
const schema = schemas.find((s) => `dxn:type:${s.typename}:${s.version}` === typename);
|
|
124
|
-
if (!schema) {
|
|
125
|
-
log.warn('Missing schema for object', { id, typename });
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const object = Obj.make(schema, fields);
|
|
129
|
-
space.db.add(object);
|
|
130
|
-
return object;
|
|
131
|
-
}),
|
|
132
|
-
);
|
|
133
|
-
} catch (err) {
|
|
134
|
-
log.catch(err);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
input.click();
|
|
139
|
-
}, []);
|
|
140
|
-
|
|
141
90
|
return (
|
|
142
91
|
<div role='none' className='flex flex-col grow overflow-hidden'>
|
|
143
92
|
<Toolbar.Root classNames='border-be border-subduedSeparator'>
|
|
144
93
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
145
|
-
<IconButton
|
|
146
|
-
icon='ph--file-arrow-up--regular'
|
|
147
|
-
iconOnly
|
|
148
|
-
label='Load tables from JSON'
|
|
149
|
-
onClick={handleLoadTables}
|
|
150
|
-
/>
|
|
151
94
|
<Toolbar.Separator variant='gap' />
|
|
152
95
|
<Input.Root>
|
|
153
96
|
<Input.TextInput
|
|
@@ -165,11 +108,11 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
165
108
|
|
|
166
109
|
<div className='flex flex-col overflow-y-auto divide-y divide-separator'>
|
|
167
110
|
<SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
|
|
168
|
-
<SchemaTable types={
|
|
111
|
+
<SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
|
|
169
112
|
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
170
113
|
|
|
171
114
|
<div>
|
|
172
|
-
<SyntaxHighlighter classNames='
|
|
115
|
+
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
173
116
|
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|
|
174
117
|
</SyntaxHighlighter>
|
|
175
118
|
</div>
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// TODO(burdon): workerize-loader dep.
|
|
6
|
-
import {
|
|
6
|
+
import { type Edge, Graph, type PlainObject } from '@antv/graphlib';
|
|
7
7
|
import {
|
|
8
|
-
type Layout,
|
|
9
8
|
D3ForceLayout,
|
|
10
9
|
type D3ForceLayoutOptions,
|
|
11
10
|
GridLayout,
|
|
12
11
|
type GridLayoutOptions,
|
|
12
|
+
type Layout,
|
|
13
13
|
RadialLayout,
|
|
14
14
|
type RadialLayoutOptions,
|
|
15
15
|
} from '@antv/layout';
|
|
16
|
-
import {
|
|
16
|
+
import { type Editor, type SerializedStore, type TLRecord, createBindingId, createShapeId } from '@tldraw/tldraw';
|
|
17
17
|
|
|
18
18
|
import { faker } from '@dxos/random';
|
|
19
19
|
import { isNotFalsy, range } from '@dxos/util';
|