@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.406dc2a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-VMWHGAJZ.mjs} +245 -69
- package/dist/lib/browser/SpaceGenerator-VMWHGAJZ.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-I4IHBKKN.mjs} +75 -84
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5XPIRNQS.mjs → chunk-SVCKCXCL.mjs} +2 -4
- package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-QLZE7VSQ.mjs} +6 -6
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-GFORPA3A.mjs} +78 -74
- package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-EBVICEEW.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-EBVICEEW.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +66 -63
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +63 -89
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +49 -47
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +74 -66
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -15
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +173 -12
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/meta.ts +1 -3
- package/src/translations.ts +2 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
type PluginContext,
|
|
10
12
|
chain,
|
|
11
13
|
contributes,
|
|
12
14
|
createIntent,
|
|
13
15
|
createSurface,
|
|
14
|
-
LayoutAction,
|
|
15
16
|
useCapability,
|
|
16
17
|
useIntentDispatcher,
|
|
17
|
-
type PluginContext,
|
|
18
18
|
} from '@dxos/app-framework';
|
|
19
19
|
import {
|
|
20
20
|
AutomergePanel,
|
|
@@ -50,12 +50,12 @@ import { ClientCapabilities } from '@dxos/plugin-client';
|
|
|
50
50
|
import { Graph } from '@dxos/plugin-graph';
|
|
51
51
|
import { ScriptAction } from '@dxos/plugin-script/types';
|
|
52
52
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
53
|
-
import { SpaceState, isSpace,
|
|
53
|
+
import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
|
|
54
54
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
55
55
|
import { DataType } from '@dxos/schema';
|
|
56
56
|
|
|
57
57
|
import {
|
|
58
|
-
|
|
58
|
+
DebugGraph,
|
|
59
59
|
DebugObjectPanel,
|
|
60
60
|
DebugSettings,
|
|
61
61
|
DebugStatus,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
SpaceGenerator,
|
|
64
64
|
Wireframe,
|
|
65
65
|
} from '../components';
|
|
66
|
-
import {
|
|
66
|
+
import { meta } from '../meta';
|
|
67
67
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
68
68
|
|
|
69
69
|
type SpaceDebug = {
|
|
@@ -73,10 +73,11 @@ type SpaceDebug = {
|
|
|
73
73
|
|
|
74
74
|
type GraphDebug = {
|
|
75
75
|
graph: Graph;
|
|
76
|
+
root: string;
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${
|
|
79
|
-
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
|
|
79
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
|
|
80
|
+
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
|
|
80
81
|
|
|
81
82
|
// TODO(wittjosiah): Factor out?
|
|
82
83
|
const useCurrentSpace = () => {
|
|
@@ -90,14 +91,14 @@ const useCurrentSpace = () => {
|
|
|
90
91
|
export default (context: PluginContext) =>
|
|
91
92
|
contributes(Capabilities.ReactSurface, [
|
|
92
93
|
createSurface({
|
|
93
|
-
id: `${
|
|
94
|
+
id: `${meta.id}/plugin-settings`,
|
|
94
95
|
role: 'article',
|
|
95
96
|
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
96
|
-
data.subject instanceof SettingsStore && data.subject.prefix ===
|
|
97
|
+
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
97
98
|
component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
|
|
98
99
|
}),
|
|
99
100
|
createSurface({
|
|
100
|
-
id: `${
|
|
101
|
+
id: `${meta.id}/space`,
|
|
101
102
|
role: 'article',
|
|
102
103
|
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
103
104
|
component: ({ data }) => {
|
|
@@ -131,19 +132,17 @@ export default (context: PluginContext) =>
|
|
|
131
132
|
},
|
|
132
133
|
}),
|
|
133
134
|
createSurface({
|
|
134
|
-
id: `${
|
|
135
|
+
id: `${meta.id}/app-graph`,
|
|
135
136
|
role: 'article',
|
|
136
137
|
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
137
|
-
component: ({ data }) => <
|
|
138
|
+
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
138
139
|
}),
|
|
139
140
|
createSurface({
|
|
140
|
-
id: `${
|
|
141
|
+
id: `${meta.id}/wireframe`,
|
|
141
142
|
role: ['article', 'section'],
|
|
142
143
|
position: 'hoist',
|
|
143
144
|
filter: (data): data is { subject: Obj.Any } => {
|
|
144
|
-
const settings = context
|
|
145
|
-
.getCapability(Capabilities.SettingsStore)
|
|
146
|
-
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
145
|
+
const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
|
|
147
146
|
return Obj.isObject(data.subject) && !!settings.wireframe;
|
|
148
147
|
},
|
|
149
148
|
component: ({ data, role }) => (
|
|
@@ -151,18 +150,18 @@ export default (context: PluginContext) =>
|
|
|
151
150
|
),
|
|
152
151
|
}),
|
|
153
152
|
createSurface({
|
|
154
|
-
id: `${
|
|
153
|
+
id: `${meta.id}/object-debug`,
|
|
155
154
|
role: 'article',
|
|
156
155
|
filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
|
|
157
156
|
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
158
157
|
}),
|
|
159
158
|
createSurface({
|
|
160
|
-
id: `${
|
|
159
|
+
id: `${meta.id}/devtools-overview`,
|
|
161
160
|
role: 'deck-companion--devtools',
|
|
162
161
|
component: () => <DevtoolsOverviewContainer />,
|
|
163
162
|
}),
|
|
164
163
|
createSurface({
|
|
165
|
-
id: `${
|
|
164
|
+
id: `${meta.id}/status`,
|
|
166
165
|
role: 'status',
|
|
167
166
|
component: () => <DebugStatus />,
|
|
168
167
|
}),
|
|
@@ -172,55 +171,55 @@ export default (context: PluginContext) =>
|
|
|
172
171
|
//
|
|
173
172
|
|
|
174
173
|
createSurface({
|
|
175
|
-
id: `${
|
|
174
|
+
id: `${meta.id}/client/config`,
|
|
176
175
|
role: 'article',
|
|
177
176
|
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
178
177
|
component: () => <ConfigPanel vaultSelector={false} />,
|
|
179
178
|
}),
|
|
180
179
|
createSurface({
|
|
181
|
-
id: `${
|
|
180
|
+
id: `${meta.id}/client/storage`,
|
|
182
181
|
role: 'article',
|
|
183
182
|
filter: (data): data is any => data.subject === Devtools.Client.Storage,
|
|
184
183
|
component: () => <StoragePanel />,
|
|
185
184
|
}),
|
|
186
185
|
createSurface({
|
|
187
|
-
id: `${
|
|
186
|
+
id: `${meta.id}/client/logs`,
|
|
188
187
|
role: 'article',
|
|
189
188
|
filter: (data): data is any => data.subject === Devtools.Client.Logs,
|
|
190
189
|
component: () => <LoggingPanel />,
|
|
191
190
|
}),
|
|
192
191
|
createSurface({
|
|
193
|
-
id: `${
|
|
192
|
+
id: `${meta.id}/client/diagnostics`,
|
|
194
193
|
role: 'article',
|
|
195
194
|
filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
|
|
196
195
|
component: () => <DiagnosticsPanel />,
|
|
197
196
|
}),
|
|
198
197
|
createSurface({
|
|
199
|
-
id: `${
|
|
198
|
+
id: `${meta.id}/client/tracing`,
|
|
200
199
|
role: 'article',
|
|
201
200
|
filter: (data): data is any => data.subject === Devtools.Client.Tracing,
|
|
202
201
|
component: () => <TracingPanel />,
|
|
203
202
|
}),
|
|
204
203
|
createSurface({
|
|
205
|
-
id: `${
|
|
204
|
+
id: `${meta.id}/halo/identity`,
|
|
206
205
|
role: 'article',
|
|
207
206
|
filter: (data): data is any => data.subject === Devtools.Halo.Identity,
|
|
208
207
|
component: () => <IdentityPanel />,
|
|
209
208
|
}),
|
|
210
209
|
createSurface({
|
|
211
|
-
id: `${
|
|
210
|
+
id: `${meta.id}/halo/devices`,
|
|
212
211
|
role: 'article',
|
|
213
212
|
filter: (data): data is any => data.subject === Devtools.Halo.Devices,
|
|
214
213
|
component: () => <DeviceListPanel />,
|
|
215
214
|
}),
|
|
216
215
|
createSurface({
|
|
217
|
-
id: `${
|
|
216
|
+
id: `${meta.id}/halo/keyring`,
|
|
218
217
|
role: 'article',
|
|
219
218
|
filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
|
|
220
219
|
component: () => <KeyringPanel />,
|
|
221
220
|
}),
|
|
222
221
|
createSurface({
|
|
223
|
-
id: `${
|
|
222
|
+
id: `${meta.id}/halo/credentials`,
|
|
224
223
|
role: 'article',
|
|
225
224
|
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
226
225
|
component: () => {
|
|
@@ -229,7 +228,7 @@ export default (context: PluginContext) =>
|
|
|
229
228
|
},
|
|
230
229
|
}),
|
|
231
230
|
createSurface({
|
|
232
|
-
id: `${
|
|
231
|
+
id: `${meta.id}/echo/spaces`,
|
|
233
232
|
role: 'article',
|
|
234
233
|
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
235
234
|
component: () => {
|
|
@@ -242,7 +241,7 @@ export default (context: PluginContext) =>
|
|
|
242
241
|
},
|
|
243
242
|
}),
|
|
244
243
|
createSurface({
|
|
245
|
-
id: `${
|
|
244
|
+
id: `${meta.id}/echo/space`,
|
|
246
245
|
role: 'article',
|
|
247
246
|
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
248
247
|
component: () => {
|
|
@@ -256,7 +255,7 @@ export default (context: PluginContext) =>
|
|
|
256
255
|
},
|
|
257
256
|
}),
|
|
258
257
|
createSurface({
|
|
259
|
-
id: `${
|
|
258
|
+
id: `${meta.id}/echo/feeds`,
|
|
260
259
|
role: 'article',
|
|
261
260
|
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
262
261
|
component: () => {
|
|
@@ -265,7 +264,7 @@ export default (context: PluginContext) =>
|
|
|
265
264
|
},
|
|
266
265
|
}),
|
|
267
266
|
createSurface({
|
|
268
|
-
id: `${
|
|
267
|
+
id: `${meta.id}/echo/objects`,
|
|
269
268
|
role: 'article',
|
|
270
269
|
filter: (data): data is any => data.subject === Devtools.Echo.Objects,
|
|
271
270
|
component: () => {
|
|
@@ -274,7 +273,7 @@ export default (context: PluginContext) =>
|
|
|
274
273
|
},
|
|
275
274
|
}),
|
|
276
275
|
createSurface({
|
|
277
|
-
id: `${
|
|
276
|
+
id: `${meta.id}/echo/schema`,
|
|
278
277
|
role: 'article',
|
|
279
278
|
filter: (data): data is any => data.subject === Devtools.Echo.Schema,
|
|
280
279
|
component: () => {
|
|
@@ -283,7 +282,7 @@ export default (context: PluginContext) =>
|
|
|
283
282
|
},
|
|
284
283
|
}),
|
|
285
284
|
createSurface({
|
|
286
|
-
id: `${
|
|
285
|
+
id: `${meta.id}/echo/automerge`,
|
|
287
286
|
role: 'article',
|
|
288
287
|
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
289
288
|
component: () => {
|
|
@@ -292,13 +291,13 @@ export default (context: PluginContext) =>
|
|
|
292
291
|
},
|
|
293
292
|
}),
|
|
294
293
|
createSurface({
|
|
295
|
-
id: `${
|
|
294
|
+
id: `${meta.id}/echo/queues`,
|
|
296
295
|
role: 'article',
|
|
297
296
|
filter: (data): data is any => data.subject === Devtools.Echo.Queues,
|
|
298
297
|
component: () => <QueuesPanel />,
|
|
299
298
|
}),
|
|
300
299
|
createSurface({
|
|
301
|
-
id: `${
|
|
300
|
+
id: `${meta.id}/echo/members`,
|
|
302
301
|
role: 'article',
|
|
303
302
|
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
304
303
|
component: () => {
|
|
@@ -307,25 +306,25 @@ export default (context: PluginContext) =>
|
|
|
307
306
|
},
|
|
308
307
|
}),
|
|
309
308
|
createSurface({
|
|
310
|
-
id: `${
|
|
309
|
+
id: `${meta.id}/echo/metadata`,
|
|
311
310
|
role: 'article',
|
|
312
311
|
filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
|
|
313
312
|
component: () => <MetadataPanel />,
|
|
314
313
|
}),
|
|
315
314
|
createSurface({
|
|
316
|
-
id: `${
|
|
315
|
+
id: `${meta.id}/mesh/signal`,
|
|
317
316
|
role: 'article',
|
|
318
317
|
filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
|
|
319
318
|
component: () => <SignalPanel />,
|
|
320
319
|
}),
|
|
321
320
|
createSurface({
|
|
322
|
-
id: `${
|
|
321
|
+
id: `${meta.id}/mesh/swarm`,
|
|
323
322
|
role: 'article',
|
|
324
323
|
filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
|
|
325
324
|
component: () => <SwarmPanel />,
|
|
326
325
|
}),
|
|
327
326
|
createSurface({
|
|
328
|
-
id: `${
|
|
327
|
+
id: `${meta.id}/mesh/network`,
|
|
329
328
|
role: 'article',
|
|
330
329
|
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
331
330
|
component: () => {
|
|
@@ -335,19 +334,19 @@ export default (context: PluginContext) =>
|
|
|
335
334
|
}),
|
|
336
335
|
// TODO(wittjosiah): Remove?
|
|
337
336
|
// createSurface({
|
|
338
|
-
// id: `${
|
|
337
|
+
// id: `${meta.id}/agent/dashboard`,
|
|
339
338
|
// role: 'article',
|
|
340
339
|
// filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
341
340
|
// component: () => <DashboardPanel />,
|
|
342
341
|
// }),
|
|
343
342
|
createSurface({
|
|
344
|
-
id: `${
|
|
343
|
+
id: `${meta.id}/edge/dashboard`,
|
|
345
344
|
role: 'article',
|
|
346
345
|
filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
|
|
347
346
|
component: () => <EdgeDashboardPanel />,
|
|
348
347
|
}),
|
|
349
348
|
createSurface({
|
|
350
|
-
id: `${
|
|
349
|
+
id: `${meta.id}/edge/workflows`,
|
|
351
350
|
role: 'article',
|
|
352
351
|
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
353
352
|
component: () => {
|
|
@@ -356,7 +355,7 @@ export default (context: PluginContext) =>
|
|
|
356
355
|
},
|
|
357
356
|
}),
|
|
358
357
|
createSurface({
|
|
359
|
-
id: `${
|
|
358
|
+
id: `${meta.id}/edge/traces`,
|
|
360
359
|
role: 'article',
|
|
361
360
|
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
362
361
|
component: () => {
|
|
@@ -365,7 +364,7 @@ export default (context: PluginContext) =>
|
|
|
365
364
|
},
|
|
366
365
|
}),
|
|
367
366
|
createSurface({
|
|
368
|
-
id: `${
|
|
367
|
+
id: `${meta.id}/edge/testing`,
|
|
369
368
|
role: 'article',
|
|
370
369
|
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
371
370
|
component: () => {
|
|
@@ -382,7 +381,10 @@ export default (context: PluginContext) =>
|
|
|
382
381
|
async (space: Space) => {
|
|
383
382
|
await space.waitUntilReady();
|
|
384
383
|
const result = await dispatch(
|
|
385
|
-
pipe(
|
|
384
|
+
Function.pipe(
|
|
385
|
+
createIntent(ScriptAction.CreateScript, { space }),
|
|
386
|
+
chain(SpaceAction.AddObject, { target: space }),
|
|
387
|
+
),
|
|
386
388
|
);
|
|
387
389
|
log.info('script created', { result });
|
|
388
390
|
await dispatch(
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree } from '@dxos/devtools';
|
|
8
|
+
import { type Graph } from '@dxos/plugin-graph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {
|
|
11
|
+
return <Tree data={graph.toJSON(root)} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default DebugGraph;
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
|
|
9
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import {
|
|
10
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
11
|
|
|
12
12
|
export type DebugObjectPanelProps = {
|
|
13
13
|
object: Obj.Any;
|
|
@@ -26,9 +26,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
26
26
|
<Clipboard.IconButton value={dxn} />
|
|
27
27
|
</Input.Root>
|
|
28
28
|
</Toolbar.Root>
|
|
29
|
-
<
|
|
30
|
-
{JSON.stringify(object, null, 2)}
|
|
31
|
-
</SyntaxHighlighter>
|
|
29
|
+
<Json data={object} />
|
|
32
30
|
</StackItem.Content>
|
|
33
31
|
</Clipboard.Provider>
|
|
34
32
|
);
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
|
-
import { type ConfigProto,
|
|
8
|
+
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Button, Icon, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
13
13
|
import { setDeep } from '@dxos/util';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { meta } from '../meta';
|
|
16
16
|
import { type DebugSettingsProps } from '../types';
|
|
17
17
|
|
|
18
18
|
type Toast = {
|
|
@@ -26,7 +26,7 @@ const StorageAdapters = {
|
|
|
26
26
|
} as const;
|
|
27
27
|
|
|
28
28
|
export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {
|
|
29
|
-
const { t } = useTranslation(
|
|
29
|
+
const { t } = useTranslation(meta.id);
|
|
30
30
|
const [toast, setToast] = useState<Toast>();
|
|
31
31
|
const client = useClient();
|
|
32
32
|
const download = useFileDownload();
|
|
@@ -77,67 +77,75 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<
|
|
81
|
-
<
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
80
|
+
<ControlPage>
|
|
81
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
82
|
+
<ControlGroup>
|
|
83
|
+
<ControlItemInput title={t('settings wireframe')}>
|
|
84
|
+
<Input.Switch
|
|
85
|
+
checked={settings.wireframe}
|
|
86
|
+
onCheckedChange={(checked) => (settings.wireframe = !!checked)}
|
|
87
|
+
/>
|
|
88
|
+
</ControlItemInput>
|
|
89
|
+
<ControlItemInput title={t('settings download diagnostics')}>
|
|
90
|
+
<Button onClick={handleDownload}>
|
|
91
|
+
<Icon icon='ph--download-simple--regular' size={5} />
|
|
92
|
+
</Button>
|
|
93
|
+
</ControlItemInput>
|
|
94
|
+
<ControlItemInput title={t('settings repair')}>
|
|
95
|
+
<Button onClick={handleRepair}>
|
|
96
|
+
<Icon icon='ph--first-aid-kit--regular' size={5} />
|
|
97
|
+
</Button>
|
|
98
|
+
</ControlItemInput>
|
|
99
|
+
|
|
100
|
+
{/* TODO(burdon): Move to layout? */}
|
|
101
|
+
{toast && (
|
|
102
|
+
<Toast.Root>
|
|
103
|
+
<Toast.Body>
|
|
104
|
+
<Toast.Title>
|
|
105
|
+
<Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
|
|
106
|
+
<span>{toast.title}</span>
|
|
107
|
+
</Toast.Title>
|
|
108
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
109
|
+
</Toast.Body>
|
|
110
|
+
</Toast.Root>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
<ControlItemInput title={t('settings choose storage adaptor')}>
|
|
114
|
+
<Select.Root
|
|
115
|
+
value={
|
|
116
|
+
Object.entries(StorageAdapters).find(
|
|
117
|
+
([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
118
|
+
)?.[0]
|
|
119
|
+
}
|
|
120
|
+
onValueChange={(value) => {
|
|
121
|
+
if (confirm(t('settings storage adapter changed alert'))) {
|
|
122
|
+
updateConfig(
|
|
123
|
+
storageConfig,
|
|
124
|
+
setStorageConfig,
|
|
125
|
+
['runtime', 'client', 'storage', 'dataStore'],
|
|
126
|
+
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Select.TriggerButton placeholder={t('settings data store label')} />
|
|
132
|
+
<Select.Portal>
|
|
133
|
+
<Select.Content>
|
|
134
|
+
<Select.Viewport>
|
|
135
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
136
|
+
<Select.Option key={key} value={key}>
|
|
137
|
+
{t(`settings storage adaptor ${key} label`)}
|
|
138
|
+
</Select.Option>
|
|
139
|
+
))}
|
|
140
|
+
</Select.Viewport>
|
|
141
|
+
<Select.Arrow />
|
|
142
|
+
</Select.Content>
|
|
143
|
+
</Select.Portal>
|
|
144
|
+
</Select.Root>
|
|
145
|
+
</ControlItemInput>
|
|
146
|
+
</ControlGroup>
|
|
147
|
+
</ControlSection>
|
|
148
|
+
</ControlPage>
|
|
141
149
|
);
|
|
142
150
|
};
|
|
143
151
|
|
|
@@ -59,7 +59,7 @@ const _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: numbe
|
|
|
59
59
|
// TODO(burdon): Integrate with Sentry?
|
|
60
60
|
const ErrorIndicator = () => {
|
|
61
61
|
const [, forceUpdate] = useState({});
|
|
62
|
-
const errorRef = useRef<Error>();
|
|
62
|
+
const errorRef = useRef<Error>(null);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
const errorListener = (event: any) => {
|
|
65
65
|
const error: Error = event.error ?? event.reason;
|
|
@@ -83,7 +83,7 @@ const ErrorIndicator = () => {
|
|
|
83
83
|
}, []);
|
|
84
84
|
|
|
85
85
|
const handleReset = () => {
|
|
86
|
-
errorRef.current =
|
|
86
|
+
errorRef.current = null;
|
|
87
87
|
forceUpdate({});
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
6
6
|
import { addressToA1Notation } from '@dxos/compute';
|
|
7
7
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
8
8
|
import { DXN, Filter, Key, Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { type TypedObject } from '@dxos/echo
|
|
10
|
-
import {
|
|
9
|
+
import { type TypedObject } from '@dxos/echo/internal';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
12
|
-
import {
|
|
12
|
+
import { type CellValue, SheetType } from '@dxos/plugin-sheet/types';
|
|
13
13
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
14
14
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
15
|
import { faker } from '@dxos/random';
|
|
16
16
|
import { type Client } from '@dxos/react-client';
|
|
17
17
|
import { type Space } from '@dxos/react-client/echo';
|
|
18
|
-
import { DataType } from '@dxos/schema';
|
|
19
|
-
import {
|
|
18
|
+
import { DataType, getTypenameFromQuery } from '@dxos/schema';
|
|
19
|
+
import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
|
|
20
20
|
import { range } from '@dxos/util';
|
|
21
21
|
|
|
22
22
|
const generator: ValueGenerator = faker as any;
|
|
23
23
|
|
|
24
|
-
export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
25
|
-
|
|
26
24
|
const findViewByTypename = async (views: DataType.View[], typename: string) => {
|
|
27
|
-
return views.find((view) => view.query.
|
|
25
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
28
26
|
};
|
|
29
27
|
|
|
28
|
+
export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
29
|
+
|
|
30
30
|
export const createGenerator = <T extends Obj.Any>(
|
|
31
31
|
client: Client,
|
|
32
32
|
dispatch: PromiseIntentDispatcher,
|
|
33
33
|
schema: TypedObject<T>,
|
|
34
34
|
): ObjectGenerator<T> => {
|
|
35
|
-
return async (space: Space, n: number
|
|
35
|
+
return async (space: Space, n: number): Promise<T[]> => {
|
|
36
36
|
const typename = schema.typename;
|
|
37
37
|
|
|
38
38
|
// Find or create table and view.
|
|
@@ -40,9 +40,9 @@ export const createGenerator = <T extends Obj.Any>(
|
|
|
40
40
|
const view = await findViewByTypename(views, typename);
|
|
41
41
|
const staticSchema = client?.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
42
42
|
if (!view && !staticSchema) {
|
|
43
|
-
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema }));
|
|
43
|
+
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema, show: false }));
|
|
44
44
|
} else if (!view && staticSchema) {
|
|
45
|
-
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename }));
|
|
45
|
+
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename, show: false }));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Create objects.
|
|
@@ -53,13 +53,13 @@ export const createGenerator = <T extends Obj.Any>(
|
|
|
53
53
|
|
|
54
54
|
export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
55
55
|
[
|
|
56
|
-
|
|
56
|
+
Markdown.Document.typename,
|
|
57
57
|
async (space, n, cb) => {
|
|
58
58
|
const objects = range(n).map(() => {
|
|
59
59
|
return space.db.add(
|
|
60
|
-
|
|
60
|
+
Markdown.makeDocument({
|
|
61
61
|
name: faker.commerce.productName(),
|
|
62
|
-
content:
|
|
62
|
+
content: faker.lorem.sentences(5),
|
|
63
63
|
}),
|
|
64
64
|
);
|
|
65
65
|
});
|