@dxos/plugin-debug 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced

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 (217) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/{browser/DebugGraph-7HXJ2PS2.mjs → neutral/DebugGraph-G4FWS57E.mjs} +4 -5
  4. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
  5. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
  6. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
  7. package/dist/lib/neutral/DebugPlugin.mjs +47 -0
  8. package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
  9. package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
  10. package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
  11. package/dist/lib/neutral/DebugPlugin.workerd.mjs +12 -0
  12. package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +7 -0
  13. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
  14. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
  15. package/dist/lib/{browser/DebugSpaceObjectsPanel-SIK72DXV.mjs → neutral/DebugSpaceObjectsPanel-NISULU6U.mjs} +9 -20
  16. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
  17. package/dist/lib/{browser/DebugStatus-FWF3YFBA.mjs → neutral/DebugStatus-YB3KFP7G.mjs} +5 -8
  18. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
  19. package/dist/lib/{browser/DevtoolsOverviewContainer-TBTTPXVF.mjs → neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs} +4 -5
  20. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
  21. package/dist/lib/neutral/GithubPanel-DAIR6QSZ.mjs +177 -0
  22. package/dist/lib/neutral/GithubPanel-DAIR6QSZ.mjs.map +7 -0
  23. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs +143 -0
  24. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs.map +7 -0
  25. package/dist/lib/{browser/Wireframe-KAGOKEFW.mjs → neutral/Wireframe-7SNRUKET.mjs} +8 -9
  26. package/dist/lib/neutral/Wireframe-7SNRUKET.mjs.map +7 -0
  27. package/dist/lib/{browser/app-graph-builder-FBLOEOH5.mjs → neutral/app-graph-builder-OIC65GEP.mjs} +169 -186
  28. package/dist/lib/neutral/app-graph-builder-OIC65GEP.mjs.map +7 -0
  29. package/dist/lib/neutral/capabilities/index.mjs +15 -0
  30. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  32. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  33. package/dist/lib/{browser/chunk-Q37TZWW5.mjs → neutral/chunk-NFIOTQRZ.mjs} +21 -10
  34. package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
  35. package/dist/lib/{browser/chunk-ZOM2FBHQ.mjs → neutral/chunk-SWW2QL66.mjs} +5 -1
  36. package/dist/lib/neutral/chunk-SWW2QL66.mjs.map +7 -0
  37. package/dist/lib/{browser/SpaceGenerator-UUQS6TYY.mjs → neutral/components/index.mjs} +61 -264
  38. package/dist/lib/neutral/components/index.mjs.map +7 -0
  39. package/dist/lib/neutral/containers/index.mjs +23 -0
  40. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  41. package/dist/lib/neutral/index.mjs +18 -0
  42. package/dist/lib/neutral/index.mjs.map +7 -0
  43. package/dist/lib/neutral/meta.json +1 -0
  44. package/dist/lib/neutral/meta.mjs +8 -0
  45. package/dist/lib/neutral/meta.mjs.map +7 -0
  46. package/dist/lib/neutral/plugin.mjs +12 -0
  47. package/dist/lib/neutral/plugin.mjs.map +7 -0
  48. package/dist/lib/{browser/react-context-KBHXEMRS.mjs → neutral/react-context-MUZ3KVLU.mjs} +4 -5
  49. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
  50. package/dist/lib/{browser/react-surface-HYT4HKZX.mjs → neutral/react-surface-UP747GQ7.mjs} +148 -157
  51. package/dist/lib/neutral/react-surface-UP747GQ7.mjs.map +7 -0
  52. package/dist/lib/{browser/settings-XXFUM3QJ.mjs → neutral/settings-MPM6YUP4.mjs} +7 -11
  53. package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
  54. package/dist/lib/neutral/translations.mjs +89 -0
  55. package/dist/lib/neutral/translations.mjs.map +7 -0
  56. package/dist/lib/neutral/types/index.mjs +14 -0
  57. package/dist/lib/neutral/types/index.mjs.map +7 -0
  58. package/dist/types/src/DebugPlugin.d.ts +2 -5
  59. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  60. package/dist/types/src/DebugPlugin.node.d.ts +5 -0
  61. package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
  62. package/dist/types/src/DebugPlugin.test.d.ts +2 -0
  63. package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
  64. package/dist/types/src/DebugPlugin.workerd.d.ts +5 -0
  65. package/dist/types/src/DebugPlugin.workerd.d.ts.map +1 -0
  66. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/index.d.ts +11 -4
  68. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +2 -2
  71. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -1
  73. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  74. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  75. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  76. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +104 -0
  77. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  78. package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
  79. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  80. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
  81. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  82. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  83. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  84. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  85. package/dist/types/src/components/index.d.ts +2 -0
  86. package/dist/types/src/components/index.d.ts.map +1 -1
  87. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +2 -2
  88. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -1
  89. package/dist/types/src/containers/DebugGraph/index.d.ts +1 -2
  90. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -1
  91. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +3 -4
  92. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
  93. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +1 -2
  94. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -1
  95. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -1
  96. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
  97. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +1 -2
  98. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -1
  99. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
  100. package/dist/types/src/containers/DebugStatus/index.d.ts +1 -2
  101. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -1
  102. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +1 -2
  103. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -1
  104. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +15 -0
  105. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +1 -0
  106. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +104 -0
  107. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -0
  108. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +3 -0
  109. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +1 -0
  110. package/dist/types/src/containers/GithubPanel/index.d.ts +2 -0
  111. package/dist/types/src/containers/GithubPanel/index.d.ts.map +1 -0
  112. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +1 -5
  113. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  114. package/dist/types/src/containers/SpaceGenerator/index.d.ts +1 -2
  115. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -1
  116. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
  117. package/dist/types/src/containers/Wireframe/index.d.ts +1 -2
  118. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -1
  119. package/dist/types/src/containers/index.d.ts +1 -1
  120. package/dist/types/src/containers/index.d.ts.map +1 -1
  121. package/dist/types/src/index.d.ts +1 -1
  122. package/dist/types/src/index.d.ts.map +1 -1
  123. package/dist/types/src/meta.d.ts.map +1 -1
  124. package/dist/types/src/plugin.d.ts +4 -0
  125. package/dist/types/src/plugin.d.ts.map +1 -0
  126. package/dist/types/src/translations.d.ts +85 -61
  127. package/dist/types/src/translations.d.ts.map +1 -1
  128. package/dist/types/src/types/Settings.d.ts +8 -0
  129. package/dist/types/src/types/Settings.d.ts.map +1 -0
  130. package/dist/types/src/{types.d.ts → types/index.d.ts} +10 -9
  131. package/dist/types/src/types/index.d.ts.map +1 -0
  132. package/dist/types/tsconfig.tsbuildinfo +1 -1
  133. package/package.json +116 -63
  134. package/src/DebugPlugin.node.ts +18 -0
  135. package/src/DebugPlugin.test.ts +29 -0
  136. package/src/DebugPlugin.tsx +9 -11
  137. package/src/DebugPlugin.workerd.ts +12 -0
  138. package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +139 -153
  139. package/src/capabilities/index.ts +6 -4
  140. package/src/capabilities/{react-context/react-context.tsx → react-context.tsx} +1 -1
  141. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +163 -139
  142. package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
  143. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  144. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  145. package/src/components/DebugSettings/index.ts +5 -0
  146. package/src/components/SpaceGenerator/ObjectGenerator.tsx +13 -14
  147. package/src/components/SpaceGenerator/draw-util.ts +8 -8
  148. package/src/components/SpaceGenerator/presets.ts +27 -52
  149. package/src/components/index.ts +4 -0
  150. package/src/containers/DebugGraph/DebugGraph.tsx +3 -2
  151. package/src/containers/DebugGraph/index.ts +1 -3
  152. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +44 -15
  153. package/src/containers/DebugObjectPanel/index.ts +1 -3
  154. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +9 -17
  155. package/src/containers/DebugSpaceObjectsPanel/index.ts +1 -3
  156. package/src/containers/DebugStatus/DebugStatus.tsx +1 -3
  157. package/src/containers/DebugStatus/index.ts +1 -3
  158. package/src/containers/DevtoolsOverviewContainer/index.ts +1 -3
  159. package/src/containers/GithubPanel/GithubComponent.stories.tsx +38 -0
  160. package/src/containers/GithubPanel/GithubComponent.tsx +192 -0
  161. package/src/containers/GithubPanel/GithubPanel.tsx +17 -0
  162. package/src/containers/GithubPanel/index.ts +5 -0
  163. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +16 -20
  164. package/src/containers/SpaceGenerator/index.ts +1 -3
  165. package/src/containers/Wireframe/Wireframe.tsx +2 -6
  166. package/src/containers/Wireframe/index.ts +1 -3
  167. package/src/containers/index.ts +1 -1
  168. package/src/index.ts +1 -1
  169. package/src/meta.ts +2 -0
  170. package/src/plugin.ts +10 -0
  171. package/src/translations.ts +81 -60
  172. package/src/types/Settings.ts +16 -0
  173. package/src/{types.ts → types/index.ts} +14 -12
  174. package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs.map +0 -7
  175. package/dist/lib/browser/DebugObjectPanel-KXVFOGU6.mjs +0 -35
  176. package/dist/lib/browser/DebugObjectPanel-KXVFOGU6.mjs.map +0 -7
  177. package/dist/lib/browser/DebugSettings-DQXOXF6A.mjs +0 -183
  178. package/dist/lib/browser/DebugSettings-DQXOXF6A.mjs.map +0 -7
  179. package/dist/lib/browser/DebugSpaceObjectsPanel-SIK72DXV.mjs.map +0 -7
  180. package/dist/lib/browser/DebugStatus-FWF3YFBA.mjs.map +0 -7
  181. package/dist/lib/browser/DevtoolsOverviewContainer-TBTTPXVF.mjs.map +0 -7
  182. package/dist/lib/browser/SpaceGenerator-UUQS6TYY.mjs.map +0 -7
  183. package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +0 -7
  184. package/dist/lib/browser/app-graph-builder-FBLOEOH5.mjs.map +0 -7
  185. package/dist/lib/browser/chunk-Q37TZWW5.mjs.map +0 -7
  186. package/dist/lib/browser/chunk-ZOM2FBHQ.mjs.map +0 -7
  187. package/dist/lib/browser/index.mjs +0 -132
  188. package/dist/lib/browser/index.mjs.map +0 -7
  189. package/dist/lib/browser/meta.json +0 -1
  190. package/dist/lib/browser/react-context-KBHXEMRS.mjs.map +0 -7
  191. package/dist/lib/browser/react-surface-HYT4HKZX.mjs.map +0 -7
  192. package/dist/lib/browser/settings-XXFUM3QJ.mjs.map +0 -7
  193. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  194. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  195. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  196. package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
  197. package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
  198. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
  199. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -5
  200. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  201. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  202. package/dist/types/src/capabilities/settings/index.d.ts +0 -3
  203. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  204. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  205. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +0 -10
  206. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +0 -1
  207. package/dist/types/src/containers/DebugSettings/index.d.ts +0 -3
  208. package/dist/types/src/containers/DebugSettings/index.d.ts.map +0 -1
  209. package/dist/types/src/types.d.ts.map +0 -1
  210. package/src/capabilities/app-graph-builder/index.ts +0 -7
  211. package/src/capabilities/react-context/index.ts +0 -7
  212. package/src/capabilities/react-surface/index.ts +0 -7
  213. package/src/capabilities/settings/index.ts +0 -7
  214. package/src/containers/DebugSettings/DebugSettings.tsx +0 -206
  215. package/src/containers/DebugSettings/index.ts +0 -7
  216. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  217. /package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +0 -0
