@dxos/plugin-space 0.8.2-main.f11618f → 0.8.2-staging.42af850

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 (290) hide show
  1. package/dist/lib/browser/app-graph-builder-DCWUULKX.mjs +328 -0
  2. package/dist/lib/browser/app-graph-builder-DCWUULKX.mjs.map +7 -0
  3. package/dist/lib/browser/{app-graph-serializer-UUJH7JRN.mjs → app-graph-serializer-MLU7XI2P.mjs} +6 -6
  4. package/dist/lib/browser/app-graph-serializer-MLU7XI2P.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-KVRYWFZU.mjs → chunk-3LN4LJN6.mjs} +3 -8
  6. package/dist/lib/{node-esm/chunk-PIYAWT5N.mjs.map → browser/chunk-3LN4LJN6.mjs.map} +3 -3
  7. package/dist/lib/browser/chunk-7Y4M7GXO.mjs +94 -0
  8. package/dist/lib/browser/chunk-7Y4M7GXO.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-JS6ZV4GV.mjs → chunk-N5QMRLKI.mjs} +24 -38
  10. package/dist/lib/browser/chunk-N5QMRLKI.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-Q4BTFH2P.mjs +1900 -0
  12. package/dist/lib/browser/chunk-Q4BTFH2P.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-DIJ7LMCS.mjs → chunk-VEBKN45O.mjs} +3 -4
  14. package/dist/lib/browser/chunk-VEBKN45O.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-W46VVHFM.mjs +288 -0
  16. package/dist/lib/browser/chunk-W46VVHFM.mjs.map +7 -0
  17. package/dist/lib/browser/{identity-created-NRVE4XLL.mjs → identity-created-O63SIYOF.mjs} +3 -3
  18. package/dist/lib/browser/identity-created-O63SIYOF.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +27 -26
  20. package/dist/lib/browser/index.mjs.map +3 -3
  21. package/dist/lib/browser/{intent-resolver-NP55M7C7.mjs → intent-resolver-KBF3YU6I.mjs} +33 -35
  22. package/dist/lib/browser/intent-resolver-KBF3YU6I.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/{react-root-XKAUZ3X2.mjs → react-root-PVKJE4EZ.mjs} +6 -5
  25. package/dist/lib/browser/{react-surface-2DW2UDRX.mjs → react-surface-252P4NCK.mjs} +6 -13
  26. package/dist/lib/browser/react-surface-252P4NCK.mjs.map +7 -0
  27. package/dist/lib/browser/schema-defs-JMN74RNK.mjs +26 -0
  28. package/dist/lib/browser/schema-defs-JMN74RNK.mjs.map +7 -0
  29. package/dist/lib/browser/{schema-tools-YAXPRIXP.mjs → schema-tools-JIEMHUXV.mjs} +26 -26
  30. package/dist/lib/browser/schema-tools-JIEMHUXV.mjs.map +7 -0
  31. package/dist/lib/browser/{settings-MVT32NP6.mjs → settings-2IN2WLUK.mjs} +2 -2
  32. package/dist/lib/browser/{spaces-ready-ERNSICUW.mjs → spaces-ready-L4QAGTDE.mjs} +18 -17
  33. package/dist/lib/browser/spaces-ready-L4QAGTDE.mjs.map +7 -0
  34. package/dist/lib/browser/{state-CYV6QCTN.mjs → state-6HOSHLIN.mjs} +3 -3
  35. package/dist/lib/browser/state-6HOSHLIN.mjs.map +7 -0
  36. package/dist/lib/browser/types/index.mjs +1 -7
  37. package/dist/lib/node/app-graph-builder-WC445X77.cjs +328 -0
  38. package/dist/lib/node/app-graph-builder-WC445X77.cjs.map +7 -0
  39. package/dist/lib/node/{app-graph-serializer-M6Z2OPA4.cjs → app-graph-serializer-UPQOQVMJ.cjs} +22 -22
  40. package/dist/lib/node/app-graph-serializer-UPQOQVMJ.cjs.map +7 -0
  41. package/dist/lib/node/chunk-5WLAXYE3.cjs +125 -0
  42. package/dist/lib/node/chunk-5WLAXYE3.cjs.map +7 -0
  43. package/dist/lib/node/{chunk-IKIDS6XF.cjs → chunk-7GQGM4ZF.cjs} +7 -13
  44. package/dist/lib/node/{chunk-IKIDS6XF.cjs.map → chunk-7GQGM4ZF.cjs.map} +3 -3
  45. package/dist/lib/node/{chunk-XADZLQAJ.cjs → chunk-COQYISES.cjs} +46 -61
  46. package/dist/lib/node/chunk-COQYISES.cjs.map +7 -0
  47. package/dist/lib/node/{chunk-UOCR4G2D.cjs → chunk-DXL5TDFP.cjs} +7 -8
  48. package/dist/lib/node/chunk-DXL5TDFP.cjs.map +7 -0
  49. package/dist/lib/node/chunk-FXHI7JNY.cjs +315 -0
  50. package/dist/lib/node/chunk-FXHI7JNY.cjs.map +7 -0
  51. package/dist/lib/node/chunk-Q3YZEYZT.cjs +1904 -0
  52. package/dist/lib/node/chunk-Q3YZEYZT.cjs.map +7 -0
  53. package/dist/lib/node/{identity-created-YDTRMOMX.cjs → identity-created-UXEAUGC7.cjs} +7 -7
  54. package/dist/lib/node/identity-created-UXEAUGC7.cjs.map +7 -0
  55. package/dist/lib/node/index.cjs +77 -78
  56. package/dist/lib/node/index.cjs.map +3 -3
  57. package/dist/lib/node/{intent-resolver-3J52ARFL.cjs → intent-resolver-SVFJKUH7.cjs} +80 -81
  58. package/dist/lib/node/intent-resolver-SVFJKUH7.cjs.map +7 -0
  59. package/dist/lib/node/meta.json +1 -1
  60. package/dist/lib/node/{react-root-XUE2J7HT.cjs → react-root-DDPDUMCG.cjs} +11 -10
  61. package/dist/lib/node/{react-root-XUE2J7HT.cjs.map → react-root-DDPDUMCG.cjs.map} +1 -1
  62. package/dist/lib/node/{react-surface-IWSTOZ2E.cjs → react-surface-JUIU37BX.cjs} +44 -49
  63. package/dist/lib/node/react-surface-JUIU37BX.cjs.map +7 -0
  64. package/dist/lib/node/{schema-PPJ5BZ3A.cjs → schema-defs-XLFBG3XK.cjs} +14 -12
  65. package/dist/lib/node/schema-defs-XLFBG3XK.cjs.map +7 -0
  66. package/dist/lib/node/{schema-tools-BLIMOZYY.cjs → schema-tools-ZG6Z2QRC.cjs} +32 -32
  67. package/dist/lib/node/schema-tools-ZG6Z2QRC.cjs.map +7 -0
  68. package/dist/lib/node/{settings-JLV7YT6Q.cjs → settings-FOH7EB5C.cjs} +6 -6
  69. package/dist/lib/node/{spaces-ready-6EBR4SM4.cjs → spaces-ready-VXQYCBII.cjs} +26 -25
  70. package/dist/lib/node/spaces-ready-VXQYCBII.cjs.map +7 -0
  71. package/dist/lib/node/{state-JLN7TGRR.cjs → state-ZT3MTZXB.cjs} +7 -7
  72. package/dist/lib/node/state-ZT3MTZXB.cjs.map +7 -0
  73. package/dist/lib/node/types/index.cjs +12 -18
  74. package/dist/lib/node/types/index.cjs.map +2 -2
  75. package/dist/lib/node-esm/app-graph-builder-E7CCGPQJ.mjs +329 -0
  76. package/dist/lib/node-esm/app-graph-builder-E7CCGPQJ.mjs.map +7 -0
  77. package/dist/lib/node-esm/{app-graph-serializer-J3B4WSXU.mjs → app-graph-serializer-UCMSLPIA.mjs} +6 -6
  78. package/dist/lib/node-esm/app-graph-serializer-UCMSLPIA.mjs.map +7 -0
  79. package/dist/lib/node-esm/{chunk-PIYAWT5N.mjs → chunk-4X4Y63ND.mjs} +3 -8
  80. package/dist/lib/{browser/chunk-KVRYWFZU.mjs.map → node-esm/chunk-4X4Y63ND.mjs.map} +3 -3
  81. package/dist/lib/node-esm/chunk-FTELJGEG.mjs +289 -0
  82. package/dist/lib/node-esm/chunk-FTELJGEG.mjs.map +7 -0
  83. package/dist/lib/node-esm/chunk-GH2FGJXH.mjs +96 -0
  84. package/dist/lib/node-esm/chunk-GH2FGJXH.mjs.map +7 -0
  85. package/dist/lib/node-esm/chunk-HL2Z2GNW.mjs +1901 -0
  86. package/dist/lib/node-esm/chunk-HL2Z2GNW.mjs.map +7 -0
  87. package/dist/lib/node-esm/{chunk-OLISVDCF.mjs → chunk-OSPEGYX3.mjs} +3 -4
  88. package/dist/lib/node-esm/chunk-OSPEGYX3.mjs.map +7 -0
  89. package/dist/lib/node-esm/{chunk-ABTVMAG5.mjs → chunk-XAZNQ3QN.mjs} +24 -38
  90. package/dist/lib/node-esm/chunk-XAZNQ3QN.mjs.map +7 -0
  91. package/dist/lib/node-esm/{identity-created-EC6SVYB5.mjs → identity-created-ZECO4NH3.mjs} +3 -3
  92. package/dist/lib/node-esm/identity-created-ZECO4NH3.mjs.map +7 -0
  93. package/dist/lib/node-esm/index.mjs +27 -26
  94. package/dist/lib/node-esm/index.mjs.map +3 -3
  95. package/dist/lib/node-esm/{intent-resolver-MXQIFIRC.mjs → intent-resolver-K2UDBF2R.mjs} +33 -35
  96. package/dist/lib/node-esm/intent-resolver-K2UDBF2R.mjs.map +7 -0
  97. package/dist/lib/node-esm/meta.json +1 -1
  98. package/dist/lib/node-esm/{react-root-ZBCJCEFS.mjs → react-root-6F7B3OVO.mjs} +6 -5
  99. package/dist/lib/{browser/react-root-XKAUZ3X2.mjs.map → node-esm/react-root-6F7B3OVO.mjs.map} +1 -1
  100. package/dist/lib/node-esm/{react-surface-JCHDAPGM.mjs → react-surface-NP3Y6BNZ.mjs} +6 -13
  101. package/dist/lib/node-esm/react-surface-NP3Y6BNZ.mjs.map +7 -0
  102. package/dist/lib/node-esm/schema-defs-QZJS6UXN.mjs +27 -0
  103. package/dist/lib/node-esm/schema-defs-QZJS6UXN.mjs.map +7 -0
  104. package/dist/lib/node-esm/{schema-tools-IU7EX5A5.mjs → schema-tools-2Y4D42PD.mjs} +26 -26
  105. package/dist/lib/node-esm/schema-tools-2Y4D42PD.mjs.map +7 -0
  106. package/dist/lib/node-esm/{settings-AILIMHTE.mjs → settings-Q4XDFSYD.mjs} +2 -2
  107. package/dist/lib/node-esm/{spaces-ready-5PXESKHX.mjs → spaces-ready-JHKPD4PH.mjs} +18 -17
  108. package/dist/lib/node-esm/spaces-ready-JHKPD4PH.mjs.map +7 -0
  109. package/dist/lib/node-esm/{state-YZPY5T5A.mjs → state-4ATRHSKA.mjs} +3 -3
  110. package/dist/lib/node-esm/state-4ATRHSKA.mjs.map +7 -0
  111. package/dist/lib/node-esm/types/index.mjs +1 -7
  112. package/dist/types/src/SpacePlugin.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
  114. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  115. package/dist/types/src/capabilities/app-graph-serializer.d.ts +2 -2
  116. package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/capabilities.d.ts +0 -8
  118. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  119. package/dist/types/src/capabilities/identity-created.d.ts +2 -2
  120. package/dist/types/src/capabilities/identity-created.d.ts.map +1 -1
  121. package/dist/types/src/capabilities/index.d.ts +8 -184
  122. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  124. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  125. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  126. package/dist/types/src/capabilities/schema-defs.d.ts +4 -0
  127. package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -0
  128. package/dist/types/src/capabilities/schema-tools.d.ts +3 -3
  129. package/dist/types/src/capabilities/schema-tools.d.ts.map +1 -1
  130. package/dist/types/src/capabilities/spaces-ready.d.ts +2 -2
  131. package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -1
  132. package/dist/types/src/capabilities/state.d.ts +2 -2
  133. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  134. package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
  135. package/dist/types/src/components/CollectionMain.d.ts.map +1 -1
  136. package/dist/types/src/components/CollectionSection.d.ts.map +1 -1
  137. package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
  138. package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
  139. package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
  140. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  141. package/dist/types/src/components/MembersContainer.d.ts.map +1 -1
  142. package/dist/types/src/components/MembersContainer.stories.d.ts.map +1 -1
  143. package/dist/types/src/components/MenuFooter.d.ts +2 -2
  144. package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
  145. package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts +2 -2
  146. package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts.map +1 -1
  147. package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts +2 -2
  148. package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +1 -1
  149. package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts.map +1 -1
  150. package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts +2 -2
  151. package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts.map +1 -1
  152. package/dist/types/src/components/PersistenceStatus.d.ts.map +1 -1
  153. package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
  154. package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
  155. package/dist/types/src/components/SchemaContainer.d.ts.map +1 -1
  156. package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
  157. package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
  158. package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
  159. package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
  160. package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
  161. package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
  162. package/dist/types/src/components/SyncStatus/save-tracker.d.ts.map +1 -1
  163. package/dist/types/src/components/SyncStatus/status.d.ts.map +1 -1
  164. package/dist/types/src/components/index.d.ts +0 -1
  165. package/dist/types/src/components/index.d.ts.map +1 -1
  166. package/dist/types/src/hooks/index.d.ts +1 -0
  167. package/dist/types/src/hooks/index.d.ts.map +1 -1
  168. package/dist/types/src/hooks/useActiveSpace.d.ts +4 -0
  169. package/dist/types/src/hooks/useActiveSpace.d.ts.map +1 -0
  170. package/dist/types/src/hooks/useInputSurfaceLookup.d.ts +2 -2
  171. package/dist/types/src/hooks/useInputSurfaceLookup.d.ts.map +1 -1
  172. package/dist/types/src/hooks/usePath.d.ts +3 -2
  173. package/dist/types/src/hooks/usePath.d.ts.map +1 -1
  174. package/dist/types/src/index.d.ts +3 -2
  175. package/dist/types/src/index.d.ts.map +1 -1
  176. package/dist/types/src/translations.d.ts +2 -263
  177. package/dist/types/src/translations.d.ts.map +1 -1
  178. package/dist/types/src/types/collection.d.ts +9 -8
  179. package/dist/types/src/types/collection.d.ts.map +1 -1
  180. package/dist/types/src/types/index.d.ts +0 -1
  181. package/dist/types/src/types/index.d.ts.map +1 -1
  182. package/dist/types/src/types/types.d.ts +161 -160
  183. package/dist/types/src/types/types.d.ts.map +1 -1
  184. package/dist/types/src/util.d.ts +10 -16
  185. package/dist/types/src/util.d.ts.map +1 -1
  186. package/dist/types/tsconfig.tsbuildinfo +1 -1
  187. package/package.json +54 -48
  188. package/src/SpacePlugin.tsx +8 -7
  189. package/src/capabilities/app-graph-builder.ts +376 -268
  190. package/src/capabilities/app-graph-serializer.ts +4 -4
  191. package/src/capabilities/capabilities.ts +0 -9
  192. package/src/capabilities/identity-created.ts +3 -3
  193. package/src/capabilities/index.ts +2 -2
  194. package/src/capabilities/intent-resolver.ts +22 -29
  195. package/src/capabilities/react-surface.tsx +15 -23
  196. package/src/capabilities/schema-defs.ts +30 -0
  197. package/src/capabilities/schema-tool.test.ts +2 -3
  198. package/src/capabilities/schema-tools.ts +29 -29
  199. package/src/capabilities/spaces-ready.ts +15 -13
  200. package/src/capabilities/state.ts +3 -3
  201. package/src/components/AwaitingObject.tsx +1 -1
  202. package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +2 -2
  203. package/src/components/CreateDialog/CreateObjectDialog.tsx +1 -1
  204. package/src/components/CreateDialog/CreateSpaceDialog.tsx +2 -3
  205. package/src/components/MembersContainer.stories.tsx +1 -5
  206. package/src/components/MenuFooter.tsx +2 -2
  207. package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +4 -4
  208. package/src/components/ObjectSettings/BaseObjectSettings.tsx +2 -2
  209. package/src/components/ObjectSettings/ObjectSettingsContainer.tsx +4 -4
  210. package/src/components/PersistenceStatus.tsx +11 -14
  211. package/src/components/PopoverRenameObject.tsx +1 -1
  212. package/src/components/PopoverRenameSpace.tsx +1 -1
  213. package/src/components/SpacePresence.stories.tsx +1 -1
  214. package/src/components/SpacePresence.tsx +34 -43
  215. package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +5 -3
  216. package/src/components/SyncStatus/InlineSyncStatus.tsx +10 -17
  217. package/src/components/index.ts +0 -1
  218. package/src/hooks/index.ts +1 -0
  219. package/src/hooks/useActiveSpace.ts +20 -0
  220. package/src/hooks/useInputSurfaceLookup.tsx +2 -2
  221. package/src/hooks/usePath.ts +9 -6
  222. package/src/index.ts +3 -2
  223. package/src/translations.ts +1 -2
  224. package/src/types/collection.ts +6 -4
  225. package/src/types/index.ts +0 -1
  226. package/src/types/types.ts +119 -112
  227. package/src/util.tsx +36 -73
  228. package/dist/lib/browser/app-graph-builder-ZWNOWRAX.mjs +0 -369
  229. package/dist/lib/browser/app-graph-builder-ZWNOWRAX.mjs.map +0 -7
  230. package/dist/lib/browser/app-graph-serializer-UUJH7JRN.mjs.map +0 -7
  231. package/dist/lib/browser/chunk-4226DMDP.mjs +0 -1937
  232. package/dist/lib/browser/chunk-4226DMDP.mjs.map +0 -7
  233. package/dist/lib/browser/chunk-DIJ7LMCS.mjs.map +0 -7
  234. package/dist/lib/browser/chunk-JS6ZV4GV.mjs.map +0 -7
  235. package/dist/lib/browser/chunk-O7WGQVLQ.mjs +0 -306
  236. package/dist/lib/browser/chunk-O7WGQVLQ.mjs.map +0 -7
  237. package/dist/lib/browser/identity-created-NRVE4XLL.mjs.map +0 -7
  238. package/dist/lib/browser/intent-resolver-NP55M7C7.mjs.map +0 -7
  239. package/dist/lib/browser/react-surface-2DW2UDRX.mjs.map +0 -7
  240. package/dist/lib/browser/schema-FHTA26SW.mjs +0 -24
  241. package/dist/lib/browser/schema-FHTA26SW.mjs.map +0 -7
  242. package/dist/lib/browser/schema-tools-YAXPRIXP.mjs.map +0 -7
  243. package/dist/lib/browser/spaces-ready-ERNSICUW.mjs.map +0 -7
  244. package/dist/lib/browser/state-CYV6QCTN.mjs.map +0 -7
  245. package/dist/lib/node/app-graph-builder-LLIV422L.cjs +0 -371
  246. package/dist/lib/node/app-graph-builder-LLIV422L.cjs.map +0 -7
  247. package/dist/lib/node/app-graph-serializer-M6Z2OPA4.cjs.map +0 -7
  248. package/dist/lib/node/chunk-EQ5BPSQ7.cjs +0 -334
  249. package/dist/lib/node/chunk-EQ5BPSQ7.cjs.map +0 -7
  250. package/dist/lib/node/chunk-UOCR4G2D.cjs.map +0 -7
  251. package/dist/lib/node/chunk-XADZLQAJ.cjs.map +0 -7
  252. package/dist/lib/node/chunk-ZMQO74LX.cjs +0 -1932
  253. package/dist/lib/node/chunk-ZMQO74LX.cjs.map +0 -7
  254. package/dist/lib/node/identity-created-YDTRMOMX.cjs.map +0 -7
  255. package/dist/lib/node/intent-resolver-3J52ARFL.cjs.map +0 -7
  256. package/dist/lib/node/react-surface-IWSTOZ2E.cjs.map +0 -7
  257. package/dist/lib/node/schema-PPJ5BZ3A.cjs.map +0 -7
  258. package/dist/lib/node/schema-tools-BLIMOZYY.cjs.map +0 -7
  259. package/dist/lib/node/spaces-ready-6EBR4SM4.cjs.map +0 -7
  260. package/dist/lib/node/state-JLN7TGRR.cjs.map +0 -7
  261. package/dist/lib/node-esm/app-graph-builder-HSGLCS76.mjs +0 -370
  262. package/dist/lib/node-esm/app-graph-builder-HSGLCS76.mjs.map +0 -7
  263. package/dist/lib/node-esm/app-graph-serializer-J3B4WSXU.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-ABTVMAG5.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-FJPCLEKN.mjs +0 -307
  266. package/dist/lib/node-esm/chunk-FJPCLEKN.mjs.map +0 -7
  267. package/dist/lib/node-esm/chunk-OLISVDCF.mjs.map +0 -7
  268. package/dist/lib/node-esm/chunk-PQI4D4SH.mjs +0 -1938
  269. package/dist/lib/node-esm/chunk-PQI4D4SH.mjs.map +0 -7
  270. package/dist/lib/node-esm/identity-created-EC6SVYB5.mjs.map +0 -7
  271. package/dist/lib/node-esm/intent-resolver-MXQIFIRC.mjs.map +0 -7
  272. package/dist/lib/node-esm/react-surface-JCHDAPGM.mjs.map +0 -7
  273. package/dist/lib/node-esm/schema-OUZKVYM5.mjs +0 -25
  274. package/dist/lib/node-esm/schema-OUZKVYM5.mjs.map +0 -7
  275. package/dist/lib/node-esm/schema-tools-IU7EX5A5.mjs.map +0 -7
  276. package/dist/lib/node-esm/spaces-ready-5PXESKHX.mjs.map +0 -7
  277. package/dist/lib/node-esm/state-YZPY5T5A.mjs.map +0 -7
  278. package/dist/types/src/capabilities/schema.d.ts +0 -4
  279. package/dist/types/src/capabilities/schema.d.ts.map +0 -1
  280. package/dist/types/src/components/PopoverAddSpace.d.ts +0 -4
  281. package/dist/types/src/components/PopoverAddSpace.d.ts.map +0 -1
  282. package/dist/types/src/types/thread.d.ts +0 -352
  283. package/dist/types/src/types/thread.d.ts.map +0 -1
  284. package/src/capabilities/schema.ts +0 -27
  285. package/src/components/PopoverAddSpace.tsx +0 -52
  286. package/src/types/thread.ts +0 -24
  287. /package/dist/lib/{node-esm/react-root-ZBCJCEFS.mjs.map → browser/react-root-PVKJE4EZ.mjs.map} +0 -0
  288. /package/dist/lib/browser/{settings-MVT32NP6.mjs.map → settings-2IN2WLUK.mjs.map} +0 -0
  289. /package/dist/lib/node/{settings-JLV7YT6Q.cjs.map → settings-FOH7EB5C.cjs.map} +0 -0
  290. /package/dist/lib/node-esm/{settings-AILIMHTE.mjs.map → settings-Q4XDFSYD.mjs.map} +0 -0
