@dxos/plugin-debug 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b

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 (126) hide show
  1. package/dist/lib/browser/{DebugGraph-6VMEOKEV.mjs → DebugGraph-7HXJ2PS2.mjs} +4 -3
  2. package/dist/lib/browser/{DebugGraph-6VMEOKEV.mjs.map → DebugGraph-7HXJ2PS2.mjs.map} +4 -4
  3. package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +33 -0
  4. package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +7 -0
  5. package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +174 -0
  6. package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +7 -0
  7. package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs +50 -0
  8. package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +7 -0
  9. package/dist/lib/browser/DebugStatus-COQGH37G.mjs +125 -0
  10. package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +7 -0
  11. package/dist/lib/browser/{DevtoolsOverviewContainer-2C6XMJ3L.mjs → DevtoolsOverviewContainer-C75NFVER.mjs} +4 -3
  12. package/dist/lib/browser/{DevtoolsOverviewContainer-2C6XMJ3L.mjs.map → DevtoolsOverviewContainer-C75NFVER.mjs.map} +4 -4
  13. package/dist/lib/browser/{SpaceGenerator-W3LJORYT.mjs → SpaceGenerator-SWSGJEEL.mjs} +293 -271
  14. package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +7 -0
  15. package/dist/lib/browser/Wireframe-KAGOKEFW.mjs +53 -0
  16. package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +7 -0
  17. package/dist/lib/browser/{app-graph-builder-DEBTVBQG.mjs → app-graph-builder-LGUQNXHD.mjs} +28 -2
  18. package/dist/lib/browser/{app-graph-builder-DEBTVBQG.mjs.map → app-graph-builder-LGUQNXHD.mjs.map} +2 -2
  19. package/dist/lib/browser/index.mjs +12 -6
  20. package/dist/lib/browser/index.mjs.map +3 -3
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-surface-BTVNKKVQ.mjs +443 -0
  23. package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +7 -0
  24. package/dist/types/src/DebugPlugin.d.ts +6 -1
  25. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
  27. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/react-context/react-context.d.ts +1 -1
  29. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -1
  30. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -1
  32. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/settings/settings.d.ts +1 -1
  34. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
  35. package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
  36. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
  37. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
  38. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  39. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  40. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  41. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  42. package/dist/types/src/components/index.d.ts +2 -10
  43. package/dist/types/src/components/index.d.ts.map +1 -1
  44. package/dist/types/src/{components → containers/DebugGraph}/DebugGraph.d.ts +0 -1
  45. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  46. package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
  47. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  48. package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +1 -1
  49. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  50. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
  51. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  52. package/dist/types/src/{components → containers/DebugSettings}/DebugSettings.d.ts +4 -2
  53. package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -0
  54. package/dist/types/src/containers/DebugSettings/index.d.ts +3 -0
  55. package/dist/types/src/containers/DebugSettings/index.d.ts.map +1 -0
  56. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
  57. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  58. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
  59. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  60. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  61. package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
  62. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  63. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  64. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  65. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
  66. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  67. package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  68. package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
  69. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  70. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  71. package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
  72. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  73. package/dist/types/src/containers/index.d.ts +10 -0
  74. package/dist/types/src/containers/index.d.ts.map +1 -0
  75. package/dist/types/src/translations.d.ts +2 -0
  76. package/dist/types/src/translations.d.ts.map +1 -1
  77. package/dist/types/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +58 -59
  79. package/src/DebugPlugin.tsx +13 -3
  80. package/src/capabilities/app-graph-builder/app-graph-builder.ts +21 -1
  81. package/src/capabilities/react-surface/react-surface.tsx +27 -10
  82. package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
  83. package/src/components/SchemaTable/index.ts +5 -0
  84. package/src/components/SpaceGenerator/ObjectGenerator.tsx +3 -2
  85. package/src/components/SpaceGenerator/index.ts +2 -3
  86. package/src/components/SpaceGenerator/presets.ts +32 -24
  87. package/src/components/index.ts +2 -13
  88. package/src/{components → containers/DebugGraph}/DebugGraph.tsx +0 -2
  89. package/src/containers/DebugGraph/index.ts +7 -0
  90. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +45 -0
  91. package/src/containers/DebugObjectPanel/index.ts +7 -0
  92. package/src/{components → containers/DebugSettings}/DebugSettings.tsx +20 -4
  93. package/src/containers/DebugSettings/index.ts +7 -0
  94. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +60 -0
  95. package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
  96. package/src/containers/DebugStatus/index.ts +7 -0
  97. package/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.tsx +0 -2
  98. package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
  99. package/src/{components → containers}/SpaceGenerator/SpaceGenerator.tsx +35 -34
  100. package/src/containers/SpaceGenerator/index.ts +7 -0
  101. package/src/{components → containers/Wireframe}/Wireframe.tsx +2 -2
  102. package/src/containers/Wireframe/index.ts +7 -0
  103. package/src/containers/index.ts +14 -0
  104. package/src/translations.ts +2 -0
  105. package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +0 -7
  106. package/dist/lib/browser/react-surface-FMVC5GPV.mjs +0 -758
  107. package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +0 -7
  108. package/dist/types/src/components/Container.d.ts +0 -5
  109. package/dist/types/src/components/Container.d.ts.map +0 -1
  110. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  111. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  112. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  113. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  114. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  115. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  116. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
  117. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  118. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  119. package/src/components/Container.tsx +0 -15
  120. package/src/components/DebugObjectPanel.tsx +0 -32
  121. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
  122. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  123. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  124. /package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts +0 -0
  125. /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +0 -0
  126. /package/src/{components → containers/DebugStatus}/DebugStatus.tsx +0 -0