@@ -2,44 +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, Toolbar } 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
- };
16
+ export type DebugObjectPanelProps = Pick<
17
+ AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
18
+ 'role' | 'companionTo'
19
+ >;
17
20
 
18
- export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
19
- const db = Obj.getDatabase(object);
21
+ export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
22
+ const db = Obj.getDatabase(companionTo);
20
23
  const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
24
+ const [depth, setDepth] = useState(0);
21
25
  const [selectedObject] = useQuery(
22
26
  db,
23
- Query.select(Filter.id(selectedId ?? object.id)).options({ deleted: 'include' }),
27
+ Query.select(Filter.id(selectedId ?? companionTo.id)).options({ deleted: 'include' }),
24
28
  );
29
+ const refReplacer = useMemo(() => (db ? Json.createRefReplacer({ db, depth }) : undefined), [db, depth]);
25
30
 
26
31
  return (
27
32
  <Clipboard.Provider>
28
- <Panel.Root>
33
+ <Panel.Root role={role}>
29
34
  <Panel.Toolbar asChild>
30
35
  <Toolbar.Root />
31
36
  </Panel.Toolbar>
32
37
  <Panel.Content asChild>
33
- <Grid rows={db ? 2 : 1} classNames='divide-y divide-separator'>
38
+ <div className={mx('grid divide-y divide-separator', db && 'grid-rows-[1fr_2fr]')}>
34
39
  {db && (
35
40
  <ScrollArea.Root>
36
41
  <ScrollArea.Viewport>
37
- <ObjectsTree db={db} root={object} onSelect={(entity) => setSelectedId(entity.id)} />
42
+ <ObjectsTree db={db} root={companionTo} onSelect={(entity) => setSelectedId(entity.id)} />
38
43
  </ScrollArea.Viewport>
39
44
  </ScrollArea.Root>
40
45
  )}
41
- <Json data={selectedObject} />
42
- </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>
43
72
  </Panel.Content>
44
73
  </Panel.Root>
45
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,28 +4,20 @@
4
4
 
5
5
  import React, { useState } from 'react';
6
6
 
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
7
8
  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/plugin-space';
9
+ import { Filter, Query } from '@dxos/echo';
10
+ import { type ObjectId } from '@dxos/keys';
11
11
  import { useQuery } from '@dxos/react-client/echo';
12
12
  import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
13
- import { Json } from '@dxos/react-ui-syntax-highlighter';
13
+ import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
14
14
 
15
- export const DebugSpaceObjectsPanel = () => {
16
- const space = useActiveSpace();
17
- if (!space) {
18
- return null;
19
- }
15
+ export type DebugSpaceObjectsPanelProps = AppSurface.SpaceArticleProps;
20
16
 
21
- return <DebugSpaceObjectsPanelMain database={space.db} />;
22
- };
23
-
24
- const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database }) => {
17
+ export const DebugSpaceObjectsPanel = ({ space }: DebugSpaceObjectsPanelProps) => {
25
18
  const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
26
-
27
19
  const [selectedObject] = useQuery(
28
- database,
20
+ space.db,
29
21
  selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
30
22
  );
31
23
 
@@ -43,10 +35,10 @@ const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database
43
35
  <Grid rows={2} classNames='divide-y divide-separator'>
44
36
  <ScrollArea.Root>
45
37
  <ScrollArea.Viewport>
46
- <ObjectsTree db={database} onSelect={(entity) => setSelectedId(entity.id)} />
38
+ <ObjectsTree db={space.db} onSelect={(entity) => setSelectedId(entity.id)} />
47
39
  </ScrollArea.Viewport>
48
40
  </ScrollArea.Root>
49
- {selectedObject && <Json classNames='p-1' data={selectedObject} />}
41
+ {selectedObject && <JsonHighlighter classNames='p-1' data={selectedObject} />}
50
42
  </Grid>
51
43
  </Panel.Content>
52
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,8 +5,7 @@
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
11
  import { IconButton } from '@dxos/react-ui';
@@ -145,7 +144,6 @@ const SwarmIndicator = () => {
145
144
  // TODO(burdon): Merge with SaveStatus.
146
145
  const SavingIndicator = () => {
147
146
  const [state, _setState] = useState(0);
148
- const _space = useActiveSpace();
149
147
  // TODO(dmaretskyi): Fix this when we have save status for automerge.
150
148
  // useEffect(() => {
151
149
  // if (!space) {
@@ -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';
@@ -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';
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
9
+
10
+ import { translations } from '#translations';
11
+
12
+ import { GithubComponent } from './GithubComponent';
13
+
14
+ const DefaultStory = () => (
15
+ <GithubComponent.Root>
16
+ <div className='grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden bs-full is-full'>
17
+ <GithubComponent.Header />
18
+ <GithubComponent.Content />
19
+ <GithubComponent.StatusBar />
20
+ </div>
21
+ </GithubComponent.Root>
22
+ );
23
+
24
+ const meta = {
25
+ title: 'plugins/plugin-debug/containers/GithubComponent',
26
+ component: DefaultStory,
27
+ decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'w-(--dx-r1-size)' })],
28
+ parameters: {
29
+ layout: 'fullscreen',
30
+ translations,
31
+ },
32
+ } satisfies Meta<typeof DefaultStory>;
33
+
34
+ export default meta;
35
+
36
+ type Story = StoryObj<typeof meta>;
37
+
38
+ export const Default: Story = {};
@@ -0,0 +1,192 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import React, { type ReactNode, createContext, useContext, useEffect, useState } from 'react';
6
+
7
+ import { IconButton, ScrollArea, useTranslation } from '@dxos/react-ui';
8
+
9
+ import { meta } from '#meta';
10
+
11
+ const DEFAULT_REPO = 'dxos/dxos';
12
+ const DEFAULT_LIMIT = 20;
13
+
14
+ type GithubUser = {
15
+ login: string;
16
+ avatar_url: string;
17
+ html_url: string;
18
+ };
19
+
20
+ type GithubPullRequest = {
21
+ number: number;
22
+ title: string;
23
+ html_url: string;
24
+ merged_at: string | null;
25
+ user: GithubUser;
26
+ };
27
+
28
+ type ComponentContextValue = {
29
+ repo: string;
30
+ pulls: GithubPullRequest[];
31
+ unavailable: boolean;
32
+ };
33
+
34
+ const ComponentContext = createContext<ComponentContextValue | null>(null);
35
+
36
+ const useComponentContext = () => {
37
+ const ctx = useContext(ComponentContext);
38
+ if (!ctx) {
39
+ throw new Error('GithubComponent.* parts must be rendered inside GithubComponent.Root.');
40
+ }
41
+ return ctx;
42
+ };
43
+
44
+ export type GithubComponentRootProps = {
45
+ /** `<owner>/<name>`. Defaults to `dxos/dxos`. */
46
+ repo?: string;
47
+ /** Maximum number of merged PRs to fetch. */
48
+ limit?: number;
49
+ children?: ReactNode;
50
+ };
51
+
52
+ const Root = ({ repo = DEFAULT_REPO, limit = DEFAULT_LIMIT, children }: GithubComponentRootProps) => {
53
+ const [pulls, setPulls] = useState<GithubPullRequest[]>([]);
54
+ const [unavailable, setUnavailable] = useState(false);
55
+
56
+ useEffect(() => {
57
+ const controller = new AbortController();
58
+ setPulls([]);
59
+ setUnavailable(false);
60
+ void (async () => {
61
+ try {
62
+ const url = new URL(`https://api.github.com/repos/${repo}/pulls`);
63
+ url.searchParams.set('state', 'closed');
64
+ url.searchParams.set('sort', 'updated');
65
+ url.searchParams.set('direction', 'desc');
66
+ url.searchParams.set('per_page', String(limit * 2));
67
+ const response = await fetch(url.toString(), {
68
+ signal: controller.signal,
69
+ headers: { Accept: 'application/vnd.github+json' },
70
+ });
71
+ if (!response.ok) {
72
+ setUnavailable(true);
73
+ return;
74
+ }
75
+ const items = (await response.json()) as GithubPullRequest[];
76
+ setPulls(items.filter((pull) => pull.merged_at !== null).slice(0, limit));
77
+ setUnavailable(false);
78
+ } catch {
79
+ if (controller.signal.aborted) {
80
+ return;
81
+ }
82
+ setPulls([]);
83
+ setUnavailable(true);
84
+ }
85
+ })();
86
+ return () => controller.abort();
87
+ }, [repo, limit]);
88
+
89
+ return <ComponentContext.Provider value={{ repo, pulls, unavailable }}>{children}</ComponentContext.Provider>;
90
+ };
91
+
92
+ const Header = () => {
93
+ const { t } = useTranslation(meta.id);
94
+ const { repo, pulls, unavailable } = useComponentContext();
95
+ return (
96
+ <header className='flex items-center justify-between gap-1 px-4 py-3 bg-modal-surface border-b border-subdued-separator'>
97
+ <a
98
+ href={`https://github.com/${repo}`}
99
+ target='_blank'
100
+ rel='noopener noreferrer'
101
+ className='text-sm font-medium truncate'
102
+ >
103
+ @{repo}
104
+ </a>
105
+ <div className='text-xs text-description'>
106
+ {unavailable
107
+ ? t('github-unavailable.message')
108
+ : pulls.length > 0
109
+ ? t('recent-prs.label', { count: pulls.length })
110
+ : t('github-loading.message')}
111
+ </div>
112
+ </header>
113
+ );
114
+ };
115
+
116
+ const RELATIVE_UNITS: Array<[Intl.RelativeTimeFormatUnit, number]> = [
117
+ ['year', 60 * 60 * 24 * 365],
118
+ ['month', 60 * 60 * 24 * 30],
119
+ ['week', 60 * 60 * 24 * 7],
120
+ ['day', 60 * 60 * 24],
121
+ ['hour', 60 * 60],
122
+ ['minute', 60],
123
+ ];
124
+
125
+ const formatRelative = (iso: string): string => {
126
+ const formatter = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });
127
+ const diffSeconds = (Date.parse(iso) - Date.now()) / 1000;
128
+ const absDiff = Math.abs(diffSeconds);
129
+ for (const [unit, secondsInUnit] of RELATIVE_UNITS) {
130
+ if (absDiff >= secondsInUnit) {
131
+ return formatter.format(Math.round(diffSeconds / secondsInUnit), unit);
132
+ }
133
+ }
134
+ return formatter.format(Math.round(diffSeconds), 'second');
135
+ };
136
+
137
+ const PullRow = ({ pull }: { pull: GithubPullRequest }) => (
138
+ <li>
139
+ <a
140
+ href={pull.html_url}
141
+ target='_blank'
142
+ rel='noopener noreferrer'
143
+ className='flex items-start gap-2 px-2 py-1 rounded-sm hover:bg-hover-surface'
144
+ >
145
+ <img src={pull.user.avatar_url} alt='' className='w-6 h-6 rounded-full shrink-0 mt-0.5' />
146
+ <div className='flex flex-col min-w-0 flex-1'>
147
+ <span className='text-sm truncate'>{pull.title}</span>
148
+ <span className='text-xs text-description truncate'>
149
+ #{pull.number} · {pull.user.login} · {pull.merged_at ? formatRelative(pull.merged_at) : ''}
150
+ </span>
151
+ </div>
152
+ </a>
153
+ </li>
154
+ );
155
+
156
+ const Content = () => {
157
+ const { pulls } = useComponentContext();
158
+ return (
159
+ <ScrollArea.Root orientation='vertical'>
160
+ <ScrollArea.Viewport>
161
+ <ul className='flex flex-col p-1'>
162
+ {pulls.map((pull) => (
163
+ <PullRow key={pull.number} pull={pull} />
164
+ ))}
165
+ </ul>
166
+ </ScrollArea.Viewport>
167
+ </ScrollArea.Root>
168
+ );
169
+ };
170
+
171
+ const StatusBar = () => {
172
+ const { t } = useTranslation(meta.id);
173
+ const { repo } = useComponentContext();
174
+ return (
175
+ <IconButton
176
+ icon='ph--github-logo--regular'
177
+ label={t('view-on-github.button')}
178
+ variant='primary'
179
+ classNames='w-full'
180
+ onClick={() => {
181
+ window.open(`https://github.com/${repo}`, '_blank', 'noopener,noreferrer');
182
+ }}
183
+ />
184
+ );
185
+ };
186
+
187
+ export const GithubComponent = {
188
+ Root,
189
+ Header,
190
+ Content,
191
+ StatusBar,
192
+ };
@@ -0,0 +1,17 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { GithubComponent } from './GithubComponent';
8
+
9
+ export const GithubPanel = () => (
10
+ <GithubComponent.Root>
11
+ <div className='h-full grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden bs-full is-full'>
12
+ <GithubComponent.Header />
13
+ <GithubComponent.Content />
14
+ <GithubComponent.StatusBar />
15
+ </div>
16
+ </GithubComponent.Root>
17
+ );
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export { GithubPanel as default } from './GithubPanel';
@@ -7,18 +7,21 @@ 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 { Sketch } 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
17
  import { composable, composableProps } from '@dxos/ui-theme';
