@dxos/plugin-debug 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.0

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 (501) hide show
  1. package/PLUGIN.mdl +241 -3
  2. package/README.md +27 -3
  3. package/dist/lib/Debug.mjs.map +1 -1
  4. package/dist/lib/DebugNodes.mjs +21 -2
  5. package/dist/lib/DebugNodes.mjs.map +1 -1
  6. package/dist/lib/DebugOperation.mjs +166 -2
  7. package/dist/lib/DebugOperation.mjs.map +1 -1
  8. package/dist/lib/DebugPlugin.mjs.map +1 -1
  9. package/dist/lib/DebugSurface.mjs +7 -2
  10. package/dist/lib/DebugSurface.mjs.map +1 -1
  11. package/dist/lib/IncidentSpace.mjs +2 -0
  12. package/dist/lib/PipelineSpace.mjs +2 -0
  13. package/dist/lib/ReviewSpace.mjs +2 -0
  14. package/dist/lib/StockfishSpace.mjs +2 -0
  15. package/dist/lib/TidepoolSpace.mjs +2 -0
  16. package/dist/lib/WeatherSpace.mjs +2 -0
  17. package/dist/lib/WorkerSpace.mjs +2 -0
  18. package/dist/lib/capabilities.browser.mjs +71 -0
  19. package/dist/lib/capabilities.browser.mjs.map +1 -0
  20. package/dist/lib/capabilities.mjs +17 -7
  21. package/dist/lib/capabilities.mjs.map +1 -1
  22. package/dist/lib/capabilities.node.mjs +13 -3
  23. package/dist/lib/capabilities.node.mjs.map +1 -1
  24. package/dist/lib/capabilities.tauri.mjs +71 -0
  25. package/dist/lib/capabilities.tauri.mjs.map +1 -0
  26. package/dist/lib/capabilities.workerd.mjs +3 -1
  27. package/dist/lib/capabilities.workerd.mjs.map +1 -1
  28. package/dist/lib/chunk-DebugConsole.mjs +241 -0
  29. package/dist/lib/chunk-DebugConsole.mjs.map +1 -0
  30. package/dist/lib/chunk-DebugObjectPanel.mjs +12 -16
  31. package/dist/lib/chunk-DebugObjectPanel.mjs.map +1 -1
  32. package/dist/lib/chunk-DebugPanelDrawer.mjs +48 -0
  33. package/dist/lib/chunk-DebugPanelDrawer.mjs.map +1 -0
  34. package/dist/lib/chunk-DebugPanelHeader.mjs +280 -0
  35. package/dist/lib/chunk-DebugPanelHeader.mjs.map +1 -0
  36. package/dist/lib/chunk-DebugPanelStatus.mjs +127 -0
  37. package/dist/lib/chunk-DebugPanelStatus.mjs.map +1 -0
  38. package/dist/lib/chunk-DebugSettings.mjs +81 -70
  39. package/dist/lib/chunk-DebugSettings.mjs.map +1 -1
  40. package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs +21 -12
  41. package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs.map +1 -1
  42. package/dist/lib/chunk-DebugStatus.mjs +12 -12
  43. package/dist/lib/chunk-DebugStatus.mjs.map +1 -1
  44. package/dist/lib/chunk-IncidentSpace.mjs +269 -0
  45. package/dist/lib/chunk-IncidentSpace.mjs.map +1 -0
  46. package/dist/lib/chunk-LoggerPanel.mjs +18 -0
  47. package/dist/lib/chunk-LoggerPanel.mjs.map +1 -0
  48. package/dist/lib/chunk-PLUGIN.mjs +6 -0
  49. package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
  50. package/dist/lib/chunk-PipelineSpace.mjs +378 -0
  51. package/dist/lib/chunk-PipelineSpace.mjs.map +1 -0
  52. package/dist/lib/chunk-ReviewSpace.mjs +356 -0
  53. package/dist/lib/chunk-ReviewSpace.mjs.map +1 -0
  54. package/dist/lib/chunk-SpaceGenerator.mjs +107 -73
  55. package/dist/lib/chunk-SpaceGenerator.mjs.map +1 -1
  56. package/dist/lib/chunk-StatsPanel.mjs +28 -35
  57. package/dist/lib/chunk-StatsPanel.mjs.map +1 -1
  58. package/dist/lib/chunk-StockfishSpace.mjs +563 -0
  59. package/dist/lib/chunk-StockfishSpace.mjs.map +1 -0
  60. package/dist/lib/chunk-TidepoolSpace.mjs +544 -0
  61. package/dist/lib/chunk-TidepoolSpace.mjs.map +1 -0
  62. package/dist/lib/chunk-WeatherSpace.mjs +206 -0
  63. package/dist/lib/chunk-WeatherSpace.mjs.map +1 -0
  64. package/dist/lib/chunk-Wireframe.mjs +6 -6
  65. package/dist/lib/chunk-Wireframe.mjs.map +1 -1
  66. package/dist/lib/chunk-WorkerSpace.mjs +177 -0
  67. package/dist/lib/chunk-WorkerSpace.mjs.map +1 -0
  68. package/dist/lib/chunk-app-graph-builder.mjs +72 -40
  69. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -1
  70. package/dist/lib/chunk-create-space-from-template.mjs +55 -0
  71. package/dist/lib/chunk-create-space-from-template.mjs.map +1 -0
  72. package/dist/lib/chunk-errors.mjs +13 -0
  73. package/dist/lib/chunk-errors.mjs.map +1 -0
  74. package/dist/lib/chunk-graph-retention.mjs +14 -0
  75. package/dist/lib/chunk-graph-retention.mjs.map +1 -0
  76. package/dist/lib/chunk-insert-lorem-ipsum.mjs +2 -2
  77. package/dist/lib/chunk-log-recording.mjs +29 -1
  78. package/dist/lib/chunk-log-recording.mjs.map +1 -1
  79. package/dist/lib/chunk-open-page.mjs +29 -0
  80. package/dist/lib/chunk-open-page.mjs.map +1 -0
  81. package/dist/lib/chunk-operation-handler.mjs +5 -0
  82. package/dist/lib/chunk-operation-handler.mjs.map +1 -1
  83. package/dist/lib/chunk-react-surface.mjs +73 -71
  84. package/dist/lib/chunk-react-surface.mjs.map +1 -1
  85. package/dist/lib/chunk-settings.mjs +2 -2
  86. package/dist/lib/chunk-settings.mjs.map +1 -1
  87. package/dist/lib/chunk-snapshot.mjs +170 -0
  88. package/dist/lib/chunk-snapshot.mjs.map +1 -0
  89. package/dist/lib/chunk-space-templates.mjs +21 -0
  90. package/dist/lib/chunk-space-templates.mjs.map +1 -0
  91. package/dist/lib/chunk-stats-panel.mjs +1 -1
  92. package/dist/lib/chunk-stats-panel.mjs.map +1 -1
  93. package/dist/lib/chunk-undo.mjs +17 -0
  94. package/dist/lib/chunk-undo.mjs.map +1 -0
  95. package/dist/lib/chunk-view-state.mjs +37 -0
  96. package/dist/lib/chunk-view-state.mjs.map +1 -0
  97. package/dist/lib/components.mjs +68 -28
  98. package/dist/lib/components.mjs.map +1 -1
  99. package/dist/lib/containers.mjs +5 -2
  100. package/dist/lib/containers.mjs.map +1 -1
  101. package/dist/lib/index.mjs +8 -2
  102. package/dist/lib/meta.mjs +3 -2
  103. package/dist/lib/meta.mjs.map +1 -1
  104. package/dist/lib/operations.mjs +7 -1
  105. package/dist/lib/operations.mjs.map +1 -1
  106. package/dist/lib/plugin.mjs +2 -2
  107. package/dist/lib/plugin.mjs.map +1 -1
  108. package/dist/lib/translations.mjs +13 -4
  109. package/dist/lib/translations.mjs.map +1 -1
  110. package/dist/types/scripts/build-template-archive.d.ts +2 -0
  111. package/dist/types/scripts/build-template-archive.d.ts.map +1 -0
  112. package/dist/types/src/DebugPlugin.d.ts +2 -2
  113. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  114. package/dist/types/src/capabilities/DebugSurfaces.d.ts +4 -5
  115. package/dist/types/src/capabilities/DebugSurfaces.d.ts.map +1 -1
  116. package/dist/types/src/capabilities/app-graph-builder.d.ts +31 -0
  117. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  118. package/dist/types/src/capabilities/app-graph-builder.test.d.ts +2 -0
  119. package/dist/types/src/capabilities/app-graph-builder.test.d.ts.map +1 -0
  120. package/dist/types/src/capabilities/gen/browser.d.ts +14 -0
  121. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
  122. package/dist/types/src/capabilities/gen/node.d.ts +2 -0
  123. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
  124. package/dist/types/src/capabilities/gen/tauri.d.ts +14 -0
  125. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
  126. package/dist/types/src/capabilities/gen/workerd.d.ts +2 -0
  127. package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
  128. package/dist/types/src/capabilities/graph-retention.d.ts +5 -0
  129. package/dist/types/src/capabilities/graph-retention.d.ts.map +1 -0
  130. package/dist/types/src/capabilities/index.d.ts +2 -0
  131. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  132. package/dist/types/src/capabilities/log-recording.d.ts +4 -0
  133. package/dist/types/src/capabilities/log-recording.d.ts.map +1 -1
  134. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  135. package/dist/types/src/capabilities/space-templates.d.ts +14 -0
  136. package/dist/types/src/capabilities/space-templates.d.ts.map +1 -0
  137. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts +4 -3
  138. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
  139. package/dist/types/src/components/SchemaTable/index.d.ts +1 -1
  140. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -1
  141. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -1
  142. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  143. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  144. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  145. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -1
  146. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  147. package/dist/types/src/components/index.d.ts +2 -2
  148. package/dist/types/src/components/index.d.ts.map +1 -1
  149. package/dist/types/src/containers/DebugConsole/DebugConsole.d.ts +12 -0
  150. package/dist/types/src/containers/DebugConsole/DebugConsole.d.ts.map +1 -0
  151. package/dist/types/src/containers/DebugConsole/DebugConsole.stories.d.ts +103 -0
  152. package/dist/types/src/containers/DebugConsole/DebugConsole.stories.d.ts.map +1 -0
  153. package/dist/types/src/containers/DebugConsole/cli.d.ts +24 -0
  154. package/dist/types/src/containers/DebugConsole/cli.d.ts.map +1 -0
  155. package/dist/types/src/containers/DebugConsole/index.d.ts +2 -0
  156. package/dist/types/src/containers/DebugConsole/index.d.ts.map +1 -0
  157. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +1 -1
  158. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
  159. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +1 -1
  160. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -1
  161. package/dist/types/src/containers/DebugPanel/DebugPanel.d.ts +30 -0
  162. package/dist/types/src/containers/DebugPanel/DebugPanel.d.ts.map +1 -0
  163. package/dist/types/src/containers/DebugPanel/DebugPanel.stories.d.ts +126 -0
  164. package/dist/types/src/containers/DebugPanel/DebugPanel.stories.d.ts.map +1 -0
  165. package/dist/types/src/containers/DebugPanel/DebugPanelContext.d.ts +16 -0
  166. package/dist/types/src/containers/DebugPanel/DebugPanelContext.d.ts.map +1 -0
  167. package/dist/types/src/containers/DebugPanel/DebugPanelHeader.d.ts +14 -0
  168. package/dist/types/src/containers/DebugPanel/DebugPanelHeader.d.ts.map +1 -0
  169. package/dist/types/src/containers/DebugPanel/DebugPanelMain.d.ts +6 -0
  170. package/dist/types/src/containers/DebugPanel/DebugPanelMain.d.ts.map +1 -0
  171. package/dist/types/src/containers/DebugPanel/DebugPanelSidebar.d.ts +6 -0
  172. package/dist/types/src/containers/DebugPanel/DebugPanelSidebar.d.ts.map +1 -0
  173. package/dist/types/src/containers/DebugPanel/index.d.ts +7 -0
  174. package/dist/types/src/containers/DebugPanel/index.d.ts.map +1 -0
  175. package/dist/types/src/containers/DebugPanel/view-state.d.ts +46 -0
  176. package/dist/types/src/containers/DebugPanel/view-state.d.ts.map +1 -0
  177. package/dist/types/src/containers/DebugPanelDrawer/DebugPanelDrawer.d.ts +10 -0
  178. package/dist/types/src/containers/DebugPanelDrawer/DebugPanelDrawer.d.ts.map +1 -0
  179. package/dist/types/src/containers/DebugPanelDrawer/DebugPanelDrawer.stories.d.ts +114 -0
  180. package/dist/types/src/containers/DebugPanelDrawer/DebugPanelDrawer.stories.d.ts.map +1 -0
  181. package/dist/types/src/containers/DebugPanelDrawer/index.d.ts +2 -0
  182. package/dist/types/src/containers/DebugPanelDrawer/index.d.ts.map +1 -0
  183. package/dist/types/src/containers/DebugPanelStatus/DebugPanelStatus.d.ts +11 -0
  184. package/dist/types/src/containers/DebugPanelStatus/DebugPanelStatus.d.ts.map +1 -0
  185. package/dist/types/src/containers/DebugPanelStatus/DebugPanelStatus.stories.d.ts +107 -0
  186. package/dist/types/src/containers/DebugPanelStatus/DebugPanelStatus.stories.d.ts.map +1 -0
  187. package/dist/types/src/containers/DebugPanelStatus/index.d.ts +2 -0
  188. package/dist/types/src/containers/DebugPanelStatus/index.d.ts.map +1 -0
  189. package/dist/types/src/containers/DebugPortSettings/DebugPortSettings.d.ts.map +1 -1
  190. package/dist/types/src/containers/DebugPortSettings/DebugPortSettings.stories.d.ts +13 -4
  191. package/dist/types/src/containers/DebugPortSettings/DebugPortSettings.stories.d.ts.map +1 -1
  192. package/dist/types/src/containers/DebugPortSettings/index.d.ts +1 -1
  193. package/dist/types/src/containers/DebugPortSettings/index.d.ts.map +1 -1
  194. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +2 -2
  195. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -1
  196. package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts +14 -5
  197. package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts.map +1 -1
  198. package/dist/types/src/containers/DebugSettings/index.d.ts +1 -1
  199. package/dist/types/src/containers/DebugSettings/index.d.ts.map +1 -1
  200. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +1 -1
  201. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
  202. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +1 -1
  203. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -1
  204. package/dist/types/src/containers/DebugStatus/index.d.ts +1 -1
  205. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -1
  206. package/dist/types/src/containers/LoggerPanel/LoggerPanel.d.ts +6 -0
  207. package/dist/types/src/containers/LoggerPanel/LoggerPanel.d.ts.map +1 -0
  208. package/dist/types/src/containers/LoggerPanel/LoggerPanel.stories.d.ts +107 -0
  209. package/dist/types/src/containers/LoggerPanel/LoggerPanel.stories.d.ts.map +1 -0
  210. package/dist/types/src/containers/LoggerPanel/index.d.ts +2 -0
  211. package/dist/types/src/containers/LoggerPanel/index.d.ts.map +1 -0
  212. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  213. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
  214. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  215. package/dist/types/src/containers/SpaceGenerator/index.d.ts +1 -1
  216. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -1
  217. package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts +5 -1
  218. package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts.map +1 -1
  219. package/dist/types/src/containers/StatsPanel/index.d.ts +1 -1
  220. package/dist/types/src/containers/StatsPanel/index.d.ts.map +1 -1
  221. package/dist/types/src/containers/Wireframe/Wireframe.d.ts +2 -2
  222. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
  223. package/dist/types/src/containers/Wireframe/index.d.ts +1 -1
  224. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -1
  225. package/dist/types/src/containers/index.d.ts +7 -1
  226. package/dist/types/src/containers/index.d.ts.map +1 -1
  227. package/dist/types/src/errors.d.ts +123 -0
  228. package/dist/types/src/errors.d.ts.map +1 -0
  229. package/dist/types/src/index.d.ts +2 -2
  230. package/dist/types/src/index.d.ts.map +1 -1
  231. package/dist/types/src/operations/DebugOperationHandlerSet.d.ts.map +1 -1
  232. package/dist/types/src/operations/create-space-from-template.d.ts +5 -0
  233. package/dist/types/src/operations/create-space-from-template.d.ts.map +1 -0
  234. package/dist/types/src/operations/errors.d.ts +33 -0
  235. package/dist/types/src/operations/errors.d.ts.map +1 -0
  236. package/dist/types/src/operations/index.d.ts +1 -1
  237. package/dist/types/src/operations/index.d.ts.map +1 -1
  238. package/dist/types/src/operations/open-page.d.ts +5 -0
  239. package/dist/types/src/operations/open-page.d.ts.map +1 -0
  240. package/dist/types/src/operations/snapshot.d.ts +5 -0
  241. package/dist/types/src/operations/snapshot.d.ts.map +1 -0
  242. package/dist/types/src/operations/snapshot.test.d.ts +2 -0
  243. package/dist/types/src/operations/snapshot.test.d.ts.map +1 -0
  244. package/dist/types/src/operations/undo.d.ts +5 -0
  245. package/dist/types/src/operations/undo.d.ts.map +1 -0
  246. package/dist/types/src/operations/undo.test.d.ts +2 -0
  247. package/dist/types/src/operations/undo.test.d.ts.map +1 -0
  248. package/dist/types/src/plugin.d.ts.map +1 -1
  249. package/dist/types/src/samples/crm/PipelineSpace.d.ts +21 -0
  250. package/dist/types/src/samples/crm/PipelineSpace.d.ts.map +1 -0
  251. package/dist/types/src/samples/crm/PipelineSpace.test.d.ts +2 -0
  252. package/dist/types/src/samples/crm/PipelineSpace.test.d.ts.map +1 -0
  253. package/dist/types/src/samples/crm/accounts.d.ts +55 -0
  254. package/dist/types/src/samples/crm/accounts.d.ts.map +1 -0
  255. package/dist/types/src/samples/crm/inbox.d.ts +14 -0
  256. package/dist/types/src/samples/crm/inbox.d.ts.map +1 -0
  257. package/dist/types/src/samples/crm/pipeline.d.ts +9 -0
  258. package/dist/types/src/samples/crm/pipeline.d.ts.map +1 -0
  259. package/dist/types/src/samples/crm/util.d.ts +14 -0
  260. package/dist/types/src/samples/crm/util.d.ts.map +1 -0
  261. package/dist/types/src/samples/incident/IncidentSpace.d.ts +21 -0
  262. package/dist/types/src/samples/incident/IncidentSpace.d.ts.map +1 -0
  263. package/dist/types/src/samples/incident/IncidentSpace.test.d.ts +2 -0
  264. package/dist/types/src/samples/incident/IncidentSpace.test.d.ts.map +1 -0
  265. package/dist/types/src/samples/incident/docs.d.ts +14 -0
  266. package/dist/types/src/samples/incident/docs.d.ts.map +1 -0
  267. package/dist/types/src/samples/incident/project.d.ts +16 -0
  268. package/dist/types/src/samples/incident/project.d.ts.map +1 -0
  269. package/dist/types/src/samples/incident/tasks.d.ts +9 -0
  270. package/dist/types/src/samples/incident/tasks.d.ts.map +1 -0
  271. package/dist/types/src/samples/incident/util.d.ts +32 -0
  272. package/dist/types/src/samples/incident/util.d.ts.map +1 -0
  273. package/dist/types/src/samples/index.d.ts +8 -0
  274. package/dist/types/src/samples/index.d.ts.map +1 -0
  275. package/dist/types/src/samples/review/ReviewSpace.d.ts +19 -0
  276. package/dist/types/src/samples/review/ReviewSpace.d.ts.map +1 -0
  277. package/dist/types/src/samples/review/ReviewSpace.test.d.ts +2 -0
  278. package/dist/types/src/samples/review/ReviewSpace.test.d.ts.map +1 -0
  279. package/dist/types/src/samples/review/assets.d.ts +19 -0
  280. package/dist/types/src/samples/review/assets.d.ts.map +1 -0
  281. package/dist/types/src/samples/review/util.d.ts +4 -0
  282. package/dist/types/src/samples/review/util.d.ts.map +1 -0
  283. package/dist/types/src/samples/review/work.d.ts +15 -0
  284. package/dist/types/src/samples/review/work.d.ts.map +1 -0
  285. package/dist/types/src/samples/stockfish/StockfishSpace.d.ts +27 -0
  286. package/dist/types/src/samples/stockfish/StockfishSpace.d.ts.map +1 -0
  287. package/dist/types/src/samples/stockfish/StockfishSpace.test.d.ts +2 -0
  288. package/dist/types/src/samples/stockfish/StockfishSpace.test.d.ts.map +1 -0
  289. package/dist/types/src/samples/stockfish/docs.d.ts +8 -0
  290. package/dist/types/src/samples/stockfish/docs.d.ts.map +1 -0
  291. package/dist/types/src/samples/stockfish/game.d.ts +10 -0
  292. package/dist/types/src/samples/stockfish/game.d.ts.map +1 -0
  293. package/dist/types/src/samples/stockfish/project.d.ts +31 -0
  294. package/dist/types/src/samples/stockfish/project.d.ts.map +1 -0
  295. package/dist/types/src/samples/stockfish/run.test.d.ts +2 -0
  296. package/dist/types/src/samples/stockfish/run.test.d.ts.map +1 -0
  297. package/dist/types/src/samples/stockfish/skill.d.ts +8 -0
  298. package/dist/types/src/samples/stockfish/skill.d.ts.map +1 -0
  299. package/dist/types/src/samples/stockfish/tasks.d.ts +12 -0
  300. package/dist/types/src/samples/stockfish/tasks.d.ts.map +1 -0
  301. package/dist/types/src/samples/stockfish/util.d.ts +14 -0
  302. package/dist/types/src/samples/stockfish/util.d.ts.map +1 -0
  303. package/dist/types/src/samples/tidepool/TidepoolSpace.d.ts +22 -0
  304. package/dist/types/src/samples/tidepool/TidepoolSpace.d.ts.map +1 -0
  305. package/dist/types/src/samples/tidepool/TidepoolSpace.test.d.ts +2 -0
  306. package/dist/types/src/samples/tidepool/TidepoolSpace.test.d.ts.map +1 -0
  307. package/dist/types/src/samples/tidepool/docs.d.ts +12 -0
  308. package/dist/types/src/samples/tidepool/docs.d.ts.map +1 -0
  309. package/dist/types/src/samples/tidepool/project.d.ts +20 -0
  310. package/dist/types/src/samples/tidepool/project.d.ts.map +1 -0
  311. package/dist/types/src/samples/tidepool/tasks.d.ts +14 -0
  312. package/dist/types/src/samples/tidepool/tasks.d.ts.map +1 -0
  313. package/dist/types/src/samples/tidepool/team.d.ts +9 -0
  314. package/dist/types/src/samples/tidepool/team.d.ts.map +1 -0
  315. package/dist/types/src/samples/tidepool/util.d.ts +14 -0
  316. package/dist/types/src/samples/tidepool/util.d.ts.map +1 -0
  317. package/dist/types/src/samples/weather/WeatherSpace.d.ts +21 -0
  318. package/dist/types/src/samples/weather/WeatherSpace.d.ts.map +1 -0
  319. package/dist/types/src/samples/weather/WeatherSpace.test.d.ts +2 -0
  320. package/dist/types/src/samples/weather/WeatherSpace.test.d.ts.map +1 -0
  321. package/dist/types/src/samples/weather/project.d.ts +20 -0
  322. package/dist/types/src/samples/weather/project.d.ts.map +1 -0
  323. package/dist/types/src/samples/weather/skill.d.ts +12 -0
  324. package/dist/types/src/samples/weather/skill.d.ts.map +1 -0
  325. package/dist/types/src/samples/weather/tasks.d.ts +9 -0
  326. package/dist/types/src/samples/weather/tasks.d.ts.map +1 -0
  327. package/dist/types/src/samples/weather/util.d.ts +16 -0
  328. package/dist/types/src/samples/weather/util.d.ts.map +1 -0
  329. package/dist/types/src/samples/worker/WorkerSpace.d.ts +22 -0
  330. package/dist/types/src/samples/worker/WorkerSpace.d.ts.map +1 -0
  331. package/dist/types/src/samples/worker/WorkerSpace.test.d.ts +2 -0
  332. package/dist/types/src/samples/worker/WorkerSpace.test.d.ts.map +1 -0
  333. package/dist/types/src/samples/worker/project.d.ts +18 -0
  334. package/dist/types/src/samples/worker/project.d.ts.map +1 -0
  335. package/dist/types/src/samples/worker/tasks.d.ts +9 -0
  336. package/dist/types/src/samples/worker/tasks.d.ts.map +1 -0
  337. package/dist/types/src/samples/worker/util.d.ts +14 -0
  338. package/dist/types/src/samples/worker/util.d.ts.map +1 -0
  339. package/dist/types/src/stories/SpaceTemplates.stories.d.ts +114 -0
  340. package/dist/types/src/stories/SpaceTemplates.stories.d.ts.map +1 -0
  341. package/dist/types/src/testing/index.d.ts +3 -0
  342. package/dist/types/src/testing/index.d.ts.map +1 -0
  343. package/dist/types/src/testing/stub-drawer-plugin.d.ts +8 -0
  344. package/dist/types/src/testing/stub-drawer-plugin.d.ts.map +1 -0
  345. package/dist/types/src/testing/stub-tools-plugin.d.ts +19 -0
  346. package/dist/types/src/testing/stub-tools-plugin.d.ts.map +1 -0
  347. package/dist/types/src/translations.d.ts +13 -4
  348. package/dist/types/src/translations.d.ts.map +1 -1
  349. package/dist/types/src/types/Debug.d.ts +2 -2
  350. package/dist/types/src/types/Debug.d.ts.map +1 -1
  351. package/dist/types/src/types/DebugNodes.d.ts +13 -1
  352. package/dist/types/src/types/DebugNodes.d.ts.map +1 -1
  353. package/dist/types/src/types/DebugOperation.d.ts +119 -0
  354. package/dist/types/src/types/DebugOperation.d.ts.map +1 -1
  355. package/dist/types/src/types/DebugSurface.d.ts +7 -0
  356. package/dist/types/src/types/DebugSurface.d.ts.map +1 -1
  357. package/dist/types/src/types/index.d.ts +6 -6
  358. package/dist/types/src/types/index.d.ts.map +1 -1
  359. package/dist/types/tsconfig.tsbuildinfo +1 -1
  360. package/dx.config.ts +3 -2
  361. package/package.json +129 -73
  362. package/scripts/build-template-archive.ts +65 -0
  363. package/src/DebugPlugin.ts +1 -1
  364. package/src/capabilities/DebugSurfaces.tsx +85 -71
  365. package/src/capabilities/app-graph-builder.test.ts +45 -0
  366. package/src/capabilities/app-graph-builder.ts +83 -46
  367. package/src/capabilities/gen/browser.ts +85 -0
  368. package/src/capabilities/gen/node.ts +15 -8
  369. package/src/capabilities/gen/tauri.ts +85 -0
  370. package/src/capabilities/gen/workerd.ts +11 -4
  371. package/src/capabilities/graph-retention.ts +23 -0
  372. package/src/capabilities/index.ts +18 -10
  373. package/src/capabilities/log-recording.ts +20 -1
  374. package/src/capabilities/operation-handler.ts +9 -0
  375. package/src/capabilities/react-surface.ts +33 -29
  376. package/src/capabilities/settings.ts +2 -2
  377. package/src/capabilities/space-templates.ts +25 -0
  378. package/src/capabilities/stats-panel.ts +1 -1
  379. package/src/components/SchemaTable/SchemaTable.tsx +44 -10
  380. package/src/components/SchemaTable/index.ts +1 -1
  381. package/src/components/SpaceGenerator/ObjectGenerator.tsx +22 -2
  382. package/src/components/SpaceGenerator/index.ts +2 -2
  383. package/src/components/SpaceGenerator/presets.ts +4 -4
  384. package/src/components/index.ts +2 -2
  385. package/src/containers/DebugConsole/DebugConsole.stories.tsx +29 -0
  386. package/src/containers/DebugConsole/DebugConsole.tsx +94 -0
  387. package/src/containers/DebugConsole/cli.ts +296 -0
  388. package/src/containers/DebugConsole/index.ts +5 -0
  389. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +44 -44
  390. package/src/containers/DebugObjectPanel/index.ts +1 -1
  391. package/src/containers/DebugPanel/DebugPanel.stories.tsx +118 -0
  392. package/src/containers/DebugPanel/DebugPanel.tsx +72 -0
  393. package/src/containers/DebugPanel/DebugPanelContext.ts +33 -0
  394. package/src/containers/DebugPanel/DebugPanelHeader.tsx +54 -0
  395. package/src/containers/DebugPanel/DebugPanelMain.tsx +116 -0
  396. package/src/containers/DebugPanel/DebugPanelSidebar.tsx +123 -0
  397. package/src/containers/DebugPanel/index.ts +10 -0
  398. package/src/containers/DebugPanel/view-state.ts +60 -0
  399. package/src/containers/DebugPanelDrawer/DebugPanelDrawer.stories.tsx +92 -0
  400. package/src/containers/DebugPanelDrawer/DebugPanelDrawer.tsx +72 -0
  401. package/src/containers/DebugPanelDrawer/index.ts +5 -0
  402. package/src/containers/DebugPanelStatus/DebugPanelStatus.stories.tsx +119 -0
  403. package/src/containers/DebugPanelStatus/DebugPanelStatus.tsx +167 -0
  404. package/src/containers/DebugPanelStatus/index.ts +5 -0
  405. package/src/containers/DebugPortSettings/DebugPortSettings.stories.tsx +2 -2
  406. package/src/containers/DebugPortSettings/DebugPortSettings.tsx +33 -40
  407. package/src/containers/DebugPortSettings/index.ts +1 -1
  408. package/src/containers/DebugSettings/DebugSettings.stories.tsx +1 -1
  409. package/src/containers/DebugSettings/DebugSettings.tsx +71 -64
  410. package/src/containers/DebugSettings/index.ts +1 -1
  411. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +39 -28
  412. package/src/containers/DebugSpaceObjectsPanel/index.ts +1 -1
  413. package/src/containers/DebugStatus/DebugStatus.tsx +10 -10
  414. package/src/containers/DebugStatus/index.ts +1 -1
  415. package/src/containers/LoggerPanel/LoggerPanel.stories.tsx +62 -0
  416. package/src/containers/LoggerPanel/LoggerPanel.tsx +28 -0
  417. package/src/containers/LoggerPanel/index.ts +5 -0
  418. package/src/containers/SpaceGenerator/SpaceGenerator.stories.tsx +8 -8
  419. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +102 -73
  420. package/src/containers/SpaceGenerator/index.ts +1 -1
  421. package/src/containers/StatsPanel/StatsPanel.tsx +32 -31
  422. package/src/containers/StatsPanel/index.ts +1 -1
  423. package/src/containers/Wireframe/Wireframe.tsx +8 -7
  424. package/src/containers/Wireframe/index.ts +1 -1
  425. package/src/containers/index.ts +22 -9
  426. package/src/errors.ts +23 -0
  427. package/src/index.ts +2 -2
  428. package/src/meta.ts +1 -1
  429. package/src/operations/DebugOperationHandlerSet.ts +5 -1
  430. package/src/operations/create-space-from-template.ts +57 -0
  431. package/src/operations/errors.ts +8 -0
  432. package/src/operations/index.ts +1 -1
  433. package/src/operations/open-page.ts +51 -0
  434. package/src/operations/snapshot.test.ts +57 -0
  435. package/src/operations/snapshot.ts +243 -0
  436. package/src/operations/undo.test.ts +19 -0
  437. package/src/operations/undo.ts +28 -0
  438. package/src/plugin.tsx +4 -0
  439. package/src/samples/crm/PipelineSpace.test.ts +55 -0
  440. package/src/samples/crm/PipelineSpace.ts +52 -0
  441. package/src/samples/crm/accounts.ts +153 -0
  442. package/src/samples/crm/inbox.ts +158 -0
  443. package/src/samples/crm/pipeline.ts +70 -0
  444. package/src/samples/crm/util.ts +18 -0
  445. package/src/samples/incident/IncidentSpace.test.ts +68 -0
  446. package/src/samples/incident/IncidentSpace.ts +61 -0
  447. package/src/samples/incident/docs.ts +111 -0
  448. package/src/samples/incident/project.ts +61 -0
  449. package/src/samples/incident/tasks.ts +101 -0
  450. package/src/samples/incident/util.ts +24 -0
  451. package/src/samples/index.ts +11 -0
  452. package/src/samples/review/ReviewSpace.test.ts +89 -0
  453. package/src/samples/review/ReviewSpace.ts +47 -0
  454. package/src/samples/review/assets.ts +123 -0
  455. package/src/samples/review/util.ts +10 -0
  456. package/src/samples/review/work.ts +249 -0
  457. package/src/samples/stockfish/StockfishSpace.test.ts +129 -0
  458. package/src/samples/stockfish/StockfishSpace.ts +70 -0
  459. package/src/samples/stockfish/docs.ts +65 -0
  460. package/src/samples/stockfish/game.ts +47 -0
  461. package/src/samples/stockfish/project.ts +87 -0
  462. package/src/samples/stockfish/run.test.ts +193 -0
  463. package/src/samples/stockfish/skill.ts +154 -0
  464. package/src/samples/stockfish/tasks.ts +306 -0
  465. package/src/samples/stockfish/util.ts +17 -0
  466. package/src/samples/tidepool/TidepoolSpace.test.ts +61 -0
  467. package/src/samples/tidepool/TidepoolSpace.ts +65 -0
  468. package/src/samples/tidepool/docs.ts +140 -0
  469. package/src/samples/tidepool/project.ts +57 -0
  470. package/src/samples/tidepool/tasks.ts +252 -0
  471. package/src/samples/tidepool/team.ts +87 -0
  472. package/src/samples/tidepool/util.ts +18 -0
  473. package/src/samples/weather/WeatherSpace.test.ts +93 -0
  474. package/src/samples/weather/WeatherSpace.ts +59 -0
  475. package/src/samples/weather/project.ts +76 -0
  476. package/src/samples/weather/skill.ts +45 -0
  477. package/src/samples/weather/tasks.ts +98 -0
  478. package/src/samples/weather/util.ts +21 -0
  479. package/src/samples/worker/WorkerSpace.test.ts +102 -0
  480. package/src/samples/worker/WorkerSpace.ts +56 -0
  481. package/src/samples/worker/project.ts +72 -0
  482. package/src/samples/worker/tasks.ts +119 -0
  483. package/src/samples/worker/util.ts +17 -0
  484. package/src/stories/SpaceTemplates.stories.tsx +105 -0
  485. package/src/testing/index.ts +6 -0
  486. package/src/testing/stub-drawer-plugin.ts +65 -0
  487. package/src/testing/stub-tools-plugin.tsx +95 -0
  488. package/src/translations.ts +15 -6
  489. package/src/types/Debug.ts +2 -2
  490. package/src/types/DebugNodes.ts +21 -1
  491. package/src/types/DebugOperation.ts +206 -0
  492. package/src/types/DebugSurface.ts +7 -0
  493. package/src/types/index.ts +6 -6
  494. package/dist/lib/chunk-LogStatus.mjs +0 -44
  495. package/dist/lib/chunk-LogStatus.mjs.map +0 -1
  496. package/dist/types/src/containers/LogStatus/LogStatus.d.ts +0 -6
  497. package/dist/types/src/containers/LogStatus/LogStatus.d.ts.map +0 -1
  498. package/dist/types/src/containers/LogStatus/index.d.ts +0 -2
  499. package/dist/types/src/containers/LogStatus/index.d.ts.map +0 -1
  500. package/src/containers/LogStatus/LogStatus.tsx +0 -51
  501. package/src/containers/LogStatus/index.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-SpaceGenerator.mjs","names":[],"sources":["../../src/containers/SpaceGenerator/SpaceGenerator.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useOperationInvoker, useOptionalCapability } from '@dxos/app-framework/ui';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport { useProgressMonitor } from '@dxos/app-toolkit/ui';\nimport { ComputeGraph } from '@dxos/conductor';\nimport { Filter, Obj, Type } from '@dxos/echo';\nimport * as Drawing from '@dxos/plugin-illustrator/Drawing';\nimport * as Markdown from '@dxos/plugin-markdown/Markdown';\nimport * as Sheet from '@dxos/plugin-sheet/Sheet';\nimport * as SpaceOperation from '@dxos/plugin-space/SpaceOperation';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\nimport {\n Flex,\n IconButton,\n Input,\n Panel,\n ScrollArea,\n ThemedClassName,\n useAsyncEffect,\n useTranslation,\n} from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { ProgressMeter } from '@dxos/react-ui-components';\nimport { type ActionGraphProps, Menu, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';\nimport { Organization, Person, Task } from '@dxos/types';\nimport { mx } from '@dxos/ui-theme';\nimport { sortKeys } from '@dxos/util';\n\nimport { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';\nimport { meta } from '#meta';\n\n// TODO(burdon): Make extensible.\nconst staticTypes = [Markdown.Document, Drawing.Drawing, Sheet.Sheet, ComputeGraph];\nconst recordTypes = [Organization.Organization, Person.Person, Task.Task];\n\nconst TOAST_DURATION = 5_000;\n\nexport type SpaceGeneratorProps = {\n space: Space;\n onCreateObjects?: (objects: Obj.Unknown[]) => void;\n};\n\nexport const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(\n ({ children, space, onCreateObjects, ...props }, forwardedRef) => {\n const { invokePromise } = useOperationInvoker();\n const { t } = useTranslation(meta.profile.key);\n const client = useClient();\n const [count, setCount] = useState(1);\n const [info, setInfo] = useState<any>({});\n const presets = useMemo(() => generator(), []);\n\n // Register types.\n useAsyncEffect(async () => {\n await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);\n }, [client, presets]);\n\n // Create type generators.\n const typeMap = useMemo(() => {\n const recordGenerators = new Map<string, ObjectGenerator<any>>(\n recordTypes.map((type) => [Type.getTypename(type), createGenerator(client, invokePromise, type)]),\n );\n\n return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);\n }, [client, invokePromise, presets]);\n\n // Query space to get info.\n const updateInfo = useCallback(async () => {\n const allSchema = [...space.db.graph.registry.list().filter(Type.isType)];\n const echoSchema = allSchema.filter((t) => Type.isTypeKind(t));\n const staticSchema = allSchema.filter((t) => !Type.isTypeKind(t));\n\n const objects = await space.db.query(Filter.everything()).run();\n const objectMap = sortKeys(\n objects.reduce<Record<string, number>>((map, obj) => {\n const type = Obj.getTypename(obj);\n if (type) {\n const count = map[type] ?? 0;\n map[type] = count + 1;\n }\n\n return map;\n }, {}),\n );\n\n setInfo({\n schema: {\n static: staticSchema.length,\n mutable: echoSchema.length,\n },\n objects: objectMap,\n });\n }, [space]);\n\n useAsyncEffect(updateInfo, [updateInfo]);\n\n // TODO(wittjosiah): Custom toast required — `notify` labels are fixed at invocation, so a\n // result-dependent count cannot be reported through it. Drop these once operation notify\n // supports dynamic labels.\n const handleReset = useCallback(async () => {\n if (!window.confirm(t('remove-all-objects.confirm.description'))) {\n return;\n }\n const { data } = await invokePromise(SpaceOperation.RemoveAllObjects, undefined, {\n spaceId: space.id,\n notify: { error: ['remove-all-objects.error.title', { ns: meta.profile.key }] },\n });\n if (data) {\n await invokePromise(LayoutOperation.AddToast, {\n id: `${meta.profile.key}/remove-all-objects`,\n icon: 'ph--trash--regular',\n duration: TOAST_DURATION,\n title: ['remove-all-objects.toast.title', { ns: meta.profile.key }],\n description: ['remove-all-objects.toast.description', { ns: meta.profile.key, count: data.objectIds.length }],\n });\n }\n await updateInfo();\n }, [space, invokePromise, updateInfo, t]);\n\n const handleCollectGarbage = useCallback(async () => {\n if (!window.confirm(t('collect-garbage.confirm.description'))) {\n return;\n }\n const { data } = await invokePromise(SpaceOperation.CollectGarbage, undefined, {\n spaceId: space.id,\n notify: { error: ['collect-garbage.error.title', { ns: meta.profile.key }] },\n });\n if (data) {\n await invokePromise(LayoutOperation.AddToast, {\n id: `${meta.profile.key}/collect-garbage`,\n icon: 'ph--recycle--regular',\n duration: TOAST_DURATION,\n title: ['collect-garbage.toast.title', { ns: meta.profile.key }],\n description:\n data.removedDocuments === 0\n ? ['collect-garbage.toast.empty.description', { ns: meta.profile.key }]\n : ['collect-garbage.toast.description', { ns: meta.profile.key, count: data.removedDocuments }],\n });\n }\n await updateInfo();\n }, [space, invokePromise, updateInfo, t]);\n\n const menuActions = useSpaceGeneratorMenu({ updateInfo, handleReset, handleCollectGarbage });\n\n const handleCreateData = useCallback(\n async (typename: string) => {\n const constructor = typeMap.get(typename);\n if (constructor) {\n // TODO(burdon): Input to specify number of objects.\n await constructor(space, count, onCreateObjects);\n await updateInfo();\n }\n },\n [space, typeMap, count, updateInfo, onCreateObjects],\n );\n\n return (\n // `alwaysActive`: the toolbar gates itself on the menu scope's attention, and this debug panel\n // is not an attendable surface, so without it every action renders disabled.\n <Menu.Root {...menuActions} alwaysActive>\n <Panel.Root {...composableProps(props)} ref={forwardedRef}>\n <Panel.Toolbar>\n <Menu.Toolbar classNames='dx-document'>\n <Menu.Items />\n <Input.Root>\n <Input.TextInput\n type='number'\n placeholder='Count'\n classNames='w-[4rem] text-right'\n min={1}\n max={100}\n size={8}\n value={count}\n onChange={(event) => setCount(parseInt(event.target.value))}\n />\n </Input.Root>\n </Menu.Toolbar>\n </Panel.Toolbar>\n <Panel.Content asChild>\n <ScrollArea.Root thin orientation='vertical'>\n <ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-subdued-separator'>\n <SchemaTable\n classNames='py-1'\n types={staticTypes}\n objects={info.objects}\n label='Static Types'\n onClick={handleCreateData}\n />\n <SchemaTable\n classNames='py-1'\n types={recordTypes}\n objects={info.objects}\n label='Record Types'\n onClick={handleCreateData}\n />\n <SchemaTable\n classNames='py-1'\n types={presets.types}\n objects={info.objects}\n label='Presets'\n onClick={handleCreateData}\n />\n <ProgressGenerator classNames='py-1' />\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Panel.Content>\n </Panel.Root>\n </Menu.Root>\n );\n },\n);\n\nSpaceGenerator.displayName = 'SpaceGenerator';\n\n/**\n * Toolbar actions for the space generator. The toolbar's own action items hold the pending state —\n * each awaits its invoke, disables only itself while in flight, and guards re-entry — so nothing\n * here tracks that. The trailing gap separator pushes any sibling rendered after `Menu.Items` to the\n * end of the toolbar.\n */\nconst useSpaceGeneratorMenu = ({\n updateInfo,\n handleReset,\n handleCollectGarbage,\n}: {\n updateInfo: () => Promise<void>;\n handleReset: () => Promise<void>;\n handleCollectGarbage: () => Promise<void>;\n}) =>\n useMenuBuilder(\n (): ActionGraphProps =>\n MenuBuilder.make()\n .action(\n 'refresh',\n { label: 'Refresh', icon: 'ph--arrow-clockwise--regular', testId: 'spaceGenerator.refresh' },\n () => void updateInfo(),\n )\n .action(\n 'reset',\n { label: 'Reset space', icon: 'ph--trash--regular', testId: 'spaceGenerator.reset' },\n handleReset,\n )\n .action(\n 'collect',\n { label: 'Collect garbage', icon: 'ph--recycle--regular', testId: 'spaceGenerator.collectGarbage' },\n handleCollectGarbage,\n )\n .separator('gap')\n .build(),\n [updateInfo, handleReset, handleCollectGarbage],\n );\n\n// Stable key for the test progress monitor within the shared registry.\nconst TEST_PROGRESS_NAME = `${meta.profile.key}.test-progress`;\n\ntype ProgressGeneratorProps = ThemedClassName;\n\n// Drives a synthetic progress monitor (10s over 10 steps) so the R0 rail meter can be exercised —\n// and renders the meter here too, since the rail's only lives inside a popover the user must open,\n// which made a working monitor look like a broken one.\nconst ProgressGenerator = ({ classNames }: ProgressGeneratorProps) => {\n const registry = useOptionalCapability(AppCapabilities.ProgressRegistry);\n const monitor = useProgressMonitor(TEST_PROGRESS_NAME);\n const running = monitor?.status === 'running';\n const intervalRef = useRef<ReturnType<typeof setInterval> | undefined>(undefined);\n\n const clearTimer = useCallback(() => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = undefined;\n }\n }, []);\n\n const handleStart = useCallback(() => {\n // Guard on the timer ref too: `running` (derived from the registry) can lag a fast second click.\n if (!registry || running || intervalRef.current) {\n return;\n }\n\n const steps = 10;\n let current = 0;\n const handle = registry.register(TEST_PROGRESS_NAME, {\n label: 'Test Progress',\n total: steps,\n // Invoked by the meter's cancel control (R0 rail) or the local button.\n onCancel: () => {\n clearTimer();\n handle.remove();\n },\n });\n\n intervalRef.current = setInterval(() => {\n current += 1;\n handle.set(current);\n if (current >= steps) {\n clearTimer();\n handle.done();\n handle.remove();\n }\n }, 1_000);\n }, [registry, running, clearTimer]);\n\n // Tear down the timer and the registry entry if unmounted mid-run.\n useEffect(\n () => () => {\n clearTimer();\n registry?.cancel(TEST_PROGRESS_NAME);\n },\n [clearTimer, registry],\n );\n\n return (\n <div className={mx('flex flex-col gap-1 py-1', classNames)}>\n <Flex gap='sm' align='center'>\n <span className='grow'>Progress Monitor</span>\n {running ? (\n <IconButton\n icon='ph--x--regular'\n label='Cancel test progress'\n onClick={() => registry?.cancel(TEST_PROGRESS_NAME)}\n />\n ) : (\n <IconButton icon='ph--play--regular' label='Start test progress' disabled={!registry} onClick={handleStart} />\n )}\n </Flex>\n {monitor && (monitor.status === 'running' || monitor.status === 'error') && (\n <ProgressMeter state={monitor} onCancel={() => registry?.cancel(TEST_PROGRESS_NAME)} />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,cAAc;CAAC,SAAS;CAAU,QAAQ;CAAS,MAAM;CAAO;AAAY;AAClF,IAAM,cAAc;CA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oB;GACnD,OAAO;GACP,OAAO;GAEP,gBAAgB;IACd,WAAW;IACX,OAAO,OAAO;GAChB;EACF,CAAC;EAED,YAAY,UAAU,kBAAkB;GACtC,WAAW;GACX,OAAO,IAAI,OAAO;GAClB,IAAI,WAAW,OAAO;IACpB,WAAW;IACX,OAAO,KAAK;IACZ,OAAO,OAAO;GAChB;EACF,GAAG,GAAK;CACV,GAAG;EAAC;EAAU;EAAS;CAAU,CAAC;CAGlC,sBACc;EACV,WAAW;EACX,UAAU,OAAO,kBAAkB;CACrC,GACA,CAAC,YAAY,QAAQ,CACvB;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,4BAA4B,UAAU;EAAzD,UAAA,CACE,qBAAC,MAAD;GAAM,KAAI;GAAK,OAAM;GAArB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAO,UAAA;GAAsB,CAAA,GAC5C,UACC,oBAAC,YAAD;IACE,MAAK;IACL,OAAM;IACN,eAAe,UAAU,OAAO,kBAAkB;GACnD,CAAA,IAED,oBAAC,YAAD;IAAY,MAAK;IAAoB,OAAM;IAAsB,UAAU,CAAC;IAAU,SAAS;GAAc,CAAA,CAE3G;EACL,CAAA,GAAA,YAAY,QAAQ,WAAW,aAAa,QAAQ,WAAW,YAC9D,oBAAC,eAAD;GAAe,OAAO;GAAS,gBAAgB,UAAU,OAAO,kBAAkB;EAAI,CAAA,CAErF;;AAET"}
1
+ {"version":3,"file":"chunk-SpaceGenerator.mjs","names":[],"sources":["../../src/containers/SpaceGenerator/SpaceGenerator.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Hooks from '@dxos/app-framework/Hooks';\nimport * as PluginManagerProvider from '@dxos/app-framework/PluginManagerProvider';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as ToolkitHooks from '@dxos/app-toolkit/Hooks';\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport { ComputeGraph } from '@dxos/conductor';\nimport { Filter, Obj, Type } from '@dxos/echo';\nimport * as EffectEx from '@dxos/effect/EffectEx';\nimport * as Drawing from '@dxos/plugin-illustrator/Drawing';\nimport * as Markdown from '@dxos/plugin-markdown/Markdown';\nimport * as Sheet from '@dxos/plugin-sheet/Sheet';\nimport * as SpaceOperation from '@dxos/plugin-space/SpaceOperation';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\nimport { ProgressMeter } from '@dxos/react-ui-components';\nimport { type ActionGraphProps, ActionToolbar, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';\nimport * as Button from '@dxos/react-ui/Button';\nimport * as Field from '@dxos/react-ui/Field';\nimport * as UiHooks from '@dxos/react-ui/Hooks';\nimport * as Input from '@dxos/react-ui/Input';\nimport * as Layout from '@dxos/react-ui/Layout';\nimport * as Panel from '@dxos/react-ui/Panel';\nimport * as ScrollArea from '@dxos/react-ui/ScrollArea';\nimport * as Util from '@dxos/react-ui/Util';\nimport { Organization, Person, Task } from '@dxos/types';\nimport { mx } from '@dxos/ui-theme';\nimport { sortKeys } from '@dxos/util';\n\nimport { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';\nimport { meta } from '#meta';\n\n// TODO(burdon): Make extensible.\nconst staticTypes = [Markdown.Document, Drawing.Drawing, Sheet.Sheet, ComputeGraph];\nconst recordTypes = [Organization.Organization, Person.Person, Task.Task];\n\nconst TOAST_DURATION = 5_000;\n\nexport type SpaceGeneratorProps = {\n space: Space;\n onCreateObjects?: (objects: Obj.Unknown[]) => void;\n};\n\nexport const SpaceGenerator = Util.composable<HTMLDivElement, SpaceGeneratorProps>(\n ({ children, space, onCreateObjects, ...props }, forwardedRef) => {\n const invoker = Hooks.useOperationInvoker();\n const { invokePromise } = invoker;\n const { t } = UiHooks.useTranslation(meta.profile.key);\n const client = useClient();\n const [count, setCount] = useState(1);\n const [info, setInfo] = useState<any>({});\n const presets = useMemo(() => generator(), []);\n const manager = PluginManagerProvider.usePluginManager();\n const allTemplates = Hooks.useCapabilities(AppCapabilities.SpaceTemplate);\n\n useEffect(() => {\n EffectEx.runDetached(manager.activate(ActivationEvents.SpaceTemplatesRequested));\n }, [manager]);\n\n // Register types.\n UiHooks.useAsyncEffect(async () => {\n await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);\n }, [client, presets]);\n\n // Create type generators.\n const typeMap = useMemo(() => {\n const recordGenerators = new Map<string, ObjectGenerator<any>>(\n recordTypes.map((type) => [Type.getTypename(type), createGenerator(client, invoker, manager, type)]),\n );\n\n const allTemplateGenerators = new Map<string, ObjectGenerator<any>>(\n allTemplates.map((template) => [\n template.id,\n async (space) => {\n await template.apply({ client, space });\n return [];\n },\n ]),\n );\n\n return new Map([...staticGenerators, ...presets.items, ...recordGenerators, ...allTemplateGenerators]);\n }, [client, invoker, invokePromise, manager, presets, allTemplates]);\n\n // Query space to get info.\n const updateInfo = useCallback(async () => {\n const allSchema = [...space.db.graph.registry.list().filter(Type.isType)];\n const echoSchema = allSchema.filter((t) => Type.isTypeKind(t));\n const staticSchema = allSchema.filter((t) => !Type.isTypeKind(t));\n\n const objects = await space.db.query(Filter.everything()).run();\n const objectMap = sortKeys(\n objects.reduce<Record<string, number>>((map, obj) => {\n const type = Obj.getTypename(obj);\n if (type) {\n const count = map[type] ?? 0;\n map[type] = count + 1;\n }\n\n return map;\n }, {}),\n );\n\n setInfo({\n schema: {\n static: staticSchema.length,\n mutable: echoSchema.length,\n },\n objects: objectMap,\n });\n }, [space]);\n\n UiHooks.useAsyncEffect(updateInfo, [updateInfo]);\n\n // TODO(wittjosiah): Custom toast required — `notify` labels are fixed at invocation, so a\n // result-dependent count cannot be reported through it. Drop these once operation notify\n // supports dynamic labels.\n const handleReset = useCallback(async () => {\n if (!window.confirm(t('remove-all-objects.confirm.description'))) {\n return;\n }\n const { data } = await invokePromise(SpaceOperation.RemoveAllObjects, undefined, {\n spaceId: space.id,\n notify: { error: ['remove-all-objects.error.title', { ns: meta.profile.key }] },\n });\n if (data) {\n await invokePromise(LayoutOperation.AddToast, {\n id: `${meta.profile.key}/remove-all-objects`,\n icon: 'ph--trash--regular',\n duration: TOAST_DURATION,\n title: ['remove-all-objects.toast.title', { ns: meta.profile.key }],\n description: ['remove-all-objects.toast.description', { ns: meta.profile.key, count: data.objectIds.length }],\n });\n }\n await updateInfo();\n }, [space, invokePromise, updateInfo, t]);\n\n const handleCollectGarbage = useCallback(async () => {\n if (!window.confirm(t('collect-garbage.confirm.description'))) {\n return;\n }\n const { data } = await invokePromise(SpaceOperation.CollectGarbage, undefined, {\n spaceId: space.id,\n notify: { error: ['collect-garbage.error.title', { ns: meta.profile.key }] },\n });\n if (data) {\n await invokePromise(LayoutOperation.AddToast, {\n id: `${meta.profile.key}/collect-garbage`,\n icon: 'ph--recycle--regular',\n duration: TOAST_DURATION,\n title: ['collect-garbage.toast.title', { ns: meta.profile.key }],\n description:\n data.removedDocuments === 0\n ? ['collect-garbage.toast.empty.description', { ns: meta.profile.key }]\n : ['collect-garbage.toast.description', { ns: meta.profile.key, count: data.removedDocuments }],\n });\n }\n await updateInfo();\n }, [space, invokePromise, updateInfo, t]);\n\n const menuActions = useSpaceGeneratorMenu({ updateInfo, handleReset, handleCollectGarbage });\n\n const handleCreateData = useCallback(\n async (typename: string) => {\n const constructor = typeMap.get(typename);\n if (constructor) {\n // TODO(burdon): Input to specify number of objects.\n await constructor(space, count, onCreateObjects);\n await updateInfo();\n }\n },\n [space, typeMap, count, updateInfo, onCreateObjects],\n );\n\n return (\n // `alwaysActive`: the toolbar gates itself on the menu scope's attention, and this debug panel\n // is not an attendable surface, so without it every action renders disabled.\n\n <Panel.Root {...Util.composableProps(props)} ref={forwardedRef}>\n <Panel.Header>\n <ActionToolbar {...menuActions} alwaysActive classNames='dx-document'>\n <Field.Root>\n <Input.Root\n placeholder='Count'\n classNames='w-[4rem] text-right'\n min={1}\n max={100}\n size={8}\n value={count}\n onChange={(event) => setCount(parseInt(event.target.value))}\n type='number'\n />\n </Field.Root>\n </ActionToolbar>\n </Panel.Header>\n <Panel.Body asChild>\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-separator-subtle'>\n <SchemaTable\n classNames='py-1'\n types={staticTypes}\n objects={info.objects}\n label='Static Types'\n onClick={handleCreateData}\n />\n <SchemaTable\n classNames='py-1'\n types={recordTypes}\n objects={info.objects}\n label='Record Types'\n onClick={handleCreateData}\n />\n <SchemaTable\n classNames='py-1'\n types={presets.types}\n objects={info.objects}\n label='Presets'\n onClick={handleCreateData}\n />\n {allTemplates.length > 0 && (\n <SchemaTable\n classNames='py-1'\n types={allTemplates.map(({ id, label }) => ({ typename: id, presetLabel: label }))}\n objects={info.objects}\n label='Space Templates'\n onClick={handleCreateData}\n />\n )}\n <ProgressGenerator classNames='py-1' />\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Panel.Body>\n </Panel.Root>\n );\n },\n);\n\nSpaceGenerator.displayName = 'SpaceGenerator';\n\n/**\n * Toolbar actions for the space generator. The toolbar's own action items hold the pending state —\n * each awaits its invoke, disables only itself while in flight, and guards re-entry — so nothing\n * here tracks that. The trailing gap separator pushes any sibling rendered after `Menu.Items` to the\n * end of the toolbar.\n */\nconst useSpaceGeneratorMenu = ({\n updateInfo,\n handleReset,\n handleCollectGarbage,\n}: {\n updateInfo: () => Promise<void>;\n handleReset: () => Promise<void>;\n handleCollectGarbage: () => Promise<void>;\n}) =>\n useMenuBuilder(\n (): ActionGraphProps =>\n MenuBuilder.make()\n .action(\n 'refresh',\n { label: 'Refresh', icon: 'ph--arrow-clockwise--regular', testId: 'spaceGenerator.refresh' },\n () => void updateInfo(),\n )\n .action(\n 'reset',\n { label: 'Reset space', icon: 'ph--trash--regular', testId: 'spaceGenerator.reset' },\n handleReset,\n )\n .action(\n 'collect',\n { label: 'Collect garbage', icon: 'ph--recycle--regular', testId: 'spaceGenerator.collectGarbage' },\n handleCollectGarbage,\n )\n .separator('gap')\n .build(),\n [updateInfo, handleReset, handleCollectGarbage],\n );\n\n// Stable key for the test progress monitor within the shared registry.\nconst TEST_PROGRESS_NAME = `${meta.profile.key}.test-progress`;\n\ntype ProgressGeneratorProps = Util.ThemedClassName;\n\n// Drives a synthetic progress monitor (10s over 10 steps) so the R0 rail meter can be exercised —\n// and renders the meter here too, since the rail's only lives inside a popover the user must open,\n// which made a working monitor look like a broken one.\nconst ProgressGenerator = ({ classNames }: ProgressGeneratorProps) => {\n const registry = Hooks.useOptionalCapability(AppCapabilities.ProgressRegistry);\n const monitor = ToolkitHooks.useProgressMonitor(TEST_PROGRESS_NAME);\n const running = monitor?.status === 'running';\n const intervalRef = useRef<ReturnType<typeof setInterval> | undefined>(undefined);\n\n const clearTimer = useCallback(() => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = undefined;\n }\n }, []);\n\n const handleStart = useCallback(() => {\n // Guard on the timer ref too: `running` (derived from the registry) can lag a fast second click.\n if (!registry || running || intervalRef.current) {\n return;\n }\n\n const steps = 10;\n let current = 0;\n const handle = registry.register(TEST_PROGRESS_NAME, {\n label: 'Test Progress',\n total: steps,\n // Invoked by the meter's cancel control (R0 rail) or the local button.\n onCancel: () => {\n clearTimer();\n handle.remove();\n },\n });\n\n intervalRef.current = setInterval(() => {\n current += 1;\n handle.set(current);\n if (current >= steps) {\n clearTimer();\n handle.done();\n handle.remove();\n }\n }, 1_000);\n }, [registry, running, clearTimer]);\n\n // Tear down the timer and the registry entry if unmounted mid-run.\n useEffect(\n () => () => {\n clearTimer();\n registry?.cancel(TEST_PROGRESS_NAME);\n },\n [clearTimer, registry],\n );\n\n return (\n <div className={mx('flex flex-col gap-1 py-1', classNames)}>\n <Layout.Flex gap='sm' align='center'>\n <span className='grow'>Progress Monitor</span>\n {running ? (\n <Button.Root\n icon='ph--x--regular'\n label='Cancel test progress'\n onClick={() => registry?.cancel(TEST_PROGRESS_NAME)}\n />\n ) : (\n <Button.Root\n icon='ph--play--regular'\n label='Start test progress'\n disabled={!registry}\n onClick={handleStart}\n />\n )}\n </Layout.Flex>\n {monitor && (monitor.status === 'running' || monitor.status === 'error') && (\n <ProgressMeter state={monitor} onCancel={() => registry?.cancel(TEST_PROGRESS_NAME)} />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,cAAc;CAAC,SAAS;CAAU,QAAQ;CAAS,MAAM;CAAO;AAAY;AAClF,IAAM,cAAc;CAAC,aAAa;CAAc,OAAO;CAAQ,KAAK;AAAI;AAExE,IAAM,iBAAiB;AAOvB,IAAa,iBAAiB,KAAK,YAChC,EAAE,UAAU,OAAO,iBAAiB,GAAG,SAAS,iBAAiB;CAChE,MAAM,UAAU,MAAM,oBAAoB;CAC1C,MAAM,EAAE,kBAAkB;CAC1B,MAAM,EAAE,MAAM,QAAQ,eAAe,KAAK,QAAQ,GAAG;CACrD,MAAM,SAAS,UAAU;CACzB,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC;CACpC,MAAM,CAAC,MAAM,WAAW,SAAc,CAAC,CAAC;CACxC,MAAM,UAAU,cAAc,UAAU,GAAG,CAAC,CAAC;CAC7C,MAAM,UAAU,sBAAsB,iBAAiB;CACvD,MAAM,eAAe,MAAM,gBAAgB,gBAAgB,aAAa;CAExE,gBAAgB;EACd,SAAS,YAAY,QAAQ,SAAS,iBAAiB,uBAAuB,CAAC;CACjF,GAAG,CAAC,OAAO,CAAC;CAGZ,QAAQ,eAAe,YAAY;EACjC,MAAM,OAAO,SAAS;GAAC,GAAG;GAAa,GAAG;GAAa,GAAG,QAAQ;EAAO,CAAC;CAC5E,GAAG,CAAC,QAAQ,OAAO,CAAC;CAGpB,MAAM,UAAU,cAAc;EAC5B,MAAM,mBAAmB,IAAI,IAC3B,YAAY,KAAK,SAAS,CAAC,KAAK,YAAY,IAAI,GAAG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C,GACA,CAAC,YAAY,QAAQ,CACvB;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,4BAA4B,UAAU;EAAzD,UAAA,CACE,qBAAC,OAAO,MAAR;GAAa,KAAI;GAAK,OAAM;GAA5B,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAO,UAAA;GAAsB,CAAA,GAC5C,UACC,oBAAC,OAAO,MAAR;IACE,MAAK;IACL,OAAM;IACN,eAAe,UAAU,OAAO,kBAAkB;GACnD,CAAA,IAED,oBAAC,OAAO,MAAR;IACE,MAAK;IACL,OAAM;IACN,UAAU,CAAC;IACX,SAAS;GACV,CAAA,CAEQ;EACZ,CAAA,GAAA,YAAY,QAAQ,WAAW,aAAa,QAAQ,WAAW,YAC9D,oBAAC,eAAD;GAAe,OAAO;GAAS,gBAAgB,UAAU,OAAO,kBAAkB;EAAI,CAAA,CAErF;;AAET"}
@@ -1,56 +1,49 @@
1
1
  import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
2
- import { Fragment } from "react";
3
- import { ScrollArea } from "@dxos/react-ui";
2
+ import "react";
4
3
  import { jsx, jsxs } from "react/jsx-runtime";
5
- import { useOptionalCapability } from "@dxos/app-framework/ui";
4
+ import * as Atom from "effect/reactivity/Atom";
6
5
  import { useAtomValue } from "@effect/atom-react/Hooks";
7
- import * as Atom from "effect/unstable/reactivity/Atom";
6
+ import * as Hooks from "@dxos/app-framework/Hooks";
7
+ import { STAT_CARD_HUES, StatCard } from "@dxos/devtools";
8
+ import * as Layout from "@dxos/react-ui/Layout";
8
9
  //#region src/containers/StatsPanel/StatsPanel.tsx
9
10
  var EMPTY = Atom.make({});
10
11
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
11
- /** Renders a leaf value; numbers are monospace so columns of counts align. */
12
+ /** Renders a leaf value; numbers are localised so columns of counts read alike. */
12
13
  var formatValue = (value) => typeof value === "number" ? value.toLocaleString() : String(value);
13
14
  /**
14
15
  * Flattens a compartment into `key → value` rows, one level deep: nested objects (e.g. `coverage`)
15
- * become dotted keys (`coverage.plain`) so everything renders in a single flat table.
16
+ * become dotted keys (`coverage.plain`) so everything renders as flat rows.
16
17
  */
17
18
  var flatten = (stats) => {
18
19
  if (!isRecord(stats)) return [["value", stats]];
19
20
  return Object.entries(stats).flatMap(([key, value]) => isRecord(value) ? Object.entries(value).map(([subKey, subValue]) => [`${key}.${subKey}`, subValue]) : [[key, value]]);
20
21
  };
21
22
  /**
22
- * Presentational panel for the {@link AppCapabilities.StatsPanel} store: renders every plugin
23
- * compartment as a flat key × value table, live (re-renders on each write). Purely generic — it
24
- * displays whatever each plugin stores, so it works for sync telemetry or any other stats.
23
+ * The {@link AppCapabilities.StatsPanel} store as one card per plugin compartment, live (re-renders
24
+ * on each write). Purely generic — it displays whatever each plugin stores.
25
25
  */
26
- var StatsPanel = () => {
27
- const store = useOptionalCapability(AppCapabilities.StatsPanel);
26
+ var StatsPanel = ({ showEmpty = true }) => {
27
+ const store = Hooks.useOptionalCapability(AppCapabilities.StatsPanel);
28
28
  const stats = useAtomValue(store?.statsAtom ?? EMPTY);
29
29
  const compartments = Object.entries(stats);
30
- if (compartments.length === 0) return /* @__PURE__ */ jsx("div", {
31
- className: "p-2 text-sm text-description",
32
- children: "No stats yet."
33
- });
34
- return /* @__PURE__ */ jsx(ScrollArea.Root, {
35
- thin: true,
36
- centered: true,
37
- padding: true,
38
- children: /* @__PURE__ */ jsx(ScrollArea.Viewport, { children: compartments.map(([pluginKey, value]) => /* @__PURE__ */ jsxs("section", {
39
- className: "w-full",
40
- children: [/* @__PURE__ */ jsx("h3", {
41
- className: "text-start font-mono text-xs text-description pb-1",
42
- children: pluginKey
43
- }), /* @__PURE__ */ jsx("dl", {
44
- className: "grid grid-cols-[auto_minmax(0,1fr)] w-full",
45
- children: flatten(value).map(([key, cell]) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
46
- className: "border-be border-separator pb-1 pt-1 pe-2 text-description self-start",
47
- children: key
48
- }), /* @__PURE__ */ jsx("dd", {
49
- className: "border-be border-separator pb-1 pt-1 truncate font-mono text-end",
50
- children: formatValue(cell)
51
- })] }, key))
52
- })]
53
- }, pluginKey)) })
30
+ if (compartments.length === 0) return showEmpty ? /* @__PURE__ */ jsxs(StatCard.Root, { children: [/* @__PURE__ */ jsx(StatCard.Header, {
31
+ icon: "ph--chart-bar--regular",
32
+ hue: STAT_CARD_HUES.system,
33
+ title: "Plugin stats"
34
+ }), /* @__PURE__ */ jsx(StatCard.Row, { label: "No stats yet." })] }) : null;
35
+ return /* @__PURE__ */ jsx(Layout.Container, {
36
+ gap: "md",
37
+ gutter: "none",
38
+ children: compartments.map(([pluginKey, value]) => /* @__PURE__ */ jsxs(StatCard.Root, { children: [/* @__PURE__ */ jsx(StatCard.Header, {
39
+ icon: "ph--chart-bar--regular",
40
+ hue: STAT_CARD_HUES.system,
41
+ title: pluginKey
42
+ }), flatten(value).map(([key, cell]) => /* @__PURE__ */ jsx(StatCard.Row, {
43
+ label: key,
44
+ tooltip: key,
45
+ value: formatValue(cell)
46
+ }, key))] }, pluginKey))
54
47
  });
55
48
  };
