@dxos/plugin-debug 0.6.13 → 0.6.14-main.1366248
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.
- package/dist/lib/browser/{DebugGlobal-H56M2VL4.mjs → DebugGlobal-ZTCBF3XR.mjs} +5 -5
- package/dist/lib/browser/{DebugSpace-NHPMLATA.mjs → DebugSpace-22PW7RJM.mjs} +16 -41
- package/dist/lib/browser/DebugSpace-22PW7RJM.mjs.map +7 -0
- package/dist/lib/browser/chunk-CAENAAHY.mjs +18 -0
- package/dist/lib/browser/chunk-CAENAAHY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ED5L5YYI.mjs → chunk-H3BJHVRD.mjs} +5 -8
- package/dist/lib/browser/chunk-H3BJHVRD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RYK3J66D.mjs → chunk-LZEK532R.mjs} +11 -4
- package/dist/lib/browser/chunk-LZEK532R.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +264 -145
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -3
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +7 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/components/DebugPanel.d.ts +3 -3
- package/dist/types/src/components/DebugPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSpace.stories.d.ts +3 -13
- package/dist/types/src/components/DebugSpace.stories.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/ObjectCreator.d.ts +5 -5
- package/dist/types/src/components/ObjectCreator.d.ts.map +1 -1
- package/dist/types/src/components/ObjectCreator.stories.d.ts +3 -14
- package/dist/types/src/components/ObjectCreator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SurfaceDebug.d.ts +9 -0
- package/dist/types/src/components/SurfaceDebug.d.ts.map +1 -0
- package/dist/types/src/components/Wireframe.d.ts +5 -4
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +5 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/scaffolding/generator.d.ts +1 -2
- package/dist/types/src/scaffolding/generator.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +10 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +46 -47
- package/src/DebugPlugin.tsx +137 -47
- package/src/components/DebugObjectPanel.tsx +22 -0
- package/src/components/DebugPanel.tsx +4 -9
- package/src/components/DebugSettings.tsx +13 -13
- package/src/components/DebugSpace.stories.tsx +6 -3
- package/src/components/DebugStatus.tsx +20 -13
- package/src/components/ObjectCreator.stories.tsx +13 -10
- package/src/components/ObjectCreator.tsx +12 -21
- package/src/components/SurfaceDebug.tsx +55 -0
- package/src/components/Wireframe.tsx +20 -11
- package/src/components/index.ts +4 -5
- package/src/meta.ts +16 -0
- package/src/scaffolding/generator.ts +4 -15
- package/src/translations.ts +1 -0
- package/src/types.ts +13 -6
- package/dist/lib/browser/DebugSpace-NHPMLATA.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsMain-RWT3FLJ6.mjs +0 -15
- package/dist/lib/browser/DevtoolsMain-RWT3FLJ6.mjs.map +0 -7
- package/dist/lib/browser/chunk-ED5L5YYI.mjs.map +0 -7
- package/dist/lib/browser/chunk-RYK3J66D.mjs.map +0 -7
- package/dist/lib/browser/chunk-WEGYHXMB.mjs +0 -21
- package/dist/lib/browser/chunk-WEGYHXMB.mjs.map +0 -7
- package/dist/types/src/components/DevtoolsMain.d.ts +0 -4
- package/dist/types/src/components/DevtoolsMain.d.ts.map +0 -1
- package/dist/types/src/types.test.d.ts +0 -2
- package/dist/types/src/types.test.d.ts.map +0 -1
- package/src/components/DevtoolsMain.tsx +0 -15
- package/src/meta.tsx +0 -19
- package/src/types.test.ts +0 -13
- /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
|
-
|
|
3
|
+
DebugContext,
|
|
4
|
+
DebugSettingsSchema
|
|
5
|
+
} from "./chunk-LZEK532R.mjs";
|
|
5
6
|
import {
|
|
6
7
|
DEBUG_PLUGIN,
|
|
7
8
|
meta_default
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CAENAAHY.mjs";
|
|
9
10
|
|
|
10
|
-
// packages/plugins/
|
|
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 {
|
|
13
|
+
import { definePlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, parseMetadataResolverPlugin, parseSettingsPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
14
14
|
import { Timer } from "@dxos/async";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
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 {
|
|
21
|
+
import { create, getTypename, isEchoObject, isSpace, parseId, SpaceState } from "@dxos/react-client/echo";
|
|
20
22
|
import { Main } from "@dxos/react-ui";
|
|
21
|
-
import { baseSurface,
|
|
23
|
+
import { baseSurface, bottombarBlockPaddingEnd, fixedInsetFlexLayout, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
|
|
22
24
|
|
|
23
|
-
// packages/plugins/
|
|
24
|
-
import
|
|
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/
|
|
41
|
+
// packages/plugins/plugin-debug/src/components/DebugSettings.tsx
|
|
27
42
|
import { Gift, DownloadSimple, FirstAidKit } from "@phosphor-icons/react";
|
|
28
|
-
import
|
|
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 { DeprecatedFormInput } 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/
|
|
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__ */
|
|
129
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
115
130
|
label: t("settings show debug panel")
|
|
116
|
-
}, /* @__PURE__ */
|
|
131
|
+
}, /* @__PURE__ */ React2.createElement(Input.Switch, {
|
|
117
132
|
checked: settings.debug,
|
|
118
133
|
onCheckedChange: (checked) => settings.debug = !!checked
|
|
119
|
-
})), /* @__PURE__ */
|
|
134
|
+
})), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
120
135
|
label: t("settings show devtools panel")
|
|
121
|
-
}, /* @__PURE__ */
|
|
136
|
+
}, /* @__PURE__ */ React2.createElement(Input.Switch, {
|
|
122
137
|
checked: settings.devtools,
|
|
123
138
|
onCheckedChange: (checked) => settings.devtools = !!checked
|
|
124
|
-
})), /* @__PURE__ */
|
|
139
|
+
})), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
125
140
|
label: t("settings wireframe")
|
|
126
|
-
}, /* @__PURE__ */
|
|
141
|
+
}, /* @__PURE__ */ React2.createElement(Input.Switch, {
|
|
127
142
|
checked: settings.wireframe,
|
|
128
143
|
onCheckedChange: (checked) => settings.wireframe = !!checked
|
|
129
|
-
})), /* @__PURE__ */
|
|
144
|
+
})), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
130
145
|
label: t("settings download diagnostics")
|
|
131
|
-
}, /* @__PURE__ */
|
|
146
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
132
147
|
onClick: handleDownload
|
|
133
|
-
}, /* @__PURE__ */
|
|
148
|
+
}, /* @__PURE__ */ React2.createElement(DownloadSimple, {
|
|
134
149
|
className: getSize(5)
|
|
135
|
-
}))), /* @__PURE__ */
|
|
150
|
+
}))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
136
151
|
label: t("settings repair")
|
|
137
|
-
}, /* @__PURE__ */
|
|
152
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
138
153
|
onClick: handleRepair
|
|
139
|
-
}, /* @__PURE__ */
|
|
154
|
+
}, /* @__PURE__ */ React2.createElement(FirstAidKit, {
|
|
140
155
|
className: getSize(5)
|
|
141
|
-
}))), toast && /* @__PURE__ */
|
|
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__ */
|
|
159
|
+
}), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
145
160
|
label: t("settings choose storage adaptor")
|
|
146
|
-
}, /* @__PURE__ */
|
|
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__ */
|
|
173
|
+
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
|
|
159
174
|
placeholder: t("settings data store label")
|
|
160
|
-
}), /* @__PURE__ */
|
|
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/
|
|
175
|
-
import {
|
|
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 {
|
|
186
|
-
|
|
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__ */
|
|
238
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
224
239
|
title: errorRef.current.message,
|
|
225
240
|
onClick: handleReset
|
|
226
|
-
}, /* @__PURE__ */
|
|
227
|
-
|
|
228
|
-
|
|
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__ */
|
|
247
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
232
248
|
title: "No errors."
|
|
233
|
-
}, /* @__PURE__ */
|
|
234
|
-
|
|
235
|
-
|
|
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__ */
|
|
264
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
249
265
|
title: "Connected to swarm."
|
|
250
|
-
}, /* @__PURE__ */
|
|
251
|
-
|
|
266
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
267
|
+
icon: "ph--lightning--regular",
|
|
268
|
+
size: 4
|
|
252
269
|
}));
|
|
253
270
|
} else {
|
|
254
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
255
272
|
title: "Disconnected from swarm."
|
|
256
|
-
}, /* @__PURE__ */
|
|
257
|
-
|
|
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__ */
|
|
289
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
271
290
|
title: "Edit not saved."
|
|
272
|
-
}, /* @__PURE__ */
|
|
273
|
-
|
|
274
|
-
|
|
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__ */
|
|
297
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
278
298
|
title: "Saving..."
|
|
279
|
-
}, /* @__PURE__ */
|
|
280
|
-
|
|
281
|
-
|
|
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__ */
|
|
306
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
286
307
|
title: "Modified indicator."
|
|
287
|
-
}, /* @__PURE__ */
|
|
288
|
-
|
|
289
|
-
|
|
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__ */
|
|
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__ */
|
|
300
|
-
|
|
301
|
-
|
|
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
|
-
|
|
310
|
-
|
|
332
|
+
SwarmIndicator,
|
|
333
|
+
PerformanceIndicator,
|
|
334
|
+
ErrorIndicator
|
|
311
335
|
];
|
|
312
336
|
var DebugStatus = () => {
|
|
313
|
-
return /* @__PURE__ */
|
|
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/
|
|
319
|
-
import
|
|
342
|
+
// packages/plugins/plugin-debug/src/components/Wireframe.tsx
|
|
343
|
+
import React4 from "react";
|
|
320
344
|
import { useResizeDetector } from "react-resize-detector";
|
|
321
|
-
import {
|
|
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 = ({
|
|
324
|
-
const attendableAttrs =
|
|
349
|
+
var Wireframe = ({ classNames, label, object }) => {
|
|
350
|
+
const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));
|
|
325
351
|
const { width, height, ref } = useResizeDetector();
|
|
326
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
327
353
|
ref,
|
|
328
|
-
className: mx3("relative grow min-bs-96",
|
|
354
|
+
className: mx3("relative grow min-bs-96", classNames),
|
|
329
355
|
...attendableAttrs
|
|
330
|
-
}, /* @__PURE__ */
|
|
331
|
-
className: "absolute inset-2 flex flex-col overflow-hidden font-mono"
|
|
332
|
-
}, /* @__PURE__ */
|
|
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__ */
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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 [&>*]:
|
|
342
|
-
}, /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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/
|
|
365
|
-
var DebugGlobal =
|
|
366
|
-
var DebugSpace =
|
|
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-22PW7RJM.mjs"));
|
|
368
392
|
|
|
369
|
-
// packages/plugins/
|
|
393
|
+
// packages/plugins/plugin-debug/src/translations.ts
|
|
370
394
|
var translations_default = [
|
|
371
395
|
{
|
|
372
396
|
"en-US": {
|
|
@@ -391,39 +415,28 @@ var translations_default = [
|
|
|
391
415
|
"settings storage adaptor opfs label": "OPFS",
|
|
392
416
|
"settings data store label": "Data Store",
|
|
393
417
|
"settings storage adapter changed alert": "Warning: Swapping the storage adapter will make your data unavailable.",
|
|
394
|
-
"settings space fragmentation": "Enable AM space fragmentation"
|
|
418
|
+
"settings space fragmentation": "Enable AM space fragmentation",
|
|
419
|
+
"open debug panel label": "Show Debug"
|
|
395
420
|
}
|
|
396
421
|
}
|
|
397
422
|
}
|
|
398
423
|
];
|
|
399
424
|
|
|
400
|
-
// packages/plugins/
|
|
401
|
-
var
|
|
402
|
-
var DebugPlugin = () => {
|
|
403
|
-
const settings =
|
|
425
|
+
// packages/plugins/plugin-debug/src/DebugPlugin.tsx
|
|
426
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/DebugPlugin.tsx";
|
|
427
|
+
var DebugPlugin = definePlugin((context) => {
|
|
428
|
+
const settings = create({
|
|
404
429
|
debug: true,
|
|
405
430
|
devtools: true
|
|
406
431
|
});
|
|
407
|
-
let intentPlugin;
|
|
408
432
|
return {
|
|
409
433
|
meta: meta_default,
|
|
410
434
|
ready: async (plugins) => {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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
|
-
})
|
|
435
|
+
context.init(plugins);
|
|
436
|
+
context.resolvePlugin(parseSettingsPlugin).provides.settingsStore.createStore({
|
|
437
|
+
schema: DebugSettingsSchema,
|
|
438
|
+
prefix: DEBUG_PLUGIN,
|
|
439
|
+
value: settings
|
|
427
440
|
});
|
|
428
441
|
const composer = window.composer;
|
|
429
442
|
composer.changeStorageVersionInMetadata = async (version) => {
|
|
@@ -438,11 +451,25 @@ var DebugPlugin = () => {
|
|
|
438
451
|
};
|
|
439
452
|
},
|
|
440
453
|
unload: async () => {
|
|
441
|
-
|
|
454
|
+
context.dispose();
|
|
442
455
|
},
|
|
443
456
|
provides: {
|
|
444
|
-
settings
|
|
457
|
+
settings,
|
|
445
458
|
translations: translations_default,
|
|
459
|
+
complementary: {
|
|
460
|
+
panels: [
|
|
461
|
+
{
|
|
462
|
+
id: "debug",
|
|
463
|
+
label: [
|
|
464
|
+
"open debug panel label",
|
|
465
|
+
{
|
|
466
|
+
ns: DEBUG_PLUGIN
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
icon: "ph--bug--regular"
|
|
470
|
+
}
|
|
471
|
+
]
|
|
472
|
+
},
|
|
446
473
|
context: ({ children }) => {
|
|
447
474
|
const [timer, setTimer] = useState3();
|
|
448
475
|
useEffect3(() => timer?.state.on((value) => !value && setTimer(void 0)), [
|
|
@@ -464,12 +491,34 @@ var DebugPlugin = () => {
|
|
|
464
491
|
},
|
|
465
492
|
graph: {
|
|
466
493
|
builder: (plugins) => {
|
|
494
|
+
const clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
495
|
+
const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
|
|
467
496
|
const graphPlugin = resolvePlugin(plugins, parseGraphPlugin2);
|
|
497
|
+
const resolve = metadataPlugin?.provides.metadata.resolver;
|
|
498
|
+
const client = clientPlugin?.provides.client;
|
|
499
|
+
invariant(resolve, void 0, {
|
|
500
|
+
F: __dxlog_file3,
|
|
501
|
+
L: 111,
|
|
502
|
+
S: void 0,
|
|
503
|
+
A: [
|
|
504
|
+
"resolve",
|
|
505
|
+
""
|
|
506
|
+
]
|
|
507
|
+
});
|
|
508
|
+
invariant(client, void 0, {
|
|
509
|
+
F: __dxlog_file3,
|
|
510
|
+
L: 112,
|
|
511
|
+
S: void 0,
|
|
512
|
+
A: [
|
|
513
|
+
"client",
|
|
514
|
+
""
|
|
515
|
+
]
|
|
516
|
+
});
|
|
468
517
|
return [
|
|
469
518
|
// Devtools node.
|
|
470
519
|
createExtension({
|
|
471
520
|
id: "dxos.org/plugin/debug/devtools",
|
|
472
|
-
filter: (node) => !!settings.
|
|
521
|
+
filter: (node) => !!settings.devtools && node.id === "root",
|
|
473
522
|
connector: () => [
|
|
474
523
|
{
|
|
475
524
|
// TODO(zan): Removed `/` because it breaks deck layout reload. Fix?
|
|
@@ -483,8 +532,7 @@ var DebugPlugin = () => {
|
|
|
483
532
|
ns: DEBUG_PLUGIN
|
|
484
533
|
}
|
|
485
534
|
],
|
|
486
|
-
icon:
|
|
487
|
-
iconSymbol: "ph--hammer--regular"
|
|
535
|
+
icon: "ph--hammer--regular"
|
|
488
536
|
}
|
|
489
537
|
}
|
|
490
538
|
]
|
|
@@ -492,7 +540,7 @@ var DebugPlugin = () => {
|
|
|
492
540
|
// Debug node.
|
|
493
541
|
createExtension({
|
|
494
542
|
id: "dxos.org/plugin/debug/debug",
|
|
495
|
-
filter: (node) => !!settings.
|
|
543
|
+
filter: (node) => !!settings.debug && node.id === "root",
|
|
496
544
|
connector: () => [
|
|
497
545
|
{
|
|
498
546
|
id: "dxos.org/plugin/debug/debug",
|
|
@@ -507,8 +555,7 @@ var DebugPlugin = () => {
|
|
|
507
555
|
ns: DEBUG_PLUGIN
|
|
508
556
|
}
|
|
509
557
|
],
|
|
510
|
-
icon:
|
|
511
|
-
iconSymbol: "ph--bug--regular"
|
|
558
|
+
icon: "ph--bug--regular"
|
|
512
559
|
}
|
|
513
560
|
}
|
|
514
561
|
]
|
|
@@ -516,7 +563,7 @@ var DebugPlugin = () => {
|
|
|
516
563
|
// Space debug nodes.
|
|
517
564
|
createExtension({
|
|
518
565
|
id: "dxos.org/plugin/debug/spaces",
|
|
519
|
-
filter: (node) => !!settings.
|
|
566
|
+
filter: (node) => !!settings.debug && isSpace(node.data),
|
|
520
567
|
connector: ({ node }) => {
|
|
521
568
|
const space = node.data;
|
|
522
569
|
return [
|
|
@@ -533,12 +580,77 @@ var DebugPlugin = () => {
|
|
|
533
580
|
ns: DEBUG_PLUGIN
|
|
534
581
|
}
|
|
535
582
|
],
|
|
536
|
-
icon:
|
|
537
|
-
iconSymbol: "ph--bug--regular"
|
|
583
|
+
icon: "ph--bug--regular"
|
|
538
584
|
}
|
|
539
585
|
}
|
|
540
586
|
];
|
|
541
587
|
}
|
|
588
|
+
}),
|
|
589
|
+
// Create nodes for debug sidebar.
|
|
590
|
+
createExtension({
|
|
591
|
+
id: `${DEBUG_PLUGIN}/debug-for-subject`,
|
|
592
|
+
resolver: ({ id }) => {
|
|
593
|
+
if (!id.endsWith("~debug")) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
const type = "orphan-settings-for-subject";
|
|
597
|
+
const icon = "ph--bug--regular";
|
|
598
|
+
const [subjectId] = id.split("~");
|
|
599
|
+
const { spaceId, objectId } = parseId(subjectId);
|
|
600
|
+
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
601
|
+
if (!objectId) {
|
|
602
|
+
const label2 = space ? space.properties.name || [
|
|
603
|
+
"unnamed space label",
|
|
604
|
+
{
|
|
605
|
+
ns: DEBUG_PLUGIN
|
|
606
|
+
}
|
|
607
|
+
] : [
|
|
608
|
+
"unnamed object settings label",
|
|
609
|
+
{
|
|
610
|
+
ns: DEBUG_PLUGIN
|
|
611
|
+
}
|
|
612
|
+
];
|
|
613
|
+
return {
|
|
614
|
+
id,
|
|
615
|
+
type,
|
|
616
|
+
data: null,
|
|
617
|
+
properties: {
|
|
618
|
+
icon,
|
|
619
|
+
label: label2,
|
|
620
|
+
showResolvedThreads: false,
|
|
621
|
+
object: null,
|
|
622
|
+
space
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
const object = toSignal((onChange) => {
|
|
627
|
+
const timeout = setTimeout(async () => {
|
|
628
|
+
await space?.db.loadObjectById(objectId);
|
|
629
|
+
onChange();
|
|
630
|
+
});
|
|
631
|
+
return () => clearTimeout(timeout);
|
|
632
|
+
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
633
|
+
if (!object || !subjectId) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const meta = resolve(getTypename(object) ?? "");
|
|
637
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
638
|
+
"unnamed object settings label",
|
|
639
|
+
{
|
|
640
|
+
ns: DEBUG_PLUGIN
|
|
641
|
+
}
|
|
642
|
+
];
|
|
643
|
+
return {
|
|
644
|
+
id,
|
|
645
|
+
type,
|
|
646
|
+
data: null,
|
|
647
|
+
properties: {
|
|
648
|
+
icon,
|
|
649
|
+
label,
|
|
650
|
+
object
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
}
|
|
542
654
|
})
|
|
543
655
|
];
|
|
544
656
|
}
|
|
@@ -547,7 +659,7 @@ var DebugPlugin = () => {
|
|
|
547
659
|
resolver: async (intent, plugins) => {
|
|
548
660
|
switch (intent.action) {
|
|
549
661
|
case DebugAction.OPEN_DEVTOOLS: {
|
|
550
|
-
const clientPlugin = getPlugin(
|
|
662
|
+
const clientPlugin = context.getPlugin("dxos.org/plugin/client");
|
|
551
663
|
const client = clientPlugin.provides.client;
|
|
552
664
|
const vaultUrl = client.config.values?.runtime?.client?.remoteSource ?? "https://halo.dxos.org";
|
|
553
665
|
let devtoolsUrl = "http://localhost:5174";
|
|
@@ -570,17 +682,21 @@ var DebugPlugin = () => {
|
|
|
570
682
|
switch (role) {
|
|
571
683
|
case "settings":
|
|
572
684
|
return data.plugin === meta_default.id ? /* @__PURE__ */ React5.createElement(DebugSettings, {
|
|
573
|
-
settings
|
|
685
|
+
settings
|
|
574
686
|
}) : null;
|
|
575
687
|
case "status":
|
|
576
688
|
return /* @__PURE__ */ React5.createElement(DebugStatus, null);
|
|
689
|
+
case "complementary--debug":
|
|
690
|
+
return isEchoObject(data.subject) ? /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
|
|
691
|
+
object: data.subject
|
|
692
|
+
}) : null;
|
|
577
693
|
}
|
|
578
694
|
const primary = data.active ?? data.object;
|
|
579
695
|
let component;
|
|
580
696
|
if (role === "main" || role === "article") {
|
|
581
|
-
if (primary === "devtools" && settings.
|
|
582
|
-
component = /* @__PURE__ */ React5.createElement(
|
|
583
|
-
} else if (!primary || typeof primary !== "object" || !settings.
|
|
697
|
+
if (primary === "devtools" && settings.devtools) {
|
|
698
|
+
component = /* @__PURE__ */ React5.createElement(Devtools, null);
|
|
699
|
+
} else if (!primary || typeof primary !== "object" || !settings.debug) {
|
|
584
700
|
component = null;
|
|
585
701
|
} else if ("space" in primary && isSpace(primary.space)) {
|
|
586
702
|
component = /* @__PURE__ */ React5.createElement(DebugSpace, {
|
|
@@ -593,7 +709,7 @@ var DebugPlugin = () => {
|
|
|
593
709
|
if (!(collection instanceof CollectionType)) {
|
|
594
710
|
return;
|
|
595
711
|
}
|
|
596
|
-
void
|
|
712
|
+
void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatch(objects.map((object) => ({
|
|
597
713
|
action: SpaceAction.ADD_OBJECT,
|
|
598
714
|
data: {
|
|
599
715
|
target: collection,
|
|
@@ -611,15 +727,19 @@ var DebugPlugin = () => {
|
|
|
611
727
|
}
|
|
612
728
|
}
|
|
613
729
|
if (!component) {
|
|
614
|
-
if (settings.
|
|
730
|
+
if (settings.wireframe) {
|
|
615
731
|
if (role === "main" || role === "article" || role === "section") {
|
|
616
732
|
const primary2 = data.active ?? data.object;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
733
|
+
const isCollection = primary2 instanceof CollectionType;
|
|
734
|
+
if (!isCollection) {
|
|
735
|
+
return {
|
|
736
|
+
node: /* @__PURE__ */ React5.createElement(Wireframe, {
|
|
737
|
+
label: `${role}:${name}`,
|
|
738
|
+
object: primary2,
|
|
739
|
+
classNames: "row-span-2 overflow-hidden"
|
|
740
|
+
}),
|
|
741
|
+
disposition: "hoist"
|
|
742
|
+
};
|
|
623
743
|
}
|
|
624
744
|
}
|
|
625
745
|
}
|
|
@@ -646,13 +766,12 @@ var DebugPlugin = () => {
|
|
|
646
766
|
}
|
|
647
767
|
}
|
|
648
768
|
};
|
|
649
|
-
};
|
|
769
|
+
});
|
|
650
770
|
|
|
651
|
-
// packages/plugins/
|
|
771
|
+
// packages/plugins/plugin-debug/src/index.ts
|
|
652
772
|
var src_default = DebugPlugin;
|
|
653
773
|
export {
|
|
654
774
|
DebugPlugin,
|
|
655
|
-
SETTINGS_KEY,
|
|
656
775
|
src_default as default
|
|
657
776
|
};
|
|
658
777
|
//# sourceMappingURL=index.mjs.map
|