@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6

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 (149) hide show
  1. package/dist/lib/browser/index.mjs +101 -100
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/DebugPlugin.d.ts +7 -1
  5. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  6. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  7. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  8. package/dist/types/src/capabilities/index.d.ts +12 -5
  9. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  10. package/dist/types/src/capabilities/react-context.d.ts +4 -2
  11. package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
  12. package/dist/types/src/capabilities/react-surface.d.ts +7 -2
  13. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  14. package/dist/types/src/capabilities/settings.d.ts +8 -2
  15. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  16. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  17. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  18. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +79 -0
  19. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  20. package/dist/types/src/components/DebugSettings/index.d.ts +3 -0
  21. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  22. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
  23. package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
  24. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
  25. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
  26. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  27. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  28. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  29. package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
  30. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  31. package/dist/types/src/components/index.d.ts +4 -10
  32. package/dist/types/src/components/index.d.ts.map +1 -1
  33. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
  34. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  35. package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
  36. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  37. package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +2 -2
  38. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  39. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
  40. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  41. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
  42. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  43. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
  44. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  45. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  46. package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
  47. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  48. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  49. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  50. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
  51. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  52. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +15 -0
  53. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
  54. package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
  55. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  56. package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
  57. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  58. package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
  59. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  60. package/dist/types/src/containers/index.d.ts +9 -0
  61. package/dist/types/src/containers/index.d.ts.map +1 -0
  62. package/dist/types/src/meta.d.ts +2 -2
  63. package/dist/types/src/meta.d.ts.map +1 -1
  64. package/dist/types/src/translations.d.ts +60 -58
  65. package/dist/types/src/translations.d.ts.map +1 -1
  66. package/dist/types/src/types/Settings.d.ts +6 -0
  67. package/dist/types/src/types/Settings.d.ts.map +1 -0
  68. package/dist/types/src/types/index.d.ts +67 -0
  69. package/dist/types/src/types/index.d.ts.map +1 -0
  70. package/dist/types/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +83 -70
  72. package/src/DebugPlugin.tsx +31 -33
  73. package/src/capabilities/app-graph-builder.ts +363 -388
  74. package/src/capabilities/index.ts +5 -5
  75. package/src/capabilities/react-context.tsx +16 -7
  76. package/src/capabilities/react-surface.tsx +360 -337
  77. package/src/capabilities/settings.ts +24 -12
  78. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  79. package/src/components/DebugSettings/DebugSettings.tsx +228 -0
  80. package/src/components/DebugSettings/index.ts +7 -0
  81. package/src/components/SchemaTable/index.ts +5 -0
  82. package/src/components/SpaceGenerator/ObjectGenerator.tsx +21 -23
  83. package/src/components/SpaceGenerator/index.ts +2 -3
  84. package/src/components/SpaceGenerator/presets.ts +243 -121
  85. package/src/components/index.ts +4 -8
  86. package/src/containers/DebugGraph/DebugGraph.tsx +13 -0
  87. package/src/containers/DebugGraph/index.ts +7 -0
  88. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +47 -0
  89. package/src/containers/DebugObjectPanel/index.ts +7 -0
  90. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +55 -0
  91. package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
  92. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -17
  93. package/src/containers/DebugStatus/index.ts +7 -0
  94. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  95. package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
  96. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +130 -0
  97. package/src/containers/SpaceGenerator/index.ts +7 -0
  98. package/src/{components → containers/Wireframe}/Wireframe.tsx +6 -7
  99. package/src/containers/Wireframe/index.ts +7 -0
  100. package/src/containers/index.ts +13 -0
  101. package/src/meta.ts +3 -3
  102. package/src/translations.ts +66 -58
  103. package/src/types/Settings.ts +15 -0
  104. package/src/{types.ts → types/index.ts} +12 -10
  105. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  106. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  107. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  108. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  109. package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs +0 -1159
  110. package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +0 -7
  111. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs +0 -588
  112. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +0 -7
  113. package/dist/lib/browser/chunk-SRV2AIGJ.mjs +0 -68
  114. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  115. package/dist/lib/browser/chunk-WZFZ4ESO.mjs +0 -20
  116. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  117. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  118. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  119. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs +0 -772
  120. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +0 -7
  121. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  122. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  123. package/dist/types/src/components/Container.d.ts +0 -5
  124. package/dist/types/src/components/Container.d.ts.map +0 -1
  125. package/dist/types/src/components/DebugGraph.d.ts +0 -8
  126. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  127. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  128. package/dist/types/src/components/DebugSettings.d.ts +0 -6
  129. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  130. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  131. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  132. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  133. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  134. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +0 -1
  135. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
  136. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  137. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  138. package/dist/types/src/types.d.ts +0 -63
  139. package/dist/types/src/types.d.ts.map +0 -1
  140. package/src/components/Container.tsx +0 -15
  141. package/src/components/DebugGraph.tsx +0 -14
  142. package/src/components/DebugObjectPanel.tsx +0 -33
  143. package/src/components/DebugSettings.tsx +0 -159
  144. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  145. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
  146. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -122
  147. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  148. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  149. /package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
