@dxos/shell 0.5.1-main.bc05254 → 0.5.1-main.befa1bc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/bundle/shell.mjs +82505 -9
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +91 -146
  4. package/dist/bundle/shell.umd.js.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/react.mjs +81 -56
  7. package/dist/lib/browser/react.mjs.map +3 -3
  8. package/dist/types/src/composites/Shell/run-shell.d.ts.map +1 -1
  9. package/dist/types/src/composites/Shell/run-shell.js +29 -9
  10. package/dist/types/src/composites/Shell/run-shell.js.map +1 -1
  11. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +1 -1
  12. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  13. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +1 -1
  14. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  15. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts +1 -3
  16. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
  17. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +3 -2
  18. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
  19. package/dist/types/src/panels/JoinPanel/JoinPanel.js +2 -2
  20. package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
  21. package/dist/types/src/translations/locales/en-US.d.ts +1 -0
  22. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  23. package/dist/types/src/translations/locales/en-US.js +1 -0
  24. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  25. package/package.json +22 -21
  26. package/src/composites/Shell/run-shell.tsx +59 -18
  27. package/src/panels/IdentityPanel/IdentityPanel.tsx +1 -1
  28. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +2 -2
  29. package/src/panels/IdentityPanel/useAgentHandlers.ts +3 -4
  30. package/src/panels/JoinPanel/JoinPanel.tsx +2 -2
  31. package/src/translations/locales/en-US.ts +1 -0
  32. package/dist/bundle/index-BkvYpJbE.mjs +0 -96625
  33. package/dist/bundle/index-BkvYpJbE.mjs.map +0 -1
  34. package/dist/bundle/index-gdgcTUK8.mjs +0 -110
  35. package/dist/bundle/index-gdgcTUK8.mjs.map +0 -1
@@ -1178,7 +1178,7 @@ import { CopySimple, Plugs, PlugsConnected } from "@phosphor-icons/react";
1178
1178
  import React29, { useEffect as useEffect3, useMemo as useMemo3, useState as useState8 } from "react";
1179
1179
  import { generateName as generateName3 } from "@dxos/display-name";
1180
1180
  import { log as log6 } from "@dxos/log";
1181
- import { useClient as useClient3 } from "@dxos/react-client";
1181
+ import { useClient as useClient4 } from "@dxos/react-client";
1182
1182
  import { useIdentity, useDevices, useHaloInvitations as useHaloInvitations2 } from "@dxos/react-client/halo";
1183
1183
  import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client/invitations";
1184
1184
  import { useNetworkStatus, ConnectionState } from "@dxos/react-client/mesh";
