@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.
Files changed (87) 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/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-VMWHGAJZ.mjs} +245 -69
  4. package/dist/lib/browser/SpaceGenerator-VMWHGAJZ.mjs.map +7 -0
  5. package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-I4IHBKKN.mjs} +75 -84
  6. package/dist/lib/browser/app-graph-builder-I4IHBKKN.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-5XPIRNQS.mjs → chunk-SVCKCXCL.mjs} +2 -4
  10. package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +14 -13
  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-QLZE7VSQ.mjs} +6 -6
  15. package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +7 -0
  16. package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-GFORPA3A.mjs} +78 -74
  17. package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +7 -0
  18. package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-EBVICEEW.mjs} +5 -5
  19. package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-EBVICEEW.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 +1 -1
  23. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/index.d.ts +5 -5
  25. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/react-context.d.ts +2 -2
  27. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  28. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  29. package/dist/types/src/capabilities/settings.d.ts +1 -1
  30. package/dist/types/src/components/DebugGraph.d.ts +8 -0
  31. package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
  32. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  33. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  34. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
  35. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  36. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  37. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
  38. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  40. package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -1
  41. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  42. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  43. package/dist/types/src/components/index.d.ts +2 -1
  44. package/dist/types/src/components/index.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts +0 -1
  46. package/dist/types/src/meta.d.ts.map +1 -1
  47. package/dist/types/src/translations.d.ts +2 -0
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/dist/types/src/types.d.ts +1 -1
  50. package/dist/types/src/types.d.ts.map +1 -1
  51. package/dist/types/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +66 -63
  53. package/src/DebugPlugin.tsx +6 -7
  54. package/src/capabilities/app-graph-builder.ts +63 -89
  55. package/src/capabilities/react-context.tsx +2 -2
  56. package/src/capabilities/react-surface.tsx +49 -47
  57. package/src/components/DebugGraph.tsx +14 -0
  58. package/src/components/DebugObjectPanel.tsx +2 -4
  59. package/src/components/DebugSettings.tsx +74 -66
  60. package/src/components/DebugStatus.tsx +2 -2
  61. package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -15
  62. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
  63. package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
  64. package/src/components/SpaceGenerator/draw-util.ts +5 -5
  65. package/src/components/SpaceGenerator/presets.ts +173 -12
  66. package/src/components/Wireframe.tsx +2 -1
  67. package/src/components/index.ts +1 -1
  68. package/src/meta.ts +1 -3
  69. package/src/translations.ts +2 -0
  70. package/src/types.ts +1 -1
  71. package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
  72. package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
  73. package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +0 -7
  74. package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
  75. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  76. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  77. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  78. package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
  79. package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
  80. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
  81. package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
  82. package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
  83. package/dist/types/src/components/DebugApp/index.d.ts +0 -3
  84. package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
  85. package/src/components/DebugApp/DebugApp.tsx +0 -84
  86. package/src/components/DebugApp/Tree.tsx +0 -103
  87. package/src/components/DebugApp/index.ts +0 -7
@@ -2,19 +2,19 @@
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 {
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, type Space, parseId } from '@dxos/react-client/echo';
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
- DebugApp,
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 { DEBUG_PLUGIN } from '../meta';
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 === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
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: `${DEBUG_PLUGIN}/plugin-settings`,
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 === DEBUG_PLUGIN,
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: `${DEBUG_PLUGIN}/space`,
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: `${DEBUG_PLUGIN}/graph`,
135
+ id: `${meta.id}/app-graph`,
135
136
  role: 'article',
136
137
  filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
137
- component: ({ data }) => <DebugApp graph={data.subject.graph} />,
138
+ component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
138
139
  }),
139
140
  createSurface({
140
- id: `${DEBUG_PLUGIN}/wireframe`,
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: `${DEBUG_PLUGIN}/object-debug`,
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: `${DEBUG_PLUGIN}/devtools-overview`,
159
+ id: `${meta.id}/devtools-overview`,
161
160
  role: 'deck-companion--devtools',
162
161
  component: () => <DevtoolsOverviewContainer />,
163
162
  }),
164
163
  createSurface({
165
- id: `${DEBUG_PLUGIN}/status`,
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: `${DEBUG_PLUGIN}/client/config`,
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: `${DEBUG_PLUGIN}/client/storage`,
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: `${DEBUG_PLUGIN}/client/logs`,
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: `${DEBUG_PLUGIN}/client/diagnostics`,
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: `${DEBUG_PLUGIN}/client/tracing`,
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: `${DEBUG_PLUGIN}/halo/identity`,
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: `${DEBUG_PLUGIN}/halo/devices`,
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: `${DEBUG_PLUGIN}/halo/keyring`,
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: `${DEBUG_PLUGIN}/halo/credentials`,
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: `${DEBUG_PLUGIN}/echo/spaces`,
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: `${DEBUG_PLUGIN}/echo/space`,
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: `${DEBUG_PLUGIN}/echo/feeds`,
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: `${DEBUG_PLUGIN}/echo/objects`,
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: `${DEBUG_PLUGIN}/echo/schema`,
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: `${DEBUG_PLUGIN}/echo/automerge`,
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: `${DEBUG_PLUGIN}/echo/queues`,
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: `${DEBUG_PLUGIN}/echo/members`,
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: `${DEBUG_PLUGIN}/echo/metadata`,
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: `${DEBUG_PLUGIN}/mesh/signal`,
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: `${DEBUG_PLUGIN}/mesh/swarm`,
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: `${DEBUG_PLUGIN}/mesh/network`,
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: `${DEBUG_PLUGIN}/agent/dashboard`,
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: `${DEBUG_PLUGIN}/edge/dashboard`,
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: `${DEBUG_PLUGIN}/edge/workflows`,
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: `${DEBUG_PLUGIN}/edge/traces`,
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: `${DEBUG_PLUGIN}/edge/testing`,
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(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
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 { 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
  );
@@ -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, defs, SaveConfig, Storage } from '@dxos/config';
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 { useTranslation, Button, Toast, Input, useFileDownload, Select, Icon } from '@dxos/react-ui';
12
- import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
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 { DEBUG_PLUGIN } from '../meta';
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(DEBUG_PLUGIN);
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
- <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>
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 = undefined;
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 { createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';
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-schema';
10
- import { DocumentType } from '@dxos/plugin-markdown/types';
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 { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
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 { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
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.typename === typename);
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, cb?: (objects: T[]) => void): Promise<T[]> => {
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
- DocumentType.typename,
56
+ Markdown.Document.typename,
57
57
  async (space, n, cb) => {
58
58
  const objects = range(n).map(() => {
59
59
  return space.db.add(
60
- Obj.make(DocumentType, {
60
+ Markdown.makeDocument({
61
61
  name: faker.commerce.productName(),
62
- content: Ref.make(Obj.make(DataType.Text, { content: faker.lorem.sentences(5) })),
62
+ content: faker.lorem.sentences(5),
63
63
  }),
64
64
  );
65
65
  });