@dxos/plugin-debug 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8

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 (93) hide show
  1. package/dist/lib/browser/{DebugApp-HCHR6GKO.mjs → DebugApp-LQHFFK3Y.mjs} +4 -2
  2. package/dist/lib/browser/{DebugApp-HCHR6GKO.mjs.map → DebugApp-LQHFFK3Y.mjs.map} +3 -3
  3. package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs → DebugSpace-BTMTVZ6C.mjs} +7 -5
  4. package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs.map → DebugSpace-BTMTVZ6C.mjs.map} +3 -3
  5. package/dist/lib/browser/SpaceGenerator-BPZGOSH4.mjs +1238 -0
  6. package/dist/lib/browser/SpaceGenerator-BPZGOSH4.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs +533 -0
  8. package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-EF3UVAVI.mjs +21 -0
  10. package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-UASI2CRI.mjs +72 -0
  12. package/dist/lib/browser/chunk-UASI2CRI.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +97 -713
  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-TCD3MNIT.mjs +16 -0
  17. package/dist/lib/browser/react-context-TCD3MNIT.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-W6QLG4YJ.mjs +641 -0
  19. package/dist/lib/browser/react-surface-W6QLG4YJ.mjs.map +7 -0
  20. package/dist/lib/browser/settings-INPXR64L.mjs +24 -0
  21. package/dist/lib/browser/settings-INPXR64L.mjs.map +7 -0
  22. package/dist/types/src/DebugPlugin.d.ts +1 -2
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  25. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/index.d.ts +185 -0
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/react-context.d.ts +8 -0
  29. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  31. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/settings.d.ts +4 -0
  33. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  34. package/dist/types/src/components/Container.d.ts +2 -2
  35. package/dist/types/src/components/Container.d.ts.map +1 -1
  36. package/dist/types/src/components/DebugObjectPanel.d.ts +1 -2
  37. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  38. package/dist/types/src/components/DebugSettings.d.ts +1 -2
  39. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  40. package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts +1 -2
  41. package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +1 -1
  42. package/dist/types/src/components/DebugStatus.d.ts +1 -2
  43. package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
  44. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  45. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts +1 -2
  46. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
  47. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -2
  48. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  49. package/dist/types/src/components/SpaceGenerator/presets.d.ts +22 -0
  50. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -0
  51. package/dist/types/src/components/Wireframe.d.ts +1 -2
  52. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  53. package/dist/types/src/components/index.d.ts +4 -4
  54. package/dist/types/src/components/index.d.ts.map +1 -1
  55. package/dist/types/src/index.d.ts +1 -2
  56. package/dist/types/src/index.d.ts.map +1 -1
  57. package/dist/types/src/meta.d.ts +2 -2
  58. package/dist/types/src/meta.d.ts.map +1 -1
  59. package/dist/types/src/translations.d.ts +28 -0
  60. package/dist/types/src/translations.d.ts.map +1 -1
  61. package/dist/types/src/types.d.ts +44 -4
  62. package/dist/types/src/types.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +51 -52
  65. package/src/DebugPlugin.tsx +61 -345
  66. package/src/capabilities/app-graph-builder.ts +385 -0
  67. package/src/capabilities/index.ts +10 -0
  68. package/src/capabilities/react-context.tsx +16 -0
  69. package/src/capabilities/react-surface.tsx +307 -0
  70. package/src/capabilities/settings.ts +17 -0
  71. package/src/components/DebugApp/DebugApp.tsx +1 -1
  72. package/src/components/DebugObjectPanel.tsx +17 -5
  73. package/src/components/DebugSettings.tsx +11 -16
  74. package/src/components/DebugSpace/DebugSpace.tsx +1 -1
  75. package/src/components/DebugStatus.tsx +17 -27
  76. package/src/components/SpaceGenerator/ObjectGenerator.tsx +34 -7
  77. package/src/components/SpaceGenerator/SpaceGenerator.tsx +76 -7
  78. package/src/components/SpaceGenerator/presets.ts +563 -0
  79. package/src/index.ts +1 -4
  80. package/src/meta.ts +4 -2
  81. package/src/translations.ts +28 -0
  82. package/src/types.ts +51 -13
  83. package/dist/lib/browser/SpaceGenerator-Y2NXBQVR.mjs +0 -277
  84. package/dist/lib/browser/SpaceGenerator-Y2NXBQVR.mjs.map +0 -7
  85. package/dist/lib/browser/chunk-6CGQHKET.mjs +0 -21
  86. package/dist/lib/browser/chunk-6CGQHKET.mjs.map +0 -7
  87. package/dist/lib/browser/chunk-CAENAAHY.mjs +0 -18
  88. package/dist/lib/browser/chunk-CAENAAHY.mjs.map +0 -7
  89. package/dist/lib/browser/meta.mjs +0 -9
  90. package/dist/lib/browser/meta.mjs.map +0 -7
  91. package/dist/types/src/components/DebugSurface.d.ts +0 -9
  92. package/dist/types/src/components/DebugSurface.d.ts.map +0 -1
  93. package/src/components/DebugSurface.tsx +0 -55