19
- import { jsonKeyReplacer, sortKeys } from '@dxos/util';
18
+ import { sortKeys } from '@dxos/util';
20
19
 
21
- 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];
22
25
 
23
26
  export type SpaceGeneratorProps = {
24
27
  space: Space;
@@ -29,8 +32,6 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
29
32
  ({ space, onCreateObjects, children, ...props }, forwardedRef) => {
30
33
  const { invokePromise } = useOperationInvoker();
31
34
  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
35
  const [count, setCount] = useState(1);
35
36
  const [info, setInfo] = useState<any>({});
36
37
  const presets = useMemo(() => generator(), []);
@@ -38,7 +39,7 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
38
39
  // Register types.
39
40
  useAsyncEffect(async () => {
40
41
  await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
41
- }, [client]);
42
+ }, [client, presets]);
42
43
 
43
44
  // Create type generators.
44
45
  const typeMap = useMemo(() => {
@@ -47,15 +48,13 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
47
48
  );
48
49
 
49
50
  return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
50
- }, [client, recordTypes, invokePromise]);
51
+ }, [client, invokePromise, presets]);
51
52
 
52
53
  // Query space to get info.
53
- const updateInfo = async () => {
54
- // Create schema map.
54
+ const updateInfo = useCallback(async () => {
55
55
  const echoSchema = await space.db.schemaRegistry.query().run();
56
56
  const staticSchema = await space.db.graph.schemaRegistry.query().run();
57
57
 
58
- // Create object map.
59
58
  const objects = await space.db.query(Filter.everything()).run();
60
59
  const objectMap = sortKeys(
61
60
  objects.reduce<Record<string, number>>((map, obj) => {
@@ -76,9 +75,9 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
76
75
  },
77
76
  objects: objectMap,
78
77
  });
79
- };
78
+ }, [space]);
80
79
 
