@dxos/plugin-debug 0.9.1-staging.ee54ba693a → 0.11.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 (236) hide show
  1. package/PLUGIN.mdl +12 -325
  2. package/README.md +4 -14
  3. package/dist/lib/DebugPlugin.mjs +29 -0
  4. package/dist/lib/DebugPlugin.mjs.map +1 -0
  5. package/dist/lib/DebugPlugin.node.mjs +10 -0
  6. package/dist/lib/DebugPlugin.node.mjs.map +1 -0
  7. package/dist/lib/DebugPlugin.workerd.mjs +8 -0
  8. package/dist/lib/DebugPlugin.workerd.mjs.map +1 -0
  9. package/dist/lib/capabilities.mjs +11 -0
  10. package/dist/lib/capabilities.mjs.map +1 -0
  11. package/dist/lib/chunk-DebugObjectPanel.mjs +58 -0
  12. package/dist/lib/chunk-DebugObjectPanel.mjs.map +1 -0
  13. package/dist/lib/chunk-DebugSettings.mjs +237 -0
  14. package/dist/lib/chunk-DebugSettings.mjs.map +1 -0
  15. package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs +39 -0
  16. package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs.map +1 -0
  17. package/dist/lib/chunk-DebugStatus.mjs +117 -0
  18. package/dist/lib/chunk-DebugStatus.mjs.map +1 -0
  19. package/dist/lib/chunk-LogStatus.mjs +44 -0
  20. package/dist/lib/chunk-LogStatus.mjs.map +1 -0
  21. package/dist/lib/chunk-SpaceGenerator.mjs +208 -0
  22. package/dist/lib/chunk-SpaceGenerator.mjs.map +1 -0
  23. package/dist/lib/chunk-StatsPanel.mjs +58 -0
  24. package/dist/lib/chunk-StatsPanel.mjs.map +1 -0
  25. package/dist/lib/chunk-Wireframe.mjs +60 -0
  26. package/dist/lib/chunk-Wireframe.mjs.map +1 -0
  27. package/dist/lib/chunk-app-graph-builder.mjs +76 -0
  28. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  29. package/dist/lib/chunk-log-recording.mjs +17 -0
  30. package/dist/lib/chunk-log-recording.mjs.map +1 -0
  31. package/dist/lib/chunk-meta.mjs +36 -0
  32. package/dist/lib/chunk-meta.mjs.map +1 -0
  33. package/dist/lib/chunk-react-surface.mjs +193 -0
  34. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  35. package/dist/lib/chunk-settings.mjs +23 -0
  36. package/dist/lib/chunk-settings.mjs.map +1 -0
  37. package/dist/lib/chunk-stats-panel.mjs +56 -0
  38. package/dist/lib/chunk-stats-panel.mjs.map +1 -0
  39. package/dist/lib/chunk-types.mjs +60 -0
  40. package/dist/lib/chunk-types.mjs.map +1 -0
  41. package/dist/lib/components.mjs +763 -0
  42. package/dist/lib/components.mjs.map +1 -0
  43. package/dist/lib/containers.mjs +14 -0
  44. package/dist/lib/containers.mjs.map +1 -0
  45. package/dist/lib/index.mjs +3 -0
  46. package/dist/lib/meta.mjs +2 -0
  47. package/dist/lib/plugin.mjs +8 -0
  48. package/dist/lib/plugin.mjs.map +1 -0
  49. package/dist/lib/translations.mjs +38 -0
  50. package/dist/lib/translations.mjs.map +1 -0
  51. package/dist/lib/types.mjs +2 -0
  52. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  53. package/dist/types/src/capabilities/DebugSurfaces.d.ts +25 -0
  54. package/dist/types/src/capabilities/DebugSurfaces.d.ts.map +1 -0
  55. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  56. package/dist/types/src/capabilities/index.d.ts +4 -1
  57. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  58. package/dist/types/src/capabilities/log-recording.d.ts +10 -0
  59. package/dist/types/src/capabilities/log-recording.d.ts.map +1 -0
  60. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  61. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/settings.d.ts +1 -1
  63. package/dist/types/src/capabilities/stats-panel.d.ts +16 -0
  64. package/dist/types/src/capabilities/stats-panel.d.ts.map +1 -0
  65. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts +4 -3
  66. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
  67. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  68. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +4 -1
  69. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
  70. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +4 -1
  71. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -1
  72. package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts +30 -58
  73. package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts.map +1 -1
  74. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +4 -1
  75. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
  76. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts +4 -1
  77. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
  78. package/dist/types/src/containers/LogStatus/LogStatus.d.ts +6 -0
  79. package/dist/types/src/containers/LogStatus/LogStatus.d.ts.map +1 -0
  80. package/dist/types/src/containers/LogStatus/index.d.ts +2 -0
  81. package/dist/types/src/containers/LogStatus/index.d.ts.map +1 -0
  82. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  83. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  84. package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts +6 -0
  85. package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts.map +1 -0
  86. package/dist/types/src/containers/StatsPanel/index.d.ts +2 -0
  87. package/dist/types/src/containers/StatsPanel/index.d.ts.map +1 -0
  88. package/dist/types/src/containers/Wireframe/Wireframe.d.ts +4 -1
  89. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
  90. package/dist/types/src/containers/index.d.ts +4 -6
  91. package/dist/types/src/containers/index.d.ts.map +1 -1
  92. package/dist/types/src/translations.d.ts +26 -57
  93. package/dist/types/src/translations.d.ts.map +1 -1
  94. package/dist/types/src/types/DebugNodes.d.ts +7 -0
  95. package/dist/types/src/types/DebugNodes.d.ts.map +1 -0
  96. package/dist/types/src/types/DebugSurface.d.ts +8 -0
  97. package/dist/types/src/types/DebugSurface.d.ts.map +1 -0
  98. package/dist/types/src/types/debug.d.ts +3 -1
  99. package/dist/types/src/types/debug.d.ts.map +1 -1
  100. package/dist/types/src/types/index.d.ts +2 -2
  101. package/dist/types/src/types/index.d.ts.map +1 -1
  102. package/dist/types/tsconfig.tsbuildinfo +1 -1
  103. package/dx.config.ts +8 -13
  104. package/package.json +61 -63
  105. package/src/DebugPlugin.node.ts +1 -1
  106. package/src/DebugPlugin.tsx +10 -27
  107. package/src/DebugPlugin.workerd.ts +1 -1
  108. package/src/capabilities/DebugSurfaces.tsx +146 -0
  109. package/src/capabilities/app-graph-builder.ts +39 -373
  110. package/src/capabilities/index.ts +3 -2
  111. package/src/capabilities/log-recording.ts +20 -0
  112. package/src/capabilities/react-surface.ts +123 -0
  113. package/src/capabilities/stats-panel.ts +74 -0
  114. package/src/components/SchemaTable/SchemaTable.tsx +6 -5
  115. package/src/components/SpaceGenerator/ObjectGenerator.tsx +9 -3
  116. package/src/components/SpaceGenerator/presets.ts +2 -2
  117. package/src/components/index.ts +1 -1
  118. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +20 -20
  119. package/src/containers/DebugSettings/DebugSettings.tsx +4 -3
  120. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +4 -2
  121. package/src/containers/DebugStatus/DebugStatus.tsx +2 -0
  122. package/src/containers/LogStatus/LogStatus.tsx +51 -0
  123. package/src/containers/LogStatus/index.ts +5 -0
  124. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +108 -10
  125. package/src/containers/StatsPanel/StatsPanel.tsx +74 -0
  126. package/src/containers/StatsPanel/index.ts +5 -0
  127. package/src/containers/Wireframe/Wireframe.tsx +2 -0
  128. package/src/containers/index.ts +9 -7
  129. package/src/index.ts +1 -1
  130. package/src/meta.ts +1 -1
  131. package/src/plugin.ts +1 -1
  132. package/src/translations.ts +8 -52
  133. package/src/types/DebugNodes.ts +18 -0
  134. package/src/types/DebugSurface.ts +16 -0
  135. package/src/types/debug.ts +3 -1
  136. package/src/types/index.ts +3 -3
  137. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs +0 -15
  138. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +0 -7
  139. package/dist/lib/neutral/DebugObjectPanel-QSGQJ3LM.mjs +0 -61
  140. package/dist/lib/neutral/DebugObjectPanel-QSGQJ3LM.mjs.map +0 -7
  141. package/dist/lib/neutral/DebugPlugin.mjs +0 -59
  142. package/dist/lib/neutral/DebugPlugin.mjs.map +0 -7
  143. package/dist/lib/neutral/DebugPlugin.node.mjs +0 -18
  144. package/dist/lib/neutral/DebugPlugin.node.mjs.map +0 -7
  145. package/dist/lib/neutral/DebugPlugin.workerd.mjs +0 -12
  146. package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +0 -7
  147. package/dist/lib/neutral/DebugSettings-Q3WUL6YQ.mjs +0 -229
  148. package/dist/lib/neutral/DebugSettings-Q3WUL6YQ.mjs.map +0 -7
  149. package/dist/lib/neutral/DebugSpaceObjectsPanel-AXFZWEIM.mjs +0 -36
  150. package/dist/lib/neutral/DebugSpaceObjectsPanel-AXFZWEIM.mjs.map +0 -7
  151. package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs +0 -122
  152. package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs.map +0 -7
  153. package/dist/lib/neutral/DevtoolsOverviewContainer-DWQHTK7D.mjs +0 -24
  154. package/dist/lib/neutral/DevtoolsOverviewContainer-DWQHTK7D.mjs.map +0 -7
  155. package/dist/lib/neutral/GithubPanel-4CSJRVKE.mjs +0 -177
  156. package/dist/lib/neutral/GithubPanel-4CSJRVKE.mjs.map +0 -7
  157. package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs +0 -161
  158. package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs.map +0 -7
  159. package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs +0 -146
  160. package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs.map +0 -7
  161. package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs +0 -52
  162. package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +0 -7
  163. package/dist/lib/neutral/app-graph-builder-UKG4WVYK.mjs +0 -619
  164. package/dist/lib/neutral/app-graph-builder-UKG4WVYK.mjs.map +0 -7
  165. package/dist/lib/neutral/capabilities/index.mjs +0 -15
  166. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  167. package/dist/lib/neutral/chunk-72QXLYMI.mjs +0 -118
  168. package/dist/lib/neutral/chunk-72QXLYMI.mjs.map +0 -7
  169. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  170. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  171. package/dist/lib/neutral/chunk-R5C4CKOF.mjs +0 -54
  172. package/dist/lib/neutral/chunk-R5C4CKOF.mjs.map +0 -7
  173. package/dist/lib/neutral/components/index.mjs +0 -961
  174. package/dist/lib/neutral/components/index.mjs.map +0 -7
  175. package/dist/lib/neutral/containers/index.mjs +0 -27
  176. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  177. package/dist/lib/neutral/index.mjs +0 -20
  178. package/dist/lib/neutral/index.mjs.map +0 -7
  179. package/dist/lib/neutral/meta.json +0 -1
  180. package/dist/lib/neutral/meta.mjs +0 -8
  181. package/dist/lib/neutral/meta.mjs.map +0 -7
  182. package/dist/lib/neutral/plugin.mjs +0 -12
  183. package/dist/lib/neutral/plugin.mjs.map +0 -7
  184. package/dist/lib/neutral/react-context-UJURDOO6.mjs +0 -17
  185. package/dist/lib/neutral/react-context-UJURDOO6.mjs.map +0 -7
  186. package/dist/lib/neutral/react-surface-URESE7J4.mjs +0 -484
  187. package/dist/lib/neutral/react-surface-URESE7J4.mjs.map +0 -7
  188. package/dist/lib/neutral/settings-5I2674B6.mjs +0 -28
  189. package/dist/lib/neutral/settings-5I2674B6.mjs.map +0 -7
  190. package/dist/lib/neutral/translations.mjs +0 -91
  191. package/dist/lib/neutral/translations.mjs.map +0 -7
  192. package/dist/lib/neutral/types/index.mjs +0 -16
  193. package/dist/lib/neutral/types/index.mjs.map +0 -7
  194. package/dist/types/src/DebugPlugin.test.d.ts +0 -2
  195. package/dist/types/src/DebugPlugin.test.d.ts.map +0 -1
  196. package/dist/types/src/capabilities/react-context.d.ts +0 -5
  197. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  198. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +0 -8
  199. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +0 -1
  200. package/dist/types/src/containers/DebugGraph/index.d.ts +0 -2
  201. package/dist/types/src/containers/DebugGraph/index.d.ts.map +0 -1
  202. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts +0 -3
  203. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +0 -1
  204. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +0 -2
  205. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +0 -1
  206. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +0 -15
  207. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +0 -1
  208. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +0 -106
  209. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +0 -1
  210. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +0 -3
  211. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +0 -1
  212. package/dist/types/src/containers/GithubPanel/index.d.ts +0 -2
  213. package/dist/types/src/containers/GithubPanel/index.d.ts.map +0 -1
  214. package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts +0 -3
  215. package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts.map +0 -1
  216. package/dist/types/src/containers/RegistryPanel/index.d.ts +0 -2
  217. package/dist/types/src/containers/RegistryPanel/index.d.ts.map +0 -1
  218. package/dist/types/src/types/Devtools.d.ts +0 -57
  219. package/dist/types/src/types/Devtools.d.ts.map +0 -1
  220. package/dist/types/src/types/surface.d.ts +0 -4
  221. package/dist/types/src/types/surface.d.ts.map +0 -1
  222. package/src/DebugPlugin.test.ts +0 -29
  223. package/src/capabilities/react-context.tsx +0 -25
  224. package/src/capabilities/react-surface.tsx +0 -504
  225. package/src/containers/DebugGraph/DebugGraph.tsx +0 -14
  226. package/src/containers/DebugGraph/index.ts +0 -5
  227. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +0 -27
  228. package/src/containers/DevtoolsOverviewContainer/index.ts +0 -5
  229. package/src/containers/GithubPanel/GithubComponent.stories.tsx +0 -38
  230. package/src/containers/GithubPanel/GithubComponent.tsx +0 -192
  231. package/src/containers/GithubPanel/GithubPanel.tsx +0 -17
  232. package/src/containers/GithubPanel/index.ts +0 -5
  233. package/src/containers/RegistryPanel/RegistryPanel.tsx +0 -150
  234. package/src/containers/RegistryPanel/index.ts +0 -5
  235. package/src/types/Devtools.ts +0 -73
  236. package/src/types/surface.ts +0 -10
