@dxos/plugin-debug 0.8.4-main.1da679c → 0.8.4-main.21d9917

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