@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
@@ -1,391 +1,19 @@
1
1
  import {
2
2
  DEBUG_PLUGIN,
3
- meta_default
4
- } from "./chunk-CAENAAHY.mjs";
5
- import {
6
- DebugContext,
7
- DebugSettingsSchema
8
- } from "./chunk-6CGQHKET.mjs";
3
+ meta
4
+ } from "./chunk-EF3UVAVI.mjs";
9
5
 
10
6
  // packages/plugins/plugin-debug/src/DebugPlugin.tsx
11
- import React5, { useCallback, useEffect as useEffect3, useState as useState3 } from "react";
12
- import { createIntent, createSurface, definePlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, parseMetadataResolverPlugin, parseSettingsPlugin, resolvePlugin } from "@dxos/app-framework";
13
- import { Timer } from "@dxos/async";
14
- import { Devtools } from "@dxos/devtools";
15
- import { invariant } from "@dxos/invariant";
16
- import { parseClientPlugin } from "@dxos/plugin-client/types";
17
- import { createExtension, Graph, toSignal } from "@dxos/plugin-graph";
18
- import { memoizeQuery, SpaceAction } from "@dxos/plugin-space";
19
- import { CollectionType } from "@dxos/plugin-space/types";
20
- import { create, getTypename, isEchoObject, isSpace, parseId, SpaceState } from "@dxos/react-client/echo";
21
-
22
- // packages/plugins/plugin-debug/src/components/index.ts
23
- import { lazy } from "react";
24
-
25
- // packages/plugins/plugin-debug/src/components/DebugObjectPanel.tsx
26
- import React from "react";
27
- import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
28
- var DebugObjectPanel = ({ object }) => {
29
- return /* @__PURE__ */ React.createElement("div", {
30
- className: "flex flex-col"
31
- }, /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
32
- classNames: "flex text-xs",
33
- language: "json"
34
- }, JSON.stringify(object, null, 2)));
35
- };
36
-
37
- // packages/plugins/plugin-debug/src/components/DebugSettings.tsx
38
- import { Gift, DownloadSimple, FirstAidKit } from "@phosphor-icons/react";
39
- import React2, { useEffect, useState } from "react";
40
- import { parseFileManagerPlugin, useResolvePlugin } from "@dxos/app-framework";
41
- import { defs, SaveConfig, Storage } from "@dxos/config";
42
- import { log } from "@dxos/log";
43
- import { useClient } from "@dxos/react-client";
44
- import { useTranslation, Button, Toast, Input, useFileDownload, Select } from "@dxos/react-ui";
45
- import { DeprecatedFormInput } from "@dxos/react-ui-form";
46
- import { getSize, mx } from "@dxos/react-ui-theme";
47
- import { setDeep } from "@dxos/util";
48
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugSettings.tsx";
49
- var StorageAdapters = {
50
- opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
51
- idb: defs.Runtime.Client.Storage.StorageDriver.IDB
52
- };
53
- var DebugSettings = ({ settings }) => {
54
- const { t } = useTranslation(DEBUG_PLUGIN);
55
- const [toast, setToast] = useState();
56
- const client = useClient();
57
- const download = useFileDownload();
58
- const [storageConfig, setStorageConfig] = useState({});
59
- const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);
60
- useEffect(() => {
61
- void Storage().then((config) => setStorageConfig(config));
62
- }, []);
63
- const handleToast = (toast2) => {
64
- setToast(toast2);
65
- const t2 = setTimeout(() => setToast(void 0), 5e3);
66
- return () => clearTimeout(t2);
67
- };
68
- const handleDownload = async () => {
69
- const data = await client.diagnostics();
70
- const file = new Blob([
71
- JSON.stringify(data, void 0, 2)
72
- ], {
73
- type: "text/plain"
74
- });
75
- const fileName = `composer-${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`;
76
- download(file, fileName);
77
- if (fileManagerPlugin?.provides.file.upload) {
78
- const info = await fileManagerPlugin.provides.file.upload(new File([
79
- file
80
- ], fileName), client.spaces.default);
81
- if (!info) {
82
- log.error("diagnostics failed to upload to IPFS", void 0, {
83
- F: __dxlog_file,
84
- L: 58,
85
- S: void 0,
86
- C: (f, a) => f(...a)
87
- });
88
- return;
89
- }
90
- handleToast({
91
- title: t("settings uploaded"),
92
- description: t("settings uploaded to clipboard")
93
- });
94
- const url = client.config.values.runtime.services.ipfs.gateway + "/" + info.cid;
95
- void navigator.clipboard.writeText(url);
96
- handleToast({
97
- title: t("settings uploaded"),
98
- description: t("settings uploaded to clipboard")
99
- });
100
- log.info("diagnostics", {
101
- url
102
- }, {
103
- F: __dxlog_file,
104
- L: 67,
105
- S: void 0,
106
- C: (f, a) => f(...a)
107
- });
108
- }
109
- };
110
- const handleRepair = async () => {
111
- try {
112
- const info = await client.repair();
113
- setStorageConfig(await Storage());
114
- handleToast({
115
- title: t("settings repair success"),
116
- description: JSON.stringify(info, void 0, 2)
117
- });
118
- } catch (err) {
119
- handleToast({
120
- title: t("settings repair failed"),
121
- description: err.message
122
- });
123
- }
124
- };
125
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
126
- label: t("settings show debug panel")
127
- }, /* @__PURE__ */ React2.createElement(Input.Switch, {
128
- checked: settings.debug,
129
- onCheckedChange: (checked) => settings.debug = !!checked
130
- })), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
131
- label: t("settings show devtools panel")
132
- }, /* @__PURE__ */ React2.createElement(Input.Switch, {
133
- checked: settings.devtools,
134
- onCheckedChange: (checked) => settings.devtools = !!checked
135
- })), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
136
- label: t("settings wireframe")
137
- }, /* @__PURE__ */ React2.createElement(Input.Switch, {
138
- checked: settings.wireframe,
139
- onCheckedChange: (checked) => settings.wireframe = !!checked
140
- })), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
141
- label: t("settings download diagnostics")
142
- }, /* @__PURE__ */ React2.createElement(Button, {
143
- onClick: handleDownload
144
- }, /* @__PURE__ */ React2.createElement(DownloadSimple, {
145
- className: getSize(5)
146
- }))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
147
- label: t("settings repair")
148
- }, /* @__PURE__ */ React2.createElement(Button, {
149
- onClick: handleRepair
150
- }, /* @__PURE__ */ React2.createElement(FirstAidKit, {
151
- className: getSize(5)
152
- }))), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Gift, {
153
- className: mx(getSize(5), "inline mr-1"),
154
- weight: "duotone"
155
- }), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
156
- label: t("settings choose storage adaptor")
157
- }, /* @__PURE__ */ React2.createElement(Select.Root, {
158
- value: Object.entries(StorageAdapters).find(([name2, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
159
- onValueChange: (value) => {
160
- if (confirm(t("settings storage adapter changed alert"))) {
161
- updateConfig(storageConfig, setStorageConfig, [
162
- "runtime",
163
- "client",
164
- "storage",
165
- "dataStore"
166
- ], StorageAdapters[value]);
167
- }
168
- }
169
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
170
- placeholder: t("settings data store label")
171
- }), /* @__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, {
172
- key,
173
- value: key
174
- }, t(`settings storage adaptor ${key} label`)))))))));
175
- };
176
- var updateConfig = (config, setConfig, path, value) => {
177
- const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
178
- setDeep(storageConfigCopy, path, value);
179
- setConfig(storageConfigCopy);
180
- queueMicrotask(async () => {
181
- await SaveConfig(storageConfigCopy);
182
- });
183
- };
184
-
185
- // packages/plugins/plugin-debug/src/components/DebugStatus.tsx
186
- import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
187
- import { firstIdInPart, parseGraphPlugin, parseNavigationPlugin, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
188
- import { TimeoutError } from "@dxos/async";
189
- import { StatsPanel, useStats } from "@dxos/devtools";
190
- import { log as log2 } from "@dxos/log";
191
- import { getActiveSpace } from "@dxos/plugin-space";
192
- import { StatusBar } from "@dxos/plugin-status-bar";
193
- import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
194
- import { useNetworkStatus } from "@dxos/react-client/mesh";
195
- import { Icon } from "@dxos/react-ui";
196
- import { mx as mx2 } from "@dxos/react-ui-theme";
197
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugStatus.tsx";
198
- var styles = {
199
- success: "text-sky-300 dark:text-green-700",
200
- warning: "text-orange-300 dark:text-orange-600",
201
- error: "text-red-300 dark:text-red-600"
202
- };
203
- var ErrorIndicator = () => {
204
- const [, forceUpdate] = useState2({});
205
- const errorRef = useRef();
206
- useEffect2(() => {
207
- const errorListener = (event) => {
208
- const error = event.error ?? event.reason;
209
- if (errorRef.current !== error) {
210
- log2.error("onError", {
211
- event
212
- }, {
213
- F: __dxlog_file2,
214
- L: 73,
215
- S: void 0,
216
- C: (f, a) => f(...a)
217
- });
218
- errorRef.current = error;
219
- forceUpdate({});
220
- }
221
- };
222
- window.addEventListener("error", errorListener);
223
- window.addEventListener("unhandledrejection", errorListener);
224
- return () => {
225
- window.removeEventListener("error", errorListener);
226
- window.removeEventListener("unhandledrejection", errorListener);
227
- };
228
- }, []);
229
- const handleReset = () => {
230
- errorRef.current = void 0;
231
- forceUpdate({});
232
- };
233
- if (errorRef.current) {
234
- return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
235
- title: errorRef.current.message,
236
- onClick: handleReset
237
- }, /* @__PURE__ */ React3.createElement(Icon, {
238
- icon: "ph--warning-circle--duotone",
239
- size: 4,
240
- classNames: styles.error
241
- }));
242
- } else {
243
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
244
- title: "No errors."
245
- }, /* @__PURE__ */ React3.createElement(Icon, {
246
- icon: "ph--check--regular",
247
- size: 4
248
- }));
249
- }
250
- };
251
- var SwarmIndicator = () => {
252
- const [state, setState] = useState2(0);
253
- const { swarm } = useNetworkStatus();
254
- useEffect2(() => {
255
- setState(swarm === ConnectionState.ONLINE ? 0 : 1);
256
- }, [
257
- swarm
258
- ]);
259
- if (state === 0) {
260
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
261
- title: "Connected to swarm."
262
- }, /* @__PURE__ */ React3.createElement(Icon, {
263
- icon: "ph--lightning--regular",
264
- size: 4
265
- }));
266
- } else {
267
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
268
- title: "Disconnected from swarm."
269
- }, /* @__PURE__ */ React3.createElement(Icon, {
270
- icon: "ph--lightning-slash--regular",
271
- size: 4,
272
- classNames: styles.warning
273
- }));
274
- }
275
- };
276
- var SavingIndicator = () => {
277
- const [state, _setState] = useState2(0);
278
- const navigationPlugin = useResolvePlugin2(parseNavigationPlugin);
279
- const graphPlugin = useResolvePlugin2(parseGraphPlugin);
280
- const location2 = navigationPlugin?.provides.location;
281
- const graph = graphPlugin?.provides.graph;
282
- const _space = location2 && graph ? getActiveSpace(graph, firstIdInPart(location2.active, "main")) : void 0;
283
- switch (state) {
284
- case 2:
285
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
286
- title: "Edit not saved."
287
- }, /* @__PURE__ */ React3.createElement(Icon, {
288
- icon: "ph--circle--duotone",
289
- size: 4,
290
- classNames: styles.warning
291
- }));
292
- case 1:
293
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
294
- title: "Saving..."
295
- }, /* @__PURE__ */ React3.createElement(Icon, {
296
- icon: "ph--circle--duotone",
297
- size: 4,
298
- classNames: styles.success
299
- }));
300
- case 0:
301
- default:
302
- return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
303
- title: "Modified indicator."
304
- }, /* @__PURE__ */ React3.createElement(Icon, {
305
- icon: "ph--circle--duotone",
306
- size: 4
307
- }));
308
- }
309
- };
310
- var PerformanceIndicator = () => {
311
- const [visible, setVisible] = useState2(false);
312
- const [stats, refreshStats] = useStats();
313
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
314
- onClick: () => setVisible((visible2) => !visible2),
315
- title: "Performance panels"
316
- }, /* @__PURE__ */ React3.createElement(Icon, {
317
- icon: "ph--chart-bar--regular",
318
- size: 4
319
- })), visible && /* @__PURE__ */ React3.createElement("div", {
320
- className: mx2("z-20 absolute bottom-[--statusbar-size] right-4 w-[450px]", "overflow-x-hidden overflow-y-auto scrollbar-thin", "border-x border-y border-separator")
321
- }, /* @__PURE__ */ React3.createElement(StatsPanel, {
322
- stats,
323
- onRefresh: refreshStats
324
- })));
325
- };
326
- var indicators = [
327
- SavingIndicator,
328
- SwarmIndicator,
329
- PerformanceIndicator,
330
- ErrorIndicator
331
- ];
332
- var DebugStatus = () => {
333
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React3.createElement(Indicator, {
334
- key: Indicator.name
335
- })));
336
- };
7
+ import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
8
+ import { DeckCapabilities, DeckEvents } from "@dxos/plugin-deck";
9
+ import { isEchoObject, getSpace } from "@dxos/react-client/echo";
337
10
 
