@dxos/shell 0.5.1-main.ef0d69d → 0.5.1-main.f81ddc4
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/bundle/shell.mjs +4591 -4579
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +54 -54
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +60 -35
- package/dist/lib/browser/react.mjs.map +3 -3
- package/dist/types/src/composites/Shell/run-shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/run-shell.js +29 -10
- package/dist/types/src/composites/Shell/run-shell.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +1 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +1 -0
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/package.json +21 -21
- package/src/composites/Shell/run-shell.tsx +51 -19
- package/src/translations/locales/en-US.ts +1 -0
|
@@ -3746,8 +3746,8 @@ import React47, { StrictMode } from "react";
|
|
|
3746
3746
|
import { createRoot } from "react-dom/client";
|
|
3747
3747
|
import { DEFAULT_CLIENT_CHANNEL, DEFAULT_SHELL_CHANNEL } from "@dxos/client-protocol";
|
|
3748
3748
|
import { ShellRuntimeImpl } from "@dxos/client-services";
|
|
3749
|
-
import { AgentHostingProvider, Client, ClientContext, ClientServicesProxy, Config, SystemStatus } from "@dxos/react-client";
|
|
3750
|
-
import { ThemeProvider, Tooltip as Tooltip7 } from "@dxos/react-ui";
|
|
3749
|
+
import { AgentHostingProvider, Client, ClientContext, ClientServicesProxy, Config, ShellDisplay as ShellDisplay2, SystemStatus } from "@dxos/react-client";
|
|
3750
|
+
import { Button as Button11, Dialog as Dialog3, ThemeProvider, Tooltip as Tooltip7, useTranslation as useTranslation26 } from "@dxos/react-ui";
|
|
3751
3751
|
import { defaultTx } from "@dxos/react-ui-theme";
|
|
3752
3752
|
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
3753
3753
|
|
|
@@ -4067,7 +4067,8 @@ var os = {
|
|
|
4067
4067
|
"agent message body": "Creating an agent helps keep your devices and peers in-sync. An agent is like any other device, but since it\u2019s always online your changes will sync even when all your physical devices are\xA0asleep.",
|
|
4068
4068
|
"create agent label": "Start an agent",
|
|
4069
4069
|
"destroy agent label": "Shut down agent",
|
|
4070
|
-
"agent device label": "Your agent"
|
|
4070
|
+
"agent device label": "Your agent",
|
|
4071
|
+
"shell fallback title": "Shell failed to connect"
|
|
4071
4072
|
};
|
|
4072
4073
|
|
|
4073
4074
|
// packages/sdk/shell/src/translations/index.ts
|
|
@@ -4077,39 +4078,63 @@ var osTranslations = {
|
|
|
4077
4078
|
|
|
4078
4079
|
// packages/sdk/shell/src/composites/Shell/run-shell.tsx
|
|
4079
4080
|
var runShell = async (config = new Config()) => {
|
|
4080
|
-
const services = new ClientServicesProxy(createIFramePort({
|
|
4081
|
-
channel: DEFAULT_CLIENT_CHANNEL
|
|
4082
|
-
}));
|
|
4083
|
-
const client = new Client({
|
|
4084
|
-
config,
|
|
4085
|
-
services
|
|
4086
|
-
});
|
|
4087
4081
|
const runtime = new ShellRuntimeImpl(createIFramePort({
|
|
4088
4082
|
channel: DEFAULT_SHELL_CHANNEL
|
|
4089
4083
|
}));
|
|
4090
|
-
await
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4084
|
+
await runtime.open();
|
|
4085
|
+
try {
|
|
4086
|
+
const services = new ClientServicesProxy(createIFramePort({
|
|
4087
|
+
channel: DEFAULT_CLIENT_CHANNEL
|
|
4088
|
+
}));
|
|
4089
|
+
const client = new Client({
|
|
4090
|
+
config,
|
|
4091
|
+
services
|
|
4092
|
+
});
|
|
4093
|
+
await client.initialize();
|
|
4094
|
+
createRoot(document.getElementById("root")).render(/* @__PURE__ */ React47.createElement(StrictMode, null, /* @__PURE__ */ React47.createElement(ThemeProvider, {
|
|
4095
|
+
tx: defaultTx,
|
|
4096
|
+
resourceExtensions: [
|
|
4097
|
+
osTranslations
|
|
4098
|
+
]
|
|
4099
|
+
}, /* @__PURE__ */ React47.createElement(ClientContext.Provider, {
|
|
4100
|
+
value: {
|
|
4101
|
+
client,
|
|
4102
|
+
status: SystemStatus.ACTIVE
|
|
4103
|
+
}
|
|
4104
|
+
}, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(Tooltip7.Provider, null, /* @__PURE__ */ React47.createElement(AgentHostingProvider, null, /* @__PURE__ */ React47.createElement(Shell, {
|
|
4105
|
+
runtime,
|
|
4106
|
+
origin: location.origin
|
|
4107
|
+
}))))))));
|
|
4108
|
+
} catch {
|
|
4109
|
+
createRoot(document.getElementById("root")).render(/* @__PURE__ */ React47.createElement(StrictMode, null, /* @__PURE__ */ React47.createElement(ThemeProvider, {
|
|
4110
|
+
tx: defaultTx,
|
|
4111
|
+
resourceExtensions: [
|
|
4112
|
+
osTranslations
|
|
4113
|
+
]
|
|
4114
|
+
}, /* @__PURE__ */ React47.createElement(Fallback, {
|
|
4115
|
+
onClose: () => runtime.setAppContext({
|
|
4116
|
+
display: ShellDisplay2.NONE
|
|
4117
|
+
})
|
|
4118
|
+
}))));
|
|
4119
|
+
}
|
|
4120
|
+
};
|
|
4121
|
+
var Fallback = ({ onClose }) => {
|
|
4122
|
+
const { t } = useTranslation26("os");
|
|
4123
|
+
return /* @__PURE__ */ React47.createElement(Dialog3.Root, {
|
|
4124
|
+
modal: true,
|
|
4125
|
+
open: true,
|
|
4126
|
+
onOpenChange: () => onClose?.()
|
|
4127
|
+
}, /* @__PURE__ */ React47.createElement(Dialog3.Overlay, null, /* @__PURE__ */ React47.createElement(Dialog3.Content, null, /* @__PURE__ */ React47.createElement(Dialog3.Title, null, t("shell fallback title")), /* @__PURE__ */ React47.createElement(Dialog3.Close, {
|
|
4128
|
+
asChild: true,
|
|
4129
|
+
onClick: () => onClose?.()
|
|
4130
|
+
}, /* @__PURE__ */ React47.createElement(Button11, {
|
|
4131
|
+
variant: "primary"
|
|
4132
|
+
}, t("close label"))))));
|
|
4108
4133
|
};
|
|
4109
4134
|
|
|
4110
4135
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
4111
4136
|
import React48, { createContext as createContext2, useCallback as useCallback9, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo6, useState as useState14 } from "react";
|
|
4112
|
-
import { ShellDisplay as
|
|
4137
|
+
import { ShellDisplay as ShellDisplay3, ShellLayout as ShellLayout3, useClient as useClient8 } from "@dxos/react-client";
|
|
4113
4138
|
import { useIdentity as useIdentity3 } from "@dxos/react-client/halo";
|
|
4114
4139
|
import { mx as mx25 } from "@dxos/react-ui-theme";
|
|
4115
4140
|
|
|
@@ -4152,9 +4177,9 @@ var useShell = () => {
|
|
|
4152
4177
|
const setLayout = async (layout, options) => {
|
|
4153
4178
|
if (runtime) {
|
|
4154
4179
|
if (layout === ShellLayout3.DEFAULT) {
|
|
4155
|
-
setDisplay?.(
|
|
4180
|
+
setDisplay?.(ShellDisplay3.NONE);
|
|
4156
4181
|
} else {
|
|
4157
|
-
setDisplay?.(
|
|
4182
|
+
setDisplay?.(ShellDisplay3.FULLSCREEN);
|
|
4158
4183
|
}
|
|
4159
4184
|
runtime.setLayout({
|
|
4160
4185
|
layout,
|
|
@@ -4170,7 +4195,7 @@ var useShell = () => {
|
|
|
4170
4195
|
var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
|
|
4171
4196
|
const client = useClient8();
|
|
4172
4197
|
const identity = useIdentity3();
|
|
4173
|
-
const [display, setDisplay] = useState14(!identity || spaceInvitationCode || deviceInvitationCode ?
|
|
4198
|
+
const [display, setDisplay] = useState14(!identity || spaceInvitationCode || deviceInvitationCode ? ShellDisplay3.FULLSCREEN : ShellDisplay3.NONE);
|
|
4174
4199
|
const shellRuntime = useMemo6(() => {
|
|
4175
4200
|
if (client.config.get("runtime.app.env.DX_VAULT") !== "false") {
|
|
4176
4201
|
return;
|
|
@@ -4205,13 +4230,13 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4205
4230
|
shellRuntime.setLayout({
|
|
4206
4231
|
layout: ShellLayout3.SHARE_IDENTITY
|
|
4207
4232
|
});
|
|
4208
|
-
setDisplay(
|
|
4233
|
+
setDisplay(ShellDisplay3.FULLSCREEN);
|
|
4209
4234
|
} else if (event.key === "." && modifier) {
|
|
4210
4235
|
shellRuntime.setLayout({
|
|
4211
4236
|
layout: ShellLayout3.SPACE,
|
|
4212
4237
|
spaceKey: space.key
|
|
4213
4238
|
});
|
|
4214
|
-
setDisplay(
|
|
4239
|
+
setDisplay(ShellDisplay3.FULLSCREEN);
|
|
4215
4240
|
}
|
|
4216
4241
|
}, [
|
|
4217
4242
|
space,
|
|
@@ -4241,7 +4266,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4241
4266
|
shellRuntime
|
|
4242
4267
|
]);
|
|
4243
4268
|
return /* @__PURE__ */ React48.createElement(React48.Fragment, null, shellRuntime && /* @__PURE__ */ React48.createElement("div", {
|
|
4244
|
-
className: mx25(display ===
|
|
4269
|
+
className: mx25(display === ShellDisplay3.NONE ? "hidden" : "")
|
|
4245
4270
|
}, /* @__PURE__ */ React48.createElement(Shell, {
|
|
4246
4271
|
runtime: shellRuntime,
|
|
4247
4272
|
origin: window.location.origin
|