@dxos/plugin-debug 0.8.4-main.28f8d3d → 0.8.4-main.2c6827d

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.
Files changed (91) hide show
  1. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
  2. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
  3. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-XJJAOTIT.mjs → SpaceGenerator-46TAISVE.mjs} +231 -58
  6. package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +7 -0
  7. package/dist/lib/browser/{app-graph-builder-PXPZIIGY.mjs → app-graph-builder-CRH2HJKT.mjs} +76 -85
  8. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
  10. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
  12. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +12 -12
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
  17. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
  18. package/dist/lib/browser/{react-surface-UNFNQFWK.mjs → react-surface-2SNVZDEA.mjs} +103 -97
  19. package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +7 -0
  20. package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
  21. package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
  22. package/dist/types/src/DebugPlugin.d.ts +1 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  25. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/index.d.ts +5 -5
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/react-context.d.ts +2 -2
  29. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  30. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/settings.d.ts +1 -1
  32. package/dist/types/src/components/DebugGraph.d.ts +8 -0
  33. package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
  34. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  35. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  36. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  37. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  38. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
  39. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/SpaceGenerator/presets.d.ts +6 -3
  41. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  42. package/dist/types/src/components/Wireframe.d.ts +1 -1
  43. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  44. package/dist/types/src/components/index.d.ts +2 -1
  45. package/dist/types/src/components/index.d.ts.map +1 -1
  46. package/dist/types/src/meta.d.ts +0 -1
  47. package/dist/types/src/meta.d.ts.map +1 -1
  48. package/dist/types/src/translations.d.ts +3 -1
  49. package/dist/types/src/translations.d.ts.map +1 -1
  50. package/dist/types/src/types.d.ts +1 -1
  51. package/dist/types/src/types.d.ts.map +1 -1
  52. package/dist/types/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +67 -64
  54. package/src/DebugPlugin.tsx +5 -6
  55. package/src/capabilities/app-graph-builder.ts +67 -93
  56. package/src/capabilities/react-context.tsx +2 -2
  57. package/src/capabilities/react-surface.tsx +74 -53
  58. package/src/components/DebugGraph.tsx +14 -0
  59. package/src/components/DebugObjectPanel.tsx +2 -4
  60. package/src/components/DebugSettings.tsx +101 -72
  61. package/src/components/DebugStatus.tsx +2 -2
  62. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  63. package/src/components/SpaceGenerator/ObjectGenerator.tsx +19 -25
  64. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  65. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +10 -10
  66. package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
  67. package/src/components/SpaceGenerator/draw-util.ts +2 -2
  68. package/src/components/SpaceGenerator/presets.ts +186 -20
  69. package/src/components/Wireframe.tsx +4 -4
  70. package/src/components/index.ts +1 -1
  71. package/src/meta.ts +6 -5
  72. package/src/translations.ts +3 -1
  73. package/src/types.ts +1 -1
  74. package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs +0 -228
  75. package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs.map +0 -7
  76. package/dist/lib/browser/SpaceGenerator-XJJAOTIT.mjs.map +0 -7
  77. package/dist/lib/browser/app-graph-builder-PXPZIIGY.mjs.map +0 -7
  78. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  79. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  80. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  81. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  82. package/dist/lib/browser/react-surface-UNFNQFWK.mjs.map +0 -7
  83. package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
  84. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
  85. package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
  86. package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
  87. package/dist/types/src/components/DebugApp/index.d.ts +0 -3
  88. package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
  89. package/src/components/DebugApp/DebugApp.tsx +0 -85
  90. package/src/components/DebugApp/Tree.tsx +0 -103
  91. package/src/components/DebugApp/index.ts +0 -7
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { pipe } from 'effect';
5
+ import * as Function from 'effect/Function';
6
6
  import React, { useCallback } from 'react';
7
7
 