338
- // packages/plugins/plugin-debug/src/components/Wireframe.tsx
339
- import React4 from "react";
340
- import { useResizeDetector } from "react-resize-detector";
341
- import { fullyQualifiedId } from "@dxos/react-client/echo";
342
- import { useAttendableAttributes } from "@dxos/react-ui-attention";
343
- import { SyntaxHighlighter as SyntaxHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
344
- import { mx as mx3 } from "@dxos/react-ui-theme";
345
- var Wireframe = ({ classNames, label, object }) => {
346
- const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));
347
- const { width, height, ref } = useResizeDetector();
348
- return /* @__PURE__ */ React4.createElement("div", {
349
- ref,
350
- className: mx3("relative grow min-bs-96", classNames),
351
- ...attendableAttrs
352
- }, /* @__PURE__ */ React4.createElement("div", {
353
- className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
354
- }, /* @__PURE__ */ React4.createElement("div", {
355
- className: "flex justify-between"
356
- }, /* @__PURE__ */ React4.createElement("div", null, label), /* @__PURE__ */ React4.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React4.createElement(SyntaxHighlighter2, {
357
- language: "json",
358
- classNames: "flex w-full text-xs opacity-75 rounded"
359
- }, JSON.stringify(object, void 0, 2))), /* @__PURE__ */ React4.createElement("svg", {
360
- width,
361
- height,
362
- className: "bg-transparent [&>*]:text-subdued"
363
- }, /* @__PURE__ */ React4.createElement("rect", {
364
- x: 0,
365
- y: 0,
366
- width,
367
- height,
368
- strokeWidth: 1,
369
- fill: "none"
370
- }), /* @__PURE__ */ React4.createElement("line", {
371
- x1: 0,
372
- y1: 0,
373
- x2: width,
374
- y2: height,
375
- strokeWidth: 1
376
- }), /* @__PURE__ */ React4.createElement("line", {
377
- x1: 0,
378
- y1: height,
379
- x2: width,
380
- y2: 0,
381
- strokeWidth: 1
382
- })));
383
- };
384
-
385
- // packages/plugins/plugin-debug/src/components/index.ts
386
- var DebugApp = lazy(() => import("./DebugApp-HCHR6GKO.mjs"));
387
- var DebugSpace = lazy(() => import("./DebugSpace-V3K3PQP6.mjs"));
388
- var SpaceGenerator = lazy(() => import("./SpaceGenerator-Y2NXBQVR.mjs"));
11
+ // packages/plugins/plugin-debug/src/capabilities/index.ts
12
+ import { lazy } from "@dxos/app-framework";
13
+ var AppGraphBuilder = lazy(() => import("./app-graph-builder-BZFZ6UG6.mjs"));
14
+ var ReactContext = lazy(() => import("./react-context-TCD3MNIT.mjs"));
15
+ var ReactSurface = lazy(() => import("./react-surface-W6QLG4YJ.mjs"));
16
+ var DebugSettings = lazy(() => import("./settings-INPXR64L.mjs"));
389
17
 
