@dxos/shell 0.5.1-main.d514f85 → 0.5.1-main.ea79cb0
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 +5111 -5084
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +55 -55
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +107 -45
- package/dist/lib/browser/react.mjs.map +3 -3
- package/dist/types/src/composites/Shell/Shell.d.ts +1 -2
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +24 -4
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/composites/Shell/ShellContext.js +1 -1
- package/dist/types/src/composites/Shell/ShellContext.js.map +1 -1
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +10 -2
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/memory-shell-runtime.js +20 -1
- package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -1
- 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/panels/JoinPanel/JoinPanel.js +2 -2
- package/dist/types/src/panels/JoinPanel/JoinPanel.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/Shell.tsx +36 -5
- package/src/composites/Shell/ShellContext.tsx +1 -1
- package/src/composites/Shell/memory-shell-runtime.ts +36 -2
- package/src/composites/Shell/run-shell.tsx +51 -19
- package/src/panels/JoinPanel/JoinPanel.tsx +2 -2
- package/src/translations/locales/en-US.ts +1 -0
|
@@ -4,25 +4,40 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import {
|
|
7
|
+
ShellLayout,
|
|
7
8
|
type AppContextRequest,
|
|
9
|
+
type InvitationUrlRequest,
|
|
8
10
|
type LayoutRequest,
|
|
9
11
|
type PublicKey,
|
|
10
|
-
ShellLayout,
|
|
11
12
|
type ShellRuntime,
|
|
12
13
|
} from '@dxos/react-client';
|
|
13
14
|
|
|
14
15
|
// TODO(wittjosiah): Remove?
|
|
15
16
|
export class MemoryShellRuntime implements ShellRuntime {
|
|
16
17
|
readonly layoutUpdate = new Event<LayoutRequest>();
|
|
18
|
+
readonly invitationUrlUpdate = new Event<InvitationUrlRequest>();
|
|
17
19
|
readonly contextUpdate = new Event<AppContextRequest>();
|
|
18
20
|
private _layout: ShellLayout;
|
|
19
21
|
private _invitationCode?: string;
|
|
20
22
|
private _spaceKey?: PublicKey;
|
|
23
|
+
private _invitationUrl: string;
|
|
24
|
+
private _deviceInvitationParam: string;
|
|
25
|
+
private _spaceInvitationParam: string;
|
|
21
26
|
|
|
22
|
-
constructor({
|
|
27
|
+
constructor({
|
|
28
|
+
layout,
|
|
29
|
+
invitationCode,
|
|
30
|
+
spaceKey,
|
|
31
|
+
invitationUrl,
|
|
32
|
+
deviceInvitationParam,
|
|
33
|
+
spaceInvitationParam,
|
|
34
|
+
}: Partial<LayoutRequest> & Partial<AppContextRequest> & Partial<InvitationUrlRequest> = {}) {
|
|
23
35
|
this._layout = layout ?? ShellLayout.DEFAULT;
|
|
24
36
|
this._invitationCode = invitationCode;
|
|
25
37
|
this._spaceKey = spaceKey;
|
|
38
|
+
this._invitationUrl = invitationUrl ?? window.location.origin;
|
|
39
|
+
this._deviceInvitationParam = deviceInvitationParam ?? 'deviceInvitationCode';
|
|
40
|
+
this._spaceInvitationParam = spaceInvitationParam ?? 'spaceInvitationCode';
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
get layout() {
|
|
@@ -37,6 +52,18 @@ export class MemoryShellRuntime implements ShellRuntime {
|
|
|
37
52
|
return this._spaceKey;
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
get invitationUrl() {
|
|
56
|
+
return this._invitationUrl;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get deviceInvitationParam() {
|
|
60
|
+
return this._deviceInvitationParam;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get spaceInvitationParam() {
|
|
64
|
+
return this._spaceInvitationParam;
|
|
65
|
+
}
|
|
66
|
+
|
|
40
67
|
setLayout(request: LayoutRequest) {
|
|
41
68
|
this._layout = request.layout;
|
|
42
69
|
this._invitationCode = request.invitationCode;
|
|
@@ -44,6 +71,13 @@ export class MemoryShellRuntime implements ShellRuntime {
|
|
|
44
71
|
this.layoutUpdate.emit(request);
|
|
45
72
|
}
|
|
46
73
|
|
|
74
|
+
setInvitationUrl(request: InvitationUrlRequest) {
|
|
75
|
+
this._invitationUrl = request.invitationUrl;
|
|
76
|
+
this._deviceInvitationParam = request.deviceInvitationParam;
|
|
77
|
+
this._spaceInvitationParam = request.spaceInvitationParam;
|
|
78
|
+
this.invitationUrlUpdate.emit(request);
|
|
79
|
+
}
|
|
80
|
+
|
|
47
81
|
async setAppContext(context: AppContextRequest) {
|
|
48
82
|
this.contextUpdate.emit(context);
|
|
49
83
|
}
|
|
@@ -13,9 +13,10 @@ import {
|
|
|
13
13
|
ClientContext,
|
|
14
14
|
ClientServicesProxy,
|
|
15
15
|
Config,
|
|
16
|
+
ShellDisplay,
|
|
16
17
|
SystemStatus,
|
|
17
18
|
} from '@dxos/react-client';
|
|
18
|
-
import { ThemeProvider, Tooltip } from '@dxos/react-ui';
|
|
19
|
+
import { Button, Dialog, ThemeProvider, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
19
20
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
20
21
|
import { createIFramePort } from '@dxos/rpc-tunnel';
|
|
21
22
|
|
|
@@ -24,24 +25,55 @@ import { ClipboardProvider } from '../../components';
|
|
|
24
25
|
import { osTranslations } from '../../translations';
|
|
25
26
|
|
|
26
27
|
export const runShell = async (config: Config = new Config()) => {
|
|
27
|
-
|
|
28
|
-
const client = new Client({ config, services });
|
|
28
|
+
// If runtime fails to open then the shell will not be openable.
|
|
29
29
|
const runtime = new ShellRuntimeImpl(createIFramePort({ channel: DEFAULT_SHELL_CHANNEL }));
|
|
30
|
-
await
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
await runtime.open();
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const services = new ClientServicesProxy(createIFramePort({ channel: DEFAULT_CLIENT_CHANNEL }));
|
|
34
|
+
const client = new Client({ config, services });
|
|
35
|
+
await client.initialize();
|
|
36
|
+
|
|
37
|
+
createRoot(document.getElementById('root')!).render(
|
|
38
|
+
<StrictMode>
|
|
39
|
+
<ThemeProvider tx={defaultTx} resourceExtensions={[osTranslations]}>
|
|
40
|
+
<ClientContext.Provider value={{ client, status: SystemStatus.ACTIVE }}>
|
|
41
|
+
<ClipboardProvider>
|
|
42
|
+
<Tooltip.Provider>
|
|
43
|
+
<AgentHostingProvider>
|
|
44
|
+
<Shell runtime={runtime} />
|
|
45
|
+
</AgentHostingProvider>
|
|
46
|
+
</Tooltip.Provider>
|
|
47
|
+
</ClipboardProvider>
|
|
48
|
+
</ClientContext.Provider>
|
|
49
|
+
</ThemeProvider>
|
|
50
|
+
</StrictMode>,
|
|
51
|
+
);
|
|
52
|
+
} catch {
|
|
53
|
+
// If shell's client fails to initialize, ensure that the shell is still closeable.
|
|
54
|
+
createRoot(document.getElementById('root')!).render(
|
|
55
|
+
<StrictMode>
|
|
56
|
+
<ThemeProvider tx={defaultTx} resourceExtensions={[osTranslations]}>
|
|
57
|
+
<Fallback onClose={() => runtime.setAppContext({ display: ShellDisplay.NONE })} />
|
|
58
|
+
</ThemeProvider>
|
|
59
|
+
</StrictMode>,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const Fallback = ({ onClose }: { onClose?: () => void }) => {
|
|
65
|
+
const { t } = useTranslation('os');
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Dialog.Root modal open onOpenChange={() => onClose?.()}>
|
|
69
|
+
<Dialog.Overlay>
|
|
70
|
+
<Dialog.Content>
|
|
71
|
+
<Dialog.Title>{t('shell fallback title')}</Dialog.Title>
|
|
72
|
+
<Dialog.Close asChild onClick={() => onClose?.()}>
|
|
73
|
+
<Button variant='primary'>{t('close label')}</Button>
|
|
74
|
+
</Dialog.Close>
|
|
75
|
+
</Dialog.Content>
|
|
76
|
+
</Dialog.Overlay>
|
|
77
|
+
</Dialog.Root>
|
|
46
78
|
);
|
|
47
79
|
};
|
|
@@ -60,7 +60,7 @@ export const JoinPanelImpl = (props: JoinPanelImplProps) => {
|
|
|
60
60
|
<Viewport.View classNames={stepStyles} id='reset storage confirmation'>
|
|
61
61
|
<ConfirmResetComponent
|
|
62
62
|
send={send}
|
|
63
|
-
active={activeView === 'reset
|
|
63
|
+
active={activeView === 'reset storage confirmation'}
|
|
64
64
|
onCancel={onCancelResetStorage}
|
|
65
65
|
onConfirm={onConfirmResetStorage}
|
|
66
66
|
/>
|
|
@@ -222,7 +222,7 @@ export const JoinPanel = ({
|
|
|
222
222
|
case joinState.matches({ choosingIdentity: 'choosingAuthMethod' }):
|
|
223
223
|
return 'addition method chooser';
|
|
224
224
|
case joinState.matches('resettingIdentity'):
|
|
225
|
-
return 'reset
|
|
225
|
+
return 'reset storage confirmation';
|
|
226
226
|
case joinState.matches({ choosingIdentity: 'creatingIdentity' }):
|
|
227
227
|
return 'create identity input';
|
|
228
228
|
case joinState.matches({ choosingIdentity: 'recoveringIdentity' }):
|