@dxos/plugin-debug 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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/index.mjs +97 -91
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/DebugPlugin.d.ts +6 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +15 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +9 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +10 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +79 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +3 -0
- package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
- package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers/DebugGraph}/DebugGraph.d.ts +0 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +15 -0
- package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +9 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +60 -58
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +6 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +67 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +74 -67
- package/src/DebugPlugin.tsx +23 -10
- package/src/capabilities/app-graph-builder.ts +406 -0
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/react-context.tsx +25 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +122 -109
- package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +228 -0
- package/src/components/DebugSettings/index.ts +7 -0
- package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +7 -8
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +51 -46
- package/src/components/index.ts +4 -11
- package/src/{components → containers/DebugGraph}/DebugGraph.tsx +0 -2
- package/src/containers/DebugGraph/index.ts +7 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +47 -0
- package/src/containers/DebugObjectPanel/index.ts +7 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +55 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -17
- package/src/containers/DebugStatus/index.ts +7 -0
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
- package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +130 -0
- package/src/containers/SpaceGenerator/index.ts +7 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +2 -2
- package/src/containers/Wireframe/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/meta.ts +1 -1
- package/src/translations.ts +66 -58
- package/src/types/Settings.ts +15 -0
- package/src/{types.ts → types/index.ts} +7 -13
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +0 -15
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +0 -19
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs +0 -1152
- package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +0 -598
- package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UFQXPP7.mjs +0 -78
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5H5GRV6.mjs +0 -20
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +0 -7
- package/dist/lib/browser/react-context-FSWBT3MH.mjs +0 -17
- package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-2N6CPSHR.mjs +0 -757
- package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +0 -7
- package/dist/lib/browser/settings-KA4GN73K.mjs +0 -31
- package/dist/lib/browser/settings-KA4GN73K.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
- package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -5
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/Container.d.ts +0 -5
- package/dist/types/src/components/Container.d.ts.map +0 -1
- package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugSettings.d.ts +0 -8
- package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
- package/dist/types/src/components/Wireframe.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -68
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -420
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/react-context/index.ts +0 -7
- package/src/capabilities/react-context/react-context.tsx +0 -20
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugObjectPanel.tsx +0 -33
- package/src/components/DebugSettings.tsx +0 -185
- package/src/components/DevtoolsOverviewContainer.tsx +0 -20
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -127
- /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
- /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
- /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { ObjectsTree } from '@dxos/devtools';
|
|
8
|
+
import { type Database, Filter, Query } from '@dxos/echo';
|
|
9
|
+
import type { ObjectId } from '@dxos/keys';
|
|
10
|
+
import { useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
14
|
+
|
|
15
|
+
export const DebugSpaceObjectsPanel = () => {
|
|
16
|
+
const space = useActiveSpace();
|
|
17
|
+
if (!space) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <DebugSpaceObjectsPanelMain database={space.db} />;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database }) => {
|
|
25
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
26
|
+
|
|
27
|
+
const [selectedObject] = useQuery(
|
|
28
|
+
database,
|
|
29
|
+
selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Clipboard.Provider>
|
|
34
|
+
<Panel.Root>
|
|
35
|
+
<Panel.Toolbar asChild>
|
|
36
|
+
<Toolbar.Root>
|
|
37
|
+
<Input.Root>
|
|
38
|
+
<Input.TextInput disabled placeholder='Search...' />
|
|
39
|
+
</Input.Root>
|
|
40
|
+
</Toolbar.Root>
|
|
41
|
+
</Panel.Toolbar>
|
|
42
|
+
<Panel.Content asChild>
|
|
43
|
+
<Grid rows={2} classNames='divide-y divide-separator'>
|
|
44
|
+
<ScrollArea.Root>
|
|
45
|
+
<ScrollArea.Viewport>
|
|
46
|
+
<ObjectsTree db={database} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
47
|
+
</ScrollArea.Viewport>
|
|
48
|
+
</ScrollArea.Root>
|
|
49
|
+
{selectedObject && <Json.Data classNames='p-1' data={selectedObject} />}
|
|
50
|
+
</Grid>
|
|
51
|
+
</Panel.Content>
|
|
52
|
+
</Panel.Root>
|
|
53
|
+
</Clipboard.Provider>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { TimeoutError } from '@dxos/async';
|
|
8
|
-
import { useActiveSpace } from '@dxos/
|
|
8
|
+
import { useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
10
10
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
11
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
12
|
-
import {
|
|
12
|
+
import { IconButton } from '@dxos/react-ui';
|
|
13
13
|
|
|
14
14
|
const styles = {
|
|
15
15
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -89,14 +89,20 @@ const ErrorIndicator = () => {
|
|
|
89
89
|
|
|
90
90
|
if (errorRef.current) {
|
|
91
91
|
return (
|
|
92
|
-
<StatusBar.
|
|
93
|
-
<
|
|
94
|
-
|
|
92
|
+
<StatusBar.Item>
|
|
93
|
+
<IconButton
|
|
94
|
+
icon='ph--warning-circle--duotone'
|
|
95
|
+
iconOnly
|
|
96
|
+
label={errorRef.current.message}
|
|
97
|
+
classNames={styles.error}
|
|
98
|
+
onClick={handleReset}
|
|
99
|
+
/>
|
|
100
|
+
</StatusBar.Item>
|
|
95
101
|
);
|
|
96
102
|
} else {
|
|
97
103
|
return (
|
|
98
|
-
<StatusBar.Item
|
|
99
|
-
<
|
|
104
|
+
<StatusBar.Item>
|
|
105
|
+
<IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />
|
|
100
106
|
</StatusBar.Item>
|
|
101
107
|
);
|
|
102
108
|
}
|
|
@@ -114,14 +120,20 @@ const SwarmIndicator = () => {
|
|
|
114
120
|
|
|
115
121
|
if (state === 0) {
|
|
116
122
|
return (
|
|
117
|
-
<StatusBar.Item
|
|
118
|
-
<
|
|
123
|
+
<StatusBar.Item>
|
|
124
|
+
<IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />
|
|
119
125
|
</StatusBar.Item>
|
|
120
126
|
);
|
|
121
127
|
} else {
|
|
122
128
|
return (
|
|
123
|
-
<StatusBar.Item
|
|
124
|
-
<
|
|
129
|
+
<StatusBar.Item>
|
|
130
|
+
<IconButton
|
|
131
|
+
variant='ghost'
|
|
132
|
+
icon='ph--lightning-slash--regular'
|
|
133
|
+
iconOnly
|
|
134
|
+
label='Disconnected from swarm.'
|
|
135
|
+
classNames={styles.warning}
|
|
136
|
+
/>
|
|
125
137
|
</StatusBar.Item>
|
|
126
138
|
);
|
|
127
139
|
}
|
|
@@ -156,21 +168,33 @@ const SavingIndicator = () => {
|
|
|
156
168
|
switch (state) {
|
|
157
169
|
case 2:
|
|
158
170
|
return (
|
|
159
|
-
<StatusBar.Item
|
|
160
|
-
<
|
|
171
|
+
<StatusBar.Item>
|
|
172
|
+
<IconButton
|
|
173
|
+
variant='ghost'
|
|
174
|
+
icon='ph--circle--duotone'
|
|
175
|
+
iconOnly
|
|
176
|
+
label='Edit not saved.'
|
|
177
|
+
classNames={styles.warning}
|
|
178
|
+
/>
|
|
161
179
|
</StatusBar.Item>
|
|
162
180
|
);
|
|
163
181
|
case 1:
|
|
164
182
|
return (
|
|
165
|
-
<StatusBar.Item
|
|
166
|
-
<
|
|
183
|
+
<StatusBar.Item>
|
|
184
|
+
<IconButton
|
|
185
|
+
variant='ghost'
|
|
186
|
+
icon='ph--circle--duotone'
|
|
187
|
+
iconOnly
|
|
188
|
+
label='Saving...'
|
|
189
|
+
classNames={styles.success}
|
|
190
|
+
/>
|
|
167
191
|
</StatusBar.Item>
|
|
168
192
|
);
|
|
169
193
|
case 0:
|
|
170
194
|
default:
|
|
171
195
|
return (
|
|
172
|
-
<StatusBar.Item
|
|
173
|
-
<
|
|
196
|
+
<StatusBar.Item>
|
|
197
|
+
<IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />
|
|
174
198
|
</StatusBar.Item>
|
|
175
199
|
);
|
|
176
200
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
9
|
+
|
|
10
|
+
export const DevtoolsOverviewContainer = () => {
|
|
11
|
+
const [stats, refreshStats] = useStats();
|
|
12
|
+
const surfaceProfilerStats = Surface.useProfilerStats();
|
|
13
|
+
const clearSurfaceProfiler = Surface.useProfilerClear();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<StatsPanel
|
|
17
|
+
stats={stats}
|
|
18
|
+
surfaceProfilerStats={surfaceProfilerStats}
|
|
19
|
+
onRefresh={refreshStats}
|
|
20
|
+
onClearSurfaceProfiler={clearSurfaceProfiler}
|
|
21
|
+
>
|
|
22
|
+
<Surface.Surface role='devtools-overview' />
|
|
23
|
+
</StatsPanel>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
+
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
+
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
12
|
+
import { Sketch } from '@dxos/plugin-sketch/types';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
14
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
15
|
+
import { IconButton, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
16
|
+
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
|
+
import { Organization, Person, Task } from '@dxos/types';
|
|
18
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
19
|
+
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
20
|
+
|
|
21
|
+
import { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';
|
|
22
|
+
|
|
23
|
+
export type SpaceGeneratorProps = {
|
|
24
|
+
space: Space;
|
|
25
|
+
onCreateObjects?: (objects: Obj.Unknown[]) => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
|
|
29
|
+
({ space, onCreateObjects, children, ...props }, forwardedRef) => {
|
|
30
|
+
const { invokePromise } = useOperationInvoker();
|
|
31
|
+
const client = useClient();
|
|
32
|
+
const staticTypes = [Markdown.Document, Sketch.Sketch, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
+
const recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];
|
|
34
|
+
const [count, setCount] = useState(1);
|
|
35
|
+
const [info, setInfo] = useState<any>({});
|
|
36
|
+
const presets = useMemo(() => generator(), []);
|
|
37
|
+
|
|
38
|
+
// Register types.
|
|
39
|
+
useAsyncEffect(async () => {
|
|
40
|
+
await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
|
+
}, [client]);
|
|
42
|
+
|
|
43
|
+
// Create type generators.
|
|
44
|
+
const typeMap = useMemo(() => {
|
|
45
|
+
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
46
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
50
|
+
}, [client, recordTypes, invokePromise]);
|
|
51
|
+
|
|
52
|
+
// Query space to get info.
|
|
53
|
+
const updateInfo = async () => {
|
|
54
|
+
// Create schema map.
|
|
55
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
56
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
57
|
+
|
|
58
|
+
// Create object map.
|
|
59
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
60
|
+
const objectMap = sortKeys(
|
|
61
|
+
objects.reduce<Record<string, number>>((map, obj) => {
|
|
62
|
+
const type = Obj.getTypename(obj);
|
|
63
|
+
if (type) {
|
|
64
|
+
const count = map[type] ?? 0;
|
|
65
|
+
map[type] = count + 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return map;
|
|
69
|
+
}, {}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
setInfo({
|
|
73
|
+
schema: {
|
|
74
|
+
static: staticSchema.length,
|
|
75
|
+
mutable: echoSchema.length,
|
|
76
|
+
},
|
|
77
|
+
objects: objectMap,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
useAsyncEffect(updateInfo, [space]);
|
|
82
|
+
|
|
83
|
+
const handleCreateData = useCallback(
|
|
84
|
+
async (typename: string) => {
|
|
85
|
+
const constructor = typeMap.get(typename);
|
|
86
|
+
if (constructor) {
|
|
87
|
+
// TODO(burdon): Input to specify number of objects.
|
|
88
|
+
await constructor(space, count, onCreateObjects);
|
|
89
|
+
await updateInfo();
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
[typeMap, count],
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Panel.Root {...composableProps(props)} ref={forwardedRef}>
|
|
97
|
+
<Panel.Toolbar asChild>
|
|
98
|
+
<Toolbar.Root>
|
|
99
|
+
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
100
|
+
<Toolbar.Separator />
|
|
101
|
+
<Input.Root>
|
|
102
|
+
<Input.TextInput
|
|
103
|
+
type='number'
|
|
104
|
+
placeholder='Count'
|
|
105
|
+
classNames='w-[4rem] text-right'
|
|
106
|
+
min={1}
|
|
107
|
+
max={100}
|
|
108
|
+
size={8}
|
|
109
|
+
value={count}
|
|
110
|
+
onChange={(event) => setCount(parseInt(event.target.value))}
|
|
111
|
+
/>
|
|
112
|
+
</Input.Root>
|
|
113
|
+
</Toolbar.Root>
|
|
114
|
+
</Panel.Toolbar>
|
|
115
|
+
<Panel.Content asChild>
|
|
116
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
117
|
+
<ScrollArea.Viewport classNames='gap-4 divide-y divide-subdued-separator'>
|
|
118
|
+
<SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
|
|
119
|
+
<SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
|
|
120
|
+
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
121
|
+
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
122
|
+
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|
|
123
|
+
</SyntaxHighlighter>
|
|
124
|
+
</ScrollArea.Viewport>
|
|
125
|
+
</ScrollArea.Root>
|
|
126
|
+
</Panel.Content>
|
|
127
|
+
</Panel.Root>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
);
|
|
@@ -23,14 +23,14 @@ export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
|
|
|
23
23
|
const { width, height, ref } = useResizeDetector();
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div ref={ref} className={mx('relative grow min-
|
|
26
|
+
<div ref={ref} className={mx('relative grow min-h-96', classNames)} {...attentionAttrs}>
|
|
27
27
|
<div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>
|
|
28
28
|
<div className='flex justify-between'>
|
|
29
29
|
<div>{label}</div>
|
|
30
30
|
<div>{`[${width}x${height}]`}</div>
|
|
31
31
|
</div>
|
|
32
32
|
{object && (
|
|
33
|
-
<SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
|
|
33
|
+
<SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded-sm'>
|
|
34
34
|
{JSON.stringify(object, undefined, 2)}
|
|
35
35
|
</SyntaxHighlighter>
|
|
36
36
|
)}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const DebugGraph: ComponentType<any> = lazy(() => import('./DebugGraph'));
|
|
8
|
+
export const DebugObjectPanel: ComponentType<any> = lazy(() => import('./DebugObjectPanel'));
|
|
9
|
+
export const DebugStatus: ComponentType<any> = lazy(() => import('./DebugStatus'));
|
|
10
|
+
export const DevtoolsOverviewContainer: ComponentType<any> = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
11
|
+
export const SpaceGenerator: ComponentType<any> = lazy(() => import('./SpaceGenerator'));
|
|
12
|
+
export const Wireframe: ComponentType<any> = lazy(() => import('./Wireframe'));
|
|
13
|
+
export const DebugSpaceObjectsPanel: ComponentType<any> = lazy(() => import('./DebugSpaceObjectsPanel'));
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.debug',
|
|
10
10
|
name: 'Debug',
|
|
11
11
|
description: trim`
|
|
12
12
|
Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
|
package/src/translations.ts
CHANGED
|
@@ -4,70 +4,78 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'settings
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'debug
|
|
21
|
-
|
|
22
|
-
'settings
|
|
23
|
-
'settings
|
|
24
|
-
'settings
|
|
25
|
-
'settings
|
|
26
|
-
'settings
|
|
27
|
-
'settings
|
|
28
|
-
|
|
29
|
-
'settings
|
|
30
|
-
'settings
|
|
31
|
-
'settings
|
|
32
|
-
'settings
|
|
33
|
-
'settings
|
|
34
|
-
'settings
|
|
35
|
-
|
|
13
|
+
'plugin.name': 'Debug',
|
|
14
|
+
'settings.title': 'Debug settings',
|
|
15
|
+
'open-devtools.label': 'Open DevTools',
|
|
16
|
+
'devtools.label': 'DevTools',
|
|
17
|
+
'devtools-overview.label': 'Stats',
|
|
18
|
+
'space-objects.label': 'Database',
|
|
19
|
+
'debug.label': 'Debug',
|
|
20
|
+
'debug-app-graph.label': 'App Graph',
|
|
21
|
+
|
|
22
|
+
'settings.wireframe.label': 'Show wireframes.',
|
|
23
|
+
'settings.wireframe.description': 'Overlay wireframe outlines on UI components for debugging layout.',
|
|
24
|
+
'settings.repair.label': 'Run repair tool.',
|
|
25
|
+
'settings.repair.description': 'Attempt to detect and fix inconsistencies in local data storage.',
|
|
26
|
+
'settings.download-diagnostics.label': 'Download diagnostics.',
|
|
27
|
+
'settings.download-diagnostics.description':
|
|
28
|
+
'Export a JSON file containing client diagnostics for troubleshooting.',
|
|
29
|
+
'settings.download-logs.label': 'Download log buffer.',
|
|
30
|
+
'settings.download-logs.description': 'Export the in-memory log buffer as an NDJSON file.',
|
|
31
|
+
'settings.uploaded.message': 'Settings uploaded.',
|
|
32
|
+
'settings.uploaded.description': 'URL copied to clipboard.',
|
|
33
|
+
'settings.choose-storage-adaptor.label': 'Storage adaptor (worker reload required).',
|
|
34
|
+
'settings.choose-storage-adaptor.description':
|
|
35
|
+
'Select the browser storage backend. Changing this requires a worker reload and may make existing data unavailable.',
|
|
36
|
+
'settings.repair-success.message': 'Repair succeeded',
|
|
37
|
+
'settings.repair-failed.message': 'Repair failed',
|
|
38
|
+
|
|
39
|
+
'settings.storage-adaptor.idb.label': 'IndexedDB',
|
|
40
|
+
'settings.storage-adaptor.opfs.label': 'OPFS',
|
|
41
|
+
'settings.storage-adapter.changed-alert.message':
|
|
36
42
|
'Warning: Swapping the storage adapter will make your data unavailable.',
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
43
|
+
|
|
44
|
+
'settings.data-store.label': 'Data Store',
|
|
45
|
+
|
|
46
|
+
'open-debug-panel.label': 'Show Debug',
|
|
47
|
+
'client.label': 'Client',
|
|
48
|
+
'config.label': 'Config',
|
|
49
|
+
'storage.label': 'Storage',
|
|
50
|
+
'logs.label': 'Logs',
|
|
51
|
+
'diagnostics.label': 'Diagnostics',
|
|
52
|
+
'tracing.label': 'Tracing',
|
|
53
|
+
'halo.label': 'HALO',
|
|
54
|
+
'identity.label': 'Identity',
|
|
55
|
+
'devices.label': 'Devices',
|
|
56
|
+
'keyring.label': 'Keyring',
|
|
57
|
+
'credentials.label': 'Credentials',
|
|
58
|
+
'echo.label': 'ECHO',
|
|
59
|
+
'spaces.label': 'Spaces',
|
|
60
|
+
'space.label': 'Space',
|
|
61
|
+
'feeds.label': 'Feeds',
|
|
62
|
+
'objects.label': 'Objects',
|
|
63
|
+
'schema.label': 'Schema',
|
|
64
|
+
'automerge.label': 'Automerge',
|
|
65
|
+
'queues.label': 'Queues',
|
|
66
|
+
'members.label': 'Members',
|
|
67
|
+
'metadata.label': 'Metadata',
|
|
68
|
+
'mesh.label': 'MESH',
|
|
69
|
+
'signal.label': 'Signal',
|
|
70
|
+
'swarm.label': 'Swarm',
|
|
71
|
+
'network.label': 'Network',
|
|
72
|
+
'agent.label': 'Agent',
|
|
73
|
+
'dashboard.label': 'Dashboard',
|
|
74
|
+
'search.label': 'Search',
|
|
75
|
+
'edge.label': 'EDGE',
|
|
76
|
+
'workflows.label': 'Workflows',
|
|
77
|
+
'traces.label': 'Traces',
|
|
78
|
+
'testing.label': 'Testing',
|
|
71
79
|
},
|
|
72
80
|
},
|
|
73
81
|
},
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
export const Settings = Schema.mutable(
|
|
10
|
+
Schema.Struct({
|
|
11
|
+
wireframe: Schema.optional(Schema.Boolean),
|
|
12
|
+
}),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export type Settings = Schema.Schema.Type<typeof Settings>;
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
6
|
import { type Context, createContext } from 'react';
|
|
8
7
|
|
|
9
8
|
import { Capability } from '@dxos/app-framework';
|
|
10
9
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
11
10
|
|
|
12
|
-
import { meta } from '
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import * as Settings from './Settings';
|
|
14
|
+
|
|
15
|
+
export * as Settings from './Settings';
|
|
13
16
|
|
|
14
17
|
export type DebugContextType = {
|
|
15
18
|
running: boolean;
|
|
@@ -23,21 +26,12 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
|
|
|
23
26
|
stop: () => {},
|
|
24
27
|
});
|
|
25
28
|
|
|
26
|
-
export const DebugSettingsSchema = Schema.mutable(
|
|
27
|
-
Schema.Struct({
|
|
28
|
-
wireframe: Schema.optional(Schema.Boolean),
|
|
29
|
-
}),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
33
|
-
|
|
34
29
|
export namespace DebugCapabilities {
|
|
35
|
-
export const Settings = Capability.make<Atom.Writable<
|
|
30
|
+
export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.id}.capability.settings`);
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
export namespace Devtools {
|
|
39
|
-
|
|
40
|
-
export const id = 'dxos.org.plugin.debug.devtools';
|
|
34
|
+
export const id = `${meta.id}.devtools`;
|
|
41
35
|
|
|
42
36
|
export namespace Client {
|
|
43
37
|
export const id = `${Devtools.id}.client`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/components/DebugGraph.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Tree } from "@dxos/devtools";
|
|
4
|
-
import { Graph } from "@dxos/plugin-graph";
|
|
5
|
-
var DebugGraph = ({ graph, root }) => {
|
|
6
|
-
return /* @__PURE__ */ React.createElement(Tree, {
|
|
7
|
-
data: Graph.toJSON(graph, root)
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var DebugGraph_default = DebugGraph;
|
|
11
|
-
export {
|
|
12
|
-
DebugGraph,
|
|
13
|
-
DebugGraph_default as default
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=DebugGraph-6VMEOKEV.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 { Graph } from '@dxos/plugin-graph';\n\nexport type DebugGraphProps = { graph: Graph.Graph; root: string };\nexport const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {\n return <Tree data={Graph.toJSON(graph, root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AACrB,SAASC,aAAa;AAGf,IAAMC,aAAkC,CAAC,EAAEC,OAAOC,KAAI,MAAE;AAC7D,SAAO,sBAAA,cAACC,MAAAA;IAAKC,MAAMC,MAAMC,OAAOL,OAAOC,IAAAA;;AACzC;AAEA,IAAA,qBAAeF;",
|
|
6
|
-
"names": ["React", "Tree", "Graph", "DebugGraph", "graph", "root", "Tree", "data", "Graph", "toJSON"]
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
4
|
-
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
5
|
-
var DevtoolsOverviewContainer = () => {
|
|
6
|
-
const [stats, refreshStats] = useStats();
|
|
7
|
-
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
8
|
-
stats,
|
|
9
|
-
onRefresh: refreshStats
|
|
10
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
11
|
-
role: "devtools-overview"
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
15
|
-
export {
|
|
16
|
-
DevtoolsOverviewContainer,
|
|
17
|
-
DevtoolsOverviewContainer_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-77PKFLYV.mjs.map
|