@@ -1,1937 +0,0 @@
1
- import {
2
- SpaceCapabilities
3
- } from "./chunk-KVRYWFZU.mjs";
4
- import {
5
- COMPOSER_SPACE_LOCK,
6
- getSpaceDisplayName
7
- } from "./chunk-JS6ZV4GV.mjs";
8
- import {
9
- CollectionType,
10
- SpaceAction,
11
- SpaceForm
12
- } from "./chunk-O7WGQVLQ.mjs";
13
- import {
14
- SPACE_PLUGIN,
15
- meta
16
- } from "./chunk-PTKYMZWO.mjs";
17
-
18
- // packages/plugins/plugin-space/src/components/AwaitingObject.tsx
19
- import { CheckCircle, CircleDashed, CircleNotch } from "@phosphor-icons/react";
20
- import React, { useCallback, useEffect, useState } from "react";
21
- import { createIntent, LayoutAction, useIntentDispatcher, useLayout } from "@dxos/app-framework";
22
- import { useClient } from "@dxos/react-client";
23
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
24
- import { Button, Toast, useTranslation } from "@dxos/react-ui";
25
- import { getSize, mx } from "@dxos/react-ui-theme";
26
- var WAIT_FOR_OBJECT_TIMEOUT = 18e4;
27
- var TOAST_TIMEOUT = 24e4;
28
- var AwaitingObject = ({ id }) => {
29
- const [open, setOpen] = useState(true);
30
- const [waiting, setWaiting] = useState(true);
31
- const [found, setFound] = useState(false);
32
- const { t } = useTranslation(SPACE_PLUGIN);
33
- const { dispatchPromise: dispatch } = useIntentDispatcher();
34
- const layout = useLayout();
35
- const client = useClient();
36
- const objects = useQuery(client.spaces, Filter.all());
37
- useEffect(() => {
38
- if (!id) {
39
- return;
40
- }
41
- const timeout = setTimeout(() => {
42
- setWaiting(false);
43
- }, WAIT_FOR_OBJECT_TIMEOUT);
44
- () => clearTimeout(timeout);
45
- }, [
46
- id
47
- ]);
48
- useEffect(() => {
49
- if (objects.findIndex((object) => fullyQualifiedId(object) === id) > -1) {
50
- setFound(true);
51
- if (layout.active.includes(id)) {
52
- setOpen(false);
53
- }
54
- }
55
- }, [
56
- id,
57
- objects,
58
- layout
59
- ]);
60
- const handleClose = useCallback(async () => dispatch(createIntent(SpaceAction.WaitForObject, {
61
- id: void 0
62
- })), [
63
- dispatch
64
- ]);
65
- const handleNavigate = useCallback(() => {
66
- void dispatch(createIntent(LayoutAction.Open, {
67
- part: "main",
68
- subject: [
69
- id
70
- ]
71
- }));
72
- void handleClose();
73
- }, [
74
- id,
75
- handleClose,
76
- dispatch
77
- ]);
78
- return /* @__PURE__ */ React.createElement(Toast.Root, {
79
- open,
80
- duration: TOAST_TIMEOUT,
81
- onOpenChange: setOpen
82
- }, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
83
- classNames: "flex items-center gap-2"
84
- }, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CheckCircle, {
85
- className: getSize(5)
86
- }), /* @__PURE__ */ React.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleNotch, {
87
- className: mx(getSize(5), "animate-spin")
88
- }), /* @__PURE__ */ React.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleDashed, {
89
- className: getSize(5)
90
- }), /* @__PURE__ */ React.createElement("span", null, t("object not found label")))), /* @__PURE__ */ React.createElement(Toast.Description, null, t(found ? "found object description" : waiting ? "waiting for object description" : "object not found description"))), /* @__PURE__ */ React.createElement(Toast.Actions, null, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toast.Action, {
91
- altText: t("go to object alt"),
92
- asChild: true
93
- }, /* @__PURE__ */ React.createElement(Button, {
94
- variant: "primary",
95
- onClick: handleNavigate
96
- }, t("go to object label"))), /* @__PURE__ */ React.createElement(Toast.Close, {
97
- asChild: true
98
- }, /* @__PURE__ */ React.createElement(Button, {
99
- onClick: handleClose
100
- }, t("close label", {
101
- ns: "appkit"
102
- })))) : /* @__PURE__ */ React.createElement(Toast.Close, {
103
- asChild: true
104
- }, /* @__PURE__ */ React.createElement(Button, {
105
- onClick: handleClose
106
- }, t(waiting ? "close label" : "confirm label", {
107
- ns: "appkit"
108
- })))));
109
- };
110
-
111
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
112
- import { pipe } from "effect";
113
- import React4, { useCallback as useCallback4, useRef } from "react";
114
- import { Capabilities, chain, createIntent as createIntent2, LayoutAction as LayoutAction2, useCapabilities, useIntentDispatcher as useIntentDispatcher2, usePluginManager as usePluginManager2 } from "@dxos/app-framework";
115
- import { invariant as invariant2 } from "@dxos/invariant";
116
- import { useClient as useClient2 } from "@dxos/react-client";
117
- import { getSpace, isLiveObject, isSpace, useSpaces } from "@dxos/react-client/echo";
118
- import { Button as Button2, Dialog, Icon as Icon2, useTranslation as useTranslation3 } from "@dxos/react-ui";
119
-
120
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
121
- import React3, { useCallback as useCallback3, useState as useState3 } from "react";
122
- import { getTypeAnnotation } from "@dxos/echo-schema";
123
- import { invariant } from "@dxos/invariant";
124
- import { Icon, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
125
- import { Form } from "@dxos/react-ui-form";
126
- import { SearchList } from "@dxos/react-ui-searchlist";
127
- import { mx as mx2 } from "@dxos/react-ui-theme";
128
- import { isNonNullable } from "@dxos/util";
129
-
130
- // packages/plugins/plugin-space/src/hooks/useInputSurfaceLookup.tsx
131
- import React2, { useCallback as useCallback2 } from "react";
132
- import { usePluginManager, isSurfaceAvailable, Surface } from "@dxos/app-framework";
133
- var useInputSurfaceLookup = (baseData) => {
134
- const pluginManager = usePluginManager();
135
- return useCallback2(({ prop, schema, inputProps }) => {
136
- const composedData = {
137
- prop,
138
- schema,
139
- ...baseData
140
- };
141
- if (!isSurfaceAvailable(pluginManager.context, {
142
- role: "form-input",
143
- data: composedData
144
- })) {
145
- return void 0;
146
- }
147
- return /* @__PURE__ */ React2.createElement(Surface, {
148
- role: "form-input",
149
- data: composedData,
150
- ...inputProps
151
- });
152
- }, [
153
- pluginManager,
154
- baseData
155
- ]);
156
- };
157
-
158
- // packages/plugins/plugin-space/src/hooks/usePath.ts
159
- import { useEffect as useEffect2, useState as useState2 } from "react";
160
- var usePath = (graph, id, timeout) => {
161
- const [pathState, setPathState] = useState2(id ? graph.getPath({
162
- target: id
163
- }) : void 0);
164
- useEffect2(() => {
165
- if (!id && pathState) {
166
- setPathState(void 0);
167
- }
168
- if (pathState?.at(-1) === id || !id) {
169
- return;
170
- }
171
- const frame = requestAnimationFrame(async () => {
172
- try {
173
- const path = await graph.waitForPath({
174
- target: id
175
- }, {
176
- timeout
177
- });
178
- if (path) {
179
- setPathState(path);
180
- }
181
- } catch {
182
- }
183
- });
184
- return () => cancelAnimationFrame(frame);
185
- }, [
186
- graph,
187
- id,
188
- timeout,
189
- pathState
190
- ]);
191
- return pathState;
192
- };
193
-
194
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
195
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx";
196
- var CreateObjectPanel = ({ classNames, forms, spaces, typename: initialTypename, target: initialTarget, name: initialName, defaultSpaceId, resolve, onCreateObject }) => {
197
- const { t } = useTranslation2(SPACE_PLUGIN);
198
- const [typename, setTypename] = useState3(initialTypename);
199
- const [target, setTarget] = useState3(initialTarget);
200
- const form = forms.find((form2) => getTypeAnnotation(form2.objectSchema)?.typename === typename);
201
- const options = forms.map((form2) => getTypeAnnotation(form2.objectSchema)).filter(isNonNullable).sort((a, b) => {
202
- const nameA = t("typename label", {
203
- ns: a.typename,
204
- defaultValue: a.typename
205
- });
206
- const nameB = t("typename label", {
207
- ns: b.typename,
208
- defaultValue: b.typename
209
- });
210
- return nameA.localeCompare(nameB);
211
- });
212
- const handleCreateObject = useCallback3(async (props) => {
213
- if (!form || !target) {
214
- return;
215
- }
216
- await onCreateObject?.({
217
- form,
218
- target,
219
- data: props
220
- });
221
- }, [
222
- onCreateObject,
223
- form,
224
- target
225
- ]);
226
- const handleSetTypename = useCallback3(async (typename2) => {
227
- invariant(target, "target is required", {
228
- F: __dxlog_file,
229
- L: 72,
230
- S: void 0,
231
- A: [
232
- "target",
233
- "'target is required'"
234
- ]
235
- });
236
- const form2 = forms.find((form3) => getTypeAnnotation(form3.objectSchema)?.typename === typename2);
237
- if (form2 && !form2.formSchema) {
238
- await onCreateObject?.({
239
- form: form2,
240
- target
241
- });
242
- } else {
243
- setTypename(typename2);
244
- }
245
- }, [
246
- forms,
247
- onCreateObject,
248
- target
249
- ]);
250
- const inputSurfaceLookup = useInputSurfaceLookup({
251
- target
252
- });
253
- return /* @__PURE__ */ React3.createElement("div", {
254
- role: "form",
255
- className: mx2("flex flex-col gap-2", classNames)
256
- }, !form ? /* @__PURE__ */ React3.createElement(SelectSchema, {
257
- options,
258
- resolve,
259
- onChange: handleSetTypename
260
- }) : !target ? /* @__PURE__ */ React3.createElement(SelectSpace, {
261
- spaces,
262
- defaultSpaceId,
263
- onChange: setTarget
264
- }) : form.formSchema ? /* @__PURE__ */ React3.createElement(Form, {
265
- classNames: "!p-0",
266
- autoFocus: true,
267
- values: {
268
- name: initialName
269
- },
270
- schema: form.formSchema,
271
- testId: "create-object-form",
272
- onSave: handleCreateObject,
273
- lookupComponent: inputSurfaceLookup
274
- }) : void 0);
275
- };
276
- var SelectSpace = ({ spaces, defaultSpaceId, onChange }) => {
277
- const { t } = useTranslation2(SPACE_PLUGIN);
278
- return /* @__PURE__ */ React3.createElement(SearchList.Root, {
279
- label: t("space input label"),
280
- classNames: "flex flex-col grow overflow-hidden"
281
- }, /* @__PURE__ */ React3.createElement(SearchList.Input, {
282
- autoFocus: true,
283
- "data-testid": "create-object-form.space-input",
284
- placeholder: t("space input placeholder"),
285
- classNames: "px-1 my-2"
286
- }), /* @__PURE__ */ React3.createElement(SearchList.Content, {
287
- classNames: "max-bs-[24rem] overflow-auto"
288
- }, spaces.sort((a, b) => {
289
- const aName = toLocalizedString(getSpaceDisplayName(a, {
290
- personal: a.id === defaultSpaceId
291
- }), t);
292
- const bName = toLocalizedString(getSpaceDisplayName(b, {
293
- personal: b.id === defaultSpaceId
294
- }), t);
295
- return aName.localeCompare(bName);
296
- }).map((space) => /* @__PURE__ */ React3.createElement(SearchList.Item, {
297
- key: space.id,
298
- value: toLocalizedString(getSpaceDisplayName(space, {
299
- personal: space.id === defaultSpaceId
300
- }), t),
301
- onSelect: () => onChange(space),
302
- classNames: "flex items-center gap-2"
303
- }, /* @__PURE__ */ React3.createElement("span", {
304
- className: "grow truncate"
305
- }, toLocalizedString(getSpaceDisplayName(space, {
306
- personal: space.id === defaultSpaceId
307
- }), t))))));
308
- };
309
- var SelectSchema = ({ options, resolve, onChange }) => {
310
- const { t } = useTranslation2(SPACE_PLUGIN);
311
- return /* @__PURE__ */ React3.createElement(SearchList.Root, {
312
- label: t("schema input label"),
313
- classNames: "flex flex-col grow overflow-hidden"
314
- }, /* @__PURE__ */ React3.createElement(SearchList.Input, {
315
- autoFocus: true,
316
- "data-testid": "create-object-form.schema-input",
317
- placeholder: t("schema input placeholder"),
318
- classNames: "px-1 my-2"
319
- }), /* @__PURE__ */ React3.createElement(SearchList.Content, {
320
- classNames: "max-bs-[24rem] overflow-auto"
321
- }, options.map((option) => /* @__PURE__ */ React3.createElement(SearchList.Item, {
322
- key: option.typename,
323
- value: t("typename label", {
324
- ns: option.typename,
325
- defaultValue: option.typename
326
- }),
327
- onSelect: () => onChange(option.typename),
328
- classNames: "flex items-center gap-2"
329
- }, /* @__PURE__ */ React3.createElement("span", {
330
- className: "flex gap-2 items-center grow truncate"
331
- }, /* @__PURE__ */ React3.createElement(Icon, {
332
- icon: resolve?.(option.typename).icon ?? "ph--placeholder--regular",
333
- size: 5
334
- }), t("typename label", {
335
- ns: option.typename,
336
- defaultValue: option.typename
337
- }))))));
338
- };
339
-
340
- // packages/plugins/plugin-space/src/capabilities/index.ts
341
- import { lazy } from "@dxos/app-framework";
342
- var AppGraphBuilder = lazy(() => import("./app-graph-builder-ZWNOWRAX.mjs"));
343
- var AppGraphSerializer = lazy(() => import("./app-graph-serializer-UUJH7JRN.mjs"));
344
- var IdentityCreated = lazy(() => import("./identity-created-NRVE4XLL.mjs"));
345
- var IntentResolver = lazy(() => import("./intent-resolver-NP55M7C7.mjs"));
346
- var ReactRoot = lazy(() => import("./react-root-XKAUZ3X2.mjs"));
347
- var ReactSurface = lazy(() => import("./react-surface-2DW2UDRX.mjs"));
348
- var Schema = lazy(() => import("./schema-FHTA26SW.mjs"));
349
- var Tools = lazy(() => import("./schema-tools-YAXPRIXP.mjs"));
350
- var SpaceSettings = lazy(() => import("./settings-MVT32NP6.mjs"));
351
- var SpaceState = lazy(() => import("./state-CYV6QCTN.mjs"));
352
- var SpacesReady = lazy(() => import("./spaces-ready-ERNSICUW.mjs"));
353
-
354
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
355
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx";
356
- var CREATE_OBJECT_DIALOG = `${SPACE_PLUGIN}/CreateObjectDialog`;
357
- var CreateObjectDialog = ({ target, typename, name, shouldNavigate: _shouldNavigate }) => {
358
- const closeRef = useRef(null);
359
- const manager = usePluginManager2();
360
- const { t } = useTranslation3(SPACE_PLUGIN);
361
- const client = useClient2();
362
- const spaces = useSpaces();
363
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
364
- const forms = useCapabilities(SpaceCapabilities.ObjectForm);
365
- const resolve = useCallback4((typename2) => manager.context.requestCapabilities(Capabilities.Metadata).find(({ id }) => id === typename2)?.metadata ?? {}, [
366
- manager
367
- ]);
368
- const handleCreateObject = useCallback4(async ({ form, target: target2, data = {} }) => {
369
- if (!target2) {
370
- return;
371
- }
372
- closeRef.current?.click();
373
- const space = isSpace(target2) ? target2 : getSpace(target2);
374
- invariant2(space, "Missing space", {
375
- F: __dxlog_file2,
376
- L: 72,
377
- S: void 0,
378
- A: [
379
- "space",
380
- "'Missing space'"
381
- ]
382
- });
383
- const result = await dispatch(form.getIntent(data, {
384
- space
385
- }));
386
- const object = result.data?.object;
387
- if (isLiveObject(object)) {
388
- const addObjectIntent = createIntent2(SpaceAction.AddObject, {
389
- target: target2,
390
- object,
391
- hidden: form.hidden
392
- });
393
- const shouldNavigate = _shouldNavigate ?? (() => true);
394
- if (shouldNavigate(object)) {
395
- await dispatch(pipe(addObjectIntent, chain(LayoutAction2.Open, {
396
- part: "main"
397
- })));
398
- } else {
399
- await dispatch(addObjectIntent);
400
- }
401
- }
402
- }, [
403
- dispatch,
404
- resolve
405
- ]);
406
- return (
407
- // TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
408
- // Consider factoring it out to the tabs package.
409
- /* @__PURE__ */ React4.createElement(Dialog.Content, {
410
- classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
411
- }, /* @__PURE__ */ React4.createElement("div", {
412
- role: "none",
413
- className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
414
- }, /* @__PURE__ */ React4.createElement(Dialog.Title, null, t("create object dialog title")), /* @__PURE__ */ React4.createElement(Dialog.Close, {
415
- asChild: true
416
- }, /* @__PURE__ */ React4.createElement(Button2, {
417
- ref: closeRef,
418
- density: "fine",
419
- variant: "ghost",
420
- autoFocus: true
421
- }, /* @__PURE__ */ React4.createElement(Icon2, {
422
- icon: "ph--x--regular",
423
- size: 4
424
- })))), /* @__PURE__ */ React4.createElement(CreateObjectPanel, {
425
- classNames: "p-4",
426
- forms,
427
- spaces,
428
- target,
429
- typename,
430
- name,
431
- defaultSpaceId: client.spaces.default.id,
432
- resolve,
433
- onCreateObject: handleCreateObject
434
- }))
435
- );
436
- };
437
-
438
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateSpaceDialog.tsx
439
- import { Effect } from "effect";
440
- import React5, { useCallback as useCallback5, useRef as useRef2 } from "react";
441
- import { createIntent as createIntent3, LayoutAction as LayoutAction3, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
442
- import { Button as Button3, Dialog as Dialog2, Icon as Icon3, useTranslation as useTranslation4 } from "@dxos/react-ui";
443
- import { Form as Form2 } from "@dxos/react-ui-form";
444
- var CREATE_SPACE_DIALOG = `${SPACE_PLUGIN}/CreateSpaceDialog`;
445
- var initialValues = {
446
- edgeReplication: true
447
- };
448
- var CreateSpaceDialog = () => {
449
- const closeRef = useRef2(null);
450
- const { t } = useTranslation4(SPACE_PLUGIN);
451
- const { dispatch } = useIntentDispatcher3();
452
- const inputSurfaceLookup = useInputSurfaceLookup();
453
- const handleCreateSpace = useCallback5(async (data) => {
454
- const program = Effect.gen(function* () {
455
- const { space } = yield* dispatch(createIntent3(SpaceAction.Create, data));
456
- yield* dispatch(createIntent3(LayoutAction3.SwitchWorkspace, {
457
- part: "workspace",
458
- subject: space.id
459
- }));
460
- yield* dispatch(createIntent3(SpaceAction.OpenCreateObject, {
461
- target: space
462
- }));
463
- });
464
- await Effect.runPromise(program);
465
- }, [
466
- dispatch
467
- ]);
468
- return (
469
- // TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
470
- // Consider factoring it out to the tabs package.
471
- /* @__PURE__ */ React5.createElement(Dialog2.Content, {
472
- classNames: "p-0 bs-content min-bs-[16rem] max-bs-full md:max-is-[32rem] overflow-hidden"
473
- }, /* @__PURE__ */ React5.createElement("div", {
474
- role: "none",
475
- className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
476
- }, /* @__PURE__ */ React5.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React5.createElement(Dialog2.Close, {
477
- asChild: true
478
- }, /* @__PURE__ */ React5.createElement(Button3, {
479
- ref: closeRef,
480
- density: "fine",
481
- variant: "ghost",
482
- autoFocus: true
483
- }, /* @__PURE__ */ React5.createElement(Icon3, {
484
- icon: "ph--x--regular",
485
- size: 4
486
- })))), /* @__PURE__ */ React5.createElement("div", {
487
- className: "p-4"
488
- }, /* @__PURE__ */ React5.createElement(Form2, {
489
- testId: "create-space-form",
490
- classNames: "!p-0",
491
- autoFocus: true,
492
- values: initialValues,
493
- schema: SpaceForm,
494
- lookupComponent: inputSurfaceLookup,
495
- onSave: handleCreateSpace
496
- })))
497
- );
498
- };
499
-
500
- // packages/plugins/plugin-space/src/components/CollectionMain.tsx
501
- import React6 from "react";
502
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
503
- import { baseSurface, descriptionMessage, mx as mx3 } from "@dxos/react-ui-theme";
504
- var CollectionMain = ({ collection }) => {
505
- const { t } = useTranslation5(SPACE_PLUGIN);
506
- return /* @__PURE__ */ React6.createElement("div", {
507
- role: "none",
508
- className: mx3(baseSurface, "min-bs-screen is-full flex items-center justify-center p-8"),
509
- "data-testid": "composer.firstRunMessage"
510
- }, /* @__PURE__ */ React6.createElement("p", {
511
- role: "alert",
512
- className: mx3(descriptionMessage, "rounded-lg p-8 font-normal text-lg max-is-[24rem] break-words")
513
- }, collection.name ?? t("unnamed collection label")));
514
- };
515
-
516
- // packages/plugins/plugin-space/src/components/CollectionSection.tsx
517
- import React7 from "react";
518
- import { useTranslation as useTranslation6 } from "@dxos/react-ui";
519
- var CollectionSection = ({ collection }) => {
520
- const { t } = useTranslation6(SPACE_PLUGIN);
521
- return /* @__PURE__ */ React7.createElement("div", {
522
- className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
523
- }, /* @__PURE__ */ React7.createElement("span", {
524
- className: "truncate"
525
- }, collection.name ?? t("unnamed collection label")));
526
- };
527
-
528
- // packages/plugins/plugin-space/src/components/JoinDialog.tsx
529
- import React8, { useCallback as useCallback6 } from "react";
530
- import { createIntent as createIntent4, LayoutAction as LayoutAction4, useAppGraph, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
531
- import { Trigger } from "@dxos/async";
532
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
533
- import { useClient as useClient3 } from "@dxos/react-client";
534
- import { Dialog as Dialog3, useTranslation as useTranslation7 } from "@dxos/react-ui";
535
- import { JoinPanel } from "@dxos/shell/react";
536
- var JOIN_DIALOG = `${SPACE_PLUGIN}/JoinDialog`;
537
- var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
538
- const { dispatchPromise: dispatch } = useIntentDispatcher4();
539
- const client = useClient3();
540
- const { graph } = useAppGraph();
541
- const { t } = useTranslation7(SPACE_PLUGIN);
542
- const handleDone = useCallback6(async (result) => {
543
- const spaceKey = result?.spaceKey;
544
- if (!spaceKey) {
545
- return;
546
- }
547
- await Promise.all([
548
- dispatch(createIntent4(LayoutAction4.AddToast, {
549
- part: "toast",
550
- subject: {
551
- id: `${SPACE_PLUGIN}/join-success`,
552
- duration: 5e3,
553
- title: [
554
- "join success label",
555
- {
556
- ns: SPACE_PLUGIN
557
- }
558
- ],
559
- closeLabel: [
560
- "dismiss label",
561
- {
562
- ns: SPACE_PLUGIN
563
- }
564
- ]
565
- }
566
- })),
567
- dispatch(createIntent4(LayoutAction4.UpdateDialog, {
568
- part: "dialog",
569
- options: {
570
- state: false
571
- }
572
- }))
573
- ]);
574
- let space = client.spaces.get(spaceKey);
575
- if (!space) {
576
- const trigger = new Trigger();
577
- client.spaces.subscribe(() => {
578
- const space2 = client.spaces.get(spaceKey);
579
- if (space2) {
580
- trigger.wake(space2);
581
- }
582
- });
583
- space = await trigger.wait();
584
- }
585
- await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
586
- part: "workspace",
587
- subject: space.id
588
- }));
589
- const target = result?.target || (navigableCollections ? space?.id : void 0);
590
- if (target) {
591
- await graph.waitForPath({
592
- target
593
- }).catch(() => {
594
- });
595
- await Promise.all([
596
- dispatch(createIntent4(LayoutAction4.Open, {
597
- part: "main",
598
- subject: [
599
- target
600
- ]
601
- })),
602
- dispatch(createIntent4(LayoutAction4.Expose, {
603
- part: "navigation",
604
- subject: target
605
- }))
606
- ]);
607
- }
608
- await onDone?.(result);
609
- if (space) {
610
- await dispatch(createIntent4(ObservabilityAction.SendEvent, {
611
- name: "space.join",
612
- properties: {
613
- spaceId: space.id
614
- }
615
- }));
616
- }
617
- }, [
618
- dispatch,
619
- client,
620
- graph
621
- ]);
622
- return /* @__PURE__ */ React8.createElement(Dialog3.Content, null, /* @__PURE__ */ React8.createElement(Dialog3.Title, {
623
- classNames: "sr-only"
624
- }, t("join space label", {
625
- ns: "os"
626
- })), /* @__PURE__ */ React8.createElement(JoinPanel, {
627
- ...props,
628
- exitActionParent: /* @__PURE__ */ React8.createElement(Dialog3.Close, {
629
- asChild: true
630
- }),
631
- doneActionParent: /* @__PURE__ */ React8.createElement(Dialog3.Close, {
632
- asChild: true
633
- }),
634
- onDone: handleDone
635
- }));
636
- };
637
-
638
- // packages/plugins/plugin-space/src/components/MembersContainer.tsx
639
- import { Check, X } from "@phosphor-icons/react";
640
- import React9, { useCallback as useCallback7, useMemo, useState as useState4 } from "react";
641
- import { QR } from "react-qr-rounded";
642
- import { createIntent as createIntent5, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
643
- import { log } from "@dxos/log";
644
- import { useConfig } from "@dxos/react-client";
645
- import { fullyQualifiedId as fullyQualifiedId2, useSpaceInvitations } from "@dxos/react-client/echo";
646
- import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
647
- import { Button as Button4, Clipboard, Icon as Icon4, Input, useId, useTranslation as useTranslation8 } from "@dxos/react-ui";
648
- import { ControlPage, ControlSection, ControlFrame, ControlFrameItem, ControlItemInput } from "@dxos/react-ui-form";
649
- import { StackItem } from "@dxos/react-ui-stack";
650
- import { getSize as getSize2, mx as mx4 } from "@dxos/react-ui-theme";
651
- import { AuthCode, BifurcatedAction, Centered, Emoji, InvitationList, SpaceMemberList, Viewport } from "@dxos/shell/react";
652
- import { hexToEmoji } from "@dxos/util";
653
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/MembersContainer.tsx";
654
- var activeActionKey = "dxos:react-shell/space-manager/active-action";
655
- var handleInvitationEvent = (invitation, subscription) => {
656
- const invitationCode = InvitationEncoder.encode(invitation);
657
- if (invitation.state === Invitation.State.CONNECTING) {
658
- log.info(JSON.stringify({
659
- invitationCode,
660
- authCode: invitation.authCode
661
- }), void 0, {
662
- F: __dxlog_file3,
663
- L: 40,
664
- S: void 0,
665
- C: (f, a) => f(...a)
666
- });
667
- subscription.unsubscribe();
668
- }
669
- };
670
- var MembersContainer = ({ space, createInvitationUrl }) => {
671
- const { t } = useTranslation8(SPACE_PLUGIN);
672
- const config = useConfig();
673
- const { dispatchPromise: dispatch } = useIntentDispatcher5();
674
- const invitations = useSpaceInvitations(space.key);
675
- const visibleInvitations = invitations?.filter((invitation) => ![
676
- Invitation.State.CANCELLED
677
- ].includes(invitation.get().state));
678
- const [activeAction, setInternalActiveAction] = useState4(localStorage.getItem(activeActionKey) ?? "inviteMany");
679
- const setActiveAction = (nextAction) => {
680
- setInternalActiveAction(nextAction);
681
- localStorage.setItem(activeActionKey, nextAction);
682
- };
683
- const target = space.properties[CollectionType.typename]?.target?.objects[0]?.target;
684
- const locked = space.properties[COMPOSER_SPACE_LOCK];
685
- const handleChangeLocked = useCallback7(() => {
686
- space.properties[COMPOSER_SPACE_LOCK] = !locked;
687
- }, [
688
- locked,
689
- space
690
- ]);
691
- const inviteActions = useMemo(() => ({
692
- inviteOne: {
693
- label: t("invite one label", {
694
- ns: "os"
695
- }),
696
- description: t("invite one description", {
697
- ns: "os"
698
- }),
699
- icon: () => /* @__PURE__ */ React9.createElement(Icon4, {
700
- icon: "ph--user-plus--regular",
701
- size: 5
702
- }),
703
- testId: "membersContainer.inviteOne",
704
- onClick: async () => {
705
- const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
706
- space,
707
- type: Invitation.Type.INTERACTIVE,
708
- authMethod: Invitation.AuthMethod.SHARED_SECRET,
709
- multiUse: false,
710
- target: target && fullyQualifiedId2(target)
711
- }));
712
- if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
713
- const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
714
- }
715
- }
716
- },
717
- inviteMany: {
718
- label: t("invite many label", {
719
- ns: "os"
720
- }),
721
- description: t("invite many description", {
722
- ns: "os"
723
- }),
724
- icon: () => /* @__PURE__ */ React9.createElement(Icon4, {
725
- icon: "ph--users-three--regular",
726
- size: 5
727
- }),
728
- testId: "membersContainer.inviteMany",
729
- onClick: async () => {
730
- const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
731
- space,
732
- type: Invitation.Type.DELEGATED,
733
- authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
734
- multiUse: true,
735
- target: target && fullyQualifiedId2(target)
736
- }));
737
- if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
738
- const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
739
- }
740
- }
741
- }
742
- }), [
743
- t,
744
- space,
745
- target
746
- ]);
747
- const [selectedInvitation, setSelectedInvitation] = useState4(null);
748
- const handleSend = (event) => {
749
- setSelectedInvitation(event.invitation);
750
- };
751
- const handleBack = () => {
752
- setSelectedInvitation(null);
753
- };
754
- return /* @__PURE__ */ React9.createElement(Clipboard.Provider, null, /* @__PURE__ */ React9.createElement(StackItem.Content, {
755
- classNames: "block overflow-y-auto"
756
- }, /* @__PURE__ */ React9.createElement(ControlPage, null, /* @__PURE__ */ React9.createElement(ControlSection, {
757
- title: t("members verbose label"),
758
- description: t("members description")
759
- }, /* @__PURE__ */ React9.createElement(ControlFrame, null, /* @__PURE__ */ React9.createElement(ControlFrameItem, {
760
- title: t("members label")
761
- }, /* @__PURE__ */ React9.createElement(SpaceMemberList, {
762
- spaceKey: space.key,
763
- includeSelf: true
764
- })), locked && /* @__PURE__ */ React9.createElement(ControlFrameItem, {
765
- title: t("invitations label")
766
- }, /* @__PURE__ */ React9.createElement("p", {
767
- className: "text-description mbe-2"
768
- }, t("locked space description"))), !locked && /* @__PURE__ */ React9.createElement(ControlFrameItem, {
769
- title: t("invitations label")
770
- }, selectedInvitation && /* @__PURE__ */ React9.createElement(InvitationSection, {
771
- ...selectedInvitation,
772
- onBack: handleBack
773
- }), !selectedInvitation && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("p", {
774
- className: "text-description mbe-2"
775
- }, t("space invitation description")), /* @__PURE__ */ React9.createElement(InvitationList, {
776
- className: "mb-2",
777
- send: handleSend,
778
- invitations: visibleInvitations ?? [],
779
- onClickRemove: (invitation) => invitation.cancel(),
780
- createInvitationUrl
781
- }), /* @__PURE__ */ React9.createElement(BifurcatedAction, {
782
- actions: inviteActions,
783
- activeAction,
784
- onChangeActiveAction: setActiveAction,
785
- "data-testid": "membersContainer.createInvitation"
786
- })))), /* @__PURE__ */ React9.createElement("div", {
787
- className: "justify-center gap-4 p-0 mbs-4 container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
788
- }, /* @__PURE__ */ React9.createElement(ControlItemInput, {
789
- title: t("space locked label"),
790
- description: t("space locked description")
791
- }, /* @__PURE__ */ React9.createElement(Input.Switch, {
792
- checked: locked,
793
- onCheckedChange: handleChangeLocked,
794
- classNames: "justify-self-end"
795
- })))))));
796
- };
797
- var InvitationSection = ({ state = Invitation.State.INIT, authCode, invitationId = "never", url = "never", onBack }) => {
798
- const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
799
- return /* @__PURE__ */ React9.createElement(Viewport.Root, {
800
- activeView
801
- }, /* @__PURE__ */ React9.createElement(Viewport.Views, null, /* @__PURE__ */ React9.createElement(Viewport.View, {
802
- id: "init"
803
- }), /* @__PURE__ */ React9.createElement(Viewport.View, {
804
- id: "complete"
805
- }, /* @__PURE__ */ React9.createElement(InvitationComplete, {
806
- statusValue: state
807
- })), /* @__PURE__ */ React9.createElement(Viewport.View, {
808
- id: "auth-code"
809
- }, /* @__PURE__ */ React9.createElement(InvitationAuthCode, {
810
- id: invitationId,
811
- code: authCode ?? "never",
812
- onCancel: onBack
813
- })), /* @__PURE__ */ React9.createElement(Viewport.View, {
814
- id: "qr-code"
815
- }, /* @__PURE__ */ React9.createElement(InvitationQR, {
816
- id: invitationId,
817
- url,
818
- onCancel: onBack
819
- }))));
820
- };
821
- var InvitationQR = ({ id, url, onCancel }) => {
822
- const { t } = useTranslation8("os");
823
- const qrLabel = useId("members-container__qr-code");
824
- const emoji = hexToEmoji(id);
825
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("p", {
826
- className: "text-description"
827
- }, t("qr code description", {
828
- ns: SPACE_PLUGIN
829
- })), /* @__PURE__ */ React9.createElement("div", {
830
- role: "group",
831
- className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
832
- }, /* @__PURE__ */ React9.createElement("div", {
833
- role: "none",
834
- className: "is-full aspect-square relative text-description"
835
- }, /* @__PURE__ */ React9.createElement(QR, {
836
- rounding: 100,
837
- backgroundColor: "transparent",
838
- color: "currentColor",
839
- "aria-labelledby": qrLabel,
840
- errorCorrectionLevel: "Q",
841
- cutout: true
842
- }, url ?? "never"), /* @__PURE__ */ React9.createElement(Centered, null, /* @__PURE__ */ React9.createElement(Emoji, {
843
- text: emoji
844
- }))), /* @__PURE__ */ React9.createElement("span", {
845
- id: qrLabel,
846
- className: "sr-only"
847
- }, t("qr label")), /* @__PURE__ */ React9.createElement(Clipboard.Button, {
848
- value: url ?? "never"
849
- })), /* @__PURE__ */ React9.createElement(Button4, {
850
- variant: "ghost",
851
- onClick: onCancel
852
- }, t("cancel label")));
853
- };
854
- var InvitationAuthCode = ({ id, code, onCancel }) => {
855
- const { t } = useTranslation8("os");
856
- const emoji = hexToEmoji(id);
857
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("p", {
858
- className: "text-description"
859
- }, t("auth other device emoji message")), emoji && /* @__PURE__ */ React9.createElement(Emoji, {
860
- text: emoji,
861
- className: "mli-auto mlb-2 text-center"
862
- }), /* @__PURE__ */ React9.createElement("p", {
863
- className: "text-description"
864
- }, t("auth code message")), /* @__PURE__ */ React9.createElement(AuthCode, {
865
- code,
866
- large: true,
867
- classNames: "mli-auto mlb-2 text-center grow"
868
- }), /* @__PURE__ */ React9.createElement(Button4, {
869
- variant: "ghost",
870
- onClick: onCancel
871
- }, t("cancel label")));
872
- };
873
- var InvitationComplete = ({ statusValue }) => {
874
- return statusValue > 0 ? /* @__PURE__ */ React9.createElement(Check, {
875
- className: mx4("m-1.5", getSize2(6))
876
- }) : /* @__PURE__ */ React9.createElement(X, {
877
- className: mx4("m-1.5", getSize2(6))
878
- });
879
- };
880
-
881
- // packages/plugins/plugin-space/src/components/MenuFooter.tsx
882
- import { Planet } from "@phosphor-icons/react";
883
- import React10 from "react";
884
- import { getSpace as getSpace2 } from "@dxos/client/echo";
885
- import { useClient as useClient4 } from "@dxos/react-client";
886
- import { DropdownMenu, toLocalizedString as toLocalizedString2, useTranslation as useTranslation9 } from "@dxos/react-ui";
887
- var MenuFooter = ({ object }) => {
888
- const { t } = useTranslation9(SPACE_PLUGIN);
889
- const client = useClient4();
890
- const space = getSpace2(object);
891
- const spaceName = space ? getSpaceDisplayName(space, {
892
- personal: client.spaces.default === space
893
- }) : "";
894
- return space ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React10.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React10.createElement("dl", {
895
- className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
896
- }, /* @__PURE__ */ React10.createElement("dt", {
897
- className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
898
- }, t("location label")), /* @__PURE__ */ React10.createElement("dd", {
899
- className: "line-clamp-3"
900
- }, /* @__PURE__ */ React10.createElement(Planet, {
901
- className: "inline-block mie-1"
902
- }), toLocalizedString2(spaceName, t)))) : null;
903
- };
904
-
905
- // packages/plugins/plugin-space/src/components/ObjectSettings/ObjectSettingsContainer.tsx
906
- import React14, { useMemo as useMemo2 } from "react";
907
- import { Surface as Surface2 } from "@dxos/app-framework";
908
- import { Clipboard as Clipboard2 } from "@dxos/react-ui";
909
- import { StackItem as StackItem2 } from "@dxos/react-ui-stack";
910
-
911
- // packages/plugins/plugin-space/src/components/ObjectSettings/AdvancedObjectSettings.tsx
912
- import React12, { useCallback as useCallback9, useState as useState5 } from "react";
913
- import { ForeignKeySchema } from "@dxos/echo-schema";
914
- import { getMeta } from "@dxos/react-client/echo";
915
- import { IconButton as IconButton2, useTranslation as useTranslation11 } from "@dxos/react-ui";
916
- import { Form as Form3 } from "@dxos/react-ui-form";
917
-
918
- // packages/plugins/plugin-space/src/components/ObjectSettings/ForeignKeys.tsx
919
- import React11, { useCallback as useCallback8 } from "react";
920
- import { IconButton, List, ListItem, useTranslation as useTranslation10 } from "@dxos/react-ui";
921
- var ForeignKeys = ({ keys, onDelete }) => {
922
- return /* @__PURE__ */ React11.createElement(List, {
923
- classNames: "flex flex-col gap-2"
924
- }, keys.map((key) => /* @__PURE__ */ React11.createElement(KeyItem, {
925
- key: key.id,
926
- forignKey: key,
927
- onDelete
928
- })));
929
- };
930
- var KeyItem = ({ forignKey, onDelete }) => {
931
- const { t } = useTranslation10(SPACE_PLUGIN);
932
- const handleDelete = useCallback8(() => {
933
- onDelete?.(forignKey);
934
- }, [
935
- forignKey,
936
- onDelete
937
- ]);
938
- return /* @__PURE__ */ React11.createElement(ListItem.Root, {
939
- classNames: "px-2"
940
- }, /* @__PURE__ */ React11.createElement(ListItem.Heading, {
941
- classNames: "flex flex-col grow truncate"
942
- }, /* @__PURE__ */ React11.createElement("div", null, forignKey.source), /* @__PURE__ */ React11.createElement("div", {
943
- className: "text-description text-sm truncate"
944
- }, forignKey.id)), /* @__PURE__ */ React11.createElement(ListItem.Endcap, null, /* @__PURE__ */ React11.createElement(IconButton, {
945
- iconOnly: true,
946
- icon: "ph--x--regular",
947
- variant: "ghost",
948
- label: t("delete key"),
949
- onClick: handleDelete
950
- })));
951
- };
952
-
953
- // packages/plugins/plugin-space/src/components/ObjectSettings/AdvancedObjectSettings.tsx
954
- var initialValues2 = {
955
- source: "",
956
- id: ""
957
- };
958
- var AdvancedObjectSettings = ({ object }) => {
959
- const { t } = useTranslation11(SPACE_PLUGIN);
960
- const [adding, setAdding] = useState5(false);
961
- const keys = getMeta(object).keys;
962
- const handleNew = useCallback9(() => setAdding(true), []);
963
- const handleCancel = useCallback9(() => setAdding(false), []);
964
- const handleSave = useCallback9((key) => {
965
- const index = keys.findIndex(({ source, id }) => source === key.source && id === key.id);
966
- if (index === -1) {
967
- keys.push(key);
968
- }
969
- setAdding(false);
970
- }, [
971
- keys
972
- ]);
973
- const handleDelete = useCallback9((key) => {
974
- const index = keys.findIndex(({ source, id }) => source === key.source && id === key.id);
975
- if (index !== -1) {
976
- keys.splice(index, 1);
977
- }
978
- }, [
979
- keys
980
- ]);
981
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("div", {
982
- className: "p-2 flex flex-col gap-4"
983
- }, /* @__PURE__ */ React12.createElement("h2", null, t("advanced settings label")), /* @__PURE__ */ React12.createElement("div", {
984
- className: "flex items-center"
985
- }, /* @__PURE__ */ React12.createElement("h3", {
986
- className: "text-sm font-semibold"
987
- }, t("foreign keys")), /* @__PURE__ */ React12.createElement("div", {
988
- className: "grow"
989
- }), /* @__PURE__ */ React12.createElement(IconButton2, {
990
- classNames: adding && "invisible",
991
- icon: "ph--plus--regular",
992
- label: t("add key"),
993
- onClick: handleNew
994
- })), !adding && /* @__PURE__ */ React12.createElement(ForeignKeys, {
995
- keys,
996
- onDelete: handleDelete
997
- })), adding && /* @__PURE__ */ React12.createElement(Form3, {
998
- schema: ForeignKeySchema,
999
- values: initialValues2,
1000
- onSave: handleSave,
1001
- onCancel: handleCancel
1002
- }));
1003
- };
1004
-
1005
- // packages/plugins/plugin-space/src/components/ObjectSettings/BaseObjectSettings.tsx
1006
- import React13, { useRef as useRef3 } from "react";
1007
- import { Input as Input2, useTranslation as useTranslation12 } from "@dxos/react-ui";
1008
- import { mx as mx5 } from "@dxos/react-ui-theme";
1009
- var BaseObjectSettings = ({ classNames, children, object }) => {
1010
- const { t } = useTranslation12(meta.id);
1011
- const inputRef = useRef3(null);
1012
- return /* @__PURE__ */ React13.createElement("form", {
1013
- className: mx5("flex flex-col p-2 gap-2", classNames)
1014
- }, /* @__PURE__ */ React13.createElement(Input2.Root, null, /* @__PURE__ */ React13.createElement(Input2.Label, null, t("name label")), /* @__PURE__ */ React13.createElement(Input2.TextInput, {
1015
- ref: inputRef,
1016
- placeholder: t("name placeholder"),
1017
- value: object.name ?? "",
1018
- onChange: (event) => {
1019
- object.name = event.target.value;
1020
- },
1021
- onKeyDown: (event) => {
1022
- if (event.key === "Enter") {
1023
- inputRef.current?.blur();
1024
- }
1025
- }
1026
- })), children);
1027
- };
1028
-
1029
- // packages/plugins/plugin-space/src/components/ObjectSettings/ObjectSettingsContainer.tsx
1030
- var ObjectSettingsContainer = ({ object, role }) => {
1031
- const data = useMemo2(() => ({
1032
- subject: object
1033
- }), [
1034
- object
1035
- ]);
1036
- return /* @__PURE__ */ React14.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React14.createElement(StackItem2.Content, {
1037
- toolbar: false,
1038
- role
1039
- }, /* @__PURE__ */ React14.createElement("div", {
1040
- className: "flex flex-col overflow-y-auto divide-y divide-separator"
1041
- }, /* @__PURE__ */ React14.createElement(BaseObjectSettings, {
1042
- object
1043
- }, /* @__PURE__ */ React14.createElement(Surface2, {
1044
- role: "base-object-settings",
1045
- data
1046
- })), /* @__PURE__ */ React14.createElement(Surface2, {
1047
- role: "object-settings",
1048
- data
1049
- }), /* @__PURE__ */ React14.createElement(AdvancedObjectSettings, {
1050
- object
1051
- }))));
1052
- };
1053
-
1054
- // packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
1055
- import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
1056
- import React15, { useEffect as useEffect3, useState as useState6 } from "react";
1057
- import { debounce } from "@dxos/async";
1058
- import { Tooltip, useTranslation as useTranslation13 } from "@dxos/react-ui";
1059
- import { getSize as getSize3, mx as mx6, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
1060
- var Status;
1061
- (function(Status2) {
1062
- Status2[Status2["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
1063
- Status2[Status2["PENDING"] = 1] = "PENDING";
1064
- Status2[Status2["ERROR"] = 2] = "ERROR";
1065
- })(Status || (Status = {}));
1066
- var PersistenceStatus = ({ db }) => {
1067
- const { t } = useTranslation13(SPACE_PLUGIN);
1068
- const [displayMessage, setDisplayMessage] = useState6(false);
1069
- const [status, naturalSetStatus] = useState6(0);
1070
- const [prevStatus, setPrevStatus] = useState6(0);
1071
- const _setStatus = debounce(naturalSetStatus, 500);
1072
- useEffect3(() => {
1073
- setPrevStatus(status);
1074
- if (prevStatus !== status && status === 0) {
1075
- setDisplayMessage(true);
1076
- const timeout = setTimeout(() => setDisplayMessage(false), 5e3);
1077
- return () => clearTimeout(timeout);
1078
- }
1079
- }, [
1080
- status
1081
- ]);
1082
- switch (status) {
1083
- case 2:
1084
- return /* @__PURE__ */ React15.createElement("div", {
1085
- className: "flex items-center"
1086
- }, /* @__PURE__ */ React15.createElement(Warning, {
1087
- className: mx6(getSize3(4), "me-1")
1088
- }), /* @__PURE__ */ React15.createElement("span", {
1089
- className: mx6("text-sm", warningText)
1090
- }, t("persistence error label")));
1091
- case 1:
1092
- return /* @__PURE__ */ React15.createElement("div", {
1093
- className: "flex items-center"
1094
- }, /* @__PURE__ */ React15.createElement(ArrowsCounterClockwise, {
1095
- className: mx6(getSize3(4), "me-1")
1096
- }), /* @__PURE__ */ React15.createElement("span", {
1097
- className: mx6("text-sm", staticPlaceholderText)
1098
- }, t("persistence pending label")));
1099
- case 0:
1100
- default:
1101
- return /* @__PURE__ */ React15.createElement(Tooltip.Root, {
1102
- delayDuration: 400
1103
- }, /* @__PURE__ */ React15.createElement(Tooltip.Trigger, {
1104
- role: "status",
1105
- className: "flex items-center"
1106
- }, /* @__PURE__ */ React15.createElement(CheckCircle2, {
1107
- className: mx6(getSize3(4), "me-1")
1108
- }), displayMessage && /* @__PURE__ */ React15.createElement("span", {
1109
- className: mx6("text-sm", staticPlaceholderText)
1110
- }, t("persisted locally label"))), /* @__PURE__ */ React15.createElement(Tooltip.Portal, null, /* @__PURE__ */ React15.createElement(Tooltip.Content, null, t("persisted locally message"), /* @__PURE__ */ React15.createElement(Tooltip.Arrow, null))));
1111
- }
1112
- };
1113
-
1114
- // packages/plugins/plugin-space/src/components/PopoverAddSpace.tsx
1115
- import React16 from "react";
1116
- import { createIntent as createIntent6, LayoutAction as LayoutAction5, useIntentDispatcher as useIntentDispatcher6 } from "@dxos/app-framework";
1117
- import { IconButton as IconButton3, useTranslation as useTranslation14 } from "@dxos/react-ui";
1118
- var POPOVER_ADD_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
1119
- var PopoverAddSpace = () => {
1120
- const { t } = useTranslation14(SPACE_PLUGIN);
1121
- const { dispatchPromise: dispatch } = useIntentDispatcher6();
1122
- return /* @__PURE__ */ React16.createElement("div", {
1123
- role: "none",
1124
- className: "p-1 grid grid-cols-1 gap-1 [&>button]:justify-start"
1125
- }, /* @__PURE__ */ React16.createElement(IconButton3, {
1126
- variant: "ghost",
1127
- label: t("create space label"),
1128
- icon: "ph--plus--regular",
1129
- onClick: () => {
1130
- void dispatch(createIntent6(SpaceAction.OpenCreateSpace));
1131
- void dispatch(createIntent6(LayoutAction5.UpdatePopover, {
1132
- part: "popover",
1133
- options: {
1134
- variant: "react",
1135
- anchorId: "",
1136
- state: false
1137
- }
1138
- }));
1139
- },
1140
- "data-testid": "spacePlugin.createSpace"
1141
- }), /* @__PURE__ */ React16.createElement(IconButton3, {
1142
- variant: "ghost",
1143
- label: t("join space label"),
1144
- icon: "ph--sign-in--regular",
1145
- onClick: () => {
1146
- void dispatch(createIntent6(SpaceAction.Join));
1147
- void dispatch(createIntent6(LayoutAction5.UpdatePopover, {
1148
- part: "popover",
1149
- options: {
1150
- variant: "react",
1151
- anchorId: "",
1152
- state: false
1153
- }
1154
- }));
1155
- },
1156
- "data-testid": "spacePlugin.joinSpace"
1157
- }));
1158
- };
1159
-
1160
- // packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
1161
- import React17, { useCallback as useCallback10, useRef as useRef4, useState as useState7 } from "react";
1162
- import { createIntent as createIntent7, LayoutAction as LayoutAction6, useIntentDispatcher as useIntentDispatcher7 } from "@dxos/app-framework";
1163
- import { log as log2 } from "@dxos/log";
1164
- import { Button as Button5, Input as Input3, useTranslation as useTranslation15 } from "@dxos/react-ui";
1165
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
1166
- var POPOVER_RENAME_OBJECT = `${SPACE_PLUGIN}/PopoverRenameObject`;
1167
- var PopoverRenameObject = ({ object: obj }) => {
1168
- const { t } = useTranslation15(SPACE_PLUGIN);
1169
- const doneButton = useRef4(null);
1170
- const object = obj;
1171
- const [name, setName] = useState7(object.name || object.title || "");
1172
- const { dispatchPromise: dispatch } = useIntentDispatcher7();
1173
- const handleDone = useCallback10(() => {
1174
- try {
1175
- object.name = name;
1176
- } catch {
1177
- try {
1178
- object.title = name;
1179
- } catch (err) {
1180
- log2.error("Failed to rename object", {
1181
- err
1182
- }, {
1183
- F: __dxlog_file4,
1184
- L: 32,
1185
- S: void 0,
1186
- C: (f, a) => f(...a)
1187
- });
1188
- }
1189
- }
1190
- void dispatch(createIntent7(LayoutAction6.UpdatePopover, {
1191
- part: "popover",
1192
- options: {
1193
- variant: "react",
1194
- anchorId: "",
1195
- state: false
1196
- }
1197
- }));
1198
- }, [
1199
- object,
1200
- name
1201
- ]);
1202
- return /* @__PURE__ */ React17.createElement("div", {
1203
- role: "none",
1204
- className: "p-1 flex gap-2"
1205
- }, /* @__PURE__ */ React17.createElement("div", {
1206
- role: "none",
1207
- className: "flex-1"
1208
- }, /* @__PURE__ */ React17.createElement(Input3.Root, null, /* @__PURE__ */ React17.createElement(Input3.Label, {
1209
- srOnly: true
1210
- }, t("object name label")), /* @__PURE__ */ React17.createElement(Input3.TextInput, {
1211
- placeholder: t("object placeholder"),
1212
- value: name,
1213
- "data-testid": "spacePlugin.renameObject.input",
1214
- onChange: ({ target: { value } }) => setName(value),
1215
- onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
1216
- }))), /* @__PURE__ */ React17.createElement(Button5, {
1217
- ref: doneButton,
1218
- classNames: "self-stretch",
1219
- onClick: handleDone
1220
- }, t("done label", {
1221
- ns: "os"
1222
- })));
1223
- };
1224
-
1225
- // packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
1226
- import React18, { useCallback as useCallback11, useRef as useRef5, useState as useState8 } from "react";
1227
- import { createIntent as createIntent8, LayoutAction as LayoutAction7, useIntentDispatcher as useIntentDispatcher8 } from "@dxos/app-framework";
1228
- import { Button as Button6, Input as Input4, Popover, useTranslation as useTranslation16 } from "@dxos/react-ui";
1229
- var POPOVER_RENAME_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
1230
- var PopoverRenameSpace = ({ space }) => {
1231
- const { t } = useTranslation16(SPACE_PLUGIN);
1232
- const doneButton = useRef5(null);
1233
- const [name, setName] = useState8(space.properties.name ?? "");
1234
- const { dispatchPromise: dispatch } = useIntentDispatcher8();
1235
- const handleDone = useCallback11(() => {
1236
- space.properties.name = name;
1237
- void dispatch(createIntent8(LayoutAction7.UpdatePopover, {
1238
- part: "popover",
1239
- options: {
1240
- variant: "react",
1241
- anchorId: "",
1242
- state: false
1243
- }
1244
- }));
1245
- }, [
1246
- space,
1247
- name
1248
- ]);
1249
- return /* @__PURE__ */ React18.createElement("div", {
1250
- role: "none",
1251
- className: "p-1 flex gap-2"
1252
- }, /* @__PURE__ */ React18.createElement("div", {
1253
- role: "none",
1254
- className: "flex-1"
1255
- }, /* @__PURE__ */ React18.createElement(Input4.Root, null, /* @__PURE__ */ React18.createElement(Input4.Label, {
1256
- srOnly: true
1257
- }, t("space name label")), /* @__PURE__ */ React18.createElement(Input4.TextInput, {
1258
- defaultValue: space.properties.name ?? "",
1259
- placeholder: t("unnamed space label"),
1260
- onChange: ({ target: { value } }) => setName(value),
1261
- // TODO(wittjosiah): Ideally this should access the popover context to close the popover.
1262
- // Currently this is not possible because Radix does not expose the popover context.
1263
- onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
1264
- }))), /* @__PURE__ */ React18.createElement(Popover.Close, {
1265
- asChild: true
1266
- }, /* @__PURE__ */ React18.createElement(Button6, {
1267
- ref: doneButton,
1268
- classNames: "self-stretch",
1269
- onClick: handleDone
1270
- }, t("done label", {
1271
- ns: "os"
1272
- }))));
1273
- };
1274
-
1275
- // packages/plugins/plugin-space/src/components/SchemaContainer.tsx
1276
- import React19, { useState as useState9, useEffect as useEffect4 } from "react";
1277
- import { useTranslation as useTranslation17 } from "@dxos/react-ui";
1278
- import { controlItemClasses, ControlPage as ControlPage2, ControlSection as ControlSection2 } from "@dxos/react-ui-form";
1279
- import { StackItem as StackItem3 } from "@dxos/react-ui-stack";
1280
- var useQuerySpaceSchemas = (space) => {
1281
- const [schemas, setSchemas] = useState9([]);
1282
- useEffect4(() => {
1283
- const query = space.db.schemaRegistry.query();
1284
- const initialResults = query.runSync();
1285
- setSchemas(initialResults);
1286
- const unsubscribe = query.subscribe(() => setSchemas(query.results));
1287
- return () => unsubscribe();
1288
- }, [
1289
- space
1290
- ]);
1291
- return schemas;
1292
- };
1293
- var SchemaContainer = ({ space }) => {
1294
- const { t } = useTranslation17(SPACE_PLUGIN);
1295
- const schemas = useQuerySpaceSchemas(space);
1296
- return /* @__PURE__ */ React19.createElement(StackItem3.Content, {
1297
- classNames: "block overflow-y-auto"
1298
- }, /* @__PURE__ */ React19.createElement(ControlPage2, null, /* @__PURE__ */ React19.createElement(ControlSection2, {
1299
- title: t("schema verbose label"),
1300
- description: t("schema description")
1301
- }, /* @__PURE__ */ React19.createElement("div", {
1302
- role: "none",
1303
- className: controlItemClasses
1304
- }, schemas.length === 0 && /* @__PURE__ */ React19.createElement("div", {
1305
- className: "text-center plb-4"
1306
- }, t("no schemas found message")), schemas.map((schema) => /* @__PURE__ */ React19.createElement("div", {
1307
- key: schema.id
1308
- }, /* @__PURE__ */ React19.createElement("div", null, schema.typename)))))));
1309
- };
1310
-
1311
- // packages/plugins/plugin-space/src/components/SpacePresence.tsx
1312
- import React20, { forwardRef, useCallback as useCallback12, useEffect as useEffect5, useState as useState10 } from "react";
1313
- import { useAppGraph as useAppGraph2, useCapability } from "@dxos/app-framework";
1314
- import { generateName } from "@dxos/display-name";
1315
- import { PublicKey, useClient as useClient5 } from "@dxos/react-client";
1316
- import { getSpace as getSpace3, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1317
- import { useIdentity } from "@dxos/react-client/halo";
1318
- import { Avatar, Tooltip as Tooltip2, useTranslation as useTranslation18, List as List2, ListItem as ListItem2, useDefaultValue } from "@dxos/react-ui";
1319
- import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
1320
- import { ComplexMap, keyToFallback } from "@dxos/util";
1321
- var REFRESH_INTERVAL = 5e3;
1322
- var ACTIVITY_DURATION = 3e4;
1323
- var noViewers = new ComplexMap(PublicKey.hash);
1324
- var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
1325
- var SpacePresence = ({ object, spaceKey }) => {
1326
- const spaceState = useCapability(SpaceCapabilities.MutableState);
1327
- const client = useClient5();
1328
- const identity = useIdentity();
1329
- const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
1330
- const spaceMembers = useMembers(space?.key);
1331
- const [_moment, setMoment] = useState10(Date.now());
1332
- useEffect5(() => {
1333
- const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
1334
- return () => clearInterval(interval);
1335
- }, []);
1336
- const memberOnline = useCallback12((member) => member.presence === 1, []);
1337
- const memberIsNotSelf = useCallback12((member) => !identity?.identityKey.equals(member.identity.identityKey), [
1338
- identity?.identityKey
1339
- ]);
1340
- if (!identity || !spaceState || !space) {
1341
- return null;
1342
- }
1343
- const currentObjectViewers = spaceState.viewersByObject[fullyQualifiedId3(object)] ?? noViewers;
1344
- const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
1345
- const objectView = currentObjectViewers.get(member.identity.identityKey);
1346
- const lastSeen = objectView?.lastSeen ?? -Infinity;
1347
- const currentlyAttended = objectView?.currentlyAttended ?? false;
1348
- return {
1349
- ...member,
1350
- currentlyAttended,
1351
- lastSeen
1352
- };
1353
- }).toSorted((a, b) => a.lastSeen - b.lastSeen);
1354
- return /* @__PURE__ */ React20.createElement(FullPresence, {
1355
- members: membersForObject
1356
- });
1357
- };
1358
- var FullPresence = (props) => {
1359
- const { size = 9, onMemberClick } = props;
1360
- const members = useDefaultValue(props.members, () => []);
1361
- if (members.length === 0) {
1362
- return null;
1363
- }
1364
- return /* @__PURE__ */ React20.createElement("div", {
1365
- className: "dx-avatar-group",
1366
- "data-testid": "spacePlugin.presence"
1367
- }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React20.createElement(Tooltip2.Root, {
1368
- key: member.identity.identityKey.toHex()
1369
- }, /* @__PURE__ */ React20.createElement(Tooltip2.Trigger, {
1370
- className: "grid focus:outline-none"
1371
- }, /* @__PURE__ */ React20.createElement(PresenceAvatar, {
1372
- identity: member.identity,
1373
- match: member.currentlyAttended,
1374
- index: members.length - i,
1375
- onClick: () => onMemberClick?.(member),
1376
- size
1377
- })), /* @__PURE__ */ React20.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React20.createElement(Tooltip2.Content, {
1378
- side: "bottom"
1379
- }, /* @__PURE__ */ React20.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React20.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React20.createElement(Tooltip2.Root, null, /* @__PURE__ */ React20.createElement(Tooltip2.Trigger, {
1380
- className: "grid focus:outline-none"
1381
- }, /* @__PURE__ */ React20.createElement(Avatar.Root, null, /* @__PURE__ */ React20.createElement(Avatar.Content, {
1382
- status: "inactive",
1383
- style: {
1384
- zIndex: members.length - 4
1385
- },
1386
- fallback: `+${members.length - 3}`,
1387
- size
1388
- }))), /* @__PURE__ */ React20.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React20.createElement(Tooltip2.Content, {
1389
- side: "bottom"
1390
- }, /* @__PURE__ */ React20.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React20.createElement(List2, {
1391
- classNames: "max-h-56 overflow-y-auto"
1392
- }, members.map((member) => /* @__PURE__ */ React20.createElement(ListItem2.Root, {
1393
- key: member.identity.identityKey.toHex(),
1394
- classNames: "flex gap-2 items-center cursor-pointer mbe-2",
1395
- onClick: () => onMemberClick?.(member),
1396
- "data-testid": "identity-list-item"
1397
- }, /* @__PURE__ */ React20.createElement(PresenceAvatar, {
1398
- identity: member.identity,
1399
- size,
1400
- showName: true,
1401
- match: member.currentlyAttended
1402
- }))))))));
1403
- };
1404
- var PresenceAvatar = /* @__PURE__ */ forwardRef(({ identity, showName, match, index, onClick, size }, forwardedRef) => {
1405
- const status = match ? "current" : "active";
1406
- const fallbackValue = keyToFallback(identity.identityKey);
1407
- return /* @__PURE__ */ React20.createElement(Avatar.Root, null, /* @__PURE__ */ React20.createElement(Avatar.Content, {
1408
- status,
1409
- hue: identity.profile?.data?.hue || fallbackValue.hue,
1410
- "data-testid": "spacePlugin.presence.member",
1411
- "data-status": status,
1412
- size,
1413
- ...index ? {
1414
- style: {
1415
- zIndex: index
1416
- }
1417
- } : {},
1418
- onClick,
1419
- fallback: identity.profile?.data?.emoji || fallbackValue.emoji,
1420
- ref: forwardedRef
1421
- }), /* @__PURE__ */ React20.createElement(Avatar.Label, {
1422
- classNames: showName ? "text-sm truncate pli-2" : "sr-only"
1423
- }, getName(identity)));
1424
- });
1425
- var SmallPresenceLive = ({ id, open, viewers }) => {
1426
- const { hasAttention, isAncestor, isRelated } = useAttention(id);
1427
- const isAttended = hasAttention || isAncestor || isRelated;
1428
- const { graph } = useAppGraph2();
1429
- const attended = useAttended();
1430
- const startOfAttention = attended.at(-1);
1431
- const path = usePath(graph, startOfAttention);
1432
- const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
1433
- const getActiveViewers = (viewers2) => {
1434
- const moment = Date.now();
1435
- return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
1436
- };
1437
- const [activeViewers, setActiveViewers] = useState10(viewers ? getActiveViewers(viewers) : []);
1438
- useEffect5(() => {
1439
- if (viewers) {
1440
- setActiveViewers(getActiveViewers(viewers));
1441
- const interval = setInterval(() => {
1442
- setActiveViewers(getActiveViewers(viewers));
1443
- }, REFRESH_INTERVAL);
1444
- return () => clearInterval(interval);
1445
- }
1446
- }, [
1447
- viewers
1448
- ]);
1449
- return /* @__PURE__ */ React20.createElement(SmallPresence, {
1450
- count: activeViewers.length,
1451
- attended: isAttended,
1452
- containsAttended
1453
- });
1454
- };
1455
- var SmallPresence = ({ count = 0, attended, containsAttended }) => {
1456
- const { t } = useTranslation18(SPACE_PLUGIN);
1457
- return /* @__PURE__ */ React20.createElement(Tooltip2.Root, null, /* @__PURE__ */ React20.createElement(Tooltip2.Trigger, {
1458
- asChild: true
1459
- }, /* @__PURE__ */ React20.createElement(AttentionGlyph, {
1460
- attended,
1461
- containsAttended,
1462
- presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1463
- classNames: "self-center mie-1"
1464
- })), /* @__PURE__ */ React20.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React20.createElement(Tooltip2.Content, {
1465
- side: "bottom"
1466
- }, /* @__PURE__ */ React20.createElement("span", null, t("presence label", {
1467
- count
1468
- })), /* @__PURE__ */ React20.createElement(Tooltip2.Arrow, null))));
1469
- };
1470
-
1471
- // packages/plugins/plugin-space/src/components/SpacePluginSettings.tsx
1472
- import React21 from "react";
1473
- import { createIntent as createIntent9, useIntentDispatcher as useIntentDispatcher9 } from "@dxos/app-framework";
1474
- import { useClient as useClient6 } from "@dxos/react-client";
1475
- import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
1476
- import { Input as Input5, toLocalizedString as toLocalizedString3, useTranslation as useTranslation19, List as List3, ListItem as ListItem3, Button as Button7 } from "@dxos/react-ui";
1477
- import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
1478
- var SpacePluginSettings = ({ settings }) => {
1479
- const { t } = useTranslation19(SPACE_PLUGIN);
1480
- const { dispatchPromise: dispatch } = useIntentDispatcher9();
1481
- const client = useClient6();
1482
- const spaces = useSpaces2({
1483
- all: settings.showHidden
1484
- });
1485
- return /* @__PURE__ */ React21.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React21.createElement(DeprecatedFormInput, {
1486
- label: t("show hidden spaces label")
1487
- }, /* @__PURE__ */ React21.createElement(Input5.Switch, {
1488
- checked: settings.showHidden,
1489
- onCheckedChange: (checked) => settings.showHidden = !!checked
1490
- })), /* @__PURE__ */ React21.createElement("div", {
1491
- role: "none"
1492
- }, /* @__PURE__ */ React21.createElement("h2", {
1493
- className: "text-xl my-4"
1494
- }, "Space Settings"), /* @__PURE__ */ React21.createElement(List3, {
1495
- classNames: "max-w-md mx-auto"
1496
- }, spaces.map((space) => /* @__PURE__ */ React21.createElement(ListItem3.Root, {
1497
- key: space.id
1498
- }, /* @__PURE__ */ React21.createElement(ListItem3.Heading, {
1499
- classNames: "flex flex-col grow truncate mbe-2"
1500
- }, toLocalizedString3(getSpaceDisplayName(space, {
1501
- personal: space === client.spaces.default
1502
- }), t)), /* @__PURE__ */ React21.createElement(ListItem3.Endcap, null, /* @__PURE__ */ React21.createElement(Button7, {
1503
- onClick: () => dispatch(createIntent9(SpaceAction.OpenSettings, {
1504
- space
1505
- }))
1506
- }, t("open space settings label"))))))));
1507
- };
1508
-
1509
- // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx
1510
- import { pipe as pipe2, Schema as S } from "effect";
1511
- import React22, { useCallback as useCallback13, useMemo as useMemo3, useState as useState11 } from "react";
1512
- import { chain as chain2, createIntent as createIntent10, LayoutAction as LayoutAction8, useIntentDispatcher as useIntentDispatcher10 } from "@dxos/app-framework";
1513
- import { log as log3 } from "@dxos/log";
1514
- import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
1515
- import { useClient as useClient7 } from "@dxos/react-client";
1516
- import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
1517
- import { Button as Button8, Input as Input6, useMulticastObservable, useTranslation as useTranslation20 } from "@dxos/react-ui";
1518
- import { Form as Form4, ControlItem, ControlItemInput as ControlItemInput2, ControlSection as ControlSection3, ControlPage as ControlPage3 } from "@dxos/react-ui-form";
1519
- import { HuePicker, IconPicker } from "@dxos/react-ui-pickers";
1520
- import { StackItem as StackItem4 } from "@dxos/react-ui-stack";
1521
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx";
1522
- var FormSchema = SpaceForm.pipe(S.extend(S.Struct({
1523
- archived: S.Boolean.annotations({
1524
- title: "Archive space"
1525
- })
1526
- })));
1527
- var SpaceSettingsContainer = ({ space }) => {
1528
- const { t } = useTranslation20(SPACE_PLUGIN);
1529
- const { dispatchPromise: dispatch } = useIntentDispatcher10();
1530
- const client = useClient7();
1531
- const archived = useMulticastObservable(space.state) === SpaceState2.SPACE_INACTIVE;
1532
- const [edgeReplication, setEdgeReplication] = useState11(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1533
- const toggleEdgeReplication = useCallback13(async (next) => {
1534
- setEdgeReplication(next);
1535
- await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
1536
- log3.catch(err, void 0, {
1537
- F: __dxlog_file5,
1538
- L: 49,
1539
- S: void 0,
1540
- C: (f, a) => f(...a)
1541
- });
1542
- setEdgeReplication(!next);
1543
- });
1544
- }, [
1545
- space
1546
- ]);
1547
- const handleSave = useCallback13((properties) => {
1548
- void toggleEdgeReplication(properties.edgeReplication);
1549
- if (properties.name !== space.properties.name) {
1550
- space.properties.name = properties.name;
1551
- }
1552
- if (properties.icon !== space.properties.icon) {
1553
- space.properties.icon = properties.icon;
1554
- }
1555
- if (properties.hue !== space.properties.hue) {
1556
- space.properties.hue = properties.hue;
1557
- }
1558
- if (properties.archived && !archived) {
1559
- void dispatch(pipe2(createIntent10(SpaceAction.Close, {
1560
- space
1561
- }), chain2(LayoutAction8.SwitchWorkspace, {
1562
- part: "workspace",
1563
- subject: client.spaces.default.id
1564
- })));
1565
- } else if (!properties.archived && archived) {
1566
- void dispatch(createIntent10(SpaceAction.Open, {
1567
- space
1568
- }));
1569
- }
1570
- }, [
1571
- space,
1572
- toggleEdgeReplication,
1573
- archived
1574
- ]);
1575
- const values = useMemo3(() => ({
1576
- name: space.properties.name,
1577
- icon: space.properties.icon,
1578
- hue: space.properties.hue,
1579
- edgeReplication,
1580
- archived
1581
- }), [
1582
- space.properties.name,
1583
- space.properties.icon,
1584
- space.properties.hue,
1585
- edgeReplication,
1586
- archived
1587
- ]);
1588
- const customElements = useMemo3(() => ({
1589
- name: ({ type, label, getValue, onValueChange }) => {
1590
- const handleChange = useCallback13(({ target: { value } }) => onValueChange(type, value), [
1591
- onValueChange,
1592
- type
1593
- ]);
1594
- return /* @__PURE__ */ React22.createElement(ControlItemInput2, {
1595
- title: label,
1596
- description: t("display name description")
1597
- }, /* @__PURE__ */ React22.createElement(Input6.TextInput, {
1598
- value: getValue(),
1599
- onChange: handleChange,
1600
- placeholder: t("display name input placeholder"),
1601
- classNames: "min-is-64"
1602
- }));
1603
- },
1604
- icon: ({ type, label, getValue, onValueChange }) => {
1605
- const handleChange = useCallback13((nextEmoji) => onValueChange(type, nextEmoji), [
1606
- onValueChange,
1607
- type
1608
- ]);
1609
- const handleEmojiReset = useCallback13(() => onValueChange(type, void 0), [
1610
- onValueChange,
1611
- type
1612
- ]);
1613
- return /* @__PURE__ */ React22.createElement(ControlItem, {
1614
- title: label,
1615
- description: t("icon description")
1616
- }, /* @__PURE__ */ React22.createElement(IconPicker, {
1617
- value: getValue(),
1618
- onChange: handleChange,
1619
- onReset: handleEmojiReset,
1620
- classNames: "justify-self-end",
1621
- iconSize: 5
1622
- }));
1623
- },
1624
- hue: ({ type, label, getValue, onValueChange }) => {
1625
- const handleChange = useCallback13((nextHue) => onValueChange(type, nextHue), [
1626
- onValueChange,
1627
- type
1628
- ]);
1629
- const handleHueReset = useCallback13(() => onValueChange(type, void 0), [
1630
- onValueChange,
1631
- type
1632
- ]);
1633
- return /* @__PURE__ */ React22.createElement(ControlItem, {
1634
- title: label,
1635
- description: t("hue description")
1636
- }, /* @__PURE__ */ React22.createElement(HuePicker, {
1637
- value: getValue(),
1638
- onChange: handleChange,
1639
- onReset: handleHueReset,
1640
- classNames: "[--hue-preview-size:1.25rem] justify-self-end"
1641
- }));
1642
- },
1643
- edgeReplication: ({ type, label, getValue, onValueChange }) => {
1644
- const handleChange = useCallback13((checked) => onValueChange(type, checked), [
1645
- onValueChange,
1646
- type
1647
- ]);
1648
- return /* @__PURE__ */ React22.createElement(ControlItemInput2, {
1649
- title: label,
1650
- description: t("edge replication description")
1651
- }, /* @__PURE__ */ React22.createElement(Input6.Switch, {
1652
- checked: getValue(),
1653
- onCheckedChange: handleChange,
1654
- classNames: "justify-self-end"
1655
- }));
1656
- },
1657
- archived: ({ type, label, getValue, onValueChange }) => {
1658
- const handleChange = useCallback13(() => onValueChange(type, !getValue()), [
1659
- onValueChange,
1660
- type,
1661
- getValue
1662
- ]);
1663
- return /* @__PURE__ */ React22.createElement(ControlItemInput2, {
1664
- title: label,
1665
- description: t("archive space description")
1666
- }, /* @__PURE__ */ React22.createElement(Button8, {
1667
- disabled: space === client.spaces.default,
1668
- onClick: handleChange
1669
- }, getValue() ? t("unarchive space label") : t("archive space label")));
1670
- }
1671
- }), [
1672
- t,
1673
- space
1674
- ]);
1675
- return /* @__PURE__ */ React22.createElement(StackItem4.Content, {
1676
- classNames: "block overflow-y-auto pli-2"
1677
- }, /* @__PURE__ */ React22.createElement(ControlPage3, null, /* @__PURE__ */ React22.createElement(ControlSection3, {
1678
- title: t("space properties settings verbose label", {
1679
- ns: SPACE_PLUGIN
1680
- }),
1681
- description: t("space properties settings description", {
1682
- ns: SPACE_PLUGIN
1683
- })
1684
- }, /* @__PURE__ */ React22.createElement(Form4, {
1685
- schema: FormSchema,
1686
- values,
1687
- autoSave: true,
1688
- onSave: handleSave,
1689
- Custom: customElements,
1690
- classNames: 'p-0 container-max-width [&_[role="form"]]:grid [&_[role="form"]]:grid-cols-1 md:[&_[role="form"]]:grid-cols-[1fr_min-content] [&_[role="form"]]:gap-4'
1691
- }))));
1692
- };
1693
-
1694
- // packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
1695
- import React23, { useEffect as useEffect6, useState as useState12 } from "react";
1696
- import { useAppGraph as useAppGraph3 } from "@dxos/app-framework";
1697
- import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
1698
- import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
1699
- import { useClient as useClient8 } from "@dxos/react-client";
1700
- import { useSpaceSyncState } from "@dxos/react-client/echo";
1701
- import { Tooltip as Tooltip3, useTranslation as useTranslation21 } from "@dxos/react-ui";
1702
- import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
1703
- var useEdgeStatus = () => {
1704
- const [status, setStatus] = useState12(EdgeStatus.NOT_CONNECTED);
1705
- const client = useClient8();
1706
- useEffect6(() => {
1707
- client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
1708
- setStatus(status2);
1709
- });
1710
- }, [
1711
- client
1712
- ]);
1713
- return status;
1714
- };
1715
- var InlineSyncStatus = ({ space, open }) => {
1716
- const { t } = useTranslation21(SPACE_PLUGIN);
1717
- const id = space.id;
1718
- const { hasAttention, isAncestor, isRelated } = useAttention2(id);
1719
- const isAttended = hasAttention || isAncestor || isRelated;
1720
- const { graph } = useAppGraph3();
1721
- const attended = useAttended2();
1722
- const startOfAttention = attended.at(-1);
1723
- const path = usePath(graph, startOfAttention);
1724
- const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
1725
- const connectedToEdge = useEdgeStatus() === EdgeStatus.CONNECTED;
1726
- const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
1727
- const syncState = useSpaceSyncState(space);
1728
- const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
1729
- return /* @__PURE__ */ React23.createElement(Tooltip3.Root, null, /* @__PURE__ */ React23.createElement(Tooltip3.Trigger, {
1730
- asChild: true
1731
- }, /* @__PURE__ */ React23.createElement(AttentionGlyph2, {
1732
- syncing,
1733
- attended: isAttended,
1734
- containsAttended,
1735
- classNames: "self-center mie-1"
1736
- })), /* @__PURE__ */ React23.createElement(Tooltip3.Portal, null, /* @__PURE__ */ React23.createElement(Tooltip3.Content, {
1737
- side: "bottom",
1738
- classNames: "z-[70]"
1739
- }, /* @__PURE__ */ React23.createElement("span", null, t("syncing label")), /* @__PURE__ */ React23.createElement(Tooltip3.Arrow, null))));
1740
- };
1741
-
1742
- // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1743
- import React24, { useEffect as useEffect7, useState as useState13 } from "react";
1744
- import { StatusBar } from "@dxos/plugin-status-bar";
1745
- import { useClient as useClient9 } from "@dxos/react-client";
1746
- import { getSyncSummary, useSyncState } from "@dxos/react-client/echo";
1747
- import { Icon as Icon5, useTranslation as useTranslation22 } from "@dxos/react-ui";
1748
-
1749
- // packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts
1750
- import { Context } from "@dxos/context";
1751
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
1752
- var createClientSaveTracker = (client, cb) => {
1753
- const CleanupFns = {};
1754
- const state = {};
1755
- const install = (spaces) => {
1756
- for (const space of spaces) {
1757
- if (state[space.id]) {
1758
- continue;
1759
- }
1760
- state[space.id] = "saved";
1761
- CleanupFns[space.id] = createSpaceSaveTracker(space, (s) => {
1762
- state[space.id] = s;
1763
- cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
1764
- });
1765
- }
1766
- };
1767
- client.spaces.subscribe((spaces) => {
1768
- install(spaces);
1769
- });
1770
- install(client.spaces.get());
1771
- return () => {
1772
- for (const unsubscribe of Object.values(CleanupFns)) {
1773
- unsubscribe();
1774
- }
1775
- };
1776
- };
1777
- var createSpaceSaveTracker = (space, cb) => {
1778
- const ctx = new Context(void 0, {
1779
- F: __dxlog_file6,
1780
- L: 40
1781
- });
1782
- void space.waitUntilReady().then(() => {
1783
- if (ctx.disposed) {
1784
- return;
1785
- }
1786
- let hasUnsavedChanges = false;
1787
- let lastFlushPromise;
1788
- space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
1789
- hasUnsavedChanges = unsavedDocuments.length > 0;
1790
- });
1791
- space.crud.saveStateChanged.debounce(500).on(ctx, () => {
1792
- if (hasUnsavedChanges) {
1793
- lastFlushPromise = void 0;
1794
- cb("saving");
1795
- } else {
1796
- const flushPromise = space.crud.flush();
1797
- lastFlushPromise = flushPromise;
1798
- void flushPromise.then(() => {
1799
- if (lastFlushPromise === flushPromise) {
1800
- cb("saved");
1801
- }
1802
- });
1803
- }
1804
- });
1805
- });
1806
- return () => {
1807
- void ctx.dispose();
1808
- };
1809
- };
1810
-
1811
- // packages/plugins/plugin-space/src/components/SyncStatus/status.ts
1812
- var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
1813
- if (!saved) {
1814
- return "saving locally";
1815
- } else if (!offline && needsToDownload) {
1816
- return "downloading";
1817
- } else if (!offline && needsToUpload) {
1818
- return "uploading";
1819
- } else if (offline && !needsToUpload && !needsToDownload) {
1820
- return "offline persisted";
1821
- } else {
1822
- return "remote synced";
1823
- }
1824
- };
1825
- var getIcon = (status) => {
1826
- switch (status) {
1827
- case "saving locally":
1828
- return "ph--download--regular";
1829
- case "downloading":
1830
- return "ph--cloud-arrow-down--regular";
1831
- case "uploading":
1832
- return "ph--cloud-arrow-up--regular";
1833
- case "offline persisted":
1834
- return "ph--check-circle--regular";
1835
- case "remote synced":
1836
- return "ph--cloud-check--regular";
1837
- }
1838
- };
1839
-
1840
- // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1841
- var SYNC_STALLED_TIMEOUT = 5e3;
1842
- var SyncStatus = () => {
1843
- const client = useClient9();
1844
- const state = useSyncState();
1845
- const [saved, setSaved] = useState13(true);
1846
- useEffect7(() => {
1847
- return createClientSaveTracker(client, (state2) => {
1848
- setSaved(state2 === "saved");
1849
- });
1850
- }, []);
1851
- return /* @__PURE__ */ React24.createElement(SyncStatusIndicator, {
1852
- state,
1853
- saved
1854
- });
1855
- };
1856
- var SyncStatusIndicator = ({ state, saved }) => {
1857
- const { t } = useTranslation22(SPACE_PLUGIN);
1858
- const summary = getSyncSummary(state);
1859
- const offline = Object.values(state).length === 0;
1860
- const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1861
- const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1862
- const status = getStatus({
1863
- offline,
1864
- saved,
1865
- needsToUpload,
1866
- needsToDownload
1867
- });
1868
- const [classNames, setClassNames] = useState13();
1869
- useEffect7(() => {
1870
- setClassNames(void 0);
1871
- if (offline || !needsToUpload && !needsToDownload) {
1872
- return;
1873
- }
1874
- const t2 = setTimeout(() => {
1875
- setClassNames("text-orange-500");
1876
- }, SYNC_STALLED_TIMEOUT);
1877
- return () => clearTimeout(t2);
1878
- }, [
1879
- offline,
1880
- needsToUpload,
1881
- needsToDownload
1882
- ]);
1883
- const title = t(`${status} label`);
1884
- const icon = /* @__PURE__ */ React24.createElement(Icon5, {
1885
- icon: getIcon(status),
1886
- size: 4,
1887
- classNames
1888
- });
1889
- return /* @__PURE__ */ React24.createElement(StatusBar.Item, {
1890
- title
1891
- }, icon);
1892
- };
1893
-
1894
- export {
1895
- AwaitingObject,
1896
- CREATE_OBJECT_DIALOG,
1897
- CreateObjectDialog,
1898
- CREATE_SPACE_DIALOG,
1899
- CreateSpaceDialog,
1900
- CollectionMain,
1901
- CollectionSection,
1902
- JOIN_DIALOG,
1903
- JoinDialog,
1904
- MembersContainer,
1905
- MenuFooter,
1906
- ObjectSettingsContainer,
1907
- PersistenceStatus,
1908
- POPOVER_ADD_SPACE,
1909
- PopoverAddSpace,
1910
- POPOVER_RENAME_OBJECT,
1911
- PopoverRenameObject,
1912
- POPOVER_RENAME_SPACE,
1913
- PopoverRenameSpace,
1914
- useQuerySpaceSchemas,
1915
- SchemaContainer,
1916
- SpacePresence,
1917
- FullPresence,
1918
- SmallPresenceLive,
1919
- SmallPresence,
1920
- SpacePluginSettings,
1921
- SpaceSettingsContainer,
1922
- InlineSyncStatus,
1923
- SyncStatus,
1924
- SyncStatusIndicator,
1925
- AppGraphBuilder,
1926
- AppGraphSerializer,
1927
- IdentityCreated,
1928
- IntentResolver,
1929
- ReactRoot,
1930
- ReactSurface,
1931
- Schema,
1932
- Tools,
1933
- SpaceSettings,
1934
- SpaceState,
1935
- SpacesReady
1936
- };
1937
- //# sourceMappingURL=chunk-4226DMDP.mjs.map