8
8
  import {
@@ -13,9 +13,8 @@ import {
13
13
  contributes,
14
14
  createIntent,
15
15
  createSurface,
16
- useCapability,
17
- useIntentDispatcher,
18
16
  } from '@dxos/app-framework';
17
+ import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
19
18
  import {
20
19
  AutomergePanel,
21
20
  ConfigPanel,
@@ -52,10 +51,10 @@ import { ScriptAction } from '@dxos/plugin-script/types';
52
51
  import { SpaceAction } from '@dxos/plugin-space/types';
53
52
  import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
54
53
  import { StackItem } from '@dxos/react-ui-stack';
55
- import { DataType } from '@dxos/schema';
54
+ import { Collection } from '@dxos/schema';
56
55
 
57
56
  import {
58
- DebugApp,
57
+ DebugGraph,
59
58
  DebugObjectPanel,
60
59
  DebugSettings,
61
60
  DebugStatus,
@@ -63,7 +62,7 @@ import {
63
62
  SpaceGenerator,
64
63
  Wireframe,
65
64
  } from '../components';
66
- import { DEBUG_PLUGIN } from '../meta';
65
+ import { meta } from '../meta';
67
66
  import { type DebugSettingsProps, Devtools } from '../types';
68
67
 
69
68
  type SpaceDebug = {
@@ -73,10 +72,11 @@ type SpaceDebug = {
73
72
 
74
73
  type GraphDebug = {
75
74
  graph: Graph;
75
+ root: string;
76
76
  };
77
77
 
78
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
79
- const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
78
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
79
+ const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
80
80
 
81
81
  // TODO(wittjosiah): Factor out?
82
82
  const useCurrentSpace = () => {
@@ -90,14 +90,14 @@ const useCurrentSpace = () => {
90
90
  export default (context: PluginContext) =>
91
91
  contributes(Capabilities.ReactSurface, [
92
92
  createSurface({
93
- id: `${DEBUG_PLUGIN}/plugin-settings`,
93
+ id: `${meta.id}/plugin-settings`,
94
94
  role: 'article',
95
95
  filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
96
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
96
+ data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
97
97
  component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
98
98
  }),
99
99
  createSurface({
100
- id: `${DEBUG_PLUGIN}/space`,
100
+ id: `${meta.id}/space`,
101
101
  role: 'article',
102
102
  filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
103
103
  component: ({ data }) => {
@@ -111,13 +111,18 @@ export default (context: PluginContext) =>
111
111
 
112
112
  const collection =
113
113
  data.subject.space.state.get() === SpaceState.SPACE_READY &&
114
- data.subject.space.properties[DataType.Collection.typename]?.target;
115
- if (!Obj.instanceOf(DataType.Collection, collection)) {
114
+ data.subject.space.properties[Collection.Collection.typename]?.target;
115
+ if (!Obj.instanceOf(Collection.Collection, collection)) {
116
116
  return;
117
117
  }
118
118
 
119
119
  objects.forEach((object) => {
120
- void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
120
+ void dispatch(
121
+ createIntent(SpaceAction.AddObject, {
122
+ target: collection,
123
+ object,
124
+ }),
125
+ );
121
126
  });
122
127
  },
123
128
  [data.subject.space],
@@ -131,19 +136,17 @@ export default (context: PluginContext) =>
131
136
  },
132
137
  }),
133
138
  createSurface({
134
- id: `${DEBUG_PLUGIN}/graph`,
139
+ id: `${meta.id}/app-graph`,
135
140
  role: 'article',
136
141
  filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
137
- component: ({ data }) => <DebugApp graph={data.subject.graph} />,
142
+ component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
138
143
  }),
139
144
  createSurface({
140
- id: `${DEBUG_PLUGIN}/wireframe`,
145
+ id: `${meta.id}/wireframe`,
141
146
  role: ['article', 'section'],
142
147
  position: 'hoist',
143
148
  filter: (data): data is { subject: Obj.Any } => {
144
- const settings = context
145
- .getCapability(Capabilities.SettingsStore)
146
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
149
+ const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
147
150
  return Obj.isObject(data.subject) && !!settings.wireframe;
148
151
  },
149
152
  component: ({ data, role }) => (
@@ -151,18 +154,18 @@ export default (context: PluginContext) =>
151
154
  ),
152
155
  }),
153
156
  createSurface({
154
- id: `${DEBUG_PLUGIN}/object-debug`,
157
+ id: `${meta.id}/object-debug`,
155
158
  role: 'article',
156
159
  filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
157
160
  component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
158
161
  }),
159
162
  createSurface({
160
- id: `${DEBUG_PLUGIN}/devtools-overview`,
163
+ id: `${meta.id}/devtools-overview`,
161
164
  role: 'deck-companion--devtools',
162
165
  component: () => <DevtoolsOverviewContainer />,
163
166
  }),
164
167
  createSurface({
165
- id: `${DEBUG_PLUGIN}/status`,
168
+ id: `${meta.id}/status`,
166
169
  role: 'status',
167
170
  component: () => <DebugStatus />,
168
171
  }),
@@ -172,55 +175,55 @@ export default (context: PluginContext) =>
172
175
  //
173
176
 
174
177
  createSurface({
175
- id: `${DEBUG_PLUGIN}/client/config`,
178
+ id: `${meta.id}/client/config`,
176
179
  role: 'article',
177
180
  filter: (data): data is any => data.subject === Devtools.Client.Config,
178
181
  component: () => <ConfigPanel vaultSelector={false} />,
179
182
  }),
180
183
  createSurface({
181
- id: `${DEBUG_PLUGIN}/client/storage`,
184
+ id: `${meta.id}/client/storage`,
182
185
  role: 'article',
183
186
  filter: (data): data is any => data.subject === Devtools.Client.Storage,
184
187
  component: () => <StoragePanel />,
185
188
  }),
186
189
  createSurface({
187
- id: `${DEBUG_PLUGIN}/client/logs`,
190
+ id: `${meta.id}/client/logs`,
188
191
  role: 'article',
189
192
  filter: (data): data is any => data.subject === Devtools.Client.Logs,
190
193
  component: () => <LoggingPanel />,
191
194
  }),
192
195
  createSurface({
193
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
196
+ id: `${meta.id}/client/diagnostics`,
194
197
  role: 'article',
195
198
  filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
196
199
  component: () => <DiagnosticsPanel />,
197
200
  }),
198
201
  createSurface({
199
- id: `${DEBUG_PLUGIN}/client/tracing`,
202
+ id: `${meta.id}/client/tracing`,
200
203
  role: 'article',
201
204
  filter: (data): data is any => data.subject === Devtools.Client.Tracing,
202
205
  component: () => <TracingPanel />,
203
206
  }),
204
207
  createSurface({
205
- id: `${DEBUG_PLUGIN}/halo/identity`,
208
+ id: `${meta.id}/halo/identity`,
206
209
  role: 'article',
207
210
  filter: (data): data is any => data.subject === Devtools.Halo.Identity,
208
211
  component: () => <IdentityPanel />,
209
212
  }),
210
213
  createSurface({
211
- id: `${DEBUG_PLUGIN}/halo/devices`,
214
+ id: `${meta.id}/halo/devices`,
212
215
  role: 'article',
213
216
  filter: (data): data is any => data.subject === Devtools.Halo.Devices,
214
217
  component: () => <DeviceListPanel />,
215
218
  }),
216
219
  createSurface({
217
- id: `${DEBUG_PLUGIN}/halo/keyring`,
220
+ id: `${meta.id}/halo/keyring`,
218
221
  role: 'article',
219
222
  filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
220
223
  component: () => <KeyringPanel />,
221
224
  }),
222
225
  createSurface({
223
- id: `${DEBUG_PLUGIN}/halo/credentials`,
226
+ id: `${meta.id}/halo/credentials`,
224
227
  role: 'article',
225
228
  filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
226
229
  component: () => {
@@ -229,34 +232,46 @@ export default (context: PluginContext) =>
229
232
  },
230
233
  }),
231
234
  createSurface({
232
- id: `${DEBUG_PLUGIN}/echo/spaces`,
235
+ id: `${meta.id}/echo/spaces`,
233
236
  role: 'article',
234
237
  filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
235
238
  component: () => {
236
239
  const { dispatchPromise: dispatch } = useIntentDispatcher();
237
240
  const handleSelect = useCallback(
238
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
241
+ () =>
242
+ dispatch(
243
+ createIntent(LayoutAction.Open, {
244
+ part: 'main',
245
+ subject: [Devtools.Echo.Space],
246
+ }),
247
+ ),
239
248
  [dispatch],
240
249
  );
241
250
  return <SpaceListPanel onSelect={handleSelect} />;
242
251
  },
243
252
  }),
244
253
  createSurface({
245
- id: `${DEBUG_PLUGIN}/echo/space`,
254
+ id: `${meta.id}/echo/space`,
246
255
  role: 'article',
247
256
  filter: (data): data is any => data.subject === Devtools.Echo.Space,
248
257
  component: () => {
249
258
  const space = useCurrentSpace();
250
259
  const { dispatchPromise: dispatch } = useIntentDispatcher();
251
260
  const handleSelect = useCallback(
252
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
261
+ () =>
262
+ dispatch(
263
+ createIntent(LayoutAction.Open, {
264
+ part: 'main',
265
+ subject: [Devtools.Echo.Feeds],
266
+ }),
267
+ ),
253
268
  [dispatch],
254
269
  );
255
270
  return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
256
271
  },
257
272
  }),
258
273
  createSurface({
259
- id: `${DEBUG_PLUGIN}/echo/feeds`,
274
+ id: `${meta.id}/echo/feeds`,
260
275
  role: 'article',
261
276
  filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
262
277
  component: () => {
@@ -265,7 +280,7 @@ export default (context: PluginContext) =>
265
280
  },
266
281
  }),
267
282
  createSurface({
268
- id: `${DEBUG_PLUGIN}/echo/objects`,
283
+ id: `${meta.id}/echo/objects`,
269
284
  role: 'article',
270
285
  filter: (data): data is any => data.subject === Devtools.Echo.Objects,
271
286
  component: () => {
@@ -274,7 +289,7 @@ export default (context: PluginContext) =>
274
289
  },
275
290
  }),
276
291
  createSurface({
277
- id: `${DEBUG_PLUGIN}/echo/schema`,
292
+ id: `${meta.id}/echo/schema`,
278
293
  role: 'article',
279
294
  filter: (data): data is any => data.subject === Devtools.Echo.Schema,
280
295
  component: () => {
@@ -283,7 +298,7 @@ export default (context: PluginContext) =>
283
298
  },
284
299
  }),
285
300
  createSurface({
286
- id: `${DEBUG_PLUGIN}/echo/automerge`,
301
+ id: `${meta.id}/echo/automerge`,
287
302
  role: 'article',
288
303
  filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
289
304
  component: () => {
@@ -292,13 +307,13 @@ export default (context: PluginContext) =>
292
307
  },
293
308
  }),
294
309
  createSurface({
295
- id: `${DEBUG_PLUGIN}/echo/queues`,
310
+ id: `${meta.id}/echo/queues`,
296
311
  role: 'article',
297
312
  filter: (data): data is any => data.subject === Devtools.Echo.Queues,
298
313
  component: () => <QueuesPanel />,
299
314
  }),
300
315
  createSurface({
301
- id: `${DEBUG_PLUGIN}/echo/members`,
316
+ id: `${meta.id}/echo/members`,
302
317
  role: 'article',
303
318
  filter: (data): data is any => data.subject === Devtools.Echo.Members,
304
319
  component: () => {
@@ -307,25 +322,25 @@ export default (context: PluginContext) =>
307
322
  },
308
323
  }),
309
324
  createSurface({
310
- id: `${DEBUG_PLUGIN}/echo/metadata`,
325
+ id: `${meta.id}/echo/metadata`,
311
326
  role: 'article',
312
327
  filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
313
328
  component: () => <MetadataPanel />,
314
329
  }),
315
330
  createSurface({
316
- id: `${DEBUG_PLUGIN}/mesh/signal`,
331
+ id: `${meta.id}/mesh/signal`,
317
332
  role: 'article',
318
333
  filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
319
334
  component: () => <SignalPanel />,
320
335
  }),
321
336
  createSurface({
322
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
337
+ id: `${meta.id}/mesh/swarm`,
323
338
  role: 'article',
324
339
  filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
325
340
  component: () => <SwarmPanel />,
326
341
  }),
327
342
  createSurface({
328
- id: `${DEBUG_PLUGIN}/mesh/network`,
343
+ id: `${meta.id}/mesh/network`,
329
344
  role: 'article',
330
345
  filter: (data): data is any => data.subject === Devtools.Mesh.Network,
331
346
  component: () => {
@@ -335,19 +350,19 @@ export default (context: PluginContext) =>
335
350
  }),
336
351
  // TODO(wittjosiah): Remove?
337
352
  // createSurface({
338
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
353
+ // id: `${meta.id}/agent/dashboard`,
339
354
  // role: 'article',
340
355
  // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
341
356
  // component: () => <DashboardPanel />,
342
357
  // }),
343
358
  createSurface({
344
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
359
+ id: `${meta.id}/edge/dashboard`,
345
360
  role: 'article',
346
361
  filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
347
362
  component: () => <EdgeDashboardPanel />,
348
363
  }),
349
364
  createSurface({
350
- id: `${DEBUG_PLUGIN}/edge/workflows`,
365
+ id: `${meta.id}/edge/workflows`,
351
366
  role: 'article',
352
367
  filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
353
368
  component: () => {
@@ -356,7 +371,7 @@ export default (context: PluginContext) =>
356
371
  },
357
372
  }),
358
373
  createSurface({
359
- id: `${DEBUG_PLUGIN}/edge/traces`,
374
+ id: `${meta.id}/edge/traces`,
360
375
  role: 'article',
361
376
  filter: (data): data is any => data.subject === Devtools.Edge.Traces,
362
377
  component: () => {
@@ -365,7 +380,7 @@ export default (context: PluginContext) =>
365
380
  },
366
381
  }),
367
382
  createSurface({
368
- id: `${DEBUG_PLUGIN}/edge/testing`,
383
+ id: `${meta.id}/edge/testing`,
369
384
  role: 'article',
370
385
  filter: (data): data is any => data.subject === Devtools.Edge.Testing,
371
386
  component: () => {
@@ -382,11 +397,17 @@ export default (context: PluginContext) =>
382
397
  async (space: Space) => {
383
398
  await space.waitUntilReady();
384
399
  const result = await dispatch(
385
- pipe(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
400
+ Function.pipe(
401
+ createIntent(ScriptAction.CreateScript, { space }),
402
+ chain(SpaceAction.AddObject, { target: space }),
403
+ ),
386
404
  );
387
405
  log.info('script created', { result });
388
406
  await dispatch(
389
- createIntent(LayoutAction.Open, { part: 'main', subject: [`${space.id}:${result.data?.object.id}`] }),
407
+ createIntent(LayoutAction.Open, {
408
+ part: 'main',
409
+ subject: [`${space.id}:${result.data?.object.id}`],
410
+ }),
390
411
  );
391
412
  },
392
413
  [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 { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
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
- <SyntaxHighlighter classNames='flex text-xs' language='json'>
30
- {JSON.stringify(object, null, 2)}
31
- </SyntaxHighlighter>
29
+ <Json data={object} />
32
30
  </StackItem.Content>
33
31
  </Clipboard.Provider>
34
32
  );
@@ -4,15 +4,16 @@
4
4
 
5
5
  import React, { useEffect, useState } from 'react';
6
6
 
7
- import { Capabilities, useCapabilities } from '@dxos/app-framework';
7
+ import { Capabilities } from '@dxos/app-framework';
8
+ import { useCapabilities } from '@dxos/app-framework/react';
8
9
  import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
9
10
  import { log } from '@dxos/log';
10
11
  import { useClient } from '@dxos/react-client';
11
- import { Button, Icon, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
12
- import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
12
+ import { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
13
+ import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
13
14
  import { setDeep } from '@dxos/util';
14
15
 
15
- import { DEBUG_PLUGIN } from '../meta';
16
+ import { meta } from '../meta';
16
17
  import { type DebugSettingsProps } from '../types';
17
18
 
18
19
  type Toast = {
@@ -26,7 +27,7 @@ const StorageAdapters = {
26
27
  } as const;
27
28
 
28
29
  export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {
29
- const { t } = useTranslation(DEBUG_PLUGIN);
30
+ const { t } = useTranslation(meta.id);
30
31
  const [toast, setToast] = useState<Toast>();
31
32
  const client = useClient();
32
33
  const download = useFileDownload();
@@ -46,22 +47,30 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
46
47
 
47
48
  const handleDownload = async () => {
48
49
  const data = await client.diagnostics();
49
- const file = new Blob([JSON.stringify(data, undefined, 2)], { type: 'text/plain' });
50
+ const file = new Blob([JSON.stringify(data, undefined, 2)], {
51
+ type: 'text/plain',
52
+ });
50
53
  const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
51
54
  download(file, fileName);
52
55
 
53
56
  if (upload) {
54
- const info = await upload(new File([file], fileName), client.spaces.default);
57
+ const info = await upload(client.spaces.default, new File([file], fileName));
55
58
  if (!info) {
56
59
  log.error('diagnostics failed to upload to IPFS');
57
60
  return;
58
61
  }
59
- handleToast({ title: t('settings uploaded'), description: t('settings uploaded to clipboard') });
62
+ handleToast({
63
+ title: t('settings uploaded'),
64
+ description: t('settings uploaded to clipboard'),
65
+ });
60
66
 
61
67
  // TODO(nf): move to IpfsPlugin?
62
68
  const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
63
69
  void navigator.clipboard.writeText(url);
64
- handleToast({ title: t('settings uploaded'), description: t('settings uploaded to clipboard') });
70
+ handleToast({
71
+ title: t('settings uploaded'),
72
+ description: t('settings uploaded to clipboard'),
73
+ });
65
74
  log.info('diagnostics', { url });
66
75
  }
67
76
  };
@@ -70,74 +79,94 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
70
79
  try {
71
80
  const info = await client.repair();
72
81
  setStorageConfig(await Storage());
73
- handleToast({ title: t('settings repair success'), description: JSON.stringify(info, undefined, 2) });
82
+ handleToast({
83
+ title: t('settings repair success'),
84
+ description: JSON.stringify(info, undefined, 2),
85
+ });
74
86
  } catch (err: any) {
75
- handleToast({ title: t('settings repair failed'), description: err.message });
87
+ handleToast({
88
+ title: t('settings repair failed'),
89
+ description: err.message,
90
+ });
76
91
  }
77
92
  };
78
93
 
79
94
  return (
80
- <DeprecatedFormContainer>
81
- <DeprecatedFormInput label={t('settings wireframe')}>
82
- <Input.Switch checked={settings.wireframe} onCheckedChange={(checked) => (settings.wireframe = !!checked)} />
83
- </DeprecatedFormInput>
84
- <DeprecatedFormInput label={t('settings download diagnostics')}>
85
- <Button onClick={handleDownload}>
86
- <Icon icon='ph--download-simple--regular' size={5} />
87
- </Button>
88
- </DeprecatedFormInput>
89
- <DeprecatedFormInput label={t('settings repair')}>
90
- <Button onClick={handleRepair}>
91
- <Icon icon='ph--first-aid-kit--regular' size={5} />
92
- </Button>
93
- </DeprecatedFormInput>
94
-
95
- {/* TODO(burdon): Move to layout? */}
96
- {toast && (
97
- <Toast.Root>
98
- <Toast.Body>
99
- <Toast.Title>
100
- <Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
101
- <span>{toast.title}</span>
102
- </Toast.Title>
103
- {toast.description && <Toast.Description>{toast.description}</Toast.Description>}
104
- </Toast.Body>
105
- </Toast.Root>
106
- )}
107
-
108
- <DeprecatedFormInput label={t('settings choose storage adaptor')}>
109
- <Select.Root
110
- value={
111
- Object.entries(StorageAdapters).find(
112
- ([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
113
- )?.[0]
114
- }
115
- onValueChange={(value) => {
116
- if (confirm(t('settings storage adapter changed alert'))) {
117
- updateConfig(
118
- storageConfig,
119
- setStorageConfig,
120
- ['runtime', 'client', 'storage', 'dataStore'],
121
- StorageAdapters[value as keyof typeof StorageAdapters],
122
- );
123
- }
124
- }}
125
- >
126
- <Select.TriggerButton placeholder={t('settings data store label')} />
127
- <Select.Portal>
128
- <Select.Content>
129
- <Select.Viewport>
130
- {Object.keys(StorageAdapters).map((key) => (
131
- <Select.Option key={key} value={key}>
132
- {t(`settings storage adaptor ${key} label`)}
133
- </Select.Option>
134
- ))}
135
- </Select.Viewport>
136
- </Select.Content>
137
- </Select.Portal>
138
- </Select.Root>
139
- </DeprecatedFormInput>
140
- </DeprecatedFormContainer>
95
+ <ControlPage>
96
+ <ControlSection title={t('settings title', { ns: meta.id })}>
97
+ <ControlGroup>
98
+ <ControlItemInput title={t('settings wireframe')}>
99
+ <Input.Switch
100
+ checked={settings.wireframe}
101
+ onCheckedChange={(checked) => (settings.wireframe = !!checked)}
102
+ />
103
+ </ControlItemInput>
104
+ <ControlItemInput title={t('settings download diagnostics')}>
105
+ <IconButton
106
+ icon='ph--download-simple--regular'
107
+ iconOnly
108
+ label={t('settings download diagnostics')}
109
+ onClick={handleDownload}
110
+ />
111
+ </ControlItemInput>
112
+ <ControlItemInput title={t('settings repair')}>
113
+ <IconButton
114
+ icon='ph--first-aid-kit--regular'
115
+ iconOnly
116
+ label={t('settings repair')}
117
+ onClick={handleRepair}
118
+ />
119
+ </ControlItemInput>
120
+
121
+ {/* TODO(burdon): Move to layout? */}
122
+ {toast && (
123
+ <Toast.Root>
124
+ <Toast.Body>
125
+ <Toast.Title>
126
+ <Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
127
+ <span>{toast.title}</span>
128
+ </Toast.Title>
129
+ {toast.description && <Toast.Description>{toast.description}</Toast.Description>}
130
+ </Toast.Body>
131
+ </Toast.Root>
132
+ )}
133
+
134
+ <ControlItemInput title={t('settings choose storage adaptor')}>
135
+ <Select.Root
136
+ value={
137
+ Object.entries(StorageAdapters).find(
138
+ ([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
139
+ )?.[0]
140
+ }
141
+ onValueChange={(value) => {
142
+ if (confirm(t('settings storage adapter changed alert'))) {
143
+ updateConfig(
144
+ storageConfig,
145
+ setStorageConfig,
146
+ ['runtime', 'client', 'storage', 'dataStore'],
147
+ StorageAdapters[value as keyof typeof StorageAdapters],
148
+ );
149
+ }
150
+ }}
151
+ >
152
+ <Select.TriggerButton placeholder={t('settings data store label')} />
153
+ <Select.Portal>
154
+ <Select.Content>
155
+ <Select.Viewport>
156
+ {Object.keys(StorageAdapters).map((key) => (
157
+ <Select.Option key={key} value={key}>
158
+ {t(`settings storage adaptor ${key} label`)}
159
+ </Select.Option>
160
+ ))}
161
+ </Select.Viewport>
162
+ <Select.Arrow />
163
+ </Select.Content>
164
+ </Select.Portal>
165
+ </Select.Root>
166
+ </ControlItemInput>
167
+ </ControlGroup>
168
+ </ControlSection>
169
+ </ControlPage>
141
170
  );
142
171
  };
143
172
 
@@ -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 = undefined;
86
+ errorRef.current = null;
87
87
  forceUpdate({});
88
88
  };
89
89