81
- useAsyncEffect(updateInfo, [space]);
80
+ useAsyncEffect(updateInfo, [updateInfo]);
82
81
 
83
82
  const handleCreateData = useCallback(
84
83
  async (typename: string) => {
@@ -89,7 +88,7 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
89
88
  await updateInfo();
90
89
  }
91
90
  },
92
- [typeMap, count],
91
+ [typeMap, count, space, onCreateObjects, updateInfo],
93
92
  );
94
93
 
95
94
  return (
@@ -114,13 +113,10 @@ export const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(
114
113
  </Panel.Toolbar>
115
114
  <Panel.Content asChild>
116
115
  <ScrollArea.Root thin orientation='vertical'>
117
- <ScrollArea.Viewport classNames='gap-4 divide-y divide-subdued-separator'>
116
+ <ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-subdued-separator'>
118
117
  <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
119
118
  <SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
120
119
  <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
120
  </ScrollArea.Viewport>
125
121
  </ScrollArea.Root>
126
122
  </Panel.Content>
@@ -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,9 +6,9 @@ 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'));
13
12
  export const Wireframe: ComponentType<any> = lazy(() => import('./Wireframe'));
14
13
  export const DebugSpaceObjectsPanel: ComponentType<any> = lazy(() => import('./DebugSpaceObjectsPanel'));
14
+ export const GithubPanel: ComponentType<any> = lazy(() => import('./GithubPanel'));
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
@@ -8,6 +8,7 @@ import { trim } from '@dxos/util';
8
8
  export const meta: Plugin.Meta = {
9
9
  id: 'org.dxos.plugin.debug',
10
10
  name: 'Debug',
11
+ author: 'DXOS',
11
12
  description: trim`
12
13
  Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
13
14
  Inspect objects, monitor events, and debug plugin behavior in real-time.
@@ -15,4 +16,5 @@ export const meta: Plugin.Meta = {
15
16
  icon: 'ph--bug--regular',
16
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
17
18
  screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
19
+ tags: ['labs'],
18
20
  };
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';