@@ -0,0 +1,55 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useState } from 'react';
6
+
7
+ import { ObjectsTree } from '@dxos/devtools';
8
+ import { type Database, Filter, Query } from '@dxos/echo';
9
+ import type { ObjectId } from '@dxos/keys';
10
+ import { useActiveSpace } from '@dxos/app-toolkit/ui';
11
+ import { useQuery } from '@dxos/react-client/echo';
12
+ import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
13
+ import { Json } from '@dxos/react-ui-syntax-highlighter';
14
+
15
+ export const DebugSpaceObjectsPanel = () => {
16
+ const space = useActiveSpace();
17
+ if (!space) {
18
+ return null;
19
+ }
20
+
21
+ return <DebugSpaceObjectsPanelMain database={space.db} />;
22
+ };
23
+
24
+ const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database }) => {
25
+ const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
26
+
27
+ const [selectedObject] = useQuery(
28
+ database,
29
+ selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
30
+ );
31
+
32
+ return (
33
+ <Clipboard.Provider>
34
+ <Panel.Root>
35
+ <Panel.Toolbar asChild>
36
+ <Toolbar.Root>
37
+ <Input.Root>
38
+ <Input.TextInput disabled placeholder='Search...' />
39
+ </Input.Root>
40
+ </Toolbar.Root>
41
+ </Panel.Toolbar>
42
+ <Panel.Content asChild>
43
+ <Grid rows={2} classNames='divide-y divide-separator'>
44
+ <ScrollArea.Root>
45
+ <ScrollArea.Viewport>
46
+ <ObjectsTree db={database} onSelect={(entity) => setSelectedId(entity.id)} />
47
+ </ScrollArea.Viewport>
48
+ </ScrollArea.Root>
49
+ {selectedObject && <Json.Data classNames='p-1' data={selectedObject} />}
50
+ </Grid>
51
+ </Panel.Content>
52
+ </Panel.Root>
53
+ </Clipboard.Provider>
54
+ );
55
+ };
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { DebugSpaceObjectsPanel } from './DebugSpaceObjectsPanel';
6
+
7
+ export default DebugSpaceObjectsPanel;
@@ -5,11 +5,11 @@
5
5
  import React, { useEffect, useRef, useState } from 'react';
6
6
 
7
7
  import { TimeoutError } from '@dxos/async';
8
- import { useActiveSpace } from '@dxos/plugin-space';
8
+ import { useActiveSpace } from '@dxos/app-toolkit/ui';
9
9
  import { StatusBar } from '@dxos/plugin-status-bar';
10
10
  import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
11
11
  import { useNetworkStatus } from '@dxos/react-client/mesh';
12
- import { Icon } from '@dxos/react-ui';
12
+ import { IconButton } from '@dxos/react-ui';
13
13
 