@@ -0,0 +1,641 @@
1
+ import {
2
+ DEBUG_PLUGIN
3
+ } from "./chunk-EF3UVAVI.mjs";
4
+ import {
5
+ Devtools
6
+ } from "./chunk-UASI2CRI.mjs";
7
+
8
+ // packages/plugins/plugin-debug/src/capabilities/react-surface.tsx
9
+ import React5, { useCallback } from "react";
10
+ import { Capabilities as Capabilities2, contributes, createIntent, createSurface, LayoutAction } from "@dxos/app-framework";
11
+ import { ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, FeedsPanel, IdentityPanel, KeyringPanel, LoggingPanel, MembersPanel, MetadataPanel, NetworkPanel, ObjectsPanel, SignalPanel, SpaceInfoPanel, SpaceListPanel, StoragePanel, SwarmPanel, TracingPanel, DashboardPanel, EdgeDashboardPanel, SearchPanel, AutomergePanel, WorkflowPanel } from "@dxos/devtools";
12
+ import { SettingsStore } from "@dxos/local-storage";
13
+ import { Graph } from "@dxos/plugin-graph";
14
+ import { SpaceAction, CollectionType } from "@dxos/plugin-space/types";
15
+ import { SpaceState, isSpace, isEchoObject } from "@dxos/react-client/echo";
16
+
17
+ // packages/plugins/plugin-debug/src/components/index.ts
18
+ import { lazy } from "react";
19
+
20
+ // packages/plugins/plugin-debug/src/components/DebugObjectPanel.tsx
21
+ import React from "react";
22
+ import { Clipboard, Input } from "@dxos/react-ui";
23
+ import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
24
+ var DebugObjectPanel = ({ object }) => {
25
+ const dxn = `dxn:echo:@:${object.id}`;
26
+ return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement("div", {
27
+ className: "flex flex-col"
28
+ }, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
29
+ role: "none",
30
+ className: "flex flex-col gap-1"
31
+ }, /* @__PURE__ */ React.createElement("div", {
32
+ role: "none",
33
+ className: "flex gap-1"
34
+ }, /* @__PURE__ */ React.createElement(Input.TextInput, {
35
+ disabled: true,
36
+ value: dxn
37
+ }), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
38
+ value: dxn
39
+ })))), /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
40
+ classNames: "flex text-xs",
41
+ language: "json"
42
+ }, JSON.stringify(object, null, 2))));
43
+ };
44
+
45
+ // packages/plugins/plugin-debug/src/components/DebugSettings.tsx
46
+ import React2, { useEffect, useState } from "react";
47
+ import { Capabilities, useCapabilities } from "@dxos/app-framework";
48
+ import { defs, SaveConfig, Storage } from "@dxos/config";
49
+ import { log } from "@dxos/log";
50
+ import { useClient } from "@dxos/react-client";
51
+ import { useTranslation, Button, Toast, Input as Input2, useFileDownload, Select, Icon } from "@dxos/react-ui";
52
+ import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
53
+ import { setDeep } from "@dxos/util";
54
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugSettings.tsx";
55
+ var StorageAdapters = {
56
+ opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
57
+ idb: defs.Runtime.Client.Storage.StorageDriver.IDB
58
+ };
59
+ var DebugSettings = ({ settings }) => {
60
+ const { t } = useTranslation(DEBUG_PLUGIN);
61
+ const [toast, setToast] = useState();
62
+ const client = useClient();
63
+ const download = useFileDownload();
64
+ const [storageConfig, setStorageConfig] = useState({});
65
+ const [upload] = useCapabilities(Capabilities.FileUploader);
66
+ useEffect(() => {
67
+ void Storage().then((config) => setStorageConfig(config));
68
+ }, []);
69
+ const handleToast = (toast2) => {
70
+ setToast(toast2);
71
+ const t2 = setTimeout(() => setToast(void 0), 5e3);
72
+ return () => clearTimeout(t2);
73
+ };
74
+ const handleDownload = async () => {
75
+ const data = await client.diagnostics();
76
+ const file = new Blob([
77
+ JSON.stringify(data, void 0, 2)
78
+ ], {
79
+ type: "text/plain"
80
+ });
81
+ const fileName = `composer-${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`;
82
+ download(file, fileName);
83
+ if (upload) {
84
+ const info = await upload(new File([
85
+ file
86
+ ], fileName), client.spaces.default);
87
+ if (!info) {
88
+ log.error("diagnostics failed to upload to IPFS", void 0, {
89
+ F: __dxlog_file,
90
+ L: 56,
91
+ S: void 0,
92
+ C: (f, a) => f(...a)
93
+ });
94
+ return;
95
+ }
96
+ handleToast({
97
+ title: t("settings uploaded"),
98
+ description: t("settings uploaded to clipboard")
99
+ });
100
+ const url = client.config.values.runtime.services.ipfs.gateway + "/" + info.cid;
101
+ void navigator.clipboard.writeText(url);
102
+ handleToast({
103
+ title: t("settings uploaded"),
104
+ description: t("settings uploaded to clipboard")
105
+ });
106
+ log.info("diagnostics", {
107
+ url
108
+ }, {
109
+ F: __dxlog_file,
110
+ L: 65,
111
+ S: void 0,
112
+ C: (f, a) => f(...a)
113
+ });
114
+ }
115
+ };
116
+ const handleRepair = async () => {
117
+ try {
118
+ const info = await client.repair();
119
+ setStorageConfig(await Storage());
120
+ handleToast({
121
+ title: t("settings repair success"),
122
+ description: JSON.stringify(info, void 0, 2)
123
+ });
124
+ } catch (err) {
125
+ handleToast({
126
+ title: t("settings repair failed"),
127
+ description: err.message
128
+ });
129
+ }
130
+ };
131
+ return /* @__PURE__ */ React2.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
132
+ label: t("settings show debug panel")
133
+ }, /* @__PURE__ */ React2.createElement(Input2.Switch, {
134
+ checked: settings.debug,
135
+ onCheckedChange: (checked) => settings.debug = !!checked
136
+ })), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
137
+ label: t("settings wireframe")
138
+ }, /* @__PURE__ */ React2.createElement(Input2.Switch, {
139
+ checked: settings.wireframe,
140
+ onCheckedChange: (checked) => settings.wireframe = !!checked
141
+ })), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
142
+ label: t("settings download diagnostics")
143
+ }, /* @__PURE__ */ React2.createElement(Button, {
144
+ onClick: handleDownload
145
+ }, /* @__PURE__ */ React2.createElement(Icon, {
146
+ icon: "ph--download-simple--regular",
147
+ size: 5
148
+ }))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
149
+ label: t("settings repair")
150
+ }, /* @__PURE__ */ React2.createElement(Button, {
151
+ onClick: handleRepair
152
+ }, /* @__PURE__ */ React2.createElement(Icon, {
153
+ icon: "ph--first-aid-kit--regular",
154
+ size: 5
155
+ }))), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
156
+ icon: "ph--gift--duotone",
157
+ size: 5,
158
+ classNames: "inline mr-1"
159
+ }), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
160
+ label: t("settings choose storage adaptor")
161
+ }, /* @__PURE__ */ React2.createElement(Select.Root, {
162
+ value: Object.entries(StorageAdapters).find(([name2, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
163
+ onValueChange: (value) => {
164
+ if (confirm(t("settings storage adapter changed alert"))) {
165
+ updateConfig(storageConfig, setStorageConfig, [
166
+ "runtime",
167
+ "client",
168
+ "storage",
169
+ "dataStore"
170
+ ], StorageAdapters[value]);
171
+ }
172
+ }
173
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
174
+ placeholder: t("settings data store label")
175
+ }), /* @__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, {
176
+ key,
177
+ value: key
178
+ }, t(`settings storage adaptor ${key} label`)))))))));
179
+ };
180
+ var updateConfig = (config, setConfig, path, value) => {
181
+ const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
182
+ setDeep(storageConfigCopy, path, value);
183
+ setConfig(storageConfigCopy);
184
+ queueMicrotask(async () => {
185
+ await SaveConfig(storageConfigCopy);
186
+ });
187
+ };
188
+
189
+ // packages/plugins/plugin-debug/src/components/DebugStatus.tsx
190
+ import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
191
+ import { useAppGraph, useLayout } from "@dxos/app-framework";
192
+ import { TimeoutError } from "@dxos/async";
193
+ import { StatsPanel, useStats } from "@dxos/devtools";
194
+ import { getActiveSpace } from "@dxos/plugin-space";
195
+ import { StatusBar } from "@dxos/plugin-status-bar";
196
+ import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
197
+ import { useNetworkStatus } from "@dxos/react-client/mesh";
198
+ import { Icon as Icon2, Popover } from "@dxos/react-ui";
199
+ var styles = {
200
+ success: "text-sky-300 dark:text-green-700",
201
+ warning: "text-orange-300 dark:text-orange-600",
202
+ error: "text-red-300 dark:text-red-600"
203
+ };
204
+ var ErrorIndicator = () => {
205
+ const [, forceUpdate] = useState2({});
206
+ const errorRef = useRef();
207
+ useEffect2(() => {
208
+ const errorListener = (event) => {
209
+ const error = event.error ?? event.reason;
210
+ if (errorRef.current !== error) {
211
+ errorRef.current = error;
212
+ forceUpdate({});
213
+ }
214
+ };
215
+ window.addEventListener("error", errorListener);
216
+ window.addEventListener("unhandledrejection", errorListener);
217
+ return () => {
218
+ window.removeEventListener("error", errorListener);
219
+ window.removeEventListener("unhandledrejection", errorListener);
220
+ };
221
+ }, []);
222
+ const handleReset = () => {
223
+ errorRef.current = void 0;
224
+ forceUpdate({});
225
+ };
226
+ if (errorRef.current) {
227
+ return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
228
+ title: errorRef.current.message,
229
+ onClick: handleReset
230
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
231
+ icon: "ph--warning-circle--duotone",
232
+ size: 4,
233
+ classNames: styles.error
234
+ }));
235
+ } else {
236
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
237
+ title: "No errors."
238
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
239
+ icon: "ph--check--regular",
240
+ size: 4
241
+ }));
242
+ }
243
+ };
244
+ var SwarmIndicator = () => {
245
+ const [state, setState] = useState2(0);
246
+ const { swarm } = useNetworkStatus();
247
+ useEffect2(() => {
248
+ setState(swarm === ConnectionState.ONLINE ? 0 : 1);
249
+ }, [
250
+ swarm
251
+ ]);
252
+ if (state === 0) {
253
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
254
+ title: "Connected to swarm."
255
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
256
+ icon: "ph--lightning--regular",
257
+ size: 4
258
+ }));
259
+ } else {
260
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
261
+ title: "Disconnected from swarm."
262
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
263
+ icon: "ph--lightning-slash--regular",
264
+ size: 4,
265
+ classNames: styles.warning
266
+ }));
267
+ }
268
+ };
269
+ var SavingIndicator = () => {
270
+ const [state, _setState] = useState2(0);
271
+ const layout = useLayout();
272
+ const { graph } = useAppGraph();
273
+ const _space = graph ? getActiveSpace(graph, layout.active[0]) : void 0;
274
+ switch (state) {
275
+ case 2:
276
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
277
+ title: "Edit not saved."
278
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
279
+ icon: "ph--circle--duotone",
280
+ size: 4,
281
+ classNames: styles.warning
282
+ }));
283
+ case 1:
284
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
285
+ title: "Saving..."
286
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
287
+ icon: "ph--circle--duotone",
288
+ size: 4,
289
+ classNames: styles.success
290
+ }));
291
+ case 0:
292
+ default:
293
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
294
+ title: "Modified indicator."
295
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
296
+ icon: "ph--circle--duotone",
297
+ size: 4
298
+ }));
299
+ }
300
+ };
301
+ var PerformanceIndicator = () => {
302
+ const [visible, setVisible] = useState2(false);
303
+ const [stats, refreshStats] = useStats();
304
+ return /* @__PURE__ */ React3.createElement(Popover.Root, {
305
+ open: visible,
306
+ onOpenChange: setVisible
307
+ }, /* @__PURE__ */ React3.createElement(Popover.Trigger, {
308
+ asChild: true
309
+ }, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
310
+ onClick: () => setVisible((visible2) => !visible2),
311
+ title: "Performance panels"
312
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
313
+ icon: "ph--chart-bar--regular",
314
+ size: 4
315
+ }))), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(Popover.Content, {
316
+ classNames: "max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]"
317
+ }, /* @__PURE__ */ React3.createElement(StatsPanel, {
318
+ stats,
319
+ onRefresh: refreshStats
320
+ }), /* @__PURE__ */ React3.createElement(Popover.Arrow, null))));
321
+ };
322
+ var indicators = [
323
+ SavingIndicator,
324
+ SwarmIndicator,
325
+ PerformanceIndicator,
326
+ ErrorIndicator
327
+ ];
328
+ var DebugStatus = () => {
329
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React3.createElement(Indicator, {
330
+ key: Indicator.name
331
+ })));
332
+ };
333
+
334
+ // packages/plugins/plugin-debug/src/components/Wireframe.tsx
335
+ import React4 from "react";
336
+ import { useResizeDetector } from "react-resize-detector";
337
+ import { fullyQualifiedId } from "@dxos/react-client/echo";
338
+ import { useAttendableAttributes } from "@dxos/react-ui-attention";
339
+ import { SyntaxHighlighter as SyntaxHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
340
+ import { mx } from "@dxos/react-ui-theme";
341
+ var Wireframe = ({ classNames, label, object }) => {
342
+ const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));
343
+ const { width, height, ref } = useResizeDetector();
344
+ return /* @__PURE__ */ React4.createElement("div", {
345
+ ref,
346
+ className: mx("relative grow min-bs-96", classNames),
347
+ ...attendableAttrs
348
+ }, /* @__PURE__ */ React4.createElement("div", {
349
+ className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
350
+ }, /* @__PURE__ */ React4.createElement("div", {
351
+ className: "flex justify-between"
352
+ }, /* @__PURE__ */ React4.createElement("div", null, label), /* @__PURE__ */ React4.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React4.createElement(SyntaxHighlighter2, {
353
+ language: "json",
354
+ classNames: "flex w-full text-xs opacity-75 rounded"
355
+ }, JSON.stringify(object, void 0, 2))), /* @__PURE__ */ React4.createElement("svg", {
356
+ width,
357
+ height,
358
+ className: "bg-transparent [&>*]:text-subdued"
359
+ }, /* @__PURE__ */ React4.createElement("rect", {
360
+ x: 0,
361
+ y: 0,
362
+ width,
363
+ height,
364
+ strokeWidth: 1,
365
+ fill: "none"
366
+ }), /* @__PURE__ */ React4.createElement("line", {
367
+ x1: 0,
368
+ y1: 0,
369
+ x2: width,
370
+ y2: height,
371
+ strokeWidth: 1
372
+ }), /* @__PURE__ */ React4.createElement("line", {
373
+ x1: 0,
374
+ y1: height,
375
+ x2: width,
376
+ y2: 0,
377
+ strokeWidth: 1
378
+ })));
379
+ };
380
+
381
+ // packages/plugins/plugin-debug/src/components/index.ts
382
+ var DebugApp = lazy(() => import("./DebugApp-LQHFFK3Y.mjs"));
383
+ var DebugSpace = lazy(() => import("./DebugSpace-BTMTVZ6C.mjs"));
384
+ var SpaceGenerator = lazy(() => import("./SpaceGenerator-BPZGOSH4.mjs"));
385
+
386
+ // packages/plugins/plugin-debug/src/capabilities/react-surface.tsx
387
+ var isSpaceDebug = (data) => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
388
+ var isGraphDebug = (data) => data?.graph instanceof Graph;
389
+ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface, [
390
+ createSurface({
391
+ id: `${DEBUG_PLUGIN}/settings`,
392
+ role: "article",
393
+ filter: (data) => data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
394
+ component: ({ data: { subject } }) => /* @__PURE__ */ React5.createElement(DebugSettings, {
395
+ settings: subject.value
396
+ })
397
+ }),
398
+ createSurface({
399
+ id: `${DEBUG_PLUGIN}/space`,
400
+ role: "article",
401
+ filter: (data) => isSpaceDebug(data.subject),
402
+ component: ({ data }) => {
403
+ const handleCreateObject = useCallback((objects) => {
404
+ if (!isSpace(data.subject.space)) {
405
+ return;
406
+ }
407
+ const collection = data.subject.space.state.get() === SpaceState.SPACE_READY && data.subject.space.properties[CollectionType.typename]?.target;
408
+ if (!(collection instanceof CollectionType)) {
409
+ return;
410
+ }
411
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities2.IntentDispatcher);
412
+ objects.forEach((object) => {
413
+ void dispatch(createIntent(SpaceAction.AddObject, {
414
+ target: collection,
415
+ object
416
+ }));
417
+ });
418
+ }, [
419
+ data.subject.space
420
+ ]);
421
+ const deprecated = false;
422
+ return deprecated ? /* @__PURE__ */ React5.createElement(DebugSpace, {
423
+ space: data.subject.space,
424
+ onAddObjects: handleCreateObject
425
+ }) : /* @__PURE__ */ React5.createElement(SpaceGenerator, {
426
+ space: data.subject.space,
427
+ onCreateObjects: handleCreateObject
428
+ });
429
+ }
430
+ }),
431
+ createSurface({
432
+ id: `${DEBUG_PLUGIN}/graph`,
433
+ role: "article",
434
+ filter: (data) => isGraphDebug(data.subject),
435
+ component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugApp, {
436
+ graph: data.subject.graph
437
+ })
438
+ }),
439
+ createSurface({
440
+ id: `${DEBUG_PLUGIN}/wireframe`,
441
+ role: [
442
+ "article",
443
+ "section"
444
+ ],
445
+ position: "hoist",
446
+ filter: (data) => {
447
+ const settings = context.requestCapability(Capabilities2.SettingsStore).getStore(DEBUG_PLUGIN).value;
448
+ return isEchoObject(data.subject) && !!settings.wireframe;
449
+ },
450
+ component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
451
+ label: `${role}:${name}`,
452
+ object: data.subject,
453
+ classNames: "row-span-2 overflow-hidden"
454
+ })
455
+ }),
456
+ createSurface({
457
+ id: `${DEBUG_PLUGIN}/complementary`,
458
+ role: "complementary--debug",
459
+ filter: (data) => isEchoObject(data.subject),
460
+ component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
461
+ object: data.subject
462
+ })
463
+ }),
464
+ createSurface({
465
+ id: `${DEBUG_PLUGIN}/status`,
466
+ role: "status",
467
+ component: () => /* @__PURE__ */ React5.createElement(DebugStatus, null)
468
+ }),
469
+ //
470
+ // Devtools
471
+ //
472
+ createSurface({
473
+ id: `${DEBUG_PLUGIN}/client/config`,
474
+ role: "article",
475
+ filter: (data) => data.subject === Devtools.Client.Config,
476
+ component: () => /* @__PURE__ */ React5.createElement(ConfigPanel, null)
477
+ }),
478
+ createSurface({
479
+ id: `${DEBUG_PLUGIN}/client/storage`,
480
+ role: "article",
481
+ filter: (data) => data.subject === Devtools.Client.Storage,
482
+ component: () => /* @__PURE__ */ React5.createElement(StoragePanel, null)
483
+ }),
484
+ createSurface({
485
+ id: `${DEBUG_PLUGIN}/client/logs`,
486
+ role: "article",
487
+ filter: (data) => data.subject === Devtools.Client.Logs,
488
+ component: () => /* @__PURE__ */ React5.createElement(LoggingPanel, null)
489
+ }),
490
+ createSurface({
491
+ id: `${DEBUG_PLUGIN}/client/diagnostics`,
492
+ role: "article",
493
+ filter: (data) => data.subject === Devtools.Client.Diagnostics,
494
+ component: () => /* @__PURE__ */ React5.createElement(DiagnosticsPanel, null)
495
+ }),
496
+ createSurface({
497
+ id: `${DEBUG_PLUGIN}/client/tracing`,
498
+ role: "article",
499
+ filter: (data) => data.subject === Devtools.Client.Tracing,
500
+ component: () => /* @__PURE__ */ React5.createElement(TracingPanel, null)
501
+ }),
502
+ createSurface({
503
+ id: `${DEBUG_PLUGIN}/halo/identity`,
504
+ role: "article",
505
+ filter: (data) => data.subject === Devtools.Halo.Identity,
506
+ component: () => /* @__PURE__ */ React5.createElement(IdentityPanel, null)
507
+ }),
508
+ createSurface({
509
+ id: `${DEBUG_PLUGIN}/halo/devices`,
510
+ role: "article",
511
+ filter: (data) => data.subject === Devtools.Halo.Devices,
512
+ component: () => /* @__PURE__ */ React5.createElement(DeviceListPanel, null)
513
+ }),
514
+ createSurface({
515
+ id: `${DEBUG_PLUGIN}/halo/keyring`,
516
+ role: "article",
517
+ filter: (data) => data.subject === Devtools.Halo.Keyring,
518
+ component: () => /* @__PURE__ */ React5.createElement(KeyringPanel, null)
519
+ }),
520
+ createSurface({
521
+ id: `${DEBUG_PLUGIN}/halo/credentials`,
522
+ role: "article",
523
+ filter: (data) => data.subject === Devtools.Halo.Credentials,
524
+ component: () => /* @__PURE__ */ React5.createElement(CredentialsPanel, null)
525
+ }),
526
+ createSurface({
527
+ id: `${DEBUG_PLUGIN}/echo/spaces`,
528
+ role: "article",
529
+ filter: (data) => data.subject === Devtools.Echo.Spaces,
530
+ component: () => {
531
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities2.IntentDispatcher);
532
+ const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
533
+ part: "main",
534
+ subject: [
535
+ Devtools.Echo.Space
536
+ ]
537
+ })), [
538
+ dispatch
539
+ ]);
540
+ return /* @__PURE__ */ React5.createElement(SpaceListPanel, {
541
+ onSelect: handleSelect
542
+ });
543
+ }
544
+ }),
545
+ createSurface({
546
+ id: `${DEBUG_PLUGIN}/echo/space`,
547
+ role: "article",
548
+ filter: (data) => data.subject === Devtools.Echo.Space,
549
+ component: () => {
550
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities2.IntentDispatcher);
551
+ const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
552
+ part: "main",
553
+ subject: [
554
+ Devtools.Echo.Feeds
555
+ ]
556
+ })), [
557
+ dispatch
558
+ ]);
559
+ return /* @__PURE__ */ React5.createElement(SpaceInfoPanel, {
560
+ onSelectFeed: handleSelect,
561
+ onSelectPipeline: handleSelect
562
+ });
563
+ }
564
+ }),
565
+ createSurface({
566
+ id: `${DEBUG_PLUGIN}/echo/feeds`,
567
+ role: "article",
568
+ filter: (data) => data.subject === Devtools.Echo.Feeds,
569
+ component: () => /* @__PURE__ */ React5.createElement(FeedsPanel, null)
570
+ }),
571
+ createSurface({
572
+ id: `${DEBUG_PLUGIN}/echo/objects`,
573
+ role: "article",
574
+ filter: (data) => data.subject === Devtools.Echo.Objects,
575
+ component: () => /* @__PURE__ */ React5.createElement(ObjectsPanel, null)
576
+ }),
577
+ createSurface({
578
+ id: `${DEBUG_PLUGIN}/echo/automerge`,
579
+ role: "article",
580
+ filter: (data) => data.subject === Devtools.Echo.Automerge,
581
+ component: () => /* @__PURE__ */ React5.createElement(AutomergePanel, null)
582
+ }),
583
+ createSurface({
584
+ id: `${DEBUG_PLUGIN}/echo/members`,
585
+ role: "article",
586
+ filter: (data) => data.subject === Devtools.Echo.Members,
587
+ component: () => /* @__PURE__ */ React5.createElement(MembersPanel, null)
588
+ }),
589
+ createSurface({
590
+ id: `${DEBUG_PLUGIN}/echo/metadata`,
591
+ role: "article",
592
+ filter: (data) => data.subject === Devtools.Echo.Metadata,
593
+ component: () => /* @__PURE__ */ React5.createElement(MetadataPanel, null)
594
+ }),
595
+ createSurface({
596
+ id: `${DEBUG_PLUGIN}/mesh/signal`,
597
+ role: "article",
598
+ filter: (data) => data.subject === Devtools.Mesh.Signal,
599
+ component: () => /* @__PURE__ */ React5.createElement(SignalPanel, null)
600
+ }),
601
+ createSurface({
602
+ id: `${DEBUG_PLUGIN}/mesh/swarm`,
603
+ role: "article",
604
+ filter: (data) => data.subject === Devtools.Mesh.Swarm,
605
+ component: () => /* @__PURE__ */ React5.createElement(SwarmPanel, null)
606
+ }),
607
+ createSurface({
608
+ id: `${DEBUG_PLUGIN}/mesh/network`,
609
+ role: "article",
610
+ filter: (data) => data.subject === Devtools.Mesh.Network,
611
+ component: () => /* @__PURE__ */ React5.createElement(NetworkPanel, null)
612
+ }),
613
+ createSurface({
614
+ id: `${DEBUG_PLUGIN}/agent/dashboard`,
615
+ role: "article",
616
+ filter: (data) => data.subject === Devtools.Agent.Dashboard,
617
+ component: () => /* @__PURE__ */ React5.createElement(DashboardPanel, null)
618
+ }),
619
+ createSurface({
620
+ id: `${DEBUG_PLUGIN}/agent/search`,
621
+ role: "article",
622
+ filter: (data) => data.subject === Devtools.Agent.Search,
623
+ component: () => /* @__PURE__ */ React5.createElement(SearchPanel, null)
624
+ }),
625
+ createSurface({
626
+ id: `${DEBUG_PLUGIN}/edge/dashboard`,
627
+ role: "article",
628
+ filter: (data) => data.subject === Devtools.Edge.Dashboard,
629
+ component: () => /* @__PURE__ */ React5.createElement(EdgeDashboardPanel, null)
630
+ }),
631
+ createSurface({
632
+ id: `${DEBUG_PLUGIN}/edge/workflows`,
633
+ role: "article",
634
+ filter: (data) => data.subject === Devtools.Edge.Workflows,
635
+ component: () => /* @__PURE__ */ React5.createElement(WorkflowPanel, null)
636
+ })
637
+ ]);
638
+ export {
639
+ react_surface_default as default
640
+ };
641
+ //# sourceMappingURL=react-surface-W6QLG4YJ.mjs.map