@dxos/plugin-debug 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b
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/{DebugApp-HCHR6GKO.mjs → DebugApp-LQHFFK3Y.mjs} +4 -2
- package/dist/lib/browser/{DebugApp-HCHR6GKO.mjs.map → DebugApp-LQHFFK3Y.mjs.map} +3 -3
- package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs → DebugSpace-4JHYA7FG.mjs} +7 -5
- package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs.map → DebugSpace-4JHYA7FG.mjs.map} +3 -3
- package/dist/lib/browser/{SpaceGenerator-Y2NXBQVR.mjs → SpaceGenerator-NJCG57CU.mjs} +7 -5
- package/dist/lib/browser/{SpaceGenerator-Y2NXBQVR.mjs.map → SpaceGenerator-NJCG57CU.mjs.map} +3 -3
- package/dist/lib/browser/app-graph-builder-66ZVNTDI.mjs +182 -0
- package/dist/lib/browser/app-graph-builder-66ZVNTDI.mjs.map +7 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs +21 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6CGQHKET.mjs → chunk-P7GHHMDB.mjs} +1 -1
- package/dist/lib/browser/chunk-P7GHHMDB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +60 -712
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-YF7Y4TZR.mjs +471 -0
- package/dist/lib/browser/react-surface-YF7Y4TZR.mjs.map +7 -0
- package/dist/lib/browser/settings-OIMSBZUC.mjs +25 -0
- package/dist/lib/browser/settings-OIMSBZUC.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +1 -2
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +180 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +0 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -51
- package/src/DebugPlugin.tsx +53 -345
- package/src/capabilities/app-graph-builder.ts +182 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/settings.ts +18 -0
- package/src/components/DebugApp/DebugApp.tsx +1 -1
- package/src/components/DebugSettings.tsx +74 -74
- package/src/components/DebugSpace/DebugSpace.tsx +1 -1
- package/src/components/DebugStatus.tsx +17 -27
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +3 -3
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +1 -1
- package/src/index.ts +1 -4
- package/src/meta.ts +4 -2
- package/src/types.ts +0 -13
- package/dist/lib/browser/chunk-6CGQHKET.mjs.map +0 -7
- package/dist/lib/browser/chunk-CAENAAHY.mjs +0 -18
- package/dist/lib/browser/chunk-CAENAAHY.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/components/DebugSurface.d.ts +0 -9
- package/dist/types/src/components/DebugSurface.d.ts.map +0 -1
- package/src/components/DebugSurface.tsx +0 -55
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, contributes, createIntent, createSurface, type PluginsContext } from '@dxos/app-framework';
|
|
8
|
+
import { Devtools } from '@dxos/devtools';
|
|
9
|
+
import { SettingsStore } from '@dxos/local-storage';
|
|
10
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
11
|
+
import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
|
|
12
|
+
import {
|
|
13
|
+
SpaceState,
|
|
14
|
+
isSpace,
|
|
15
|
+
isEchoObject,
|
|
16
|
+
type ReactiveEchoObject,
|
|
17
|
+
type ReactiveObject,
|
|
18
|
+
type Space,
|
|
19
|
+
} from '@dxos/react-client/echo';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
DebugApp,
|
|
23
|
+
DebugObjectPanel,
|
|
24
|
+
DebugSettings,
|
|
25
|
+
DebugSpace,
|
|
26
|
+
DebugStatus,
|
|
27
|
+
SpaceGenerator,
|
|
28
|
+
Wireframe,
|
|
29
|
+
} from '../components';
|
|
30
|
+
import { DEBUG_PLUGIN } from '../meta';
|
|
31
|
+
import { type DebugSettingsProps } from '../types';
|
|
32
|
+
|
|
33
|
+
type SpaceDebug = {
|
|
34
|
+
type: string;
|
|
35
|
+
space: Space;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type GraphDebug = {
|
|
39
|
+
graph: Graph;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
|
|
43
|
+
const isGraphDebug = (data: any): data is GraphDebug => data.graph instanceof Graph;
|
|
44
|
+
|
|
45
|
+
export default (context: PluginsContext) =>
|
|
46
|
+
contributes(Capabilities.ReactSurface, [
|
|
47
|
+
createSurface({
|
|
48
|
+
id: `${DEBUG_PLUGIN}/settings`,
|
|
49
|
+
role: 'article',
|
|
50
|
+
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
51
|
+
data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
|
|
52
|
+
component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
|
|
53
|
+
}),
|
|
54
|
+
createSurface({
|
|
55
|
+
id: `${DEBUG_PLUGIN}/status`,
|
|
56
|
+
role: 'status',
|
|
57
|
+
component: () => <DebugStatus />,
|
|
58
|
+
}),
|
|
59
|
+
createSurface({
|
|
60
|
+
id: `${DEBUG_PLUGIN}/complementary`,
|
|
61
|
+
role: 'complementary--debug',
|
|
62
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),
|
|
63
|
+
component: ({ data }) => <DebugObjectPanel object={data.subject} />,
|
|
64
|
+
}),
|
|
65
|
+
createSurface({
|
|
66
|
+
id: `${DEBUG_PLUGIN}/devtools`,
|
|
67
|
+
role: 'article',
|
|
68
|
+
filter: (data): data is any => {
|
|
69
|
+
const settings = context
|
|
70
|
+
.requestCapability(Capabilities.SettingsStore)
|
|
71
|
+
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
72
|
+
return data.subject === 'devtools' && !!settings.devtools;
|
|
73
|
+
},
|
|
74
|
+
component: () => <Devtools />,
|
|
75
|
+
}),
|
|
76
|
+
createSurface({
|
|
77
|
+
id: `${DEBUG_PLUGIN}/space`,
|
|
78
|
+
role: 'article',
|
|
79
|
+
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
80
|
+
component: ({ data }) => {
|
|
81
|
+
const handleCreateObject = useCallback(
|
|
82
|
+
(objects: ReactiveObject<any>[]) => {
|
|
83
|
+
if (!isSpace(data.subject.space)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const collection =
|
|
88
|
+
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
89
|
+
data.subject.space.properties[CollectionType.typename]?.target;
|
|
90
|
+
if (!(collection instanceof CollectionType)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
95
|
+
objects.forEach((object) => {
|
|
96
|
+
void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
[data.subject.space],
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const deprecated = false;
|
|
103
|
+
return deprecated ? (
|
|
104
|
+
<DebugSpace space={data.subject.space} onAddObjects={handleCreateObject} />
|
|
105
|
+
) : (
|
|
106
|
+
<SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
createSurface({
|
|
111
|
+
id: `${DEBUG_PLUGIN}/graph`,
|
|
112
|
+
role: 'article',
|
|
113
|
+
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
114
|
+
component: ({ data }) => <DebugApp graph={data.subject.graph} />,
|
|
115
|
+
}),
|
|
116
|
+
createSurface({
|
|
117
|
+
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
118
|
+
role: ['article', 'section'],
|
|
119
|
+
position: 'hoist',
|
|
120
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => {
|
|
121
|
+
const settings = context
|
|
122
|
+
.requestCapability(Capabilities.SettingsStore)
|
|
123
|
+
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
124
|
+
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
125
|
+
},
|
|
126
|
+
component: ({ data, role }) => (
|
|
127
|
+
<Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
|
|
128
|
+
),
|
|
129
|
+
}),
|
|
130
|
+
]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { create } from '@dxos/react-client/echo';
|
|
7
|
+
|
|
8
|
+
import { DEBUG_PLUGIN } from '../meta';
|
|
9
|
+
import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
10
|
+
|
|
11
|
+
export default () => {
|
|
12
|
+
const settings = create<DebugSettingsProps>({
|
|
13
|
+
debug: true,
|
|
14
|
+
devtools: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
18
|
+
};
|
|
@@ -59,7 +59,7 @@ export const DebugApp: FC<{ graph: Graph }> = ({ graph }) => {
|
|
|
59
59
|
</ToggleGroupItem>
|
|
60
60
|
</ToggleGroup>
|
|
61
61
|
|
|
62
|
-
<Toolbar.
|
|
62
|
+
<Toolbar.Separator variant='gap' />
|
|
63
63
|
<Button onClick={(event) => handleResetClient(event.shiftKey)} title='Reset client'>
|
|
64
64
|
<Warning className={mx(getSize(5), 'text-red-700')} />
|
|
65
65
|
</Button>
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Gift, DownloadSimple, FirstAidKit } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useEffect, useState } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
8
|
import { type ConfigProto, defs, SaveConfig, Storage } from '@dxos/config';
|
|
10
9
|
import { log } from '@dxos/log';
|
|
11
10
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import { useTranslation, Button, Toast, Input, useFileDownload, Select } from '@dxos/react-ui';
|
|
13
|
-
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
14
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
11
|
+
import { useTranslation, Button, Toast, Input, useFileDownload, Select, Icon } from '@dxos/react-ui';
|
|
12
|
+
import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
15
13
|
import { setDeep } from '@dxos/util';
|
|
16
14
|
|
|
17
15
|
import { DEBUG_PLUGIN } from '../meta';
|
|
@@ -34,7 +32,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
34
32
|
const download = useFileDownload();
|
|
35
33
|
// TODO(mykola): Get updates from other places that change Config.
|
|
36
34
|
const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
|
|
37
|
-
const
|
|
35
|
+
const [upload] = useCapabilities(Capabilities.FileUploader);
|
|
38
36
|
|
|
39
37
|
useEffect(() => {
|
|
40
38
|
void Storage().then((config) => setStorageConfig(config));
|
|
@@ -52,8 +50,8 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
52
50
|
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
53
51
|
download(file, fileName);
|
|
54
52
|
|
|
55
|
-
if (
|
|
56
|
-
const info = await
|
|
53
|
+
if (upload) {
|
|
54
|
+
const info = await upload(new File([file], fileName), client.spaces.default);
|
|
57
55
|
if (!info) {
|
|
58
56
|
log.error('diagnostics failed to upload to IPFS');
|
|
59
57
|
return;
|
|
@@ -79,73 +77,75 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
return (
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<Toast.
|
|
107
|
-
<Toast.
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
onValueChange={(value) => {
|
|
124
|
-
if (confirm(t('settings storage adapter changed alert'))) {
|
|
125
|
-
updateConfig(
|
|
126
|
-
storageConfig,
|
|
127
|
-
setStorageConfig,
|
|
128
|
-
['runtime', 'client', 'storage', 'dataStore'],
|
|
129
|
-
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
130
|
-
);
|
|
80
|
+
<DeprecatedFormContainer>
|
|
81
|
+
<DeprecatedFormContainer>
|
|
82
|
+
<DeprecatedFormInput label={t('settings show debug panel')}>
|
|
83
|
+
<Input.Switch checked={settings.debug} onCheckedChange={(checked) => (settings.debug = !!checked)} />
|
|
84
|
+
</DeprecatedFormInput>
|
|
85
|
+
<DeprecatedFormInput label={t('settings show devtools panel')}>
|
|
86
|
+
<Input.Switch checked={settings.devtools} onCheckedChange={(checked) => (settings.devtools = !!checked)} />
|
|
87
|
+
</DeprecatedFormInput>
|
|
88
|
+
<DeprecatedFormInput label={t('settings wireframe')}>
|
|
89
|
+
<Input.Switch checked={settings.wireframe} onCheckedChange={(checked) => (settings.wireframe = !!checked)} />
|
|
90
|
+
</DeprecatedFormInput>
|
|
91
|
+
<DeprecatedFormInput label={t('settings download diagnostics')}>
|
|
92
|
+
<Button onClick={handleDownload}>
|
|
93
|
+
<Icon icon='ph--download-simple--regular' size={5} />
|
|
94
|
+
</Button>
|
|
95
|
+
</DeprecatedFormInput>
|
|
96
|
+
<DeprecatedFormInput label={t('settings repair')}>
|
|
97
|
+
<Button onClick={handleRepair}>
|
|
98
|
+
<Icon icon='ph--first-aid-kit--regular' size={5} />
|
|
99
|
+
</Button>
|
|
100
|
+
</DeprecatedFormInput>
|
|
101
|
+
|
|
102
|
+
{/* TODO(burdon): Move to layout? */}
|
|
103
|
+
{toast && (
|
|
104
|
+
<Toast.Root>
|
|
105
|
+
<Toast.Body>
|
|
106
|
+
<Toast.Title>
|
|
107
|
+
<Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
|
|
108
|
+
<span>{toast.title}</span>
|
|
109
|
+
</Toast.Title>
|
|
110
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
111
|
+
</Toast.Body>
|
|
112
|
+
</Toast.Root>
|
|
113
|
+
)}
|
|
114
|
+
|
|
115
|
+
<DeprecatedFormInput label={t('settings choose storage adaptor')}>
|
|
116
|
+
<Select.Root
|
|
117
|
+
value={
|
|
118
|
+
Object.entries(StorageAdapters).find(
|
|
119
|
+
([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
120
|
+
)?.[0]
|
|
131
121
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
122
|
+
onValueChange={(value) => {
|
|
123
|
+
if (confirm(t('settings storage adapter changed alert'))) {
|
|
124
|
+
updateConfig(
|
|
125
|
+
storageConfig,
|
|
126
|
+
setStorageConfig,
|
|
127
|
+
['runtime', 'client', 'storage', 'dataStore'],
|
|
128
|
+
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<Select.TriggerButton placeholder={t('settings data store label')} />
|
|
134
|
+
<Select.Portal>
|
|
135
|
+
<Select.Content>
|
|
136
|
+
<Select.Viewport>
|
|
137
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
138
|
+
<Select.Option key={key} value={key}>
|
|
139
|
+
{t(`settings storage adaptor ${key} label`)}
|
|
140
|
+
</Select.Option>
|
|
141
|
+
))}
|
|
142
|
+
</Select.Viewport>
|
|
143
|
+
</Select.Content>
|
|
144
|
+
</Select.Portal>
|
|
145
|
+
</Select.Root>
|
|
146
|
+
</DeprecatedFormInput>
|
|
147
|
+
</DeprecatedFormContainer>
|
|
148
|
+
</DeprecatedFormContainer>
|
|
149
149
|
);
|
|
150
150
|
};
|
|
151
151
|
|
|
@@ -158,7 +158,7 @@ export const DebugSpace: FC<{
|
|
|
158
158
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' size={5} onClick={handleUpdate} />
|
|
159
159
|
<IconButton icon='ph--download-simple--regular' iconOnly label='Download' size={5} onClick={handleDownload} />
|
|
160
160
|
|
|
161
|
-
<Toolbar.
|
|
161
|
+
<Toolbar.Separator variant='gap' />
|
|
162
162
|
<IconButton
|
|
163
163
|
icon='ph--flag-pennant--regular'
|
|
164
164
|
iconOnly
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useAppGraph, useLayout } from '@dxos/app-framework';
|
|
8
8
|
import { TimeoutError } from '@dxos/async';
|
|
9
9
|
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
10
|
-
import { log } from '@dxos/log';
|
|
11
10
|
import { getActiveSpace } from '@dxos/plugin-space';
|
|
12
11
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
13
12
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
14
13
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
15
|
-
import { Icon } from '@dxos/react-ui';
|
|
16
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
17
15
|
|
|
18
16
|
const styles = {
|
|
19
17
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -67,10 +65,7 @@ const ErrorIndicator = () => {
|
|
|
67
65
|
useEffect(() => {
|
|
68
66
|
const errorListener = (event: any) => {
|
|
69
67
|
const error: Error = event.error ?? event.reason;
|
|
70
|
-
// event.preventDefault();
|
|
71
68
|
if (errorRef.current !== error) {
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
log.error('onError', { event });
|
|
74
69
|
errorRef.current = error;
|
|
75
70
|
forceUpdate({});
|
|
76
71
|
}
|
|
@@ -140,11 +135,9 @@ const SwarmIndicator = () => {
|
|
|
140
135
|
// TODO(burdon): Merge with SaveStatus.
|
|
141
136
|
const SavingIndicator = () => {
|
|
142
137
|
const [state, _setState] = useState(0);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const graph = graphPlugin?.provides.graph;
|
|
147
|
-
const _space = location && graph ? getActiveSpace(graph, firstIdInPart(location.active, 'main')) : undefined;
|
|
138
|
+
const layout = useLayout();
|
|
139
|
+
const { graph } = useAppGraph();
|
|
140
|
+
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
148
141
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
149
142
|
// useEffect(() => {
|
|
150
143
|
// if (!space) {
|
|
@@ -192,22 +185,19 @@ const PerformanceIndicator = () => {
|
|
|
192
185
|
const [stats, refreshStats] = useStats();
|
|
193
186
|
|
|
194
187
|
return (
|
|
195
|
-
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'overflow-x-hidden overflow-y-auto scrollbar-thin',
|
|
204
|
-
'border-x border-y border-separator',
|
|
205
|
-
)}
|
|
206
|
-
>
|
|
188
|
+
<Popover.Root open={visible} onOpenChange={setVisible}>
|
|
189
|
+
<Popover.Trigger asChild>
|
|
190
|
+
<StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>
|
|
191
|
+
<Icon icon='ph--chart-bar--regular' size={4} />
|
|
192
|
+
</StatusBar.Button>
|
|
193
|
+
</Popover.Trigger>
|
|
194
|
+
<Popover.Portal>
|
|
195
|
+
<Popover.Content classNames='max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]'>
|
|
207
196
|
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
197
|
+
<Popover.Arrow />
|
|
198
|
+
</Popover.Content>
|
|
199
|
+
</Popover.Portal>
|
|
200
|
+
</Popover.Root>
|
|
211
201
|
);
|
|
212
202
|
};
|
|
213
203
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { addressToA1Notation } from '@dxos/compute';
|
|
6
6
|
import { type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
7
7
|
import { create, makeRef, type ReactiveObject } from '@dxos/live-object';
|
|
8
|
-
import { DocumentType
|
|
9
|
-
import { createSheet } from '@dxos/plugin-sheet';
|
|
8
|
+
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
9
|
+
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
10
10
|
import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
11
11
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
12
12
|
import { faker } from '@dxos/random';
|
|
13
13
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
14
14
|
import { TableType } from '@dxos/react-ui-table';
|
|
15
|
-
import { createView } from '@dxos/schema';
|
|
15
|
+
import { createView, TextType } from '@dxos/schema';
|
|
16
16
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
17
17
|
import { range } from '@dxos/util';
|
|
18
18
|
|
|
@@ -86,7 +86,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
86
86
|
<div role='none' className='flex flex-col divide-y divide-separator'>
|
|
87
87
|
<Toolbar.Root classNames='p-1'>
|
|
88
88
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
89
|
-
<Toolbar.
|
|
89
|
+
<Toolbar.Separator variant='gap' />
|
|
90
90
|
<div className='flex'>
|
|
91
91
|
<Input.Root>
|
|
92
92
|
<Input.TextInput
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -6,11 +6,13 @@ import { type PluginMeta } from '@dxos/app-framework';
|
|
|
6
6
|
|
|
7
7
|
export const DEBUG_PLUGIN = 'dxos.org/plugin/debug';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const meta = {
|
|
10
10
|
id: DEBUG_PLUGIN,
|
|
11
11
|
name: 'Debug',
|
|
12
|
-
description:
|
|
12
|
+
description:
|
|
13
|
+
'The debug plugin is useful for troubleshooting inside of Composer. You can also use the Debug plugin to create test data inside of sheets or tables or explore pre-built automations. Non-technical users will likely not spend much time here, but this plugin is invaluable for developers and technical users.',
|
|
13
14
|
icon: 'ph--bug--regular',
|
|
14
15
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
|
|
15
16
|
tags: ['experimental'],
|
|
17
|
+
screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
|
|
16
18
|
} satisfies PluginMeta;
|
package/src/types.ts
CHANGED
|
@@ -4,15 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Context, createContext } from 'react';
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
GraphBuilderProvides,
|
|
9
|
-
SettingsProvides,
|
|
10
|
-
SurfaceProvides,
|
|
11
|
-
TranslationsProvides,
|
|
12
|
-
} from '@dxos/app-framework';
|
|
13
7
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
14
8
|
import { S } from '@dxos/echo-schema';
|
|
15
|
-
import { type PanelProvides } from '@dxos/plugin-deck/types';
|
|
16
9
|
|
|
17
10
|
export type DebugContextType = {
|
|
18
11
|
running: boolean;
|
|
@@ -35,9 +28,3 @@ export const DebugSettingsSchema = S.mutable(
|
|
|
35
28
|
);
|
|
36
29
|
|
|
37
30
|
export interface DebugSettingsProps extends S.Schema.Type<typeof DebugSettingsSchema> {}
|
|
38
|
-
|
|
39
|
-
export type DebugPluginProvides = SurfaceProvides &
|
|
40
|
-
GraphBuilderProvides &
|
|
41
|
-
SettingsProvides<DebugSettingsProps> &
|
|
42
|
-
TranslationsProvides &
|
|
43
|
-
PanelProvides;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport type {\n GraphBuilderProvides,\n SettingsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport type { TimerCallback, TimerOptions } from '@dxos/async';\nimport { S } from '@dxos/echo-schema';\nimport { type PanelProvides } from '@dxos/plugin-deck/types';\n\nexport type DebugContextType = {\n running: boolean;\n start: (cb: TimerCallback, options: TimerOptions) => void;\n stop: () => void;\n};\n\nexport const DebugContext: Context<DebugContextType> = createContext<DebugContextType>({\n running: false,\n start: () => {},\n stop: () => {},\n});\n\nexport const DebugSettingsSchema = S.mutable(\n S.Struct({\n devtools: S.optional(S.Boolean),\n debug: S.optional(S.Boolean),\n wireframe: S.optional(S.Boolean),\n }),\n);\n\nexport interface DebugSettingsProps extends S.Schema.Type<typeof DebugSettingsSchema> {}\n\nexport type DebugPluginProvides = SurfaceProvides &\n GraphBuilderProvides &\n SettingsProvides<DebugSettingsProps> &\n TranslationsProvides &\n PanelProvides;\n"],
|
|
5
|
-
"mappings": ";AAIA,SAAuBA,qBAAqB;AAS5C,SAASC,SAAS;AASX,IAAMC,eAA0CC,cAAgC;EACrFC,SAAS;EACTC,OAAO,MAAA;EAAO;EACdC,MAAM,MAAA;EAAO;AACf,CAAA;AAEO,IAAMC,sBAAsBC,EAAEC,QACnCD,EAAEE,OAAO;EACPC,UAAUH,EAAEI,SAASJ,EAAEK,OAAO;EAC9BC,OAAON,EAAEI,SAASJ,EAAEK,OAAO;EAC3BE,WAAWP,EAAEI,SAASJ,EAAEK,OAAO;AACjC,CAAA,CAAA;",
|
|
6
|
-
"names": ["createContext", "S", "DebugContext", "createContext", "running", "start", "stop", "DebugSettingsSchema", "S", "mutable", "Struct", "devtools", "optional", "Boolean", "debug", "wireframe"]
|
|
7
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-debug/src/meta.ts
|
|
2
|
-
var DEBUG_PLUGIN = "dxos.org/plugin/debug";
|
|
3
|
-
var meta_default = {
|
|
4
|
-
id: DEBUG_PLUGIN,
|
|
5
|
-
name: "Debug",
|
|
6
|
-
description: "DXOS debugging tools.",
|
|
7
|
-
icon: "ph--bug--regular",
|
|
8
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug",
|
|
9
|
-
tags: [
|
|
10
|
-
"experimental"
|
|
11
|
-
]
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
DEBUG_PLUGIN,
|
|
16
|
-
meta_default
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-CAENAAHY.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const DEBUG_PLUGIN = 'dxos.org/plugin/debug';\n\nexport default {\n id: DEBUG_PLUGIN,\n name: 'Debug',\n description: 'DXOS debugging tools.',\n icon: 'ph--bug--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',\n tags: ['experimental'],\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,eAAe;AAE5B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
|
|
6
|
-
"names": ["DEBUG_PLUGIN", "id", "name", "description", "icon", "source", "tags"]
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
export type SurfaceDebugProps = ThemedClassName<{}>;
|
|
4
|
-
/**
|
|
5
|
-
* Show surface info.
|
|
6
|
-
* NOTE: Remove from @dxos/app-framework if removing this.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DebugSurface: ({ classNames }: SurfaceDebugProps) => React.JSX.Element;
|
|
9
|
-
//# sourceMappingURL=DebugSurface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DebugSurface.d.ts","sourceRoot":"","sources":["../../../../src/components/DebugSurface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKpE,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,YAAY,mBAAoB,iBAAiB,sBAoC7D,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type DebugInfo, useSurfaceRoot } from '@dxos/app-framework';
|
|
8
|
-
import { Button, Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
// TODO(burdon): Move to debug panel.
|
|
12
|
-
|
|
13
|
-
export type SurfaceDebugProps = ThemedClassName<{}>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Show surface info.
|
|
17
|
-
* NOTE: Remove from @dxos/app-framework if removing this.
|
|
18
|
-
*/
|
|
19
|
-
export const DebugSurface = ({ classNames }: SurfaceDebugProps) => {
|
|
20
|
-
const context = useSurfaceRoot();
|
|
21
|
-
const [surfaces, setSurfaces] = useState<DebugInfo[]>([]);
|
|
22
|
-
const renderMap = useMemo(() => new Map<string, { last: number; delta: number }>(), []);
|
|
23
|
-
const handleRefresh = () => {
|
|
24
|
-
if (context.debugInfo) {
|
|
25
|
-
setSurfaces(
|
|
26
|
-
Array.from(context.debugInfo.values())
|
|
27
|
-
.sort(({ created: a }, { created: b }) => a - b)
|
|
28
|
-
.map((surface) => {
|
|
29
|
-
const state = renderMap.get(surface.id) ?? { last: 0, delta: 0 };
|
|
30
|
-
renderMap.set(surface.id, { last: surface.renderCount, delta: surface.renderCount - state.last });
|
|
31
|
-
return surface;
|
|
32
|
-
}),
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={mx('flex flex-col border border-separator overflow-hidden bg-modalSurface', classNames)}>
|
|
39
|
-
<div className='flex flex-col h-full w-full p-2'>
|
|
40
|
-
{surfaces.map(({ id, role, renderCount }) => (
|
|
41
|
-
<div key={id} className='grid grid-cols-[1fr_3rem_3rem] items-center text-xs font-mono whitespace-nowrap'>
|
|
42
|
-
<span className='px-1 truncate'>{role}</span>
|
|
43
|
-
<span className='px-1 text-right'>{renderCount}</span>
|
|
44
|
-
<span className='px-1 text-right'>{renderMap.get(id)?.delta}</span>
|
|
45
|
-
</div>
|
|
46
|
-
))}
|
|
47
|
-
</div>
|
|
48
|
-
<div className='flex justify-center text-sm items-center'>
|
|
49
|
-
<Button onClick={handleRefresh}>
|
|
50
|
-
<Icon icon='ph--arrow-clockwise--regular' size={4} />
|
|
51
|
-
</Button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
};
|