@dxos/plugin-debug 0.6.13 → 0.6.14-main.69511f5

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 (68) hide show
  1. package/dist/lib/browser/{DebugGlobal-H56M2VL4.mjs → DebugGlobal-ZTCBF3XR.mjs} +5 -5
  2. package/dist/lib/browser/{DebugSpace-NHPMLATA.mjs → DebugSpace-I6BNZKI2.mjs} +16 -41
  3. package/dist/lib/browser/DebugSpace-I6BNZKI2.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-2HTS7SNO.mjs +17 -0
  5. package/dist/lib/browser/chunk-2HTS7SNO.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-ED5L5YYI.mjs → chunk-H3BJHVRD.mjs} +5 -8
  7. package/dist/lib/browser/chunk-H3BJHVRD.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-RYK3J66D.mjs → chunk-NHHLZV45.mjs} +11 -4
  9. package/dist/lib/browser/chunk-NHHLZV45.mjs.map +7 -0
  10. package/dist/lib/browser/index.mjs +248 -144
  11. package/dist/lib/browser/index.mjs.map +4 -4
  12. package/dist/lib/browser/meta.json +1 -1
  13. package/dist/lib/browser/meta.mjs +1 -1
  14. package/dist/types/src/DebugPlugin.d.ts +1 -3
  15. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  16. package/dist/types/src/components/DebugObjectPanel.d.ts +7 -0
  17. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -0
  18. package/dist/types/src/components/DebugPanel.d.ts +3 -3
  19. package/dist/types/src/components/DebugPanel.d.ts.map +1 -1
  20. package/dist/types/src/components/DebugSpace.stories.d.ts +3 -13
  21. package/dist/types/src/components/DebugSpace.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
  23. package/dist/types/src/components/ObjectCreator.d.ts +5 -5
  24. package/dist/types/src/components/ObjectCreator.d.ts.map +1 -1
  25. package/dist/types/src/components/ObjectCreator.stories.d.ts +3 -14
  26. package/dist/types/src/components/ObjectCreator.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/SurfaceDebug.d.ts +9 -0
  28. package/dist/types/src/components/SurfaceDebug.d.ts.map +1 -0
  29. package/dist/types/src/components/Wireframe.d.ts +5 -4
  30. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  31. package/dist/types/src/components/index.d.ts +3 -4
  32. package/dist/types/src/components/index.d.ts.map +1 -1
  33. package/dist/types/src/meta.d.ts +4 -9
  34. package/dist/types/src/meta.d.ts.map +1 -1
  35. package/dist/types/src/scaffolding/generator.d.ts +1 -2
  36. package/dist/types/src/scaffolding/generator.d.ts.map +1 -1
  37. package/dist/types/src/types.d.ts +8 -5
  38. package/dist/types/src/types.d.ts.map +1 -1
  39. package/package.json +45 -47
  40. package/src/DebugPlugin.tsx +134 -47
  41. package/src/components/DebugObjectPanel.tsx +22 -0
  42. package/src/components/DebugPanel.tsx +4 -9
  43. package/src/components/DebugSettings.tsx +13 -13
  44. package/src/components/DebugSpace.stories.tsx +6 -3
  45. package/src/components/DebugStatus.tsx +20 -13
  46. package/src/components/ObjectCreator.stories.tsx +13 -10
  47. package/src/components/ObjectCreator.tsx +12 -21
  48. package/src/components/SurfaceDebug.tsx +55 -0
  49. package/src/components/Wireframe.tsx +20 -11
  50. package/src/components/index.ts +4 -5
  51. package/src/meta.ts +15 -0
  52. package/src/scaffolding/generator.ts +4 -15
  53. package/src/types.ts +10 -5
  54. package/dist/lib/browser/DebugSpace-NHPMLATA.mjs.map +0 -7
  55. package/dist/lib/browser/DevtoolsMain-RWT3FLJ6.mjs +0 -15
  56. package/dist/lib/browser/DevtoolsMain-RWT3FLJ6.mjs.map +0 -7
  57. package/dist/lib/browser/chunk-ED5L5YYI.mjs.map +0 -7
  58. package/dist/lib/browser/chunk-RYK3J66D.mjs.map +0 -7
  59. package/dist/lib/browser/chunk-WEGYHXMB.mjs +0 -21
  60. package/dist/lib/browser/chunk-WEGYHXMB.mjs.map +0 -7
  61. package/dist/types/src/components/DevtoolsMain.d.ts +0 -4
  62. package/dist/types/src/components/DevtoolsMain.d.ts.map +0 -1
  63. package/dist/types/src/types.test.d.ts +0 -2
  64. package/dist/types/src/types.test.d.ts.map +0 -1
  65. package/src/components/DevtoolsMain.tsx +0 -15
  66. package/src/meta.tsx +0 -19
  67. package/src/types.test.ts +0 -13
  68. /package/dist/lib/browser/{DebugGlobal-H56M2VL4.mjs.map → DebugGlobal-ZTCBF3XR.mjs.map} +0 -0