390
18
  // packages/plugins/plugin-debug/src/translations.ts
391
19
  var translations_default = [
@@ -413,346 +41,102 @@ var translations_default = [
413
41
  "settings data store label": "Data Store",
414
42
  "settings storage adapter changed alert": "Warning: Swapping the storage adapter will make your data unavailable.",
415
43
  "settings space fragmentation": "Enable AM space fragmentation",
416
- "open debug panel label": "Show Debug"
44
+ "open debug panel label": "Show Debug",
45
+ "client label": "Client",
46
+ "config label": "Config",
47
+ "storage label": "Storage",
48
+ "logs label": "Logs",
49
+ "diagnostics label": "Diagnostics",
50
+ "tracing label": "Tracing",
51
+ "halo label": "HALO",
52
+ "identity label": "Identity",
53
+ "devices label": "Devices",
54
+ "keyring label": "Keyring",
55
+ "credentials label": "Credentials",
56
+ "echo label": "ECHO",
57
+ "spaces label": "Spaces",
58
+ "space label": "Space",
59
+ "feeds label": "Feeds",
60
+ "objects label": "Objects",
61
+ "automerge label": "Automerge",
62
+ "members label": "Members",
63
+ "metadata label": "Metadata",
64
+ "mesh label": "Mesh",
65
+ "signal label": "Signal",
66
+ "swarm label": "Swarm",
67
+ "network label": "Network",
68
+ "agent label": "Agent",
69
+ "dashboard label": "Dashboard",
70
+ "search label": "Search",
71
+ "edge label": "Edge",
72
+ "workflows label": "Workflows"
417
73
  }
418
74
  }