@@ -1296,7 +1296,7 @@ var useIdentityMachine = (client, options) => {
1296
1296
  // packages/sdk/shell/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx
1297
1297
  import React25, { useCallback as useCallback4 } from "react";
1298
1298
  import { log as log2 } from "@dxos/log";
1299
- import { useAgentHostingProviderClient, useClient as useClient2 } from "@dxos/react-client";
1299
+ import { useAgentHostingClient, useClient as useClient2 } from "@dxos/react-client";
1300
1300
  import { useHaloInvitations } from "@dxos/react-client/halo";
1301
1301
  import { Invitation as Invitation2, InvitationEncoder } from "@dxos/react-client/invitations";
1302
1302
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx";
@@ -1304,7 +1304,7 @@ var IdentityActionChooser = (props) => {
1304
1304
  const { send } = props;
1305
1305
  const client = useClient2();
1306
1306
  const invitations = useHaloInvitations();
1307
- const agentHostingProviderClient = useAgentHostingProviderClient(client.config);
1307
+ const agentHostingProviderClient = useAgentHostingClient();
1308
1308
  const onInvitationEvent = useCallback4((invitation) => {
1309
1309
  const invitationCode = InvitationEncoder.encode(invitation);
1310
1310
  if (invitation.state === Invitation2.State.CONNECTING) {
@@ -1364,14 +1364,15 @@ import { hexToEmoji as hexToEmoji2, hexToHue } from "@dxos/util";
1364
1364
  import { useCallback as useCallback5, useEffect as useEffect2, useState as useState6 } from "react";
1365
1365
  import { invariant } from "@dxos/invariant";
1366
1366
  import { log as log4 } from "@dxos/log";
1367
- import { useAgentHostingProviderClient as useAgentHostingProviderClient2 } from "@dxos/react-client";
1367
+ import { useAgentHostingClient as useAgentHostingClient2, useClient as useClient3 } from "@dxos/react-client";
1368
1368
  import { Invitation as Invitation3, InvitationEncoder as InvitationEncoder2 } from "@dxos/react-client/invitations";
1369
1369
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useAgentHandlers.ts";
1370
- var useAgentHandlers = ({ client, invitations, identity }) => {
1370
+ var useAgentHandlers = ({ invitations, identity }) => {
1371
1371
  const [validationMessage, setValidationMessage] = useState6("");
1372
1372
  const [agentStatus, setAgentStatus] = useState6("");
1373
1373
  const [agentActive, setAgentActive] = useState6(false);
1374
- const agentHostingProviderClient = useAgentHostingProviderClient2(client.config);
1374
+ const agentHostingProviderClient = useAgentHostingClient2();
1375
+ const client = useClient3();
1375
1376
  useEffect2(() => {
1376
1377
  const fetchAgentStatus = async () => {
1377
1378
  if (agentHostingProviderClient) {
@@ -1397,13 +1398,13 @@ var useAgentHandlers = ({ client, invitations, identity }) => {
1397
1398
  authCode: invitation.authCode
1398
1399
  }), void 0, {
1399
1400
  F: __dxlog_file3,
1400
- L: 50,
1401
+ L: 49,
1401
1402
  S: void 0,
1402
1403
  C: (f, a) => f(...a)
1403
1404
  });
1404
1405
  invariant(identity, "Identity not found", {
1405
1406
  F: __dxlog_file3,
1406
- L: 51,
1407
+ L: 50,
1407
1408
  S: void 0,
1408
1409
  A: [
1409
1410
  "identity",
@@ -1435,7 +1436,7 @@ var useAgentHandlers = ({ client, invitations, identity }) => {
1435
1436
  const identity2 = client.halo.identity.get();
1436
1437
  invariant(identity2, "Identity not found", {
1437
1438
  F: __dxlog_file3,
1438
- L: 81,
1439
+ L: 80,
1439
1440
  S: void 0,
1440
1441
  A: [
1441
1442
  "identity",
@@ -1833,12 +1834,11 @@ var IdentityPanelWithInvitationImpl = ({ invitation, ...props }) => {
1833
1834
  };
1834
1835
  var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code, initialDisposition = "default", ...props }) => {
1835
1836
  const titleId = useId6("identityPanel__heading", propsTitleId);
1836
- const client = useClient3();
1837
+ const client = useClient4();
1837
1838
  const devices = useDevices();
1838
1839
  const identity = useIdentity();
1839
1840
  const invitations = useHaloInvitations2();
1840
1841
  const agentProps = useAgentHandlers({
1841
- client,
1842
1842
  identity,
1843
1843
  invitations
1844
1844
  });
@@ -1915,7 +1915,7 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
1915
1915
  // packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
1916
1916
  import React38, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo4 } from "react";
1917
1917
  import { log as log10 } from "@dxos/log";
1918
- import { useClient as useClient5, useMulticastObservable } from "@dxos/react-client";
1918
+ import { useClient as useClient6, useMulticastObservable } from "@dxos/react-client";
1919
1919
  import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
1920
1920
  import { DensityProvider as DensityProvider2, useId as useId8, useThemeContext as useThemeContext4 } from "@dxos/react-ui";
1921
1921
 
@@ -2654,13 +2654,13 @@ var IdentityAdded = (props) => {
2654
2654
  // packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx
2655
2655
  import React33, { useState as useState9 } from "react";
2656
2656
  import { log as log8 } from "@dxos/log";
2657
- import { useClient as useClient4 } from "@dxos/react-client";
2657
+ import { useClient as useClient5 } from "@dxos/react-client";
2658
2658
  import { useTranslation as useTranslation18 } from "@dxos/react-ui";
2659
2659
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx";
2660
2660
  var IdentityInput = (props) => {
2661
2661
  const { send, method } = props;
2662
2662
  const isRecover = method === "recover identity";
2663
- const client = useClient4();
2663
+ const client = useClient5();
2664
2664
  const { t } = useTranslation18("os");
2665
2665
  const [validationMessage, setValidationMessage] = useState9("");
2666
2666
  const createIdentity = (displayName) => {
@@ -2983,7 +2983,7 @@ var JoinPanelImpl = (props) => {
2983
2983
  id: "reset storage confirmation"
2984
2984
  }, /* @__PURE__ */ React38.createElement(ConfirmResetComponent, {
2985
2985
  send,
2986
- active: activeView === "reset identity confirmation",
2986
+ active: activeView === "reset storage confirmation",
2987
2987
  onCancel: onCancelResetStorage,
2988
2988
  onConfirm: onConfirmResetStorage
2989
2989
  })), /* @__PURE__ */ React38.createElement(Viewport.View, {
@@ -3102,7 +3102,7 @@ var JoinPanelImpl = (props) => {
3102
3102
  })))));
3103
3103
  };
3104
3104
  var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone: propsOnDone, onCancelResetStorage }) => {
3105
- const client = useClient5();
3105
+ const client = useClient6();
3106
3106
  const identity = useIdentity2();
3107
3107
  const { hasIosKeyboard } = useThemeContext4();
3108
3108
  const titleId = useId8("joinPanel__heading", propsTitleId);
@@ -3150,7 +3150,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
3150
3150
  }):
3151
3151
  return "addition method chooser";
3152
3152
  case joinState.matches("resettingIdentity"):
3153
- return "reset identity confirmation";
3153
+ return "reset storage confirmation";
3154
3154
  case joinState.matches({
3155
3155
  choosingIdentity: "creatingIdentity"
3156
3156
  }):
@@ -3746,15 +3746,15 @@ 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 { 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
 
3754
3754
  // packages/sdk/shell/src/composites/Shell/Shell.tsx
3755
3755
  import React46, { useEffect as useEffect7, useState as useState13 } from "react";
3756
3756
  import { log as log14 } from "@dxos/log";
3757
- import { ShellDisplay, ShellLayout, useClient as useClient6 } from "@dxos/react-client";
3757
+ import { ShellDisplay, ShellLayout, useClient as useClient7 } from "@dxos/react-client";
3758
3758
  import { useSpace as useSpace2 } from "@dxos/react-client/echo";
3759
3759
 
3760
3760
  // packages/sdk/shell/src/composites/SpaceDialog/SpaceDialog.tsx
@@ -3799,7 +3799,7 @@ var Shell = ({ runtime, origin }) => {
3799
3799
  spaceKey: runtime.spaceKey,
3800
3800
  target: runtime.target
3801
3801
  });
3802
- const client = useClient6();
3802
+ const client = useClient7();
3803
3803
  const space = useSpace2(spaceKey);
3804
3804
  useEffect7(() => {
3805
3805
  return runtime.layoutUpdate.on((request) => setLayout(request));
@@ -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 Promise.all([
4091
- runtime.open(),
4092
- client.initialize()
4093
- ]);
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(Shell, {
4105
- runtime,
4106
- origin: location.origin
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 ShellDisplay2, ShellLayout as ShellLayout3, useClient as useClient7 } from "@dxos/react-client";
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
 
@@ -4147,14 +4172,14 @@ var MemoryShellRuntime = class {
4147
4172
  // packages/sdk/shell/src/composites/Shell/ShellContext.tsx
4148
4173
  var ShellContext = /* @__PURE__ */ createContext2({});
4149
4174
  var useShell = () => {
4150
- const client = useClient7();
4175
+ const client = useClient8();
4151
4176
  const { runtime, setDisplay } = useContext2(ShellContext);
4152
4177
  const setLayout = async (layout, options) => {
4153
4178
  if (runtime) {
4154
4179
  if (layout === ShellLayout3.DEFAULT) {
4155
- setDisplay?.(ShellDisplay2.NONE);
4180
+ setDisplay?.(ShellDisplay3.NONE);
4156
4181
  } else {
4157
- setDisplay?.(ShellDisplay2.FULLSCREEN);
4182
+ setDisplay?.(ShellDisplay3.FULLSCREEN);
4158
4183
  }
4159
4184
  runtime.setLayout({
4160
4185
  layout,
@@ -4168,9 +4193,9 @@ var useShell = () => {
4168
4193
  };
4169
4194
  };
4170
4195
  var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
4171
- const client = useClient7();
4196
+ const client = useClient8();
4172
4197
  const identity = useIdentity3();
4173
- const [display, setDisplay] = useState14(!identity || spaceInvitationCode || deviceInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
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(ShellDisplay2.FULLSCREEN);
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(ShellDisplay2.FULLSCREEN);
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 === ShellDisplay2.NONE ? "hidden" : "")
4269
+ className: mx25(display === ShellDisplay3.NONE ? "hidden" : "")
4245
4270
  }, /* @__PURE__ */ React48.createElement(Shell, {
4246
4271
  runtime: shellRuntime,
4247
4272
  origin: window.location.origin