@@ -1,40 +1,55 @@
1
1
  import {
2
2
  DebugAction,
3
- DebugContext
4
- } from "./chunk-RYK3J66D.mjs";
3
+ DebugContext,
4
+ DebugSettingsSchema
5
+ } from "./chunk-NHHLZV45.mjs";
5
6
  import {
6
7
  DEBUG_PLUGIN,
7
8
  meta_default
8
- } from "./chunk-WEGYHXMB.mjs";
9
+ } from "./chunk-2HTS7SNO.mjs";
9
10
 
10
- // packages/plugins/experimental/plugin-debug/src/DebugPlugin.tsx
11
- import { Bug, Hammer } from "@phosphor-icons/react";
11
+ // packages/plugins/plugin-debug/src/DebugPlugin.tsx
12
12
  import React5, { useEffect as useEffect3, useState as useState3 } from "react";
13
- import { getPlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
13
+ import { definePlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, parseMetadataResolverPlugin, parseSettingsPlugin, resolvePlugin } from "@dxos/app-framework";
14
14
  import { Timer } from "@dxos/async";
15
- import { LocalStorageStore } from "@dxos/local-storage";
16
- import { createExtension, Graph } from "@dxos/plugin-graph";
15
+ import { Devtools } from "@dxos/devtools";
16
+ import { invariant } from "@dxos/invariant";
17
+ import { parseClientPlugin } from "@dxos/plugin-client";
18
+ import { createExtension, Graph, toSignal } from "@dxos/plugin-graph";
17
19
  import { SpaceAction } from "@dxos/plugin-space";
18
20
  import { CollectionType } from "@dxos/plugin-space/types";
19
- import { SpaceState, isSpace } from "@dxos/react-client/echo";
21
+ import { create, getTypename, isEchoObject, isSpace, parseId, SpaceState } from "@dxos/react-client/echo";
20
22
  import { Main } from "@dxos/react-ui";
21
- import { baseSurface, topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from "@dxos/react-ui-theme";
23
+ import { baseSurface, bottombarBlockPaddingEnd, fixedInsetFlexLayout, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
22
24
 
23
- // packages/plugins/experimental/plugin-debug/src/components/index.ts
24
- import React4 from "react";
25
+ // packages/plugins/plugin-debug/src/components/index.ts
26
+ import { lazy } from "react";
27
+
28
+ // packages/plugins/plugin-debug/src/components/DebugObjectPanel.tsx
29
+ import React from "react";
30
+ import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
31
+ var DebugObjectPanel = ({ object }) => {
32
+ return /* @__PURE__ */ React.createElement("div", {
33
+ role: "form",
34
+ className: "flex flex-col"
35
+ }, /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
36
+ classNames: "flex text-xs",
37
+ language: "json"
38
+ }, JSON.stringify(object, null, 2)));
39
+ };
25
40
 
26
- // packages/plugins/experimental/plugin-debug/src/components/DebugSettings.tsx
41
+ // packages/plugins/plugin-debug/src/components/DebugSettings.tsx
27
42
  import { Gift, DownloadSimple, FirstAidKit } from "@phosphor-icons/react";
28
- import React, { useEffect, useState } from "react";
43
+ import React2, { useEffect, useState } from "react";
29
44
  import { parseFileManagerPlugin, useResolvePlugin } from "@dxos/app-framework";
30
45
  import { defs, SaveConfig, Storage } from "@dxos/config";
31
46
  import { log } from "@dxos/log";
32
- import { SettingsValue } from "@dxos/plugin-settings";
33
47
  import { useClient } from "@dxos/react-client";
34
48
  import { useTranslation, Button, Toast, Input, useFileDownload, Select } from "@dxos/react-ui";
49
+ import { FormInput } from "@dxos/react-ui-data";
35
50
  import { getSize, mx } from "@dxos/react-ui-theme";
36
51
  import { setDeep } from "@dxos/util";
37
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-debug/src/components/DebugSettings.tsx";
52
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugSettings.tsx";
38
53
  var StorageAdapters = {
39
54
  opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
40
55
  idb: defs.Runtime.Client.Storage.StorageDriver.IDB
@@ -111,39 +126,39 @@ var DebugSettings = ({ settings }) => {
111
126
  });
112
127
  }
