@dxos/plugin-debug 0.8.4-main.bc674ce → 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 (164) hide show
  1. package/dist/lib/browser/index.mjs +97 -91
  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 +6 -1
  5. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  6. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  7. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  8. package/dist/types/src/capabilities/index.d.ts +15 -4
  9. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  10. package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +1 -1
  11. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  12. package/dist/types/src/capabilities/react-surface.d.ts +9 -0
  13. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  14. package/dist/types/src/capabilities/settings.d.ts +10 -0
  15. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  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 +1 -1
  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.map +1 -1
  30. package/dist/types/src/components/index.d.ts +4 -10
  31. package/dist/types/src/components/index.d.ts.map +1 -1
  32. package/dist/types/src/{components → containers/DebugGraph}/DebugGraph.d.ts +0 -1
  33. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  34. package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
  35. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  36. package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +1 -1
  37. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  38. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
  39. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  40. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
  41. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  42. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
  43. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  44. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  45. package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
  46. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  47. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  48. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  49. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
  50. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  51. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +15 -0
  52. package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  53. package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
  54. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  55. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  56. package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
  57. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  58. package/dist/types/src/containers/index.d.ts +9 -0
  59. package/dist/types/src/containers/index.d.ts.map +1 -0
  60. package/dist/types/src/translations.d.ts +60 -58
  61. package/dist/types/src/translations.d.ts.map +1 -1
  62. package/dist/types/src/types/Settings.d.ts +6 -0
  63. package/dist/types/src/types/Settings.d.ts.map +1 -0
  64. package/dist/types/src/types/index.d.ts +67 -0
  65. package/dist/types/src/types/index.d.ts.map +1 -0
  66. package/dist/types/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +74 -67
  68. package/src/DebugPlugin.tsx +23 -10
  69. package/src/capabilities/app-graph-builder.ts +406 -0
  70. package/src/capabilities/index.ts +6 -4
  71. package/src/capabilities/react-context.tsx +25 -0
  72. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +122 -109
  73. package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
  74. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  75. package/src/components/DebugSettings/DebugSettings.tsx +228 -0
  76. package/src/components/DebugSettings/index.ts +7 -0
  77. package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
  78. package/src/components/SchemaTable/index.ts +5 -0
  79. package/src/components/SpaceGenerator/ObjectGenerator.tsx +7 -8
  80. package/src/components/SpaceGenerator/index.ts +2 -3
  81. package/src/components/SpaceGenerator/presets.ts +51 -46
  82. package/src/components/index.ts +4 -11
  83. package/src/{components → containers/DebugGraph}/DebugGraph.tsx +0 -2
  84. package/src/containers/DebugGraph/index.ts +7 -0
  85. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +47 -0
  86. package/src/containers/DebugObjectPanel/index.ts +7 -0
  87. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +55 -0
  88. package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
  89. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -17
  90. package/src/containers/DebugStatus/index.ts +7 -0
  91. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  92. package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
  93. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +130 -0
  94. package/src/containers/SpaceGenerator/index.ts +7 -0
  95. package/src/{components → containers/Wireframe}/Wireframe.tsx +2 -2
  96. package/src/containers/Wireframe/index.ts +7 -0
  97. package/src/containers/index.ts +13 -0
  98. package/src/meta.ts +1 -1
  99. package/src/translations.ts +66 -58
  100. package/src/types/Settings.ts +15 -0
  101. package/src/{types.ts → types/index.ts} +7 -13
  102. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +0 -15
  103. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +0 -7
  104. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +0 -19
  105. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +0 -7
  106. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs +0 -1152
  107. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +0 -7
  108. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +0 -598
  109. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +0 -7
  110. package/dist/lib/browser/chunk-4UFQXPP7.mjs +0 -78
  111. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
  112. package/dist/lib/browser/chunk-A5H5GRV6.mjs +0 -20
  113. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +0 -7
  114. package/dist/lib/browser/react-context-FSWBT3MH.mjs +0 -17
  115. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +0 -7
  116. package/dist/lib/browser/react-surface-2N6CPSHR.mjs +0 -757
  117. package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +0 -7
  118. package/dist/lib/browser/settings-KA4GN73K.mjs +0 -31
  119. package/dist/lib/browser/settings-KA4GN73K.mjs.map +0 -7
  120. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
  121. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  122. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  123. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  124. package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
  125. package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
  126. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
  127. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  128. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  129. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  130. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  131. package/dist/types/src/capabilities/settings/index.d.ts +0 -3
  132. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  133. package/dist/types/src/capabilities/settings/settings.d.ts +0 -5
  134. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  135. package/dist/types/src/components/Container.d.ts +0 -5
  136. package/dist/types/src/components/Container.d.ts.map +0 -1
  137. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  138. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  139. package/dist/types/src/components/DebugSettings.d.ts +0 -8
  140. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  141. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  142. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  143. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  144. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  145. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
  146. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  147. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  148. package/dist/types/src/types.d.ts +0 -68
  149. package/dist/types/src/types.d.ts.map +0 -1
  150. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -420
  151. package/src/capabilities/app-graph-builder/index.ts +0 -7
  152. package/src/capabilities/react-context/index.ts +0 -7
  153. package/src/capabilities/react-context/react-context.tsx +0 -20
  154. package/src/capabilities/react-surface/index.ts +0 -7
  155. package/src/capabilities/settings/index.ts +0 -7
  156. package/src/components/Container.tsx +0 -15
  157. package/src/components/DebugObjectPanel.tsx +0 -33
  158. package/src/components/DebugSettings.tsx +0 -185
  159. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  160. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
  161. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -127
  162. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  163. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  164. /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +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;
