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