@@ -1,758 +0,0 @@
1
- import {
2
- DebugCapabilities,
3
- Devtools
4
- } from "./chunk-4UFQXPP7.mjs";
5
- import {
6
- meta
7
- } from "./chunk-A5H5GRV6.mjs";
8
-
9
- // src/capabilities/react-surface/react-surface.tsx
10
- import * as Effect from "effect/Effect";
11
- import React5, { useCallback } from "react";
12
- import { Capabilities, Capability } from "@dxos/app-framework";
13
- import { Surface, useCapability, useOperationInvoker, useSettingsState } from "@dxos/app-framework/ui";
14
- import { AppCapabilities as AppCapabilities2, LayoutOperation } from "@dxos/app-toolkit";
15
- import { useLayout } from "@dxos/app-toolkit/ui";
16
- import { AutomergePanel, ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, EdgeDashboardPanel, FeedsPanel, IdentityPanel, InvocationTraceContainer, KeyringPanel, LoggingPanel, MembersPanel, MetadataPanel, NetworkPanel, ObjectsPanel, QueuesPanel, SchemaPanel, SignalPanel, SpaceInfoPanel, SpaceListPanel, StoragePanel, SwarmPanel, TestingPanel, TracingPanel, WorkflowPanel } from "@dxos/devtools";
17
- import { Obj as Obj2 } from "@dxos/echo";
18
- import { log as log2 } from "@dxos/log";
19
- import { ClientCapabilities } from "@dxos/plugin-client";
20
- import { ScriptOperation } from "@dxos/plugin-script/types";
21
- import { SpaceOperation } from "@dxos/plugin-space/types";
22
- import { SpaceState, isSpace, parseId } from "@dxos/react-client/echo";
23
- import { Layout as Layout2 } from "@dxos/react-ui";
24
- import { Collection } from "@dxos/schema";
25
-
26
- // src/components/index.ts
27
- import { lazy } from "react";
28
-
29
- // src/components/DebugObjectPanel.tsx
30
- import React from "react";
31
- import { Clipboard, Input, Layout, Toolbar } from "@dxos/react-ui";
32
- import { Json } from "@dxos/react-ui-syntax-highlighter";
33
- var DebugObjectPanel = ({ object }) => {
34
- const dxn = `dxn:echo:@:${object.id}`;
35
- return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(Layout.Main, {
36
- toolbar: true
37
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.TextInput, {
38
- disabled: true,
39
- value: dxn
40
- }), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
41
- value: dxn
42
- }))), /* @__PURE__ */ React.createElement(Json, {
43
- data: object
44
- })));
45
- };
46
-
47
- // src/components/DebugSettings.tsx
48
- import React2, { useEffect, useState } from "react";
49
- import { useCapabilities } from "@dxos/app-framework/ui";
50
- import { AppCapabilities } from "@dxos/app-toolkit";
51
- import { SaveConfig, Storage, defs } from "@dxos/config";
52
- import { log } from "@dxos/log";
53
- import { useClient } from "@dxos/react-client";
54
- import { Icon, IconButton, Input as Input2, Select, Toast, useFileDownload, useTranslation } from "@dxos/react-ui";
55
- import { Settings } from "@dxos/react-ui-form";
56
- import { setDeep } from "@dxos/util";
57
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugSettings.tsx";
58
- var StorageAdapters = {
59
- opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
60
- idb: defs.Runtime.Client.Storage.StorageDriver.IDB
61
- };
62
- var DebugSettings = ({ settings, onSettingsChange }) => {
63
- const { t } = useTranslation(meta.id);
64
- const [toast, setToast] = useState();
65
- const client = useClient();
66
- const download = useFileDownload();
67
- const [storageConfig, setStorageConfig] = useState({});
68
- const [upload] = useCapabilities(AppCapabilities.FileUploader);
69
- useEffect(() => {
70
- void Storage().then((config) => setStorageConfig(config));
71
- }, []);
72
- const handleToast = (toast2) => {
73
- setToast(toast2);
74
- const t2 = setTimeout(() => setToast(void 0), 5e3);
75
- return () => clearTimeout(t2);
76
- };
77
- const handleDownload = async () => {
78
- const data = await client.diagnostics();
79
- const file = new Blob([
80
- JSON.stringify(data, void 0, 2)
81
- ], {
82
- type: "text/plain"
83
- });
84
- const fileName = `composer-${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`;
85
- download(file, fileName);
86
- if (upload) {
87
- const info = await upload(client.spaces.default.db, new File([
88
- file
89
- ], fileName));
90
- if (!info) {
91
- log.error("diagnostics failed to upload to IPFS", void 0, {
92
- F: __dxlog_file,
93
- L: 64,
94
- S: void 0,
95
- C: (f, a) => f(...a)
96
- });
97
- return;
98
- }
99
- handleToast({
100
- title: t("settings uploaded"),
101
- description: t("settings uploaded to clipboard")
102
- });
103
- const url = client.config.values.runtime.services.ipfs.gateway + "/" + info.cid;
104
- void navigator.clipboard.writeText(url);
105
- handleToast({
106
- title: t("settings uploaded"),
107
- description: t("settings uploaded to clipboard")
108
- });
109
- log.info("diagnostics", {
110
- url
111
- }, {
112
- F: __dxlog_file,
113
- L: 79,
114
- S: void 0,
115
- C: (f, a) => f(...a)
116
- });
117
- }
118
- };
119
- const handleRepair = async () => {
120
- try {
121
- const info = await client.repair();
122
- setStorageConfig(await Storage());
123
- handleToast({
124
- title: t("settings repair success"),
125
- description: JSON.stringify(info, void 0, 2)
126
- });
127
- } catch (err) {
128
- handleToast({
129
- title: t("settings repair failed"),
130
- description: err.message
131
- });
132
- }
133
- };
134
- return /* @__PURE__ */ React2.createElement(Settings.Root, null, /* @__PURE__ */ React2.createElement(Settings.Section, {
135
- title: t("settings title", {
136
- ns: meta.id
137
- })
138
- }, /* @__PURE__ */ React2.createElement(Settings.Group, null, /* @__PURE__ */ React2.createElement(Settings.ItemInput, {
139
- title: t("settings wireframe")
140
- }, /* @__PURE__ */ React2.createElement(Input2.Switch, {
141
- checked: settings.wireframe,
142
- onCheckedChange: (checked) => onSettingsChange((s) => ({
143
- ...s,
144
- wireframe: !!checked
145
- }))
146
- })), /* @__PURE__ */ React2.createElement(Settings.ItemInput, {
147
- title: t("settings download diagnostics")
148
- }, /* @__PURE__ */ React2.createElement(IconButton, {
149
- icon: "ph--download-simple--regular",
150
- iconOnly: true,
151
- label: t("settings download diagnostics"),
152
- onClick: handleDownload
153
- })), /* @__PURE__ */ React2.createElement(Settings.ItemInput, {
154
- title: t("settings repair")
155
- }, /* @__PURE__ */ React2.createElement(IconButton, {
156
- icon: "ph--first-aid-kit--regular",
157
- iconOnly: true,
158
- label: t("settings repair"),
159
- onClick: handleRepair
160
- })), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
161
- icon: "ph--gift--duotone",
162
- size: 5,
163
- classNames: "inline mr-1"
164
- }), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(Settings.ItemInput, {
165
- title: t("settings choose storage adaptor")
166
- }, /* @__PURE__ */ React2.createElement(Select.Root, {
167
- value: Object.entries(StorageAdapters).find(([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
168
- onValueChange: (value) => {
169
- if (confirm(t("settings storage adapter changed alert"))) {
170
- updateConfig(storageConfig, setStorageConfig, [
171
- "runtime",
172
- "client",
173
- "storage",
174
- "dataStore"
175
- ], StorageAdapters[value]);
176
- }
177
- }
178
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
179
- placeholder: t("settings data store label")
180
- }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, Object.keys(StorageAdapters).map((key) => /* @__PURE__ */ React2.createElement(Select.Option, {
181
- key,
182
- value: key
183
- }, t(`settings storage adaptor ${key} label`)))), /* @__PURE__ */ React2.createElement(Select.Arrow, null))))))));
184
- };
185
- var updateConfig = (config, setConfig, path, value) => {
186
- const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
187
- setDeep(storageConfigCopy, path, value);
188
- setConfig(storageConfigCopy);
189
- queueMicrotask(async () => {
190
- await SaveConfig(storageConfigCopy);
191
- });
192
- };
193
-
194
- // src/components/DebugStatus.tsx
195
- import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
196
- import { TimeoutError } from "@dxos/async";
197
- import { useActiveSpace } from "@dxos/plugin-space";
198
- import { StatusBar } from "@dxos/plugin-status-bar";
199
- import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
200
- import { useNetworkStatus } from "@dxos/react-client/mesh";
201
- import { Icon as Icon2 } from "@dxos/react-ui";
202
- var styles = {
203
- success: "text-sky-300 dark:text-green-700",
204
- warning: "text-orange-300 dark:text-orange-600",
205
- error: "text-red-300 dark:text-red-600"
206
- };
207
- var ErrorIndicator = () => {
208
- const [, forceUpdate] = useState2({});
209
- const errorRef = useRef(null);
210
- useEffect2(() => {
211
- const errorListener = (event) => {
212
- const error = event.error ?? event.reason;
213
- if (errorRef.current !== error) {
214
- errorRef.current = error;
215
- forceUpdate({});
216
- }
217
- };
218
- window.addEventListener("error", errorListener);
219
- window.addEventListener("unhandledrejection", errorListener);
220
- return () => {
221
- window.removeEventListener("error", errorListener);
222
- window.removeEventListener("unhandledrejection", errorListener);
223
- };
224
- }, []);
225
- const handleReset = () => {
226
- errorRef.current = null;
227
- forceUpdate({});
228
- };
229
- if (errorRef.current) {
230
- return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
231
- title: errorRef.current.message,
232
- onClick: handleReset
233
- }, /* @__PURE__ */ React3.createElement(Icon2, {
234
- icon: "ph--warning-circle--duotone",
235
- size: 4,
236
- classNames: styles.error
237
- }));
238
- } else {
239
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
240
- title: "No errors."
241
- }, /* @__PURE__ */ React3.createElement(Icon2, {
242
- icon: "ph--check--regular",
243
- size: 4
244
- }));
245
- }
246
- };
247
- var SwarmIndicator = () => {
248
- const [state, setState] = useState2(0);
249
- const { swarm } = useNetworkStatus();
250
- useEffect2(() => {
251
- setState(swarm === ConnectionState.ONLINE ? 0 : 1);
252
- }, [
253
- swarm
254
- ]);
255
- if (state === 0) {
256
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
257
- title: "Connected to swarm."
258
- }, /* @__PURE__ */ React3.createElement(Icon2, {
259
- icon: "ph--lightning--regular",
260
- size: 4
261
- }));
262
- } else {
263
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
264
- title: "Disconnected from swarm."
265
- }, /* @__PURE__ */ React3.createElement(Icon2, {
266
- icon: "ph--lightning-slash--regular",
267
- size: 4,
268
- classNames: styles.warning
269
- }));
270
- }
271
- };
272
- var SavingIndicator = () => {
273
- const [state, _setState] = useState2(0);
274
- const _space = useActiveSpace();
275
- switch (state) {
276
- case 2:
277
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
278
- title: "Edit not saved."
279
- }, /* @__PURE__ */ React3.createElement(Icon2, {
280
- icon: "ph--circle--duotone",
281
- size: 4,
282
- classNames: styles.warning
283
- }));
284
- case 1:
285
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
286
- title: "Saving..."
287
- }, /* @__PURE__ */ React3.createElement(Icon2, {
288
- icon: "ph--circle--duotone",
289
- size: 4,
290
- classNames: styles.success
291
- }));
292
- case 0:
293
- default:
294
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
295
- title: "Modified indicator."
296
- }, /* @__PURE__ */ React3.createElement(Icon2, {
297
- icon: "ph--circle--duotone",
298
- size: 4
299
- }));
300
- }
301
- };
302
- var indicators = [
303
- SavingIndicator,
304
- SwarmIndicator,
305
- ErrorIndicator
306
- ];
307
- var DebugStatus = () => {
308
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React3.createElement(Indicator, {
309
- key: Indicator.name
310
- })));
311
- };
312
-
313
- // src/components/Wireframe.tsx
314
- import React4 from "react";
315
- import { useResizeDetector } from "react-resize-detector";
316
- import { Obj } from "@dxos/echo";
317
- import { useAttentionAttributes } from "@dxos/react-ui-attention";
318
- import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
319
- import { mx } from "@dxos/ui-theme";
320
- var Wireframe = ({ classNames, label, object }) => {
321
- const attentionAttrs = useAttentionAttributes(Obj.getDXN(object).toString());
322
- const { width, height, ref } = useResizeDetector();
323
- return /* @__PURE__ */ React4.createElement("div", {
324
- ref,
325
- className: mx("relative grow min-bs-96", classNames),
326
- ...attentionAttrs
327
- }, /* @__PURE__ */ React4.createElement("div", {
328
- className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
329
- }, /* @__PURE__ */ React4.createElement("div", {
330
- className: "flex justify-between"
331
- }, /* @__PURE__ */ React4.createElement("div", null, label), /* @__PURE__ */ React4.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React4.createElement(SyntaxHighlighter, {
332
- language: "json",
333
- classNames: "text-xs opacity-75 rounded"
334
- }, JSON.stringify(object, void 0, 2))), /* @__PURE__ */ React4.createElement("svg", {
335
- width,
336
- height,
337
- className: "bg-transparent *:text-subdued"
338
- }, /* @__PURE__ */ React4.createElement("rect", {
339
- x: 0,
340
- y: 0,
341
- width,
342
- height,
343
- strokeWidth: 1,
344
- fill: "none"
345
- }), /* @__PURE__ */ React4.createElement("line", {
346
- x1: 0,
347
- y1: 0,
348
- x2: width,
349
- y2: height,
350
- strokeWidth: 1
351
- }), /* @__PURE__ */ React4.createElement("line", {
352
- x1: 0,
353
- y1: height,
354
- x2: width,
355
- y2: 0,
356
- strokeWidth: 1
357
- })));
358
- };
359
-
360
- // src/components/index.ts
361
- var DebugGraph = lazy(() => import("./DebugGraph-6VMEOKEV.mjs"));
362
- var DevtoolsOverviewContainer = lazy(() => import("./DevtoolsOverviewContainer-2C6XMJ3L.mjs"));
363
- var SpaceGenerator = lazy(() => import("./SpaceGenerator-W3LJORYT.mjs"));
364
-
365
- // src/capabilities/react-surface/react-surface.tsx
366
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/capabilities/react-surface/react-surface.tsx";
367
- var isSpaceDebug = (data) => data?.type === `${meta.id}/space` && isSpace(data.space);
368
- var isGraphDebug = (data) => {
369
- const graph = data?.graph;
370
- return graph != null && typeof graph === "object" && typeof graph.json === "function" && typeof data?.root === "string";
371
- };
372
- var useCurrentSpace = () => {
373
- const layout = useLayout();
374
- const client = useCapability(ClientCapabilities.Client);
375
- const { spaceId } = parseId(layout.workspace);
376
- const space = spaceId ? client.spaces.get(spaceId) : void 0;
377
- return space;
378
- };
379
- var react_surface_default = Capability.makeModule(Effect.fnUntraced(function* () {
380
- const capabilities = yield* Capability.Service;
381
- const registry = capabilities.get(Capabilities.AtomRegistry);
382
- const settingsAtom = capabilities.get(DebugCapabilities.Settings);
383
- return Capability.contributes(Capabilities.ReactSurface, [
384
- Surface.create({
385
- id: `${meta.id}/plugin-settings`,
386
- role: "article",
387
- filter: (data) => AppCapabilities2.isSettings(data.subject) && data.subject.prefix === meta.id,
388
- component: ({ data: { subject } }) => {
389
- const { settings, updateSettings } = useSettingsState(subject.atom);
390
- return /* @__PURE__ */ React5.createElement(DebugSettings, {
391
- settings,
392
- onSettingsChange: updateSettings
393
- });
394
- }
395
- }),
396
- Surface.create({
397
- id: `${meta.id}/space`,
398
- role: "article",
399
- filter: (data) => isSpaceDebug(data.subject),
400
- component: ({ role, data }) => {
401
- const { invokePromise } = useOperationInvoker();
402
- const handleCreateObject = useCallback((objects) => {
403
- if (!isSpace(data.subject.space)) {
404
- return;
405
- }
406
- const collection = data.subject.space.state.get() === SpaceState.SPACE_READY && data.subject.space.properties[Collection.Collection.typename]?.target;
407
- if (!Obj2.instanceOf(Collection.Collection, collection)) {
408
- return;
409
- }
410
- objects.forEach((object) => {
411
- void invokePromise(SpaceOperation.AddObject, {
412
- target: collection,
413
- object
414
- });
415
- });
416
- }, [
417
- data.subject.space,
418
- invokePromise
419
- ]);
420
- return /* @__PURE__ */ React5.createElement(Layout2.Main, {
421
- role
422
- }, /* @__PURE__ */ React5.createElement(SpaceGenerator, {
423
- space: data.subject.space,
424
- onCreateObjects: handleCreateObject
425
- }));
426
- }
427
- }),
428
- Surface.create({
429
- id: `${meta.id}/app-graph`,
430
- role: "article",
431
- filter: (data) => isGraphDebug(data.subject),
432
- component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugGraph, {
433
- graph: data.subject.graph,
434
- root: data.subject.root
435
- })
436
- }),
437
- Surface.create({
438
- id: `${meta.id}/wireframe`,
439
- role: [
440
- "article",
441
- "section"
442
- ],
443
- position: "hoist",
444
- filter: (data) => {
445
- const settings = registry.get(settingsAtom);
446
- return Obj2.isObject(data.subject) && !!settings.wireframe;
447
- },
448
- component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
449
- label: `${role}:${name}`,
450
- object: data.subject,
451
- classNames: "row-span-2 overflow-hidden"
452
- })
453
- }),
454
- Surface.create({
455
- id: `${meta.id}/object-debug`,
456
- role: "article",
457
- filter: (data) => data.subject === "debug" && Obj2.isObject(data.companionTo),
458
- component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
459
- object: data.companionTo
460
- })
461
- }),
462
- Surface.create({
463
- id: `${meta.id}/devtools-overview`,
464
- role: "deck-companion--devtools",
465
- component: () => /* @__PURE__ */ React5.createElement(DevtoolsOverviewContainer, null)
466
- }),
467
- Surface.create({
468
- id: `${meta.id}/status`,
469
- role: "status",
470
- component: () => /* @__PURE__ */ React5.createElement(DebugStatus, null)
471
- }),
472
- //
473
- // Devtools
474
- //
475
- Surface.create({
476
- id: `${meta.id}/client/config`,
477
- role: "article",
478
- filter: (data) => data.subject === Devtools.Client.Config,
479
- component: () => /* @__PURE__ */ React5.createElement(ConfigPanel, {
480
- vaultSelector: false
481
- })
482
- }),
483
- Surface.create({
484
- id: `${meta.id}/client/storage`,
485
- role: "article",
486
- filter: (data) => data.subject === Devtools.Client.Storage,
487
- component: () => /* @__PURE__ */ React5.createElement(StoragePanel, null)
488
- }),
489
- Surface.create({
490
- id: `${meta.id}/client/logs`,
491
- role: "article",
492
- filter: (data) => data.subject === Devtools.Client.Logs,
493
- component: () => /* @__PURE__ */ React5.createElement(LoggingPanel, null)
494
- }),
495
- Surface.create({
496
- id: `${meta.id}/client/diagnostics`,
497
- role: "article",
498
- filter: (data) => data.subject === Devtools.Client.Diagnostics,
499
- component: () => /* @__PURE__ */ React5.createElement(DiagnosticsPanel, null)
500
- }),
501
- Surface.create({
502
- id: `${meta.id}/client/tracing`,
503
- role: "article",
504
- filter: (data) => data.subject === Devtools.Client.Tracing,
505
- component: () => /* @__PURE__ */ React5.createElement(TracingPanel, null)
506
- }),
507
- Surface.create({
508
- id: `${meta.id}/halo/identity`,
509
- role: "article",
510
- filter: (data) => data.subject === Devtools.Halo.Identity,
511
- component: () => /* @__PURE__ */ React5.createElement(IdentityPanel, null)
512
- }),
513
- Surface.create({
514
- id: `${meta.id}/halo/devices`,
515
- role: "article",
516
- filter: (data) => data.subject === Devtools.Halo.Devices,
517
- component: () => /* @__PURE__ */ React5.createElement(DeviceListPanel, null)
518
- }),
519
- Surface.create({
520
- id: `${meta.id}/halo/keyring`,
521
- role: "article",
522
- filter: (data) => data.subject === Devtools.Halo.Keyring,
523
- component: () => /* @__PURE__ */ React5.createElement(KeyringPanel, null)
524
- }),
525
- Surface.create({
526
- id: `${meta.id}/halo/credentials`,
527
- role: "article",
528
- filter: (data) => data.subject === Devtools.Halo.Credentials,
529
- component: () => {
530
- const space = useCurrentSpace();
531
- return /* @__PURE__ */ React5.createElement(CredentialsPanel, {
532
- space
533
- });
534
- }
535
- }),
536
- Surface.create({
537
- id: `${meta.id}/echo/spaces`,
538
- role: "article",
539
- filter: (data) => data.subject === Devtools.Echo.Spaces,
540
- component: () => {
541
- const { invokePromise } = useOperationInvoker();
542
- const handleSelect = useCallback(() => invokePromise(LayoutOperation.Open, {
543
- subject: [
544
- Devtools.Echo.Space
545
- ]
546
- }), [
547
- invokePromise
548
- ]);
549
- return /* @__PURE__ */ React5.createElement(SpaceListPanel, {
550
- onSelect: handleSelect
551
- });
552
- }
553
- }),
554
- Surface.create({
555
- id: `${meta.id}/echo/space`,
556
- role: "article",
557
- filter: (data) => data.subject === Devtools.Echo.Space,
558
- component: () => {
559
- const space = useCurrentSpace();
560
- const { invokePromise } = useOperationInvoker();
561
- const handleSelect = useCallback(() => invokePromise(LayoutOperation.Open, {
562
- subject: [
563
- Devtools.Echo.Feeds
564
- ]
565
- }), [
566
- invokePromise
567
- ]);
568
- return /* @__PURE__ */ React5.createElement(SpaceInfoPanel, {
569
- space,
570
- onSelectFeed: handleSelect,
571
- onSelectPipeline: handleSelect
572
- });
573
- }
574
- }),
575
- Surface.create({
576
- id: `${meta.id}/echo/feeds`,
577
- role: "article",
578
- filter: (data) => data.subject === Devtools.Echo.Feeds,
579
- component: () => {
580
- const space = useCurrentSpace();
581
- return /* @__PURE__ */ React5.createElement(FeedsPanel, {
582
- space
583
- });
584
- }
585
- }),
586
- Surface.create({
587
- id: `${meta.id}/echo/objects`,
588
- role: "article",
589
- filter: (data) => data.subject === Devtools.Echo.Objects,
590
- component: () => {
591
- const space = useCurrentSpace();
592
- return /* @__PURE__ */ React5.createElement(ObjectsPanel, {
593
- space
594
- });
595
- }
596
- }),
597
- Surface.create({
598
- id: `${meta.id}/echo/schema`,
599
- role: "article",
600
- filter: (data) => data.subject === Devtools.Echo.Schema,
601
- component: () => {
602
- const space = useCurrentSpace();
603
- return /* @__PURE__ */ React5.createElement(SchemaPanel, {
604
- space
605
- });
606
- }
607
- }),
608
- Surface.create({
609
- id: `${meta.id}/echo/automerge`,
610
- role: "article",
611
- filter: (data) => data.subject === Devtools.Echo.Automerge,
612
- component: () => {
613
- const space = useCurrentSpace();
614
- return /* @__PURE__ */ React5.createElement(AutomergePanel, {
615
- space
616
- });
617
- }
618
- }),
619
- Surface.create({
620
- id: `${meta.id}/echo/queues`,
621
- role: "article",
622
- filter: (data) => data.subject === Devtools.Echo.Queues,
623
- component: () => /* @__PURE__ */ React5.createElement(QueuesPanel, null)
624
- }),
625
- Surface.create({
626
- id: `${meta.id}/echo/members`,
627
- role: "article",
628
- filter: (data) => data.subject === Devtools.Echo.Members,
629
- component: () => {
630
- const space = useCurrentSpace();
631
- return /* @__PURE__ */ React5.createElement(MembersPanel, {
632
- space
633
- });
634
- }
635
- }),
636
- Surface.create({
637
- id: `${meta.id}/echo/metadata`,
638
- role: "article",
639
- filter: (data) => data.subject === Devtools.Echo.Metadata,
640
- component: () => /* @__PURE__ */ React5.createElement(MetadataPanel, null)
641
- }),
642
- Surface.create({
643
- id: `${meta.id}/mesh/signal`,
644
- role: "article",
645
- filter: (data) => data.subject === Devtools.Mesh.Signal,
646
- component: () => /* @__PURE__ */ React5.createElement(SignalPanel, null)
647
- }),
648
- Surface.create({
649
- id: `${meta.id}/mesh/swarm`,
650
- role: "article",
651
- filter: (data) => data.subject === Devtools.Mesh.Swarm,
652
- component: () => /* @__PURE__ */ React5.createElement(SwarmPanel, null)
653
- }),
654
- Surface.create({
655
- id: `${meta.id}/mesh/network`,
656
- role: "article",
657
- filter: (data) => data.subject === Devtools.Mesh.Network,
658
- component: () => {
659
- const space = useCurrentSpace();
660
- return /* @__PURE__ */ React5.createElement(NetworkPanel, {
661
- space
662
- });
663
- }
664
- }),
665
- // TODO(wittjosiah): Remove?
666
- // createSurface({
667
- // id: `${meta.id}/agent/dashboard`,
668
- // role: 'article',
669
- // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
670
- // component: () => <DashboardPanel />,
671
- // }),
672
- Surface.create({
673
- id: `${meta.id}/edge/dashboard`,
674
- role: "article",
675
- filter: (data) => data.subject === Devtools.Edge.Dashboard,
676
- component: () => /* @__PURE__ */ React5.createElement(EdgeDashboardPanel, null)
677
- }),
678
- Surface.create({
679
- id: `${meta.id}/edge/workflows`,
680
- role: "article",
681
- filter: (data) => data.subject === Devtools.Edge.Workflows,
682
- component: () => {
683
- const space = useCurrentSpace();
684
- return /* @__PURE__ */ React5.createElement(WorkflowPanel, {
685
- space
686
- });
687
- }
688
- }),
689
- Surface.create({
690
- id: `${meta.id}/edge/traces`,
691
- role: "article",
692
- filter: (data) => data.subject === Devtools.Edge.Traces,
693
- component: () => {
694
- const space = useCurrentSpace();
695
- const queueDxn = space?.properties.invocationTraceQueue?.dxn;
696
- return /* @__PURE__ */ React5.createElement(InvocationTraceContainer, {
697
- db: space?.db,
698
- queueDxn,
699
- detailAxis: "block"
700
- });
701
- }
702
- }),
703
- Surface.create({
704
- id: `${meta.id}/edge/testing`,
705
- role: "article",
706
- filter: (data) => data.subject === Devtools.Edge.Testing,
707
- component: () => {
708
- const { invokePromise } = useOperationInvoker();
709
- const onSpaceCreate = useCallback(async (space) => {
710
- await space.waitUntilReady();
711
- await invokePromise(SpaceOperation.Migrate, {
712
- space
713
- });
714
- await space.db.flush();
715
- }, [
716
- invokePromise
717
- ]);
718
- const onScriptPluginOpen = useCallback(async (space) => {
719
- await space.waitUntilReady();
720
- const createResult = await invokePromise(ScriptOperation.CreateScript, {
721
- db: space.db
722
- });
723
- if (createResult.data?.object) {
724
- await invokePromise(SpaceOperation.AddObject, {
725
- target: space.db,
726
- object: createResult.data.object
727
- });
728
- }
729
- log2.info("script created", {
730
- result: createResult
731
- }, {
732
- F: __dxlog_file2,
733
- L: 397,
734
- S: this,
735
- C: (f, a) => f(...a)
736
- });
737
- if (createResult.data?.object?.id) {
738
- await invokePromise(LayoutOperation.Open, {
739
- subject: [
740
- `${space.id}:${createResult.data.object.id}`
741
- ]
742
- });
743
- }
744
- }, [
745
- invokePromise
746
- ]);
747
- return /* @__PURE__ */ React5.createElement(TestingPanel, {
748
- onSpaceCreate,
749
- onScriptPluginOpen
750
- });
751
- }
752
- })
753
- ]);
754
- }));
755
- export {
756
- react_surface_default as default
757
- };
758
- //# sourceMappingURL=react-surface-FMVC5GPV.mjs.map