14
14
  const styles = {
15
15
  success: 'text-sky-300 dark:text-green-700',
@@ -89,14 +89,20 @@ const ErrorIndicator = () => {
89
89
 
90
90
  if (errorRef.current) {
91
91
  return (
92
- <StatusBar.Button title={errorRef.current.message} onClick={handleReset}>
93
- <Icon icon='ph--warning-circle--duotone' size={4} classNames={styles.error} />
94
- </StatusBar.Button>
92
+ <StatusBar.Item>
93
+ <IconButton
94
+ icon='ph--warning-circle--duotone'
95
+ iconOnly
96
+ label={errorRef.current.message}
97
+ classNames={styles.error}
98
+ onClick={handleReset}
99
+ />
100
+ </StatusBar.Item>
95
101
  );
96
102
  } else {
97
103
  return (
98
- <StatusBar.Item title='No errors.'>
99
- <Icon icon='ph--check--regular' size={4} />
104
+ <StatusBar.Item>
105
+ <IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />
100
106
  </StatusBar.Item>
101
107
  );
102
108
  }
@@ -114,14 +120,20 @@ const SwarmIndicator = () => {
114
120
 
115
121
  if (state === 0) {
116
122
  return (
117
- <StatusBar.Item title='Connected to swarm.'>
118
- <Icon icon='ph--lightning--regular' size={4} />
123
+ <StatusBar.Item>
124
+ <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />
119
125
  </StatusBar.Item>
120
126
  );
121
127
  } else {
122
128
  return (
123
- <StatusBar.Item title='Disconnected from swarm.'>
124
- <Icon icon='ph--lightning-slash--regular' size={4} classNames={styles.warning} />
129
+ <StatusBar.Item>
130
+ <IconButton
131
+ variant='ghost'
132
+ icon='ph--lightning-slash--regular'
133
+ iconOnly
134
+ label='Disconnected from swarm.'
135
+ classNames={styles.warning}
136
+ />
125
137
  </StatusBar.Item>
126
138
  );
127
139
  }
@@ -156,21 +168,33 @@ const SavingIndicator = () => {
156
168
  switch (state) {
157
169
  case 2:
158
170
  return (
159
- <StatusBar.Item title='Edit not saved.'>
160
- <Icon icon='ph--circle--duotone' size={4} classNames={styles.warning} />
171
+ <StatusBar.Item>
172
+ <IconButton
173
+ variant='ghost'
174
+ icon='ph--circle--duotone'
175
+ iconOnly
176
+ label='Edit not saved.'
177
+ classNames={styles.warning}
178
+ />
161
179
  </StatusBar.Item>
162
180
  );
163
181
  case 1:
164
182
  return (
165
- <StatusBar.Item title='Saving...'>
166
- <Icon icon='ph--circle--duotone' size={4} classNames={styles.success} />
183
+ <StatusBar.Item>
184
+ <IconButton
185
+ variant='ghost'
186
+ icon='ph--circle--duotone'
187
+ iconOnly
188
+ label='Saving...'
189
+ classNames={styles.success}
190
+ />
167
191
  </StatusBar.Item>
168
192
  );
169
193
  case 0:
170
194
  default:
171
195
  return (
172
- <StatusBar.Item title='Modified indicator.'>
173
- <Icon icon='ph--circle--duotone' size={4} />
196
+ <StatusBar.Item>
197
+ <IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />
174
198
  </StatusBar.Item>
175
199
  );
176
200
  }
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { DebugStatus } from './DebugStatus';
6
+
7
+ export default DebugStatus;
@@ -0,0 +1,25 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+ import { StatsPanel, useStats } from '@dxos/devtools';
9
+
10
+ export const DevtoolsOverviewContainer = () => {
11
+ const [stats, refreshStats] = useStats();
12
+ const surfaceProfilerStats = Surface.useProfilerStats();
13
+ const clearSurfaceProfiler = Surface.useProfilerClear();
14
+
15
+ return (
16
+ <StatsPanel
17
+ stats={stats}
18
+ surfaceProfilerStats={surfaceProfilerStats}
19
+ onRefresh={refreshStats}
20
+ onClearSurfaceProfiler={clearSurfaceProfiler}
21
+ >
22
+ <Surface.Surface role='devtools-overview' />
23
+ </StatsPanel>
24
+ );
25
+ };
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { DevtoolsOverviewContainer } from './DevtoolsOverviewContainer';
6
+
7
+ export default DevtoolsOverviewContainer;
@@ -0,0 +1,130 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useMemo, useState } from 'react';
6
+
7
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { ComputeGraph } from '@dxos/conductor';
9
+ import { Filter, Obj, type Type } from '@dxos/echo';
10
+ import { Markdown } from '@dxos/plugin-markdown/types';
11
+ import { Sheet } from '@dxos/plugin-sheet/types';
12
+ import { Sketch } from '@dxos/plugin-sketch/types';
13
+ import { useClient } from '@dxos/react-client';
14
+ import { type Space } from '@dxos/react-client/echo';
15
+ import { IconButton, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from '@dxos/react-ui';
16
+ import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
17
+ import { Organization, Person, Task } from '@dxos/types';
18
+ import { composable, composableProps } from '@dxos/ui-theme';
19
+ import { jsonKeyReplacer, sortKeys } from '@dxos/util';
20
+
21
+ import { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';
22
+
23
+ export type SpaceGeneratorProps = {
24
+ space: Space;
25
+ onCreateObjects?: (objects: Obj.Unknown[]) => void;
26
+ };
27
+
28
+ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
29
+ ({ space, onCreateObjects, children, ...props }, forwardedRef) => {
30
+ const { invokePromise } = useOperationInvoker();
31
+ const client = useClient();
32
+ const staticTypes = [Markdown.Document, Sketch.Sketch, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
33
+ const recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];
34
+ const [count, setCount] = useState(1);
35
+ const [info, setInfo] = useState<any>({});
36
+ const presets = useMemo(() => generator(), []);
37
+
38
+ // Register types.
39
+ useAsyncEffect(async () => {
40
+ await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
41
+ }, [client]);
42
+
43
+ // Create type generators.
44
+ const typeMap = useMemo(() => {
45
+ const recordGenerators = new Map<string, ObjectGenerator<any>>(
46
+ recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
47
+ );
48
+
49
+ return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
50
+ }, [client, recordTypes, invokePromise]);
51
+
52
+ // Query space to get info.
53
+ const updateInfo = async () => {
54
+ // Create schema map.
55
+ const echoSchema = await space.db.schemaRegistry.query().run();
56
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
57
+
58
+ // Create object map.
59
+ const objects = await space.db.query(Filter.everything()).run();
60
+ const objectMap = sortKeys(
61
+ objects.reduce<Record<string, number>>((map, obj) => {
62
+ const type = Obj.getTypename(obj);
63
+ if (type) {
64
+ const count = map[type] ?? 0;
65
+ map[type] = count + 1;
66
+ }
67
+
68
+ return map;
69
+ }, {}),
70
+ );
71
+
72
+ setInfo({
73
+ schema: {
74
+ static: staticSchema.length,
75
+ mutable: echoSchema.length,
76
+ },
77
+ objects: objectMap,
78
+ });
79
+ };
80
+
81
+ useAsyncEffect(updateInfo, [space]);
82
+
83
+ const handleCreateData = useCallback(
84
+ async (typename: string) => {
85
+ const constructor = typeMap.get(typename);
86
+ if (constructor) {
87
+ // TODO(burdon): Input to specify number of objects.
88
+ await constructor(space, count, onCreateObjects);
89
+ await updateInfo();
90
+ }
91
+ },
92
+ [typeMap, count],
93
+ );
94
+
95
+ return (
96
+ <Panel.Root {...composableProps(props)} ref={forwardedRef}>
97
+ <Panel.Toolbar asChild>
98
+ <Toolbar.Root>
99
+ <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
100
+ <Toolbar.Separator />
101
+ <Input.Root>
102
+ <Input.TextInput
103
+ type='number'
104
+ placeholder='Count'
105
+ classNames='w-[4rem] text-right'
106
+ min={1}
107
+ max={100}
108
+ size={8}
109
+ value={count}
110
+ onChange={(event) => setCount(parseInt(event.target.value))}
111
+ />
112
+ </Input.Root>
113
+ </Toolbar.Root>
114
+ </Panel.Toolbar>
115
+ <Panel.Content asChild>
116
+ <ScrollArea.Root thin orientation='vertical'>
117
+ <ScrollArea.Viewport classNames='gap-4 divide-y divide-subdued-separator'>
118
+ <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
119
+ <SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
120
+ <SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
121
+ <SyntaxHighlighter language='json' classNames='text-xs'>
122
+ {JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
123
+ </SyntaxHighlighter>
124
+ </ScrollArea.Viewport>
125
+ </ScrollArea.Root>
126
+ </Panel.Content>
127
+ </Panel.Root>
128
+ );
129
+ },
130
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { SpaceGenerator } from './SpaceGenerator';
6
+
7
+ export default SpaceGenerator;
@@ -5,33 +5,32 @@
5
5
  import React from 'react';
6
6
  import { useResizeDetector } from 'react-resize-detector';
7
7
 
8
- import { type Obj } from '@dxos/echo';
9
- import { fullyQualifiedId } from '@dxos/react-client/echo';
8
+ import { Obj } from '@dxos/echo';
10
9
  import { type ThemedClassName } from '@dxos/react-ui';
11
10
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
12
11
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
13
- import { mx } from '@dxos/react-ui-theme';
12
+ import { mx } from '@dxos/ui-theme';
14
13
 
15
14
  // TODO(burdon): Create generic container with wireframe mode.
16
15
  export type WireframeProps = ThemedClassName<{
16
+ object: Obj.Unknown;
17
17
  label?: string;
18
- object: Obj.Any;
19
18
  }>;
20
19
 
21
20
  // TODO(burdon): Make focusable and attendable with input.
22
21
  export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
23
- const attentionAttrs = useAttentionAttributes(fullyQualifiedId(object));
22
+ const attentionAttrs = useAttentionAttributes(Obj.getDXN(object).toString());
24
23
  const { width, height, ref } = useResizeDetector();
25
24
 
26
25
  return (
27
- <div ref={ref} className={mx('relative grow min-bs-96', classNames)} {...attentionAttrs}>
26
+ <div ref={ref} className={mx('relative grow min-h-96', classNames)} {...attentionAttrs}>
28
27
  <div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>
29
28
  <div className='flex justify-between'>
30
29
  <div>{label}</div>
31
30
  <div>{`[${width}x${height}]`}</div>
32
31
  </div>
33
32
  {object && (
34
- <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
33
+ <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded-sm'>
35
34
  {JSON.stringify(object, undefined, 2)}
36
35
  </SyntaxHighlighter>
37
36
  )}
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { Wireframe } from './Wireframe';
6
+
7
+ export default Wireframe;
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const DebugGraph: ComponentType<any> = lazy(() => import('./DebugGraph'));
8
+ export const DebugObjectPanel: ComponentType<any> = lazy(() => import('./DebugObjectPanel'));
9
+ export const DebugStatus: ComponentType<any> = lazy(() => import('./DebugStatus'));
10
+ export const DevtoolsOverviewContainer: ComponentType<any> = lazy(() => import('./DevtoolsOverviewContainer'));
11
+ export const SpaceGenerator: ComponentType<any> = lazy(() => import('./SpaceGenerator'));
12
+ export const Wireframe: ComponentType<any> = lazy(() => import('./Wireframe'));
13
+ export const DebugSpaceObjectsPanel: ComponentType<any> = lazy(() => import('./DebugSpaceObjectsPanel'));
package/src/meta.ts CHANGED
@@ -2,11 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
- export const meta: PluginMeta = {
9
- id: 'dxos.org/plugin/debug',
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.debug',
10
10
  name: 'Debug',
11
11
  description: trim`
12
12
  Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
@@ -4,70 +4,78 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'plugin name': 'Debug',
14
- 'settings title': 'Debug settings',
15
- 'mutation count': 'Number of mutations',
16
- 'mutation period': 'Mutation period',
17
- 'open devtools label': 'Open DevTools',
18
- 'devtools label': 'DevTools',
19
- 'devtools overview label': 'DevTools Stats',
20
- 'debug label': 'Debug',
21
- 'debug app graph label': 'App Graph',
22
- 'settings show debug panel': 'Show Debug panel.',
23
- 'settings show devtools panel': 'Show DevTools panel.',
24
- 'settings wireframe': 'Show wireframes.',
25
- 'settings repair': 'Run repair tool.',
26
- 'settings download diagnostics': 'Download diagnostics.',
27
- 'settings uploaded': 'Uploaded to IPFS',
28
- 'settings uploaded to clipboard': 'URL copied to clipboard.',
29
- 'settings repair success': 'Repair succeeded',
30
- 'settings repair failed': 'Repair failed',
31
- 'settings choose storage adaptor': 'Storage adaptor (worker reload required).',
32
- 'settings storage adaptor idb label': 'IndexedDB',
33
- 'settings storage adaptor opfs label': 'OPFS',
34
- 'settings data store label': 'Data Store',
35
- 'settings storage adapter changed alert':
13
+ 'plugin.name': 'Debug',
14
+ 'settings.title': 'Debug settings',
15
+ 'open-devtools.label': 'Open DevTools',
16
+ 'devtools.label': 'DevTools',
17
+ 'devtools-overview.label': 'Stats',
18
+ 'space-objects.label': 'Database',
19
+ 'debug.label': 'Debug',
20
+ 'debug-app-graph.label': 'App Graph',
21
+
22
+ 'settings.wireframe.label': 'Show wireframes.',
23
+ 'settings.wireframe.description': 'Overlay wireframe outlines on UI components for debugging layout.',
24
+ 'settings.repair.label': 'Run repair tool.',
25
+ 'settings.repair.description': 'Attempt to detect and fix inconsistencies in local data storage.',
26
+ 'settings.download-diagnostics.label': 'Download diagnostics.',
27
+ 'settings.download-diagnostics.description':
28
+ 'Export a JSON file containing client diagnostics for troubleshooting.',
29
+ 'settings.download-logs.label': 'Download log buffer.',
30
+ 'settings.download-logs.description': 'Export the in-memory log buffer as an NDJSON file.',
31
+ 'settings.uploaded.message': 'Settings uploaded.',
32
+ 'settings.uploaded.description': 'URL copied to clipboard.',
33
+ 'settings.choose-storage-adaptor.label': 'Storage adaptor (worker reload required).',
34
+ 'settings.choose-storage-adaptor.description':
35
+ 'Select the browser storage backend. Changing this requires a worker reload and may make existing data unavailable.',
36
+ 'settings.repair-success.message': 'Repair succeeded',
37
+ 'settings.repair-failed.message': 'Repair failed',
38
+
39
+ 'settings.storage-adaptor.idb.label': 'IndexedDB',
40
+ 'settings.storage-adaptor.opfs.label': 'OPFS',
41
+ 'settings.storage-adapter.changed-alert.message':
36
42
  'Warning: Swapping the storage adapter will make your data unavailable.',
37
- 'settings space fragmentation': 'Enable AM space fragmentation',
38
- 'open debug panel label': 'Show Debug',
39
- 'client label': 'Client',
40
- 'config label': 'Config',
41
- 'storage label': 'Storage',
42
- 'logs label': 'Logs',
43
- 'diagnostics label': 'Diagnostics',
44
- 'tracing label': 'Tracing',
45
- 'halo label': 'HALO',
46
- 'identity label': 'Identity',
47
- 'devices label': 'Devices',
48
- 'keyring label': 'Keyring',
49
- 'credentials label': 'Credentials',
50
- 'echo label': 'ECHO',
51
- 'spaces label': 'Spaces',
52
- 'space label': 'Space',
53
- 'feeds label': 'Feeds',
54
- 'objects label': 'Objects',
55
- 'schema label': 'Schema',
56
- 'automerge label': 'Automerge',
57
- 'queues label': 'Queues',
58
- 'members label': 'Members',
59
- 'metadata label': 'Metadata',
60
- 'mesh label': 'MESH',
61
- 'signal label': 'Signal',
62
- 'swarm label': 'Swarm',
63
- 'network label': 'Network',
64
- 'agent label': 'Agent',
65
- 'dashboard label': 'Dashboard',
66
- 'search label': 'Search',
67
- 'edge label': 'EDGE',
68
- 'workflows label': 'Workflows',
69
- 'traces label': 'Traces',
70
- 'testing label': 'Testing',
43
+
44
+ 'settings.data-store.label': 'Data Store',
45
+
46
+ 'open-debug-panel.label': 'Show Debug',
47
+ 'client.label': 'Client',
48
+ 'config.label': 'Config',
49
+ 'storage.label': 'Storage',
50
+ 'logs.label': 'Logs',
51
+ 'diagnostics.label': 'Diagnostics',
52
+ 'tracing.label': 'Tracing',
53
+ 'halo.label': 'HALO',
54
+ 'identity.label': 'Identity',
55
+ 'devices.label': 'Devices',
56
+ 'keyring.label': 'Keyring',
57
+ 'credentials.label': 'Credentials',
58
+ 'echo.label': 'ECHO',
59
+ 'spaces.label': 'Spaces',
60
+ 'space.label': 'Space',
61
+ 'feeds.label': 'Feeds',
62
+ 'objects.label': 'Objects',
63
+ 'schema.label': 'Schema',
64
+ 'automerge.label': 'Automerge',
65
+ 'queues.label': 'Queues',
66
+ 'members.label': 'Members',
67
+ 'metadata.label': 'Metadata',
68
+ 'mesh.label': 'MESH',
69
+ 'signal.label': 'Signal',
70
+ 'swarm.label': 'Swarm',
71
+ 'network.label': 'Network',
72
+ 'agent.label': 'Agent',
73
+ 'dashboard.label': 'Dashboard',
74
+ 'search.label': 'Search',
75
+ 'edge.label': 'EDGE',
76
+ 'workflows.label': 'Workflows',
77
+ 'traces.label': 'Traces',
78
+ 'testing.label': 'Testing',
71
79
  },
72
80
  },
73
81
  },
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ export const Settings = Schema.mutable(
10
+ Schema.Struct({
11
+ wireframe: Schema.optional(Schema.Boolean),
12
+ }),
13
+ );
14
+
15
+ export type Settings = Schema.Schema.Type<typeof Settings>;
@@ -2,11 +2,18 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import * as Schema from 'effect/Schema';
5
+ import { type Atom } from '@effect-atom/atom-react';
6
6
  import { type Context, createContext } from 'react';
7
7
 
8
+ import { Capability } from '@dxos/app-framework';
8
9
  import type { TimerCallback, TimerOptions } from '@dxos/async';
9
10
 
11
+ import { meta } from '#meta';
12
+
13
+ import * as Settings from './Settings';
14
+
15
+ export * as Settings from './Settings';
16
+
10
17
  export type DebugContextType = {
11
18
  running: boolean;
12
19
  start: (cb: TimerCallback, options: TimerOptions) => void;
@@ -19,17 +26,12 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
19
26
  stop: () => {},
20
27
  });
21
28
 
22
- export const DebugSettingsSchema = Schema.mutable(
23
- Schema.Struct({
24
- wireframe: Schema.optional(Schema.Boolean),
25
- }),
26
- );
27
-
28
- export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
29
+ export namespace DebugCapabilities {
30
+ export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.id}.capability.settings`);
31
+ }
29
32
 
30
33
  export namespace Devtools {
31
- // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
32
- export const id = 'dxos.org.plugin.debug.devtools';
34
+ export const id = `${meta.id}.devtools`;
33
35
 
34
36
  export namespace Client {
35
37
  export const id = `${Devtools.id}.client`;
@@ -1,20 +0,0 @@
1
- // src/components/DebugGraph.tsx
2
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
3
- import React from "react";
4
- import { Tree } from "@dxos/devtools";
5
- var DebugGraph = ({ graph, root }) => {
6
- var _effect = _useSignals();
7
- try {
8
- return /* @__PURE__ */ React.createElement(Tree, {
9
- data: graph.toJSON(root)
10
- });
11
- } finally {
12
- _effect.f();
13
- }
14
- };
15
- var DebugGraph_default = DebugGraph;
16
- export {
17
- DebugGraph,
18
- DebugGraph_default as default
19
- };
20
- //# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map