@dxos/shell 0.4.10-main.b9b4602 → 0.4.10-main.c2d5db5

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 (122) hide show
  1. package/dist/bundle/shell.mjs +81827 -10
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +89 -152
  4. package/dist/bundle/shell.umd.js.map +1 -1
  5. package/dist/bundle/style.css +1 -1
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/react.mjs +792 -831
  8. package/dist/lib/browser/react.mjs.map +4 -4
  9. package/dist/lib/browser/testing/index.mjs +2 -4
  10. package/dist/lib/browser/testing/index.mjs.map +2 -2
  11. package/dist/types/src/components/EmojiPicker.d.ts +2 -9
  12. package/dist/types/src/components/EmojiPicker.d.ts.map +1 -1
  13. package/dist/types/src/components/EmojiPicker.js +3 -57
  14. package/dist/types/src/components/EmojiPicker.js.map +1 -1
  15. package/dist/types/src/components/HuePicker.d.ts +2 -9
  16. package/dist/types/src/components/HuePicker.d.ts.map +1 -1
  17. package/dist/types/src/components/HuePicker.js +6 -75
  18. package/dist/types/src/components/HuePicker.js.map +1 -1
  19. package/dist/types/src/components/IdentityList/DeviceList.d.ts +7 -0
  20. package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +1 -0
  21. package/dist/types/src/components/IdentityList/DeviceList.js +34 -0
  22. package/dist/types/src/components/IdentityList/DeviceList.js.map +1 -0
  23. package/dist/types/src/components/IdentityList/index.d.ts +1 -0
  24. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
  25. package/dist/types/src/components/IdentityList/index.js +1 -0
  26. package/dist/types/src/components/IdentityList/index.js.map +1 -1
  27. package/dist/types/src/components/Panel/Action.d.ts +2 -2
  28. package/dist/types/src/components/Viewport/Viewport.d.ts +1 -1
  29. package/dist/types/src/components/index.d.ts +0 -2
  30. package/dist/types/src/components/index.d.ts.map +1 -1
  31. package/dist/types/src/components/index.js +0 -2
  32. package/dist/types/src/components/index.js.map +1 -1
  33. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
  34. package/dist/types/src/composites/Shell/Shell.js +5 -1
  35. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  36. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
  37. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +40 -80
  38. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  39. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +3 -0
  40. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
  41. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +43 -1
  42. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
  43. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +11 -8
  44. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
  45. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
  46. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
  47. package/dist/types/src/panels/IdentityPanel/identityMachine.js +24 -0
  48. package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
  49. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts +3 -0
  50. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts.map +1 -0
  51. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js +26 -0
  52. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js.map +1 -0
  53. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts +10 -0
  54. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts.map +1 -0
  55. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js +23 -0
  56. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js.map +1 -0
  57. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +4 -4
  58. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
  59. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +43 -9
  60. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  61. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +1 -1
  62. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -1
  63. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +2 -2
  64. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
  65. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +2 -0
  66. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
  67. package/dist/types/src/panels/IdentityPanel/steps/index.js +2 -0
  68. package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
  69. package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
  70. package/dist/types/src/testing/shell-manager.js +2 -4
  71. package/dist/types/src/testing/shell-manager.js.map +1 -1
  72. package/dist/types/src/translations/locales/en-US.d.ts +2 -12
  73. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  74. package/dist/types/src/translations/locales/en-US.js +2 -12
  75. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  76. package/package.json +19 -19
  77. package/src/components/EmojiPicker.tsx +4 -101
  78. package/src/components/HuePicker.tsx +5 -99
  79. package/src/components/IdentityList/DeviceList.tsx +49 -0
  80. package/src/components/IdentityList/index.ts +1 -0
  81. package/src/components/index.ts +0 -2
  82. package/src/composites/Shell/Shell.tsx +7 -1
  83. package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +63 -0
  84. package/src/panels/IdentityPanel/IdentityPanel.tsx +34 -123
  85. package/src/panels/IdentityPanel/IdentityPanelProps.ts +14 -10
  86. package/src/panels/IdentityPanel/identityMachine.ts +31 -1
  87. package/src/panels/IdentityPanel/steps/AgentForm.tsx +61 -0
  88. package/src/panels/IdentityPanel/steps/DeviceManager.tsx +41 -0
  89. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +76 -23
  90. package/src/panels/IdentityPanel/steps/ProfileForm.tsx +4 -12
  91. package/src/panels/IdentityPanel/steps/index.ts +2 -0
  92. package/src/testing/shell-manager.ts +2 -4
  93. package/src/translations/locales/en-US.ts +2 -13
  94. package/dist/bundle/index-D-K0uxrm.mjs +0 -94
  95. package/dist/bundle/index-D-K0uxrm.mjs.map +0 -1
  96. package/dist/bundle/index-DRtLjStG.mjs +0 -96550
  97. package/dist/bundle/index-DRtLjStG.mjs.map +0 -1
  98. package/dist/types/src/components/AgentConfig.d.ts +0 -3
  99. package/dist/types/src/components/AgentConfig.d.ts.map +0 -1
  100. package/dist/types/src/components/AgentConfig.js +0 -37
  101. package/dist/types/src/components/AgentConfig.js.map +0 -1
  102. package/dist/types/src/components/DeviceList/DeviceList.d.ts +0 -3
  103. package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +0 -1
  104. package/dist/types/src/components/DeviceList/DeviceList.js +0 -29
  105. package/dist/types/src/components/DeviceList/DeviceList.js.map +0 -1
  106. package/dist/types/src/components/DeviceList/DeviceListItem.d.ts +0 -6
  107. package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +0 -1
  108. package/dist/types/src/components/DeviceList/DeviceListItem.js +0 -72
  109. package/dist/types/src/components/DeviceList/DeviceListItem.js.map +0 -1
  110. package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +0 -27
  111. package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +0 -1
  112. package/dist/types/src/components/DeviceList/DeviceListProps.js +0 -6
  113. package/dist/types/src/components/DeviceList/DeviceListProps.js.map +0 -1
  114. package/dist/types/src/components/DeviceList/index.d.ts +0 -3
  115. package/dist/types/src/components/DeviceList/index.d.ts.map +0 -1
  116. package/dist/types/src/components/DeviceList/index.js +0 -22
  117. package/dist/types/src/components/DeviceList/index.js.map +0 -1
  118. package/src/components/AgentConfig.tsx +0 -66
  119. package/src/components/DeviceList/DeviceList.tsx +0 -54
  120. package/src/components/DeviceList/DeviceListItem.tsx +0 -120
  121. package/src/components/DeviceList/DeviceListProps.ts +0 -33
  122. package/src/components/DeviceList/index.ts +0 -6