419
75
  }
420
76
  ];
421
77
 
422
78
  // packages/plugins/plugin-debug/src/DebugPlugin.tsx
423
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/DebugPlugin.tsx";
424
- var isSpaceDebug = (data) => data.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
425
- var isGraphDebug = (data) => data.graph instanceof Graph;
426
- var DebugPlugin = definePlugin((context) => {
427
- const settings = create({
428
- debug: true,
429
- devtools: true
430
- });
431
- return {
432
- meta: meta_default,
433
- ready: async ({ plugins }) => {
434
- context.init(plugins);
435
- context.resolvePlugin(parseSettingsPlugin).provides.settingsStore.createStore({
436
- schema: DebugSettingsSchema,
437
- prefix: DEBUG_PLUGIN,
438
- value: settings
439
- });
440
- const composer = window.composer;
441
- composer.changeStorageVersionInMetadata = async (version) => {
442
- const { changeStorageVersionInMetadata } = await import("@dxos/echo-pipeline/testing");
443
- const { createStorageObjects } = await import("@dxos/client-services");
444
- const client = window.dxos.client;
445
- const config = client.config;
446
- await client.destroy();
447
- const { storage } = createStorageObjects(config.values?.runtime?.client?.storage ?? {});
448
- await changeStorageVersionInMetadata(storage, version);
449
- location.pathname = "/";
450
- };
451
- },
452
- unload: async () => {
453
- context.dispose();
454
- },
455
- provides: {
456
- settings,
457
- translations: translations_default,
458
- complementary: {
459
- panels: [
79
+ var DebugPlugin = () => {
80
+ setupDevtools();
81
+ return definePlugin(meta, [
82
+ defineModule({
83
+ id: `${meta.id}/module/settings`,
84
+ activatesOn: Events.SetupSettings,
85
+ activate: DebugSettings
86
+ }),
87
+ defineModule({
88
+ id: `${meta.id}/module/translations`,
89
+ activatesOn: Events.SetupTranslations,
90
+ activate: () => contributes(Capabilities.Translations, translations_default)
91
+ }),
92
+ defineModule({
93
+ id: `${meta.id}/module/complementary-panel`,
94
+ activatesOn: DeckEvents.SetupComplementaryPanels,
95
+ activate: () => contributes(DeckCapabilities.ComplementaryPanel, {
96
+ id: "debug",
97
+ label: [
98
+ "debug label",
460
99
  {
461
- id: "debug",
462
- label: [
463
- "open debug panel label",
464
- {
465
- ns: DEBUG_PLUGIN
466
- }
467
- ],
468
- icon: "ph--bug--regular"
469
- }
470
- ]
471
- },
472
- context: ({ children }) => {
473
- const [timer, setTimer] = useState3();
474
- useEffect3(() => timer?.state.on((value) => !value && setTimer(void 0)), [
475
- timer
476
- ]);
477
- useEffect3(() => {
478
- timer?.stop();
479
- }, []);
480
- return /* @__PURE__ */ React5.createElement(DebugContext.Provider, {
481
- value: {
482
- running: !!timer,
483
- start: (cb, options) => {
484
- timer?.stop();
485
- setTimer(new Timer(cb).start(options));
486
- },
487
- stop: () => timer?.stop()
100
+ ns: DEBUG_PLUGIN
488
101
  }
489
- }, children);
490
- },
491
- graph: {
492
- builder: (plugins) => {
493
- const clientPlugin = resolvePlugin(plugins, parseClientPlugin);
494
- const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
495
- const graphPlugin = resolvePlugin(plugins, parseGraphPlugin2);
496
- const resolve = metadataPlugin?.provides.metadata.resolver;
497
- const client = clientPlugin?.provides.client;
498
- invariant(resolve, void 0, {
499
- F: __dxlog_file3,
500
- L: 130,
501
- S: void 0,
502
- A: [
503
- "resolve",
504
- ""
505
- ]
506
- });
507
- invariant(client, void 0, {
508
- F: __dxlog_file3,
509
- L: 131,
510
- S: void 0,
511
- A: [
512
- "client",
513
- ""
514
- ]
515
- });
516
- return [
517
- // Devtools node.
518
- createExtension({
519
- id: "dxos.org/plugin/debug/devtools",
520
- filter: (node) => !!settings.devtools && node.id === "root",
521
- connector: () => [
522
- {
523
- // TODO(zan): Removed `/` because it breaks deck layout reload. Fix?
524
- id: "dxos.org.plugin.debug.devtools",
525
- data: "devtools",
526
- type: "dxos.org/plugin/debug/devtools",
527
- properties: {
528
- label: [
529
- "devtools label",
530
- {
531
- ns: DEBUG_PLUGIN
532
- }
533
- ],
534
- icon: "ph--hammer--regular"
535
- }
536
- }
537
- ]
538
- }),
539
- // Debug node.
540
- createExtension({
541
- id: "dxos.org/plugin/debug/debug",
542
- filter: (node) => !!settings.debug && node.id === "root",
543
- connector: () => [
544
- {
545
- id: "dxos.org/plugin/debug/debug",
546
- type: "dxos.org/plugin/debug/debug",
547
- data: {
548
- graph: graphPlugin?.provides.graph
549
- },
550
- properties: {
551
- label: [
552
- "debug label",
553
- {
554
- ns: DEBUG_PLUGIN
555
- }
556
- ],
557
- icon: "ph--bug--regular"
558
- }
559
- }
560
- ]
561
- }),
562
- // Space debug nodes.
563
- createExtension({
564
- id: "dxos.org/plugin/debug/spaces",
565
- filter: (node) => !!settings.debug && isSpace(node.data),
566
- connector: ({ node }) => {
567
- const space = node.data;
568
- const state = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
569
- if (state !== SpaceState.SPACE_READY) {
570
- return;
571
- }
572
- const collection = space.properties[CollectionType.typename]?.target;
573
- if (!collection) {
574
- return;
575
- }
576
- return [
577
- {
578
- id: `${space.id}-debug`,
579
- type: "dxos.org/plugin/debug/space",
580
- data: {
581
- space,
582
- type: "dxos.org/plugin/debug/space"
583
- },
584
- properties: {
585
- label: [
586
- "debug label",
587
- {
588
- ns: DEBUG_PLUGIN
589
- }
590
- ],
591
- icon: "ph--bug--regular"
592
- }
593
- }
594
- ];
595
- }
596
- }),
597
- // Create nodes for debug sidebar.
598
- createExtension({
599
- id: `${DEBUG_PLUGIN}/debug-for-subject`,
600
- resolver: ({ id }) => {
601
- if (!id.endsWith("~debug")) {
602
- return;
603
- }
604
- const type = "orphan-settings-for-subject";
605
- const icon = "ph--bug--regular";
606
- const [subjectId] = id.split("~");
607
- const { spaceId, objectId } = parseId(subjectId);
608
- const spaces = toSignal((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
609
- const space = spaces?.find((space2) => space2.state.get() === SpaceState.SPACE_READY && space2.id === spaceId);
610
- if (!objectId) {
611
- const label2 = space ? space.properties.name || [
612
- "unnamed space label",
613
- {
614
- ns: DEBUG_PLUGIN
615
- }
616
- ] : [
617
- "unnamed object settings label",
618
- {
619
- ns: DEBUG_PLUGIN
620
- }
621
- ];
622
- return {
623
- id,
624
- type,
625
- data: null,
626
- properties: {
627
- icon,
628
- label: label2,
629
- showResolvedThreads: false,
630
- object: null,
631
- space
632
- }
633
- };
634
- }
635
- const [object] = memoizeQuery(space, {
636
- id: objectId
637
- });
638
- if (!object || !subjectId) {
639
- return;
640
- }
641
- const meta = resolve(getTypename(object) ?? "");
642
- const label = meta.label?.(object) || object.name || meta.placeholder || [
643
- "unnamed object settings label",
644
- {
645
- ns: DEBUG_PLUGIN
646
- }
647
- ];
648
- return {
649
- id,
650
- type,
651
- data: null,
652
- properties: {
653
- icon,
654
- label,
655
- object
656
- }
657
- };
658
- }
659
- })
660
- ];
661
- }
662
- },
663
- surface: {
664
- definitions: () => [
665
- createSurface({
666
- id: `${DEBUG_PLUGIN}/settings`,
667
- role: "settings",
668
- filter: (data) => data.subject === DEBUG_PLUGIN,
669
- component: () => /* @__PURE__ */ React5.createElement(DebugSettings, {
670
- settings
671
- })
672
- }),
673
- createSurface({
674
- id: `${DEBUG_PLUGIN}/status`,
675
- role: "status",
676
- component: () => /* @__PURE__ */ React5.createElement(DebugStatus, null)
677
- }),
678
- createSurface({
679
- id: `${DEBUG_PLUGIN}/complementary`,
680
- role: "complementary--debug",
681
- filter: (data) => isEchoObject(data.subject),
682
- component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
683
- object: data.subject
684
- })
685
- }),
686
- createSurface({
687
- id: `${DEBUG_PLUGIN}/devtools`,
688
- role: "article",
689
- filter: (data) => data.subject === "devtools" && !!settings.devtools,
690
- component: () => /* @__PURE__ */ React5.createElement(Devtools, null)
691
- }),
692
- createSurface({
693
- id: `${DEBUG_PLUGIN}/space`,
694
- role: "article",
695
- filter: (data) => isSpaceDebug(data.subject),
696
- component: ({ data }) => {
697
- const handleCreateObject = useCallback((objects) => {
698
- if (!isSpace(data.subject.space)) {
699
- return;
700
- }
701
- const collection = data.subject.space.state.get() === SpaceState.SPACE_READY && data.subject.space.properties[CollectionType.typename]?.target;
702
- if (!(collection instanceof CollectionType)) {
703
- return;
704
- }
705
- objects.forEach((object) => {
706
- void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatchPromise(createIntent(SpaceAction.AddObject, {
707
- target: collection,
708
- object
709
- }));
710
- });
711
- }, [
712
- data.subject.space
713
- ]);
714
- const deprecated = false;
715
- return deprecated ? /* @__PURE__ */ React5.createElement(DebugSpace, {
716
- space: data.subject.space,
717
- onAddObjects: handleCreateObject
718
- }) : /* @__PURE__ */ React5.createElement(SpaceGenerator, {
719
- space: data.subject.space,
720
- onCreateObjects: handleCreateObject
721
- });
722
- }
723
- }),
724
- createSurface({
725
- id: `${DEBUG_PLUGIN}/graph`,
726
- role: "article",
727
- filter: (data) => isGraphDebug(data.subject),
728
- component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugApp, {
729
- graph: data.subject.graph
730
- })
731
- }),
732
- createSurface({
733
- id: `${DEBUG_PLUGIN}/wireframe`,
734
- role: [
735
- "article",
736
- "section"
737
- ],
738
- disposition: "hoist",
739
- filter: (data) => isEchoObject(data.subject) && !!settings.wireframe,
740
- component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
741
- label: `${role}:${name}`,
742
- object: data.subject,
743
- classNames: "row-span-2 overflow-hidden"
744
- })
745
- })
746
- ]
747
- }
748
- }
102
+ ],
103
+ icon: "ph--bug--regular",
104
+ filter: (node) => isEchoObject(node.data) && !!getSpace(node.data)
105
+ })
106
+ }),
107
+ defineModule({
108
+ id: `${meta.id}/module/react-context`,
109
+ activatesOn: Events.Startup,
110
+ activate: ReactContext
111
+ }),
112
+ defineModule({
113
+ id: `${meta.id}/module/react-surface`,
114
+ activatesOn: Events.SetupReactSurface,
115
+ activate: ReactSurface
116
+ }),
117
+ defineModule({
118
+ id: `${meta.id}/module/app-graph-builder`,
119
+ activatesOn: Events.SetupAppGraph,
120
+ activate: AppGraphBuilder
121
+ })
122
+ ]);
123
+ };
124
+ var setupDevtools = () => {
125
+ globalThis.composer ??= {};
126
+ globalThis.composer.changeStorageVersionInMetadata = async (version) => {
127
+ const { changeStorageVersionInMetadata } = await import("@dxos/echo-pipeline/testing");
128
+ const { createStorageObjects } = await import("@dxos/client-services");
129
+ const client = window.dxos.client;
130
+ const config = client.config;
131
+ await client.destroy();
132
+ const { storage } = createStorageObjects(config.values?.runtime?.client?.storage ?? {});
133
+ await changeStorageVersionInMetadata(storage, version);
134
+ location.pathname = "/";
749
135
  };
750
- });
751
-
752
- // packages/plugins/plugin-debug/src/index.ts
753
- var src_default = DebugPlugin;
136
+ };
754
137
  export {
138
+ DEBUG_PLUGIN,
755
139
  DebugPlugin,
756
- src_default as default
140
+ meta
757
141
  };
758
142
  //# sourceMappingURL=index.mjs.map