@@ -0,0 +1,193 @@
1
+ import { Capabilities, Capability } from "@dxos/app-framework";
2
+ import { Position } from "@dxos/util";
3
+ import { useCallback, useMemo } from "react";
4
+ import { meta } from "#meta";
5
+ import { AppAnnotation, AppCapabilities, GraphPath, LayoutOperation } from "@dxos/app-toolkit";
6
+ import { Panel } from "@dxos/react-ui";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Annotation, Collection, Entity, Filter, Obj, Type } from "@dxos/echo";
9
+ import { SpaceCapabilities, SpaceOperation } from "@dxos/plugin-space";
10
+ import * as Effect from "effect/Effect";
11
+ import { DebugCapabilities, DebugNodes, DebugSurface } from "#types";
12
+ import { Logger } from "@dxos/react-ui-debug";
13
+ import { Surface, useAtomCapability, useOperationInvoker, useSettingsState } from "@dxos/app-framework/ui";
14
+ import { AppSurface, useActiveSpace } from "@dxos/app-toolkit/ui";
15
+ import { SpaceState, isSpace } from "@dxos/react-client/echo";
16
+ import { DebugObjectPanel, DebugSettings, DebugSpaceObjectsPanel, DebugStatus, LogStatus, SpaceGenerator, StatsPanel, Wireframe } from "#containers";
17
+ import { useAtomValue } from "@effect-atom/atom-react";
18
+ import * as Option from "effect/Option";
19
+ import { HiddenAnnotation } from "@dxos/echo/Annotation";
20
+ import { useClient } from "@dxos/react-client";
21
+ //#region src/capabilities/DebugSurfaces.tsx
22
+ /** Returns `onOpen` and `canOpen` for the ObjectsTree "Open" action. */
23
+ var useObjectOpenAction = (invokePromise) => {
24
+ const client = useClient();
25
+ const showHidden = useAtomCapability(SpaceCapabilities.Settings)?.showHidden ?? false;
26
+ const allTypes = useAtomValue(useMemo(() => client.graph.registry.query(Filter.type(Type.Type)).atom, [client]));
27
+ const hiddenTypenames = useMemo(() => {
28
+ const result = /* @__PURE__ */ new Set();
29
+ for (const typeEntity of allTypes) {
30
+ const schema = Type.getSchema(typeEntity);
31
+ if (HiddenAnnotation.get(schema).pipe(Option.getOrElse(() => false))) result.add(Type.getTypename(typeEntity));
32
+ }
33
+ return result;
34
+ }, [allTypes]);
35
+ return {
36
+ onOpen: useCallback((object) => {
37
+ invokePromise(LayoutOperation.Open, { subject: [GraphPath.getObjectPathFromObject(object)] });
38
+ }, [invokePromise]),
39
+ canOpen: useCallback((entity) => {
40
+ if (showHidden) return true;
41
+ const typename = Entity.getTypename(entity);
42
+ return !hiddenTypenames.has(typename ?? "");
43
+ }, [showHidden, hiddenTypenames])
44
+ };
45
+ };
46
+ var DebugSettingsSurface = ({ subject, logStore, onUpload }) => {
47
+ const { settings, updateSettings } = useSettingsState(subject.atom);
48
+ return /* @__PURE__ */ jsx(DebugSettings, {
49
+ settings,
50
+ onSettingsChange: updateSettings,
51
+ logStore,
52
+ onUpload
53
+ });
54
+ };
55
+ /** Generated objects are added to the space's root collection, resolved at invocation time. */
56
+ var SpaceGeneratorSurface = ({ role, space }) => {
57
+ const { invokePromise } = useOperationInvoker();
58
+ return /* @__PURE__ */ jsx(SpaceGenerator, {
59
+ role,
60
+ space,
61
+ onCreateObjects: useCallback((objects) => {
62
+ const collection = space.state.get() === SpaceState.SPACE_READY && Annotation.get(space.properties, AppAnnotation.RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target;
63
+ if (!Obj.instanceOf(Collection.Collection, collection)) return;
64
+ objects.forEach((object) => {
65
+ invokePromise(SpaceOperation.AddObject, {
66
+ target: collection,
67
+ object
68
+ });
69
+ });
70
+ }, [space, invokePromise])
71
+ });
72
+ };
73
+ var ObjectDebugSurface = ({ role, companionTo }) => {
74
+ const { invokePromise } = useOperationInvoker();
75
+ const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
76
+ return /* @__PURE__ */ jsx(DebugObjectPanel, {
77
+ role,
78
+ companionTo,
79
+ onOpen,
80
+ canOpen
81
+ });
82
+ };
83
+ var SpaceObjectsSurface = () => {
84
+ const space = useActiveSpace();
85
+ const { invokePromise } = useOperationInvoker();
86
+ const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
87
+ if (!space) return null;
88
+ return /* @__PURE__ */ jsx(DebugSpaceObjectsPanel, {
89
+ space,
90
+ onOpen,
91
+ canOpen
92
+ });
93
+ };
94
+ var LoggerSurface = () => /* @__PURE__ */ jsx(Logger.Root, { children: /* @__PURE__ */ jsxs(Panel.Root, { children: [
95
+ /* @__PURE__ */ jsx(Panel.Toolbar, {
96
+ asChild: true,
97
+ children: /* @__PURE__ */ jsx(Logger.Toolbar, {})
98
+ }),
99
+ /* @__PURE__ */ jsx(Panel.Content, {
100
+ asChild: true,
101
+ children: /* @__PURE__ */ jsx(Logger.Content, { children: /* @__PURE__ */ jsx(Logger.List, {}) })
102
+ }),
103
+ /* @__PURE__ */ jsx(Panel.Statusbar, {
104
+ asChild: true,
105
+ children: /* @__PURE__ */ jsx(Logger.Filter, {})
106
+ })
107
+ ] }) });
108
+ //#endregion
109
+ //#region src/capabilities/react-surface.ts
110
+ var isSpaceDebug = (data) => typeof data === "object" && data !== null && "type" in data && data.type === DebugNodes.SpaceType && "space" in data && isSpace(data.space);
111
+ var react_surface_default = Capability.makeModule(Effect.fnUntraced(function* ({ logStore }) {
112
+ const capabilities = yield* Capability.Service;
113
+ const registry = capabilities.get(Capabilities.AtomRegistry);
114
+ const settingsAtom = capabilities.get(DebugCapabilities.Settings);
115
+ const fileUploader = capabilities.getAll(AppCapabilities.FileUploader)[0];
116
+ return Capability.contributes(Capabilities.ReactSurface, [
117
+ Surface.create({
118
+ id: "pluginSettings",
119
+ filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
120
+ component: DebugSettingsSurface,
121
+ props: ({ data: { subject } }) => ({
122
+ subject,
123
+ logStore,
124
+ onUpload: fileUploader
125
+ })
126
+ }),
127
+ Surface.create({
128
+ id: "space",
129
+ filter: AppSurface.subject(AppSurface.Article, isSpaceDebug),
130
+ component: SpaceGeneratorSurface,
131
+ props: ({ role, data: { subject } }) => ({
132
+ role,
133
+ space: subject.space
134
+ })
135
+ }),
136
+ Surface.create({
137
+ id: "wireframe",
138
+ filter: AppSurface.oneOf(AppSurface.subject(AppSurface.Article, (value) => {
139
+ const settings = registry.get(settingsAtom);
140
+ return Obj.isObject(value) && !!settings.wireframe;
141
+ }), AppSurface.subject(AppSurface.Section, (value) => {
142
+ const settings = registry.get(settingsAtom);
143
+ return Obj.isObject(value) && !!settings.wireframe;
144
+ })),
145
+ position: Position.first,
146
+ component: Wireframe,
147
+ props: ({ role, name, data: { subject } }) => ({
148
+ label: `${role}:${name}`,
149
+ object: subject,
150
+ classNames: "row-span-2 overflow-hidden"
151
+ })
152
+ }),
153
+ Surface.create({
154
+ id: "objectDebug",
155
+ filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "debug"), AppSurface.companion(AppSurface.Article)),
156
+ component: ObjectDebugSurface,
157
+ props: ({ role, data: { companionTo } }) => ({
158
+ role,
159
+ companionTo
160
+ })
161
+ }),
162
+ Surface.create({
163
+ id: "spaceObjects",
164
+ filter: Surface.makeFilter(AppSurface.deckCompanion("spaceObjects")),
165
+ component: SpaceObjectsSurface
166
+ }),
167
+ Surface.create({
168
+ id: "debugStatus",
169
+ filter: Surface.makeFilter(AppSurface.StatusIndicator),
170
+ position: Position.first,
171
+ component: DebugStatus
172
+ }),
173
+ Surface.create({
174
+ id: "logs",
175
+ filter: Surface.makeFilter(AppSurface.deckCompanion("logs")),
176
+ component: LoggerSurface
177
+ }),
178
+ Surface.create({
179
+ id: "logStatus",
180
+ filter: Surface.makeFilter(AppSurface.StatusIndicator),
181
+ component: LogStatus
182
+ }),
183
+ Surface.create({
184
+ id: "statsPanel",
185
+ filter: Surface.makeFilter(DebugSurface.Stats),
186
+ component: StatsPanel
187
+ })
188
+ ]);
189
+ }));
190
+ //#endregion
191
+ export { react_surface_default as default };
192
+
193
+ //# sourceMappingURL=chunk-react-surface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/capabilities/DebugSurfaces.tsx","../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// Surface components that cannot be expressed as a `props` mapper, because they call hooks or compose.\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useAtomCapability, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';\nimport { AppAnnotation, type AppCapabilities, GraphPath, LayoutOperation } from '@dxos/app-toolkit';\nimport { useActiveSpace } from '@dxos/app-toolkit/ui';\nimport { Annotation, Collection, Entity, Filter, Obj, Type } from '@dxos/echo';\nimport { HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\nimport { SpaceCapabilities, SpaceOperation } from '@dxos/plugin-space';\nimport { useClient } from '@dxos/react-client';\nimport { type Space, SpaceState } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\nimport { Logger } from '@dxos/react-ui-debug';\n\nimport { DebugObjectPanel, DebugSettings, DebugSpaceObjectsPanel, SpaceGenerator } from '#containers';\nimport { type Settings } from '#types';\n\n/** Returns `onOpen` and `canOpen` for the ObjectsTree \"Open\" action. */\nconst useObjectOpenAction = (invokePromise: ReturnType<typeof useOperationInvoker>['invokePromise']) => {\n const client = useClient();\n const spaceSettings = useAtomCapability(SpaceCapabilities.Settings);\n const showHidden = spaceSettings?.showHidden ?? false;\n\n const allTypes = useAtomValue(useMemo(() => client.graph.registry.query(Filter.type(Type.Type)).atom, [client]));\n\n const hiddenTypenames = useMemo(() => {\n const result = new Set<string>();\n for (const typeEntity of allTypes) {\n const schema = Type.getSchema(typeEntity);\n if (HiddenAnnotation.get(schema).pipe(Option.getOrElse(() => false))) {\n result.add(Type.getTypename(typeEntity));\n }\n }\n return result;\n }, [allTypes]);\n\n const onOpen = useCallback(\n (object: Obj.Unknown) => {\n void invokePromise(LayoutOperation.Open, { subject: [GraphPath.getObjectPathFromObject(object)] });\n },\n [invokePromise],\n );\n\n const canOpen = useCallback(\n (entity: Entity.Snapshot) => {\n if (showHidden) {\n return true;\n }\n const typename = Entity.getTypename(entity);\n return !hiddenTypenames.has(typename ?? '');\n },\n [showHidden, hiddenTypenames],\n );\n\n return { onOpen, canOpen };\n};\n\nexport type DebugSettingsSurfaceProps = {\n subject: AppCapabilities.Settings;\n logStore?: IdbLogStore;\n onUpload?: AppCapabilities.FileUploader;\n};\n\nexport const DebugSettingsSurface = ({ subject, logStore, onUpload }: DebugSettingsSurfaceProps) => {\n const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);\n\n return (\n <DebugSettings settings={settings} onSettingsChange={updateSettings} logStore={logStore} onUpload={onUpload} />\n );\n};\n\nexport type SpaceGeneratorSurfaceProps = {\n role: string;\n space: Space;\n};\n\n/** Generated objects are added to the space's root collection, resolved at invocation time. */\nexport const SpaceGeneratorSurface = ({ role, space }: SpaceGeneratorSurfaceProps) => {\n const { invokePromise } = useOperationInvoker();\n const handleCreateObjects = useCallback(\n (objects: Obj.Unknown[]) => {\n const collection =\n space.state.get() === SpaceState.SPACE_READY &&\n Annotation.get(space.properties, AppAnnotation.RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target;\n if (!Obj.instanceOf(Collection.Collection, collection)) {\n return;\n }\n\n objects.forEach((object) => {\n void invokePromise(SpaceOperation.AddObject, { target: collection, object });\n });\n },\n [space, invokePromise],\n );\n\n return <SpaceGenerator role={role} space={space} onCreateObjects={handleCreateObjects} />;\n};\n\nexport type ObjectDebugSurfaceProps = {\n role: string;\n companionTo: Obj.Unknown;\n};\n\nexport const ObjectDebugSurface = ({ role, companionTo }: ObjectDebugSurfaceProps) => {\n const { invokePromise } = useOperationInvoker();\n const { onOpen, canOpen } = useObjectOpenAction(invokePromise);\n\n return <DebugObjectPanel role={role} companionTo={companionTo} onOpen={onOpen} canOpen={canOpen} />;\n};\n\nexport const SpaceObjectsSurface = () => {\n const space = useActiveSpace();\n const { invokePromise } = useOperationInvoker();\n const { onOpen, canOpen } = useObjectOpenAction(invokePromise);\n if (!space) {\n return null;\n }\n\n return <DebugSpaceObjectsPanel space={space} onOpen={onOpen} canOpen={canOpen} />;\n};\n\nexport const LoggerSurface = () => (\n <Logger.Root>\n <Panel.Root>\n <Panel.Toolbar asChild>\n <Logger.Toolbar />\n </Panel.Toolbar>\n <Panel.Content asChild>\n <Logger.Content>\n <Logger.List />\n </Logger.Content>\n </Panel.Content>\n <Panel.Statusbar asChild>\n <Logger.Filter />\n </Panel.Statusbar>\n </Panel.Root>\n </Logger.Root>\n);\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\nimport { type Space, isSpace } from '@dxos/react-client/echo';\nimport { Position } from '@dxos/util';\n\nimport { DebugStatus, LogStatus, StatsPanel, Wireframe } from '#containers';\nimport { meta } from '#meta';\nimport { DebugCapabilities, DebugNodes, DebugSurface } from '#types';\n\nimport {\n DebugSettingsSurface,\n LoggerSurface,\n ObjectDebugSurface,\n SpaceGeneratorSurface,\n SpaceObjectsSurface,\n} from './DebugSurfaces';\n\ntype SpaceDebug = {\n type: string;\n space: Space;\n};\n\nconst isSpaceDebug = (data: unknown): data is SpaceDebug =>\n typeof data === 'object' &&\n data !== null &&\n 'type' in data &&\n data.type === DebugNodes.SpaceType &&\n 'space' in data &&\n isSpace(data.space);\n\ntype ReactSurfaceOptions = {\n logStore?: IdbLogStore;\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* ({ logStore }: ReactSurfaceOptions) {\n const capabilities = yield* Capability.Service;\n const registry = capabilities.get(Capabilities.AtomRegistry);\n const settingsAtom = capabilities.get(DebugCapabilities.Settings);\n const fileUploader = capabilities.getAll(AppCapabilities.FileUploader)[0];\n\n return Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'pluginSettings',\n filter: AppSurface.settings(AppSurface.Article, meta.profile.key),\n component: DebugSettingsSurface,\n props: ({ data: { subject } }) => ({ subject, logStore, onUpload: fileUploader }),\n }),\n Surface.create({\n id: 'space',\n filter: AppSurface.subject(AppSurface.Article, isSpaceDebug),\n component: SpaceGeneratorSurface,\n props: ({ role, data: { subject } }) => ({ role, space: subject.space }),\n }),\n Surface.create({\n id: 'wireframe',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n filter: AppSurface.oneOf(\n AppSurface.subject(AppSurface.Article, (value): value is Obj.Unknown => {\n const settings = registry.get(settingsAtom);\n return Obj.isObject(value) && !!settings.wireframe;\n }),\n AppSurface.subject(AppSurface.Section, (value): value is Obj.Unknown => {\n const settings = registry.get(settingsAtom);\n return Obj.isObject(value) && !!settings.wireframe;\n }),\n ),\n position: Position.first,\n component: Wireframe,\n props: ({ role, name, data: { subject } }) => ({\n label: `${role}:${name}`,\n object: subject,\n classNames: 'row-span-2 overflow-hidden',\n }),\n }),\n Surface.create({\n id: 'objectDebug',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'debug'),\n AppSurface.companion(AppSurface.Article),\n ),\n component: ObjectDebugSurface,\n props: ({ role, data: { companionTo } }) => ({ role, companionTo }),\n }),\n Surface.create({\n id: 'spaceObjects',\n filter: Surface.makeFilter(AppSurface.deckCompanion('spaceObjects')),\n component: SpaceObjectsSurface,\n }),\n Surface.create({\n id: 'debugStatus',\n filter: Surface.makeFilter(AppSurface.StatusIndicator),\n position: Position.first,\n component: DebugStatus,\n }),\n Surface.create({\n id: 'logs',\n filter: Surface.makeFilter(AppSurface.deckCompanion('logs')),\n component: LoggerSurface,\n }),\n Surface.create({\n id: 'logStatus',\n filter: Surface.makeFilter(AppSurface.StatusIndicator),\n component: LogStatus,\n }),\n Surface.create({\n id: 'statsPanel',\n filter: Surface.makeFilter(DebugSurface.Stats),\n component: StatsPanel,\n }),\n ]);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,uBAAuB,kBAA2E;CACtG,MAAM,SAAS,UAAU;CAEzB,MAAM,aADgB,kBAAkB,kBAAkB,QACvC,CAAA,EAAe,cAAc;CAEhD,MAAM,WAAW,aAAa,cAAc,OAAO,MAAM,SAAS,MAAM,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAE/G,MAAM,kBAAkB,cAAc;EACpC,MAAM,yBAAS,IAAI,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,SAAS;GACnB,WAAW;EACb,CAAC;EACD,QAAQ,OAAO;GACb,IAAI;GACJ,QAAQ,QAAQ,WAAW,WAAW,cAAc,MAAM,CAAC;GAC3D,WAAW;EACb,CAAC;EACD,QAAQ,OAAO;GACb,IAAI;GACJ,QAAQ,QAAQ,WAAW,WAAW,eAAe;GACrD,WAAW;EACb,CAAC;EACD,QAAQ,OAAO;GACb,IAAI;GACJ,QAAQ,QAAQ,WAAW,aAAa,KAAK;GAC7C,WAAW;EACb,CAAC;CACH,CAAC;AACH,CAAC,CACH"}
@@ -0,0 +1,23 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ import { meta } from "#meta";
3
+ import { AppCapabilities } from "@dxos/app-toolkit";
4
+ import * as Effect from "effect/Effect";
5
+ import { DebugCapabilities, Settings } from "#types";
6
+ import { createKvsStore } from "@dxos/effect";
7
+ //#region src/capabilities/settings.ts
8
+ var settings_default = Capability.makeModule(() => Effect.sync(() => {
9
+ const settingsAtom = createKvsStore({
10
+ key: meta.profile.key,
11
+ schema: Settings.Settings,
12
+ defaultValue: () => ({})
13
+ });
14
+ return [Capability.contributes(DebugCapabilities.Settings, settingsAtom), Capability.contributes(AppCapabilities.Settings, {
15
+ prefix: meta.profile.key,
16
+ schema: Settings.Settings,
17
+ atom: settingsAtom
18
+ })];
19
+ }));
20
+ //#endregion
21
+ export { settings_default as default };
22
+
23
+ //# sourceMappingURL=chunk-settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-settings.mjs","names":[],"sources":["../../src/capabilities/settings.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { DebugCapabilities, Settings } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n const settingsAtom = createKvsStore({\n key: meta.profile.key,\n schema: Settings.Settings,\n defaultValue: () => ({}),\n });\n\n return [\n Capability.contributes(DebugCapabilities.Settings, settingsAtom),\n Capability.contributes(AppCapabilities.Settings, {\n prefix: meta.profile.key,\n schema: Settings.Settings,\n atom: settingsAtom,\n }),\n ];\n }),\n);\n"],"mappings":";;;;;;;AAaA,IAAA,mBAAe,WAAW,iBACxB,OAAO,WAAW;CAChB,MAAM,eAAe,eAAe;EAClC,KAAK,KAAK,QAAQ;EAClB,QAAQ,SAAS;EACjB,qBAAqB,CAAC;CACxB,CAAC;CAED,OAAO,CACL,WAAW,YAAY,kBAAkB,UAAU,YAAY,GAC/D,WAAW,YAAY,gBAAgB,UAAU;EAC/C,QAAQ,KAAK,QAAQ;EACrB,QAAQ,SAAS;EACjB,MAAM;CACR,CAAC,CACH;AACF,CAAC,CACH"}
@@ -0,0 +1,56 @@
1
+ import { Capabilities, Capability } from "@dxos/app-framework";
2
+ import { meta } from "#meta";
3
+ import { AppCapabilities } from "@dxos/app-toolkit";
4
+ import * as Effect from "effect/Effect";
5
+ import { Atom } from "@effect-atom/atom";
6
+ //#region src/capabilities/stats-panel.ts
7
+ var STORAGE_KEY = `${meta.profile.key}.statsPanel`;
8
+ /**
9
+ * Contributes the {@link AppCapabilities.StatsPanel} store: a single reactive atom holding one
10
+ * compartment per plugin, keyed by plugin key. Read access spans the whole store; writes are scoped
11
+ * to a compartment via `compartment(pluginKey)`. Kept alive with `Atom.keepAlive` so a background
12
+ * writer (e.g. a sync operation) can populate it before any surface subscribes. When `persist` is set
13
+ * the store hydrates from and saves to localStorage so stats survive a reload.
14
+ */
15
+ var stats_panel_default = Capability.makeModule(Effect.fnUntraced(function* ({ persist = true } = {}) {
16
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
17
+ const canPersist = persist && typeof localStorage !== "undefined";
18
+ const hydrate = () => {
19
+ if (!canPersist) return {};
20
+ try {
21
+ const raw = localStorage.getItem(STORAGE_KEY);
22
+ return raw ? JSON.parse(raw) : {};
23
+ } catch {
24
+ return {};
25
+ }
26
+ };
27
+ const statsAtom = Atom.make(hydrate()).pipe(Atom.keepAlive);
28
+ const save = () => {
29
+ if (!canPersist) return;
30
+ try {
31
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(registry.get(statsAtom)));
32
+ } catch {}
33
+ };
34
+ return Capability.contributes(AppCapabilities.StatsPanel, {
35
+ statsAtom,
36
+ get: (pluginKey) => registry.get(statsAtom)[pluginKey],
37
+ compartment: (pluginKey) => ({
38
+ set: (stats) => {
39
+ registry.set(statsAtom, {
40
+ ...registry.get(statsAtom),
41
+ [pluginKey]: stats
42
+ });
43
+ save();
44
+ },
45
+ clear: () => {
46
+ const { [pluginKey]: _removed, ...rest } = registry.get(statsAtom);
47
+ registry.set(statsAtom, rest);
48
+ save();
49
+ }
50
+ })
51
+ });
52
+ }));
53
+ //#endregion
54
+ export { stats_panel_default as default };
55
+
56
+ //# sourceMappingURL=chunk-stats-panel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-stats-panel.mjs","names":[],"sources":["../../src/capabilities/stats-panel.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\n\ntype StatsPanelOptions = {\n /** Persist the store to localStorage (hydrate on load, save on write). */\n persist?: boolean;\n};\n\nconst STORAGE_KEY = `${meta.profile.key}.statsPanel`;\n\n/**\n * Contributes the {@link AppCapabilities.StatsPanel} store: a single reactive atom holding one\n * compartment per plugin, keyed by plugin key. Read access spans the whole store; writes are scoped\n * to a compartment via `compartment(pluginKey)`. Kept alive with `Atom.keepAlive` so a background\n * writer (e.g. a sync operation) can populate it before any surface subscribes. When `persist` is set\n * the store hydrates from and saves to localStorage so stats survive a reload.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* ({ persist = true }: StatsPanelOptions = {}) {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const canPersist = persist && typeof localStorage !== 'undefined';\n\n const hydrate = (): Record<string, unknown> => {\n if (!canPersist) {\n return {};\n }\n try {\n const raw = localStorage.getItem(STORAGE_KEY);\n return raw ? JSON.parse(raw) : {};\n } catch {\n // Best-effort: a malformed/unavailable value just starts empty.\n return {};\n }\n };\n\n const statsAtom = Atom.make<Record<string, unknown>>(hydrate()).pipe(Atom.keepAlive);\n\n const save = () => {\n if (!canPersist) {\n return;\n }\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(registry.get(statsAtom)));\n } catch {\n // Best-effort: localStorage may be disabled or over quota; the in-memory atom is authoritative.\n }\n };\n\n return Capability.contributes(AppCapabilities.StatsPanel, {\n statsAtom,\n get: (pluginKey) => registry.get(statsAtom)[pluginKey],\n compartment: (pluginKey) => ({\n set: (stats) => {\n registry.set(statsAtom, { ...registry.get(statsAtom), [pluginKey]: stats });\n save();\n },\n clear: () => {\n const { [pluginKey]: _removed, ...rest } = registry.get(statsAtom);\n registry.set(statsAtom, rest);\n save();\n },\n }),\n });\n }),\n);\n"],"mappings":";;;;;;AAiBA,IAAM,cAAc,GAAG,KAAK,QAAQ,IAAI;;;;;;;;AASxC,IAAA,sBAAe,WAAW,WACxB,OAAO,WAAW,WAAW,EAAE,UAAU,SAA4B,CAAC,GAAG;CACvE,MAAM,WAAW,OAAO,WAAW,IAAI,aAAa,YAAY;CAChE,MAAM,aAAa,WAAW,OAAO,iBAAiB;CAEtD,MAAM,gBAAyC;EAC7C,IAAI,CAAC,YACH,OAAO,CAAC;EAEV,IAAI;GACF,MAAM,MAAM,aAAa,QAAQ,WAAW;GAC5C,OAAO,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;EAClC,QAAQ;GAEN,OAAO,CAAC;EACV;CACF;CAEA,MAAM,YAAY,KAAK,KAA8B,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS;CAEnF,MAAM,aAAa;EACjB,IAAI,CAAC,YACH;EAEF,IAAI;GACF,aAAa,QAAQ,aAAa,KAAK,UAAU,SAAS,IAAI,SAAS,CAAC,CAAC;EAC3E,QAAQ,CAER;CACF;CAEA,OAAO,WAAW,YAAY,gBAAgB,YAAY;EACxD;EACA,MAAM,cAAc,SAAS,IAAI,SAAS,CAAC,CAAC;EAC5C,cAAc,eAAe;GAC3B,MAAM,UAAU;IACd,SAAS,IAAI,WAAW;KAAE,GAAG,SAAS,IAAI,SAAS;MAAI,YAAY;IAAM,CAAC;IAC1E,KAAK;GACP;GACA,aAAa;IACX,MAAM,GAAG,YAAY,UAAU,GAAG,SAAS,SAAS,IAAI,SAAS;IACjE,SAAS,IAAI,WAAW,IAAI;IAC5B,KAAK;GACP;EACF;CACF,CAAC;AACH,CAAC,CACH"}
@@ -0,0 +1,60 @@
1
+ import { Capability, Role } from "@dxos/app-framework";
2
+ import { createContext } from "react";
3
+ import { meta } from "#meta";
4
+ import * as Schema from "effect/Schema";
5
+ //#region \0rolldown/runtime.js
6
+ var __defProp = Object.defineProperty;
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
14
+ return target;
15
+ };
16
+ //#endregion
17
+ //#region src/types/debug.ts
18
+ var DebugContext = createContext({
19
+ running: false,
20
+ start: () => {},
21
+ stop: () => {}
22
+ });
23
+ var DebugCapabilities;
24
+ (function(_DebugCapabilities) {
25
+ _DebugCapabilities.Settings = Capability.make(`${meta.profile.key}.capability.settings`);
26
+ })(DebugCapabilities || (DebugCapabilities = {}));
27
+ //#endregion
28
+ //#region src/types/DebugNodes.ts
29
+ var DebugNodes_exports = /* @__PURE__ */ __exportAll({
30
+ SpaceType: () => SpaceType,
31
+ id: () => id,
32
+ nodeId: () => nodeId
33
+ });
34
+ /** Extracts the last dot-separated segment of a namespaced ID string for use as a node segment id. */
35
+ var nodeId = (fullId) => fullId.split(".").at(-1) ?? "";
36
+ var debugId = meta.profile.key;
37
+ /** Top-level Debug node (sibling of DevTools under the SYSTEM navtree group). */
38
+ var id = `${debugId}.debug`;
39
+ /** Discriminator for the space-generator article surface (`node.data.type`). */
40
+ var SpaceType = `${debugId}.space`;
41
+ //#endregion
42
+ //#region src/types/DebugSurface.ts
43
+ var DebugSurface_exports = /* @__PURE__ */ __exportAll({ Stats: () => Stats });
44
+ /**
45
+ * Role token for the transient-stats panel — renders the {@link AppCapabilities.StatsPanel} store
46
+ * (arbitrary reactive telemetry keyed by owner id). A layout targets this role (role-only dispatch);
47
+ * the surface reads the store directly, so it needs no subject.
48
+ */
49
+ var Stats = Role.make(`${meta.profile.key}.surface.stats`);
50
+ //#endregion
51
+ //#region src/types/Settings.ts
52
+ var Settings_exports = /* @__PURE__ */ __exportAll({ Settings: () => Settings });
53
+ var Settings = Schema.mutable(Schema.Struct({
54
+ wireframe: Schema.optional(Schema.Boolean),
55
+ traceAll: Schema.optional(Schema.Boolean)
56
+ }));
57
+ //#endregion
58
+ export { DebugContext as a, DebugCapabilities as i, DebugSurface_exports as n, DebugNodes_exports as r, Settings_exports as t };
59
+
60
+ //# sourceMappingURL=chunk-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-types.mjs","names":[],"sources":["../../src/types/debug.ts","../../src/types/DebugNodes.ts","../../src/types/DebugSurface.ts","../../src/types/Settings.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom';\nimport { type Context, createContext } from 'react';\n\nimport { Capability } from '@dxos/app-framework';\nimport type { TimerCallback, TimerOptions } from '@dxos/async';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\n\nimport { meta } from '#meta';\n\nimport * as Settings from './Settings';\n\nexport type DebugPluginOptions = {\n /** Shared persistent log store for capturing and downloading logs. */\n logStore?: IdbLogStore;\n /** Persist the stats-panel store to localStorage so it survives a reload. Defaults to `true`. */\n persistStats?: boolean;\n};\n\nexport type DebugContextType = {\n running: boolean;\n start: (cb: TimerCallback, options: TimerOptions) => void;\n stop: () => void;\n};\n\nexport const DebugContext: Context<DebugContextType> = createContext<DebugContextType>({\n running: false,\n start: () => {},\n stop: () => {},\n});\n\nexport namespace DebugCapabilities {\n export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.profile.key}.capability.settings`);\n}\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { meta } from '#meta';\n\n/** Extracts the last dot-separated segment of a namespaced ID string for use as a node segment id. */\nexport const nodeId = (fullId: string): string => fullId.split('.').at(-1) ?? '';\n\nconst debugId = meta.profile.key;\n\n/** Top-level Debug node (sibling of DevTools under the SYSTEM navtree group). */\nexport const id = `${debugId}.debug`;\n\n/** Discriminator for the space-generator article surface (`node.data.type`). */\nexport const SpaceType = `${debugId}.space`;\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { Role } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\n/**\n * Role token for the transient-stats panel — renders the {@link AppCapabilities.StatsPanel} store\n * (arbitrary reactive telemetry keyed by owner id). A layout targets this role (role-only dispatch);\n * the surface reads the store directly, so it needs no subject.\n */\nexport const Stats = Role.make<Record<string, unknown>>(`${meta.profile.key}.surface.stats`);\n","//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nexport const Settings = Schema.mutable(\n Schema.Struct({\n wireframe: Schema.optional(Schema.Boolean),\n traceAll: Schema.optional(Schema.Boolean),\n }),\n);\n\nexport interface Settings extends Schema.Schema.Type<typeof Settings> {}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAa,eAA0C,cAAgC;CACrF,SAAS;CACT,aAAa,CAAC;CACd,YAAY,CAAC;AACf,CAAC;AAEM,IAAA;;CACQ,mBAAA,WAAW,WAAW,KAAuC,GAAG,KAAK,QAAQ,IAAI,qBAAqB;GACrH,sBAAA,oBAAA,CAAA,EAAA;;;;;;;;;AC3BA,IAAa,UAAU,WAA2B,OAAO,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAE9E,IAAM,UAAU,KAAK,QAAQ;;AAG7B,IAAa,KAAK,GAAG,QAAQ;;AAG7B,IAAa,YAAY,GAAG,QAAQ;;;;;;;;;ACFpC,IAAa,QAAQ,KAAK,KAA8B,GAAG,KAAK,QAAQ,IAAI,eAAe;;;;ACP3F,IAAa,WAAW,OAAO,QAC7B,OAAO,OAAO;CACZ,WAAW,OAAO,SAAS,OAAO,OAAO;CACzC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CACH"}