@@ -0,0 +1,61 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { useTranslation } from '@dxos/react-ui';
8
+
9
+ import { Action, Actions, StepHeading, Input } from '../../../components';
10
+ import { type AgentFormProps, type IdentityPanelStepProps } from '../IdentityPanelProps';
11
+
12
+ export const AgentForm = (props: IdentityPanelStepProps & AgentFormProps) => {
13
+ const {
14
+ active,
15
+ onAgentCreate,
16
+ onAgentDestroy,
17
+ send,
18
+ validationMessage,
19
+ agentStatus,
20
+ agentActive,
21
+ agentProviderDisabled,
22
+ } = props;
23
+ const disabled = !active;
24
+ const { t } = useTranslation('os');
25
+ return (
26
+ <>
27
+ <div role='none' className='grow flex flex-col justify-center'>
28
+ <Input
29
+ {...{ validationMessage }}
30
+ label={<StepHeading>Agent Status</StepHeading>}
31
+ disabled={disabled}
32
+ data-testid='agent-status'
33
+ value={agentStatus}
34
+ />
35
+ </div>
36
+ <Actions>
37
+ <Action
38
+ disabled={agentActive || agentProviderDisabled}
39
+ onClick={() => onAgentCreate?.()}
40
+ data-testid={'create-agent'}
41
+ >
42
+ Create Agent
43
+ </Action>
44
+ <Action
45
+ disabled={!agentActive || agentProviderDisabled}
46
+ onClick={() => onAgentDestroy?.()}
47
+ data-testid={'destroy-agent'}
48
+ >
49
+ Destroy Agent
50
+ </Action>
51
+ <Action
52
+ disabled={disabled}
53
+ onClick={() => send?.({ type: 'unchooseAction' })}
54
+ data-testid={'update-profile-form-back'}
55
+ >
56
+ {t('back label')}
57
+ </Action>
58
+ </Actions>
59
+ </>
60
+ );
61
+ };
@@ -0,0 +1,41 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+ import { type Event, type SingleOrArray } from 'xstate';
7
+
8
+ import { type Device } from '@dxos/react-client/halo';
9
+ import { useTranslation } from '@dxos/react-ui';
10
+
11
+ import { Action, Actions, DeviceList } from '../../../components';
12
+ import type { IdentityPanelStepProps } from '../IdentityPanelProps';
13
+ import type { IdentityEvent } from '../identityMachine';
14
+
15
+ export interface DeviceManagerProps extends Omit<IdentityPanelStepProps, 'send'> {
16
+ send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
17
+ devices: Device[];
18
+ }
19
+
20
+ export const DeviceManager = ({ devices, active, send }: DeviceManagerProps) => {
21
+ const { t } = useTranslation('os');
22
+ const disabled = !active;
23
+
24
+ return (
25
+ <>
26
+ <div role='none' className='grow'>
27
+ <DeviceList devices={devices} />
28
+ </div>
29
+ <Actions>
30
+ <Action
31
+ variant='ghost'
32
+ disabled={disabled}
33
+ onClick={() => send?.({ type: 'unchooseAction' })}
34
+ data-testid={'manage-devices-back'}
35
+ >
36
+ {t('back label')}
37
+ </Action>
38
+ </Actions>
39
+ </>
40
+ );
41
+ };
@@ -2,14 +2,17 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { CaretRight, Devices, Plus, Power, UserGear, HardDrive, Intersect } from '@phosphor-icons/react';
5
6
  import React, { useCallback } from 'react';
