@dxos/plugin-debug 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe

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 (65) hide show
  1. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
  2. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
  3. package/dist/lib/browser/{SpaceGenerator-SRCIEELZ.mjs → SpaceGenerator-46TAISVE.mjs} +142 -90
  4. package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +7 -0
  5. package/dist/lib/browser/{app-graph-builder-JTIEFOWZ.mjs → app-graph-builder-CRH2HJKT.mjs} +60 -59
  6. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
  8. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
  10. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +11 -14
  12. package/dist/lib/browser/index.mjs.map +3 -3
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
  15. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
  16. package/dist/lib/browser/{react-surface-HQPOGG33.mjs → react-surface-2SNVZDEA.mjs} +85 -84
  17. package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +7 -0
  18. package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
  19. package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
  20. package/dist/types/src/DebugPlugin.d.ts +1 -1
  21. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  24. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  25. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  26. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  27. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  28. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -1
  29. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -4
  31. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  32. package/dist/types/src/components/Wireframe.d.ts +1 -1
  33. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  34. package/dist/types/src/meta.d.ts +0 -1
  35. package/dist/types/src/meta.d.ts.map +1 -1
  36. package/dist/types/src/translations.d.ts +1 -1
  37. package/dist/types/src/types.d.ts +1 -1
  38. package/dist/types/src/types.d.ts.map +1 -1
  39. package/dist/types/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +67 -66
  41. package/src/DebugPlugin.tsx +5 -6
  42. package/src/capabilities/app-graph-builder.ts +59 -58
  43. package/src/capabilities/react-context.tsx +2 -2
  44. package/src/capabilities/react-surface.tsx +70 -50
  45. package/src/components/DebugObjectPanel.tsx +2 -4
  46. package/src/components/DebugSettings.tsx +39 -18
  47. package/src/components/DebugStatus.tsx +2 -2
  48. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  49. package/src/components/SpaceGenerator/ObjectGenerator.tsx +16 -22
  50. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  51. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +3 -5
  52. package/src/components/SpaceGenerator/SpaceGenerator.tsx +6 -6
  53. package/src/components/SpaceGenerator/draw-util.ts +2 -2
  54. package/src/components/SpaceGenerator/presets.ts +124 -59
  55. package/src/components/Wireframe.tsx +2 -3
  56. package/src/meta.ts +6 -5
  57. package/src/translations.ts +1 -1
  58. package/src/types.ts +1 -1
  59. package/dist/lib/browser/SpaceGenerator-SRCIEELZ.mjs.map +0 -7
  60. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +0 -7
  61. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  62. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  63. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  64. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  65. package/dist/lib/browser/react-surface-HQPOGG33.mjs.map +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,7 +51,7 @@ 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
57
  DebugGraph,