113
128
  };
114
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SettingsValue, {
129
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(FormInput, {
115
130
  label: t("settings show debug panel")
116
- }, /* @__PURE__ */ React.createElement(Input.Switch, {
131
+ }, /* @__PURE__ */ React2.createElement(Input.Switch, {
117
132
  checked: settings.debug,
118
133
  onCheckedChange: (checked) => settings.debug = !!checked
119
- })), /* @__PURE__ */ React.createElement(SettingsValue, {
134
+ })), /* @__PURE__ */ React2.createElement(FormInput, {
120
135
  label: t("settings show devtools panel")
121
- }, /* @__PURE__ */ React.createElement(Input.Switch, {
136
+ }, /* @__PURE__ */ React2.createElement(Input.Switch, {
122
137
  checked: settings.devtools,
123
138
  onCheckedChange: (checked) => settings.devtools = !!checked
124
- })), /* @__PURE__ */ React.createElement(SettingsValue, {
139
+ })), /* @__PURE__ */ React2.createElement(FormInput, {
125
140
  label: t("settings wireframe")
126
- }, /* @__PURE__ */ React.createElement(Input.Switch, {
141
+ }, /* @__PURE__ */ React2.createElement(Input.Switch, {
127
142
  checked: settings.wireframe,
128
143
  onCheckedChange: (checked) => settings.wireframe = !!checked
129
- })), /* @__PURE__ */ React.createElement(SettingsValue, {
144
+ })), /* @__PURE__ */ React2.createElement(FormInput, {
130
145
  label: t("settings download diagnostics")
131
- }, /* @__PURE__ */ React.createElement(Button, {
146
+ }, /* @__PURE__ */ React2.createElement(Button, {
132
147
  onClick: handleDownload
133
- }, /* @__PURE__ */ React.createElement(DownloadSimple, {
148
+ }, /* @__PURE__ */ React2.createElement(DownloadSimple, {
134
149
  className: getSize(5)
135
- }))), /* @__PURE__ */ React.createElement(SettingsValue, {
150
+ }))), /* @__PURE__ */ React2.createElement(FormInput, {
136
151
  label: t("settings repair")
137
- }, /* @__PURE__ */ React.createElement(Button, {
152
+ }, /* @__PURE__ */ React2.createElement(Button, {
138
153
  onClick: handleRepair
139
- }, /* @__PURE__ */ React.createElement(FirstAidKit, {
154
+ }, /* @__PURE__ */ React2.createElement(FirstAidKit, {
140
155
  className: getSize(5)
141
- }))), toast && /* @__PURE__ */ React.createElement(Toast.Root, null, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, null, /* @__PURE__ */ React.createElement(Gift, {
156
+ }))), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Gift, {
142
157
  className: mx(getSize(5), "inline mr-1"),
143
158
  weight: "duotone"
144
- }), /* @__PURE__ */ React.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React.createElement(SettingsValue, {
159
+ }), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(FormInput, {
145
160
  label: t("settings choose storage adaptor")
146
- }, /* @__PURE__ */ React.createElement(Select.Root, {
161
+ }, /* @__PURE__ */ React2.createElement(Select.Root, {
147
162
  value: Object.entries(StorageAdapters).find(([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
148
163
  onValueChange: (value) => {
149
164
  if (confirm(t("settings storage adapter changed alert"))) {
@@ -155,9 +170,9 @@ var DebugSettings = ({ settings }) => {
155
170
  ], StorageAdapters[value]);
156
171
  }
157
172
  }
158
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
173
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
159
174
  placeholder: t("settings data store label")
160
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, Object.keys(StorageAdapters).map((key) => /* @__PURE__ */ React.createElement(Select.Option, {
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, {
161
176
  key,
162
177
  value: key
163
178
  }, t(`settings storage adaptor ${key} label`)))))))));
@@ -171,9 +186,8 @@ var updateConfig = (config, setConfig, path, value) => {
171
186
  });
172
187
  };
173
188
 
