@dxos/plugin-debug 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef
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 -118
- 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 +3 -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 +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -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 +7 -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 +97 -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 +2 -2
- 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.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/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/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- 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/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/translations.d.ts +78 -59
- 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 +89 -70
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +20 -11
- package/src/capabilities/app-graph-builder.ts +405 -0
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/react-context.tsx +25 -0
- package/src/capabilities/react-surface.tsx +439 -0
- 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 +262 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +14 -15
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +53 -73
- package/src/components/index.ts +4 -11
- package/src/{components → containers/DebugGraph}/DebugGraph.tsx +3 -4
- 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 +41 -19
- 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 +3 -7
- 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 +1 -1
- package/src/translations.ts +75 -58
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +15 -14
- 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 +0 -9
- package/dist/types/src/components/DebugGraph.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 -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/react-surface/react-surface.tsx +0 -409
- 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,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
|
+
);
|
|
@@ -8,7 +8,7 @@ import { useResizeDetector } from 'react-resize-detector';
|
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
11
|
-
import {
|
|
11
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
12
|
import { mx } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
@@ -23,17 +23,13 @@ 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
|
-
{object &&
|
|
33
|
-
<SyntaxHighlighter language='json' classNames='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
|
@@ -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
|
@@ -3,71 +3,88 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as introspectTranslations } from '@dxos/react-ui-introspect/translations';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
8
9
|
|
|
9
10
|
export const translations = [
|
|
11
|
+
...introspectTranslations,
|
|
10
12
|
{
|
|
11
13
|
'en-US': {
|
|
12
14
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'settings
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'debug
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
'settings
|
|
25
|
-
'settings
|
|
26
|
-
'settings
|
|
27
|
-
'settings
|
|
28
|
-
|
|
29
|
-
'settings
|
|
30
|
-
'settings
|
|
31
|
-
'settings
|
|
32
|
-
'settings
|
|
33
|
-
'settings
|
|
34
|
-
'settings
|
|
35
|
-
|
|
15
|
+
'plugin.name': 'Debug',
|
|
16
|
+
'settings.title': 'Debug settings',
|
|
17
|
+
'open-devtools.label': 'Open DevTools',
|
|
18
|
+
'devtools.label': 'DevTools',
|
|
19
|
+
'devtools-overview.label': 'Stats',
|
|
20
|
+
'space-objects.label': 'Database',
|
|
21
|
+
'debug.label': 'Debug',
|
|
22
|
+
'generate-objects.label': 'Generate Objects',
|
|
23
|
+
'debug-app-graph.label': 'App Graph',
|
|
24
|
+
'debug-tools-explorer.label': 'Tools Explorer',
|
|
25
|
+
|
|
26
|
+
'settings.wireframe.label': 'Show wireframes.',
|
|
27
|
+
'settings.wireframe.description': 'Overlay wireframe outlines on UI components for debugging layout.',
|
|
28
|
+
'settings.trace-all.label': 'Trace all requests (100% sampling).',
|
|
29
|
+
'settings.trace-all.description':
|
|
30
|
+
'Override the default 30% sampling rate to capture all traces. Requires page reload to take effect.',
|
|
31
|
+
'settings.tracing-panel.label': 'Open tracing panel.',
|
|
32
|
+
'settings.tracing-panel.description': 'Open the tracing dashboard to inspect captured spans.',
|
|
33
|
+
'settings.repair.label': 'Run repair tool.',
|
|
34
|
+
'settings.repair.description': 'Attempt to detect and fix inconsistencies in local data storage.',
|
|
35
|
+
'settings.download-diagnostics.label': 'Download diagnostics.',
|
|
36
|
+
'settings.download-diagnostics.description':
|
|
37
|
+
'Export a JSON file containing client diagnostics for troubleshooting.',
|
|
38
|
+
'settings.download-logs.label': 'Download log buffer.',
|
|
39
|
+
'settings.download-logs.description': 'Export the in-memory log buffer as an NDJSON file.',
|
|
40
|
+
'settings.uploaded.message': 'Settings uploaded.',
|
|
41
|
+
'settings.uploaded.description': 'URL copied to clipboard.',
|
|
42
|
+
'settings.choose-storage-adaptor.label': 'Storage adaptor (worker reload required).',
|
|
43
|
+
'settings.choose-storage-adaptor.description':
|
|
44
|
+
'Select the browser storage backend. Changing this requires a worker reload and may make existing data unavailable.',
|
|
45
|
+
'settings.repair-success.message': 'Repair succeeded',
|
|
46
|
+
'settings.repair-failed.message': 'Repair failed',
|
|
47
|
+
|
|
48
|
+
'settings.storage-adaptor.idb.label': 'IndexedDB',
|
|
49
|
+
'settings.storage-adaptor.opfs.label': 'OPFS',
|
|
50
|
+
'settings.storage-adapter.changed-alert.message':
|
|
36
51
|
'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
|
-
'
|
|
52
|
+
|
|
53
|
+
'settings.data-store.label': 'Data Store',
|
|
54
|
+
|
|
55
|
+
'open-debug-panel.label': 'Show Debug',
|
|
56
|
+
'client.label': 'Client',
|
|
57
|
+
'config.label': 'Config',
|
|
58
|
+
'storage.label': 'Storage',
|
|
59
|
+
'logs.label': 'Logs',
|
|
60
|
+
'diagnostics.label': 'Diagnostics',
|
|
61
|
+
'tracing.label': 'Tracing',
|
|
62
|
+
'halo.label': 'HALO',
|
|
63
|
+
'identity.label': 'Identity',
|
|
64
|
+
'devices.label': 'Devices',
|
|
65
|
+
'keyring.label': 'Keyring',
|
|
66
|
+
'credentials.label': 'Credentials',
|
|
67
|
+
'echo.label': 'ECHO',
|
|
68
|
+
'spaces.label': 'Spaces',
|
|
69
|
+
'space.label': 'Space',
|
|
70
|
+
'feeds.label': 'Feeds',
|
|
71
|
+
'objects.label': 'Objects',
|
|
72
|
+
'schema.label': 'Schema',
|
|
73
|
+
'automerge.label': 'Automerge',
|
|
74
|
+
'queues.label': 'Queues',
|
|
75
|
+
'members.label': 'Members',
|
|
76
|
+
'metadata.label': 'Metadata',
|
|
77
|
+
'mesh.label': 'MESH',
|
|
78
|
+
'signal.label': 'Signal',
|
|
79
|
+
'swarm.label': 'Swarm',
|
|
80
|
+
'network.label': 'Network',
|
|
81
|
+
'agent.label': 'Agent',
|
|
82
|
+
'dashboard.label': 'Dashboard',
|
|
83
|
+
'search.label': 'Search',
|
|
84
|
+
'edge.label': 'EDGE',
|
|
85
|
+
'workflows.label': 'Workflows',
|
|
86
|
+
'traces.label': 'Traces',
|
|
87
|
+
'testing.label': 'Testing',
|
|
71
88
|
},
|
|
72
89
|
},
|
|
73
90
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
traceAll: Schema.optional(Schema.Boolean),
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
|
@@ -3,13 +3,22 @@
|
|
|
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';
|
|
10
|
+
import { type IdbLogStore } from '@dxos/log-store-idb';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
import * as Settings from './Settings';
|
|
15
|
+
|
|
16
|
+
export * as Settings from './Settings';
|
|
17
|
+
|
|
18
|
+
export type DebugPluginOptions = {
|
|
19
|
+
/** Shared persistent log store for capturing and downloading logs. */
|
|
20
|
+
logStore?: IdbLogStore;
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
export type DebugContextType = {
|
|
15
24
|
running: boolean;
|
|
@@ -23,21 +32,14 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
|
|
|
23
32
|
stop: () => {},
|
|
24
33
|
});
|
|
25
34
|
|
|
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
35
|
export namespace DebugCapabilities {
|
|
35
|
-
export const Settings = Capability.make<Atom.Writable<
|
|
36
|
+
export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.id}.capability.settings`);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export namespace Devtools {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
export const id = `${meta.id}.devtools`;
|
|
41
|
+
|
|
42
|
+
export const ToolsExplorer = `${Devtools.id}.tools-explorer`;
|
|
41
43
|
|
|
42
44
|
export namespace Client {
|
|
43
45
|
export const id = `${Devtools.id}.client`;
|
|
@@ -45,7 +47,6 @@ export namespace Devtools {
|
|
|
45
47
|
export const Storage = `${Devtools.Client.id}.storage`;
|
|
46
48
|
export const Logs = `${Devtools.Client.id}.logs`;
|
|
47
49
|
export const Diagnostics = `${Devtools.Client.id}.diagnostics`;
|
|
48
|
-
export const Tracing = `${Devtools.Client.id}.tracing`;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export namespace Halo {
|
|
@@ -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
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/react';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;AACvC,QAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,SACE,sBAAA,cAACC,YAAAA;IAAWH;IAAcI,WAAWH;KACnC,sBAAA,cAACI,SAAAA;IAAQC,MAAK;;AAGpB;AAEA,IAAA,oCAAeP;",
|
|
6
|
-
"names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
|
|
7
|
-
}
|