@@ -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 = {
@@ -76,7 +75,7 @@ type GraphDebug = {
76
75
  root: string;
77
76
  };
78
77
 
79
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
78
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
80
79
  const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
81
80
 
82
81
  // TODO(wittjosiah): Factor out?
@@ -91,14 +90,14 @@ const useCurrentSpace = () => {
91
90
  export default (context: PluginContext) =>
92
91
  contributes(Capabilities.ReactSurface, [
93
92
  createSurface({
94
- id: `${DEBUG_PLUGIN}/plugin-settings`,
93
+ id: `${meta.id}/plugin-settings`,
95
94
  role: 'article',
96
95
  filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
97
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
96
+ data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
98
97
  component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
99
98
  }),
100
99
  createSurface({
101
- id: `${DEBUG_PLUGIN}/space`,
100
+ id: `${meta.id}/space`,
102
101
  role: 'article',
103
102
  filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
104
103
  component: ({ data }) => {
@@ -112,13 +111,18 @@ export default (context: PluginContext) =>
112
111
 
113
112
  const collection =
114
113
  data.subject.space.state.get() === SpaceState.SPACE_READY &&
115
- data.subject.space.properties[DataType.Collection.typename]?.target;
116
- if (!Obj.instanceOf(DataType.Collection, collection)) {
114
+ data.subject.space.properties[Collection.Collection.typename]?.target;
115
+ if (!Obj.instanceOf(Collection.Collection, collection)) {
117
116
  return;
118
117
  }
119
118
 
120
119
  objects.forEach((object) => {
121
- void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
120
+ void dispatch(
121
+ createIntent(SpaceAction.AddObject, {
122
+ target: collection,
123
+ object,
124
+ }),
125
+ );
122
126
  });
123
127
  },
124
128
  [data.subject.space],
@@ -132,19 +136,17 @@ export default (context: PluginContext) =>
132
136
  },
133
137
  }),
134
138
  createSurface({
135
- id: `${DEBUG_PLUGIN}/graph`,
139
+ id: `${meta.id}/app-graph`,
136
140
  role: 'article',
137
141
  filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
138
142
  component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
139
143
  }),
140
144
  createSurface({
141
- id: `${DEBUG_PLUGIN}/wireframe`,
145
+ id: `${meta.id}/wireframe`,
142
146
  role: ['article', 'section'],
143
147
  position: 'hoist',
144
148
  filter: (data): data is { subject: Obj.Any } => {
145
- const settings = context
146
- .getCapability(Capabilities.SettingsStore)
147
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
149
+ const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
148
150
  return Obj.isObject(data.subject) && !!settings.wireframe;
149
151
  },
150
152
  component: ({ data, role }) => (
@@ -152,18 +154,18 @@ export default (context: PluginContext) =>
152
154
  ),
153
155
  }),
154
156
  createSurface({
155
- id: `${DEBUG_PLUGIN}/object-debug`,
157
+ id: `${meta.id}/object-debug`,
156
158
  role: 'article',
157
159
  filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
158
160
  component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
159
161
  }),
160
162
  createSurface({
161
- id: `${DEBUG_PLUGIN}/devtools-overview`,
163
+ id: `${meta.id}/devtools-overview`,
162
164
  role: 'deck-companion--devtools',
163
165
  component: () => <DevtoolsOverviewContainer />,
164
166
  }),
165
167
  createSurface({
166
- id: `${DEBUG_PLUGIN}/status`,
168
+ id: `${meta.id}/status`,
167
169
  role: 'status',
168
170
  component: () => <DebugStatus />,
169
171
  }),
@@ -173,55 +175,55 @@ export default (context: PluginContext) =>
173
175
  //
174
176
 
175
177
  createSurface({
176
- id: `${DEBUG_PLUGIN}/client/config`,
178
+ id: `${meta.id}/client/config`,
177
179
  role: 'article',
178
180
  filter: (data): data is any => data.subject === Devtools.Client.Config,
179
181
  component: () => <ConfigPanel vaultSelector={false} />,
180
182
  }),
181
183
  createSurface({
182
- id: `${DEBUG_PLUGIN}/client/storage`,
184
+ id: `${meta.id}/client/storage`,
183
185
  role: 'article',
184
186
  filter: (data): data is any => data.subject === Devtools.Client.Storage,
185
187
  component: () => <StoragePanel />,
186
188
  }),
187
189
  createSurface({
188
- id: `${DEBUG_PLUGIN}/client/logs`,
190
+ id: `${meta.id}/client/logs`,
189
191
  role: 'article',
190
192
  filter: (data): data is any => data.subject === Devtools.Client.Logs,
191
193
  component: () => <LoggingPanel />,
192
194
  }),
193
195
  createSurface({
194
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
196
+ id: `${meta.id}/client/diagnostics`,
195
197
  role: 'article',
196
198
  filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
197
199
  component: () => <DiagnosticsPanel />,
198
200
  }),
199
201
  createSurface({
200
- id: `${DEBUG_PLUGIN}/client/tracing`,
202
+ id: `${meta.id}/client/tracing`,
201
203
  role: 'article',
202
204
  filter: (data): data is any => data.subject === Devtools.Client.Tracing,
203
205
  component: () => <TracingPanel />,
204
206
  }),
205
207
  createSurface({
206
- id: `${DEBUG_PLUGIN}/halo/identity`,
208
+ id: `${meta.id}/halo/identity`,
207
209
  role: 'article',
208
210
  filter: (data): data is any => data.subject === Devtools.Halo.Identity,
209
211
  component: () => <IdentityPanel />,
210
212
  }),
211
213
  createSurface({
212
- id: `${DEBUG_PLUGIN}/halo/devices`,
214
+ id: `${meta.id}/halo/devices`,
213
215
  role: 'article',
214
216
  filter: (data): data is any => data.subject === Devtools.Halo.Devices,
215
217
  component: () => <DeviceListPanel />,
216
218
  }),
217
219
  createSurface({
218
- id: `${DEBUG_PLUGIN}/halo/keyring`,
220
+ id: `${meta.id}/halo/keyring`,
219
221
  role: 'article',
220
222
  filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
221
223
  component: () => <KeyringPanel />,
222
224
  }),
223
225
  createSurface({
224
- id: `${DEBUG_PLUGIN}/halo/credentials`,
226
+ id: `${meta.id}/halo/credentials`,
225
227
  role: 'article',
226
228
  filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
227
229
  component: () => {
@@ -230,34 +232,46 @@ export default (context: PluginContext) =>
230
232
  },
231
233
  }),
232
234
  createSurface({
233
- id: `${DEBUG_PLUGIN}/echo/spaces`,
235
+ id: `${meta.id}/echo/spaces`,
234
236
  role: 'article',
235
237
  filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
236
238
  component: () => {
237
239
  const { dispatchPromise: dispatch } = useIntentDispatcher();
238
240
  const handleSelect = useCallback(
239
- () => 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
+ ),
240
248
  [dispatch],
241
249
  );
242
250
  return <SpaceListPanel onSelect={handleSelect} />;
243
251
  },
244
252
  }),
245
253
  createSurface({
246
- id: `${DEBUG_PLUGIN}/echo/space`,
254
+ id: `${meta.id}/echo/space`,
247
255
  role: 'article',
248
256
  filter: (data): data is any => data.subject === Devtools.Echo.Space,
249
257
  component: () => {
250
258
  const space = useCurrentSpace();
251
259
  const { dispatchPromise: dispatch } = useIntentDispatcher();
252
260
  const handleSelect = useCallback(
253
- () => 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
+ ),
254
268
  [dispatch],
255
269
  );
256
270
  return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
257
271
  },
258
272
  }),
259
273
  createSurface({
260
- id: `${DEBUG_PLUGIN}/echo/feeds`,
274
+ id: `${meta.id}/echo/feeds`,
261
275
  role: 'article',
262
276
  filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
263
277
  component: () => {
@@ -266,7 +280,7 @@ export default (context: PluginContext) =>
266
280
  },
267
281
  }),
268
282
  createSurface({
269
- id: `${DEBUG_PLUGIN}/echo/objects`,
283
+ id: `${meta.id}/echo/objects`,
270
284
  role: 'article',
271
285
  filter: (data): data is any => data.subject === Devtools.Echo.Objects,
272
286
  component: () => {
@@ -275,7 +289,7 @@ export default (context: PluginContext) =>
275
289
  },
276
290
  }),
277
291
  createSurface({
278
- id: `${DEBUG_PLUGIN}/echo/schema`,
292
+ id: `${meta.id}/echo/schema`,
279
293
  role: 'article',
280
294
  filter: (data): data is any => data.subject === Devtools.Echo.Schema,
281
295
  component: () => {
@@ -284,7 +298,7 @@ export default (context: PluginContext) =>
284
298
  },
285
299
  }),
286
300
  createSurface({
287
- id: `${DEBUG_PLUGIN}/echo/automerge`,
301
+ id: `${meta.id}/echo/automerge`,
288
302
  role: 'article',
289
303
  filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
290
304
  component: () => {
@@ -293,13 +307,13 @@ export default (context: PluginContext) =>
293
307
  },
294
308
  }),
295
309
  createSurface({
296
- id: `${DEBUG_PLUGIN}/echo/queues`,
310
+ id: `${meta.id}/echo/queues`,
297
311
  role: 'article',
298
312
  filter: (data): data is any => data.subject === Devtools.Echo.Queues,
299
313
  component: () => <QueuesPanel />,
300
314
  }),
301
315
  createSurface({
302
- id: `${DEBUG_PLUGIN}/echo/members`,
316
+ id: `${meta.id}/echo/members`,
303
317
  role: 'article',
304
318
  filter: (data): data is any => data.subject === Devtools.Echo.Members,
305
319
  component: () => {
@@ -308,25 +322,25 @@ export default (context: PluginContext) =>
308
322
  },
309
323
  }),
310
324
  createSurface({
311
- id: `${DEBUG_PLUGIN}/echo/metadata`,
325
+ id: `${meta.id}/echo/metadata`,
312
326
  role: 'article',
313
327
  filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
314
328
  component: () => <MetadataPanel />,
315
329
  }),
316
330
  createSurface({
317
- id: `${DEBUG_PLUGIN}/mesh/signal`,
331
+ id: `${meta.id}/mesh/signal`,
318
332
  role: 'article',
319
333
  filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
320
334
  component: () => <SignalPanel />,
321
335
  }),
322
336
  createSurface({
323
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
337
+ id: `${meta.id}/mesh/swarm`,
324
338
  role: 'article',
325
339
  filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
326
340
  component: () => <SwarmPanel />,
327
341
  }),
328
342
  createSurface({
329
- id: `${DEBUG_PLUGIN}/mesh/network`,
343
+ id: `${meta.id}/mesh/network`,
330
344
  role: 'article',
331
345
  filter: (data): data is any => data.subject === Devtools.Mesh.Network,
332
346
  component: () => {
@@ -336,19 +350,19 @@ export default (context: PluginContext) =>
336
350
  }),
337
351
  // TODO(wittjosiah): Remove?
338
352
  // createSurface({
339
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
353
+ // id: `${meta.id}/agent/dashboard`,
340
354
  // role: 'article',
341
355
  // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
342
356
  // component: () => <DashboardPanel />,
343
357
  // }),
344
358
  createSurface({
345
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
359
+ id: `${meta.id}/edge/dashboard`,
346
360
  role: 'article',
347
361
  filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
348
362
  component: () => <EdgeDashboardPanel />,
349
363
  }),
350
364
  createSurface({
351
- id: `${DEBUG_PLUGIN}/edge/workflows`,
365
+ id: `${meta.id}/edge/workflows`,
352
366
  role: 'article',
353
367
  filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
354
368
  component: () => {
@@ -357,7 +371,7 @@ export default (context: PluginContext) =>
357
371
  },
358
372
  }),
359
373
  createSurface({
360
- id: `${DEBUG_PLUGIN}/edge/traces`,
374
+ id: `${meta.id}/edge/traces`,
361
375
  role: 'article',
362
376
  filter: (data): data is any => data.subject === Devtools.Edge.Traces,
363
377
  component: () => {
@@ -366,7 +380,7 @@ export default (context: PluginContext) =>
366
380
  },
367
381
  }),
368
382
  createSurface({
369
- id: `${DEBUG_PLUGIN}/edge/testing`,
383
+ id: `${meta.id}/edge/testing`,
370
384
  role: 'article',
371
385
  filter: (data): data is any => data.subject === Devtools.Edge.Testing,
372
386
  component: () => {
@@ -383,11 +397,17 @@ export default (context: PluginContext) =>
383
397
  async (space: Space) => {
384
398
  await space.waitUntilReady();
385
399
  const result = await dispatch(
386
- 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
+ ),
387
404
  );
388
405
  log.info('script created', { result });
389
406
  await dispatch(
390
- 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
+ }),
391
411
  );
392
412
  },
393
413
  [dispatch],
@@ -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 language='json' classNames='text-xs'>
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 { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
12
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,15 +79,21 @@ 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
95
  <ControlPage>
81
- <ControlSection title={t('settings title', { ns: DEBUG_PLUGIN })}>
96
+ <ControlSection title={t('settings title', { ns: meta.id })}>
82
97
  <ControlGroup>
83
98
  <ControlItemInput title={t('settings wireframe')}>
84
99
  <Input.Switch
@@ -87,14 +102,20 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
87
102
  />
88
103
  </ControlItemInput>
89
104
  <ControlItemInput title={t('settings download diagnostics')}>
90
- <Button onClick={handleDownload}>
91
- <Icon icon='ph--download-simple--regular' size={5} />
92
- </Button>
105
+ <IconButton
106
+ icon='ph--download-simple--regular'
107
+ iconOnly
108
+ label={t('settings download diagnostics')}
109
+ onClick={handleDownload}
110
+ />
93
111
  </ControlItemInput>
94
112
  <ControlItemInput title={t('settings repair')}>
95
- <Button onClick={handleRepair}>
96
- <Icon icon='ph--first-aid-kit--regular' size={5} />
97
- </Button>
113
+ <IconButton
114
+ icon='ph--first-aid-kit--regular'
115
+ iconOnly
116
+ label={t('settings repair')}
117
+ onClick={handleRepair}
118
+ />
98
119
  </ControlItemInput>
99
120
 
100
121
  {/* TODO(burdon): Move to layout? */}
@@ -114,7 +135,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
114
135
  <Select.Root
115
136
  value={
116
137
  Object.entries(StorageAdapters).find(
117
- ([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
138
+ ([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
118
139
  )?.[0]
119
140
  }
120
141
  onValueChange={(value) => {
@@ -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
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { Surface } from '@dxos/app-framework';
7
+ import { Surface } from '@dxos/app-framework/react';
8
8
  import { StatsPanel, useStats } from '@dxos/devtools';
9
9
 
10
10
  export const DevtoolsOverviewContainer = () => {
@@ -5,24 +5,23 @@
5
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
- import { DXN, Filter, Key, Obj, Ref, Type } from '@dxos/echo';
9
- import { type TypedObject } from '@dxos/echo-schema';
8
+ import { DXN, Filter, Key, type Obj, Type } from '@dxos/echo';
9
+ import { type TypedObject } from '@dxos/echo/internal';
10
10
  import { Markdown } from '@dxos/plugin-markdown/types';
11
- import { createSheet } from '@dxos/plugin-sheet/types';
12
- import { type CellValue, SheetType } from '@dxos/plugin-sheet/types';
13
- import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
11
+ import { Sheet } from '@dxos/plugin-sheet/types';
12
+ import { Diagram } from '@dxos/plugin-sketch/types';
14
13
  import { SpaceAction } from '@dxos/plugin-space/types';
15
14
  import { faker } from '@dxos/random';
16
15
  import { type Client } from '@dxos/react-client';
17
16
  import { type Space } from '@dxos/react-client/echo';
18
- import { DataType, typenameFromQuery } from '@dxos/schema';
17
+ import { View, getTypenameFromQuery } from '@dxos/schema';
19
18
  import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
20
19
  import { range } from '@dxos/util';
21
20
 
22
21
  const generator: ValueGenerator = faker as any;
23
22
 
24
- const findViewByTypename = async (views: DataType.View[], typename: string) => {
25
- return views.find((view) => typenameFromQuery(view.query) === typename);
23
+ const findViewByTypename = async (views: View.View[], typename: string) => {
24
+ return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
26
25
  };
27
26
 
28
27
  export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
@@ -36,13 +35,13 @@ export const createGenerator = <T extends Obj.Any>(
36
35
  const typename = schema.typename;
37
36
 
38
37
  // Find or create table and view.
39
- const { objects: views } = await space.db.query(Filter.type(DataType.View)).run();
38
+ const { objects: views } = await space.db.query(Filter.type(View.View)).run();
40
39
  const view = await findViewByTypename(views, typename);
41
40
  const staticSchema = client?.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
42
41
  if (!view && !staticSchema) {
43
- await dispatch(createIntent(SpaceAction.AddSchema, { space, schema }));
42
+ await dispatch(createIntent(SpaceAction.AddSchema, { space, schema, show: false }));
44
43
  } else if (!view && staticSchema) {
45
- await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename }));
44
+ await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename, show: false }));
46
45
  }
47
46
 
48
47
  // Create objects.
@@ -57,7 +56,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
57
56
  async (space, n, cb) => {
58
57
  const objects = range(n).map(() => {
59
58
  return space.db.add(
60
- Markdown.makeDocument({
59
+ Markdown.make({
61
60
  name: faker.commerce.productName(),
62
61
  content: faker.lorem.sentences(5),
63
62
  }),
@@ -69,16 +68,11 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
69
68
  },
70
69
  ],
71
70
  [
72
- DiagramType.typename,
71
+ Diagram.Diagram.typename,
73
72
  async (space, n, cb) => {
74
73
  const objects = range(n).map(() => {
75
74
  // TODO(burdon): Generate diagram.
76
- const obj = space.db.add(
77
- Obj.make(DiagramType, {
78
- name: faker.commerce.productName(),
79
- canvas: Ref.make(Obj.make(CanvasType, { content: {} })),
80
- }),
81
- );
75
+ const obj = space.db.add(Diagram.make({ name: faker.commerce.productName() }));
82
76
 
83
77
  return obj;
84
78
  });
@@ -89,10 +83,10 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
89
83
  ],
90
84
  // TODO(burdon): Create unit tests.
91
85
  [
92
- SheetType.typename,
86
+ Sheet.Sheet.typename,
93
87
  async (space, n, cb) => {
94
88
  const objects = range(n).map(() => {
95
- const cells: Record<string, CellValue> = {};
89
+ const cells: Record<string, Sheet.CellValue> = {};
96
90
  const year = new Date().getFullYear();
97
91
  const cols = 4;
98
92
  const rows = 16;
@@ -114,7 +108,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
114
108
  // TODO(burdon): Set width.
115
109
  // TODO(burdon): Set formatting for columns.
116
110
  return space.db.add(
117
- createSheet({
111
+ Sheet.make({
118
112
  name: faker.commerce.productName(),
119
113
  cells,
120
114
  }),
@@ -19,8 +19,8 @@ export const SchemaTable = ({ types, objects = {}, label, onClick }: SchemaTable
19
19
  <h2 className='p-2'>{label}</h2>
20
20
  {types.map((type) => (
21
21
  <div key={type.typename} className='grid grid-cols-subgrid col-span-3 items-center'>
22
- <div className='px-2 text-sm font-mono text-subdued'>{type.typename}</div>
23
- <div className='px-2 text-right font-mono'>{objects[type.typename] ?? 0}</div>
22
+ <div className='pli-2 text-sm font-mono text-subdued'>{type.typename}</div>
23
+ <div className='pli-2 text-right font-mono'>{objects[type.typename] ?? 0}</div>
24
24
  <IconButton
25
25
  variant='ghost'
26
26
  icon='ph--plus--regular'