@dxos/plugin-debug 0.8.4-main.5ea62a8 → 0.8.4-main.ae835ea

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 (56) hide show
  1. package/dist/lib/browser/{SpaceGenerator-C7XYY4YG.mjs → SpaceGenerator-7Q7CX64P.mjs} +226 -47
  2. package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +7 -0
  3. package/dist/lib/browser/{app-graph-builder-JTIEFOWZ.mjs → app-graph-builder-RXWTHLEW.mjs} +57 -56
  4. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
  6. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
  8. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +10 -13
  10. package/dist/lib/browser/index.mjs.map +3 -3
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
  13. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
  14. package/dist/lib/browser/{react-surface-446ZZTL6.mjs → react-surface-4XGZUT3Z.mjs} +59 -60
  15. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +7 -0
  16. package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
  17. package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
  18. package/dist/types/src/DebugPlugin.d.ts +1 -1
  19. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  22. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  23. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  24. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  25. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -1
  26. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/SpaceGenerator/presets.d.ts +5 -31
  28. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  29. package/dist/types/src/meta.d.ts +0 -1
  30. package/dist/types/src/meta.d.ts.map +1 -1
  31. package/dist/types/src/types.d.ts +1 -1
  32. package/dist/types/src/types.d.ts.map +1 -1
  33. package/dist/types/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +65 -63
  35. package/src/DebugPlugin.tsx +5 -6
  36. package/src/capabilities/app-graph-builder.ts +53 -52
  37. package/src/capabilities/react-context.tsx +2 -2
  38. package/src/capabilities/react-surface.tsx +42 -41
  39. package/src/components/DebugObjectPanel.tsx +2 -4
  40. package/src/components/DebugSettings.tsx +4 -4
  41. package/src/components/DebugStatus.tsx +2 -2
  42. package/src/components/SpaceGenerator/ObjectGenerator.tsx +16 -22
  43. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +3 -5
  44. package/src/components/SpaceGenerator/SpaceGenerator.tsx +4 -4
  45. package/src/components/SpaceGenerator/draw-util.ts +2 -2
  46. package/src/components/SpaceGenerator/presets.ts +177 -12
  47. package/src/components/Wireframe.tsx +1 -1
  48. package/src/meta.ts +6 -5
  49. package/src/types.ts +1 -1
  50. package/dist/lib/browser/SpaceGenerator-C7XYY4YG.mjs.map +0 -7
  51. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +0 -7
  52. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  53. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  54. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  55. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  56. package/dist/lib/browser/react-surface-446ZZTL6.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 {
@@ -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 = {
@@ -76,7 +76,7 @@ type GraphDebug = {
76
76
  root: string;
77
77
  };
78
78
 
79
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
79
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
80
80
  const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
81
81
 
82
82
  // TODO(wittjosiah): Factor out?
@@ -91,14 +91,14 @@ const useCurrentSpace = () => {
91
91
  export default (context: PluginContext) =>
92
92
  contributes(Capabilities.ReactSurface, [
93
93
  createSurface({
94
- id: `${DEBUG_PLUGIN}/plugin-settings`,
94
+ id: `${meta.id}/plugin-settings`,
95
95
  role: 'article',
96
96
  filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
97
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
97
+ data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
98
98
  component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
99
99
  }),
100
100
  createSurface({
101
- id: `${DEBUG_PLUGIN}/space`,
101
+ id: `${meta.id}/space`,
102
102
  role: 'article',
103
103
  filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
104
104
  component: ({ data }) => {
@@ -132,19 +132,17 @@ export default (context: PluginContext) =>
132
132
  },
133
133
  }),
134
134
  createSurface({
135
- id: `${DEBUG_PLUGIN}/graph`,
135
+ id: `${meta.id}/app-graph`,
136
136
  role: 'article',
137
137
  filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
138
138
  component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
139
139
  }),
140
140
  createSurface({
141
- id: `${DEBUG_PLUGIN}/wireframe`,
141
+ id: `${meta.id}/wireframe`,
142
142
  role: ['article', 'section'],
143
143
  position: 'hoist',
144
144
  filter: (data): data is { subject: Obj.Any } => {
145
- const settings = context
146
- .getCapability(Capabilities.SettingsStore)
147
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
145
+ const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
148
146
  return Obj.isObject(data.subject) && !!settings.wireframe;
149
147
  },
150
148
  component: ({ data, role }) => (
@@ -152,18 +150,18 @@ export default (context: PluginContext) =>
152
150
  ),
153
151
  }),
154
152
  createSurface({
155
- id: `${DEBUG_PLUGIN}/object-debug`,
153
+ id: `${meta.id}/object-debug`,
156
154
  role: 'article',
157
155
  filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
158
156
  component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
159
157
  }),
160
158
  createSurface({
161
- id: `${DEBUG_PLUGIN}/devtools-overview`,
159
+ id: `${meta.id}/devtools-overview`,
162
160
  role: 'deck-companion--devtools',
163
161
  component: () => <DevtoolsOverviewContainer />,
164
162
  }),
165
163
  createSurface({
166
- id: `${DEBUG_PLUGIN}/status`,
164
+ id: `${meta.id}/status`,
167
165
  role: 'status',
168
166
  component: () => <DebugStatus />,
169
167
  }),
@@ -173,55 +171,55 @@ export default (context: PluginContext) =>
173
171
  //
174
172
 
175
173
  createSurface({
176
- id: `${DEBUG_PLUGIN}/client/config`,
174
+ id: `${meta.id}/client/config`,
177
175
  role: 'article',
178
176
  filter: (data): data is any => data.subject === Devtools.Client.Config,
179
177
  component: () => <ConfigPanel vaultSelector={false} />,
180
178
  }),
181
179
  createSurface({
182
- id: `${DEBUG_PLUGIN}/client/storage`,
180
+ id: `${meta.id}/client/storage`,
183
181
  role: 'article',
184
182
  filter: (data): data is any => data.subject === Devtools.Client.Storage,
185
183
  component: () => <StoragePanel />,
186
184
  }),
187
185
  createSurface({
188
- id: `${DEBUG_PLUGIN}/client/logs`,
186
+ id: `${meta.id}/client/logs`,
189
187
  role: 'article',
190
188
  filter: (data): data is any => data.subject === Devtools.Client.Logs,
191
189
  component: () => <LoggingPanel />,
192
190
  }),
193
191
  createSurface({
194
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
192
+ id: `${meta.id}/client/diagnostics`,
195
193
  role: 'article',
196
194
  filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
197
195
  component: () => <DiagnosticsPanel />,
198
196
  }),
199
197
  createSurface({
200
- id: `${DEBUG_PLUGIN}/client/tracing`,
198
+ id: `${meta.id}/client/tracing`,
201
199
  role: 'article',
202
200
  filter: (data): data is any => data.subject === Devtools.Client.Tracing,
203
201
  component: () => <TracingPanel />,
204
202
  }),
205
203
  createSurface({
206
- id: `${DEBUG_PLUGIN}/halo/identity`,
204
+ id: `${meta.id}/halo/identity`,
207
205
  role: 'article',
208
206
  filter: (data): data is any => data.subject === Devtools.Halo.Identity,
209
207
  component: () => <IdentityPanel />,
210
208
  }),
211
209
  createSurface({
212
- id: `${DEBUG_PLUGIN}/halo/devices`,
210
+ id: `${meta.id}/halo/devices`,
213
211
  role: 'article',
214
212
  filter: (data): data is any => data.subject === Devtools.Halo.Devices,
215
213
  component: () => <DeviceListPanel />,
216
214
  }),
217
215
  createSurface({
218
- id: `${DEBUG_PLUGIN}/halo/keyring`,
216
+ id: `${meta.id}/halo/keyring`,
219
217
  role: 'article',
220
218
  filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
221
219
  component: () => <KeyringPanel />,
222
220
  }),
223
221
  createSurface({
224
- id: `${DEBUG_PLUGIN}/halo/credentials`,
222
+ id: `${meta.id}/halo/credentials`,
225
223
  role: 'article',
226
224
  filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
227
225
  component: () => {
@@ -230,7 +228,7 @@ export default (context: PluginContext) =>
230
228
  },
231
229
  }),
232
230
  createSurface({
233
- id: `${DEBUG_PLUGIN}/echo/spaces`,
231
+ id: `${meta.id}/echo/spaces`,
234
232
  role: 'article',
235
233
  filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
236
234
  component: () => {
@@ -243,7 +241,7 @@ export default (context: PluginContext) =>
243
241
  },
244
242
  }),
245
243
  createSurface({
246
- id: `${DEBUG_PLUGIN}/echo/space`,
244
+ id: `${meta.id}/echo/space`,
247
245
  role: 'article',
248
246
  filter: (data): data is any => data.subject === Devtools.Echo.Space,
249
247
  component: () => {
@@ -257,7 +255,7 @@ export default (context: PluginContext) =>
257
255
  },
258
256
  }),
259
257
  createSurface({
260
- id: `${DEBUG_PLUGIN}/echo/feeds`,
258
+ id: `${meta.id}/echo/feeds`,
261
259
  role: 'article',
262
260
  filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
263
261
  component: () => {
@@ -266,7 +264,7 @@ export default (context: PluginContext) =>
266
264
  },
267
265
  }),
268
266
  createSurface({
269
- id: `${DEBUG_PLUGIN}/echo/objects`,
267
+ id: `${meta.id}/echo/objects`,
270
268
  role: 'article',
271
269
  filter: (data): data is any => data.subject === Devtools.Echo.Objects,
272
270
  component: () => {
@@ -275,7 +273,7 @@ export default (context: PluginContext) =>
275
273
  },
276
274
  }),
277
275
  createSurface({
278
- id: `${DEBUG_PLUGIN}/echo/schema`,
276
+ id: `${meta.id}/echo/schema`,
279
277
  role: 'article',
280
278
  filter: (data): data is any => data.subject === Devtools.Echo.Schema,
281
279
  component: () => {
@@ -284,7 +282,7 @@ export default (context: PluginContext) =>
284
282
  },
285
283
  }),
286
284
  createSurface({
287
- id: `${DEBUG_PLUGIN}/echo/automerge`,
285
+ id: `${meta.id}/echo/automerge`,
288
286
  role: 'article',
289
287
  filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
290
288
  component: () => {
@@ -293,13 +291,13 @@ export default (context: PluginContext) =>
293
291
  },
294
292
  }),
295
293
  createSurface({
296
- id: `${DEBUG_PLUGIN}/echo/queues`,
294
+ id: `${meta.id}/echo/queues`,
297
295
  role: 'article',
298
296
  filter: (data): data is any => data.subject === Devtools.Echo.Queues,
299
297
  component: () => <QueuesPanel />,
300
298
  }),
301
299
  createSurface({
302
- id: `${DEBUG_PLUGIN}/echo/members`,
300
+ id: `${meta.id}/echo/members`,
303
301
  role: 'article',
304
302
  filter: (data): data is any => data.subject === Devtools.Echo.Members,
305
303
  component: () => {
@@ -308,25 +306,25 @@ export default (context: PluginContext) =>
308
306
  },
309
307
  }),
310
308
  createSurface({
311
- id: `${DEBUG_PLUGIN}/echo/metadata`,
309
+ id: `${meta.id}/echo/metadata`,
312
310
  role: 'article',
313
311
  filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
314
312
  component: () => <MetadataPanel />,
315
313
  }),
316
314
  createSurface({
317
- id: `${DEBUG_PLUGIN}/mesh/signal`,
315
+ id: `${meta.id}/mesh/signal`,
318
316
  role: 'article',
319
317
  filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
320
318
  component: () => <SignalPanel />,
321
319
  }),
322
320
  createSurface({
323
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
321
+ id: `${meta.id}/mesh/swarm`,
324
322
  role: 'article',
325
323
  filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
326
324
  component: () => <SwarmPanel />,
327
325
  }),
328
326
  createSurface({
329
- id: `${DEBUG_PLUGIN}/mesh/network`,
327
+ id: `${meta.id}/mesh/network`,
330
328
  role: 'article',
331
329
  filter: (data): data is any => data.subject === Devtools.Mesh.Network,
332
330
  component: () => {
@@ -336,19 +334,19 @@ export default (context: PluginContext) =>
336
334
  }),
337
335
  // TODO(wittjosiah): Remove?
338
336
  // createSurface({
339
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
337
+ // id: `${meta.id}/agent/dashboard`,
340
338
  // role: 'article',
341
339
  // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
342
340
  // component: () => <DashboardPanel />,
343
341
  // }),
344
342
  createSurface({
345
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
343
+ id: `${meta.id}/edge/dashboard`,
346
344
  role: 'article',
347
345
  filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
348
346
  component: () => <EdgeDashboardPanel />,
349
347
  }),
350
348
  createSurface({
351
- id: `${DEBUG_PLUGIN}/edge/workflows`,
349
+ id: `${meta.id}/edge/workflows`,
352
350
  role: 'article',
353
351
  filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
354
352
  component: () => {
@@ -357,7 +355,7 @@ export default (context: PluginContext) =>
357
355
  },
358
356
  }),
359
357
  createSurface({
360
- id: `${DEBUG_PLUGIN}/edge/traces`,
358
+ id: `${meta.id}/edge/traces`,
361
359
  role: 'article',
362
360
  filter: (data): data is any => data.subject === Devtools.Edge.Traces,
363
361
  component: () => {
@@ -366,7 +364,7 @@ export default (context: PluginContext) =>
366
364
  },
367
365
  }),
368
366
  createSurface({
369
- id: `${DEBUG_PLUGIN}/edge/testing`,
367
+ id: `${meta.id}/edge/testing`,
370
368
  role: 'article',
371
369
  filter: (data): data is any => data.subject === Devtools.Edge.Testing,
372
370
  component: () => {
@@ -383,7 +381,10 @@ export default (context: PluginContext) =>
383
381
  async (space: Space) => {
384
382
  await space.waitUntilReady();
385
383
  const result = await dispatch(
386
- 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
+ ),
387
388
  );
388
389
  log.info('script created', { result });
389
390
  await 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 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
  );
@@ -12,7 +12,7 @@ import { Button, Icon, Input, Select, Toast, useFileDownload, useTranslation } f
12
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();
@@ -51,7 +51,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
51
51
  download(file, fileName);
52
52
 
53
53
  if (upload) {
54
- const info = await upload(new File([file], fileName), client.spaces.default);
54
+ const info = await upload(client.spaces.default, new File([file], fileName));
55
55
  if (!info) {
56
56
  log.error('diagnostics failed to upload to IPFS');
57
57
  return;
@@ -78,7 +78,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
78
78
 
79
79
  return (
80
80
  <ControlPage>
81
- <ControlSection title={t('settings title', { ns: DEBUG_PLUGIN })}>
81
+ <ControlSection title={t('settings title', { ns: meta.id })}>
82
82
  <ControlGroup>
83
83
  <ControlItemInput title={t('settings wireframe')}>
84
84
  <Input.Switch
@@ -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
 
@@ -5,34 +5,33 @@
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 } from '@dxos/schema';
17
+ import { DataType, 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
- export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
25
-
26
23
  const findViewByTypename = async (views: DataType.View[], typename: string) => {
27
- return views.find((view) => view.query.typename === typename);
24
+ return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
28
25
  };
29
26
 
27
+ export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
28
+
30
29
  export const createGenerator = <T extends Obj.Any>(
31
30
  client: Client,
32
31
  dispatch: PromiseIntentDispatcher,
33
32
  schema: TypedObject<T>,
34
33
  ): ObjectGenerator<T> => {
35
- return async (space: Space, n: number, cb?: (objects: T[]) => void): Promise<T[]> => {
34
+ return async (space: Space, n: number): Promise<T[]> => {
36
35
  const typename = schema.typename;
37
36
 
38
37
  // Find or create table and view.
@@ -40,9 +39,9 @@ export const createGenerator = <T extends Obj.Any>(
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.
@@ -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
  }),
@@ -2,8 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
@@ -11,7 +9,8 @@ import { IntentPlugin } from '@dxos/app-framework';
11
9
  import { withPluginManager } from '@dxos/app-framework/testing';
12
10
  import { ClientPlugin } from '@dxos/plugin-client';
13
11
  import { useSpaces } from '@dxos/react-client/echo';
14
- import { render, withLayout, withTheme } from '@dxos/storybook-utils';
12
+ import { withTheme } from '@dxos/react-ui/testing';
13
+ import { render } from '@dxos/storybook-utils';
15
14
 
16
15
  import { SpaceGenerator } from './SpaceGenerator';
17
16
 
@@ -29,6 +28,7 @@ const meta = {
29
28
  component: SpaceGenerator as any,
30
29
  render: render(DefaultStory),
31
30
  decorators: [
31
+ withTheme,
32
32
  withPluginManager({
33
33
  plugins: [
34
34
  ClientPlugin({
@@ -39,8 +39,6 @@ const meta = {
39
39
  IntentPlugin(),
40
40
  ],
41
41
  }),
42
- withLayout(),
43
- withTheme,
44
42
  ],
45
43
  parameters: {
46
44
  layout: 'fullscreen',
@@ -8,8 +8,8 @@ import { useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { ComputeGraph } from '@dxos/conductor';
9
9
  import { Filter, type Obj } from '@dxos/echo';
10
10
  import { Markdown } from '@dxos/plugin-markdown/types';
11
- import { SheetType } from '@dxos/plugin-sheet/types';
12
- import { DiagramType } from '@dxos/plugin-sketch/types';
11
+ import { Sheet } from '@dxos/plugin-sheet/types';
12
+ import { Diagram } from '@dxos/plugin-sketch/types';
13
13
  import { useClient } from '@dxos/react-client';
14
14
  import { type Space, getTypename } from '@dxos/react-client/echo';
15
15
  import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
@@ -29,7 +29,7 @@ export type SpaceGeneratorProps = {
29
29
  export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
30
30
  const { dispatchPromise: dispatch } = useIntentDispatcher();
31
31
  const client = useClient();
32
- const staticTypes = [Markdown.Document, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
32
+ const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
33
33
  const recordTypes = [DataType.Organization, DataType.Person, DataType.Task];
34
34
  const [count, setCount] = useState(1);
35
35
  const [info, setInfo] = useState<any>({});
@@ -112,7 +112,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
112
112
  <SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
113
113
 
114
114
  <div>
115
- <SyntaxHighlighter classNames='flex text-xs' language='json'>
115
+ <SyntaxHighlighter language='json' classNames='text-xs'>
116
116
  {JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
117
117
  </SyntaxHighlighter>
118
118
  </div>
@@ -16,7 +16,7 @@ import {
16
16
  import { type Editor, type SerializedStore, type TLRecord, createBindingId, createShapeId } from '@tldraw/tldraw';
17
17
 
18
18
  import { faker } from '@dxos/random';
19
- import { isNotFalsy, range } from '@dxos/util';
19
+ import { isTruthy, range } from '@dxos/util';
20
20
 
21
21
  // TODO(burdon): Graph layout:
22
22
  // - https://www.npmjs.com/package/@antv/layout (uses d3)
@@ -67,7 +67,7 @@ export const generateGraph = (): Graph<PlainObject, PlainObject> => {
67
67
  }
68
68
  return target;
69
69
  })
70
- .filter(isNotFalsy);
70
+ .filter(isTruthy);
71
71
 
72
72
  for (const target of targets) {
73
73
  traverse(target);