@@ -23,14 +23,14 @@ export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
23
23
  const { width, height, ref } = useResizeDetector();
24
24
 
25
25
  return (
26
- <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}>
27
27
  <div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>
28
28
  <div className='flex justify-between'>
29
29
  <div>{label}</div>
30
30
  <div>{`[${width}x${height}]`}</div>
31
31
  </div>
32
32
  {object && (
33
- <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
33
+ <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded-sm'>
34
34
  {JSON.stringify(object, undefined, 2)}
35
35
  </SyntaxHighlighter>
36
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
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
8
  export const meta: Plugin.Meta = {
9
- id: 'dxos.org/plugin/debug',
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': '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>;
@@ -3,13 +3,16 @@
3
3
  //
4
4
 
5
5
  import { type Atom } from '@effect-atom/atom-react';
6
- import * as Schema from 'effect/Schema';
7
6
  import { type Context, createContext } from 'react';
8
7
 
9
8
  import { Capability } from '@dxos/app-framework';
10
9
  import type { TimerCallback, TimerOptions } from '@dxos/async';
11
10
 
12
- import { meta } from './meta';
11
+ import { meta } from '#meta';
12
+
13
+ import * as Settings from './Settings';
14
+
15
+ export * as Settings from './Settings';
13
16
 
14
17
  export type DebugContextType = {
15
18
  running: boolean;
@@ -23,21 +26,12 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
23
26
  stop: () => {},
24
27
  });
25
28
 
26
- export const DebugSettingsSchema = Schema.mutable(
27
- Schema.Struct({
28
- wireframe: Schema.optional(Schema.Boolean),
29
- }),
30
- );
31
-
32
- export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
33
-
34
29
  export namespace DebugCapabilities {
35
- export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
30
+ export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.id}.capability.settings`);
36
31
  }
37
32
 
38
33
  export namespace Devtools {
39
- // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
40
- export const id = 'dxos.org.plugin.debug.devtools';
34
+ export const id = `${meta.id}.devtools`;
41
35
 
42
36
  export namespace Client {
43
37
  export const id = `${Devtools.id}.client`;
@@ -1,15 +0,0 @@
1
- // src/components/DebugGraph.tsx
2
- import React from "react";
3
- import { Tree } from "@dxos/devtools";
4
- import { Graph } from "@dxos/plugin-graph";
5
- var DebugGraph = ({ graph, root }) => {
6
- return /* @__PURE__ */ React.createElement(Tree, {
7
- data: Graph.toJSON(graph, root)
8
- });
9
- };
10
- var DebugGraph_default = DebugGraph;
11
- export {
12
- DebugGraph,
13
- DebugGraph_default as default
14
- };
15
- //# sourceMappingURL=DebugGraph-6VMEOKEV.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/DebugGraph.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { Graph } from '@dxos/plugin-graph';\n\nexport type DebugGraphProps = { graph: Graph.Graph; root: string };\nexport const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {\n return <Tree data={Graph.toJSON(graph, root)} />;\n};\n\nexport default DebugGraph;\n"],
5
- "mappings": ";AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AACrB,SAASC,aAAa;AAGf,IAAMC,aAAkC,CAAC,EAAEC,OAAOC,KAAI,MAAE;AAC7D,SAAO,sBAAA,cAACC,MAAAA;IAAKC,MAAMC,MAAMC,OAAOL,OAAOC,IAAAA;;AACzC;AAEA,IAAA,qBAAeF;",
6
- "names": ["React", "Tree", "Graph", "DebugGraph", "graph", "root", "Tree", "data", "Graph", "toJSON"]
7
- }
@@ -1,19 +0,0 @@
1
- // src/components/DevtoolsOverviewContainer.tsx
2
- import React from "react";
3
- import { Surface } from "@dxos/app-framework/react";
4
- import { StatsPanel, useStats } from "@dxos/devtools";
5
- var DevtoolsOverviewContainer = () => {
6
- const [stats, refreshStats] = useStats();
7
- return /* @__PURE__ */ React.createElement(StatsPanel, {
8
- stats,
9
- onRefresh: refreshStats
10
- }, /* @__PURE__ */ React.createElement(Surface, {
11
- role: "devtools-overview"
12
- }));
13
- };
14
- var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
15
- export {
16
- DevtoolsOverviewContainer,
17
- DevtoolsOverviewContainer_default as default
18
- };
19
- //# sourceMappingURL=DevtoolsOverviewContainer-77PKFLYV.mjs.map