@dxos/plugin-debug 0.8.2-main.f11618f → 0.8.2-staging.42af850
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-HYNZTH2Z.mjs.map → DevtoolsOverviewContainer-IIIWO77Q.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-HR7R3RTE.mjs → SpaceGenerator-RHQLPN44.mjs} +246 -234
- package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-RTKWOHHT.mjs → app-graph-builder-PIPBIN6P.mjs} +88 -83
- 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 +6 -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-NEMNEAAI.mjs → react-surface-PHUWS5WD.mjs} +313 -266
- package/dist/lib/browser/react-surface-PHUWS5WD.mjs.map +7 -0
- package/dist/lib/browser/{settings-BIRIGKTH.mjs → settings-N4Q6YB7L.mjs} +3 -3
- 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/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.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/meta.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 +5 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -55
- package/src/capabilities/app-graph-builder.ts +415 -379
- package/src/capabilities/react-surface.tsx +23 -12
- package/src/components/DebugObjectPanel.tsx +2 -2
- package/src/components/DebugStatus.tsx +2 -5
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +3 -4
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +5 -5
- package/src/components/SpaceGenerator/presets.ts +18 -16
- package/src/components/Wireframe.tsx +2 -2
- package/src/meta.ts +0 -1
- package/src/translations.ts +1 -0
- package/src/types.ts +6 -5
- package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
- package/dist/lib/browser/DevtoolsOverviewContainer-HYNZTH2Z.mjs +0 -19
- package/dist/lib/browser/SpaceGenerator-HR7R3RTE.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-RTKWOHHT.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-NEMNEAAI.mjs.map +0 -7
- /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-BIRIGKTH.mjs.map → settings-N4Q6YB7L.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 { AutomergePanel, ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, EdgeDashboardPanel, FeedsPanel, IdentityPanel,
|
|
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,10 +198,10 @@ 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 {
|
|
204
|
+
import { useActiveSpace } from "@dxos/plugin-space";
|
|
193
205
|
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
194
206
|
import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
|
|
195
207
|
import { useNetworkStatus } from "@dxos/react-client/mesh";
|
|
@@ -200,100 +212,113 @@ var styles = {
|
|
|
200
212
|
error: "text-red-300 dark:text-red-600"
|
|
201
213
|
};
|
|
202
214
|
var ErrorIndicator = () => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
window.
|
|
217
|
-
|
|
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({});
|
|
218
237
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
};
|
|
224
|
-
if (errorRef.current) {
|
|
225
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
226
|
-
title: errorRef.current.message,
|
|
227
|
-
onClick: handleReset
|
|
228
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
229
|
-
icon: "ph--warning-circle--duotone",
|
|
230
|
-
size: 4,
|
|
231
|
-
classNames: styles.error
|
|
232
|
-
}));
|
|
233
|
-
} else {
|
|
234
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
235
|
-
title: "No errors."
|
|
236
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
237
|
-
icon: "ph--check--regular",
|
|
238
|
-
size: 4
|
|
239
|
-
}));
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
var SwarmIndicator = () => {
|
|
243
|
-
const [state, setState] = useState2(0);
|
|
244
|
-
const { swarm } = useNetworkStatus();
|
|
245
|
-
useEffect2(() => {
|
|
246
|
-
setState(swarm === ConnectionState.ONLINE ? 0 : 1);
|
|
247
|
-
}, [
|
|
248
|
-
swarm
|
|
249
|
-
]);
|
|
250
|
-
if (state === 0) {
|
|
251
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
252
|
-
title: "Connected to swarm."
|
|
253
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
254
|
-
icon: "ph--lightning--regular",
|
|
255
|
-
size: 4
|
|
256
|
-
}));
|
|
257
|
-
} else {
|
|
258
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
259
|
-
title: "Disconnected from swarm."
|
|
260
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
261
|
-
icon: "ph--lightning-slash--regular",
|
|
262
|
-
size: 4,
|
|
263
|
-
classNames: styles.warning
|
|
264
|
-
}));
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
var SavingIndicator = () => {
|
|
268
|
-
const [state, _setState] = useState2(0);
|
|
269
|
-
const layout = useLayout();
|
|
270
|
-
const { graph } = useAppGraph();
|
|
271
|
-
const _space = graph ? getActiveSpace(graph, layout.active[0]) : void 0;
|
|
272
|
-
switch (state) {
|
|
273
|
-
case 2:
|
|
274
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
275
|
-
title: "Edit not saved."
|
|
238
|
+
if (errorRef.current) {
|
|
239
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
240
|
+
title: errorRef.current.message,
|
|
241
|
+
onClick: handleReset
|
|
276
242
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
277
|
-
icon: "ph--circle--duotone",
|
|
243
|
+
icon: "ph--warning-circle--duotone",
|
|
278
244
|
size: 4,
|
|
279
|
-
classNames: styles.
|
|
245
|
+
classNames: styles.error
|
|
280
246
|
}));
|
|
281
|
-
|
|
247
|
+
} else {
|
|
282
248
|
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
283
|
-
title: "
|
|
249
|
+
title: "No errors."
|
|
284
250
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
285
|
-
icon: "ph--
|
|
286
|
-
size: 4
|
|
287
|
-
classNames: styles.success
|
|
251
|
+
icon: "ph--check--regular",
|
|
252
|
+
size: 4
|
|
288
253
|
}));
|
|
289
|
-
|
|
290
|
-
|
|
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) {
|
|
291
270
|
return /* @__PURE__ */ React3.createElement(StatusBar.Item, {
|
|
292
|
-
title: "
|
|
271
|
+
title: "Connected to swarm."
|
|
293
272
|
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
294
|
-
icon: "ph--
|
|
273
|
+
icon: "ph--lightning--regular",
|
|
295
274
|
size: 4
|
|
296
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();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
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();
|
|
297
322
|
}
|
|
298
323
|
};
|
|
299
324
|
var indicators = [
|
|
@@ -302,12 +327,18 @@ var indicators = [
|
|
|
302
327
|
ErrorIndicator
|
|
303
328
|
];
|
|
304
329
|
var DebugStatus = () => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
+
}
|
|
308
338
|
};
|
|
309
339
|
|
|
310
340
|
// packages/plugins/plugin-debug/src/components/Wireframe.tsx
|
|
341
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
311
342
|
import React4 from "react";
|
|
312
343
|
import { useResizeDetector } from "react-resize-detector";
|
|
313
344
|
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
@@ -315,49 +346,54 @@ import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
|
315
346
|
import { SyntaxHighlighter as SyntaxHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
|
|
316
347
|
import { mx } from "@dxos/react-ui-theme";
|
|
317
348
|
var Wireframe = ({ classNames, label, object }) => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
ref
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
+
}
|
|
355
391
|
};
|
|
356
392
|
|
|
357
393
|
// packages/plugins/plugin-debug/src/components/index.ts
|
|
358
|
-
var DebugApp = lazy(() => import("./DebugApp-
|
|
359
|
-
var DevtoolsOverviewContainer = lazy(() => import("./DevtoolsOverviewContainer-
|
|
360
|
-
var SpaceGenerator = lazy(() => import("./SpaceGenerator-
|
|
394
|
+
var DebugApp = lazy(() => import("./DebugApp-WSEJPCKY.mjs"));
|
|
395
|
+
var DevtoolsOverviewContainer = lazy(() => import("./DevtoolsOverviewContainer-IIIWO77Q.mjs"));
|
|
396
|
+
var SpaceGenerator = lazy(() => import("./SpaceGenerator-RHQLPN44.mjs"));
|
|
361
397
|
|
|
362
398
|
// packages/plugins/plugin-debug/src/capabilities/react-surface.tsx
|
|
363
399
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/capabilities/react-surface.tsx";
|
|
@@ -392,7 +428,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
392
428
|
if (!(collection instanceof CollectionType)) {
|
|
393
429
|
return;
|
|
394
430
|
}
|
|
395
|
-
const { dispatchPromise: dispatch } =
|
|
431
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
396
432
|
objects.forEach((object) => {
|
|
397
433
|
void dispatch(createIntent(SpaceAction.AddObject, {
|
|
398
434
|
target: collection,
|
|
@@ -424,7 +460,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
424
460
|
],
|
|
425
461
|
position: "hoist",
|
|
426
462
|
filter: (data) => {
|
|
427
|
-
const settings = context.
|
|
463
|
+
const settings = context.getCapability(Capabilities2.SettingsStore).getStore(DEBUG_PLUGIN).value;
|
|
428
464
|
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
429
465
|
},
|
|
430
466
|
component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
|
|
@@ -520,7 +556,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
520
556
|
role: "article",
|
|
521
557
|
filter: (data) => data.subject === Devtools.Echo.Spaces,
|
|
522
558
|
component: () => {
|
|
523
|
-
const { dispatchPromise: dispatch } =
|
|
559
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
524
560
|
const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
|
|
525
561
|
part: "main",
|
|
526
562
|
subject: [
|
|
@@ -540,7 +576,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
540
576
|
filter: (data) => data.subject === Devtools.Echo.Space,
|
|
541
577
|
component: () => {
|
|
542
578
|
const space = useCurrentSpace();
|
|
543
|
-
const { dispatchPromise: dispatch } =
|
|
579
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
544
580
|
const handleSelect = useCallback(() => dispatch(createIntent(LayoutAction.Open, {
|
|
545
581
|
part: "main",
|
|
546
582
|
subject: [
|
|
@@ -578,6 +614,17 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
578
614
|
});
|
|
579
615
|
}
|
|
580
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
|
+
}),
|
|
581
628
|
createSurface({
|
|
582
629
|
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
583
630
|
role: "article",
|
|
@@ -665,7 +712,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
665
712
|
filter: (data) => data.subject === Devtools.Edge.Traces,
|
|
666
713
|
component: () => {
|
|
667
714
|
const space = useCurrentSpace();
|
|
668
|
-
return /* @__PURE__ */ React5.createElement(
|
|
715
|
+
return /* @__PURE__ */ React5.createElement(InvocationTraceContainer, {
|
|
669
716
|
space
|
|
670
717
|
});
|
|
671
718
|
}
|
|
@@ -675,7 +722,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
675
722
|
role: "article",
|
|
676
723
|
filter: (data) => data.subject === Devtools.Edge.Testing,
|
|
677
724
|
component: () => {
|
|
678
|
-
const { dispatchPromise: dispatch } =
|
|
725
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
679
726
|
const onSpaceCreate = useCallback(async (space) => {
|
|
680
727
|
await space.waitUntilReady();
|
|
681
728
|
await dispatch(createIntent(SpaceAction.Migrate, {
|
|
@@ -696,7 +743,7 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
696
743
|
result
|
|
697
744
|
}, {
|
|
698
745
|
F: __dxlog_file2,
|
|
699
|
-
L:
|
|
746
|
+
L: 388,
|
|
700
747
|
S: void 0,
|
|
701
748
|
C: (f, a) => f(...a)
|
|
702
749
|
});
|
|
@@ -719,4 +766,4 @@ var react_surface_default = (context) => contributes(Capabilities2.ReactSurface,
|
|
|
719
766
|
export {
|
|
720
767
|
react_surface_default as default
|
|
721
768
|
};
|
|
722
|
-
//# sourceMappingURL=react-surface-
|
|
769
|
+
//# sourceMappingURL=react-surface-PHUWS5WD.mjs.map
|