@dxos/plugin-debug 0.8.2-staging.7ac8446 → 0.8.2
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/DebugApp-WSEJPCKY.mjs +225 -0
- package/dist/lib/browser/{DebugApp-7PFYN52J.mjs.map → DebugApp-WSEJPCKY.mjs.map} +1 -1
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +25 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-NBOQZ4JF.mjs → SpaceGenerator-RHQLPN44.mjs} +254 -242
- package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-ALFPRSAR.mjs → app-graph-builder-PIPBIN6P.mjs} +115 -88
- package/dist/lib/browser/app-graph-builder-PIPBIN6P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RORUXVAC.mjs → chunk-47JOZTT2.mjs} +1 -4
- package/dist/lib/browser/{chunk-RORUXVAC.mjs.map → chunk-47JOZTT2.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KS3YBEL7.mjs +68 -0
- package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-ZRLN5KUI.mjs → react-context-ZQRD2WG2.mjs} +2 -2
- package/dist/lib/browser/{react-surface-MXXLOQYV.mjs → react-surface-PHUWS5WD.mjs} +318 -288
- package/dist/lib/browser/react-surface-PHUWS5WD.mjs.map +7 -0
- package/dist/lib/browser/{settings-AP74NCXH.mjs → settings-N4Q6YB7L.mjs} +5 -5
- package/dist/lib/browser/settings-N4Q6YB7L.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -178
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Container.d.ts.map +1 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +2 -2
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts +4 -0
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -53
- package/src/capabilities/app-graph-builder.ts +418 -374
- package/src/capabilities/react-surface.tsx +43 -19
- package/src/capabilities/settings.ts +2 -2
- package/src/components/DebugObjectPanel.tsx +2 -2
- package/src/components/DebugStatus.tsx +4 -29
- package/src/components/DevtoolsOverviewContainer.tsx +20 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +11 -16
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +9 -9
- package/src/components/SpaceGenerator/presets.ts +20 -18
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/meta.ts +0 -1
- package/src/translations.ts +2 -0
- package/src/types.ts +6 -5
- package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
- package/dist/lib/browser/SpaceGenerator-NBOQZ4JF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCEHALD4.mjs +0 -73
- package/dist/lib/browser/chunk-TCEHALD4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-MXXLOQYV.mjs.map +0 -7
- package/dist/lib/browser/settings-AP74NCXH.mjs.map +0 -7
- /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Devtools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KS3YBEL7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEBUG_PLUGIN
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-47JOZTT2.mjs";
|
|
7
7
|
|
|
8
8
|
// packages/plugins/plugin-debug/src/capabilities/react-surface.tsx
|
|
9
9
|
import { pipe } from "effect";
|
|
10
10
|
import React5, { useCallback } from "react";
|
|
11
|
-
import { Capabilities as Capabilities2, chain, contributes, createIntent, createSurface, LayoutAction, useCapability } from "@dxos/app-framework";
|
|
12
|
-
import { ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, FeedsPanel, IdentityPanel, KeyringPanel, LoggingPanel, MembersPanel, MetadataPanel, NetworkPanel, ObjectsPanel, SignalPanel, SpaceInfoPanel, SpaceListPanel, StoragePanel, SwarmPanel,
|
|
11
|
+
import { Capabilities as Capabilities2, chain, contributes, createIntent, createSurface, LayoutAction, useCapability, useIntentDispatcher } from "@dxos/app-framework";
|
|
12
|
+
import { AutomergePanel, ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, EdgeDashboardPanel, FeedsPanel, IdentityPanel, InvocationTraceContainer, KeyringPanel, LoggingPanel, MembersPanel, MetadataPanel, NetworkPanel, ObjectsPanel, QueuesPanel, SchemaPanel, SignalPanel, SpaceInfoPanel, SpaceListPanel, StoragePanel, SwarmPanel, TestingPanel, TracingPanel, WorkflowPanel } from "@dxos/devtools";
|
|
13
13
|
import { SettingsStore } from "@dxos/local-storage";
|
|
14
14
|
import { log as log2 } from "@dxos/log";
|
|
15
15
|
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
@@ -22,31 +22,38 @@ import { SpaceState, isSpace, isEchoObject, parseId } from "@dxos/react-client/e
|
|
|
22
22
|
import { lazy } from "react";
|
|
23
23
|
|
|
24
24
|
// packages/plugins/plugin-debug/src/components/DebugObjectPanel.tsx
|
|
25
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
25
26
|
import React from "react";
|
|
26
27
|
import { Clipboard, Input } from "@dxos/react-ui";
|
|
27
28
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
28
29
|
var DebugObjectPanel = ({ object }) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
var _effect = _useSignals();
|
|
31
|
+
try {
|
|
32
|
+
const dxn = `dxn:echo:@:${object.id}`;
|
|
33
|
+
return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement("div", {
|
|
34
|
+
className: "flex flex-col"
|
|
35
|
+
}, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
36
|
+
role: "none",
|
|
37
|
+
className: "flex flex-col gap-1"
|
|
38
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
39
|
+
role: "none",
|
|
40
|
+
className: "flex gap-1"
|
|
41
|
+
}, /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
42
|
+
disabled: true,
|
|
43
|
+
value: dxn
|
|
44
|
+
}), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
45
|
+
value: dxn
|
|
46
|
+
})))), /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
|
|
47
|
+
classNames: "flex text-xs",
|
|
48
|
+
language: "json"
|
|
49
|
+
}, JSON.stringify(object, null, 2))));
|
|
50
|
+
} finally {
|
|
51
|
+
_effect.f();
|
|
52
|
+
}
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
// packages/plugins/plugin-debug/src/components/DebugSettings.tsx
|
|
56
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
50
57
|
import React2, { useEffect, useState } from "react";
|
|
51
58
|
import { Capabilities, useCapabilities } from "@dxos/app-framework";
|
|
52
59
|
import { defs, SaveConfig, Storage } from "@dxos/config";
|
|
@@ -61,120 +68,125 @@ var StorageAdapters = {
|
|
|
61
68
|
idb: defs.Runtime.Client.Storage.StorageDriver.IDB
|
|
62
69
|
};
|
|
63
70
|
var DebugSettings = ({ settings }) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
var _effect = _useSignals2();
|
|
72
|
+
try {
|
|
73
|
+
const { t } = useTranslation(DEBUG_PLUGIN);
|
|
74
|
+
const [toast, setToast] = useState();
|
|
75
|
+
const client = useClient();
|
|
76
|
+
const download = useFileDownload();
|
|
77
|
+
const [storageConfig, setStorageConfig] = useState({});
|
|
78
|
+
const [upload] = useCapabilities(Capabilities.FileUploader);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
void Storage().then((config) => setStorageConfig(config));
|
|
81
|
+
}, []);
|
|
82
|
+
const handleToast = (toast2) => {
|
|
83
|
+
setToast(toast2);
|
|
84
|
+
const t2 = setTimeout(() => setToast(void 0), 5e3);
|
|
85
|
+
return () => clearTimeout(t2);
|
|
86
|
+
};
|
|
87
|
+
const handleDownload = async () => {
|
|
88
|
+
const data = await client.diagnostics();
|
|
89
|
+
const file = new Blob([
|
|
90
|
+
JSON.stringify(data, void 0, 2)
|
|
91
|
+
], {
|
|
92
|
+
type: "text/plain"
|
|
93
|
+
});
|
|
94
|
+
const fileName = `composer-${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`;
|
|
95
|
+
download(file, fileName);
|
|
96
|
+
if (upload) {
|
|
97
|
+
const info = await upload(new File([
|
|
98
|
+
file
|
|
99
|
+
], fileName), client.spaces.default);
|
|
100
|
+
if (!info) {
|
|
101
|
+
log.error("diagnostics failed to upload to IPFS", void 0, {
|
|
102
|
+
F: __dxlog_file,
|
|
103
|
+
L: 56,
|
|
104
|
+
S: void 0,
|
|
105
|
+
C: (f, a) => f(...a)
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
handleToast({
|
|
110
|
+
title: t("settings uploaded"),
|
|
111
|
+
description: t("settings uploaded to clipboard")
|
|
112
|
+
});
|
|
113
|
+
const url = client.config.values.runtime.services.ipfs.gateway + "/" + info.cid;
|
|
114
|
+
void navigator.clipboard.writeText(url);
|
|
115
|
+
handleToast({
|
|
116
|
+
title: t("settings uploaded"),
|
|
117
|
+
description: t("settings uploaded to clipboard")
|
|
118
|
+
});
|
|
119
|
+
log.info("diagnostics", {
|
|
120
|
+
url
|
|
121
|
+
}, {
|
|
93
122
|
F: __dxlog_file,
|
|
94
|
-
L:
|
|
123
|
+
L: 65,
|
|
95
124
|
S: void 0,
|
|
96
125
|
C: (f, a) => f(...a)
|
|
97
126
|
});
|
|
98
|
-
return;
|
|
99
127
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
L: 65,
|
|
115
|
-
S: void 0,
|
|
116
|
-
C: (f, a) => f(...a)
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const handleRepair = async () => {
|
|
121
|
-
try {
|
|
122
|
-
const info = await client.repair();
|
|
123
|
-
setStorageConfig(await Storage());
|
|
124
|
-
handleToast({
|
|
125
|
-
title: t("settings repair success"),
|
|
126
|
-
description: JSON.stringify(info, void 0, 2)
|
|
127
|
-
});
|
|
128
|
-
} catch (err) {
|
|
129
|
-
handleToast({
|
|
130
|
-
title: t("settings repair failed"),
|
|
131
|
-
description: err.message
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
return /* @__PURE__ */ React2.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
136
|
-
label: t("settings wireframe")
|
|
137
|
-
}, /* @__PURE__ */ React2.createElement(Input2.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(Icon, {
|
|
145
|
-
icon: "ph--download-simple--regular",
|
|
146
|
-
size: 5
|
|
147
|
-
}))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
148
|
-
label: t("settings repair")
|
|
149
|
-
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
150
|
-
onClick: handleRepair
|
|
151
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
152
|
-
icon: "ph--first-aid-kit--regular",
|
|
153
|
-
size: 5
|
|
154
|
-
}))), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
155
|
-
icon: "ph--gift--duotone",
|
|
156
|
-
size: 5,
|
|
157
|
-
classNames: "inline mr-1"
|
|
158
|
-
}), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
159
|
-
label: t("settings choose storage adaptor")
|
|
160
|
-
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
161
|
-
value: Object.entries(StorageAdapters).find(([name2, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
|
|
162
|
-
onValueChange: (value) => {
|
|
163
|
-
if (confirm(t("settings storage adapter changed alert"))) {
|
|
164
|
-
updateConfig(storageConfig, setStorageConfig, [
|
|
165
|
-
"runtime",
|
|
166
|
-
"client",
|
|
167
|
-
"storage",
|
|
168
|
-
"dataStore"
|
|
169
|
-
], StorageAdapters[value]);
|
|
128
|
+
};
|
|
129
|
+
const handleRepair = async () => {
|
|
130
|
+
try {
|
|
131
|
+
const info = await client.repair();
|
|
132
|
+
setStorageConfig(await Storage());
|
|
133
|
+
handleToast({
|
|
134
|
+
title: t("settings repair success"),
|
|
135
|
+
description: JSON.stringify(info, void 0, 2)
|
|
136
|
+
});
|
|
137
|
+
} catch (err) {
|
|
138
|
+
handleToast({
|
|
139
|
+
title: t("settings repair failed"),
|
|
140
|
+
description: err.message
|
|
141
|
+
});
|
|
170
142
|
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ React2.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
145
|
+
label: t("settings wireframe")
|
|
146
|
+
}, /* @__PURE__ */ React2.createElement(Input2.Switch, {
|
|
147
|
+
checked: settings.wireframe,
|
|
148
|
+
onCheckedChange: (checked) => settings.wireframe = !!checked
|
|
149
|
+
})), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
150
|
+
label: t("settings download diagnostics")
|
|
151
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
152
|
+
onClick: handleDownload
|
|
153
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
154
|
+
icon: "ph--download-simple--regular",
|
|
155
|
+
size: 5
|
|
156
|
+
}))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
157
|
+
label: t("settings repair")
|
|
158
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
159
|
+
onClick: handleRepair
|
|
160
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
161
|
+
icon: "ph--first-aid-kit--regular",
|
|
162
|
+
size: 5
|
|
163
|
+
}))), toast && /* @__PURE__ */ React2.createElement(Toast.Root, null, /* @__PURE__ */ React2.createElement(Toast.Body, null, /* @__PURE__ */ React2.createElement(Toast.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
164
|
+
icon: "ph--gift--duotone",
|
|
165
|
+
size: 5,
|
|
166
|
+
classNames: "inline mr-1"
|
|
167
|
+
}), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
168
|
+
label: t("settings choose storage adaptor")
|
|
169
|
+
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
170
|
+
value: Object.entries(StorageAdapters).find(([name2, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
|
|
171
|
+
onValueChange: (value) => {
|
|
172
|
+
if (confirm(t("settings storage adapter changed alert"))) {
|
|
173
|
+
updateConfig(storageConfig, setStorageConfig, [
|
|
174
|
+
"runtime",
|
|
175
|
+
"client",
|
|
176
|
+
"storage",
|
|
177
|
+
"dataStore"
|
|
178
|
+
], StorageAdapters[value]);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
|
|
182
|
+
placeholder: t("settings data store label")
|
|
183
|
+
}), /* @__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, {
|
|
184
|
+
key,
|
|
185
|
+
value: key
|
|
186
|
+
}, t(`settings storage adaptor ${key} label`)))))))));
|
|
187
|
+
} finally {
|
|
188
|
+
_effect.f();
|
|
189
|
+
}
|
|
178
190
|
};
|
|
179
191
|
var updateConfig = (config, setConfig, path, value) => {
|
|
180
192
|
const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
|
|
@@ -186,151 +198,147 @@ var updateConfig = (config, setConfig, path, value) => {
|
|
|
186
198
|
};
|
|
187
199
|
|
|
188
200
|
// packages/plugins/plugin-debug/src/components/DebugStatus.tsx
|
|
201
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
189
202
|
import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
190
|
-
import { useAppGraph, useLayout } from "@dxos/app-framework";
|
|
191
203
|
import { TimeoutError } from "@dxos/async";
|
|
192
|
-
import {
|
|
193
|
-
import { getActiveSpace } from "@dxos/plugin-space";
|
|
204
|
+
import { useActiveSpace } from "@dxos/plugin-space";
|
|
194
205
|
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
195
206
|
import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
|
|
196
207
|
import { useNetworkStatus } from "@dxos/react-client/mesh";
|
|
197
|
-
import { Icon as Icon2
|
|
208
|
+
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
198
209
|
var styles = {
|
|
199
210
|
success: "text-sky-300 dark:text-green-700",
|
|
200
211
|
warning: "text-orange-300 dark:text-orange-600",
|
|
201
212
|
error: "text-red-300 dark:text-red-600"
|
|
202
213
|
};
|
|
203
214
|
var ErrorIndicator = () => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
window.
|
|
218
|
-
|
|
215
|
+
var _effect = _useSignals3();
|
|
216
|
+
try {
|
|
217
|
+
const [, forceUpdate] = useState2({});
|
|
218
|
+
const errorRef = useRef();
|
|
219
|
+
useEffect2(() => {
|
|
220
|
+
const errorListener = (event) => {
|
|
221
|
+
const error = event.error ?? event.reason;
|
|
222
|
+
if (errorRef.current !== error) {
|
|
223
|
+
errorRef.current = error;
|
|
224
|
+
forceUpdate({});
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener("error", errorListener);
|
|
228
|
+
window.addEventListener("unhandledrejection", errorListener);
|
|
229
|
+
return () => {
|
|
230
|
+
window.removeEventListener("error", errorListener);
|
|
231
|
+
window.removeEventListener("unhandledrejection", errorListener);
|
|
232
|
+
};
|
|
233
|
+
}, []);
|
|
234
|
+
const handleReset = () => {
|
|
235
|
+
errorRef.current = void 0;
|
|
236
|
+
forceUpdate({});
|
|
219
237
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
};
|
|
225
|
-
if (errorRef.current) {
|
|
226
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
227
|
-
title: errorRef.current.message,
|
|
228
|
-
onClick: handleReset
|
|
229
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
230
|
-
icon: "ph--warning-circle--duotone",
|
|
231
|
-
size: 4,
|
|
232
|
-
classNames: styles.error
|
|
233
|
-
}));
|
|
234
|
-
} else {
|
|
235
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
236
|
-
title: "No errors."
|
|
237
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
238
|
-
icon: "ph--check--regular",
|
|
239
|
-
size: 4
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
var SwarmIndicator = () => {
|
|
244
|
-
const [state, setState] = useState2(0);
|
|
245
|
-
const { swarm } = useNetworkStatus();
|
|
246
|
-
useEffect2(() => {
|
|
247
|
-
setState(swarm === ConnectionState.ONLINE ? 0 : 1);
|
|
248
|
-
}, [
|
|
249
|
-
swarm
|
|
250
|
-
]);
|
|
251
|
-
if (state === 0) {
|
|
252
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
253
|
-
title: "Connected to swarm."
|
|
254
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
255
|
-
icon: "ph--lightning--regular",
|
|
256
|
-
size: 4
|
|
257
|
-
}));
|
|
258
|
-
} else {
|
|
259
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
260
|
-
title: "Disconnected from swarm."
|
|
261
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
262
|
-
icon: "ph--lightning-slash--regular",
|
|
263
|
-
size: 4,
|
|
264
|
-
classNames: styles.warning
|
|
265
|
-
}));
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
var SavingIndicator = () => {
|
|
269
|
-
const [state, _setState] = useState2(0);
|
|
270
|
-
const layout = useLayout();
|
|
271
|
-
const { graph } = useAppGraph();
|
|
272
|
-
const _space = graph ? getActiveSpace(graph, layout.active[0]) : void 0;
|
|
273
|
-
switch (state) {
|
|
274
|
-
case 2:
|
|
275
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
276
|
-
title: "Edit not saved."
|
|
238
|
+
if (errorRef.current) {
|
|
239
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
240
|
+
title: errorRef.current.message,
|
|
241
|
+
onClick: handleReset
|
|
277
242
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
278
|
-
icon: "ph--circle--duotone",
|
|
243
|
+
icon: "ph--warning-circle--duotone",
|
|
279
244
|
size: 4,
|
|
280
|
-
classNames: styles.
|
|
245
|
+
classNames: styles.error
|
|
281
246
|
}));
|
|
282
|
-
|
|
247
|
+
} else {
|
|
283
248
|
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
284
|
-
title: "
|
|
249
|
+
title: "No errors."
|
|
285
250
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
286
|
-
icon: "ph--
|
|
287
|
-
size: 4
|
|
288
|
-
classNames: styles.success
|
|
251
|
+
icon: "ph--check--regular",
|
|
252
|
+
size: 4
|
|
289
253
|
}));
|
|
290
|
-
|
|
291
|
-
|
|
254
|
+
}
|
|
255
|
+
} finally {
|
|
256
|
+
_effect.f();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var SwarmIndicator = () => {
|
|
260
|
+
var _effect = _useSignals3();
|
|
261
|
+
try {
|
|
262
|
+
const [state, setState] = useState2(0);
|
|
263
|
+
const { swarm } = useNetworkStatus();
|
|
264
|
+
useEffect2(() => {
|
|
265
|
+
setState(swarm === ConnectionState.ONLINE ? 0 : 1);
|
|
266
|
+
}, [
|
|
267
|
+
swarm
|
|
268
|
+
]);
|
|
269
|
+
if (state === 0) {
|
|
292
270
|
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
293
|
-
title: "
|
|
271
|
+
title: "Connected to swarm."
|
|
294
272
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
295
|
-
icon: "ph--
|
|
273
|
+
icon: "ph--lightning--regular",
|
|
296
274
|
size: 4
|
|
297
275
|
}));
|
|
276
|
+
} else {
|
|
277
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
278
|
+
title: "Disconnected from swarm."
|
|
279
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
280
|
+
icon: "ph--lightning-slash--regular",
|
|
281
|
+
size: 4,
|
|
282
|
+
classNames: styles.warning
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
} finally {
|
|
286
|
+
_effect.f();
|
|
298
287
|
}
|
|
299
288
|
};
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
289
|
+
var SavingIndicator = () => {
|
|
290
|
+
var _effect = _useSignals3();
|
|
291
|
+
try {
|
|
292
|
+
const [state, _setState] = useState2(0);
|
|
293
|
+
const _space = useActiveSpace();
|
|
294
|
+
switch (state) {
|
|
295
|
+
case 2:
|
|
296
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
297
|
+
title: "Edit not saved."
|
|
298
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
299
|
+
icon: "ph--circle--duotone",
|
|
300
|
+
size: 4,
|
|
301
|
+
classNames: styles.warning
|
|
302
|
+
}));
|
|
303
|
+
case 1:
|
|
304
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
305
|
+
title: "Saving..."
|
|
306
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
307
|
+
icon: "ph--circle--duotone",
|
|
308
|
+
size: 4,
|
|
309
|
+
classNames: styles.success
|
|
310
|
+
}));
|
|
311
|
+
case 0:
|
|
312
|
+
default:
|
|
313
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
314
|
+
title: "Modified indicator."
|
|
315
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
316
|
+
icon: "ph--circle--duotone",
|
|
317
|
+
size: 4
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
} finally {
|
|
321
|
+
_effect.f();
|
|
322
|
+
}
|
|
320
323
|
};
|
|
321
324
|
var indicators = [
|
|
322
325
|
SavingIndicator,
|
|
323
326
|
SwarmIndicator,
|
|
324
|
-
PerformanceIndicator,
|
|
325
327
|
ErrorIndicator
|
|
326
328
|
];
|
|
327
329
|
var DebugStatus = () => {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
var _effect = _useSignals3();
|
|
331
|
+
try {
|
|
332
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React3.createElement(Indicator, {
|
|
333
|
+
key: Indicator.name
|
|
334
|
+
})));
|
|
335
|
+
} finally {
|
|
336
|
+
_effect.f();
|
|
337
|
+
}
|
|
331
338
|
};
|
|
332
339
|
|
|
333
340
|
// packages/plugins/plugin-debug/src/components/Wireframe.tsx
|
|
341
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
334
342
|
import React4 from "react";
|
|
335
343
|
import { useResizeDetector } from "react-resize-detector";
|
|
336
344
|
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
@@ -338,48 +346,54 @@ import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
|
338
346
|
import { SyntaxHighlighter as SyntaxHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
|
|
339
347
|
import { mx } from "@dxos/react-ui-theme";
|
|
340
348
|
var Wireframe = ({ classNames, label, object }) => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
ref
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
349
|
+
var _effect = _useSignals4();
|
|
350
|
+
try {
|
|
351
|
+
const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));
|
|
352
|
+
const { width, height, ref } = useResizeDetector();
|
|
353
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
354
|
+
ref,
|
|
355
|
+
className: mx("relative grow min-bs-96", classNames),
|
|
356
|
+
...attendableAttrs
|
|
357
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
358
|
+
className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
|
|
359
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
360
|
+
className: "flex justify-between"
|
|
361
|
+
}, /* @__PURE__ */ React4.createElement("div", null, label), /* @__PURE__ */ React4.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React4.createElement(SyntaxHighlighter2, {
|
|
362
|
+
language: "json",
|
|
363
|
+
classNames: "flex w-full text-xs opacity-75 rounded"
|
|
364
|
+
}, JSON.stringify(object, void 0, 2))), /* @__PURE__ */ React4.createElement("svg", {
|
|
365
|
+
width,
|
|
366
|
+
height,
|
|
367
|
+
className: "bg-transparent [&>*]:text-subdued"
|
|
368
|
+
}, /* @__PURE__ */ React4.createElement("rect", {
|
|
369
|
+
x: 0,
|
|
370
|
+
y: 0,
|
|
371
|
+
width,
|
|
372
|
+
height,
|
|
373
|
+
strokeWidth: 1,
|
|
374
|
+
fill: "none"
|
|
375
|
+
}), /* @__PURE__ */ React4.createElement("line", {
|
|
376
|
+
x1: 0,
|
|
377
|
+
y1: 0,
|
|
378
|
+
x2: width,
|
|
379
|
+
y2: height,
|
|
380
|
+
strokeWidth: 1
|
|
381
|
+
}), /* @__PURE__ */ React4.createElement("line", {
|
|
382
|
+
x1: 0,
|
|
383
|
+
y1: height,
|
|
384
|
+
x2: width,
|
|
385
|
+
y2: 0,
|
|
386
|
+
strokeWidth: 1
|
|
387
|
+
})));
|
|
388
|
+
} finally {
|
|
389
|
+
_effect.f();
|
|
390
|
+
}
|
|
378
391
|
};
|
|
379
392
|
|
|
380
393
|
// packages/plugins/plugin-debug/src/components/index.ts
|
|
381
|
-
var DebugApp = lazy(() => import("./DebugApp-
|
|
382
|
-
var
|
|
394
|
+
var DebugApp = lazy(() => import("./DebugApp-WSEJPCKY.mjs"));
|
|
395
|
+
var DevtoolsOverviewContainer = lazy(() => import("./DevtoolsOverviewContainer-IIIWO77Q.mjs"));
|
|
396
|
+
var SpaceGenerator = lazy(() => import("./SpaceGenerator-RHQLPN44.mjs"));
|
|
383
397
|
|
|
384
398
|
// packages/plugins/plugin-debug/src/capabilities/react-surface.tsx
|
|
385
399
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/capabilities/react-surface.tsx";
|
|
@@ -414,7 +428,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
414
428
|
if (!(collection instanceof CollectionType)) {
|
|
415
429
|
return;
|
|
416
430
|
}
|
|
417
|
-
const { dispatchPromise: dispatch } =
|
|
431
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
418
432
|
objects.forEach((object) => {
|
|
419
433
|
void dispatch(createIntent(SpaceAction.AddObject, {
|
|
420
434
|
target: collection,
|
|
@@ -446,7 +460,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
446
460
|
],
|
|
447
461
|
position: "hoist",
|
|
448
462
|
filter: (data) => {
|
|
449
|
-
const settings = context.
|
|
463
|
+
const settings = context.getCapability(Capabilities2.SettingsStore).getStore(DEBUG_PLUGIN).value;
|
|
450
464
|
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
451
465
|
},
|
|
452
466
|
component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
|
|
@@ -463,6 +477,11 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
463
477
|
object: data.companionTo
|
|
464
478
|
})
|
|
465
479
|
}),
|
|
480
|
+
createSurface({
|
|
481
|
+
id: `${DEBUG_PLUGIN}/devtools-overview`,
|
|
482
|
+
role: "deck-companion--devtools",
|
|
483
|
+
component: () => /* @__PURE__ */ React5.createElement(DevtoolsOverviewContainer, null)
|
|
484
|
+
}),
|
|
466
485
|
createSurface({
|
|
467
486
|
id: `${DEBUG_PLUGIN}/status`,
|
|
468
487
|
role: "status",
|
|
@@ -537,7 +556,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
537
556
|
role: "article",
|
|
538
557
|
filter: (data) => data.subject === Devtools.Echo.Spaces,
|
|
539
558
|
component: () => {
|
|
540
|
-
const { dispatchPromise: dispatch } =
|
|
559
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
541
560
|
const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
|
|
542
561
|
part: "main",
|
|
543
562
|
subject: [
|
|
@@ -557,7 +576,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
557
576
|
filter: (data) => data.subject === Devtools.Echo.Space,
|
|
558
577
|
component: () => {
|
|
559
578
|
const space = useCurrentSpace();
|
|
560
|
-
const { dispatchPromise: dispatch } =
|
|
579
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
561
580
|
const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
|
|
562
581
|
part: "main",
|
|
563
582
|
subject: [
|
|
@@ -595,6 +614,17 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
595
614
|
});
|
|
596
615
|
}
|
|
597
616
|
}),
|
|
617
|
+
createSurface({
|
|
618
|
+
id: `${DEBUG_PLUGIN}/echo/schema`,
|
|
619
|
+
role: "article",
|
|
620
|
+
filter: (data) => data.subject === Devtools.Echo.Schema,
|
|
621
|
+
component: () => {
|
|
622
|
+
const space = useCurrentSpace();
|
|
623
|
+
return /* @__PURE__ */ React5.createElement(SchemaPanel, {
|
|
624
|
+
space
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}),
|
|
598
628
|
createSurface({
|
|
599
629
|
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
600
630
|
role: "article",
|
|
@@ -682,7 +712,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
682
712
|
filter: (data) => data.subject === Devtools.Edge.Traces,
|
|
683
713
|
component: () => {
|
|
684
714
|
const space = useCurrentSpace();
|
|
685
|
-
return /* @__PURE__ */ React5.createElement(
|
|
715
|
+
return /* @__PURE__ */ React5.createElement(InvocationTraceContainer, {
|
|
686
716
|
space
|
|
687
717
|
});
|
|
688
718
|
}
|
|
@@ -692,7 +722,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
692
722
|
role: "article",
|
|
693
723
|
filter: (data) => data.subject === Devtools.Edge.Testing,
|
|
694
724
|
component: () => {
|
|
695
|
-
const { dispatchPromise: dispatch } =
|
|
725
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
696
726
|
const onSpaceCreate = useCallback(async (space) => {
|
|
697
727
|
await space.waitUntilReady();
|
|
698
728
|
await dispatch(createIntent(SpaceAction.Migrate, {
|
|
@@ -713,7 +743,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
713
743
|
result
|
|
714
744
|
}, {
|
|
715
745
|
F: __dxlog_file2,
|
|
716
|
-
L:
|
|
746
|
+
L: 388,
|
|
717
747
|
S: void 0,
|
|
718
748
|
C: (f, a) => f(...a)
|
|
719
749
|
});
|
|
@@ -736,4 +766,4 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
736
766
|
export {
|
|
737
767
|
react_surface_default as default
|
|
738
768
|
};
|
|
739
|
-
//# sourceMappingURL=react-surface-
|
|
769
|
+
//# sourceMappingURL=react-surface-PHUWS5WD.mjs.map
|