@dxos/plugin-debug 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29

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 (198) hide show
  1. package/dist/lib/{browser/DebugGraph-7HXJ2PS2.mjs → neutral/DebugGraph-G4FWS57E.mjs} +4 -5
  2. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
  3. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
  4. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
  5. package/dist/lib/neutral/DebugPlugin.mjs +47 -0
  6. package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
  8. package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
  9. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
  10. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
  11. package/dist/lib/{browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs → neutral/DebugSpaceObjectsPanel-NISULU6U.mjs} +10 -26
  12. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
  13. package/dist/lib/{browser/DebugStatus-COQGH37G.mjs → neutral/DebugStatus-YB3KFP7G.mjs} +35 -39
  14. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
  15. package/dist/lib/{browser/DevtoolsOverviewContainer-C75NFVER.mjs → neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs} +9 -6
  16. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
  17. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs +143 -0
  18. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs.map +7 -0
  19. package/dist/lib/{browser/Wireframe-KAGOKEFW.mjs → neutral/Wireframe-7SNRUKET.mjs} +8 -9
  20. package/dist/lib/neutral/Wireframe-7SNRUKET.mjs.map +7 -0
  21. package/dist/lib/{browser/app-graph-builder-LGUQNXHD.mjs → neutral/app-graph-builder-YPYHL2K5.mjs} +210 -258
  22. package/dist/lib/neutral/app-graph-builder-YPYHL2K5.mjs.map +7 -0
  23. package/dist/lib/neutral/capabilities/index.mjs +15 -0
  24. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  25. package/dist/lib/{browser/chunk-A5H5GRV6.mjs → neutral/chunk-3OGPOE7H.mjs} +2 -2
  26. package/dist/lib/{browser/chunk-A5H5GRV6.mjs.map → neutral/chunk-3OGPOE7H.mjs.map} +3 -3
  27. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  28. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  29. package/dist/lib/{browser/chunk-4UFQXPP7.mjs → neutral/chunk-NFIOTQRZ.mjs} +23 -12
  30. package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
  31. package/dist/lib/{browser/SpaceGenerator-SWSGJEEL.mjs → neutral/components/index.mjs} +60 -253
  32. package/dist/lib/neutral/components/index.mjs.map +7 -0
  33. package/dist/lib/neutral/containers/index.mjs +21 -0
  34. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  35. package/dist/lib/neutral/index.mjs +18 -0
  36. package/dist/lib/neutral/index.mjs.map +7 -0
  37. package/dist/lib/neutral/meta.json +1 -0
  38. package/dist/lib/neutral/meta.mjs +8 -0
  39. package/dist/lib/neutral/meta.mjs.map +7 -0
  40. package/dist/lib/neutral/plugin.mjs +12 -0
  41. package/dist/lib/neutral/plugin.mjs.map +7 -0
  42. package/dist/lib/{browser/react-context-I3USIAF6.mjs → neutral/react-context-MUZ3KVLU.mjs} +6 -6
  43. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
  44. package/dist/lib/{browser/react-surface-BTVNKKVQ.mjs → neutral/react-surface-NH2H63KW.mjs} +153 -176
  45. package/dist/lib/neutral/react-surface-NH2H63KW.mjs.map +7 -0
  46. package/dist/lib/{browser/settings-SLTQJJNF.mjs → neutral/settings-MPM6YUP4.mjs} +7 -11
  47. package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
  48. package/dist/lib/neutral/translations.mjs +83 -0
  49. package/dist/lib/neutral/translations.mjs.map +7 -0
  50. package/dist/lib/neutral/types/index.mjs +14 -0
  51. package/dist/lib/neutral/types/index.mjs.map +7 -0
  52. package/dist/types/src/DebugPlugin.d.ts +2 -5
  53. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  54. package/dist/types/src/DebugPlugin.node.d.ts +5 -0
  55. package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
  56. package/dist/types/src/DebugPlugin.test.d.ts +2 -0
  57. package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
  58. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  59. package/dist/types/src/capabilities/index.d.ts +11 -4
  60. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  61. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  62. package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +2 -2
  63. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  64. package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -1
  65. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  66. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  67. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  68. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +99 -0
  69. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  70. package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
  71. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  72. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
  73. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  74. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  75. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  76. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  77. package/dist/types/src/components/index.d.ts +2 -0
  78. package/dist/types/src/components/index.d.ts.map +1 -1
  79. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +2 -2
  80. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -1
  81. package/dist/types/src/containers/DebugGraph/index.d.ts +1 -2
  82. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -1
  83. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +3 -4
  84. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
  85. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +1 -2
  86. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -1
  87. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -1
  88. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
  89. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +1 -2
  90. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -1
  91. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
  92. package/dist/types/src/containers/DebugStatus/index.d.ts +1 -2
  93. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -1
  94. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -1
  95. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +1 -2
  96. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -1
  97. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +3 -1
  98. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  99. package/dist/types/src/containers/SpaceGenerator/index.d.ts +1 -2
  100. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -1
  101. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
  102. package/dist/types/src/containers/Wireframe/index.d.ts +1 -2
  103. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -1
  104. package/dist/types/src/containers/index.d.ts +0 -1
  105. package/dist/types/src/containers/index.d.ts.map +1 -1
  106. package/dist/types/src/index.d.ts +1 -1
  107. package/dist/types/src/index.d.ts.map +1 -1
  108. package/dist/types/src/plugin.d.ts +4 -0
  109. package/dist/types/src/plugin.d.ts.map +1 -0
  110. package/dist/types/src/translations.d.ts +80 -61
  111. package/dist/types/src/translations.d.ts.map +1 -1
  112. package/dist/types/src/types/Settings.d.ts +8 -0
  113. package/dist/types/src/types/Settings.d.ts.map +1 -0
  114. package/dist/types/src/types/index.d.ts +69 -0
  115. package/dist/types/src/types/index.d.ts.map +1 -0
  116. package/dist/types/tsconfig.tsbuildinfo +1 -1
  117. package/package.json +115 -64
  118. package/src/DebugPlugin.node.ts +18 -0
  119. package/src/DebugPlugin.test.ts +29 -0
  120. package/src/DebugPlugin.tsx +9 -11
  121. package/src/capabilities/app-graph-builder.ts +405 -0
  122. package/src/capabilities/index.ts +6 -4
  123. package/src/capabilities/{react-context/react-context.tsx → react-context.tsx} +7 -2
  124. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +169 -158
  125. package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
  126. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  127. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  128. package/src/components/DebugSettings/index.ts +5 -0
  129. package/src/components/SpaceGenerator/ObjectGenerator.tsx +13 -15
  130. package/src/components/SpaceGenerator/draw-util.ts +8 -8
  131. package/src/components/SpaceGenerator/presets.ts +28 -50
  132. package/src/components/index.ts +4 -0
  133. package/src/containers/DebugGraph/DebugGraph.tsx +3 -2
  134. package/src/containers/DebugGraph/index.ts +1 -3
  135. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +47 -16
  136. package/src/containers/DebugObjectPanel/index.ts +1 -3
  137. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +10 -23
  138. package/src/containers/DebugSpaceObjectsPanel/index.ts +1 -3
  139. package/src/containers/DebugStatus/DebugStatus.tsx +41 -19
  140. package/src/containers/DebugStatus/index.ts +1 -3
  141. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +8 -1
  142. package/src/containers/DevtoolsOverviewContainer/index.ts +1 -3
  143. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +102 -103
  144. package/src/containers/SpaceGenerator/index.ts +1 -3
  145. package/src/containers/Wireframe/Wireframe.tsx +2 -6
  146. package/src/containers/Wireframe/index.ts +1 -3
  147. package/src/containers/index.ts +0 -1
  148. package/src/index.ts +1 -1
  149. package/src/meta.ts +1 -1
  150. package/src/plugin.ts +10 -0
  151. package/src/translations.ts +75 -60
  152. package/src/types/Settings.ts +16 -0
  153. package/src/{types.ts → types/index.ts} +15 -14
  154. package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs.map +0 -7
  155. package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +0 -33
  156. package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +0 -7
  157. package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +0 -174
  158. package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +0 -7
  159. package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +0 -7
  160. package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +0 -7
  161. package/dist/lib/browser/DevtoolsOverviewContainer-C75NFVER.mjs.map +0 -7
  162. package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +0 -7
  163. package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +0 -7
  164. package/dist/lib/browser/app-graph-builder-LGUQNXHD.mjs.map +0 -7
  165. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
  166. package/dist/lib/browser/index.mjs +0 -132
  167. package/dist/lib/browser/index.mjs.map +0 -7
  168. package/dist/lib/browser/meta.json +0 -1
  169. package/dist/lib/browser/react-context-I3USIAF6.mjs.map +0 -7
  170. package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +0 -7
  171. package/dist/lib/browser/settings-SLTQJJNF.mjs.map +0 -7
  172. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  173. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  174. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  175. package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
  176. package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
  177. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
  178. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -5
  179. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  180. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  181. package/dist/types/src/capabilities/settings/index.d.ts +0 -3
  182. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  183. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  184. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +0 -10
  185. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +0 -1
  186. package/dist/types/src/containers/DebugSettings/index.d.ts +0 -3
  187. package/dist/types/src/containers/DebugSettings/index.d.ts.map +0 -1
  188. package/dist/types/src/types.d.ts +0 -68
  189. package/dist/types/src/types.d.ts.map +0 -1
  190. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -441
  191. package/src/capabilities/app-graph-builder/index.ts +0 -7
  192. package/src/capabilities/react-context/index.ts +0 -7
  193. package/src/capabilities/react-surface/index.ts +0 -7
  194. package/src/capabilities/settings/index.ts +0 -7
  195. package/src/containers/DebugSettings/DebugSettings.tsx +0 -201
  196. package/src/containers/DebugSettings/index.ts +0 -7
  197. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  198. /package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +0 -0
