@dxos/shell 0.3.11-main.1caa3af

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 (530) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +21 -0
  3. package/dist/lib/browser/chunk-ZSTKOCBT.mjs +10 -0
  4. package/dist/lib/browser/chunk-ZSTKOCBT.mjs.map +7 -0
  5. package/dist/lib/browser/meta.json +1 -0
  6. package/dist/lib/browser/react.mjs +3617 -0
  7. package/dist/lib/browser/react.mjs.map +7 -0
  8. package/dist/lib/browser/testing/index.mjs +179 -0
  9. package/dist/lib/browser/testing/index.mjs.map +7 -0
  10. package/dist/types/src/components/AuthCode.d.ts +8 -0
  11. package/dist/types/src/components/AuthCode.d.ts.map +1 -0
  12. package/dist/types/src/components/AuthCode.js +26 -0
  13. package/dist/types/src/components/AuthCode.js.map +1 -0
  14. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +9 -0
  15. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -0
  16. package/dist/types/src/components/Clipboard/ClipboardProvider.js +46 -0
  17. package/dist/types/src/components/Clipboard/ClipboardProvider.js.map +1 -0
  18. package/dist/types/src/components/Clipboard/CopyButton.d.ts +9 -0
  19. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -0
  20. package/dist/types/src/components/Clipboard/CopyButton.js +65 -0
  21. package/dist/types/src/components/Clipboard/CopyButton.js.map +1 -0
  22. package/dist/types/src/components/Clipboard/index.d.ts +3 -0
  23. package/dist/types/src/components/Clipboard/index.d.ts.map +1 -0
  24. package/dist/types/src/components/Clipboard/index.js +22 -0
  25. package/dist/types/src/components/Clipboard/index.js.map +1 -0
  26. package/dist/types/src/components/CompoundButton/CompoundButton.d.ts +17 -0
  27. package/dist/types/src/components/CompoundButton/CompoundButton.d.ts.map +1 -0
  28. package/dist/types/src/components/CompoundButton/CompoundButton.js +29 -0
  29. package/dist/types/src/components/CompoundButton/CompoundButton.js.map +1 -0
  30. package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts +35 -0
  31. package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts.map +1 -0
  32. package/dist/types/src/components/CompoundButton/CompoundButton.stories.js +45 -0
  33. package/dist/types/src/components/CompoundButton/CompoundButton.stories.js.map +1 -0
  34. package/dist/types/src/components/CompoundButton/index.d.ts +2 -0
  35. package/dist/types/src/components/CompoundButton/index.d.ts.map +1 -0
  36. package/dist/types/src/components/CompoundButton/index.js +21 -0
  37. package/dist/types/src/components/CompoundButton/index.js.map +1 -0
  38. package/dist/types/src/components/IdentityList/DeviceList.d.ts +7 -0
  39. package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +1 -0
  40. package/dist/types/src/components/IdentityList/DeviceList.js +29 -0
  41. package/dist/types/src/components/IdentityList/DeviceList.js.map +1 -0
  42. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +11 -0
  43. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -0
  44. package/dist/types/src/components/IdentityList/IdentityListItem.js +47 -0
  45. package/dist/types/src/components/IdentityList/IdentityListItem.js.map +1 -0
  46. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +13 -0
  47. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -0
  48. package/dist/types/src/components/IdentityList/SpaceMemberList.js +54 -0
  49. package/dist/types/src/components/IdentityList/SpaceMemberList.js.map +1 -0
  50. package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts +17 -0
  51. package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts.map +1 -0
  52. package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js +26 -0
  53. package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js.map +1 -0
  54. package/dist/types/src/components/IdentityList/index.d.ts +4 -0
  55. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -0
  56. package/dist/types/src/components/IdentityList/index.js +23 -0
  57. package/dist/types/src/components/IdentityList/index.js.map +1 -0
  58. package/dist/types/src/components/InvitationList/InvitationList.d.ts +11 -0
  59. package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -0
  60. package/dist/types/src/components/InvitationList/InvitationList.js +22 -0
  61. package/dist/types/src/components/InvitationList/InvitationList.js.map +1 -0
  62. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +17 -0
  63. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -0
  64. package/dist/types/src/components/InvitationList/InvitationList.stories.js +39 -0
  65. package/dist/types/src/components/InvitationList/InvitationList.stories.js.map +1 -0
  66. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +7 -0
  67. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -0
  68. package/dist/types/src/components/InvitationList/InvitationListContainer.js +42 -0
  69. package/dist/types/src/components/InvitationList/InvitationListContainer.js.map +1 -0
  70. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +12 -0
  71. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -0
  72. package/dist/types/src/components/InvitationList/InvitationListItem.js +103 -0
  73. package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -0
  74. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +9 -0
  75. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +1 -0
  76. package/dist/types/src/components/InvitationList/InvitationListProps.js +3 -0
  77. package/dist/types/src/components/InvitationList/InvitationListProps.js.map +1 -0
  78. package/dist/types/src/components/InvitationList/index.d.ts +4 -0
  79. package/dist/types/src/components/InvitationList/index.d.ts.map +1 -0
  80. package/dist/types/src/components/InvitationList/index.js +23 -0
  81. package/dist/types/src/components/InvitationList/index.js.map +1 -0
  82. package/dist/types/src/components/Panel/Action.d.ts +20 -0
  83. package/dist/types/src/components/Panel/Action.d.ts.map +1 -0
  84. package/dist/types/src/components/Panel/Action.js +93 -0
  85. package/dist/types/src/components/Panel/Action.js.map +1 -0
  86. package/dist/types/src/components/Panel/Actions.d.ts +11 -0
  87. package/dist/types/src/components/Panel/Actions.d.ts.map +1 -0
  88. package/dist/types/src/components/Panel/Actions.js +36 -0
  89. package/dist/types/src/components/Panel/Actions.js.map +1 -0
  90. package/dist/types/src/components/Panel/CloseButton.d.ts +5 -0
  91. package/dist/types/src/components/Panel/CloseButton.d.ts.map +1 -0
  92. package/dist/types/src/components/Panel/CloseButton.js +21 -0
  93. package/dist/types/src/components/Panel/CloseButton.js.map +1 -0
  94. package/dist/types/src/components/Panel/Emoji.d.ts +7 -0
  95. package/dist/types/src/components/Panel/Emoji.d.ts.map +1 -0
  96. package/dist/types/src/components/Panel/Emoji.js +24 -0
  97. package/dist/types/src/components/Panel/Emoji.js.map +1 -0
  98. package/dist/types/src/components/Panel/Heading.d.ts +16 -0
  99. package/dist/types/src/components/Panel/Heading.d.ts.map +1 -0
  100. package/dist/types/src/components/Panel/Heading.js +39 -0
  101. package/dist/types/src/components/Panel/Heading.js.map +1 -0
  102. package/dist/types/src/components/Panel/Input.d.ts +11 -0
  103. package/dist/types/src/components/Panel/Input.d.ts.map +1 -0
  104. package/dist/types/src/components/Panel/Input.js +19 -0
  105. package/dist/types/src/components/Panel/Input.js.map +1 -0
  106. package/dist/types/src/components/Panel/Label.d.ts +4 -0
  107. package/dist/types/src/components/Panel/Label.d.ts.map +1 -0
  108. package/dist/types/src/components/Panel/Label.js +17 -0
  109. package/dist/types/src/components/Panel/Label.js.map +1 -0
  110. package/dist/types/src/components/Panel/Panel.stories.d.ts +13 -0
  111. package/dist/types/src/components/Panel/Panel.stories.d.ts.map +1 -0
  112. package/dist/types/src/components/Panel/Panel.stories.js +44 -0
  113. package/dist/types/src/components/Panel/Panel.stories.js.map +1 -0
  114. package/dist/types/src/components/Panel/StepHeading.d.ts +5 -0
  115. package/dist/types/src/components/Panel/StepHeading.d.ts.map +1 -0
  116. package/dist/types/src/components/Panel/StepHeading.js +35 -0
  117. package/dist/types/src/components/Panel/StepHeading.js.map +1 -0
  118. package/dist/types/src/components/Panel/index.d.ts +9 -0
  119. package/dist/types/src/components/Panel/index.d.ts.map +1 -0
  120. package/dist/types/src/components/Panel/index.js +28 -0
  121. package/dist/types/src/components/Panel/index.js.map +1 -0
  122. package/dist/types/src/components/SpaceListItem.d.ts +7 -0
  123. package/dist/types/src/components/SpaceListItem.d.ts.map +1 -0
  124. package/dist/types/src/components/SpaceListItem.js +46 -0
  125. package/dist/types/src/components/SpaceListItem.js.map +1 -0
  126. package/dist/types/src/components/StorybookDialog.d.ts +6 -0
  127. package/dist/types/src/components/StorybookDialog.d.ts.map +1 -0
  128. package/dist/types/src/components/StorybookDialog.js +23 -0
  129. package/dist/types/src/components/StorybookDialog.js.map +1 -0
  130. package/dist/types/src/components/Viewport/Viewport.d.ts +39 -0
  131. package/dist/types/src/components/Viewport/Viewport.d.ts.map +1 -0
  132. package/dist/types/src/components/Viewport/Viewport.js +73 -0
  133. package/dist/types/src/components/Viewport/Viewport.js.map +1 -0
  134. package/dist/types/src/components/Viewport/Viewport.stories.d.ts +17 -0
  135. package/dist/types/src/components/Viewport/Viewport.stories.d.ts.map +1 -0
  136. package/dist/types/src/components/Viewport/Viewport.stories.js +51 -0
  137. package/dist/types/src/components/Viewport/Viewport.stories.js.map +1 -0
  138. package/dist/types/src/components/Viewport/index.d.ts +2 -0
  139. package/dist/types/src/components/Viewport/index.d.ts.map +1 -0
  140. package/dist/types/src/components/Viewport/index.js +21 -0
  141. package/dist/types/src/components/Viewport/index.js.map +1 -0
  142. package/dist/types/src/components/index.d.ts +9 -0
  143. package/dist/types/src/components/index.d.ts.map +1 -0
  144. package/dist/types/src/components/index.js +28 -0
  145. package/dist/types/src/components/index.js.map +1 -0
  146. package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts +7 -0
  147. package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts.map +1 -0
  148. package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +26 -0
  149. package/dist/types/src/composites/IdentityDialog/IdentityDialog.js.map +1 -0
  150. package/dist/types/src/composites/IdentityDialog/index.d.ts +2 -0
  151. package/dist/types/src/composites/IdentityDialog/index.d.ts.map +1 -0
  152. package/dist/types/src/composites/IdentityDialog/index.js +21 -0
  153. package/dist/types/src/composites/IdentityDialog/index.js.map +1 -0
  154. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +6 -0
  155. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -0
  156. package/dist/types/src/composites/JoinDialog/JoinDialog.js +27 -0
  157. package/dist/types/src/composites/JoinDialog/JoinDialog.js.map +1 -0
  158. package/dist/types/src/composites/JoinDialog/index.d.ts +2 -0
  159. package/dist/types/src/composites/JoinDialog/index.d.ts.map +1 -0
  160. package/dist/types/src/composites/JoinDialog/index.js +21 -0
  161. package/dist/types/src/composites/JoinDialog/index.js.map +1 -0
  162. package/dist/types/src/composites/Shell/Shell.d.ts +6 -0
  163. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -0
  164. package/dist/types/src/composites/Shell/Shell.js +90 -0
  165. package/dist/types/src/composites/Shell/Shell.js.map +1 -0
  166. package/dist/types/src/composites/Shell/ShellContext.d.ts +30 -0
  167. package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -0
  168. package/dist/types/src/composites/Shell/ShellContext.js +129 -0
  169. package/dist/types/src/composites/Shell/ShellContext.js.map +1 -0
  170. package/dist/types/src/composites/Shell/index.d.ts +4 -0
  171. package/dist/types/src/composites/Shell/index.d.ts.map +1 -0
  172. package/dist/types/src/composites/Shell/index.js +23 -0
  173. package/dist/types/src/composites/Shell/index.js.map +1 -0
  174. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +16 -0
  175. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -0
  176. package/dist/types/src/composites/Shell/memory-shell-runtime.js +38 -0
  177. package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -0
  178. package/dist/types/src/composites/Shell/run-shell.d.ts +3 -0
  179. package/dist/types/src/composites/Shell/run-shell.d.ts.map +1 -0
  180. package/dist/types/src/composites/Shell/run-shell.js +54 -0
  181. package/dist/types/src/composites/Shell/run-shell.js.map +1 -0
  182. package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +6 -0
  183. package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +1 -0
  184. package/dist/types/src/composites/SpaceDialog/SpaceDialog.js +26 -0
  185. package/dist/types/src/composites/SpaceDialog/SpaceDialog.js.map +1 -0
  186. package/dist/types/src/composites/SpaceDialog/index.d.ts +2 -0
  187. package/dist/types/src/composites/SpaceDialog/index.d.ts.map +1 -0
  188. package/dist/types/src/composites/SpaceDialog/index.js +21 -0
  189. package/dist/types/src/composites/SpaceDialog/index.js.map +1 -0
  190. package/dist/types/src/composites/index.d.ts +5 -0
  191. package/dist/types/src/composites/index.d.ts.map +1 -0
  192. package/dist/types/src/composites/index.js +24 -0
  193. package/dist/types/src/composites/index.js.map +1 -0
  194. package/dist/types/src/index.d.ts +3 -0
  195. package/dist/types/src/index.d.ts.map +1 -0
  196. package/dist/types/src/index.js +10 -0
  197. package/dist/types/src/index.js.map +1 -0
  198. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +4 -0
  199. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -0
  200. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +124 -0
  201. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -0
  202. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +22 -0
  203. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -0
  204. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +86 -0
  205. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -0
  206. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +27 -0
  207. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -0
  208. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js +6 -0
  209. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js.map +1 -0
  210. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +46 -0
  211. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -0
  212. package/dist/types/src/panels/IdentityPanel/identityMachine.js +79 -0
  213. package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -0
  214. package/dist/types/src/panels/IdentityPanel/index.d.ts +3 -0
  215. package/dist/types/src/panels/IdentityPanel/index.d.ts.map +1 -0
  216. package/dist/types/src/panels/IdentityPanel/index.js +22 -0
  217. package/dist/types/src/panels/IdentityPanel/index.js.map +1 -0
  218. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +9 -0
  219. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -0
  220. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +85 -0
  221. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -0
  222. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +15 -0
  223. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -0
  224. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +62 -0
  225. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -0
  226. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +3 -0
  227. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -0
  228. package/dist/types/src/panels/IdentityPanel/steps/index.js +22 -0
  229. package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -0
  230. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +10 -0
  231. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -0
  232. package/dist/types/src/panels/JoinPanel/JoinHeading.js +45 -0
  233. package/dist/types/src/panels/JoinPanel/JoinHeading.js.map +1 -0
  234. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +4 -0
  235. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -0
  236. package/dist/types/src/panels/JoinPanel/JoinPanel.js +293 -0
  237. package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -0
  238. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +92 -0
  239. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -0
  240. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +74 -0
  241. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -0
  242. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +91 -0
  243. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -0
  244. package/dist/types/src/panels/JoinPanel/JoinPanelProps.js +6 -0
  245. package/dist/types/src/panels/JoinPanel/JoinPanelProps.js.map +1 -0
  246. package/dist/types/src/panels/JoinPanel/index.d.ts +3 -0
  247. package/dist/types/src/panels/JoinPanel/index.d.ts.map +1 -0
  248. package/dist/types/src/panels/JoinPanel/index.js +22 -0
  249. package/dist/types/src/panels/JoinPanel/index.js.map +1 -0
  250. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +87 -0
  251. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
  252. package/dist/types/src/panels/JoinPanel/joinMachine.js +402 -0
  253. package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -0
  254. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts +4 -0
  255. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts.map +1 -0
  256. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js +34 -0
  257. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js.map +1 -0
  258. package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts +8 -0
  259. package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts.map +1 -0
  260. package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js +56 -0
  261. package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js.map +1 -0
  262. package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts +12 -0
  263. package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts.map +1 -0
  264. package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js +67 -0
  265. package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js.map +1 -0
  266. package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts +9 -0
  267. package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts.map +1 -0
  268. package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js +44 -0
  269. package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js.map +1 -0
  270. package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts +11 -0
  271. package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts.map +1 -0
  272. package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js +72 -0
  273. package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js.map +1 -0
  274. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts +8 -0
  275. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts.map +1 -0
  276. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js +68 -0
  277. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js.map +1 -0
  278. package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts +11 -0
  279. package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts.map +1 -0
  280. package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js +49 -0
  281. package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js.map +1 -0
  282. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +12 -0
  283. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +1 -0
  284. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +63 -0
  285. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +1 -0
  286. package/dist/types/src/panels/JoinPanel/steps/index.d.ts +9 -0
  287. package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -0
  288. package/dist/types/src/panels/JoinPanel/steps/index.js +28 -0
  289. package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -0
  290. package/dist/types/src/panels/Panels.stories.d.ts +22 -0
  291. package/dist/types/src/panels/Panels.stories.d.ts.map +1 -0
  292. package/dist/types/src/panels/Panels.stories.js +71 -0
  293. package/dist/types/src/panels/Panels.stories.js.map +1 -0
  294. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +4 -0
  295. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -0
  296. package/dist/types/src/panels/SpacePanel/SpacePanel.js +93 -0
  297. package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -0
  298. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +30 -0
  299. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +1 -0
  300. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +183 -0
  301. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -0
  302. package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +30 -0
  303. package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -0
  304. package/dist/types/src/panels/SpacePanel/SpacePanelProps.js +6 -0
  305. package/dist/types/src/panels/SpacePanel/SpacePanelProps.js.map +1 -0
  306. package/dist/types/src/panels/SpacePanel/index.d.ts +3 -0
  307. package/dist/types/src/panels/SpacePanel/index.d.ts.map +1 -0
  308. package/dist/types/src/panels/SpacePanel/index.js +22 -0
  309. package/dist/types/src/panels/SpacePanel/index.js.map +1 -0
  310. package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts +35 -0
  311. package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts.map +1 -0
  312. package/dist/types/src/panels/SpacePanel/spaceMachine.js +46 -0
  313. package/dist/types/src/panels/SpacePanel/spaceMachine.js.map +1 -0
  314. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts +15 -0
  315. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -0
  316. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +120 -0
  317. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -0
  318. package/dist/types/src/panels/SpacePanel/steps/index.d.ts +2 -0
  319. package/dist/types/src/panels/SpacePanel/steps/index.d.ts.map +1 -0
  320. package/dist/types/src/panels/SpacePanel/steps/index.js +21 -0
  321. package/dist/types/src/panels/SpacePanel/steps/index.js.map +1 -0
  322. package/dist/types/src/panels/index.d.ts +4 -0
  323. package/dist/types/src/panels/index.d.ts.map +1 -0
  324. package/dist/types/src/panels/index.js +23 -0
  325. package/dist/types/src/panels/index.js.map +1 -0
  326. package/dist/types/src/playwright/invitations-manager.d.ts +26 -0
  327. package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -0
  328. package/dist/types/src/playwright/invitations-manager.js +142 -0
  329. package/dist/types/src/playwright/invitations-manager.js.map +1 -0
  330. package/dist/types/src/playwright/invitations.spec.d.ts +2 -0
  331. package/dist/types/src/playwright/invitations.spec.d.ts.map +1 -0
  332. package/dist/types/src/playwright/invitations.spec.js +298 -0
  333. package/dist/types/src/playwright/invitations.spec.js.map +1 -0
  334. package/dist/types/src/playwright/playwright.config.d.ts +3 -0
  335. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
  336. package/dist/types/src/playwright/playwright.config.js +8 -0
  337. package/dist/types/src/playwright/playwright.config.js.map +1 -0
  338. package/dist/types/src/react.d.ts +6 -0
  339. package/dist/types/src/react.d.ts.map +1 -0
  340. package/dist/types/src/react.js +25 -0
  341. package/dist/types/src/react.js.map +1 -0
  342. package/dist/types/src/steps/InvitationManager.d.ts +7 -0
  343. package/dist/types/src/steps/InvitationManager.d.ts.map +1 -0
  344. package/dist/types/src/steps/InvitationManager.js +80 -0
  345. package/dist/types/src/steps/InvitationManager.js.map +1 -0
  346. package/dist/types/src/steps/StepProps.d.ts +14 -0
  347. package/dist/types/src/steps/StepProps.d.ts.map +1 -0
  348. package/dist/types/src/steps/StepProps.js +6 -0
  349. package/dist/types/src/steps/StepProps.js.map +1 -0
  350. package/dist/types/src/steps/index.d.ts +3 -0
  351. package/dist/types/src/steps/index.d.ts.map +1 -0
  352. package/dist/types/src/steps/index.js +22 -0
  353. package/dist/types/src/steps/index.js.map +1 -0
  354. package/dist/types/src/stories/Invitations.e2e-stories.d.ts +22 -0
  355. package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -0
  356. package/dist/types/src/stories/Invitations.e2e-stories.js +146 -0
  357. package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -0
  358. package/dist/types/src/styles/index.d.ts +3 -0
  359. package/dist/types/src/styles/index.d.ts.map +1 -0
  360. package/dist/types/src/styles/index.js +22 -0
  361. package/dist/types/src/styles/index.js.map +1 -0
  362. package/dist/types/src/styles/invitationStatusStyles.d.ts +20 -0
  363. package/dist/types/src/styles/invitationStatusStyles.d.ts.map +1 -0
  364. package/dist/types/src/styles/invitationStatusStyles.js +41 -0
  365. package/dist/types/src/styles/invitationStatusStyles.js.map +1 -0
  366. package/dist/types/src/styles/panelStyles.d.ts +2 -0
  367. package/dist/types/src/styles/panelStyles.d.ts.map +1 -0
  368. package/dist/types/src/styles/panelStyles.js +8 -0
  369. package/dist/types/src/styles/panelStyles.js.map +1 -0
  370. package/dist/types/src/testing/fixtures/identities.d.ts +3 -0
  371. package/dist/types/src/testing/fixtures/identities.d.ts.map +1 -0
  372. package/dist/types/src/testing/fixtures/identities.js +18 -0
  373. package/dist/types/src/testing/fixtures/identities.js.map +1 -0
  374. package/dist/types/src/testing/fixtures/index.d.ts +3 -0
  375. package/dist/types/src/testing/fixtures/index.d.ts.map +1 -0
  376. package/dist/types/src/testing/fixtures/index.js +22 -0
  377. package/dist/types/src/testing/fixtures/index.js.map +1 -0
  378. package/dist/types/src/testing/fixtures/invitations.d.ts +3 -0
  379. package/dist/types/src/testing/fixtures/invitations.d.ts.map +1 -0
  380. package/dist/types/src/testing/fixtures/invitations.js +25 -0
  381. package/dist/types/src/testing/fixtures/invitations.js.map +1 -0
  382. package/dist/types/src/testing/index.d.ts +4 -0
  383. package/dist/types/src/testing/index.d.ts.map +1 -0
  384. package/dist/types/src/testing/index.js +23 -0
  385. package/dist/types/src/testing/index.js.map +1 -0
  386. package/dist/types/src/testing/scoped-shell-manager.d.ts +17 -0
  387. package/dist/types/src/testing/scoped-shell-manager.d.ts.map +1 -0
  388. package/dist/types/src/testing/scoped-shell-manager.js +71 -0
  389. package/dist/types/src/testing/scoped-shell-manager.js.map +1 -0
  390. package/dist/types/src/testing/shell-manager.d.ts +24 -0
  391. package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
  392. package/dist/types/src/testing/shell-manager.js +85 -0
  393. package/dist/types/src/testing/shell-manager.js.map +1 -0
  394. package/dist/types/src/translations/index.d.ts +5 -0
  395. package/dist/types/src/translations/index.d.ts.map +1 -0
  396. package/dist/types/src/translations/index.js +32 -0
  397. package/dist/types/src/translations/index.js.map +1 -0
  398. package/dist/types/src/translations/locales/en-US.d.ts +97 -0
  399. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -0
  400. package/dist/types/src/translations/locales/en-US.js +103 -0
  401. package/dist/types/src/translations/locales/en-US.js.map +1 -0
  402. package/dist/types/src/types/FailReason.d.ts +2 -0
  403. package/dist/types/src/types/FailReason.d.ts.map +1 -0
  404. package/dist/types/src/types/FailReason.js +6 -0
  405. package/dist/types/src/types/FailReason.js.map +1 -0
  406. package/dist/types/src/types/IInvitation.d.ts +7 -0
  407. package/dist/types/src/types/IInvitation.d.ts.map +1 -0
  408. package/dist/types/src/types/IInvitation.js +6 -0
  409. package/dist/types/src/types/IInvitation.js.map +1 -0
  410. package/dist/types/src/types/index.d.ts +3 -0
  411. package/dist/types/src/types/index.d.ts.map +1 -0
  412. package/dist/types/src/types/index.js +22 -0
  413. package/dist/types/src/types/index.js.map +1 -0
  414. package/dist/types/src/util/index.d.ts +3 -0
  415. package/dist/types/src/util/index.d.ts.map +1 -0
  416. package/dist/types/src/util/index.js +22 -0
  417. package/dist/types/src/util/index.js.map +1 -0
  418. package/dist/types/src/util/invitationStatusValue.d.ts +8 -0
  419. package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -0
  420. package/dist/types/src/util/invitationStatusValue.js +24 -0
  421. package/dist/types/src/util/invitationStatusValue.js.map +1 -0
  422. package/dist/types/src/util/toEmoji.d.ts +2 -0
  423. package/dist/types/src/util/toEmoji.d.ts.map +1 -0
  424. package/dist/types/src/util/toEmoji.js +26 -0
  425. package/dist/types/src/util/toEmoji.js.map +1 -0
  426. package/package.json +79 -0
  427. package/src/components/AuthCode.tsx +36 -0
  428. package/src/components/Clipboard/ClipboardProvider.tsx +26 -0
  429. package/src/components/Clipboard/CopyButton.tsx +70 -0
  430. package/src/components/Clipboard/index.ts +6 -0
  431. package/src/components/CompoundButton/CompoundButton.stories.tsx +49 -0
  432. package/src/components/CompoundButton/CompoundButton.tsx +89 -0
  433. package/src/components/CompoundButton/index.ts +5 -0
  434. package/src/components/IdentityList/DeviceList.tsx +45 -0
  435. package/src/components/IdentityList/IdentityListItem.tsx +42 -0
  436. package/src/components/IdentityList/SpaceMemberList.stories.tsx +24 -0
  437. package/src/components/IdentityList/SpaceMemberList.tsx +65 -0
  438. package/src/components/IdentityList/index.ts +7 -0
  439. package/src/components/InvitationList/InvitationList.stories.tsx +44 -0
  440. package/src/components/InvitationList/InvitationList.tsx +31 -0
  441. package/src/components/InvitationList/InvitationListContainer.tsx +27 -0
  442. package/src/components/InvitationList/InvitationListItem.tsx +183 -0
  443. package/src/components/InvitationList/InvitationListProps.ts +9 -0
  444. package/src/components/InvitationList/index.ts +7 -0
  445. package/src/components/Panel/Action.tsx +142 -0
  446. package/src/components/Panel/Actions.tsx +31 -0
  447. package/src/components/Panel/CloseButton.tsx +24 -0
  448. package/src/components/Panel/Emoji.tsx +36 -0
  449. package/src/components/Panel/Heading.tsx +32 -0
  450. package/src/components/Panel/Input.tsx +27 -0
  451. package/src/components/Panel/Label.tsx +14 -0
  452. package/src/components/Panel/Panel.stories.tsx +52 -0
  453. package/src/components/Panel/StepHeading.tsx +17 -0
  454. package/src/components/Panel/index.ts +12 -0
  455. package/src/components/SpaceListItem.tsx +35 -0
  456. package/src/components/StorybookDialog.tsx +33 -0
  457. package/src/components/Viewport/Viewport.stories.tsx +66 -0
  458. package/src/components/Viewport/Viewport.tsx +120 -0
  459. package/src/components/Viewport/index.tsx +5 -0
  460. package/src/components/index.ts +12 -0
  461. package/src/composites/IdentityDialog/IdentityDialog.tsx +39 -0
  462. package/src/composites/IdentityDialog/index.ts +5 -0
  463. package/src/composites/JoinDialog/JoinDialog.tsx +40 -0
  464. package/src/composites/JoinDialog/index.ts +5 -0
  465. package/src/composites/Shell/Shell.tsx +98 -0
  466. package/src/composites/Shell/ShellContext.tsx +163 -0
  467. package/src/composites/Shell/index.ts +7 -0
  468. package/src/composites/Shell/memory-shell-runtime.ts +50 -0
  469. package/src/composites/Shell/run-shell.tsx +38 -0
  470. package/src/composites/SpaceDialog/SpaceDialog.tsx +37 -0
  471. package/src/composites/SpaceDialog/index.ts +5 -0
  472. package/src/composites/index.ts +8 -0
  473. package/src/index.ts +7 -0
  474. package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +113 -0
  475. package/src/panels/IdentityPanel/IdentityPanel.tsx +158 -0
  476. package/src/panels/IdentityPanel/IdentityPanelProps.ts +36 -0
  477. package/src/panels/IdentityPanel/identityMachine.ts +131 -0
  478. package/src/panels/IdentityPanel/index.ts +6 -0
  479. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +96 -0
  480. package/src/panels/IdentityPanel/steps/ProfileForm.tsx +79 -0
  481. package/src/panels/IdentityPanel/steps/index.ts +6 -0
  482. package/src/panels/JoinPanel/JoinHeading.tsx +49 -0
  483. package/src/panels/JoinPanel/JoinPanel.stories.tsx +91 -0
  484. package/src/panels/JoinPanel/JoinPanel.tsx +415 -0
  485. package/src/panels/JoinPanel/JoinPanelProps.ts +132 -0
  486. package/src/panels/JoinPanel/index.ts +6 -0
  487. package/src/panels/JoinPanel/joinMachine.ts +536 -0
  488. package/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx +65 -0
  489. package/src/panels/JoinPanel/steps/IdentityAdded.tsx +75 -0
  490. package/src/panels/JoinPanel/steps/IdentityInput.tsx +86 -0
  491. package/src/panels/JoinPanel/steps/InvitationAccepted.tsx +43 -0
  492. package/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx +99 -0
  493. package/src/panels/JoinPanel/steps/InvitationInput.tsx +102 -0
  494. package/src/panels/JoinPanel/steps/InvitationRescuer.tsx +102 -0
  495. package/src/panels/JoinPanel/steps/ResetIdentity.tsx +71 -0
  496. package/src/panels/JoinPanel/steps/index.ts +12 -0
  497. package/src/panels/Panels.stories.tsx +61 -0
  498. package/src/panels/SpacePanel/SpacePanel.stories.tsx +328 -0
  499. package/src/panels/SpacePanel/SpacePanel.tsx +122 -0
  500. package/src/panels/SpacePanel/SpacePanelProps.ts +40 -0
  501. package/src/panels/SpacePanel/index.ts +6 -0
  502. package/src/panels/SpacePanel/spaceMachine.ts +72 -0
  503. package/src/panels/SpacePanel/steps/SpaceManager.tsx +157 -0
  504. package/src/panels/SpacePanel/steps/index.ts +5 -0
  505. package/src/panels/index.ts +7 -0
  506. package/src/playwright/invitations-manager.ts +168 -0
  507. package/src/playwright/invitations.spec.ts +364 -0
  508. package/src/playwright/playwright.config.ts +7 -0
  509. package/src/react.ts +9 -0
  510. package/src/steps/InvitationManager.tsx +116 -0
  511. package/src/steps/StepProps.ts +17 -0
  512. package/src/steps/index.ts +6 -0
  513. package/src/stories/Invitations.e2e-stories.tsx +231 -0
  514. package/src/styles/index.ts +6 -0
  515. package/src/styles/invitationStatusStyles.ts +42 -0
  516. package/src/styles/panelStyles.ts +5 -0
  517. package/src/testing/fixtures/identities.ts +16 -0
  518. package/src/testing/fixtures/index.ts +6 -0
  519. package/src/testing/fixtures/invitations.ts +23 -0
  520. package/src/testing/index.ts +7 -0
  521. package/src/testing/scoped-shell-manager.ts +79 -0
  522. package/src/testing/shell-manager.ts +102 -0
  523. package/src/translations/index.ts +7 -0
  524. package/src/translations/locales/en-US.ts +101 -0
  525. package/src/types/FailReason.ts +5 -0
  526. package/src/types/IInvitation.ts +14 -0
  527. package/src/types/index.ts +6 -0
  528. package/src/util/index.ts +6 -0
  529. package/src/util/invitationStatusValue.ts +22 -0
  530. package/src/util/toEmoji.ts +22 -0