174
- // packages/plugins/experimental/plugin-debug/src/components/DebugStatus.tsx
175
- import { ChartBar, Circle, Lightning, LightningSlash } from "@phosphor-icons/react";
176
- import React2, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
189
+ // packages/plugins/plugin-debug/src/components/DebugStatus.tsx
190
+ import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
177
191
  import { firstIdInPart, parseGraphPlugin, parseNavigationPlugin, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
178
192
  import { TimeoutError } from "@dxos/async";
179
193
  import { StatsPanel, useStats } from "@dxos/devtools";
@@ -182,8 +196,9 @@ import { getActiveSpace } from "@dxos/plugin-space";
182
196
  import { StatusBar } from "@dxos/plugin-status-bar";
183
197
  import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
184
198
  import { useNetworkStatus } from "@dxos/react-client/mesh";
185
- import { getSize as getSize2, mx as mx2 } from "@dxos/react-ui-theme";
186
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-debug/src/components/DebugStatus.tsx";
199
+ import { Icon } from "@dxos/react-ui";
200
+ import { mx as mx2 } from "@dxos/react-ui-theme";
201
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/DebugStatus.tsx";
187
202
  var styles = {
188
203
  success: "text-sky-300 dark:text-green-700",
189
204
  warning: "text-orange-300 dark:text-orange-600",
@@ -220,19 +235,20 @@ var ErrorIndicator = () => {
220
235
  forceUpdate({});
221
236
  };
222
237
  if (errorRef.current) {
223
- return /* @__PURE__ */ React2.createElement(StatusBar.Button, {
238
+ return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
224
239
  title: errorRef.current.message,
225
240
  onClick: handleReset
226
- }, /* @__PURE__ */ React2.createElement(Circle, {
227
- weight: "fill",
228
- className: mx2(styles.error, getSize2(3))
241
+ }, /* @__PURE__ */ React3.createElement(Icon, {
242
+ icon: "ph--warning-circle--duotone",
243
+ size: 4,
244
+ classNames: styles.error
229
245
  }));
230
246
  } else {
231
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
247
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
232
248
  title: "No errors."
233
- }, /* @__PURE__ */ React2.createElement(Circle, {
234
- weight: "fill",
235
- className: getSize2(3)
249
+ }, /* @__PURE__ */ React3.createElement(Icon, {
250
+ icon: "ph--check--regular",
251
+ size: 4
236
252
  }));
237
253
  }
238
254
  };
@@ -245,16 +261,19 @@ var SwarmIndicator = () => {
245
261
  swarm
246
262
  ]);
247
263
  if (state === 0) {
248
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
264
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
249
265
  title: "Connected to swarm."
250
- }, /* @__PURE__ */ React2.createElement(Lightning, {
251
- className: getSize2(4)
266
+ }, /* @__PURE__ */ React3.createElement(Icon, {
267
+ icon: "ph--lightning--regular",
268
+ size: 4
252
269
  }));
253
270
  } else {
254
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
271
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
255
272
  title: "Disconnected from swarm."
256
- }, /* @__PURE__ */ React2.createElement(LightningSlash, {
257
- className: mx2(styles.warning, getSize2(4))
273
+ }, /* @__PURE__ */ React3.createElement(Icon, {
274
+ icon: "ph--lightning-slash--regular",
275
+ size: 4,
276
+ classNames: styles.warning
258
277
  }));
259
278
  }
260
279
  };
@@ -267,92 +286,98 @@ var SavingIndicator = () => {
267
286
  const _space = location2 && graph ? getActiveSpace(graph, firstIdInPart(location2.active, "main")) : void 0;
268
287
  switch (state) {
269
288
  case 2:
270
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
289
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
271
290
  title: "Edit not saved."
272
- }, /* @__PURE__ */ React2.createElement(Circle, {
273
- weight: "fill",
274
- className: mx2(styles.warning, getSize2(3))
291
+ }, /* @__PURE__ */ React3.createElement(Icon, {
292
+ icon: "ph--circle--duotone",
293
+ size: 4,
294
+ classNames: styles.warning
275
295
  }));
276
296
  case 1:
277
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
297
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
278
298
  title: "Saving..."
279
- }, /* @__PURE__ */ React2.createElement(Circle, {
280
- weight: "fill",
281
- className: mx2(styles.success, getSize2(3))
299
+ }, /* @__PURE__ */ React3.createElement(Icon, {
300
+ icon: "ph--circle--duotone",
301
+ size: 4,
302
+ classNames: styles.success
282
303
  }));
283
304
  case 0:
284
305
  default:
285
- return /* @__PURE__ */ React2.createElement(StatusBar.Item, {
306
+ return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
286
307
  title: "Modified indicator."
287
- }, /* @__PURE__ */ React2.createElement(Circle, {
288
- weight: "fill",
289
- className: getSize2(3)
308
+ }, /* @__PURE__ */ React3.createElement(Icon, {
309
+ icon: "ph--circle--duotone",
310
+ size: 4
290
311
  }));
291
312
  }
