@dxos/plugin-debug 0.8.3 → 0.8.4-main.1c7ec43d41
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 +19 -123
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +81 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +4 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/DebugPlugin.node.d.ts +5 -0
- package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.test.d.ts +2 -0
- package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +8 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +4 -2
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +7 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- 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 +99 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +2 -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 +6 -4
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.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 +5 -8
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -9
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -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 +2 -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 +2 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +2 -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/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +83 -60
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +8 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +69 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +99 -73
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +30 -37
- package/src/capabilities/app-graph-builder.ts +361 -413
- package/src/capabilities/index.ts +5 -5
- package/src/capabilities/react-context.tsx +16 -7
- package/src/capabilities/react-surface.tsx +381 -339
- package/src/capabilities/settings.ts +24 -12
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +262 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +44 -46
- package/src/components/SpaceGenerator/draw-util.ts +13 -13
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +527 -263
- package/src/components/index.ts +4 -8
- package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
- package/src/containers/DebugGraph/index.ts +5 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
- package/src/containers/DebugObjectPanel/index.ts +5 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +43 -21
- package/src/containers/DebugStatus/index.ts +5 -0
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
- package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
- package/src/containers/SpaceGenerator/index.ts +5 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +8 -12
- package/src/containers/Wireframe/index.ts +5 -0
- package/src/containers/index.ts +13 -0
- package/src/index.ts +7 -1
- package/src/meta.ts +8 -7
- package/src/translations.ts +80 -59
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +20 -11
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +0 -225
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs +0 -1238
- package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs +0 -597
- package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs.map +0 -7
- package/dist/lib/browser/chunk-47JOZTT2.mjs +0 -18
- package/dist/lib/browser/chunk-47JOZTT2.mjs.map +0 -7
- package/dist/lib/browser/chunk-KS3YBEL7.mjs +0 -68
- package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +0 -7
- package/dist/lib/browser/react-context-ZQRD2WG2.mjs +0 -16
- package/dist/lib/browser/react-context-ZQRD2WG2.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UI6OK73H.mjs +0 -768
- package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
- package/dist/lib/browser/settings-SXQWSIM4.mjs +0 -22
- package/dist/lib/browser/settings-SXQWSIM4.mjs.map +0 -7
- 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/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/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugSettings.d.ts +0 -6
- 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.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -6
- 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 -63
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/components/Container.tsx +0 -15
- 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/src/components/DebugObjectPanel.tsx +0 -35
- package/src/components/DebugSettings.tsx +0 -151
- package/src/components/DevtoolsOverviewContainer.tsx +0 -20
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -179
- /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/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
package/src/components/index.ts
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
|
-
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
7
|
+
export const DebugSettings: ComponentType<any> = lazy(() => import('./DebugSettings'));
|
|
10
8
|
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './DebugStatus';
|
|
14
|
-
export * from './Wireframe';
|
|
9
|
+
export * from './SchemaTable';
|
|
10
|
+
export * from './SpaceGenerator';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree } from '@dxos/devtools';
|
|
8
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
9
|
+
|
|
10
|
+
export type DebugGraphProps = { graph: Graph.Graph; root: string };
|
|
11
|
+
|
|
12
|
+
export const DebugGraph = ({ graph, root }: DebugGraphProps) => {
|
|
13
|
+
return <Tree data={Graph.toJSON(graph, root)} />;
|
|
14
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { ObjectsTree } from '@dxos/devtools';
|
|
9
|
+
import { Filter, Json, Obj, Query } from '@dxos/echo';
|
|
10
|
+
import type { ObjectId } from '@dxos/keys';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { Syntax } from '@dxos/react-ui-syntax-highlighter';
|
|
14
|
+
import { mx } from '@dxos/ui-theme';
|
|
15
|
+
|
|
16
|
+
export type DebugObjectPanelProps = Pick<
|
|
17
|
+
AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
|
|
18
|
+
'role' | 'companionTo'
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
|
|
22
|
+
const db = Obj.getDatabase(companionTo);
|
|
23
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
24
|
+
const [depth, setDepth] = useState(0);
|
|
25
|
+
const [selectedObject] = useQuery(
|
|
26
|
+
db,
|
|
27
|
+
Query.select(Filter.id(selectedId ?? companionTo.id)).options({ deleted: 'include' }),
|
|
28
|
+
);
|
|
29
|
+
const refReplacer = useMemo(() => (db ? Json.createRefReplacer({ db, depth }) : undefined), [db, depth]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Clipboard.Provider>
|
|
33
|
+
<Panel.Root role={role}>
|
|
34
|
+
<Panel.Toolbar asChild>
|
|
35
|
+
<Toolbar.Root />
|
|
36
|
+
</Panel.Toolbar>
|
|
37
|
+
<Panel.Content asChild>
|
|
38
|
+
<div role='none' className={mx('grid divide-y divide-separator', db && 'grid-rows-[1fr_2fr]')}>
|
|
39
|
+
{db && (
|
|
40
|
+
<ScrollArea.Root>
|
|
41
|
+
<ScrollArea.Viewport>
|
|
42
|
+
<ObjectsTree db={db} root={companionTo} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
43
|
+
</ScrollArea.Viewport>
|
|
44
|
+
</ScrollArea.Root>
|
|
45
|
+
)}
|
|
46
|
+
<Syntax.Root data={selectedObject} replacer={refReplacer}>
|
|
47
|
+
<Panel.Root>
|
|
48
|
+
<Panel.Toolbar asChild>
|
|
49
|
+
<Toolbar.Root classNames='grid grid-cols-[1fr_3rem]'>
|
|
50
|
+
<Syntax.Filter />
|
|
51
|
+
<Input.Root>
|
|
52
|
+
<Input.TextInput
|
|
53
|
+
variant='subdued'
|
|
54
|
+
type='number'
|
|
55
|
+
min={0}
|
|
56
|
+
step={1}
|
|
57
|
+
aria-label='Ref depth'
|
|
58
|
+
value={depth}
|
|
59
|
+
onChange={(event) => setDepth(Math.max(0, Number(event.target.value) || 0))}
|
|
60
|
+
/>
|
|
61
|
+
</Input.Root>
|
|
62
|
+
</Toolbar.Root>
|
|
63
|
+
</Panel.Toolbar>
|
|
64
|
+
<Panel.Content asChild>
|
|
65
|
+
<Syntax.Viewport>
|
|
66
|
+
<Syntax.Code />
|
|
67
|
+
</Syntax.Viewport>
|
|
68
|
+
</Panel.Content>
|
|
69
|
+
</Panel.Root>
|
|
70
|
+
</Syntax.Root>
|
|
71
|
+
</div>
|
|
72
|
+
</Panel.Content>
|
|
73
|
+
</Panel.Root>
|
|
74
|
+
</Clipboard.Provider>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { ObjectsTree } from '@dxos/devtools';
|
|
9
|
+
import { Filter, Query } from '@dxos/echo';
|
|
10
|
+
import { type ObjectId } from '@dxos/keys';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
14
|
+
|
|
15
|
+
export type DebugSpaceObjectsPanelProps = AppSurface.SpaceArticleProps;
|
|
16
|
+
|
|
17
|
+
export const DebugSpaceObjectsPanel = ({ space }: DebugSpaceObjectsPanelProps) => {
|
|
18
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
19
|
+
const [selectedObject] = useQuery(
|
|
20
|
+
space.db,
|
|
21
|
+
selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Clipboard.Provider>
|
|
26
|
+
<Panel.Root>
|
|
27
|
+
<Panel.Toolbar asChild>
|
|
28
|
+
<Toolbar.Root>
|
|
29
|
+
<Input.Root>
|
|
30
|
+
<Input.TextInput disabled placeholder='Search...' />
|
|
31
|
+
</Input.Root>
|
|
32
|
+
</Toolbar.Root>
|
|
33
|
+
</Panel.Toolbar>
|
|
34
|
+
<Panel.Content asChild>
|
|
35
|
+
<Grid rows={2} classNames='divide-y divide-separator'>
|
|
36
|
+
<ScrollArea.Root>
|
|
37
|
+
<ScrollArea.Viewport>
|
|
38
|
+
<ObjectsTree db={space.db} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
39
|
+
</ScrollArea.Viewport>
|
|
40
|
+
</ScrollArea.Root>
|
|
41
|
+
{selectedObject && <JsonHighlighter classNames='p-1' data={selectedObject} />}
|
|
42
|
+
</Grid>
|
|
43
|
+
</Panel.Content>
|
|
44
|
+
</Panel.Root>
|
|
45
|
+
</Clipboard.Provider>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { TimeoutError } from '@dxos/async';
|
|
8
|
-
import {
|
|
9
|
-
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
8
|
+
import { StatusBar } from '@dxos/plugin-status-bar/components';
|
|
10
9
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
10
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
12
|
-
import {
|
|
11
|
+
import { IconButton } from '@dxos/react-ui';
|
|
13
12
|
|
|
14
13
|
const styles = {
|
|
15
14
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -59,7 +58,7 @@ const _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: numbe
|
|
|
59
58
|
// TODO(burdon): Integrate with Sentry?
|
|
60
59
|
const ErrorIndicator = () => {
|
|
61
60
|
const [, forceUpdate] = useState({});
|
|
62
|
-
const errorRef = useRef<Error>();
|
|
61
|
+
const errorRef = useRef<Error>(null);
|
|
63
62
|
useEffect(() => {
|
|
64
63
|
const errorListener = (event: any) => {
|
|
65
64
|
const error: Error = event.error ?? event.reason;
|
|
@@ -83,20 +82,26 @@ const ErrorIndicator = () => {
|
|
|
83
82
|
}, []);
|
|
84
83
|
|
|
85
84
|
const handleReset = () => {
|
|
86
|
-
errorRef.current =
|
|
85
|
+
errorRef.current = null;
|
|
87
86
|
forceUpdate({});
|
|
88
87
|
};
|
|
89
88
|
|
|
90
89
|
if (errorRef.current) {
|
|
91
90
|
return (
|
|
92
|
-
<StatusBar.
|
|
93
|
-
<
|
|
94
|
-
|
|
91
|
+
<StatusBar.Item>
|
|
92
|
+
<IconButton
|
|
93
|
+
icon='ph--warning-circle--duotone'
|
|
94
|
+
iconOnly
|
|
95
|
+
label={errorRef.current.message}
|
|
96
|
+
classNames={styles.error}
|
|
97
|
+
onClick={handleReset}
|
|
98
|
+
/>
|
|
99
|
+
</StatusBar.Item>
|
|
95
100
|
);
|
|
96
101
|
} else {
|
|
97
102
|
return (
|
|
98
|
-
<StatusBar.Item
|
|
99
|
-
<
|
|
103
|
+
<StatusBar.Item>
|
|
104
|
+
<IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />
|
|
100
105
|
</StatusBar.Item>
|
|
101
106
|
);
|
|
102
107
|
}
|
|
@@ -114,14 +119,20 @@ const SwarmIndicator = () => {
|
|
|
114
119
|
|
|
115
120
|
if (state === 0) {
|
|
116
121
|
return (
|
|
117
|
-
<StatusBar.Item
|
|
118
|
-
<
|
|
122
|
+
<StatusBar.Item>
|
|
123
|
+
<IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />
|
|
119
124
|
</StatusBar.Item>
|
|
120
125
|
);
|
|
121
126
|
} else {
|
|
122
127
|
return (
|
|
123
|
-
<StatusBar.Item
|
|
124
|
-
<
|
|
128
|
+
<StatusBar.Item>
|
|
129
|
+
<IconButton
|
|
130
|
+
variant='ghost'
|
|
131
|
+
icon='ph--lightning-slash--regular'
|
|
132
|
+
iconOnly
|
|
133
|
+
label='Disconnected from swarm.'
|
|
134
|
+
classNames={styles.warning}
|
|
135
|
+
/>
|
|
125
136
|
</StatusBar.Item>
|
|
126
137
|
);
|
|
127
138
|
}
|
|
@@ -133,7 +144,6 @@ const SwarmIndicator = () => {
|
|
|
133
144
|
// TODO(burdon): Merge with SaveStatus.
|
|
134
145
|
const SavingIndicator = () => {
|
|
135
146
|
const [state, _setState] = useState(0);
|
|
136
|
-
const _space = useActiveSpace();
|
|
137
147
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
138
148
|
// useEffect(() => {
|
|
139
149
|
// if (!space) {
|
|
@@ -156,21 +166,33 @@ const SavingIndicator = () => {
|
|
|
156
166
|
switch (state) {
|
|
157
167
|
case 2:
|
|
158
168
|
return (
|
|
159
|
-
<StatusBar.Item
|
|
160
|
-
<
|
|
169
|
+
<StatusBar.Item>
|
|
170
|
+
<IconButton
|
|
171
|
+
variant='ghost'
|
|
172
|
+
icon='ph--circle--duotone'
|
|
173
|
+
iconOnly
|
|
174
|
+
label='Edit not saved.'
|
|
175
|
+
classNames={styles.warning}
|
|
176
|
+
/>
|
|
161
177
|
</StatusBar.Item>
|
|
162
178
|
);
|
|
163
179
|
case 1:
|
|
164
180
|
return (
|
|
165
|
-
<StatusBar.Item
|
|
166
|
-
<
|
|
181
|
+
<StatusBar.Item>
|
|
182
|
+
<IconButton
|
|
183
|
+
variant='ghost'
|
|
184
|
+
icon='ph--circle--duotone'
|
|
185
|
+
iconOnly
|
|
186
|
+
label='Saving...'
|
|
187
|
+
classNames={styles.success}
|
|
188
|
+
/>
|
|
167
189
|
</StatusBar.Item>
|
|
168
190
|
);
|
|
169
191
|
case 0:
|
|
170
192
|
default:
|
|
171
193
|
return (
|
|
172
|
-
<StatusBar.Item
|
|
173
|
-
<
|
|
194
|
+
<StatusBar.Item>
|
|
195
|
+
<IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />
|
|
174
196
|
</StatusBar.Item>
|
|
175
197
|
);
|
|
176
198
|
}
|
|
@@ -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,126 @@
|
|
|
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 { Organization, Person, Task } from '@dxos/types';
|
|
17
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
18
|
+
import { sortKeys } from '@dxos/util';
|
|
19
|
+
|
|
20
|
+
import { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';
|
|
21
|
+
|
|
22
|
+
// TODO(burdon): Make extensible.
|
|
23
|
+
const staticTypes = [Markdown.Document, Sketch.Sketch, Sheet.Sheet, ComputeGraph];
|
|
24
|
+
const recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];
|
|
25
|
+
|
|
26
|
+
export type SpaceGeneratorProps = {
|
|
27
|
+
space: Space;
|
|
28
|
+
onCreateObjects?: (objects: Obj.Unknown[]) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
|
|
32
|
+
({ space, onCreateObjects, children, ...props }, forwardedRef) => {
|
|
33
|
+
const { invokePromise } = useOperationInvoker();
|
|
34
|
+
const client = useClient();
|
|
35
|
+
const [count, setCount] = useState(1);
|
|
36
|
+
const [info, setInfo] = useState<any>({});
|
|
37
|
+
const presets = useMemo(() => generator(), []);
|
|
38
|
+
|
|
39
|
+
// Register types.
|
|
40
|
+
useAsyncEffect(async () => {
|
|
41
|
+
await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
42
|
+
}, [client, presets]);
|
|
43
|
+
|
|
44
|
+
// Create type generators.
|
|
45
|
+
const typeMap = useMemo(() => {
|
|
46
|
+
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
47
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
51
|
+
}, [client, invokePromise, presets]);
|
|
52
|
+
|
|
53
|
+
// Query space to get info.
|
|
54
|
+
const updateInfo = useCallback(async () => {
|
|
55
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
56
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
57
|
+
|
|
58
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
59
|
+
const objectMap = sortKeys(
|
|
60
|
+
objects.reduce<Record<string, number>>((map, obj) => {
|
|
61
|
+
const type = Obj.getTypename(obj);
|
|
62
|
+
if (type) {
|
|
63
|
+
const count = map[type] ?? 0;
|
|
64
|
+
map[type] = count + 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return map;
|
|
68
|
+
}, {}),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
setInfo({
|
|
72
|
+
schema: {
|
|
73
|
+
static: staticSchema.length,
|
|
74
|
+
mutable: echoSchema.length,
|
|
75
|
+
},
|
|
76
|
+
objects: objectMap,
|
|
77
|
+
});
|
|
78
|
+
}, [space]);
|
|
79
|
+
|
|
80
|
+
useAsyncEffect(updateInfo, [updateInfo]);
|
|
81
|
+
|
|
82
|
+
const handleCreateData = useCallback(
|
|
83
|
+
async (typename: string) => {
|
|
84
|
+
const constructor = typeMap.get(typename);
|
|
85
|
+
if (constructor) {
|
|
86
|
+
// TODO(burdon): Input to specify number of objects.
|
|
87
|
+
await constructor(space, count, onCreateObjects);
|
|
88
|
+
await updateInfo();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[typeMap, count, space, onCreateObjects, updateInfo],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Panel.Root {...composableProps(props)} ref={forwardedRef}>
|
|
96
|
+
<Panel.Toolbar asChild>
|
|
97
|
+
<Toolbar.Root>
|
|
98
|
+
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
99
|
+
<Toolbar.Separator />
|
|
100
|
+
<Input.Root>
|
|
101
|
+
<Input.TextInput
|
|
102
|
+
type='number'
|
|
103
|
+
placeholder='Count'
|
|
104
|
+
classNames='w-[4rem] text-right'
|
|
105
|
+
min={1}
|
|
106
|
+
max={100}
|
|
107
|
+
size={8}
|
|
108
|
+
value={count}
|
|
109
|
+
onChange={(event) => setCount(parseInt(event.target.value))}
|
|
110
|
+
/>
|
|
111
|
+
</Input.Root>
|
|
112
|
+
</Toolbar.Root>
|
|
113
|
+
</Panel.Toolbar>
|
|
114
|
+
<Panel.Content asChild>
|
|
115
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
116
|
+
<ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-subdued-separator'>
|
|
117
|
+
<SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
|
|
118
|
+
<SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
|
|
119
|
+
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
120
|
+
</ScrollArea.Viewport>
|
|
121
|
+
</ScrollArea.Root>
|
|
122
|
+
</Panel.Content>
|
|
123
|
+
</Panel.Root>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
);
|
|
@@ -5,35 +5,31 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useResizeDetector } from 'react-resize-detector';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
10
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
12
|
-
import {
|
|
13
|
-
import { mx } from '@dxos/
|
|
11
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
14
13
|
|
|
15
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
16
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
|
+
object: Obj.Unknown;
|
|
17
17
|
label?: string;
|
|
18
|
-
object: Obj.Any;
|
|
19
18
|
}>;
|
|
20
19
|
|
|
21
20
|
// TODO(burdon): Make focusable and attendable with input.
|
|
22
21
|
export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
|
|
23
|
-
const attentionAttrs = useAttentionAttributes(
|
|
22
|
+
const attentionAttrs = useAttentionAttributes(Obj.getDXN(object).toString());
|
|
24
23
|
const { width, height, ref } = useResizeDetector();
|
|
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
|
-
{object &&
|
|
33
|
-
<SyntaxHighlighter language='json' classNames='flex w-full text-xs opacity-75 rounded'>
|
|
34
|
-
{JSON.stringify(object, undefined, 2)}
|
|
35
|
-
</SyntaxHighlighter>
|
|
36
|
-
)}
|
|
32
|
+
{object && <JsonHighlighter data={object} classNames='text-xs opacity-75 rounded-sm' />}
|
|
37
33
|
</div>
|
|
38
34
|
<svg width={width} height={height} className='bg-transparent *:text-subdued'>
|
|
39
35
|
<rect x={0} y={0} width={width} height={height} strokeWidth={1} fill='none' />
|
|
@@ -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/index.ts
CHANGED
|
@@ -2,5 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const DebugPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
export type { DebugPluginOptions } from '#types';
|
|
11
|
+
|
|
6
12
|
export * from './meta';
|
package/src/meta.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: DEBUG_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.debug',
|
|
11
10
|
name: 'Debug',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
|
|
13
|
+
Inspect objects, monitor events, and debug plugin behavior in real-time.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--bug--regular',
|
|
15
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
|
|
16
17
|
screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
|