@@ -0,0 +1,37 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Dialog, type DialogContentProps, useId } from '@dxos/react-ui';
8
+
9
+ import { ClipboardProvider } from '../../components';
10
+ import { SpacePanel, type SpacePanelProps } from '../../panels';
11
+
12
+ export interface SpaceDialogProps
13
+ extends Omit<DialogContentProps, 'children'>,
14
+ Omit<SpacePanelProps, 'doneActionParent'> {}
15
+
16
+ export const SpaceDialog = (spacePanelProps: SpaceDialogProps) => {
17
+ const titleId = useId('spaceDialog__title');
18
+ return (
19
+ <Dialog.Root defaultOpen onOpenChange={(open) => open || spacePanelProps.onDone?.()}>
20
+ <Dialog.Portal>
21
+ <Dialog.Overlay>
22
+ <Dialog.Content aria-labelledby={titleId}>
23
+ <ClipboardProvider>
24
+ <SpacePanel
25
+ {...{
26
+ ...spacePanelProps,
27
+ titleId,
28
+ doneActionParent: <Dialog.Close asChild />,
29
+ }}
30
+ />
31
+ </ClipboardProvider>
32
+ </Dialog.Content>
33
+ </Dialog.Overlay>
34
+ </Dialog.Portal>
35
+ </Dialog.Root>
36
+ );
37
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './SpaceDialog';
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './IdentityDialog';
6
+ export * from './JoinDialog';
7
+ export * from './Shell';
8
+ export * from './SpaceDialog';
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+
7
+ export { runShell } from './composites';
@@ -0,0 +1,113 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+
7
+ import { faker } from '@faker-js/faker';
8
+ import React from 'react';
9
+
10
+ import { PublicKey } from '@dxos/react-client';
11
+ import { Invitation } from '@dxos/react-client/invitations';
12
+ import { withTheme } from '@dxos/storybook-utils';
13
+
14
+ import { IdentityPanelImpl } from './IdentityPanel';
15
+ import type { IdentityPanelImplProps } from './IdentityPanelProps';
16
+ import { IdentityActionChooserImpl } from './steps';
17
+ import { StorybookDialog } from '../../components/StorybookDialog';
18
+ import { InvitationManager, type InvitationManagerProps } from '../../steps';
19
+
20
+ faker.seed(1234);
21
+
22
+ const noOpProps: IdentityPanelImplProps = {
23
+ titleId: 'storybookIdentityPanel',
24
+ send: () => {},
25
+ activeView: 'identity action chooser',
26
+ createInvitationUrl: (code) => code,
27
+ identity: {
28
+ identityKey: PublicKey.random(),
29
+ profile: {
30
+ displayName: faker.person.firstName(),
31
+ },
32
+ },
33
+ };
34
+
35
+ export default {
36
+ title: 'Panels/Identity',
37
+ decorators: [withTheme],
38
+ parameters: { chromatic: { disableSnapshot: false } },
39
+ };
40
+
41
+ export const IdentityActionChooser = () => {
42
+ return (
43
+ <StorybookDialog inOverlayLayout>
44
+ <IdentityPanelImpl
45
+ {...noOpProps}
46
+ activeView='identity action chooser'
47
+ IdentityActionChooser={IdentityActionChooserImpl}
48
+ />
49
+ </StorybookDialog>
50
+ );
51
+ };
52
+
53
+ const DeviceInvitationManagerWithState = (extraProps: InvitationManagerProps) => (
54
+ <StorybookDialog inOverlayLayout>
55
+ <IdentityPanelImpl
56
+ {...noOpProps}
57
+ activeView='device invitation manager'
58
+ IdentityActionChooser={IdentityActionChooserImpl}
59
+ InvitationManager={(props) => <InvitationManager {...props} {...extraProps} />}
60
+ />
61
+ </StorybookDialog>
62
+ );
63
+
64
+ export const DeviceInvitationManager = () =>
65
+ DeviceInvitationManagerWithState({ status: Invitation.State.INIT, id: '0' });
66
+
67
+ export const DeviceInvitationManagerConnecting = () =>
68
+ DeviceInvitationManagerWithState({
69
+ status: Invitation.State.CONNECTING,
70
+ id: '1',
71
+ });
72
+
73
+ export const DeviceInvitationManagerConnected = () =>
74
+ DeviceInvitationManagerWithState({
75
+ status: Invitation.State.CONNECTED,
76
+ id: '2',
77
+ });
78
+
79
+ export const DeviceInvitationManagerReady = () =>
80
+ DeviceInvitationManagerWithState({
81
+ status: Invitation.State.READY_FOR_AUTHENTICATION,
82
+ authCode: '123123',
83
+ id: '3',
84
+ });
85
+
86
+ export const DeviceInvitationManagerAuthenticating = () =>
87
+ DeviceInvitationManagerWithState({
88
+ status: Invitation.State.AUTHENTICATING,
89
+ id: '4',
90
+ });
91
+
92
+ export const DeviceInvitationManagerSuccess = () =>
93
+ DeviceInvitationManagerWithState({ status: Invitation.State.SUCCESS });
94
+
95
+ export const DeviceInvitationManagerError = () => DeviceInvitationManagerWithState({ status: Invitation.State.ERROR });
96
+
97
+ export const DeviceInvitationManagerTimeout = () =>
98
+ DeviceInvitationManagerWithState({ status: Invitation.State.TIMEOUT });
99
+
100
+ export const DeviceInvitationManagerCancelled = () =>
101
+ DeviceInvitationManagerWithState({
102
+ status: Invitation.State.CANCELLED,
103
+ });
104
+
105
+ // export const IdentityActionChooser = {
106
+ // decorators: [ClientDecorator()],
107
+ // args: { activeView: 'identity action chooser' },
108
+ // };
109
+
110
+ // export const DeviceManager = {
111
+ // decorators: [ClientDecorator()],
112
+ // args: { activeView: 'device manager' },
113
+ // };
@@ -0,0 +1,158 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+ import React, { useEffect, useMemo } from 'react';
5
+
6
+ import { generateName } from '@dxos/display-name';
7
+ import { log } from '@dxos/log';
8
+ import { useClient } from '@dxos/react-client';
9
+ import { type Identity, useIdentity } from '@dxos/react-client/halo';
10
+ import { useInvitationStatus } from '@dxos/react-client/invitations';
11
+ import type { CancellableInvitationObservable } from '@dxos/react-client/invitations';
12
+ import { Avatar, DensityProvider, useId, useJdenticonHref, useTranslation } from '@dxos/react-ui';
13
+
14
+ import {
15
+ type IdentityPanelHeadingProps,
16
+ type IdentityPanelImplProps,
17
+ type IdentityPanelProps,
18
+ } from './IdentityPanelProps';
19
+ import { useIdentityMachine } from './identityMachine';
20
+ import { IdentityActionChooser, ProfileForm } from './steps';
21
+ import { Viewport, Heading, CloseButton } from '../../components';
22
+ import { InvitationManager } from '../../steps';
23
+
24
+ const viewStyles = 'pbs-1 pbe-3 pli-3';
25
+
26
+ const IdentityHeading = ({ titleId, title, identity, onDone }: IdentityPanelHeadingProps) => {
27
+ const fallbackHref = useJdenticonHref(identity.identityKey.toHex(), 12);
28
+ return (
29
+ <Heading titleId={titleId} title={title} corner={<CloseButton onDone={onDone} />}>
30
+ <Avatar.Root size={12} variant='circle' status='active'>
31
+ <Avatar.Frame classNames='block mbs-4 mbe-2 mli-auto chromatic-ignore'>
32
+ <Avatar.Fallback href={fallbackHref} />
33
+ </Avatar.Frame>
34
+ <Avatar.Label classNames='block text-center font-light text-xl'>
35
+ {identity.profile?.displayName ?? generateName(identity.identityKey.toHex())}
36
+ </Avatar.Label>
37
+ </Avatar.Root>
38
+ </Heading>
39
+ );
40
+ };
41
+
42
+ export const IdentityPanelImpl = (props: IdentityPanelImplProps) => {
43
+ const {
44
+ identity,
45
+ titleId,
46
+ activeView,
47
+ onUpdateProfile,
48
+ IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser,
49
+ InvitationManager: InvitationManagerComponent = InvitationManager,
50
+ onDone,
51
+ ...rest
52
+ } = props;
53
+ const { t } = useTranslation('os');
54
+ const title = useMemo(() => {
55
+ switch (activeView) {
56
+ case 'device manager':
57
+ case 'device invitation manager':
58
+ return t('choose devices label');
59
+ default:
60
+ return t('identity heading');
61
+ }
62
+ }, [activeView, t]);
63
+ return (
64
+ <DensityProvider density='fine'>
65
+ <IdentityHeading {...{ identity, titleId, title, onDone }} />
66
+ <Viewport.Root activeView={activeView}>
67
+ <Viewport.Views>
68
+ <Viewport.View id='identity action chooser' classNames={viewStyles}>
69
+ <IdentityActionChooserComponent active={activeView === 'identity action chooser'} {...rest} />
70
+ </Viewport.View>
71
+ <Viewport.View id='device invitation manager' classNames={viewStyles}>
72
+ <InvitationManagerComponent
73
+ active={activeView === 'device invitation manager'}
74
+ {...rest}
75
+ invitationUrl={rest.createInvitationUrl(rest.invitationCode!)}
76
+ />
77
+ </Viewport.View>
78
+ <Viewport.View classNames={viewStyles} id='update profile form'>
79
+ <ProfileForm
80
+ send={rest.send}
81
+ active={activeView === 'update profile form'}
82
+ profile={identity.profile}
83
+ onUpdateProfile={onUpdateProfile}
84
+ />
85
+ </Viewport.View>
86
+ {/* <Viewport.View id='signing out'></Viewport.View> */}
87
+ </Viewport.Views>
88
+ </Viewport.Root>
89
+ </DensityProvider>
90
+ );
91
+ };
92
+
93
+ const IdentityPanelWithInvitationImpl = ({
94
+ invitation,
95
+ ...props
96
+ }: IdentityPanelImplProps & { invitation: CancellableInvitationObservable }) => {
97
+ const invitationStatus = useInvitationStatus(invitation);
98
+ return <IdentityPanelImpl {...props} {...invitationStatus} />;
99
+ };
100
+
101
+ export const IdentityPanel = ({
102
+ titleId: propsTitleId,
103
+ createInvitationUrl = (code) => code,
104
+ ...props
105
+ }: IdentityPanelProps) => {
106
+ const titleId = useId('identityPanel__heading', propsTitleId);
107
+ const client = useClient();
108
+ const identity = useIdentity();
109
+ if (!identity) {
110
+ console.error('IdentityPanel rendered with no active identity.');
111
+ return null;
112
+ }
113
+ const [identityState, identitySend, identityService] = useIdentityMachine(client);
114
+
115
+ useEffect(() => {
116
+ const subscription = identityService.subscribe((state) => {
117
+ log('[state]', state);
118
+ });
119
+
120
+ return subscription.unsubscribe;
121
+ }, [identityService]);
122
+
123
+ const activeView = useMemo(() => {
124
+ switch (true) {
125
+ case identityState.matches('choosingAction'):
126
+ return 'identity action chooser';
127
+ case identityState.matches('managingDeviceInvitation'):
128
+ return 'device invitation manager';
129
+ case [{ managingProfile: 'idle' }, { managingProfile: 'pending' }].some(identityState.matches):
130
+ return 'update profile form';
131
+ // case identityState.matches('signingOut'):
132
+ // return 'identity exit';
133
+ default:
134
+ return 'identity action chooser';
135
+ }
136
+ }, [identityState]);
137
+
138
+ const onUpdateProfile = async (profile: NonNullable<Identity['profile']>) => {
139
+ identitySend({ type: 'updateProfile' });
140
+ await client.halo.updateProfile(profile);
141
+ };
142
+
143
+ const implProps = {
144
+ ...props,
145
+ identity,
146
+ activeView,
147
+ send: identitySend,
148
+ titleId,
149
+ createInvitationUrl,
150
+ onUpdateProfile,
151
+ } satisfies IdentityPanelImplProps;
152
+
153
+ return identityState.context.invitation ? (
154
+ <IdentityPanelWithInvitationImpl {...implProps} invitation={identityState.context.invitation} />
155
+ ) : (
156
+ <IdentityPanelImpl {...implProps} />
157
+ );
158
+ };
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type cloneElement } from 'react';
6
+ import { type Event, type SingleOrArray } from 'xstate';
7
+
8
+ import type { Identity } from '@dxos/react-client/halo';
9
+ import { type InvitationStatus } from '@dxos/react-client/invitations';
10
+
11
+ import { type IdentityEvent } from './identityMachine';
12
+ import { type InvitationManagerProps } from '../../steps';
13
+
14
+ export type IdentityPanelImplProps = {
15
+ titleId: string;
16
+ activeView: 'device manager' | 'update profile form' | 'device invitation manager' | 'identity action chooser';
17
+ identity: Identity;
18
+ onUpdateProfile?: (profile: NonNullable<Identity['profile']>) => Promise<void>;
19
+ createInvitationUrl: (invitationCode: string) => string;
20
+ send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
21
+ onDone?: () => void;
22
+ doneActionParent?: Parameters<typeof cloneElement>[0];
23
+ invitationUrl?: string;
24
+ IdentityActionChooser?: React.FC<IdentityPanelStepProps>;
25
+ InvitationManager?: React.FC<InvitationManagerProps>;
26
+ } & Partial<InvitationStatus>;
27
+
28
+ export type IdentityPanelProps = Partial<Omit<IdentityPanelImplProps, 'send' | 'activeView' | 'identity'>>;
29
+
30
+ export type IdentityPanelHeadingProps = Pick<IdentityPanelImplProps, 'titleId' | 'identity' | 'onDone'> & {
31
+ title: string;
32
+ };
33
+
34
+ export type IdentityPanelStepProps = Pick<IdentityPanelImplProps, 'send' | 'onDone' | 'doneActionParent'> & {
35
+ active?: boolean;
36
+ };
@@ -0,0 +1,131 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { useMachine } from '@xstate/react';
6
+ import { assign, createMachine, type InterpreterFrom, type StateFrom, type Subscribable } from 'xstate';
7
+
8
+ import { log } from '@dxos/log';
9
+ import { type Client } from '@dxos/react-client';
10
+ import { type Identity } from '@dxos/react-client/halo';
11
+ import { type CancellableInvitationObservable } from '@dxos/react-client/invitations';
12
+
13
+ import { type StepEvent } from '../../steps';
14
+
15
+ type IdentityMachineContext = {
16
+ invitation?: CancellableInvitationObservable;
17
+ identity: Identity | null;
18
+ identitySubscribable: Subscribable<SetIdentityEvent> | null;
19
+ };
20
+
21
+ type IdentityChooseActionEvent = {
22
+ type: 'chooseDevices' | 'chooseProfile' | /* 'chooseSignOut' | */ 'unchooseAction';
23
+ };
24
+
25
+ type IdentitySelectDeviceInvitationEvent = {
26
+ type: 'selectInvitation';
27
+ invitation: CancellableInvitationObservable;
28
+ };
29
+
30
+ export type SetIdentityEvent = {
31
+ type: 'setIdentity';
32
+ identity: Identity | null;
33
+ };
34
+
35
+ export type UpdateProfileEvent = {
36
+ type: 'updateProfile';
37
+ };
38
+
39
+ type IdentityEvent =
40
+ | SetIdentityEvent
41
+ | UpdateProfileEvent
42
+ | IdentitySelectDeviceInvitationEvent
43
+ | IdentityChooseActionEvent
44
+ | StepEvent;
45
+
46
+ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
47
+ {
48
+ id: 'identity',
49
+ predictableActionArguments: true,
50
+ context: {
51
+ identity: null,
52
+ identitySubscribable: null,
53
+ },
54
+ initial: 'choosingAction',
55
+ invoke: {
56
+ src: (context) => context.identitySubscribable!,
57
+ },
58
+ states: {
59
+ choosingAction: {},
60
+ managingDeviceInvitation: {},
61
+ managingProfile: {
62
+ initial: 'idle',
63
+ states: {
64
+ idle: {},
65
+ pending: {},
66
+ },
67
+ on: {
68
+ setIdentity: { target: 'choosingAction', actions: ['setIdentity', 'log'] },
69
+ updateProfile: { target: '.pending', actions: 'log' },
70
+ },
71
+ },
72
+ // signingOut: {},
73
+ },
74
+ on: {
75
+ unchooseAction: { target: '.choosingAction', actions: ['unsetInvitation', 'log'] },
76
+ chooseDevices: { target: '.managingDeviceInvitation', actions: ['unsetInvitation', 'log'] },
77
+ deselectInvitation: { target: '.choosingAction', actions: ['unsetInvitation', 'log'] },
78
+ selectInvitation: { target: '.managingDeviceInvitation', actions: ['setInvitation', 'log'] },
79
+ chooseProfile: { target: '.managingProfile', actions: 'log' },
80
+ // chooseSignOut: { target: '.signingOut', actions: 'log' },
81
+ },
82
+ },
83
+ {
84
+ actions: {
85
+ setIdentity: assign<IdentityMachineContext, IdentityEvent>({
86
+ identity: (context, event) => (event as SetIdentityEvent)?.identity ?? null,
87
+ }),
88
+ setInvitation: assign<IdentityMachineContext, IdentityEvent>({
89
+ invitation: (context, event) => (event as IdentitySelectDeviceInvitationEvent)?.invitation ?? null,
90
+ }),
91
+ unsetInvitation: assign<IdentityMachineContext, IdentityEvent>({
92
+ invitation: () => undefined,
93
+ }),
94
+ log: (context, event) => {
95
+ log('[transition]', {
96
+ event,
97
+ context,
98
+ });
99
+ },
100
+ },
101
+ },
102
+ );
103
+
104
+ type IdentityMachine = typeof identityMachine;
105
+
106
+ type IdentityState = StateFrom<IdentityMachine>;
107
+ type IdentitySend = InterpreterFrom<IdentityMachine>['send'];
108
+
109
+ const useIdentityMachine = (client: Client, options?: Parameters<typeof useMachine<IdentityMachine>>[1]) => {
110
+ return useMachine(identityMachine, {
111
+ ...options,
112
+ context: {
113
+ ...options?.context,
114
+ identity: client.halo.identity.get(),
115
+ identitySubscribable: client.halo.identity.map((identity) => ({
116
+ type: 'setIdentity',
117
+ identity,
118
+ })) satisfies Subscribable<SetIdentityEvent>,
119
+ },
120
+ });
121
+ };
122
+
123
+ export type {
124
+ IdentityMachine,
125
+ IdentityEvent,
126
+ IdentityMachineContext,
127
+ IdentityChooseActionEvent,
128
+ IdentityState,
129
+ IdentitySend,
130
+ };
131
+ export { identityMachine, useIdentityMachine };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './IdentityPanel';
6
+ export * from './IdentityPanelProps';
@@ -0,0 +1,96 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { CaretRight, Plus, Power, UserGear } from '@phosphor-icons/react';
6
+ import React, { useCallback } from 'react';
7
+
8
+ import { useClient } from '@dxos/react-client';
9
+ import { useHaloInvitations } from '@dxos/react-client/halo';
10
+ import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
11
+ import { DensityProvider, useTranslation } from '@dxos/react-ui';
12
+ import { getSize } from '@dxos/react-ui-theme';
13
+
14
+ import { Action } from '../../../components';
15
+ import { type IdentityPanelStepProps } from '../IdentityPanelProps';
16
+
17
+ export type IdentityActionChooserProps = IdentityPanelStepProps;
18
+
19
+ export const IdentityActionChooser = (props: IdentityPanelStepProps) => {
20
+ const { send } = props;
21
+ const client = useClient();
22
+ const invitations = useHaloInvitations();
23
+ const onInvitationEvent = useCallback((invitation: Invitation) => {
24
+ const invitationCode = InvitationEncoder.encode(invitation);
25
+ if (invitation.state === Invitation.State.CONNECTING) {
26
+ console.log(JSON.stringify({ invitationCode, authCode: invitation.authCode }));
27
+ }
28
+ }, []);
29
+ const createInvitation = (e: React.MouseEvent) => {
30
+ const testing = e.altKey && e.shiftKey;
31
+ invitations.forEach((invitation) => invitation.cancel());
32
+ const invitation = client.halo.share(
33
+ testing ? { type: Invitation.Type.MULTIUSE, authMethod: Invitation.AuthMethod.NONE } : undefined,
34
+ );
35
+ // TODO(wittjosiah): Don't depend on NODE_ENV.
36
+ if (process.env.NODE_ENV !== 'production') {
37
+ invitation.subscribe(onInvitationEvent);
38
+ }
39
+ send?.({ type: 'selectInvitation', invitation });
40
+ };
41
+ return <IdentityActionChooserImpl {...props} onCreateInvitationClick={(e) => createInvitation(e)} />;
42
+ };
43
+
44
+ export type IdentityActionChooserImplProps = IdentityActionChooserProps & {
45
+ onCreateInvitationClick?: (e: React.MouseEvent) => void;
46
+ };
47
+
48
+ export const IdentityActionChooserImpl = ({
49
+ onCreateInvitationClick,
50
+ active,
51
+ send,
52
+ onDone,
53
+ doneActionParent,
54
+ }: IdentityActionChooserImplProps) => {
55
+ const { t } = useTranslation('os');
56
+
57
+ // const doneAction = (
58
+ // <PanelAction aria-label={t('done label')} onClick={onDone} disabled={!active} data-testid='identity-panel-done'>
59
+ // <Check weight='light' className={getSize(6)} />
60
+ // </PanelAction>
61
+ // );
62
+ return (
63
+ <div role='none' className='grow flex flex-col gap-1'>
64
+ <DensityProvider density='coarse'>
65
+ <div className='grow justify-center flex flex-col gap-1'>
66
+ <Action
67
+ disabled={!active}
68
+ data-testid='devices-panel.create-invitation'
69
+ onClick={onCreateInvitationClick}
70
+ classNames='plb-4'
71
+ >
72
+ <Plus className={getSize(6)} />
73
+ <span className='grow mli-3'>{t('choose devices label')}</span>
74
+ <CaretRight weight='bold' className={getSize(4)} />
75
+ </Action>
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
+ <Action
82
+ disabled
83
+ data-testid='sign-out'
84
+ onClick={() => {} /* send({ type: 'chooseSignOut' }) */}
85
+ classNames='plb-4'
86
+ >
87
+ <Power className={getSize(6)} />
88
+ <span className='grow mli-3'>{t('choose sign out label')}</span>
89
+ <CaretRight weight='bold' className={getSize(4)} />
90
+ </Action>
91
+ </div>
92
+ </DensityProvider>
93
+ {/* <PanelActions>{doneActionParent ? cloneElement(doneActionParent, {}, doneAction) : doneAction}</PanelActions> */}
94
+ </div>
95
+ );
96
+ };
@@ -0,0 +1,79 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { useState } from 'react';
6
+ import { type Event, type SingleOrArray } from 'xstate';
7
+
8
+ import { log } from '@dxos/log';
9
+ import { type Identity } from '@dxos/react-client/halo';
10
+ import { useTranslation } from '@dxos/react-ui';
11
+
12
+ import { Action, Actions, StepHeading, Input } from '../../../components';
13
+ import { type IdentityPanelStepProps } from '../IdentityPanelProps';
14
+ import { type IdentityEvent } from '../identityMachine';
15
+
16
+ export interface ProfileFormProps extends Omit<IdentityPanelStepProps, 'send'> {
17
+ send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
18
+ onUpdateProfile?: (profile: NonNullable<Identity['profile']>) => Promise<void>;
19
+ profile?: Identity['profile'];
20
+ }
21
+
22
+ export type ProfileFormImplProps = ProfileFormProps & {
23
+ validationMessage?: string;
24
+ };
25
+
26
+ export const ProfileForm = (props: ProfileFormProps) => {
27
+ const { onUpdateProfile } = props;
28
+ const { t } = useTranslation('os');
29
+ const [validationMessage, setValidationMessage] = useState('');
30
+ const handleUpdateProfile = async (profile: NonNullable<Identity['profile']>) => {
31
+ await onUpdateProfile?.(profile).catch((error) => {
32
+ log.catch(error);
33
+ setValidationMessage(t('failed to update profile message'));
34
+ });
35
+ };
36
+ return <ProfileFormImpl {...props} onUpdateProfile={handleUpdateProfile} validationMessage={validationMessage} />;
37
+ };
38
+
39
+ // TODO(zhenyasav): impl shouldn't need send()
40
+ export const ProfileFormImpl = (props: ProfileFormImplProps) => {
41
+ const { active, profile, send, onUpdateProfile, validationMessage } = props;
42
+ const disabled = !active;
43
+ const { t } = useTranslation('os');
44
+ const [inputValue, setInputValue] = useState(profile?.displayName ?? '');
45
+ return (
46
+ <>
47
+ <div role='none' className='grow flex flex-col justify-center'>
48
+ <Input
49
+ {...{ validationMessage }}
50
+ label={<StepHeading>{t('display name input label')}</StepHeading>}
51
+ disabled={disabled}
52
+ data-testid='display-name-input'
53
+ placeholder={t('display name input placeholder')}
54
+ value={inputValue}
55
+ onChange={({ target: { value } }) => setInputValue(value)}
56
+ onKeyDown={({ key }) => key === 'Enter' && onUpdateProfile?.({ displayName: inputValue })}
57
+ />
58
+ </div>
59
+ <Actions>
60
+ <Action
61
+ variant='ghost'
62
+ disabled={disabled}
63
+ onClick={() => send?.({ type: 'unchooseAction' })}
64
+ data-testid={'update-profile-form-back'}
65
+ >
66
+ {t('back label')}
67
+ </Action>
68
+ <Action
69
+ variant='primary'
70
+ disabled={disabled}
71
+ onClick={() => onUpdateProfile?.({ displayName: inputValue })}
72
+ data-testid={'update-profile-form-continue'}
73
+ >
74
+ {t('done label')}
75
+ </Action>
76
+ </Actions>
77
+ </>
78
+ );
79
+ };