292
313
  };
293
314
  var PerformanceIndicator = () => {
294
315
  const [visible, setVisible] = useState2(false);
295
316
  const [stats, refreshStats] = useStats();
296
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StatusBar.Button, {
317
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
297
318
  onClick: () => setVisible((visible2) => !visible2),
298
319
  title: "Performance panels"
299
- }, /* @__PURE__ */ React2.createElement(ChartBar, null)), visible && /* @__PURE__ */ React2.createElement("div", {
300
- className: "z-20 absolute bottom-[24px] w-[450px] border-l border-y border-separator"
301
- }, /* @__PURE__ */ React2.createElement(StatsPanel, {
320
+ }, /* @__PURE__ */ React3.createElement(Icon, {
321
+ icon: "ph--chart-bar--regular",
322
+ size: 4
323
+ })), visible && /* @__PURE__ */ React3.createElement("div", {
324
+ 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")
325
+ }, /* @__PURE__ */ React3.createElement(StatsPanel, {
302
326
  stats,
303
327
  onRefresh: refreshStats
304
328
  })));
305
329
  };
306
330
  var indicators = [
307
- PerformanceIndicator,
308
331
  SavingIndicator,
309
- ErrorIndicator,
310
- SwarmIndicator
332
+ SwarmIndicator,
333
+ PerformanceIndicator,
334
+ ErrorIndicator
311
335
  ];
312
336
  var DebugStatus = () => {
313
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React2.createElement(Indicator, {
337
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React3.createElement(Indicator, {
314
338
  key: Indicator.name
315
339
  })));
316
340
  };
317
341
 
318
- // packages/plugins/experimental/plugin-debug/src/components/Wireframe.tsx
319
- import React3 from "react";
342
+ // packages/plugins/plugin-debug/src/components/Wireframe.tsx
343
+ import React4 from "react";
320
344
  import { useResizeDetector } from "react-resize-detector";