6
7
 
7
8
  import { log } from '@dxos/log';
8
9
  import { useAgentHostingProviderClient, useClient } from '@dxos/react-client';
9
10
  import { useHaloInvitations } from '@dxos/react-client/halo';
10
11
  import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
12
+ import { DensityProvider, useTranslation } from '@dxos/react-ui';
13
+ import { getSize } from '@dxos/react-ui-theme';
11
14
 
12
- import { AgentConfig, type AgentFormProps, DeviceList } from '../../../components';
15
+ import { Action } from '../../../components';
13
16
  import { type IdentityPanelStepProps } from '../IdentityPanelProps';
14
17
 
15
18
  export type IdentityActionChooserProps = IdentityPanelStepProps;
@@ -25,10 +28,13 @@ export const IdentityActionChooser = (props: IdentityPanelStepProps) => {
25
28
  log.info(JSON.stringify({ invitationCode, authCode: invitation.authCode }));
26
29
  }
27
30
  }, []);
28
- const createInvitation = () => {
31
+ const createInvitation = (e: React.MouseEvent) => {
32
+ const testing = e.altKey && e.shiftKey;
29
33
  invitations.forEach((invitation) => invitation.cancel());
30
34
  // TODO(nf): allow user to make invitations non-persistent?
31
- const invitation = client.halo.share();
35
+ const invitation = client.halo.share(
36
+ testing ? { type: Invitation.Type.MULTIUSE, authMethod: Invitation.AuthMethod.NONE } : undefined,
37
+ );
32
38
  // TODO(wittjosiah): Don't depend on NODE_ENV.
33
39
  if (process.env.NODE_ENV !== 'production') {
34
40
  invitation.subscribe(onInvitationEvent);
@@ -38,36 +44,83 @@ export const IdentityActionChooser = (props: IdentityPanelStepProps) => {
38
44
  return (
39
45
  <IdentityActionChooserImpl
40
46
  {...props}
41
- onCreateInvitationClick={createInvitation}
47
+ onCreateInvitationClick={(e) => createInvitation(e)}
42
48
  agentHostingEnabled={!!agentHostingProviderClient}
43
49
  />
44
50
  );
45
51
  };
46
52
 
47
- export type IdentityActionChooserImplProps = IdentityActionChooserProps &
48
- Partial<AgentFormProps> & {
49
- onCreateInvitationClick?: () => void;
50
- };
53
+ export type IdentityActionChooserImplProps = IdentityActionChooserProps & {
54
+ onCreateInvitationClick?: (e: React.MouseEvent) => void;
55
+ };
51
56
 
52
57
  export const IdentityActionChooserImpl = ({
53
- send,
54
58
  onCreateInvitationClick,
55
- devices,
56
- onAgentDestroy,
57
- onAgentCreate,
58
- agentStatus,
59
- agentActive,
59
+ active,
60
+ send,
61
+ onDone,
62
+ doneActionParent,
60
63
  agentHostingEnabled,
61
64
  }: IdentityActionChooserImplProps) => {
65
+ const { t } = useTranslation('os');
66
+
67
+ // const doneAction = (
68
+ // <PanelAction aria-label={t('done label')} onClick={onDone} disabled={!active} data-testid='identity-panel-done'>
69
+ // <Check weight='light' className={getSize(6)} />
70
+ // </PanelAction>
71
+ // );
62
72
  return (
63
- <>
64
- <DeviceList
65
- devices={devices}
66
- onClickAdd={onCreateInvitationClick}
67
- onClickJoinExisting={() => send?.({ type: 'chooseJoinNewIdentity' })}
68
- onClickReset={() => send?.({ type: 'chooseResetStorage' })}
69
- />
70
- {agentHostingEnabled && <AgentConfig {...{ agentActive, agentStatus, onAgentDestroy, onAgentCreate }} />}
71
- </>
73
+ <div role='none' className='grow flex flex-col gap-1'>
74
+ <DensityProvider density='coarse'>
75
+ <div className='grow justify-center flex flex-col gap-1'>
76
+ <Action data-testid='manage-profile' onClick={() => send?.({ type: 'chooseProfile' })} classNames='plb-4'>
77
+ <UserGear className={getSize(6)} />
78
+ <span className='grow mli-3'>{t('choose profile label')}</span>
79
+ <CaretRight weight='bold' className={getSize(4)} />
80
+ </Action>
81
+ {agentHostingEnabled && (
82
+ <Action data-testid='manage-agent' onClick={() => send?.({ type: 'chooseAgent' })} classNames='plb-4'>
83
+ <HardDrive className={getSize(6)} />
84
+ <span className='grow mli-3'>Manage Agent</span>
85
+ <CaretRight weight='bold' className={getSize(4)} />
86
+ </Action>
87
+ )}
88
+ <Action
89
+ disabled={!active}
90
+ data-testid='devices-panel.create-invitation'
91
+ onClick={onCreateInvitationClick}
92
+ classNames='plb-4'
93
+ >
94
+ <Plus className={getSize(6)} />
95
+ <span className='grow mli-3'>{t('choose add device label')}</span>
96
+ <CaretRight weight='bold' className={getSize(4)} />
97
+ </Action>
98
+ <Action
99
+ data-testid='devices-panel.join-new-identity'
100
+ onClick={() => send?.({ type: 'chooseJoinNewIdentity' })}
101
+ classNames='plb-4'
102
+ >
103
+ <Intersect className={getSize(6)} />
104
+ <span className='grow mli-3'>{t('choose join new identity label')}</span>
105
+ <CaretRight weight='bold' className={getSize(4)} />
106
+ </Action>
107
+ <Action data-testid='manage-devices' onClick={() => send?.({ type: 'chooseDevices' })} classNames='plb-4'>
108
+ <Devices className={getSize(6)} />
109
+ <span className='grow mli-3'>{t('choose devices label')}</span>
110
+ <CaretRight weight='bold' className={getSize(4)} />
111
+ </Action>
112
+ <Action
113
+ data-testid='devices-panel.sign-out'
114
+ onClick={() => send?.({ type: 'chooseResetStorage' })}
115
+ classNames='plb-4'
116
+ >
117
+ <Power className={getSize(6)} />
118
+ <span className='grow mli-3'>{t('choose sign out label')}</span>
119
+ <CaretRight weight='bold' className={getSize(4)} />
120
+ </Action>
121
+ </div>
122
+ </DensityProvider>
123
+ {/* <PanelActions>{doneActionParent ? cloneElement(doneActionParent, {}, doneAction) : doneAction}</PanelActions> */}
124
+ </div>
72
125
  );
73
126
  };
@@ -10,19 +10,11 @@ import { type Identity } from '@dxos/react-client/halo';
10
10
  import { useTranslation } from '@dxos/react-ui';
11
11
  import { hexToEmoji, hexToHue } from '@dxos/util';
12
12
 
13
- import {
14
- Action,
15
- Actions,
16
- StepHeading,
17
- Input,
18
- useClipboardContext,
19
- EmojiPickerBlock,
20
- HuePickerBlock,
21
- } from '../../../components';
13
+ import { Action, Actions, StepHeading, Input, useClipboardContext, EmojiPicker, HuePicker } from '../../../components';
22
14
  import { type IdentityPanelStepProps } from '../IdentityPanelProps';
23
15
  import { type IdentityEvent } from '../identityMachine';
24
16
 
25
- export interface ProfileFormProps extends Omit<IdentityPanelStepProps, 'send' | 'devices'> {
17
+ export interface ProfileFormProps extends Omit<IdentityPanelStepProps, 'send'> {
26
18
  send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
27
19
  onUpdateProfile?: (profile: NonNullable<Identity['profile']>) => Promise<void>;
28
20
  identity?: Identity;
@@ -76,13 +68,13 @@ const ProfileFormImpl = (props: ProfileFormImplProps) => {
76
68
  />
77
69
  <StepHeading className='mbe-2'>{t('emoji and color label')}</StepHeading>
78
70
  <div role='none' className='grid grid-cols-[1fr_min-content] gap-y-2'>
79
- <EmojiPickerBlock
71
+ <EmojiPicker
80
72
  emoji={emoji}
81
73
  onChangeEmoji={setEmoji}
82
74
  disabled={disabled}
83
75
  onClickClear={() => setEmoji(getEmojiValue(identity))}
84
76
  />
85
- <HuePickerBlock
77
+ <HuePicker
86
78
  hue={hue}
87
79
  onChangeHue={setHue}
88
80
  disabled={disabled}
@@ -2,5 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './AgentForm';
6
+ export * from './DeviceManager';
5
7
  export * from './IdentityActionChooser';
6
8
  export * from './ProfileForm';
@@ -65,15 +65,13 @@ export class ShellManager extends ScopedShellManager {
65
65
  };
66
66
 
67
67
  this.page.on('dialog', handleDialog);
68
- await this.shell.getByTestId('device-list-item-current.options').click();
69
- await this.shell.getByTestId('device-list-item-current.reset').click();
68
+ await this.shell.getByTestId('devices-panel.sign-out').click();
70
69
  await this.shell.getByTestId('reset-storage.reset-identity-input').fill('CONFIRM');
71
70
  await this.shell.getByTestId('reset-storage.reset-identity-confirm').click();
72
71
  }
73
72
 
74
73
  async joinNewIdentity(invitationCode: string) {
75
- await this.shell.getByTestId('device-list-item-current.options').click();
76
- await this.shell.getByTestId('device-list-item-current.join-existing').click();
74
+ await this.shell.getByTestId('devices-panel.join-new-identity').click();
77
75
  await this.shell.getByTestId('join-new-identity.reset-identity-input').fill('CONFIRM');
78
76
  await this.shell.getByTestId('join-new-identity.reset-identity-input-confirm').click();
79
77
  await this.inputInvitation('device', invitationCode, this.shell);
@@ -45,6 +45,8 @@ export const os = {
45
45
  'connected status label': 'Enter confirmation PIN',
46
46
  'authenticating status label': 'Enter confirmation PIN',
47
47
  'success status label': 'Success',
48
+ 'connect label': 'Connect',
49
+ 'reconnect label': 'Reconnect',
48
50
  'cancel label': 'Cancel',
49
51
  'done label': 'Done',
50
52
  'reset label': 'Start over',
@@ -129,17 +131,4 @@ export const os = {
129
131
  'fuchsia label': 'Fuchsia',
130
132
  'pink label': 'Pink',
131
133
  'rose label': 'Rose',
132
- 'current device tag label': 'This device',
133
- 'device name placeholder': '{{platform}} on {{os}}',
134
- 'more options label': 'More options',
135
- 'disconnect label': 'Currently online. Click to go offline.',
136
- 'connect label': 'Currently offline. Click to go online.',
137
- 'edit device label': 'Edit device name & avatar',
138
- 'agent heading': 'Agent',
139
- 'agent message title': 'About creating an agent',
140
- 'agent message body':
141
- 'Creating an agent helps keep your devices and peers in-sync. An agent is like any other device, but since it’s always online your changes will sync even when all your physical devices are asleep.',
142
- 'create agent label': 'Start an agent',
143
- 'destroy agent label': 'Shut down agent',
144
- 'agent device label': 'Your agent',
145
134
  };
@@ -1,94 +0,0 @@
1
- import { T as l, E as p, c as _, e as d, W as u, l as i, a as f } from "./index-DRtLjStG.mjs";
2
- function m(t, e, r, s) {
3
- var c = arguments.length, o = c < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, r) : s, a;
4
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
5
- o = Reflect.decorate(t, e, r, s);
6
- else
7
- for (var h = t.length - 1; h >= 0; h--)
8
- (a = t[h]) && (o = (c < 3 ? a(o) : c > 3 ? a(e, r, o) : a(e, r)) || o);
9
- return c > 3 && o && Object.defineProperty(e, r, o), o;
10
- }
11
- var n = "/home/runner/work/dxos/dxos/packages/core/mesh/websocket-rpc/src/client.ts", w = class {
12
- constructor(t) {
13
- this._params = t, this._connectTrigger = new l(), this.connected = new p(), this.disconnected = new p(), this.error = new p(), this._rpc = _({
14
- requested: this._params.requested,
15
- exposed: this._params.exposed,
16
- handlers: this._params.handlers,
17
- port: {
18
- send: (e) => {
19
- this._socket.send(e);
20
- },
21
- subscribe: (e) => {
22
- this._socket.onmessage = async (r) => {
23
- typeof Blob < "u" && r.data instanceof Blob ? e(d.from(await r.data.arrayBuffer())) : e(r.data);
24
- };
25
- }
26
- }
27
- });
28
- }
29
- get url() {
30
- return this._params.url;
31
- }
32
- async open() {
33
- this._socket = new u(this._params.url), this._socket.onopen = async () => {
34
- i("Socket open", void 0, {
35
- F: n,
36
- L: 55,
37
- S: this,
38
- C: (t, e) => t(...e)
39
- });
40
- try {
41
- await this._rpc.open(), i(`RPC open ${this._params.url}`, void 0, {
42
- F: n,
43
- L: 58,
44
- S: this,
45
- C: (t, e) => t(...e)
46
- }), this.connected.emit(), this._connectTrigger.wake();
47
- } catch (t) {
48
- this.error.emit(t);
49
- }
50
- }, this._socket.onclose = async () => {
51
- i(`Disconnected ${this._params.url}`, void 0, {
52
- F: n,
53
- L: 67,
54
- S: this,
55
- C: (t, e) => t(...e)
56
- }), this.disconnected.emit(), await this.close();
57
- }, this._socket.onerror = (t) => {
58
- i.error(t.message ?? "Socket error", {
59
- url: this._params.url
60
- }, {
61
- F: n,
62
- L: 73,
63
- S: this,
64
- C: (r, s) => r(...s)
65
- });
66
- const e = t.error ?? new Error(t.message);
67
- this.error.emit(e), this._connectTrigger.throw(e);
68
- }, await this._connectTrigger.wait();
69
- }
70
- async close() {
71
- var t, e;
72
- try {
73
- await ((t = this._rpc) == null ? void 0 : t.close());
74
- } catch (r) {
75
- i.catch(r, void 0, {
76
- F: n,
77
- L: 86,
78
- S: this,
79
- C: (s, c) => s(...c)
80
- });
81
- }
82
- (e = this._socket) == null || e.close();
83
- }
84
- get rpc() {
85
- return this._rpc.rpc;
86
- }
87
- };
88
- m([
89
- f
90
- ], w.prototype, "url", null);
91
- export {
92
- w as WebsocketRpcClient
93
- };
94
- //# sourceMappingURL=index-D-K0uxrm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-D-K0uxrm.mjs","sources":["../../../../core/mesh/websocket-rpc/dist/lib/browser/index.mjs"],"sourcesContent":["import \"@dxos/node-std/globals\";\n\n// inject-globals:@inject-globals\nimport {\n global,\n Buffer,\n process\n} from \"@dxos/node-std/inject-globals\";\n\n// packages/core/mesh/websocket-rpc/src/client.ts\nimport WebSocket from \"isomorphic-ws\";\nimport { Event, Trigger } from \"@dxos/async\";\nimport { log, logInfo } from \"@dxos/log\";\nimport { createProtoRpcPeer } from \"@dxos/rpc\";\nfunction _ts_decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nvar __dxlog_file = \"/home/runner/work/dxos/dxos/packages/core/mesh/websocket-rpc/src/client.ts\";\nvar WebsocketRpcClient = class {\n constructor(_params) {\n this._params = _params;\n this._connectTrigger = new Trigger();\n this.connected = new Event();\n this.disconnected = new Event();\n this.error = new Event();\n this._rpc = createProtoRpcPeer({\n requested: this._params.requested,\n exposed: this._params.exposed,\n handlers: this._params.handlers,\n port: {\n send: (msg) => {\n this._socket.send(msg);\n },\n subscribe: (cb) => {\n this._socket.onmessage = async (msg) => {\n if (typeof Blob !== \"undefined\" && msg.data instanceof Blob) {\n cb(Buffer.from(await msg.data.arrayBuffer()));\n } else {\n cb(msg.data);\n }\n };\n }\n }\n });\n }\n get url() {\n return this._params.url;\n }\n async open() {\n this._socket = new WebSocket(this._params.url);\n this._socket.onopen = async () => {\n log(\"Socket open\", void 0, {\n F: __dxlog_file,\n L: 55,\n S: this,\n C: (f, a) => f(...a)\n });\n try {\n await this._rpc.open();\n log(`RPC open ${this._params.url}`, void 0, {\n F: __dxlog_file,\n L: 58,\n S: this,\n C: (f, a) => f(...a)\n });\n this.connected.emit();\n this._connectTrigger.wake();\n } catch (err) {\n this.error.emit(err);\n }\n };\n this._socket.onclose = async () => {\n log(`Disconnected ${this._params.url}`, void 0, {\n F: __dxlog_file,\n L: 67,\n S: this,\n C: (f, a) => f(...a)\n });\n this.disconnected.emit();\n await this.close();\n };\n this._socket.onerror = (event) => {\n log.error(event.message ?? \"Socket error\", {\n url: this._params.url\n }, {\n F: __dxlog_file,\n L: 73,\n S: this,\n C: (f, a) => f(...a)\n });\n const error = event.error ?? new Error(event.message);\n this.error.emit(error);\n this._connectTrigger.throw(error);\n };\n await this._connectTrigger.wait();\n }\n async close() {\n try {\n await this._rpc?.close();\n } catch (err) {\n log.catch(err, void 0, {\n F: __dxlog_file,\n L: 86,\n S: this,\n C: (f, a) => f(...a)\n });\n }\n this._socket?.close();\n }\n get rpc() {\n return this._rpc.rpc;\n }\n};\n_ts_decorate([\n logInfo\n], WebsocketRpcClient.prototype, \"url\", null);\n\n// packages/core/mesh/websocket-rpc/src/server.ts\nimport WebSocket2 from \"isomorphic-ws\";\nimport { log as log2 } from \"@dxos/log\";\nimport { createProtoRpcPeer as createProtoRpcPeer2 } from \"@dxos/rpc\";\nvar __dxlog_file2 = \"/home/runner/work/dxos/dxos/packages/core/mesh/websocket-rpc/src/server.ts\";\nvar WebsocketRpcServer = class {\n constructor(_params) {\n this._params = _params;\n }\n async open() {\n this._server = new WebSocket2.Server({\n ...this._params\n });\n this._server.on(\"connection\", async (socket, request) => {\n log2(\"connection\", {\n request\n }, {\n F: __dxlog_file2,\n L: 34,\n S: this,\n C: (f, a) => f(...a)\n });\n const info = {\n request\n };\n const { onOpen, onClose, ...options } = await this._params.onConnection(info);\n const rpc = createProtoRpcPeer2({\n ...options,\n port: {\n send: (msg) => {\n socket.send(msg);\n },\n subscribe: (cb) => {\n socket.onmessage = async (msg) => {\n if (typeof Blob !== \"undefined\" && msg.data instanceof Blob) {\n cb(Buffer.from(await msg.data.arrayBuffer()));\n } else {\n cb(msg.data);\n }\n };\n }\n }\n });\n await rpc.open();\n await onOpen?.(rpc);\n socket.onclose = async () => {\n await onClose?.(rpc);\n await rpc.close();\n };\n });\n }\n async close() {\n this._server?.close();\n }\n};\nexport {\n WebsocketRpcClient,\n WebsocketRpcServer\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["_ts_decorate","decorators","target","key","desc","r","d","i","__dxlog_file","WebsocketRpcClient","_params","Trigger","Event","createProtoRpcPeer","msg","cb","Buffer","WebSocket","log","f","a","err","event","error","_a","_b","logInfo"],"mappings":";AAcA,SAASA,EAAaC,GAAYC,GAAQC,GAAKC,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