56
49
  StatsPanel.displayName = "StatsPanel";
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-StatsPanel.mjs","names":[],"sources":["../../src/containers/StatsPanel/StatsPanel.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport * as Atom from 'effect/unstable/reactivity/Atom';\nimport React, { Fragment } from 'react';\n\nimport { useOptionalCapability } from '@dxos/app-framework/ui';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport { ScrollArea } from '@dxos/react-ui';\n\n// Fallback so the atom hook is called unconditionally when no store is contributed (host plugin not\n// loaded); the panel then renders its empty state.\nconst EMPTY = Atom.make<Record<string, unknown>>({});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** Renders a leaf value; numbers are monospace so columns of counts align. */\nconst formatValue = (value: unknown): string => (typeof value === 'number' ? value.toLocaleString() : String(value));\n\n/**\n * Flattens a compartment into `key → value` rows, one level deep: nested objects (e.g. `coverage`)\n * become dotted keys (`coverage.plain`) so everything renders in a single flat table.\n */\nconst flatten = (stats: unknown): [string, unknown][] => {\n if (!isRecord(stats)) {\n return [['value', stats]];\n }\n\n return Object.entries(stats).flatMap(([key, value]) =>\n isRecord(value)\n ? Object.entries(value).map(([subKey, subValue]): [string, unknown] => [`${key}.${subKey}`, subValue])\n : [[key, value] as [string, unknown]],\n );\n};\n\n/**\n * Presentational panel for the {@link AppCapabilities.StatsPanel} store: renders every plugin\n * compartment as a flat key × value table, live (re-renders on each write). Purely generic — it\n * displays whatever each plugin stores, so it works for sync telemetry or any other stats.\n */\nexport const StatsPanel = () => {\n const store = useOptionalCapability(AppCapabilities.StatsPanel);\n const stats = useAtomValue(store?.statsAtom ?? EMPTY);\n const compartments = Object.entries(stats);\n if (compartments.length === 0) {\n return <div className='p-2 text-sm text-description'>No stats yet.</div>;\n }\n\n return (\n <ScrollArea.Root thin centered padding>\n <ScrollArea.Viewport>\n {compartments.map(([pluginKey, value]) => (\n <section key={pluginKey} className='w-full'>\n <h3 className='text-start font-mono text-xs text-description pb-1'>{pluginKey}</h3>\n <dl className='grid grid-cols-[auto_minmax(0,1fr)] w-full'>\n {flatten(value).map(([key, cell]) => (\n <Fragment key={key}>\n <dt className='border-be border-separator pb-1 pt-1 pe-2 text-description self-start'>{key}</dt>\n <dd className='border-be border-separator pb-1 pt-1 truncate font-mono text-end'>\n {formatValue(cell)}\n </dd>\n </Fragment>\n ))}\n </dl>\n </section>\n ))}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n};\n\nStatsPanel.displayName = 'StatsPanel';\n"],"mappings":";;;;;;;;AAcA,IAAM,QAAQ,KAAK,KAA8B,CAAC,CAAC;AAEnD,IAAM,YAAY,UAChB,OAAO,UAAU,YA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SAYL,CACV,EACkB,CAAA;CACN,CAAA;AAErB;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"chunk-StatsPanel.mjs","names":[],"sources":["../../src/containers/StatsPanel/StatsPanel.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport * as Atom from 'effect/reactivity/Atom';\nimport React from 'react';\n\nimport * as Hooks from '@dxos/app-framework/Hooks';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport { STAT_CARD_HUES, StatCard } from '@dxos/devtools';\nimport * as Layout from '@dxos/react-ui/Layout';\n\n// Fallback so the atom hook is called unconditionally when no store is contributed (host plugin not\n// loaded); the panel then renders its empty state.\nconst EMPTY = Atom.make<Record<string, unknown>>({});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** Renders a leaf value; numbers are localised so columns of counts read alike. */\nconst formatValue = (value: unknown): string => (typeof value === 'number' ? value.toLocaleString() : String(value));\n\n/**\n * Flattens a compartment into `key → value` rows, one level deep: nested objects (e.g. `coverage`)\n * become dotted keys (`coverage.plain`) so everything renders as flat rows.\n */\nconst flatten = (stats: unknown): [string, unknown][] => {\n if (!isRecord(stats)) {\n return [['value', stats]];\n }\n\n return Object.entries(stats).flatMap(([key, value]) =>\n isRecord(value)\n ? Object.entries(value).map(([subKey, subValue]): [string, unknown] => [`${key}.${subKey}`, subValue])\n : [[key, value] as [string, unknown]],\n );\n};\n\nexport type StatsPanelProps = {\n /** Renders the empty state as a card too, so a stack shows the store exists. */\n showEmpty?: boolean;\n};\n\n/**\n * The {@link AppCapabilities.StatsPanel} store as one card per plugin compartment, live (re-renders\n * on each write). Purely generic — it displays whatever each plugin stores.\n */\nexport const StatsPanel = ({ showEmpty = true }: StatsPanelProps) => {\n const store = Hooks.useOptionalCapability(AppCapabilities.StatsPanel);\n const stats = useAtomValue(store?.statsAtom ?? EMPTY);\n const compartments = Object.entries(stats);\n if (compartments.length === 0) {\n return showEmpty ? (\n <StatCard.Root>\n <StatCard.Header icon='ph--chart-bar--regular' hue={STAT_CARD_HUES.system} title='Plugin stats' />\n <StatCard.Row label='No stats yet.' />\n </StatCard.Root>\n ) : null;\n }\n\n return (\n <Layout.Container gap='md' gutter='none'>\n {compartments.map(([pluginKey, value]) => (\n <StatCard.Root key={pluginKey}>\n <StatCard.Header icon='ph--chart-bar--regular' hue={STAT_CARD_HUES.system} title={pluginKey} />\n {flatten(value).map(([key, cell]) => (\n <StatCard.Row key={key} label={key} tooltip={key} value={formatValue(cell)} />\n ))}\n </StatCard.Root>\n ))}\n </Layout.Container>\n );\n};\n\nStatsPanel.displayName = 'StatsPanel';\n"],"mappings":";;;;;;;;;AAeA,IAAM,QAAQ,KAAK,KAA8B,CAAC,CAAC;AAEnD,IAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;AAGrE,IAAM,eAAe,UAA4B,OAAO,UAAU,WAAW,MAAM,eAAe,IAAI,OAAO,KAAK;;;;;AAMlH,IAAM,WAAW,UAAwC;CACvD,IAAI,CAAC,SAAS,KAAK,GACjB,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC;CAG1B,OAAO,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAC1C,SAAS,KAAK,IACV,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,QAAQ,cAAiC,CAAC,GAAG,IAAI,GAAG,UAAU,QAAQ,CAAC,IACnG,CAAC,CAAC,KAAK,KAAK,CAAsB,CACxC;AACF;;;;;AAWA,IAAa,cAAc,EAAE,YAAY,WAA4B;CACnE,MAAM,QAAQ,MAAM,sBAAsB,gBAAgB,UAAU;CACpE,MAAM,QAAQ,aAAa,OAAO,aAAa,KAAK;CACpD,MAAM,eAAe,OAAO,QAAQ,KAAK;CACzC,IAAI,aAAa,WAAW,GAC1B,OAAO,YACL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