321
- import { createAttendableAttributes } from "@dxos/react-ui-attention";
345
+ import { fullyQualifiedId } from "@dxos/react-client/echo";
346
+ import { useAttendableAttributes } from "@dxos/react-ui-attention";
347
+ import { SyntaxHighlighter as SyntaxHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
322
348
  import { mx as mx3 } from "@dxos/react-ui-theme";
323
- var Wireframe = ({ label, data, className }) => {
324
- const attendableAttrs = createAttendableAttributes(data);
349
+ var Wireframe = ({ classNames, label, object }) => {
350
+ const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));
325
351
  const { width, height, ref } = useResizeDetector();
326
- return /* @__PURE__ */ React3.createElement("div", {
352
+ return /* @__PURE__ */ React4.createElement("div", {
327
353
  ref,
328
- className: mx3("relative grow min-bs-96", className),
354
+ className: mx3("relative grow min-bs-96", classNames),
329
355
  ...attendableAttrs
330
- }, /* @__PURE__ */ React3.createElement("div", {
331
- className: "absolute inset-2 flex flex-col overflow-hidden font-mono"
332
- }, /* @__PURE__ */ React3.createElement("div", {
356
+ }, /* @__PURE__ */ React4.createElement("div", {
357
+ className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
358
+ }, /* @__PURE__ */ React4.createElement("div", {
333
359
  className: "flex justify-between"
334
- }, /* @__PURE__ */ React3.createElement("div", null, label), /* @__PURE__ */ React3.createElement("div", null, `[${width}x${height}]`)), /* @__PURE__ */ React3.createElement("div", {
335
- className: "flex grow overflow-auto"
336
- }, data && /* @__PURE__ */ React3.createElement("pre", {
337
- className: "text-neutral-500 text-sm whitespace-pre-line"
338
- }, JSON.stringify(data, void 0, 1)))), /* @__PURE__ */ React3.createElement("svg", {
360
+ }, /* @__PURE__ */ React4.createElement("div", null, label), /* @__PURE__ */ React4.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React4.createElement(SyntaxHighlighter2, {
361
+ language: "json",
362
+ classNames: "flex w-full text-xs opacity-75 rounded"
363
+ }, JSON.stringify(object, void 0, 2))), /* @__PURE__ */ React4.createElement("svg", {
339
364
  width,
340
365
  height,
341
- className: "bg-transparent [&>*]:stroke-neutral-500"
342
- }, /* @__PURE__ */ React3.createElement("rect", {
366
+ className: "bg-transparent [&>*]:text-subdued"
367
+ }, /* @__PURE__ */ React4.createElement("rect", {
343
368
  x: 0,
344
369
  y: 0,
345
370
  width,
346
371
  height,
347
372
  strokeWidth: 1,
348
373
  fill: "none"
349
- }), /* @__PURE__ */ React3.createElement("line", {
374
+ }), /* @__PURE__ */ React4.createElement("line", {
350
375
  x1: 0,
351
376
  y1: 0,
352
377
  x2: width,
353
378
  y2: height,
354
379
  strokeWidth: 1
355
- }), /* @__PURE__ */ React3.createElement("line", {
380
+ }), /* @__PURE__ */ React4.createElement("line", {
356
381
  x1: 0,
357
382
  y1: height,
358
383
  x2: width,
@@ -361,12 +386,11 @@ var Wireframe = ({ label, data, className }) => {
361
386
  })));
362
387
  };
363
388
 
364
- // packages/plugins/experimental/plugin-debug/src/components/index.ts
365
- var DebugGlobal = React4.lazy(() => import("./DebugGlobal-H56M2VL4.mjs"));
366
- var DebugSpace = React4.lazy(() => import("./DebugSpace-NHPMLATA.mjs"));
367
- var DevtoolsMain = React4.lazy(() => import("./DevtoolsMain-RWT3FLJ6.mjs"));
389
+ // packages/plugins/plugin-debug/src/components/index.ts
390
+ var DebugGlobal = lazy(() => import("./DebugGlobal-ZTCBF3XR.mjs"));
391
+ var DebugSpace = lazy(() => import("./DebugSpace-I6BNZKI2.mjs"));
368
392
 
369
- // packages/plugins/experimental/plugin-debug/src/translations.ts
393
+ // packages/plugins/plugin-debug/src/translations.ts
370
394
  var translations_default = [
371
395
  {
372
396
  "en-US": {
@@ -397,33 +421,21 @@ var translations_default = [
397
421
  }
398
422
  ];
399
423
 
400
- // packages/plugins/experimental/plugin-debug/src/DebugPlugin.tsx
401
- var SETTINGS_KEY = DEBUG_PLUGIN + "/settings";
402
- var DebugPlugin = () => {
403
- const settings = new LocalStorageStore(DEBUG_PLUGIN, {
424
+ // packages/plugins/plugin-debug/src/DebugPlugin.tsx
425
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/DebugPlugin.tsx";
426
+ var DebugPlugin = definePlugin((context) => {
427
+ const settings = create({
404
428
  debug: true,
405
429
  devtools: true
406
430
  });
407
- let intentPlugin;
408
431
  return {
409
432
  meta: meta_default,
410
433
  ready: async (plugins) => {
411
- intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
412
- settings.prop({
413
- key: "debug",
414
- type: LocalStorageStore.bool({
415
- allowUndefined: true
416
- })
417
- }).prop({
418
- key: "devtools",
419
- type: LocalStorageStore.bool({
420
- allowUndefined: true
421
- })
422
- }).prop({
423
- key: "wireframe",
424
- type: LocalStorageStore.bool({
425
- allowUndefined: true
426
- })
434
+ context.init(plugins);
435
+ context.resolvePlugin(parseSettingsPlugin).provides.settingsStore.createStore({
436
+ schema: DebugSettingsSchema,
437
+ prefix: DEBUG_PLUGIN,
438
+ value: settings
427
439
  });
428
440
  const composer = window.composer;
429
441
  composer.changeStorageVersionInMetadata = async (version) => {
@@ -438,10 +450,10 @@ var DebugPlugin = () => {
438
450
  };
439
451
  },
440
452
  unload: async () => {
441
- settings.close();
453
+ context.dispose();
442
454
  },
443
455
  provides: {
444
- settings: settings.values,
456
+ settings,
445
457
  translations: translations_default,
446
458
  context: ({ children }) => {
447
459
  const [timer, setTimer] = useState3();
@@ -464,12 +476,34 @@ var DebugPlugin = () => {
464
476
  },
465
477
  graph: {
466
478
  builder: (plugins) => {
479
+ const clientPlugin = resolvePlugin(plugins, parseClientPlugin);
480
+ const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
467
481
  const graphPlugin = resolvePlugin(plugins, parseGraphPlugin2);
482
+ const resolve = metadataPlugin?.provides.metadata.resolver;
483
+ const client = clientPlugin?.provides.client;
484
+ invariant(resolve, void 0, {
485
+ F: __dxlog_file3,
486
+ L: 108,
487
+ S: void 0,
488
+ A: [
489
+ "resolve",
490
+ ""
491
+ ]
492
+ });
493
+ invariant(client, void 0, {
494
+ F: __dxlog_file3,
495
+ L: 109,
496
+ S: void 0,
497
+ A: [
498
+ "client",
499
+ ""
500
+ ]
501
+ });
468
502
  return [
469
503
  // Devtools node.
470
504
  createExtension({
471
505
  id: "dxos.org/plugin/debug/devtools",
472
- filter: (node) => !!settings.values.devtools && node.id === "root",
506
+ filter: (node) => !!settings.devtools && node.id === "root",
473
507
  connector: () => [
474
508
  {
475
509
  // TODO(zan): Removed `/` because it breaks deck layout reload. Fix?
@@ -483,8 +517,7 @@ var DebugPlugin = () => {
483
517
  ns: DEBUG_PLUGIN
484
518
  }
485
519
  ],
486
- icon: (props) => /* @__PURE__ */ React5.createElement(Hammer, props),
487
- iconSymbol: "ph--hammer--regular"
520
+ icon: "ph--hammer--regular"
488
521
  }
489
522
  }
490
523
  ]
@@ -492,7 +525,7 @@ var DebugPlugin = () => {
492
525
  // Debug node.
493
526
  createExtension({
494
527
  id: "dxos.org/plugin/debug/debug",
495
- filter: (node) => !!settings.values.debug && node.id === "root",
528
+ filter: (node) => !!settings.debug && node.id === "root",
496
529
  connector: () => [
497
530
  {
498
531
  id: "dxos.org/plugin/debug/debug",
@@ -507,8 +540,7 @@ var DebugPlugin = () => {
507
540
  ns: DEBUG_PLUGIN
508
541
  }
509
542
  ],
510
- icon: (props) => /* @__PURE__ */ React5.createElement(Bug, props),
511
- iconSymbol: "ph--bug--regular"
543
+ icon: "ph--bug--regular"
512
544
  }
513
545
  }
514
546
  ]
@@ -516,7 +548,7 @@ var DebugPlugin = () => {
516
548
  // Space debug nodes.
517
549
  createExtension({
518
550
  id: "dxos.org/plugin/debug/spaces",
519
- filter: (node) => !!settings.values.debug && isSpace(node.data),
551
+ filter: (node) => !!settings.debug && isSpace(node.data),
520
552
  connector: ({ node }) => {
521
553
  const space = node.data;
522
554
  return [
@@ -533,11 +565,76 @@ var DebugPlugin = () => {
533
565
  ns: DEBUG_PLUGIN
534
566
  }
535
567
  ],
536
- icon: (props) => /* @__PURE__ */ React5.createElement(Bug, props),
537
- iconSymbol: "ph--bug--regular"
568
+ icon: "ph--bug--regular"
569
+ }
570
+ }
571
+ ];
572
+ }
573
+ }),
574
+ // Create nodes for debug sidebar.
575
+ createExtension({
576
+ id: `${DEBUG_PLUGIN}/debug-for-subject`,
577
+ resolver: ({ id }) => {
578
+ if (!id.endsWith("~debug")) {
579
+ return;
580
+ }
581
+ const type = "orphan-settings-for-subject";
582
+ const icon = "ph--bug--regular";
583
+ const [subjectId] = id.split("~");
584
+ const { spaceId, objectId } = parseId(subjectId);
585
+ const space = client.spaces.get().find((space2) => space2.id === spaceId);
586
+ if (!objectId) {
587
+ const label2 = space ? space.properties.name || [
588
+ "unnamed space label",
589
+ {
590
+ ns: DEBUG_PLUGIN
538
591
  }
592
+ ] : [
593
+ "unnamed object settings label",
594
+ {
595
+ ns: DEBUG_PLUGIN
596
+ }
597
+ ];
598
+ return {
599
+ id,
600
+ type,
601
+ data: null,
602
+ properties: {
603
+ icon,
604
+ label: label2,
605
+ showResolvedThreads: false,
606
+ object: null,
607
+ space
608
+ }
609
+ };
610
+ }
611
+ const object = toSignal((onChange) => {
612
+ const timeout = setTimeout(async () => {
613
+ await space?.db.loadObjectById(objectId);
614
+ onChange();
615
+ });
616
+ return () => clearTimeout(timeout);
617
+ }, () => space?.db.getObjectById(objectId), subjectId);
618
+ if (!object || !subjectId) {
619
+ return;
620
+ }
621
+ const meta = resolve(getTypename(object) ?? "");
622
+ const label = meta.label?.(object) || object.name || meta.placeholder || [
623
+ "unnamed object settings label",
624
+ {
625
+ ns: DEBUG_PLUGIN
539
626
  }
540
627
  ];
628
+ return {
629
+ id,
630
+ type,
631
+ data: null,
632
+ properties: {
633
+ icon,
634
+ label,
635
+ object
636
+ }
637
+ };
541
638
  }
542
639
  })
543
640
  ];
@@ -547,7 +644,7 @@ var DebugPlugin = () => {
547
644
  resolver: async (intent, plugins) => {
548
645
  switch (intent.action) {
549
646
  case DebugAction.OPEN_DEVTOOLS: {
550
- const clientPlugin = getPlugin(plugins, "dxos.org/plugin/client");
647
+ const clientPlugin = context.getPlugin("dxos.org/plugin/client");
551
648
  const client = clientPlugin.provides.client;
552
649
  const vaultUrl = client.config.values?.runtime?.client?.remoteSource ?? "https://halo.dxos.org";
553
650
  let devtoolsUrl = "http://localhost:5174";
@@ -570,17 +667,21 @@ var DebugPlugin = () => {
570
667
  switch (role) {
571
668
  case "settings":
572
669
  return data.plugin === meta_default.id ? /* @__PURE__ */ React5.createElement(DebugSettings, {
573
- settings: settings.values
670
+ settings
574
671
  }) : null;
575
672
  case "status":
576
673
  return /* @__PURE__ */ React5.createElement(DebugStatus, null);
674
+ case "complementary--debug":
675
+ return isEchoObject(data.subject) ? /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
676
+ object: data.subject
677
+ }) : null;
577
678
  }
578
679
  const primary = data.active ?? data.object;
579
680
  let component;
580
681
  if (role === "main" || role === "article") {
581
- if (primary === "devtools" && settings.values.devtools) {
582
- component = /* @__PURE__ */ React5.createElement(DevtoolsMain, null);
583
- } else if (!primary || typeof primary !== "object" || !settings.values.debug) {
682
+ if (primary === "devtools" && settings.devtools) {
683
+ component = /* @__PURE__ */ React5.createElement(Devtools, null);
684
+ } else if (!primary || typeof primary !== "object" || !settings.debug) {
584
685
  component = null;
585
686
  } else if ("space" in primary && isSpace(primary.space)) {
586
687
  component = /* @__PURE__ */ React5.createElement(DebugSpace, {
@@ -593,7 +694,7 @@ var DebugPlugin = () => {
593
694
  if (!(collection instanceof CollectionType)) {
594
695
  return;
595
696
  }
596
- void intentPlugin?.provides.intent.dispatch(objects.map((object) => ({
697
+ void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatch(objects.map((object) => ({
597
698
  action: SpaceAction.ADD_OBJECT,
598
699
  data: {
599
700
  target: collection,
@@ -611,15 +712,19 @@ var DebugPlugin = () => {
611
712
  }
612
713
  }
613
714
  if (!component) {
614
- if (settings.values.wireframe) {
715
+ if (settings.wireframe) {
615
716
  if (role === "main" || role === "article" || role === "section") {
616
717
  const primary2 = data.active ?? data.object;
617
- if (!(primary2 instanceof CollectionType)) {
618
- return /* @__PURE__ */ React5.createElement(Wireframe, {
619
- label: role,
620
- data,
621
- className: "row-span-2 overflow-hidden"
622
- });
718
+ const isCollection = primary2 instanceof CollectionType;
719
+ if (!isCollection) {
720
+ return {
721
+ node: /* @__PURE__ */ React5.createElement(Wireframe, {
722
+ label: `${role}:${name}`,
723
+ object: primary2,
724
+ classNames: "row-span-2 overflow-hidden"
725
+ }),
726
+ disposition: "hoist"
727
+ };
623
728
  }
624
729
  }
625
730
  }
@@ -646,13 +751,12 @@ var DebugPlugin = () => {
646
751
  }
647
752
  }
648
753
  };
649
- };
754
+ });
650
755
 
651
- // packages/plugins/experimental/plugin-debug/src/index.ts
756
+ // packages/plugins/plugin-debug/src/index.ts
652
757
  var src_default = DebugPlugin;
653
758
  export {
654
759
  DebugPlugin,
655
- SETTINGS_KEY,
656
760
  src_default as default
657
761
  };
658
762
  //# sourceMappingURL=index.mjs.map