@@ -2,42 +2,73 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import React, { useState } from 'react';
5
+ import React, { useMemo, useState } from 'react';
6
6
 
7
+ import { AppSurface } from '@dxos/app-toolkit/ui';
7
8
  import { ObjectsTree } from '@dxos/devtools';
8
- import { Filter, Obj, Query } from '@dxos/echo';
9
+ import { Filter, Json, Obj, Query } from '@dxos/echo';
9
10
  import type { ObjectId } from '@dxos/keys';
10
11
  import { useQuery } from '@dxos/react-client/echo';
11
- import { Clipboard, Grid, Panel, ScrollArea } from '@dxos/react-ui';
12
- import { Json } from '@dxos/react-ui-syntax-highlighter';
12
+ import { Clipboard, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
13
+ import { Syntax } from '@dxos/react-ui-syntax-highlighter';
14
+ import { mx } from '@dxos/ui-theme';
13
15
 
14
- export type DebugObjectPanelProps = {
15
- object: Obj.Unknown;
16
- };
17
-
18
- export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
19
- const db = Obj.getDatabase(object);
16
+ export type DebugObjectPanelProps = Pick<
17
+ AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
18
+ 'role' | 'companionTo'
19
+ >;
20
20
 
21
+ export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
22
+ const db = Obj.getDatabase(companionTo);
21
23
  const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
24
+ const [depth, setDepth] = useState(0);
22
25
  const [selectedObject] = useQuery(
23
26
  db,
24
- Query.select(Filter.id(selectedId ?? object.id)).options({ deleted: 'include' }),
27
+ Query.select(Filter.id(selectedId ?? companionTo.id)).options({ deleted: 'include' }),
25
28
  );
29
+ const refReplacer = useMemo(() => (db ? Json.createRefReplacer({ db, depth }) : undefined), [db, depth]);
26
30
 
27
31
  return (
28
32
  <Clipboard.Provider>
29
- <Panel.Root>
33
+ <Panel.Root role={role}>
34
+ <Panel.Toolbar asChild>
35
+ <Toolbar.Root />
36
+ </Panel.Toolbar>
30
37
  <Panel.Content asChild>
31
- <Grid rows={db ? 2 : 1} classNames='divide-y divide-separator'>
38
+ <div className={mx('grid divide-y divide-separator', db && 'grid-rows-[1fr_2fr]')}>
32
39
  {db && (
33
40
  <ScrollArea.Root>
34
41
  <ScrollArea.Viewport>
35
- <ObjectsTree db={db} root={object} onSelect={(entity) => setSelectedId(entity.id)} />
42
+ <ObjectsTree db={db} root={companionTo} onSelect={(entity) => setSelectedId(entity.id)} />
36
43
  </ScrollArea.Viewport>
37
44
  </ScrollArea.Root>
38
45
  )}
39
- <Json data={selectedObject} />
40
- </Grid>
46
+ <Syntax.Root data={selectedObject} replacer={refReplacer}>
47
+ <Panel.Root>
48
+ <Panel.Toolbar asChild>
49
+ <Toolbar.Root classNames='grid grid-cols-[1fr_3rem]'>
50
+ <Syntax.Filter />
51
+ <Input.Root>
52
+ <Input.TextInput
53
+ variant='subdued'
54
+ type='number'
55
+ min={0}
56
+ step={1}
57
+ aria-label='Ref depth'
58
+ value={depth}
59
+ onChange={(event) => setDepth(Math.max(0, Number(event.target.value) || 0))}
60
+ />
61
+ </Input.Root>
62
+ </Toolbar.Root>
63
+ </Panel.Toolbar>
64
+ <Panel.Content asChild>
65
+ <Syntax.Viewport>
66
+ <Syntax.Code />
67
+ </Syntax.Viewport>
68
+ </Panel.Content>
69
+ </Panel.Root>
70
+ </Syntax.Root>
71
+ </div>
41
72
  </Panel.Content>
42
73
  </Panel.Root>
43
74
  </Clipboard.Provider>
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { DebugObjectPanel } from './DebugObjectPanel';
6
-
7
- export default DebugObjectPanel;
5
+ export { DebugObjectPanel as default } from './DebugObjectPanel';
@@ -4,33 +4,20 @@
4
4
 
5
5
  import React, { useState } from 'react';
6
6
 
7
- import { useCapability } from '@dxos/app-framework/ui';
8
- import { useLayout } from '@dxos/app-toolkit/ui';
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
9
8
  import { ObjectsTree } from '@dxos/devtools';
10
- import { type Database, Filter, Query } from '@dxos/echo';
11
- import type { ObjectId } from '@dxos/keys';
12
- import { ClientCapabilities } from '@dxos/plugin-client';
13
- import { parseId, useQuery } from '@dxos/react-client/echo';
9
+ import { Filter, Query } from '@dxos/echo';
10
+ import { type ObjectId } from '@dxos/keys';
11
+ import { useQuery } from '@dxos/react-client/echo';
14
12
  import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
15
- import { Json } from '@dxos/react-ui-syntax-highlighter';
13
+ import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
16
14
 
17
- export const DebugSpaceObjectsPanel = () => {
18
- const layout = useLayout();
19
- const client = useCapability(ClientCapabilities.Client);
20
- const { spaceId } = parseId(layout.workspace);
21
- const space = spaceId ? client.spaces.get(spaceId) : undefined;
22
- if (!space) {
23
- return null;
24
- }
15
+ export type DebugSpaceObjectsPanelProps = AppSurface.SpaceArticleProps;
25
16
 
26
- return <DebugSpaceObjectsPanelMain database={space.db} />;
27
- };
28
-
29
- const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database }) => {
17
+ export const DebugSpaceObjectsPanel = ({ space }: DebugSpaceObjectsPanelProps) => {
30
18
  const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
31
-
32
19
  const [selectedObject] = useQuery(
33
- database,
20
+ space.db,
34
21
  selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
35
22
  );
36
23
 
@@ -48,10 +35,10 @@ const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database
48
35
  <Grid rows={2} classNames='divide-y divide-separator'>
49
36
  <ScrollArea.Root>
50
37
  <ScrollArea.Viewport>
51
- <ObjectsTree db={database} onSelect={(entity) => setSelectedId(entity.id)} />
38
+ <ObjectsTree db={space.db} onSelect={(entity) => setSelectedId(entity.id)} />
52
39
  </ScrollArea.Viewport>
53
40
  </ScrollArea.Root>
54
- {selectedObject && <Json classNames='p-1' data={selectedObject} />}
41
+ {selectedObject && <JsonHighlighter classNames='p-1' data={selectedObject} />}
55
42
  </Grid>
56
43
  </Panel.Content>
57
44
  </Panel.Root>
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { DebugSpaceObjectsPanel } from './DebugSpaceObjectsPanel';
6
-
7
- export default DebugSpaceObjectsPanel;
5
+ export { DebugSpaceObjectsPanel as default } from './DebugSpaceObjectsPanel';
@@ -5,11 +5,10 @@
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';
9
- import { StatusBar } from '@dxos/plugin-status-bar';
8
+ import { StatusBar } from '@dxos/plugin-status-bar/components';
10
9
  import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
11
10
  import { useNetworkStatus } from '@dxos/react-client/mesh';
12
- import { Icon } from '@dxos/react-ui';
11
+ import { IconButton } from '@dxos/react-ui';
13
12
 
14
13
  const styles = {
15
14
  success: 'text-sky-300 dark:text-green-700',
@@ -89,14 +88,20 @@ const ErrorIndicator = () => {
89
88
 
90
89
  if (errorRef.current) {
91
90
  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>
91
+ <StatusBar.Item>
92
+ <IconButton
93
+ icon='ph--warning-circle--duotone'
94
+ iconOnly
95
+ label={errorRef.current.message}
96
+ classNames={styles.error}
97
+ onClick={handleReset}
98
+ />
99
+ </StatusBar.Item>
95
100
  );
96
101
  } else {
97
102
  return (
98
- <StatusBar.Item title='No errors.'>
99
- <Icon icon='ph--check--regular' size={4} />
103
+ <StatusBar.Item>
104
+ <IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />
100
105
  </StatusBar.Item>
101
106
  );
102
107
  }
@@ -114,14 +119,20 @@ const SwarmIndicator = () => {
114
119
 
115
120
  if (state === 0) {
116
121
  return (
117
- <StatusBar.Item title='Connected to swarm.'>
118
- <Icon icon='ph--lightning--regular' size={4} />
122
+ <StatusBar.Item>
123
+ <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />
119
124
  </StatusBar.Item>
120
125
  );
121
126
  } else {
122
127
  return (
123
- <StatusBar.Item title='Disconnected from swarm.'>
124
- <Icon icon='ph--lightning-slash--regular' size={4} classNames={styles.warning} />
128
+ <StatusBar.Item>
129
+ <IconButton
130
+ variant='ghost'
131
+ icon='ph--lightning-slash--regular'
132
+ iconOnly
133
+ label='Disconnected from swarm.'
134
+ classNames={styles.warning}
135
+ />
125
136
  </StatusBar.Item>
126
137
  );
127
138
  }
@@ -133,7 +144,6 @@ const SwarmIndicator = () => {
133
144
  // TODO(burdon): Merge with SaveStatus.
134
145
  const SavingIndicator = () => {
135
146
  const [state, _setState] = useState(0);
136
- const _space = useActiveSpace();
137
147
  // TODO(dmaretskyi): Fix this when we have save status for automerge.
138
148
  // useEffect(() => {
139
149
  // if (!space) {
@@ -156,21 +166,33 @@ const SavingIndicator = () => {
156
166
  switch (state) {
157
167
  case 2:
158
168
  return (
159
- <StatusBar.Item title='Edit not saved.'>
160
- <Icon icon='ph--circle--duotone' size={4} classNames={styles.warning} />
169
+ <StatusBar.Item>
170
+ <IconButton
171
+ variant='ghost'
172
+ icon='ph--circle--duotone'
173
+ iconOnly
174
+ label='Edit not saved.'
175
+ classNames={styles.warning}
176
+ />
161
177
  </StatusBar.Item>
162
178
  );
163
179
  case 1:
164
180
  return (
165
- <StatusBar.Item title='Saving...'>
166
- <Icon icon='ph--circle--duotone' size={4} classNames={styles.success} />
181
+ <StatusBar.Item>
182
+ <IconButton
183
+ variant='ghost'
184
+ icon='ph--circle--duotone'
185
+ iconOnly
186
+ label='Saving...'
187
+ classNames={styles.success}
188
+ />
167
189
  </StatusBar.Item>
168
190
  );
169
191
  case 0:
170
192
  default:
171
193
  return (
172
- <StatusBar.Item title='Modified indicator.'>
173
- <Icon icon='ph--circle--duotone' size={4} />
194
+ <StatusBar.Item>
195
+ <IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />
174
196
  </StatusBar.Item>
175
197
  );
176
198
  }
@@ -2,6 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { DebugStatus } from './DebugStatus';
6
-
7
- export default DebugStatus;
5
+ export { DebugStatus as default } from './DebugStatus';
@@ -9,9 +9,16 @@ import { StatsPanel, useStats } from '@dxos/devtools';
9
9
 
10
10
  export const DevtoolsOverviewContainer = () => {
11
11
  const [stats, refreshStats] = useStats();
12
+ const surfaceProfilerStats = Surface.useProfilerStats();
13
+ const clearSurfaceProfiler = Surface.useProfilerClear();
12
14
 
13
15
  return (
14
- <StatsPanel stats={stats} onRefresh={refreshStats}>
16
+ <StatsPanel
17
+ stats={stats}
18
+ surfaceProfilerStats={surfaceProfilerStats}
19
+ onRefresh={refreshStats}
20
+ onClearSurfaceProfiler={clearSurfaceProfiler}
21
+ >
15
22
  <Surface.Surface role='devtools-overview' />
16
23
  </StatsPanel>
17
24
  );
@@ -2,6 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { DevtoolsOverviewContainer } from './DevtoolsOverviewContainer';
6
-
7
- export default DevtoolsOverviewContainer;
5
+ export { DevtoolsOverviewContainer as default } from './DevtoolsOverviewContainer';
@@ -7,121 +7,120 @@ import React, { useCallback, useMemo, useState } from 'react';
7
7
  import { useOperationInvoker } from '@dxos/app-framework/ui';
8
8
  import { ComputeGraph } from '@dxos/conductor';
9
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 { Diagram } from '@dxos/plugin-sketch/types';
10
+ import { Markdown } from '@dxos/plugin-markdown';
11
+ import { Sheet } from '@dxos/plugin-sheet';
12
+ import { Sketch } from '@dxos/plugin-sketch';
13
13
  import { useClient } from '@dxos/react-client';
14
14
  import { type Space } from '@dxos/react-client/echo';
15
15
  import { IconButton, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from '@dxos/react-ui';
16
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
17
16
  import { Organization, Person, Task } from '@dxos/types';
18
- import { jsonKeyReplacer, sortKeys } from '@dxos/util';
17
+ import { composable, composableProps } from '@dxos/ui-theme';
18
+ import { sortKeys } from '@dxos/util';
19
19
 
20
- import { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '../../components';
20
+ import { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';
21
+
22
+ // TODO(burdon): Make extensible.
23
+ const staticTypes = [Markdown.Document, Sketch.Sketch, Sheet.Sheet, ComputeGraph];
24
+ const recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];
21
25
 
22
26
  export type SpaceGeneratorProps = {
23
27
  space: Space;
24
28
  onCreateObjects?: (objects: Obj.Unknown[]) => void;
25
29
  };
26
30
 
27
- export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
28
- const { invokePromise } = useOperationInvoker();
29
- const client = useClient();
30
- const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
31
- const recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];
32
- const [count, setCount] = useState(1);
33
- const [info, setInfo] = useState<any>({});
34
- const presets = useMemo(() => generator(), []);
35
-
36
- // Register types.
37
- useAsyncEffect(async () => {
38
- await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
39
- }, [client]);
40
-
41
- // Create type generators.
42
- const typeMap = useMemo(() => {
43
- const recordGenerators = new Map<string, ObjectGenerator<any>>(
44
- recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
45
- );
31
+ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
32
+ ({ space, onCreateObjects, children, ...props }, forwardedRef) => {
33
+ const { invokePromise } = useOperationInvoker();
34
+ const client = useClient();
35
+ const [count, setCount] = useState(1);
36
+ const [info, setInfo] = useState<any>({});
37
+ const presets = useMemo(() => generator(), []);
46
38
 
47
- return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
48
- }, [client, recordTypes, invokePromise]);
49
-
50
- // Query space to get info.
51
- const updateInfo = async () => {
52
- // Create schema map.
53
- const echoSchema = await space.db.schemaRegistry.query().run();
54
- const staticSchema = await space.db.graph.schemaRegistry.query().run();
55
-
56
- // Create object map.
57
- const objects = await space.db.query(Filter.everything()).run();
58
- const objectMap = sortKeys(
59
- objects.reduce<Record<string, number>>((map, obj) => {
60
- const type = Obj.getTypename(obj);
61
- if (type) {
62
- const count = map[type] ?? 0;
63
- map[type] = count + 1;
64
- }
39
+ // Register types.
40
+ useAsyncEffect(async () => {
41
+ await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
42
+ }, [client, presets]);
65
43
 
66
- return map;
67
- }, {}),
68
- );
44
+ // Create type generators.
45
+ const typeMap = useMemo(() => {
46
+ const recordGenerators = new Map<string, ObjectGenerator<any>>(
47
+ recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
48
+ );
49
+
50
+ return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
51
+ }, [client, invokePromise, presets]);
52
+
53
+ // Query space to get info.
54
+ const updateInfo = useCallback(async () => {
55
+ const echoSchema = await space.db.schemaRegistry.query().run();
56
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
57
+
58
+ const objects = await space.db.query(Filter.everything()).run();
59
+ const objectMap = sortKeys(
60
+ objects.reduce<Record<string, number>>((map, obj) => {
61
+ const type = Obj.getTypename(obj);
62
+ if (type) {
63
+ const count = map[type] ?? 0;
64
+ map[type] = count + 1;
65
+ }
66
+
67
+ return map;
68
+ }, {}),
69
+ );
69
70
 
70
- setInfo({
71
- schema: {
72
- static: staticSchema.length,
73
- mutable: echoSchema.length,
71
+ setInfo({
72
+ schema: {
73
+ static: staticSchema.length,
74
+ mutable: echoSchema.length,
75
+ },
76
+ objects: objectMap,
77
+ });
78
+ }, [space]);
79
+
80
+ useAsyncEffect(updateInfo, [updateInfo]);
81
+
82
+ const handleCreateData = useCallback(
83
+ async (typename: string) => {
84
+ const constructor = typeMap.get(typename);
85
+ if (constructor) {
86
+ // TODO(burdon): Input to specify number of objects.
87
+ await constructor(space, count, onCreateObjects);
88
+ await updateInfo();
89
+ }
74
90
  },
75
- objects: objectMap,
76
- });
77
- };
78
-
79
- useAsyncEffect(updateInfo, [space]);
80
-
81
- const handleCreateData = useCallback(
82
- async (typename: string) => {
83
- const constructor = typeMap.get(typename);
84
- if (constructor) {
85
- // TODO(burdon): Input to specify number of objects.
86
- await constructor(space, count, onCreateObjects);
87
- await updateInfo();
88
- }
89
- },
90
- [typeMap, count],
91
- );
92
-
93
- return (
94
- <Panel.Root>
95
- <Panel.Toolbar asChild>
96
- <Toolbar.Root>
97
- <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
98
- <Toolbar.Separator />
99
- <Input.Root>
100
- <Input.TextInput
101
- type='number'
102
- placeholder='Count'
103
- classNames='w-[4rem] text-right'
104
- min={1}
105
- max={100}
106
- size={8}
107
- value={count}
108
- onChange={(event) => setCount(parseInt(event.target.value))}
109
- />
110
- </Input.Root>
111
- </Toolbar.Root>
112
- </Panel.Toolbar>
113
- <Panel.Content asChild>
114
- <ScrollArea.Root thin orientation='vertical'>
115
- <ScrollArea.Viewport classNames='gap-4 divide-y divide-subdued-separator'>
116
- <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
117
- <SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
118
- <SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
119
- <SyntaxHighlighter language='json' classNames='text-xs'>
120
- {JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
121
- </SyntaxHighlighter>
122
- </ScrollArea.Viewport>
123
- </ScrollArea.Root>
124
- </Panel.Content>
125
- </Panel.Root>
126
- );
127
- };
91
+ [typeMap, count, space, onCreateObjects, updateInfo],
92
+ );
93
+
94
+ return (
95
+ <Panel.Root {...composableProps(props)} ref={forwardedRef}>
96
+ <Panel.Toolbar asChild>
97
+ <Toolbar.Root>
98
+ <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
99
+ <Toolbar.Separator />
100
+ <Input.Root>
101
+ <Input.TextInput
102
+ type='number'
103
+ placeholder='Count'
104
+ classNames='w-[4rem] text-right'
105
+ min={1}
106
+ max={100}
107
+ size={8}
108
+ value={count}
109
+ onChange={(event) => setCount(parseInt(event.target.value))}
110
+ />
111
+ </Input.Root>
112
+ </Toolbar.Root>
113
+ </Panel.Toolbar>
114
+ <Panel.Content asChild>
115
+ <ScrollArea.Root thin orientation='vertical'>
116
+ <ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-subdued-separator'>
117
+ <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
118
+ <SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
119
+ <SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
120
+ </ScrollArea.Viewport>
121
+ </ScrollArea.Root>
122
+ </Panel.Content>
123
+ </Panel.Root>
124
+ );
125
+ },
126
+ );
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { SpaceGenerator } from './SpaceGenerator';
6
-
7
- export default SpaceGenerator;
5
+ export { SpaceGenerator as default } from './SpaceGenerator';
@@ -8,7 +8,7 @@ import { useResizeDetector } from 'react-resize-detector';
8
8
  import { Obj } from '@dxos/echo';
9
9
  import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
11
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
11
+ import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
12
12
  import { mx } from '@dxos/ui-theme';
13
13
 
14
14
  // TODO(burdon): Create generic container with wireframe mode.
@@ -29,11 +29,7 @@ export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
29
29
  <div>{label}</div>
30
30
  <div>{`[${width}x${height}]`}</div>
31
31
  </div>
32
- {object && (
33
- <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded-sm'>
34
- {JSON.stringify(object, undefined, 2)}
35
- </SyntaxHighlighter>
36
- )}
32
+ {object && <JsonHighlighter data={object} classNames='text-xs opacity-75 rounded-sm' />}
37
33
  </div>
38
34
  <svg width={width} height={height} className='bg-transparent *:text-subdued'>
39
35
  <rect x={0} y={0} width={width} height={height} strokeWidth={1} fill='none' />
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Wireframe } from './Wireframe';
6
-
7
- export default Wireframe;
5
+ export { Wireframe as default } from './Wireframe';
@@ -6,7 +6,6 @@ import { type ComponentType, lazy } from 'react';
6
6
 
7
7
  export const DebugGraph: ComponentType<any> = lazy(() => import('./DebugGraph'));
8
8
  export const DebugObjectPanel: ComponentType<any> = lazy(() => import('./DebugObjectPanel'));
9
- export const DebugSettings: ComponentType<any> = lazy(() => import('./DebugSettings'));
10
9
  export const DebugStatus: ComponentType<any> = lazy(() => import('./DebugStatus'));
11
10
  export const DevtoolsOverviewContainer: ComponentType<any> = lazy(() => import('./DevtoolsOverviewContainer'));
12
11
  export const SpaceGenerator: ComponentType<any> = lazy(() => import('./SpaceGenerator'));
package/src/index.ts CHANGED
@@ -2,5 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './DebugPlugin';
6
5
  export * from './meta';
6
+ export * from './types';
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.
package/src/plugin.ts ADDED
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const DebugPlugin = Plugin.lazy(meta, () => import('#plugin'));
10
+ export type { DebugPluginOptions } from '#types';