@dxos/plugin-space 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203

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 (535) hide show
  1. package/dist/lib/browser/CollectionArticle-XXLUNK3F.mjs +127 -0
  2. package/dist/lib/browser/CollectionArticle-XXLUNK3F.mjs.map +7 -0
  3. package/dist/lib/browser/ObjectCardStack-CXNBCSMR.mjs +148 -0
  4. package/dist/lib/browser/ObjectCardStack-CXNBCSMR.mjs.map +7 -0
  5. package/dist/lib/browser/ObjectDetails-HXV4IQEM.mjs +143 -0
  6. package/dist/lib/browser/ObjectDetails-HXV4IQEM.mjs.map +7 -0
  7. package/dist/lib/browser/RecordArticle-36LDKFWF.mjs +108 -0
  8. package/dist/lib/browser/RecordArticle-36LDKFWF.mjs.map +7 -0
  9. package/dist/lib/browser/app-graph-builder-GLV46QSI.mjs +530 -0
  10. package/dist/lib/browser/app-graph-builder-GLV46QSI.mjs.map +7 -0
  11. package/dist/lib/browser/app-graph-serializer-VOLRDNVE.mjs +85 -0
  12. package/dist/lib/browser/app-graph-serializer-VOLRDNVE.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-POFUXISV.mjs → chunk-7D63MVRS.mjs} +6 -5
  14. package/dist/lib/browser/chunk-7D63MVRS.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-5CSSKOWR.mjs → chunk-A7ZCVQGZ.mjs} +43 -45
  16. package/dist/lib/browser/chunk-A7ZCVQGZ.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-ASV6DYFH.mjs +19 -0
  18. package/dist/lib/browser/chunk-ASV6DYFH.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-CMLRMQNM.mjs +1889 -0
  20. package/dist/lib/browser/chunk-CMLRMQNM.mjs.map +7 -0
  21. package/dist/lib/browser/{chunk-VZBIIYFM.mjs → chunk-HSMQFM57.mjs} +1 -1
  22. package/dist/lib/browser/chunk-HSMQFM57.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-KGLWYGIF.mjs +715 -0
  24. package/dist/lib/browser/chunk-KGLWYGIF.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-NF3ZFAB4.mjs +13 -0
  26. package/dist/lib/browser/chunk-NF3ZFAB4.mjs.map +7 -0
  27. package/dist/lib/browser/{chunk-IJCMB5B5.mjs → chunk-WAOJLA2S.mjs} +195 -196
  28. package/dist/lib/browser/chunk-WAOJLA2S.mjs.map +7 -0
  29. package/dist/lib/browser/cli/index.mjs +851 -0
  30. package/dist/lib/browser/cli/index.mjs.map +7 -0
  31. package/dist/lib/browser/identity-created-VCFYLSBB.mjs +23 -0
  32. package/dist/lib/browser/identity-created-VCFYLSBB.mjs.map +7 -0
  33. package/dist/lib/browser/index.mjs +215 -189
  34. package/dist/lib/browser/index.mjs.map +4 -4
  35. package/dist/lib/browser/meta.json +1 -1
  36. package/dist/lib/browser/operation-resolver-PJJ3PCM7.mjs +830 -0
  37. package/dist/lib/browser/operation-resolver-PJJ3PCM7.mjs.map +7 -0
  38. package/dist/lib/browser/react-root-ITWAPZIY.mjs +30 -0
  39. package/dist/lib/browser/react-root-ITWAPZIY.mjs.map +7 -0
  40. package/dist/lib/browser/react-surface-6GD6K4I4.mjs +383 -0
  41. package/dist/lib/browser/react-surface-6GD6K4I4.mjs.map +7 -0
  42. package/dist/lib/browser/{repair-CNLE35NF.mjs → repair-DKU4TUD2.mjs} +16 -10
  43. package/dist/lib/browser/repair-DKU4TUD2.mjs.map +7 -0
  44. package/dist/lib/browser/settings-M2DMD2ZA.mjs +34 -0
  45. package/dist/lib/browser/settings-M2DMD2ZA.mjs.map +7 -0
  46. package/dist/lib/browser/spaces-ready-XWJUJ43N.mjs +243 -0
  47. package/dist/lib/browser/spaces-ready-XWJUJ43N.mjs.map +7 -0
  48. package/dist/lib/browser/state-V637BLIM.mjs +58 -0
  49. package/dist/lib/browser/state-V637BLIM.mjs.map +7 -0
  50. package/dist/lib/browser/types/index.mjs +10 -8
  51. package/dist/lib/node-esm/CollectionArticle-KFFKKP37.mjs +128 -0
  52. package/dist/lib/node-esm/CollectionArticle-KFFKKP37.mjs.map +7 -0
  53. package/dist/lib/node-esm/ObjectCardStack-EHXPNRQW.mjs +149 -0
  54. package/dist/lib/node-esm/ObjectCardStack-EHXPNRQW.mjs.map +7 -0
  55. package/dist/lib/node-esm/ObjectDetails-N73UI4ZL.mjs +144 -0
  56. package/dist/lib/node-esm/ObjectDetails-N73UI4ZL.mjs.map +7 -0
  57. package/dist/lib/node-esm/RecordArticle-CMEXNNOZ.mjs +109 -0
  58. package/dist/lib/node-esm/RecordArticle-CMEXNNOZ.mjs.map +7 -0
  59. package/dist/lib/node-esm/app-graph-builder-KCEHEKVS.mjs +531 -0
  60. package/dist/lib/node-esm/app-graph-builder-KCEHEKVS.mjs.map +7 -0
  61. package/dist/lib/node-esm/app-graph-serializer-7C4MV5NB.mjs +86 -0
  62. package/dist/lib/node-esm/app-graph-serializer-7C4MV5NB.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-2NM62ORP.mjs +1890 -0
  64. package/dist/lib/node-esm/chunk-2NM62ORP.mjs.map +7 -0
  65. package/dist/lib/node-esm/{chunk-AX3UGL5D.mjs → chunk-5N3YIAXD.mjs} +6 -5
  66. package/dist/lib/node-esm/chunk-5N3YIAXD.mjs.map +7 -0
  67. package/dist/lib/node-esm/{chunk-UMZ7G6G4.mjs → chunk-A5A7M37T.mjs} +43 -45
  68. package/dist/lib/node-esm/chunk-A5A7M37T.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-CVXULIYC.mjs +20 -0
  70. package/dist/lib/node-esm/chunk-CVXULIYC.mjs.map +7 -0
  71. package/dist/lib/node-esm/{chunk-3D4NGZPW.mjs → chunk-FB5YNROS.mjs} +195 -196
  72. package/dist/lib/node-esm/chunk-FB5YNROS.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-NYSDQPNM.mjs +716 -0
  74. package/dist/lib/node-esm/chunk-NYSDQPNM.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-PG7DNOEX.mjs +15 -0
  76. package/dist/lib/node-esm/chunk-PG7DNOEX.mjs.map +7 -0
  77. package/dist/lib/node-esm/{chunk-BDEFTL6K.mjs → chunk-SL4BJSUG.mjs} +1 -1
  78. package/dist/lib/node-esm/chunk-SL4BJSUG.mjs.map +7 -0
  79. package/dist/lib/node-esm/cli/index.mjs +852 -0
  80. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  81. package/dist/lib/node-esm/identity-created-2SJABVJD.mjs +25 -0
  82. package/dist/lib/node-esm/identity-created-2SJABVJD.mjs.map +7 -0
  83. package/dist/lib/node-esm/index.mjs +215 -189
  84. package/dist/lib/node-esm/index.mjs.map +4 -4
  85. package/dist/lib/node-esm/meta.json +1 -1
  86. package/dist/lib/node-esm/operation-resolver-2K7N4KYC.mjs +831 -0
  87. package/dist/lib/node-esm/operation-resolver-2K7N4KYC.mjs.map +7 -0
  88. package/dist/lib/node-esm/react-root-GIQAKDQ2.mjs +31 -0
  89. package/dist/lib/node-esm/react-root-GIQAKDQ2.mjs.map +7 -0
  90. package/dist/lib/node-esm/react-surface-KWP2DNFG.mjs +384 -0
  91. package/dist/lib/node-esm/react-surface-KWP2DNFG.mjs.map +7 -0
  92. package/dist/lib/node-esm/{repair-EHZS6MFY.mjs → repair-C2H6JQCL.mjs} +16 -10
  93. package/dist/lib/node-esm/repair-C2H6JQCL.mjs.map +7 -0
  94. package/dist/lib/node-esm/settings-VCPCNBOY.mjs +35 -0
  95. package/dist/lib/node-esm/settings-VCPCNBOY.mjs.map +7 -0
  96. package/dist/lib/node-esm/spaces-ready-5JOGEWON.mjs +244 -0
  97. package/dist/lib/node-esm/spaces-ready-5JOGEWON.mjs.map +7 -0
  98. package/dist/lib/node-esm/state-5MCEPWN3.mjs +59 -0
  99. package/dist/lib/node-esm/state-5MCEPWN3.mjs.map +7 -0
  100. package/dist/lib/node-esm/types/index.mjs +10 -8
  101. package/dist/types/src/SpacePlugin.d.ts +3 -15
  102. package/dist/types/src/SpacePlugin.d.ts.map +1 -1
  103. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +7 -0
  104. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  106. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
  108. package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
  109. package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
  110. package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/identity-created/identity-created.d.ts +5 -0
  112. package/dist/types/src/capabilities/identity-created/identity-created.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/identity-created/index.d.ts +3 -0
  114. package/dist/types/src/capabilities/identity-created/index.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/index.d.ts +10 -20
  116. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/operation-resolver/index.d.ts +6 -0
  118. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +9 -0
  120. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  121. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  122. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  123. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  124. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  125. package/dist/types/src/capabilities/react-surface/index.d.ts +5 -0
  126. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  127. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +8 -0
  128. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  129. package/dist/types/src/capabilities/repair/index.d.ts +3 -0
  130. package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
  131. package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
  132. package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
  133. package/dist/types/src/capabilities/settings/index.d.ts +7 -0
  134. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  135. package/dist/types/src/capabilities/settings/settings.d.ts +10 -0
  136. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  137. package/dist/types/src/capabilities/spaces-ready/index.d.ts +3 -0
  138. package/dist/types/src/capabilities/spaces-ready/index.d.ts.map +1 -0
  139. package/dist/types/src/capabilities/spaces-ready/spaces-ready.d.ts +5 -0
  140. package/dist/types/src/capabilities/spaces-ready/spaces-ready.d.ts.map +1 -0
  141. package/dist/types/src/capabilities/state/index.d.ts +13 -0
  142. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  143. package/dist/types/src/capabilities/state/state.d.ts +17 -0
  144. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  145. package/dist/types/src/cli/commands/database/add.d.ts +17 -0
  146. package/dist/types/src/cli/commands/database/add.d.ts.map +1 -0
  147. package/dist/types/src/cli/commands/database/index.d.ts +3 -0
  148. package/dist/types/src/cli/commands/database/index.d.ts.map +1 -0
  149. package/dist/types/src/cli/commands/database/query/index.d.ts +2 -0
  150. package/dist/types/src/cli/commands/database/query/index.d.ts.map +1 -0
  151. package/dist/types/src/cli/commands/database/query/query.d.ts +13 -0
  152. package/dist/types/src/cli/commands/database/query/query.d.ts.map +1 -0
  153. package/dist/types/src/cli/commands/database/query/query.test.d.ts +2 -0
  154. package/dist/types/src/cli/commands/database/query/query.test.d.ts.map +1 -0
  155. package/dist/types/src/cli/commands/database/remove.d.ts +9 -0
  156. package/dist/types/src/cli/commands/database/remove.d.ts.map +1 -0
  157. package/dist/types/src/cli/commands/database/stats.d.ts +6 -0
  158. package/dist/types/src/cli/commands/database/stats.d.ts.map +1 -0
  159. package/dist/types/src/cli/commands/database/util.d.ts +14 -0
  160. package/dist/types/src/cli/commands/database/util.d.ts.map +1 -0
  161. package/dist/types/src/cli/commands/index.d.ts +4 -0
  162. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  163. package/dist/types/src/cli/commands/queue/index.d.ts +7 -0
  164. package/dist/types/src/cli/commands/queue/index.d.ts.map +1 -0
  165. package/dist/types/src/cli/commands/queue/query.d.ts +8 -0
  166. package/dist/types/src/cli/commands/queue/query.d.ts.map +1 -0
  167. package/dist/types/src/cli/commands/queue/util.d.ts +6 -0
  168. package/dist/types/src/cli/commands/queue/util.d.ts.map +1 -0
  169. package/dist/types/src/cli/commands/space/close/close.d.ts +12 -0
  170. package/dist/types/src/cli/commands/space/close/close.d.ts.map +1 -0
  171. package/dist/types/src/cli/commands/space/close/index.d.ts +2 -0
  172. package/dist/types/src/cli/commands/space/close/index.d.ts.map +1 -0
  173. package/dist/types/src/cli/commands/space/create/create.d.ts +12 -0
  174. package/dist/types/src/cli/commands/space/create/create.d.ts.map +1 -0
  175. package/dist/types/src/cli/commands/space/create/create.test.d.ts +2 -0
  176. package/dist/types/src/cli/commands/space/create/create.test.d.ts.map +1 -0
  177. package/dist/types/src/cli/commands/space/create/index.d.ts +2 -0
  178. package/dist/types/src/cli/commands/space/create/index.d.ts.map +1 -0
  179. package/dist/types/src/cli/commands/space/index.d.ts +31 -0
  180. package/dist/types/src/cli/commands/space/index.d.ts.map +1 -0
  181. package/dist/types/src/cli/commands/space/info/index.d.ts +2 -0
  182. package/dist/types/src/cli/commands/space/info/index.d.ts.map +1 -0
  183. package/dist/types/src/cli/commands/space/info/info.d.ts +13 -0
  184. package/dist/types/src/cli/commands/space/info/info.d.ts.map +1 -0
  185. package/dist/types/src/cli/commands/space/info/info.test.d.ts +2 -0
  186. package/dist/types/src/cli/commands/space/info/info.test.d.ts.map +1 -0
  187. package/dist/types/src/cli/commands/space/join/index.d.ts +2 -0
  188. package/dist/types/src/cli/commands/space/join/index.d.ts.map +1 -0
  189. package/dist/types/src/cli/commands/space/join/join.d.ts +14 -0
  190. package/dist/types/src/cli/commands/space/join/join.d.ts.map +1 -0
  191. package/dist/types/src/cli/commands/space/join/util.d.ts +17 -0
  192. package/dist/types/src/cli/commands/space/join/util.d.ts.map +1 -0
  193. package/dist/types/src/cli/commands/space/list/index.d.ts +2 -0
  194. package/dist/types/src/cli/commands/space/list/index.d.ts.map +1 -0
  195. package/dist/types/src/cli/commands/space/list/list.d.ts +7 -0
  196. package/dist/types/src/cli/commands/space/list/list.d.ts.map +1 -0
  197. package/dist/types/src/cli/commands/space/list/list.test.d.ts +2 -0
  198. package/dist/types/src/cli/commands/space/list/list.test.d.ts.map +1 -0
  199. package/dist/types/src/cli/commands/space/members/index.d.ts +2 -0
  200. package/dist/types/src/cli/commands/space/members/index.d.ts.map +1 -0
  201. package/dist/types/src/cli/commands/space/members/members.d.ts +13 -0
  202. package/dist/types/src/cli/commands/space/members/members.d.ts.map +1 -0
  203. package/dist/types/src/cli/commands/space/members/members.test.d.ts +2 -0
  204. package/dist/types/src/cli/commands/space/members/members.test.d.ts.map +1 -0
  205. package/dist/types/src/cli/commands/space/members/util.d.ts +9 -0
  206. package/dist/types/src/cli/commands/space/members/util.d.ts.map +1 -0
  207. package/dist/types/src/cli/commands/space/open/index.d.ts +2 -0
  208. package/dist/types/src/cli/commands/space/open/index.d.ts.map +1 -0
  209. package/dist/types/src/cli/commands/space/open/open.d.ts +12 -0
  210. package/dist/types/src/cli/commands/space/open/open.d.ts.map +1 -0
  211. package/dist/types/src/cli/commands/space/schema/index.d.ts +8 -0
  212. package/dist/types/src/cli/commands/space/schema/index.d.ts.map +1 -0
  213. package/dist/types/src/cli/commands/space/schema/list/index.d.ts +2 -0
  214. package/dist/types/src/cli/commands/space/schema/list/index.d.ts.map +1 -0
  215. package/dist/types/src/cli/commands/space/schema/list/list.d.ts +15 -0
  216. package/dist/types/src/cli/commands/space/schema/list/list.d.ts.map +1 -0
  217. package/dist/types/src/cli/commands/space/schema/list/list.test.d.ts +2 -0
  218. package/dist/types/src/cli/commands/space/schema/list/list.test.d.ts.map +1 -0
  219. package/dist/types/src/cli/commands/space/schema/list/util.d.ts +15 -0
  220. package/dist/types/src/cli/commands/space/schema/list/util.d.ts.map +1 -0
  221. package/dist/types/src/cli/commands/space/share/index.d.ts +2 -0
  222. package/dist/types/src/cli/commands/space/share/index.d.ts.map +1 -0
  223. package/dist/types/src/cli/commands/space/share/share.d.ts +19 -0
  224. package/dist/types/src/cli/commands/space/share/share.d.ts.map +1 -0
  225. package/dist/types/src/cli/commands/space/sync/index.d.ts +2 -0
  226. package/dist/types/src/cli/commands/space/sync/index.d.ts.map +1 -0
  227. package/dist/types/src/cli/commands/space/sync/sync.d.ts +6 -0
  228. package/dist/types/src/cli/commands/space/sync/sync.d.ts.map +1 -0
  229. package/dist/types/src/cli/commands/space/sync/sync.test.d.ts +2 -0
  230. package/dist/types/src/cli/commands/space/sync/sync.test.d.ts.map +1 -0
  231. package/dist/types/src/cli/index.d.ts +2 -0
  232. package/dist/types/src/cli/index.d.ts.map +1 -0
  233. package/dist/types/src/cli/plugin.d.ts +4 -0
  234. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  235. package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
  236. package/dist/types/src/components/CollectionArticle.d.ts +6 -3
  237. package/dist/types/src/components/CollectionArticle.d.ts.map +1 -1
  238. package/dist/types/src/components/CollectionSection.d.ts +1 -1
  239. package/dist/types/src/components/CollectionSection.d.ts.map +1 -1
  240. package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +2 -2
  241. package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
  242. package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +17 -7
  243. package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
  244. package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +9 -5
  245. package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
  246. package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
  247. package/dist/types/src/components/JoinDialog/JoinDialog.d.ts.map +1 -1
  248. package/dist/types/src/components/MembersContainer/MembersContainer.d.ts.map +1 -1
  249. package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts +11 -2
  250. package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts.map +1 -1
  251. package/dist/types/src/components/MenuFooter.d.ts +1 -1
  252. package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
  253. package/dist/types/src/components/ObjectCardStack/ObjectCardStack.d.ts +1 -1
  254. package/dist/types/src/components/ObjectCardStack/ObjectCardStack.d.ts.map +1 -1
  255. package/dist/types/src/components/ObjectCardStack/ObjectForm.d.ts +1 -1
  256. package/dist/types/src/components/ObjectCardStack/ObjectForm.d.ts.map +1 -1
  257. package/dist/types/src/components/ObjectDetails/BaseObjectSettings.d.ts +1 -1
  258. package/dist/types/src/components/ObjectDetails/BaseObjectSettings.d.ts.map +1 -1
  259. package/dist/types/src/components/ObjectDetails/BaseObjectSettings.stories.d.ts +9 -0
  260. package/dist/types/src/components/ObjectDetails/BaseObjectSettings.stories.d.ts.map +1 -1
  261. package/dist/types/src/components/ObjectDetails/ObjectDetails.d.ts +6 -5
  262. package/dist/types/src/components/ObjectDetails/ObjectDetails.d.ts.map +1 -1
  263. package/dist/types/src/components/ObjectRenamePopover/ObjectRenamePopover.d.ts +1 -1
  264. package/dist/types/src/components/ObjectRenamePopover/ObjectRenamePopover.d.ts.map +1 -1
  265. package/dist/types/src/components/RecordArticle.d.ts +2 -2
  266. package/dist/types/src/components/RecordArticle.d.ts.map +1 -1
  267. package/dist/types/src/components/RecordArticle.stories.d.ts +11 -2
  268. package/dist/types/src/components/RecordArticle.stories.d.ts.map +1 -1
  269. package/dist/types/src/components/SchemaContainer.d.ts.map +1 -1
  270. package/dist/types/src/components/SpacePluginSettings.d.ts +4 -2
  271. package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
  272. package/dist/types/src/components/SpacePresence/SpacePresence.d.ts +4 -4
  273. package/dist/types/src/components/SpacePresence/SpacePresence.d.ts.map +1 -1
  274. package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts +9 -0
  275. package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts.map +1 -1
  276. package/dist/types/src/components/SpaceRenamePopover/SpaceRenamePopover.d.ts.map +1 -1
  277. package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts +4 -1
  278. package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
  279. package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +13 -1
  280. package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
  281. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +9 -0
  282. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
  283. package/dist/types/src/components/ViewEditor.d.ts.map +1 -1
  284. package/dist/types/src/components/index.d.ts +11 -6
  285. package/dist/types/src/components/index.d.ts.map +1 -1
  286. package/dist/types/src/constants.d.ts +6 -0
  287. package/dist/types/src/constants.d.ts.map +1 -0
  288. package/dist/types/src/helpers/query.d.ts +3 -3
  289. package/dist/types/src/helpers/query.d.ts.map +1 -1
  290. package/dist/types/src/hooks/useActiveSpace.d.ts +2 -2
  291. package/dist/types/src/hooks/useActiveSpace.d.ts.map +1 -1
  292. package/dist/types/src/hooks/usePath.d.ts +2 -2
  293. package/dist/types/src/hooks/usePath.d.ts.map +1 -1
  294. package/dist/types/src/index.d.ts +1 -2
  295. package/dist/types/src/index.d.ts.map +1 -1
  296. package/dist/types/src/meta.d.ts +2 -2
  297. package/dist/types/src/meta.d.ts.map +1 -1
  298. package/dist/types/src/translations.d.ts +9 -0
  299. package/dist/types/src/translations.d.ts.map +1 -1
  300. package/dist/types/src/types/capabilities.d.ts +71 -0
  301. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  302. package/dist/types/src/types/events.d.ts +9 -0
  303. package/dist/types/src/types/events.d.ts.map +1 -0
  304. package/dist/types/src/types/index.d.ts +2 -0
  305. package/dist/types/src/types/index.d.ts.map +1 -1
  306. package/dist/types/src/types/types.d.ts +643 -354
  307. package/dist/types/src/types/types.d.ts.map +1 -1
  308. package/dist/types/src/util.d.ts +36 -31
  309. package/dist/types/src/util.d.ts.map +1 -1
  310. package/dist/types/tsconfig.tsbuildinfo +1 -1
  311. package/package.json +83 -69
  312. package/src/SpacePlugin.ts +174 -194
  313. package/src/capabilities/app-graph-builder/app-graph-builder.ts +621 -0
  314. package/src/capabilities/app-graph-builder/index.ts +7 -0
  315. package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +83 -0
  316. package/src/capabilities/app-graph-serializer/index.ts +7 -0
  317. package/src/capabilities/identity-created/identity-created.ts +29 -0
  318. package/src/capabilities/identity-created/index.ts +7 -0
  319. package/src/capabilities/index.ts +10 -14
  320. package/src/capabilities/operation-resolver/index.ts +7 -0
  321. package/src/capabilities/operation-resolver/operation-resolver.ts +762 -0
  322. package/src/capabilities/react-root/index.ts +7 -0
  323. package/src/capabilities/react-root/react-root.tsx +25 -0
  324. package/src/capabilities/react-surface/index.ts +7 -0
  325. package/src/capabilities/react-surface/react-surface.tsx +377 -0
  326. package/src/capabilities/repair/index.ts +7 -0
  327. package/src/capabilities/{repair.ts → repair/repair.ts} +21 -11
  328. package/src/capabilities/settings/index.ts +7 -0
  329. package/src/capabilities/settings/settings.ts +33 -0
  330. package/src/capabilities/spaces-ready/index.ts +7 -0
  331. package/src/capabilities/spaces-ready/spaces-ready.ts +290 -0
  332. package/src/capabilities/state/index.ts +7 -0
  333. package/src/capabilities/state/state.ts +64 -0
  334. package/src/cli/commands/database/add.ts +115 -0
  335. package/src/cli/commands/database/index.ts +16 -0
  336. package/src/cli/commands/database/query/index.ts +5 -0
  337. package/src/cli/commands/database/query/query.test.ts +55 -0
  338. package/src/cli/commands/database/query/query.ts +44 -0
  339. package/src/cli/commands/database/remove.ts +51 -0
  340. package/src/cli/commands/database/stats.ts +44 -0
  341. package/src/cli/commands/database/util.ts +32 -0
  342. package/src/cli/commands/index.ts +7 -0
  343. package/src/cli/commands/queue/index.ts +12 -0
  344. package/src/cli/commands/queue/query.ts +45 -0
  345. package/src/cli/commands/queue/util.ts +19 -0
  346. package/src/cli/commands/space/close/close.ts +40 -0
  347. package/src/cli/commands/space/close/index.ts +5 -0
  348. package/src/cli/commands/space/create/create.test.ts +67 -0
  349. package/src/cli/commands/space/create/create.ts +61 -0
  350. package/src/cli/commands/space/create/index.ts +5 -0
  351. package/src/cli/commands/space/index.ts +21 -0
  352. package/src/cli/commands/space/info/index.ts +5 -0
  353. package/src/cli/commands/space/info/info.test.ts +47 -0
  354. package/src/cli/commands/space/info/info.ts +37 -0
  355. package/src/cli/commands/space/join/index.ts +5 -0
  356. package/src/cli/commands/space/join/join.ts +122 -0
  357. package/src/cli/commands/space/join/util.ts +82 -0
  358. package/src/cli/commands/space/list/index.ts +5 -0
  359. package/src/cli/commands/space/list/list.test.ts +36 -0
  360. package/src/cli/commands/space/list/list.ts +30 -0
  361. package/src/cli/commands/space/members/index.ts +5 -0
  362. package/src/cli/commands/space/members/members.test.ts +46 -0
  363. package/src/cli/commands/space/members/members.ts +40 -0
  364. package/src/cli/commands/space/members/util.ts +29 -0
  365. package/src/cli/commands/space/open/index.ts +5 -0
  366. package/src/cli/commands/space/open/open.ts +39 -0
  367. package/src/cli/commands/space/schema/index.ts +12 -0
  368. package/src/cli/commands/space/schema/list/index.ts +5 -0
  369. package/src/cli/commands/space/schema/list/list.test.ts +42 -0
  370. package/src/cli/commands/space/schema/list/list.ts +64 -0
  371. package/src/cli/commands/space/schema/list/util.ts +39 -0
  372. package/src/cli/commands/space/share/index.ts +5 -0
  373. package/src/cli/commands/space/share/share.ts +112 -0
  374. package/src/cli/commands/space/sync/index.ts +5 -0
  375. package/src/cli/commands/space/sync/sync.test.ts +12 -0
  376. package/src/cli/commands/space/sync/sync.ts +33 -0
  377. package/src/cli/index.ts +5 -0
  378. package/src/cli/plugin.ts +88 -0
  379. package/src/components/AwaitingObject.tsx +14 -10
  380. package/src/components/CollectionArticle.tsx +142 -19
  381. package/src/components/CollectionSection.tsx +1 -1
  382. package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +28 -22
  383. package/src/components/CreateDialog/CreateObjectDialog.tsx +55 -60
  384. package/src/components/CreateDialog/CreateObjectPanel.tsx +102 -52
  385. package/src/components/CreateDialog/CreateSpaceDialog.tsx +34 -51
  386. package/src/components/JoinDialog/JoinDialog.tsx +26 -52
  387. package/src/components/MembersContainer/MembersContainer.stories.tsx +3 -3
  388. package/src/components/MembersContainer/MembersContainer.tsx +76 -81
  389. package/src/components/MenuFooter.tsx +1 -1
  390. package/src/components/ObjectCardStack/ObjectCardStack.tsx +13 -10
  391. package/src/components/ObjectCardStack/ObjectForm.tsx +34 -27
  392. package/src/components/ObjectDetails/BaseObjectSettings.stories.tsx +8 -8
  393. package/src/components/ObjectDetails/BaseObjectSettings.tsx +35 -31
  394. package/src/components/ObjectDetails/ObjectDetails.tsx +9 -11
  395. package/src/components/ObjectRenamePopover/ObjectRenamePopover.tsx +9 -13
  396. package/src/components/RecordArticle.stories.tsx +14 -13
  397. package/src/components/RecordArticle.tsx +47 -37
  398. package/src/components/SchemaContainer.tsx +20 -17
  399. package/src/components/SpacePluginSettings.tsx +42 -35
  400. package/src/components/SpacePresence/SpacePresence.stories.tsx +1 -1
  401. package/src/components/SpacePresence/SpacePresence.tsx +15 -16
  402. package/src/components/SpaceRenamePopover/SpaceRenamePopover.tsx +11 -12
  403. package/src/components/SpaceSettings/SpaceSettingsContainer.stories.tsx +5 -5
  404. package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +165 -182
  405. package/src/components/SyncStatus/InlineSyncStatus.tsx +1 -1
  406. package/src/components/SyncStatus/SyncStatus.stories.tsx +1 -1
  407. package/src/components/SyncStatus/SyncStatus.tsx +1 -1
  408. package/src/components/SyncStatus/save-tracker.ts +2 -2
  409. package/src/components/ViewEditor.tsx +16 -12
  410. package/src/constants.ts +11 -0
  411. package/src/helpers/query.ts +7 -6
  412. package/src/hooks/useActiveSpace.ts +8 -5
  413. package/src/hooks/useInputSurfaceLookup.tsx +3 -3
  414. package/src/hooks/usePath.ts +4 -4
  415. package/src/index.ts +1 -2
  416. package/src/meta.ts +2 -2
  417. package/src/translations.ts +4 -2
  418. package/src/types/capabilities.ts +73 -0
  419. package/src/types/events.ts +16 -0
  420. package/src/types/index.ts +2 -0
  421. package/src/types/types.ts +533 -245
  422. package/src/util.tsx +222 -230
  423. package/dist/lib/browser/CollectionArticle-WTHWY4YS.mjs +0 -31
  424. package/dist/lib/browser/CollectionArticle-WTHWY4YS.mjs.map +0 -7
  425. package/dist/lib/browser/ObjectCardStack-TE7AWPMH.mjs +0 -144
  426. package/dist/lib/browser/ObjectCardStack-TE7AWPMH.mjs.map +0 -7
  427. package/dist/lib/browser/ObjectDetails-666IBRHE.mjs +0 -144
  428. package/dist/lib/browser/ObjectDetails-666IBRHE.mjs.map +0 -7
  429. package/dist/lib/browser/RecordArticle-2PFEBPXY.mjs +0 -116
  430. package/dist/lib/browser/RecordArticle-2PFEBPXY.mjs.map +0 -7
  431. package/dist/lib/browser/app-graph-builder-USKWFIDK.mjs +0 -551
  432. package/dist/lib/browser/app-graph-builder-USKWFIDK.mjs.map +0 -7
  433. package/dist/lib/browser/app-graph-serializer-SXIQ425K.mjs +0 -80
  434. package/dist/lib/browser/app-graph-serializer-SXIQ425K.mjs.map +0 -7
  435. package/dist/lib/browser/chunk-5CSSKOWR.mjs.map +0 -7
  436. package/dist/lib/browser/chunk-C6DAPIFF.mjs +0 -20
  437. package/dist/lib/browser/chunk-C6DAPIFF.mjs.map +0 -7
  438. package/dist/lib/browser/chunk-E4BEMEZ3.mjs +0 -399
  439. package/dist/lib/browser/chunk-E4BEMEZ3.mjs.map +0 -7
  440. package/dist/lib/browser/chunk-IJCMB5B5.mjs.map +0 -7
  441. package/dist/lib/browser/chunk-POFUXISV.mjs.map +0 -7
  442. package/dist/lib/browser/chunk-VZBIIYFM.mjs.map +0 -7
  443. package/dist/lib/browser/chunk-WJXU4GKV.mjs +0 -19
  444. package/dist/lib/browser/chunk-WJXU4GKV.mjs.map +0 -7
  445. package/dist/lib/browser/chunk-XKQCDLXX.mjs +0 -2103
  446. package/dist/lib/browser/chunk-XKQCDLXX.mjs.map +0 -7
  447. package/dist/lib/browser/identity-created-NAXTPQXE.mjs +0 -23
  448. package/dist/lib/browser/identity-created-NAXTPQXE.mjs.map +0 -7
  449. package/dist/lib/browser/intent-resolver-QEIM7NQT.mjs +0 -769
  450. package/dist/lib/browser/intent-resolver-QEIM7NQT.mjs.map +0 -7
  451. package/dist/lib/browser/react-root-T6ZETLD2.mjs +0 -30
  452. package/dist/lib/browser/react-root-T6ZETLD2.mjs.map +0 -7
  453. package/dist/lib/browser/react-surface-MLN5BZ2G.mjs +0 -374
  454. package/dist/lib/browser/react-surface-MLN5BZ2G.mjs.map +0 -7
  455. package/dist/lib/browser/repair-CNLE35NF.mjs.map +0 -7
  456. package/dist/lib/browser/settings-EGTCHS7U.mjs +0 -24
  457. package/dist/lib/browser/settings-EGTCHS7U.mjs.map +0 -7
  458. package/dist/lib/browser/spaces-ready-YS4BBZXW.mjs +0 -208
  459. package/dist/lib/browser/spaces-ready-YS4BBZXW.mjs.map +0 -7
  460. package/dist/lib/browser/state-C7N6EDDZ.mjs +0 -47
  461. package/dist/lib/browser/state-C7N6EDDZ.mjs.map +0 -7
  462. package/dist/lib/node-esm/CollectionArticle-KHXYT3SH.mjs +0 -32
  463. package/dist/lib/node-esm/CollectionArticle-KHXYT3SH.mjs.map +0 -7
  464. package/dist/lib/node-esm/ObjectCardStack-AAKMAQ6T.mjs +0 -145
  465. package/dist/lib/node-esm/ObjectCardStack-AAKMAQ6T.mjs.map +0 -7
  466. package/dist/lib/node-esm/ObjectDetails-TZ5YKXGN.mjs +0 -145
  467. package/dist/lib/node-esm/ObjectDetails-TZ5YKXGN.mjs.map +0 -7
  468. package/dist/lib/node-esm/RecordArticle-SSJ7PULS.mjs +0 -117
  469. package/dist/lib/node-esm/RecordArticle-SSJ7PULS.mjs.map +0 -7
  470. package/dist/lib/node-esm/app-graph-builder-QRQ5EQLB.mjs +0 -552
  471. package/dist/lib/node-esm/app-graph-builder-QRQ5EQLB.mjs.map +0 -7
  472. package/dist/lib/node-esm/app-graph-serializer-P2X4W7LI.mjs +0 -81
  473. package/dist/lib/node-esm/app-graph-serializer-P2X4W7LI.mjs.map +0 -7
  474. package/dist/lib/node-esm/chunk-3D4NGZPW.mjs.map +0 -7
  475. package/dist/lib/node-esm/chunk-AX3UGL5D.mjs.map +0 -7
  476. package/dist/lib/node-esm/chunk-BDEFTL6K.mjs.map +0 -7
  477. package/dist/lib/node-esm/chunk-H4JILUJK.mjs +0 -20
  478. package/dist/lib/node-esm/chunk-H4JILUJK.mjs.map +0 -7
  479. package/dist/lib/node-esm/chunk-QQQE2ZCX.mjs +0 -400
  480. package/dist/lib/node-esm/chunk-QQQE2ZCX.mjs.map +0 -7
  481. package/dist/lib/node-esm/chunk-UMZ7G6G4.mjs.map +0 -7
  482. package/dist/lib/node-esm/chunk-WWGV5FJM.mjs +0 -21
  483. package/dist/lib/node-esm/chunk-WWGV5FJM.mjs.map +0 -7
  484. package/dist/lib/node-esm/chunk-XD532BVR.mjs +0 -2104
  485. package/dist/lib/node-esm/chunk-XD532BVR.mjs.map +0 -7
  486. package/dist/lib/node-esm/identity-created-OXLKCJE3.mjs +0 -25
  487. package/dist/lib/node-esm/identity-created-OXLKCJE3.mjs.map +0 -7
  488. package/dist/lib/node-esm/intent-resolver-ZWCBVABN.mjs +0 -770
  489. package/dist/lib/node-esm/intent-resolver-ZWCBVABN.mjs.map +0 -7
  490. package/dist/lib/node-esm/react-root-SKB4UJ4K.mjs +0 -31
  491. package/dist/lib/node-esm/react-root-SKB4UJ4K.mjs.map +0 -7
  492. package/dist/lib/node-esm/react-surface-BVZGNSBB.mjs +0 -375
  493. package/dist/lib/node-esm/react-surface-BVZGNSBB.mjs.map +0 -7
  494. package/dist/lib/node-esm/repair-EHZS6MFY.mjs.map +0 -7
  495. package/dist/lib/node-esm/settings-N3F6JCIR.mjs +0 -25
  496. package/dist/lib/node-esm/settings-N3F6JCIR.mjs.map +0 -7
  497. package/dist/lib/node-esm/spaces-ready-U2K5P4LB.mjs +0 -209
  498. package/dist/lib/node-esm/spaces-ready-U2K5P4LB.mjs.map +0 -7
  499. package/dist/lib/node-esm/state-45TXZQJ6.mjs +0 -48
  500. package/dist/lib/node-esm/state-45TXZQJ6.mjs.map +0 -7
  501. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  502. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  503. package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
  504. package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
  505. package/dist/types/src/capabilities/capabilities.d.ts +0 -34
  506. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  507. package/dist/types/src/capabilities/identity-created.d.ts +0 -4
  508. package/dist/types/src/capabilities/identity-created.d.ts.map +0 -1
  509. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -9
  510. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  511. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  512. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  513. package/dist/types/src/capabilities/react-surface.d.ts +0 -7
  514. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  515. package/dist/types/src/capabilities/repair.d.ts +0 -4
  516. package/dist/types/src/capabilities/repair.d.ts.map +0 -1
  517. package/dist/types/src/capabilities/settings.d.ts +0 -4
  518. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  519. package/dist/types/src/capabilities/spaces-ready.d.ts +0 -4
  520. package/dist/types/src/capabilities/spaces-ready.d.ts.map +0 -1
  521. package/dist/types/src/capabilities/state.d.ts +0 -5
  522. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  523. package/dist/types/src/events.d.ts +0 -8
  524. package/dist/types/src/events.d.ts.map +0 -1
  525. package/src/capabilities/app-graph-builder.ts +0 -724
  526. package/src/capabilities/app-graph-serializer.ts +0 -76
  527. package/src/capabilities/capabilities.ts +0 -40
  528. package/src/capabilities/identity-created.ts +0 -25
  529. package/src/capabilities/intent-resolver.ts +0 -705
  530. package/src/capabilities/react-root.tsx +0 -22
  531. package/src/capabilities/react-surface.tsx +0 -358
  532. package/src/capabilities/settings.ts +0 -21
  533. package/src/capabilities/spaces-ready.ts +0 -252
  534. package/src/capabilities/state.ts +0 -46
  535. package/src/events.ts +0 -15
@@ -0,0 +1,1889 @@
1
+ import {
2
+ useInputSurfaceLookup,
3
+ usePath,
4
+ useTypeOptions
5
+ } from "./chunk-A7ZCVQGZ.mjs";
6
+ import {
7
+ COMPOSER_SPACE_LOCK,
8
+ getSpaceDisplayName
9
+ } from "./chunk-WAOJLA2S.mjs";
10
+ import {
11
+ SpaceCapabilities,
12
+ SpaceForm,
13
+ SpaceOperation
14
+ } from "./chunk-KGLWYGIF.mjs";
15
+ import {
16
+ meta
17
+ } from "./chunk-HSMQFM57.mjs";
18
+
19
+ // src/components/AwaitingObject.tsx
20
+ import React, { useCallback, useEffect, useState } from "react";
21
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
22
+ import { LayoutOperation } from "@dxos/app-toolkit";
23
+ import { useLayout } from "@dxos/app-toolkit/ui";
24
+ import { Obj } from "@dxos/echo";
25
+ import { useClient } from "@dxos/react-client";
26
+ import { Filter, useQuery } from "@dxos/react-client/echo";
27
+ import { Button, Icon, Toast, useTranslation } from "@dxos/react-ui";
28
+ import { osTranslations } from "@dxos/ui-theme";
29
+ var WAIT_FOR_OBJECT_TIMEOUT = 3 * 60 * 1e3;
30
+ var TOAST_TIMEOUT = 4 * 60 * 1e3;
31
+ var AwaitingObject = ({ id }) => {
32
+ const { t } = useTranslation(meta.id);
33
+ const { invokePromise } = useOperationInvoker();
34
+ const [open, setOpen] = useState(true);
35
+ const [waiting, setWaiting] = useState(true);
36
+ const [found, setFound] = useState(false);
37
+ const layout = useLayout();
38
+ const client = useClient();
39
+ const objects = useQuery(client.spaces, Filter.everything());
40
+ useEffect(() => {
41
+ if (!id) {
42
+ return;
43
+ }
44
+ const timeout = setTimeout(() => setWaiting(false), WAIT_FOR_OBJECT_TIMEOUT);
45
+ return () => clearTimeout(timeout);
46
+ }, [
47
+ id
48
+ ]);
49
+ useEffect(() => {
50
+ if (objects.findIndex((object) => Obj.getDXN(object).toString() === 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 () => invokePromise(SpaceOperation.WaitForObject, {
62
+ id: void 0
63
+ }), [
64
+ invokePromise
65
+ ]);
66
+ const handleNavigate = useCallback(() => {
67
+ void invokePromise(LayoutOperation.Open, {
68
+ subject: [
69
+ id
70
+ ]
71
+ });
72
+ void handleClose();
73
+ }, [
74
+ id,
75
+ handleClose,
76
+ invokePromise
77
+ ]);
78
+ return /* @__PURE__ */ React.createElement(Toast.Root, {
79
+ open,
80
+ duration: TOAST_TIMEOUT,
81
+ onOpenChange: setOpen
82
+ }, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
83
+ classNames: "flex items-center gap-2"
84
+ }, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
85
+ icon: "ph--check-circle--regular",
86
+ size: 5
87
+ }), /* @__PURE__ */ React.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
88
+ icon: "ph--circle-notch--regular",
89
+ size: 5,
90
+ classNames: "animate-spin"
91
+ }), /* @__PURE__ */ React.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
92
+ icon: "ph--circle-dashed--regular",
93
+ size: 5
94
+ }), /* @__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, {
95
+ altText: t("go to object alt"),
96
+ asChild: true
97
+ }, /* @__PURE__ */ React.createElement(Button, {
98
+ variant: "primary",
99
+ onClick: handleNavigate
100
+ }, t("go to object label"))), /* @__PURE__ */ React.createElement(Toast.Close, {
101
+ asChild: true
102
+ }, /* @__PURE__ */ React.createElement(Button, {
103
+ onClick: handleClose
104
+ }, t("close label", {
105
+ ns: osTranslations
106
+ })))) : /* @__PURE__ */ React.createElement(Toast.Close, {
107
+ asChild: true
108
+ }, /* @__PURE__ */ React.createElement(Button, {
109
+ onClick: handleClose
110
+ }, t(waiting ? "close label" : "confirm label", {
111
+ ns: osTranslations
112
+ })))));
113
+ };
114
+
115
+ // src/components/CreateDialog/CreateObjectDialog.tsx
116
+ import * as Effect from "effect/Effect";
117
+ import React3, { useCallback as useCallback3, useMemo as useMemo2, useRef, useState as useState2 } from "react";
118
+ import { Capability } from "@dxos/app-framework";
119
+ import { useOperationInvoker as useOperationInvoker2, usePluginManager } from "@dxos/app-framework/ui";
120
+ import { AppCapabilities, LayoutOperation as LayoutOperation2 } from "@dxos/app-toolkit";
121
+ import { Database, Obj as Obj3, Type } from "@dxos/echo";
122
+ import { EntityKind, getTypeAnnotation as getTypeAnnotation2 } from "@dxos/echo/internal";
123
+ import { runAndForwardErrors } from "@dxos/effect";
124
+ import { invariant } from "@dxos/invariant";
125
+ import { Operation } from "@dxos/operation";
126
+ import { useClient as useClient2 } from "@dxos/react-client";
127
+ import { useSpaces } from "@dxos/react-client/echo";
128
+ import { Dialog, useTranslation as useTranslation3 } from "@dxos/react-ui";
129
+
130
+ // src/components/CreateDialog/CreateObjectPanel.tsx
131
+ import * as Option from "effect/Option";
132
+ import React2, { useCallback as useCallback2, useMemo } from "react";
133
+ import { Obj as Obj2 } from "@dxos/echo";
134
+ import { getTypeAnnotation } from "@dxos/echo/internal";
135
+ import { toLocalizedString, useDefaultValue, useTranslation as useTranslation2 } from "@dxos/react-ui";
136
+ import { Form, omitId } from "@dxos/react-ui-form";
137
+ import { SearchList, useSearchListResults } from "@dxos/react-ui-searchlist";
138
+ import { ViewAnnotation } from "@dxos/schema";
139
+ import { isNonNullable } from "@dxos/util";
140
+ var CreateObjectPanel = ({ schemas, spaces, typename, target, views, initialFormValues: _initialFormValues, defaultSpaceId, resolve, onTargetChange, onTypenameChange, onCreateObject }) => {
141
+ const { t } = useTranslation2(meta.id);
142
+ const initialFormValues = useDefaultValue(_initialFormValues, () => ({}));
143
+ const metadata = typename && resolve?.(typename);
144
+ const options = schemas.filter((schema) => {
145
+ if (views == null) {
146
+ return true;
147
+ } else {
148
+ return views === ViewAnnotation.get(schema).pipe(Option.getOrElse(() => false));
149
+ }
150
+ }).map((schema) => getTypeAnnotation(schema)).filter(isNonNullable).sort((a, b) => {
151
+ const nameA = t("typename label", {
152
+ ns: a.typename,
153
+ defaultValue: a.typename
154
+ });
155
+ const nameB = t("typename label", {
156
+ ns: b.typename,
157
+ defaultValue: b.typename
158
+ });
159
+ return nameA.localeCompare(nameB);
160
+ });
161
+ const handleCreateObject = useCallback2(async (props) => {
162
+ if (!metadata) {
163
+ return;
164
+ }
165
+ await onCreateObject?.({
166
+ metadata,
167
+ data: props
168
+ });
169
+ }, [
170
+ onCreateObject,
171
+ metadata
172
+ ]);
173
+ const handleSetTypename = useCallback2(async (typename2) => {
174
+ const metadata2 = resolve?.(typename2);
175
+ if (metadata2 && !metadata2.inputSchema) {
176
+ await onCreateObject?.({
177
+ metadata: metadata2
178
+ });
179
+ } else {
180
+ onTypenameChange?.(typename2);
181
+ }
182
+ }, [
183
+ resolve,
184
+ onCreateObject
185
+ ]);
186
+ const inputSurfaceLookup = useInputSurfaceLookup({
187
+ target
188
+ });
189
+ return !metadata ? /* @__PURE__ */ React2.createElement(SelectSchema, {
190
+ options,
191
+ resolve,
192
+ onChange: handleSetTypename
193
+ }) : !target ? /* @__PURE__ */ React2.createElement(SelectSpace, {
194
+ spaces,
195
+ defaultSpaceId,
196
+ onChange: onTargetChange
197
+ }) : metadata.inputSchema ? /* @__PURE__ */ React2.createElement(Form.Root, {
198
+ testId: "create-object-form",
199
+ autoFocus: true,
200
+ schema: omitId(metadata.inputSchema),
201
+ values: initialFormValues,
202
+ db: Obj2.isObject(target) ? Obj2.getDatabase(target) : target,
203
+ fieldProvider: inputSurfaceLookup,
204
+ onSave: handleCreateObject
205
+ }, /* @__PURE__ */ React2.createElement(Form.Viewport, null, /* @__PURE__ */ React2.createElement(Form.Content, null, /* @__PURE__ */ React2.createElement(Form.FieldSet, null), /* @__PURE__ */ React2.createElement(Form.Submit, null)))) : null;
206
+ };
207
+ CreateObjectPanel.displayName = "CreateObjectPanel";
208
+ var SelectSpace = ({ spaces, defaultSpaceId, onChange }) => {
209
+ const { t } = useTranslation2(meta.id);
210
+ const sortedSpaces = useMemo(() => [
211
+ ...spaces
212
+ ].sort((a, b) => {
213
+ const labelA = toLocalizedString(getSpaceDisplayName(a, {
214
+ personal: a.id === defaultSpaceId
215
+ }), t);
216
+ const labelB = toLocalizedString(getSpaceDisplayName(b, {
217
+ personal: b.id === defaultSpaceId
218
+ }), t);
219
+ return labelA.localeCompare(labelB);
220
+ }), [
221
+ spaces,
222
+ defaultSpaceId,
223
+ t
224
+ ]);
225
+ const { results, handleSearch } = useSearchListResults({
226
+ items: sortedSpaces,
227
+ extract: (space) => toLocalizedString(getSpaceDisplayName(space, {
228
+ personal: space.id === defaultSpaceId
229
+ }), t)
230
+ });
231
+ return /* @__PURE__ */ React2.createElement(SearchList.Root, {
232
+ onSearch: handleSearch
233
+ }, /* @__PURE__ */ React2.createElement(SearchList.Content, null, /* @__PURE__ */ React2.createElement(SearchList.Input, {
234
+ autoFocus: true,
235
+ "data-testid": "create-object-form.space-input",
236
+ placeholder: t("space input placeholder")
237
+ }), /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((space) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
238
+ key: space.id,
239
+ value: space.id,
240
+ label: toLocalizedString(getSpaceDisplayName(space, {
241
+ personal: space.id === defaultSpaceId
242
+ }), t),
243
+ onSelect: () => onChange?.(space.db),
244
+ classNames: "flex items-center gap-2"
245
+ })))));
246
+ };
247
+ var SelectSchema = ({ options, resolve, onChange }) => {
248
+ const { t } = useTranslation2(meta.id);
249
+ const { results, handleSearch } = useSearchListResults({
250
+ items: options,
251
+ extract: (option) => t("typename label", {
252
+ ns: option.typename,
253
+ defaultValue: option.typename
254
+ })
255
+ });
256
+ return /* @__PURE__ */ React2.createElement(SearchList.Root, {
257
+ onSearch: handleSearch
258
+ }, /* @__PURE__ */ React2.createElement(SearchList.Content, null, /* @__PURE__ */ React2.createElement(SearchList.Input, {
259
+ autoFocus: true,
260
+ "data-testid": "create-object-form.schema-input",
261
+ placeholder: t("schema input placeholder")
262
+ }), /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((option) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
263
+ key: option.typename,
264
+ value: option.typename,
265
+ label: t("typename label", {
266
+ ns: option.typename,
267
+ defaultValue: option.typename
268
+ }),
269
+ icon: resolve?.(option.typename)?.icon ?? "ph--placeholder--regular",
270
+ onSelect: () => onChange(option.typename),
271
+ classNames: "flex items-center gap-2"
272
+ })))));
273
+ };
274
+
275
+ // src/components/CreateDialog/CreateObjectDialog.tsx
276
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx";
277
+ var CREATE_OBJECT_DIALOG = `${meta.id}/CreateObjectDialog`;
278
+ var CreateObjectDialog = ({ target: initialTarget, typename: initialTypename, views, initialFormValues, onCreateObject, shouldNavigate: _shouldNavigate }) => {
279
+ const manager = usePluginManager();
280
+ const { t } = useTranslation3(meta.id);
281
+ const operationInvoker = useOperationInvoker2();
282
+ const [target, setTarget] = useState2(initialTarget);
283
+ const [typename, setTypename] = useState2(initialTypename);
284
+ const client = useClient2();
285
+ const spaces = useSpaces();
286
+ const closeRef = useRef(null);
287
+ const resolve = useCallback3((typename2) => {
288
+ const metadata = manager.capabilities.getAll(AppCapabilities.Metadata).find(({ id }) => id === typename2)?.metadata;
289
+ return metadata?.createObject ? metadata : void 0;
290
+ }, [
291
+ manager
292
+ ]);
293
+ const db = Database.isDatabase(target) ? target : target && Obj3.getDatabase(target);
294
+ const schemas = db?.schemaRegistry.query({
295
+ location: [
296
+ "runtime"
297
+ ],
298
+ includeSystem: false
299
+ }).runSync();
300
+ const userSchemas = useMemo2(() => schemas?.filter((schema) => getTypeAnnotation2(schema)?.kind !== EntityKind.Relation).filter((schema) => !!resolve(Type.getTypename(schema))) ?? [], [
301
+ schemas
302
+ ]);
303
+ const handleCreateObject = useCallback3(({ metadata, data = {} }) => Effect.gen(function* () {
304
+ if (!target) {
305
+ return;
306
+ }
307
+ closeRef.current?.click();
308
+ const db2 = Database.isDatabase(target) ? target : target && Obj3.getDatabase(target);
309
+ invariant(db2, "Missing database", {
310
+ F: __dxlog_file,
311
+ L: 86,
312
+ S: this,
313
+ A: [
314
+ "db",
315
+ "'Missing database'"
316
+ ]
317
+ });
318
+ const object = yield* metadata.createObject(data, {
319
+ db: db2
320
+ });
321
+ if (Obj3.isObject(object) && !Obj3.instanceOf(Type.PersistentType, object)) {
322
+ const hidden = !metadata.addToCollectionOnCreate;
323
+ yield* operationInvoker.invoke(SpaceOperation.AddObject, {
324
+ target,
325
+ object,
326
+ hidden
327
+ });
328
+ const shouldNavigate = _shouldNavigate ?? (() => true);
329
+ if (shouldNavigate(object)) {
330
+ yield* Effect.promise(() => operationInvoker.invokePromise(LayoutOperation2.Open, {
331
+ subject: [
332
+ Obj3.getDXN(object).toString()
333
+ ]
334
+ }));
335
+ }
336
+ onCreateObject?.(object);
337
+ }
338
+ }).pipe(Effect.provideService(Capability.Service, manager.capabilities), Effect.provideService(Operation.Service, operationInvoker), runAndForwardErrors), [
339
+ target,
340
+ _shouldNavigate,
341
+ onCreateObject,
342
+ manager.capabilities,
343
+ operationInvoker
344
+ ]);
345
+ return /* @__PURE__ */ React3.createElement(Dialog.Content, null, /* @__PURE__ */ React3.createElement(Dialog.Header, null, /* @__PURE__ */ React3.createElement(Dialog.Title, null, t("create object dialog title", {
346
+ object: t("typename label", {
347
+ ns: typename,
348
+ defaultValue: views ? "View" : "Object"
349
+ })
350
+ })), /* @__PURE__ */ React3.createElement(Dialog.Close, {
351
+ asChild: true
352
+ }, /* @__PURE__ */ React3.createElement(Dialog.CloseIconButton, {
353
+ ref: closeRef
354
+ }))), /* @__PURE__ */ React3.createElement(Dialog.Body, null, /* @__PURE__ */ React3.createElement(CreateObjectPanel, {
355
+ schemas: userSchemas,
356
+ spaces,
357
+ target,
358
+ views,
359
+ typename,
360
+ initialFormValues,
361
+ defaultSpaceId: client.spaces.default.id,
362
+ resolve,
363
+ onTargetChange: setTarget,
364
+ onTypenameChange: setTypename,
365
+ onCreateObject: handleCreateObject
366
+ })));
367
+ };
368
+
369
+ // src/components/CreateDialog/CreateSpaceDialog.tsx
370
+ import * as Effect2 from "effect/Effect";
371
+ import React4, { useCallback as useCallback4, useRef as useRef2 } from "react";
372
+ import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
373
+ import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
374
+ import { runAndForwardErrors as runAndForwardErrors2 } from "@dxos/effect";
375
+ import { Dialog as Dialog2, useTranslation as useTranslation4 } from "@dxos/react-ui";
376
+ import { Form as Form2 } from "@dxos/react-ui-form";
377
+ var CREATE_SPACE_DIALOG = `${meta.id}/CreateSpaceDialog`;
378
+ var initialValues = {
379
+ edgeReplication: true
380
+ };
381
+ var CreateSpaceDialog = () => {
382
+ const closeRef = useRef2(null);
383
+ const { t } = useTranslation4(meta.id);
384
+ const { invokePromise } = useOperationInvoker3();
385
+ const inputSurfaceLookup = useInputSurfaceLookup();
386
+ const handleCreateSpace = useCallback4(async (data) => {
387
+ const program = Effect2.gen(function* () {
388
+ const { data: result } = yield* Effect2.promise(() => invokePromise(SpaceOperation.Create, data));
389
+ if (result?.space) {
390
+ yield* Effect2.promise(() => invokePromise(LayoutOperation3.SwitchWorkspace, {
391
+ subject: result.space.id
392
+ }));
393
+ yield* Effect2.promise(() => invokePromise(LayoutOperation3.UpdateDialog, {
394
+ state: false
395
+ }));
396
+ }
397
+ });
398
+ await runAndForwardErrors2(program);
399
+ }, [
400
+ invokePromise
401
+ ]);
402
+ return /* @__PURE__ */ React4.createElement(Dialog2.Content, null, /* @__PURE__ */ React4.createElement(Dialog2.Header, null, /* @__PURE__ */ React4.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React4.createElement(Dialog2.Close, {
403
+ asChild: true
404
+ }, /* @__PURE__ */ React4.createElement(Dialog2.CloseIconButton, {
405
+ ref: closeRef
406
+ }))), /* @__PURE__ */ React4.createElement(Dialog2.Body, null, /* @__PURE__ */ React4.createElement(Form2.Root, {
407
+ testId: "create-space-form",
408
+ autoFocus: true,
409
+ schema: SpaceForm,
410
+ values: initialValues,
411
+ fieldProvider: inputSurfaceLookup,
412
+ onSave: handleCreateSpace
413
+ }, /* @__PURE__ */ React4.createElement(Form2.Viewport, null, /* @__PURE__ */ React4.createElement(Form2.Content, null, /* @__PURE__ */ React4.createElement(Form2.FieldSet, null), /* @__PURE__ */ React4.createElement(Form2.Submit, null))))));
414
+ };
415
+
416
+ // src/components/CollectionSection.tsx
417
+ import React5 from "react";
418
+ import { useTranslation as useTranslation5 } from "@dxos/react-ui";
419
+ var CollectionSection = ({ role, subject }) => {
420
+ const { t } = useTranslation5(meta.id);
421
+ return /* @__PURE__ */ React5.createElement("div", {
422
+ role,
423
+ className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
424
+ }, /* @__PURE__ */ React5.createElement("span", {
425
+ className: "truncate"
426
+ }, subject.name ?? t("unnamed collection label")));
427
+ };
428
+
429
+ // src/components/JoinDialog/JoinDialog.tsx
430
+ import React6, { useCallback as useCallback5 } from "react";
431
+ import { useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/ui";
432
+ import { LayoutOperation as LayoutOperation4 } from "@dxos/app-toolkit";
433
+ import { useAppGraph } from "@dxos/app-toolkit/ui";
434
+ import { Trigger } from "@dxos/async";
435
+ import { Graph } from "@dxos/plugin-graph";
436
+ import { ObservabilityOperation } from "@dxos/plugin-observability/types";
437
+ import { useClient as useClient3 } from "@dxos/react-client";
438
+ import { Dialog as Dialog3, useTranslation as useTranslation6 } from "@dxos/react-ui";
439
+ import { JoinPanel } from "@dxos/shell/react";
440
+ import { osTranslations as osTranslations2 } from "@dxos/ui-theme";
441
+ var JOIN_DIALOG = `${meta.id}/JoinDialog`;
442
+ var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
443
+ const { invokePromise } = useOperationInvoker4();
444
+ const client = useClient3();
445
+ const { graph } = useAppGraph();
446
+ const { t } = useTranslation6(meta.id);
447
+ const handleDone = useCallback5(async (result) => {
448
+ const spaceKey = result?.spaceKey;
449
+ if (!spaceKey) {
450
+ return;
451
+ }
452
+ await Promise.all([
453
+ invokePromise(LayoutOperation4.AddToast, {
454
+ id: `${meta.id}/join-success`,
455
+ duration: 5e3,
456
+ title: [
457
+ "join success label",
458
+ {
459
+ ns: meta.id
460
+ }
461
+ ],
462
+ closeLabel: [
463
+ "dismiss label",
464
+ {
465
+ ns: meta.id
466
+ }
467
+ ]
468
+ }),
469
+ invokePromise(LayoutOperation4.UpdateDialog, {
470
+ state: false
471
+ })
472
+ ]);
473
+ let space = client.spaces.get(spaceKey);
474
+ if (!space) {
475
+ const trigger = new Trigger();
476
+ client.spaces.subscribe(() => {
477
+ const space2 = client.spaces.get(spaceKey);
478
+ if (space2) {
479
+ trigger.wake(space2);
480
+ }
481
+ });
482
+ space = await trigger.wait();
483
+ }
484
+ await invokePromise(LayoutOperation4.SwitchWorkspace, {
485
+ subject: space.id
486
+ });
487
+ const target = result?.target || (navigableCollections ? space?.id : void 0);
488
+ if (target) {
489
+ await Graph.waitForPath(graph, {
490
+ target
491
+ }).catch(() => {
492
+ });
493
+ await Promise.all([
494
+ invokePromise(LayoutOperation4.Open, {
495
+ subject: [
496
+ target
497
+ ]
498
+ }),
499
+ invokePromise(LayoutOperation4.Expose, {
500
+ subject: target
501
+ })
502
+ ]);
503
+ }
504
+ await onDone?.(result);
505
+ if (space) {
506
+ await invokePromise(ObservabilityOperation.SendEvent, {
507
+ name: "space.join",
508
+ properties: {
509
+ spaceId: space.id
510
+ }
511
+ });
512
+ }
513
+ }, [
514
+ invokePromise,
515
+ client,
516
+ graph,
517
+ navigableCollections,
518
+ onDone
519
+ ]);
520
+ return /* @__PURE__ */ React6.createElement(Dialog3.Content, null, /* @__PURE__ */ React6.createElement(Dialog3.Title, {
521
+ classNames: "sr-only"
522
+ }, t("join space label", {
523
+ ns: osTranslations2
524
+ })), /* @__PURE__ */ React6.createElement(JoinPanel, {
525
+ ...props,
526
+ exitActionParent: /* @__PURE__ */ React6.createElement(Dialog3.Close, {
527
+ asChild: true
528
+ }),
529
+ doneActionParent: /* @__PURE__ */ React6.createElement(Dialog3.Close, {
530
+ asChild: true
531
+ }),
532
+ onDone: handleDone
533
+ }));
534
+ };
535
+
536
+ // src/components/MembersContainer/MembersContainer.tsx
537
+ import React7, { useCallback as useCallback6, useMemo as useMemo3, useState as useState3 } from "react";
538
+ import { QR } from "react-qr-rounded";
539
+ import { useOperationInvoker as useOperationInvoker5 } from "@dxos/app-framework/ui";
540
+ import { Obj as Obj4 } from "@dxos/echo";
541
+ import { log } from "@dxos/log";
542
+ import { useConfig } from "@dxos/react-client";
543
+ import { useSpaceInvitations } from "@dxos/react-client/echo";
544
+ import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
545
+ import { Button as Button2, Clipboard, Icon as Icon2, Input, useId, useTranslation as useTranslation7 } from "@dxos/react-ui";
546
+ import { Settings } from "@dxos/react-ui-form";
547
+ import { Collection } from "@dxos/schema";
548
+ import { AuthCode, BifurcatedAction, Centered, Emoji, InvitationList, SpaceMemberList, Viewport, translationKey as shellTranslationKey } from "@dxos/shell/react";
549
+ import { hexToEmoji } from "@dxos/util";
550
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/MembersContainer/MembersContainer.tsx";
551
+ var activeActionKey = "dxos:react-shell/space-manager/active-action";
552
+ var handleInvitationEvent = (invitation, subscription) => {
553
+ const invitationCode = InvitationEncoder.encode(invitation);
554
+ if (invitation.state === Invitation.State.CONNECTING) {
555
+ log.info(JSON.stringify({
556
+ invitationCode,
557
+ authCode: invitation.authCode
558
+ }), void 0, {
559
+ F: __dxlog_file2,
560
+ L: 40,
561
+ S: void 0,
562
+ C: (f, a) => f(...a)
563
+ });
564
+ subscription.unsubscribe();
565
+ }
566
+ };
567
+ var MembersContainer = ({ space, createInvitationUrl }) => {
568
+ const { t } = useTranslation7(meta.id);
569
+ const config = useConfig();
570
+ const { invokePromise } = useOperationInvoker5();
571
+ const invitations = useSpaceInvitations(space.key);
572
+ const visibleInvitations = invitations?.filter((invitation) => ![
573
+ Invitation.State.CANCELLED
574
+ ].includes(invitation.get().state));
575
+ const [activeAction, setInternalActiveAction] = useState3(localStorage.getItem(activeActionKey) ?? "inviteMany");
576
+ const setActiveAction = (nextAction) => {
577
+ setInternalActiveAction(nextAction);
578
+ localStorage.setItem(activeActionKey, nextAction);
579
+ };
580
+ const target = space.properties[Collection.Collection.typename]?.target?.objects[0]?.target;
581
+ const locked = space.properties[COMPOSER_SPACE_LOCK];
582
+ const handleChangeLocked = useCallback6(() => {
583
+ Obj4.change(space.properties, (p) => {
584
+ p[COMPOSER_SPACE_LOCK] = !locked;
585
+ });
586
+ }, [
587
+ locked,
588
+ space
589
+ ]);
590
+ const inviteActions = useMemo3(() => ({
591
+ inviteOne: {
592
+ label: t("invite one label", {
593
+ ns: shellTranslationKey
594
+ }),
595
+ description: t("invite one description", {
596
+ ns: shellTranslationKey
597
+ }),
598
+ icon: "ph--user-plus--regular",
599
+ testId: "membersContainer.inviteOne",
600
+ onClick: async () => {
601
+ const { data: invitation } = await invokePromise(SpaceOperation.Share, {
602
+ space,
603
+ type: Invitation.Type.INTERACTIVE,
604
+ authMethod: Invitation.AuthMethod.SHARED_SECRET,
605
+ multiUse: false,
606
+ target: target && Obj4.getDXN(target).toString()
607
+ });
608
+ if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
609
+ const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
610
+ }
611
+ }
612
+ },
613
+ inviteMany: {
614
+ label: t("invite many label", {
615
+ ns: shellTranslationKey
616
+ }),
617
+ description: t("invite many description", {
618
+ ns: shellTranslationKey
619
+ }),
620
+ icon: "ph--users-three--regular",
621
+ testId: "membersContainer.inviteMany",
622
+ onClick: async () => {
623
+ const { data: invitation } = await invokePromise(SpaceOperation.Share, {
624
+ space,
625
+ type: Invitation.Type.DELEGATED,
626
+ authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
627
+ multiUse: true,
628
+ target: target && Obj4.getDXN(target).toString()
629
+ });
630
+ if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
631
+ const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
632
+ }
633
+ }
634
+ }
635
+ }), [
636
+ t,
637
+ space,
638
+ target,
639
+ invokePromise
640
+ ]);
641
+ const [selectedInvitation, setSelectedInvitation] = useState3(null);
642
+ const handleSend = (event) => {
643
+ setSelectedInvitation(event.invitation);
644
+ };
645
+ const handleBack = () => {
646
+ setSelectedInvitation(null);
647
+ };
648
+ return /* @__PURE__ */ React7.createElement(Clipboard.Provider, null, /* @__PURE__ */ React7.createElement(Settings.Root, null, /* @__PURE__ */ React7.createElement(Settings.Section, {
649
+ title: t("members verbose label"),
650
+ description: t("members description")
651
+ }, /* @__PURE__ */ React7.createElement(Settings.Frame, null, /* @__PURE__ */ React7.createElement(Settings.FrameItem, {
652
+ title: t("members label")
653
+ }, /* @__PURE__ */ React7.createElement(SpaceMemberList, {
654
+ spaceKey: space.key,
655
+ includeSelf: true
656
+ })), locked && /* @__PURE__ */ React7.createElement(Settings.FrameItem, {
657
+ title: t("invitations label")
658
+ }, /* @__PURE__ */ React7.createElement("p", {
659
+ className: "text-description mbe-2"
660
+ }, t("locked space description"))), !locked && /* @__PURE__ */ React7.createElement(Settings.FrameItem, {
661
+ title: t("invitations label")
662
+ }, selectedInvitation && /* @__PURE__ */ React7.createElement(InvitationSection, {
663
+ ...selectedInvitation,
664
+ onBack: handleBack
665
+ }), !selectedInvitation && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
666
+ className: "text-description mbe-2"
667
+ }, t("space invitation description")), /* @__PURE__ */ React7.createElement(InvitationList, {
668
+ className: "mb-2",
669
+ send: handleSend,
670
+ invitations: visibleInvitations ?? [],
671
+ onClickRemove: (invitation) => invitation.cancel(),
672
+ createInvitationUrl
673
+ }), /* @__PURE__ */ React7.createElement(BifurcatedAction, {
674
+ actions: inviteActions,
675
+ activeAction,
676
+ onChangeActiveAction: setActiveAction,
677
+ "data-testid": "membersContainer.createInvitation"
678
+ })))), /* @__PURE__ */ React7.createElement("div", {
679
+ className: "justify-center p-0 mbs-4 container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
680
+ }, /* @__PURE__ */ React7.createElement(Settings.ItemInput, {
681
+ title: t("space locked label"),
682
+ description: t("space locked description")
683
+ }, /* @__PURE__ */ React7.createElement(Input.Switch, {
684
+ checked: locked,
685
+ onCheckedChange: handleChangeLocked,
686
+ classNames: "justify-self-end"
687
+ }))))));
688
+ };
689
+ var InvitationSection = ({ state = Invitation.State.INIT, authCode, invitationId = "never", url = "never", onBack }) => {
690
+ const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
691
+ return /* @__PURE__ */ React7.createElement(Viewport.Root, {
692
+ activeView
693
+ }, /* @__PURE__ */ React7.createElement(Viewport.Views, null, /* @__PURE__ */ React7.createElement(Viewport.View, {
694
+ id: "init"
695
+ }), /* @__PURE__ */ React7.createElement(Viewport.View, {
696
+ id: "complete"
697
+ }, /* @__PURE__ */ React7.createElement(InvitationComplete, {
698
+ statusValue: state
699
+ })), /* @__PURE__ */ React7.createElement(Viewport.View, {
700
+ id: "auth-code"
701
+ }, /* @__PURE__ */ React7.createElement(InvitationAuthCode, {
702
+ id: invitationId,
703
+ code: authCode ?? "never",
704
+ onCancel: onBack
705
+ })), /* @__PURE__ */ React7.createElement(Viewport.View, {
706
+ id: "qr-code"
707
+ }, /* @__PURE__ */ React7.createElement(InvitationQR, {
708
+ id: invitationId,
709
+ url,
710
+ onCancel: onBack
711
+ }))));
712
+ };
713
+ var InvitationQR = ({ id, url, onCancel }) => {
714
+ const { t } = useTranslation7(shellTranslationKey);
715
+ const qrLabel = useId("members-container__qr-code");
716
+ const emoji = hexToEmoji(id);
717
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
718
+ className: "text-description"
719
+ }, t("qr code description", {
720
+ ns: meta.id
721
+ })), /* @__PURE__ */ React7.createElement("div", {
722
+ role: "group",
723
+ className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
724
+ }, /* @__PURE__ */ React7.createElement("div", {
725
+ role: "none",
726
+ className: "is-full aspect-square relative text-description"
727
+ }, /* @__PURE__ */ React7.createElement(QR, {
728
+ rounding: 100,
729
+ backgroundColor: "transparent",
730
+ color: "currentColor",
731
+ "aria-labelledby": qrLabel,
732
+ errorCorrectionLevel: "Q",
733
+ cutout: true
734
+ }, url ?? "never"), /* @__PURE__ */ React7.createElement(Centered, null, /* @__PURE__ */ React7.createElement(Emoji, {
735
+ text: emoji
736
+ }))), /* @__PURE__ */ React7.createElement("span", {
737
+ id: qrLabel,
738
+ className: "sr-only"
739
+ }, t("qr label")), /* @__PURE__ */ React7.createElement(Clipboard.Button, {
740
+ value: url ?? "never"
741
+ })), /* @__PURE__ */ React7.createElement(Button2, {
742
+ variant: "ghost",
743
+ onClick: onCancel
744
+ }, t("cancel label")));
745
+ };
746
+ var InvitationAuthCode = ({ id, code, onCancel }) => {
747
+ const { t } = useTranslation7(shellTranslationKey);
748
+ const emoji = hexToEmoji(id);
749
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
750
+ className: "text-description"
751
+ }, t("auth other device emoji message")), emoji && /* @__PURE__ */ React7.createElement(Emoji, {
752
+ text: emoji,
753
+ className: "mli-auto mlb-2 text-center"
754
+ }), /* @__PURE__ */ React7.createElement("p", {
755
+ className: "text-description"
756
+ }, t("auth code message")), /* @__PURE__ */ React7.createElement(AuthCode, {
757
+ code,
758
+ large: true,
759
+ classNames: "mli-auto mlb-2 text-center grow"
760
+ }), /* @__PURE__ */ React7.createElement(Button2, {
761
+ variant: "ghost",
762
+ onClick: onCancel
763
+ }, t("cancel label")));
764
+ };
765
+ var InvitationComplete = ({ statusValue }) => {
766
+ return statusValue > 0 ? /* @__PURE__ */ React7.createElement(Icon2, {
767
+ icon: "ph--check--regular",
768
+ size: 6,
769
+ classNames: "m-1.5"
770
+ }) : /* @__PURE__ */ React7.createElement(Icon2, {
771
+ icon: "ph--x--regular",
772
+ size: 6,
773
+ classNames: "m-1.5"
774
+ });
775
+ };
776
+
777
+ // src/components/MenuFooter.tsx
778
+ import React8 from "react";
779
+ import { getSpace } from "@dxos/client/echo";
780
+ import { useClient as useClient4 } from "@dxos/react-client";
781
+ import { DropdownMenu, Icon as Icon3, toLocalizedString as toLocalizedString2, useTranslation as useTranslation8 } from "@dxos/react-ui";
782
+ var MenuFooter = ({ object }) => {
783
+ const { t } = useTranslation8(meta.id);
784
+ const client = useClient4();
785
+ const space = getSpace(object);
786
+ const spaceName = space ? getSpaceDisplayName(space, {
787
+ personal: client.spaces.default === space
788
+ }) : "";
789
+ return space ? /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React8.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React8.createElement("dl", {
790
+ className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
791
+ }, /* @__PURE__ */ React8.createElement("dt", {
792
+ className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
793
+ }, t("location label")), /* @__PURE__ */ React8.createElement("dd", {
794
+ className: "line-clamp-3"
795
+ }, /* @__PURE__ */ React8.createElement(Icon3, {
796
+ icon: "ph--planet--regular",
797
+ classNames: "inline-block mie-1"
798
+ }), toLocalizedString2(spaceName, t)))) : null;
799
+ };
800
+
801
+ // src/components/ObjectRenamePopover/ObjectRenamePopover.tsx
802
+ import React9, { useCallback as useCallback7, useRef as useRef3, useState as useState4 } from "react";
803
+ import { useOperationInvoker as useOperationInvoker6 } from "@dxos/app-framework/ui";
804
+ import { LayoutOperation as LayoutOperation5 } from "@dxos/app-toolkit";
805
+ import { Obj as Obj5 } from "@dxos/echo";
806
+ import { log as log2 } from "@dxos/log";
807
+ import { Button as Button3, Input as Input2, useTranslation as useTranslation9 } from "@dxos/react-ui";
808
+ import { osTranslations as osTranslations3 } from "@dxos/ui-theme";
809
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/ObjectRenamePopover/ObjectRenamePopover.tsx";
810
+ var OBJECT_RENAME_POPOVER = `${meta.id}/ObjectRenamePopover`;
811
+ var ObjectRenamePopover = ({ object }) => {
812
+ const { t } = useTranslation9(meta.id);
813
+ const doneButton = useRef3(null);
814
+ const [name, setName] = useState4(Obj5.getLabel(object));
815
+ const { invokePromise } = useOperationInvoker6();
816
+ const handleDone = useCallback7(() => {
817
+ try {
818
+ name && Obj5.change(object, () => Obj5.setLabel(object, name));
819
+ } catch (err) {
820
+ log2.error("Failed to rename object", {
821
+ err
822
+ }, {
823
+ F: __dxlog_file3,
824
+ L: 28,
825
+ S: void 0,
826
+ C: (f, a) => f(...a)
827
+ });
828
+ }
829
+ void invokePromise(LayoutOperation5.UpdatePopover, {
830
+ anchorId: "",
831
+ state: false
832
+ });
833
+ }, [
834
+ object,
835
+ name,
836
+ invokePromise
837
+ ]);
838
+ return /* @__PURE__ */ React9.createElement("div", {
839
+ role: "none",
840
+ className: "p-2 flex gap-2"
841
+ }, /* @__PURE__ */ React9.createElement("div", {
842
+ role: "none",
843
+ className: "flex-1"
844
+ }, /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.Label, {
845
+ srOnly: true
846
+ }, t("object name label")), /* @__PURE__ */ React9.createElement(Input2.TextInput, {
847
+ placeholder: t("object placeholder"),
848
+ value: name,
849
+ "data-testid": "spacePlugin.renameObject.input",
850
+ onChange: ({ target: { value: value2 } }) => setName(value2),
851
+ onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
852
+ }))), /* @__PURE__ */ React9.createElement(Button3, {
853
+ ref: doneButton,
854
+ classNames: "self-stretch",
855
+ onClick: handleDone
856
+ }, t("done label", {
857
+ ns: osTranslations3
858
+ })));
859
+ };
860
+
861
+ // src/components/SchemaContainer.tsx
862
+ import React10, { useEffect as useEffect2, useState as useState5 } from "react";
863
+ import { useTranslation as useTranslation10 } from "@dxos/react-ui";
864
+ import { Settings as Settings2 } from "@dxos/react-ui-form";
865
+ import { mx } from "@dxos/ui-theme";
866
+ var itemClasses = mx([
867
+ "container-max-width grid md:col-span-2 grid-cols-subgrid gap-trimSm items-center",
868
+ "*:first:!mbs-0 *:last:!mbe-0 pli-trimMd plb-trimMd",
869
+ "border border-separator rounded-md"
870
+ ]);
871
+ var SchemaContainer = ({ space }) => {
872
+ const { t } = useTranslation10(meta.id);
873
+ const schemas = useQuerySpaceSchemas(space);
874
+ return /* @__PURE__ */ React10.createElement(Settings2.Root, null, /* @__PURE__ */ React10.createElement(Settings2.Section, {
875
+ title: t("schema verbose label"),
876
+ description: t("schema description")
877
+ }, /* @__PURE__ */ React10.createElement("div", {
878
+ role: "none",
879
+ className: itemClasses
880
+ }, schemas.length === 0 && /* @__PURE__ */ React10.createElement("div", {
881
+ className: "text-center plb-4"
882
+ }, t("no schemas found message")), schemas.map((schema) => /* @__PURE__ */ React10.createElement("div", {
883
+ role: "none",
884
+ key: schema.id
885
+ }, schema.typename)))));
886
+ };
887
+ var useQuerySpaceSchemas = (space) => {
888
+ const [schemas, setSchemas] = useState5([]);
889
+ useEffect2(() => {
890
+ const query = space.db.schemaRegistry.query();
891
+ const initialResults = query.runSync();
892
+ setSchemas(initialResults);
893
+ const unsubscribe = query.subscribe(() => setSchemas(query.results));
894
+ return () => unsubscribe();
895
+ }, [
896
+ space
897
+ ]);
898
+ return schemas;
899
+ };
900
+
901
+ // src/components/SpacePluginSettings.tsx
902
+ import React11 from "react";
903
+ import { useOperationInvoker as useOperationInvoker7 } from "@dxos/app-framework/ui";
904
+ import { useClient as useClient5 } from "@dxos/react-client";
905
+ import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
906
+ import { IconButton, Input as Input3, List, ListItem, toLocalizedString as toLocalizedString3, useTranslation as useTranslation11 } from "@dxos/react-ui";
907
+ import { Settings as Settings3 } from "@dxos/react-ui-form";
908
+ var SpacePluginSettings = ({ settings, onSettingsChange }) => {
909
+ const { t } = useTranslation11(meta.id);
910
+ const client = useClient5();
911
+ const spaces = useSpaces2({
912
+ all: settings.showHidden
913
+ });
914
+ const { invokePromise } = useOperationInvoker7();
915
+ return /* @__PURE__ */ React11.createElement(Settings3.Root, null, /* @__PURE__ */ React11.createElement(Settings3.Section, {
916
+ title: t("space settings label"),
917
+ description: t("space settings description")
918
+ }, /* @__PURE__ */ React11.createElement(Settings3.Group, null, /* @__PURE__ */ React11.createElement(Settings3.ItemInput, {
919
+ title: t("show hidden spaces label")
920
+ }, /* @__PURE__ */ React11.createElement(Input3.Switch, {
921
+ checked: settings.showHidden,
922
+ onCheckedChange: (checked) => onSettingsChange((state) => ({
923
+ ...state,
924
+ showHidden: !!checked
925
+ }))
926
+ }))), /* @__PURE__ */ React11.createElement(Settings3.Container, null, /* @__PURE__ */ React11.createElement(List, {
927
+ classNames: "flex flex-col gap-trimSm"
928
+ }, spaces.map((space) => /* @__PURE__ */ React11.createElement(ListItem.Root, {
929
+ key: space.id,
930
+ classNames: "is-full items-center"
931
+ }, /* @__PURE__ */ React11.createElement(ListItem.Heading, {
932
+ classNames: "grow truncate !min-bs-0"
933
+ }, toLocalizedString3(getSpaceDisplayName(space, {
934
+ personal: space === client.spaces.default
935
+ }), t)), /* @__PURE__ */ React11.createElement(IconButton, {
936
+ icon: "ph--faders--regular",
937
+ onClick: () => invokePromise(SpaceOperation.OpenSettings, {
938
+ space
939
+ }),
940
+ label: t("open space settings label")
941
+ })))))));
942
+ };
943
+
944
+ // src/components/SpacePresence/SpacePresence.tsx
945
+ import * as Option2 from "effect/Option";
946
+ import React12, { forwardRef, useCallback as useCallback8, useEffect as useEffect3, useState as useState6 } from "react";
947
+ import { useAtomCapability } from "@dxos/app-framework/ui";
948
+ import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
949
+ import { generateName } from "@dxos/display-name";
950
+ import { Obj as Obj6 } from "@dxos/echo";
951
+ import { PublicKey } from "@dxos/react-client";
952
+ import { useMembers, useSpace } from "@dxos/react-client/echo";
953
+ import { useIdentity } from "@dxos/react-client/halo";
954
+ import { Avatar, List as List2, ListItem as ListItem2, Popover, Tooltip, useDefaultValue as useDefaultValue2, useTranslation as useTranslation12 } from "@dxos/react-ui";
955
+ import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
956
+ import { ComplexMap, keyToFallback } from "@dxos/util";
957
+ var REFRESH_INTERVAL = 5e3;
958
+ var ACTIVITY_DURATION = 3e4;
959
+ var noViewers = new ComplexMap(PublicKey.hash);
960
+ var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
961
+ var SpacePresence = ({ object, spaceId }) => {
962
+ const ephemeral = useAtomCapability(SpaceCapabilities.EphemeralState);
963
+ const identity = useIdentity();
964
+ const db = Obj6.getDatabase(object);
965
+ const space = useSpace(spaceId ?? db?.spaceId);
966
+ const spaceMembers = useMembers(spaceId ?? db?.spaceId);
967
+ const [_moment, setMoment] = useState6(Date.now());
968
+ useEffect3(() => {
969
+ const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
970
+ return () => clearInterval(interval);
971
+ }, []);
972
+ const memberOnline = useCallback8((member) => member.presence === 1, []);
973
+ const memberIsNotSelf = useCallback8((member) => !identity?.identityKey.equals(member.identity.identityKey), [
974
+ identity?.identityKey
975
+ ]);
976
+ if (!identity || !ephemeral || !space) {
977
+ return null;
978
+ }
979
+ const currentObjectViewers = ephemeral.viewersByObject[Obj6.getDXN(object).toString()] ?? noViewers;
980
+ const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
981
+ const objectView = currentObjectViewers.get(member.identity.identityKey);
982
+ const lastSeen = objectView?.lastSeen ?? -Infinity;
983
+ const currentlyAttended = objectView?.currentlyAttended ?? false;
984
+ return {
985
+ ...member,
986
+ currentlyAttended,
987
+ lastSeen
988
+ };
989
+ }).toSorted((a, b) => a.lastSeen - b.lastSeen);
990
+ return /* @__PURE__ */ React12.createElement(FullPresence, {
991
+ members: membersForObject
992
+ });
993
+ };
994
+ var FullPresence = (props) => {
995
+ const { size = 9, onMemberClick } = props;
996
+ const members = useDefaultValue2(props.members, () => []);
997
+ if (members.length === 0) {
998
+ return null;
999
+ }
1000
+ return /* @__PURE__ */ React12.createElement("div", {
1001
+ className: "dx-avatar-group",
1002
+ "data-testid": "spacePlugin.presence"
1003
+ }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React12.createElement(Tooltip.Trigger, {
1004
+ key: member.identity.identityKey.toHex(),
1005
+ side: "bottom",
1006
+ content: getName(member.identity),
1007
+ className: "grid focus:outline-none"
1008
+ }, /* @__PURE__ */ React12.createElement(PresenceAvatar, {
1009
+ identity: member.identity,
1010
+ match: member.currentlyAttended,
1011
+ index: members.length - i,
1012
+ onClick: () => onMemberClick?.(member),
1013
+ size
1014
+ }))), members.length > 3 && /* @__PURE__ */ React12.createElement(Popover.Root, null, /* @__PURE__ */ React12.createElement(Popover.Trigger, {
1015
+ className: "grid focus:outline-none"
1016
+ }, /* @__PURE__ */ React12.createElement(Avatar.Root, null, /* @__PURE__ */ React12.createElement(Avatar.Content, {
1017
+ status: "inactive",
1018
+ style: {
1019
+ zIndex: members.length - 4
1020
+ },
1021
+ fallback: `+${members.length - 3}`,
1022
+ size
1023
+ }))), /* @__PURE__ */ React12.createElement(Popover.Portal, null, /* @__PURE__ */ React12.createElement(Popover.Content, {
1024
+ side: "bottom"
1025
+ }, /* @__PURE__ */ React12.createElement(Popover.Arrow, null), /* @__PURE__ */ React12.createElement(Popover.Viewport, {
1026
+ classNames: "max-bs-56"
1027
+ }, /* @__PURE__ */ React12.createElement(List2, null, members.map((member) => /* @__PURE__ */ React12.createElement(ListItem2.Root, {
1028
+ key: member.identity.identityKey.toHex(),
1029
+ classNames: "flex gap-2 items-center cursor-pointer mbe-2",
1030
+ onClick: () => onMemberClick?.(member),
1031
+ "data-testid": "identity-list-item"
1032
+ }, /* @__PURE__ */ React12.createElement(PresenceAvatar, {
1033
+ identity: member.identity,
1034
+ size,
1035
+ showName: true,
1036
+ match: member.currentlyAttended
1037
+ })))))))));
1038
+ };
1039
+ var PresenceAvatar = /* @__PURE__ */ forwardRef(({ identity, showName, match: match2, index, onClick, size }, forwardedRef) => {
1040
+ const status = match2 ? "current" : "active";
1041
+ const fallbackValue = keyToFallback(identity.identityKey);
1042
+ return /* @__PURE__ */ React12.createElement(Avatar.Root, null, /* @__PURE__ */ React12.createElement(Avatar.Content, {
1043
+ status,
1044
+ hue: identity.profile?.data?.hue || fallbackValue.hue,
1045
+ "data-testid": "spacePlugin.presence.member",
1046
+ "data-status": status,
1047
+ size,
1048
+ ...index ? {
1049
+ style: {
1050
+ zIndex: index
1051
+ }
1052
+ } : {},
1053
+ onClick,
1054
+ fallback: identity.profile?.data?.emoji || fallbackValue.emoji,
1055
+ ref: forwardedRef
1056
+ }), /* @__PURE__ */ React12.createElement(Avatar.Label, {
1057
+ classNames: showName ? "text-sm truncate pli-2" : "sr-only"
1058
+ }, getName(identity)));
1059
+ });
1060
+ var SmallPresenceLive = ({ id, open, viewers }) => {
1061
+ const { hasAttention, isAncestor, isRelated } = useAttention(id);
1062
+ const isAttended = hasAttention || isAncestor || isRelated;
1063
+ const { graph } = useAppGraph2();
1064
+ const attended = useAttended();
1065
+ const startOfAttention = attended.at(-1);
1066
+ const path = usePath(graph, startOfAttention);
1067
+ const containsAttended = !open && !isAttended && id && Option2.isSome(path) ? path.value.includes(id) : false;
1068
+ const getActiveViewers = (viewers2) => {
1069
+ const moment = Date.now();
1070
+ return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
1071
+ };
1072
+ const [activeViewers, setActiveViewers] = useState6(viewers ? getActiveViewers(viewers) : []);
1073
+ useEffect3(() => {
1074
+ if (viewers) {
1075
+ setActiveViewers(getActiveViewers(viewers));
1076
+ const interval = setInterval(() => {
1077
+ setActiveViewers(getActiveViewers(viewers));
1078
+ }, REFRESH_INTERVAL);
1079
+ return () => clearInterval(interval);
1080
+ }
1081
+ }, [
1082
+ viewers
1083
+ ]);
1084
+ return /* @__PURE__ */ React12.createElement(SmallPresence, {
1085
+ count: activeViewers.length,
1086
+ attended: isAttended,
1087
+ containsAttended
1088
+ });
1089
+ };
1090
+ var SmallPresence = ({ count = 0, attended, containsAttended }) => {
1091
+ const { t } = useTranslation12(meta.id);
1092
+ return /* @__PURE__ */ React12.createElement(Tooltip.Trigger, {
1093
+ asChild: true,
1094
+ content: t("presence label", {
1095
+ count
1096
+ }),
1097
+ side: "bottom"
1098
+ }, /* @__PURE__ */ React12.createElement(AttentionGlyph, {
1099
+ attended,
1100
+ containsAttended,
1101
+ presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1102
+ classNames: "self-center mie-1"
1103
+ }));
1104
+ };
1105
+
1106
+ // src/components/SpaceRenamePopover/SpaceRenamePopover.tsx
1107
+ import React13, { useCallback as useCallback9, useRef as useRef4, useState as useState7 } from "react";
1108
+ import { useOperationInvoker as useOperationInvoker8 } from "@dxos/app-framework/ui";
1109
+ import { LayoutOperation as LayoutOperation6 } from "@dxos/app-toolkit";
1110
+ import { Obj as Obj7 } from "@dxos/echo";
1111
+ import { Button as Button4, Input as Input4, Popover as Popover2, useTranslation as useTranslation13 } from "@dxos/react-ui";
1112
+ import { osTranslations as osTranslations4 } from "@dxos/ui-theme";
1113
+ var SPACE_RENAME_POPOVER = `${meta.id}/SpaceRenamePopover`;
1114
+ var SpaceRenamePopover = ({ space }) => {
1115
+ const { t } = useTranslation13(meta.id);
1116
+ const doneButton = useRef4(null);
1117
+ const [name, setName] = useState7(space.properties.name ?? "");
1118
+ const { invokePromise } = useOperationInvoker8();
1119
+ const handleDone = useCallback9(() => {
1120
+ Obj7.change(space.properties, (p) => {
1121
+ p.name = name;
1122
+ });
1123
+ void invokePromise(LayoutOperation6.UpdatePopover, {
1124
+ anchorId: "",
1125
+ state: false
1126
+ });
1127
+ }, [
1128
+ space,
1129
+ name,
1130
+ invokePromise
1131
+ ]);
1132
+ return /* @__PURE__ */ React13.createElement("div", {
1133
+ role: "none",
1134
+ className: "p-2 flex gap-2"
1135
+ }, /* @__PURE__ */ React13.createElement("div", {
1136
+ role: "none",
1137
+ className: "flex-1"
1138
+ }, /* @__PURE__ */ React13.createElement(Input4.Root, null, /* @__PURE__ */ React13.createElement(Input4.Label, {
1139
+ srOnly: true
1140
+ }, t("space name label")), /* @__PURE__ */ React13.createElement(Input4.TextInput, {
1141
+ defaultValue: space.properties.name ?? "",
1142
+ placeholder: t("unnamed space label"),
1143
+ onChange: ({ target: { value: value2 } }) => setName(value2),
1144
+ // TODO(wittjosiah): Ideally this should access the popover context to close the popover.
1145
+ // Currently this is not possible because Radix does not expose the popover context.
1146
+ onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
1147
+ }))), /* @__PURE__ */ React13.createElement(Popover2.Close, {
1148
+ asChild: true
1149
+ }, /* @__PURE__ */ React13.createElement(Button4, {
1150
+ ref: doneButton,
1151
+ classNames: "self-stretch",
1152
+ onClick: handleDone
1153
+ }, t("done label", {
1154
+ ns: osTranslations4
1155
+ }))));
1156
+ };
1157
+
1158
+ // src/components/SpaceSettings/SpaceSettingsContainer.tsx
1159
+ import * as Schema from "effect/Schema";
1160
+ import React14, { useCallback as useCallback10, useMemo as useMemo4, useState as useState8 } from "react";
1161
+ import { useCapabilities, useOperationInvoker as useOperationInvoker9 } from "@dxos/app-framework/ui";
1162
+ import { LayoutOperation as LayoutOperation7 } from "@dxos/app-toolkit";
1163
+ import { Obj as Obj8 } from "@dxos/echo";
1164
+ import { log as log3 } from "@dxos/log";
1165
+ import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
1166
+ import { useClient as useClient6 } from "@dxos/react-client";
1167
+ import { SpaceState } from "@dxos/react-client/echo";
1168
+ import { Button as Button5, Input as Input5, useFileDownload, useMulticastObservable, useTranslation as useTranslation14 } from "@dxos/react-ui";
1169
+ import { Form as Form3, Settings as Settings4 } from "@dxos/react-ui-form";
1170
+ import { HuePicker, IconPicker } from "@dxos/react-ui-pickers";
1171
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx";
1172
+ var SpaceFormSchema = SpaceForm.pipe(Schema.extend(Schema.Struct({
1173
+ archived: Schema.Boolean.annotations({
1174
+ title: "Archive Space"
1175
+ })
1176
+ })));
1177
+ var SpaceSettingsContainer = ({ space }) => {
1178
+ const { t } = useTranslation14(meta.id);
1179
+ const { invokePromise } = useOperationInvoker9();
1180
+ const client = useClient6();
1181
+ const archived = useMulticastObservable(space.state) === SpaceState.SPACE_INACTIVE;
1182
+ const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1183
+ const toggleEdgeReplication = useCallback10(async (next) => {
1184
+ setEdgeReplication(next);
1185
+ await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
1186
+ log3.catch(err, void 0, {
1187
+ F: __dxlog_file4,
1188
+ L: 49,
1189
+ S: void 0,
1190
+ C: (f, a) => f(...a)
1191
+ });
1192
+ setEdgeReplication(!next);
1193
+ });
1194
+ }, [
1195
+ space
1196
+ ]);
1197
+ const handleValuesChanged = useCallback10((newValues, meta2) => {
1198
+ const changed = meta2.changed ?? {};
1199
+ if (changed["edgeReplication"]) {
1200
+ void toggleEdgeReplication(newValues.edgeReplication ?? false);
1201
+ }
1202
+ if (changed["name"] || changed["icon"] || changed["hue"]) {
1203
+ Obj8.change(space.properties, (p) => {
1204
+ if (changed["name"] && newValues.name !== void 0) {
1205
+ p.name = newValues.name;
1206
+ }
1207
+ if (changed["icon"]) {
1208
+ p.icon = newValues.icon;
1209
+ }
1210
+ if (changed["hue"]) {
1211
+ p.hue = newValues.hue;
1212
+ }
1213
+ });
1214
+ }
1215
+ if (changed["archived"]) {
1216
+ if (newValues.archived && !archived) {
1217
+ void invokePromise(SpaceOperation.Close, {
1218
+ space
1219
+ });
1220
+ void invokePromise(LayoutOperation7.SwitchWorkspace, {
1221
+ subject: client.spaces.default.id
1222
+ });
1223
+ } else if (!newValues.archived && archived) {
1224
+ void invokePromise(SpaceOperation.Open, {
1225
+ space
1226
+ });
1227
+ }
1228
+ }
1229
+ }, [
1230
+ space,
1231
+ client,
1232
+ archived,
1233
+ invokePromise,
1234
+ toggleEdgeReplication
1235
+ ]);
1236
+ const values = useMemo4(() => ({
1237
+ name: space.properties.name,
1238
+ icon: space.properties.icon,
1239
+ hue: space.properties.hue,
1240
+ edgeReplication,
1241
+ archived
1242
+ }), [
1243
+ space.properties.name,
1244
+ space.properties.icon,
1245
+ space.properties.hue,
1246
+ edgeReplication,
1247
+ archived
1248
+ ]);
1249
+ const fieldMap = useMemo4(() => ({
1250
+ name: ({ type, label, getValue, onValueChange }) => {
1251
+ const handleChange = useCallback10(({ target: { value: value2 } }) => onValueChange(type, value2), [
1252
+ onValueChange,
1253
+ type
1254
+ ]);
1255
+ return /* @__PURE__ */ React14.createElement(Settings4.ItemInput, {
1256
+ title: label,
1257
+ description: t("display name description")
1258
+ }, /* @__PURE__ */ React14.createElement(Input5.TextInput, {
1259
+ value: getValue(),
1260
+ onChange: handleChange,
1261
+ placeholder: t("display name input placeholder"),
1262
+ classNames: "min-is-64"
1263
+ }));
1264
+ },
1265
+ icon: ({ type, label, getValue, onValueChange }) => {
1266
+ const handleChange = useCallback10((icon) => onValueChange(type, icon), [
1267
+ onValueChange,
1268
+ type
1269
+ ]);
1270
+ const handleReset = useCallback10(() => onValueChange(type, void 0), [
1271
+ onValueChange,
1272
+ type
1273
+ ]);
1274
+ return /* @__PURE__ */ React14.createElement(Settings4.Item, {
1275
+ title: label,
1276
+ description: t("icon description")
1277
+ }, /* @__PURE__ */ React14.createElement(IconPicker, {
1278
+ value: getValue(),
1279
+ onChange: handleChange,
1280
+ onReset: handleReset,
1281
+ classNames: "justify-self-end"
1282
+ }));
1283
+ },
1284
+ hue: ({ type, label, getValue, onValueChange }) => {
1285
+ const handleChange = useCallback10((nextHue) => onValueChange(type, nextHue), [
1286
+ onValueChange,
1287
+ type
1288
+ ]);
1289
+ const handleReset = useCallback10(() => onValueChange(type, void 0), [
1290
+ onValueChange,
1291
+ type
1292
+ ]);
1293
+ return /* @__PURE__ */ React14.createElement(Settings4.Item, {
1294
+ title: label,
1295
+ description: t("hue description")
1296
+ }, /* @__PURE__ */ React14.createElement(HuePicker, {
1297
+ value: getValue(),
1298
+ onChange: handleChange,
1299
+ onReset: handleReset,
1300
+ classNames: "justify-self-end"
1301
+ }));
1302
+ },
1303
+ edgeReplication: ({ type, label, getValue, onValueChange }) => {
1304
+ const handleChange = useCallback10((checked) => onValueChange(type, checked), [
1305
+ onValueChange,
1306
+ type
1307
+ ]);
1308
+ return /* @__PURE__ */ React14.createElement(Settings4.ItemInput, {
1309
+ title: label,
1310
+ description: t("edge replication description")
1311
+ }, /* @__PURE__ */ React14.createElement(Input5.Switch, {
1312
+ checked: getValue(),
1313
+ onCheckedChange: handleChange,
1314
+ classNames: "justify-self-end"
1315
+ }));
1316
+ },
1317
+ archived: ({ type, label, getValue, onValueChange }) => {
1318
+ const handleChange = useCallback10(() => onValueChange(type, !getValue()), [
1319
+ onValueChange,
1320
+ type,
1321
+ getValue
1322
+ ]);
1323
+ return /* @__PURE__ */ React14.createElement(Settings4.ItemInput, {
1324
+ title: label,
1325
+ description: t("archive space description")
1326
+ }, /* @__PURE__ */ React14.createElement(Button5, {
1327
+ disabled: space === client.spaces.default,
1328
+ variant: getValue() ? "default" : "destructive",
1329
+ onClick: handleChange
1330
+ }, getValue() ? t("unarchive space label") : t("archive space label")));
1331
+ }
1332
+ }), [
1333
+ t,
1334
+ space,
1335
+ client
1336
+ ]);
1337
+ const download = useFileDownload();
1338
+ const handleBackup = useCallback10(async () => {
1339
+ const archive = await space.internal.export();
1340
+ download(new Blob([
1341
+ archive.contents
1342
+ ]), archive.filename);
1343
+ }, [
1344
+ space,
1345
+ download
1346
+ ]);
1347
+ const repairs = useCapabilities(SpaceCapabilities.Repair);
1348
+ const handleRepair = useCallback10(async () => {
1349
+ await Promise.all(repairs.map((repair) => repair({
1350
+ space,
1351
+ isDefault: client.spaces.default === space
1352
+ })));
1353
+ }, [
1354
+ client,
1355
+ space,
1356
+ repairs
1357
+ ]);
1358
+ return /* @__PURE__ */ React14.createElement(Settings4.Root, null, /* @__PURE__ */ React14.createElement(Settings4.Section, {
1359
+ title: t("space properties settings verbose label"),
1360
+ description: t("space properties settings description", {
1361
+ ns: meta.id
1362
+ })
1363
+ }, /* @__PURE__ */ React14.createElement(Form3.Root, {
1364
+ fieldMap,
1365
+ schema: SpaceFormSchema,
1366
+ values,
1367
+ onValuesChanged: handleValuesChanged
1368
+ }, /* @__PURE__ */ React14.createElement(Form3.FieldSet, {
1369
+ classNames: "space-y-trimMd"
1370
+ }))), /* @__PURE__ */ React14.createElement(Settings4.Section, {
1371
+ title: t("space controls title"),
1372
+ description: t("space controls description")
1373
+ }, /* @__PURE__ */ React14.createElement(Settings4.ItemInput, {
1374
+ title: t("backup space title"),
1375
+ description: t("backup space description")
1376
+ }, /* @__PURE__ */ React14.createElement(Button5, {
1377
+ onClick: handleBackup
1378
+ }, t("download backup label"))), /* @__PURE__ */ React14.createElement(Settings4.ItemInput, {
1379
+ title: t("repair space title"),
1380
+ description: t("repair space description")
1381
+ }, /* @__PURE__ */ React14.createElement(Button5, {
1382
+ onClick: handleRepair
1383
+ }, t("repair space label")))));
1384
+ };
1385
+ SpaceSettingsContainer.displayName = "SpaceSettingsContainer";
1386
+
1387
+ // src/components/SyncStatus/InlineSyncStatus.tsx
1388
+ import * as Option3 from "effect/Option";
1389
+ import React15, { useEffect as useEffect4, useState as useState9 } from "react";
1390
+ import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
1391
+ import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
1392
+ import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
1393
+ import { useClient as useClient7 } from "@dxos/react-client";
1394
+ import { useSpaceSyncState } from "@dxos/react-client/echo";
1395
+ import { Tooltip as Tooltip2, useTranslation as useTranslation15 } from "@dxos/react-ui";
1396
+ import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
1397
+ var useEdgeStatus = () => {
1398
+ const [status, setStatus] = useState9(EdgeStatus.ConnectionState.NOT_CONNECTED);
1399
+ const client = useClient7();
1400
+ useEffect4(() => {
1401
+ client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
1402
+ setStatus(status2.state);
1403
+ });
1404
+ }, [
1405
+ client
1406
+ ]);
1407
+ return status;
1408
+ };
1409
+ var InlineSyncStatus = ({ space, open }) => {
1410
+ const { t } = useTranslation15(meta.id);
1411
+ const id = space.id;
1412
+ const { hasAttention, isAncestor, isRelated } = useAttention2(id);
1413
+ const isAttended = hasAttention || isAncestor || isRelated;
1414
+ const { graph } = useAppGraph3();
1415
+ const attended = useAttended2();
1416
+ const startOfAttention = attended.at(-1);
1417
+ const path = usePath(graph, startOfAttention);
1418
+ const containsAttended = !open && !isAttended && id && Option3.isSome(path) ? path.value.includes(id) : false;
1419
+ const connectedToEdge = useEdgeStatus() === EdgeStatus.ConnectionState.CONNECTED;
1420
+ const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
1421
+ const syncState = useSpaceSyncState(space);
1422
+ const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
1423
+ return /* @__PURE__ */ React15.createElement(Tooltip2.Trigger, {
1424
+ asChild: true,
1425
+ content: t("syncing label"),
1426
+ side: "bottom"
1427
+ }, /* @__PURE__ */ React15.createElement(AttentionGlyph2, {
1428
+ syncing,
1429
+ attended: isAttended,
1430
+ containsAttended,
1431
+ classNames: "self-center mie-1"
1432
+ }));
1433
+ };
1434
+
1435
+ // src/components/SyncStatus/SyncStatus.tsx
1436
+ import React16, { useEffect as useEffect5, useState as useState10 } from "react";
1437
+ import { StatusBar } from "@dxos/plugin-status-bar";
1438
+ import { EdgeStatus as EdgeStatus2 } from "@dxos/protocols/proto/dxos/client/services";
1439
+ import { useClient as useClient8 } from "@dxos/react-client";
1440
+ import { useStream } from "@dxos/react-client/devtools";
1441
+ import { getSyncSummary, useSyncState } from "@dxos/react-client/echo";
1442
+ import { Icon as Icon4, Popover as Popover3, useTranslation as useTranslation16 } from "@dxos/react-ui";
1443
+ import { mx as mx2 } from "@dxos/ui-theme";
1444
+ import { Unit } from "@dxos/util";
1445
+
1446
+ // src/components/SyncStatus/save-tracker.ts
1447
+ import { Context } from "@dxos/context";
1448
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
1449
+ var createClientSaveTracker = (client, cb) => {
1450
+ const CleanupFns = {};
1451
+ const state = {};
1452
+ const install = (spaces) => {
1453
+ for (const space of spaces) {
1454
+ if (state[space.id]) {
1455
+ continue;
1456
+ }
1457
+ state[space.id] = "saved";
1458
+ CleanupFns[space.id] = createSpaceSaveTracker(space, (s) => {
1459
+ state[space.id] = s;
1460
+ cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
1461
+ });
1462
+ }
1463
+ };
1464
+ client.spaces.subscribe((spaces) => {
1465
+ install(spaces);
1466
+ });
1467
+ install(client.spaces.get());
1468
+ return () => {
1469
+ for (const unsubscribe of Object.values(CleanupFns)) {
1470
+ unsubscribe();
1471
+ }
1472
+ };
1473
+ };
1474
+ var createSpaceSaveTracker = (space, cb) => {
1475
+ const ctx = new Context(void 0, {
1476
+ F: __dxlog_file5,
1477
+ L: 40
1478
+ });
1479
+ void space.waitUntilReady().then(() => {
1480
+ if (ctx.disposed) {
1481
+ return;
1482
+ }
1483
+ let hasUnsavedChanges = false;
1484
+ let lastFlushPromise;
1485
+ space.internal.db.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
1486
+ hasUnsavedChanges = unsavedDocuments.length > 0;
1487
+ });
1488
+ space.internal.db.saveStateChanged.debounce(500).on(ctx, () => {
1489
+ if (hasUnsavedChanges) {
1490
+ lastFlushPromise = void 0;
1491
+ cb("saving");
1492
+ } else {
1493
+ const flushPromise = space.db.flush();
1494
+ lastFlushPromise = flushPromise;
1495
+ void flushPromise.then(() => {
1496
+ if (lastFlushPromise === flushPromise) {
1497
+ cb("saved");
1498
+ }
1499
+ });
1500
+ }
1501
+ });
1502
+ });
1503
+ return () => {
1504
+ void ctx.dispose();
1505
+ };
1506
+ };
1507
+
1508
+ // src/components/SyncStatus/status.ts
1509
+ var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
1510
+ if (!saved) {
1511
+ return "saving locally";
1512
+ } else if (!offline && needsToDownload) {
1513
+ return "downloading";
1514
+ } else if (!offline && needsToUpload) {
1515
+ return "uploading";
1516
+ } else if (offline && !needsToUpload && !needsToDownload) {
1517
+ return "offline persisted";
1518
+ } else {
1519
+ return "remote synced";
1520
+ }
1521
+ };
1522
+ var getIcon = (status) => {
1523
+ switch (status) {
1524
+ case "saving locally":
1525
+ return "ph--download--regular";
1526
+ case "downloading":
1527
+ return "ph--cloud-arrow-down--regular";
1528
+ case "uploading":
1529
+ return "ph--cloud-arrow-up--regular";
1530
+ case "offline persisted":
1531
+ return "ph--check-circle--regular";
1532
+ case "remote synced":
1533
+ return "ph--cloud-check--regular";
1534
+ }
1535
+ };
1536
+
1537
+ // src/components/SyncStatus/SyncStatus.tsx
1538
+ var SYNC_STALLED_TIMEOUT = 5e3;
1539
+ var SyncStatus = () => {
1540
+ const client = useClient8();
1541
+ const state = useSyncState();
1542
+ const [saved, setSaved] = useState10(true);
1543
+ useEffect5(() => createClientSaveTracker(client, (state2) => setSaved(state2 === "saved")), []);
1544
+ return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
1545
+ state,
1546
+ saved
1547
+ });
1548
+ };
1549
+ var SyncStatusIndicator = ({ state, saved }) => {
1550
+ const { t } = useTranslation16(meta.id);
1551
+ const summary = getSyncSummary(state);
1552
+ const offline = Object.values(state).length === 0;
1553
+ const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1554
+ const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1555
+ const status = getStatus({
1556
+ offline,
1557
+ saved,
1558
+ needsToUpload,
1559
+ needsToDownload
1560
+ });
1561
+ const [classNames, setClassNames] = useState10();
1562
+ useEffect5(() => {
1563
+ setClassNames(void 0);
1564
+ if (offline || !needsToUpload && !needsToDownload) {
1565
+ return;
1566
+ }
1567
+ const t2 = setTimeout(() => {
1568
+ setClassNames("text-orange-500");
1569
+ }, SYNC_STALLED_TIMEOUT);
1570
+ return () => clearTimeout(t2);
1571
+ }, [
1572
+ offline,
1573
+ needsToUpload,
1574
+ needsToDownload
1575
+ ]);
1576
+ const title = t(`${status} label`);
1577
+ const icon = /* @__PURE__ */ React16.createElement(Icon4, {
1578
+ icon: getIcon(status),
1579
+ classNames
1580
+ });
1581
+ return /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, {
1582
+ asChild: true
1583
+ }, /* @__PURE__ */ React16.createElement(StatusBar.Item, {
1584
+ title
1585
+ }, icon)), /* @__PURE__ */ React16.createElement(Popover3.Portal, null, /* @__PURE__ */ React16.createElement(Popover3.Content, null, /* @__PURE__ */ React16.createElement(EdgeConnectionPopover, null), /* @__PURE__ */ React16.createElement(Popover3.Arrow, null))));
1586
+ };
1587
+ var useEdgeStatus2 = () => {
1588
+ const client = useClient8();
1589
+ const { status } = useStream(() => client.services.services.EdgeAgentService.queryEdgeStatus(), {});
1590
+ return status;
1591
+ };
1592
+ var EdgeConnectionPopover = () => {
1593
+ const status = useEdgeStatus2();
1594
+ const { t } = useTranslation16(meta.id);
1595
+ const isConnected = status?.state === EdgeStatus2.ConnectionState.CONNECTED;
1596
+ return /* @__PURE__ */ React16.createElement("div", {
1597
+ className: "min-is-[240px] p-2"
1598
+ }, /* @__PURE__ */ React16.createElement("div", {
1599
+ className: "flex items-center gap-2 mbe-2"
1600
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1601
+ icon: isConnected ? "ph--check-circle--regular" : "ph--warning-circle--regular",
1602
+ classNames: mx2(isConnected ? "text-successText" : "text-errorText animate-pulse")
1603
+ }), /* @__PURE__ */ React16.createElement("span", {
1604
+ className: "font-medium text-sm"
1605
+ }, isConnected ? t("sync edge connected label") : t("sync edge disconnected label"))), status?.state === EdgeStatus2.ConnectionState.NOT_CONNECTED && /* @__PURE__ */ React16.createElement("div", {
1606
+ className: "flex items-center gap-2 text-sm text-description"
1607
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1608
+ icon: "ph--cloud-x--regular"
1609
+ }), /* @__PURE__ */ React16.createElement("span", null, t("sync no connection label"))), status?.state === EdgeStatus2.ConnectionState.CONNECTED && /* @__PURE__ */ React16.createElement("div", {
1610
+ className: "space-y-2"
1611
+ }, /* @__PURE__ */ React16.createElement("div", {
1612
+ className: "flex items-center justify-between text-sm"
1613
+ }, /* @__PURE__ */ React16.createElement("div", {
1614
+ className: "flex items-center gap-2 text-description"
1615
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1616
+ icon: "ph--timer--regular"
1617
+ }), /* @__PURE__ */ React16.createElement("span", null, t("sync latency label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
1618
+ value: status.rtt,
1619
+ format: Unit.Millisecond
1620
+ })), /* @__PURE__ */ React16.createElement("div", {
1621
+ className: "flex items-center justify-between text-sm"
1622
+ }, /* @__PURE__ */ React16.createElement("div", {
1623
+ className: "flex items-center gap-2 text-description"
1624
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1625
+ icon: "ph--arrow-up--regular"
1626
+ }), /* @__PURE__ */ React16.createElement("span", null, t("sync upload label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
1627
+ value: status.rateBytesUp,
1628
+ format: Unit.Kilobyte,
1629
+ suffix: "/s"
1630
+ })), /* @__PURE__ */ React16.createElement("div", {
1631
+ className: "flex items-center justify-between text-sm"
1632
+ }, /* @__PURE__ */ React16.createElement("div", {
1633
+ className: "flex items-center gap-2 text-sm text-description"
1634
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1635
+ icon: "ph--arrow-down--regular"
1636
+ }), /* @__PURE__ */ React16.createElement("span", null, t("sync download label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
1637
+ value: status.rateBytesDown,
1638
+ format: Unit.Kilobyte,
1639
+ suffix: "/s"
1640
+ }))));
1641
+ };
1642
+ var UnitValue = ({ value: input, format, suffix }) => {
1643
+ const { formattedValue, unit } = format(input);
1644
+ return /* @__PURE__ */ React16.createElement("span", {
1645
+ className: "font-mono"
1646
+ }, formattedValue, /* @__PURE__ */ React16.createElement("span", {
1647
+ className: "mis-1 text-subdued"
1648
+ }, unit.symbol, suffix));
1649
+ };
1650
+
1651
+ // src/helpers/query.ts
1652
+ import * as Array2 from "effect/Array";
1653
+ import * as Effect3 from "effect/Effect";
1654
+ import * as EffectFunction from "effect/Function";
1655
+ import * as Match from "effect/Match";
1656
+ import * as Option4 from "effect/Option";
1657
+ import * as SchemaAST from "effect/SchemaAST";
1658
+ import { DXN, Filter as Filter2, Query } from "@dxos/echo";
1659
+ import { ReferenceAnnotationId, getTypeAnnotation as getTypeAnnotation3, unwrapOptional } from "@dxos/echo/internal";
1660
+ import { runAndForwardErrors as runAndForwardErrors3 } from "@dxos/effect";
1661
+ import { log as log4 } from "@dxos/log";
1662
+ import { Person } from "@dxos/types";
1663
+ var __dxlog_file6 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/helpers/query.ts";
1664
+ var evalQuery = (queryString) => {
1665
+ const globals = {
1666
+ Query,
1667
+ Filter: Filter2,
1668
+ Person
1669
+ };
1670
+ try {
1671
+ return new Function(...Object.keys(globals), `return ${queryString}`)(...Object.values(globals));
1672
+ } catch (err) {
1673
+ log4.catch(err, void 0, {
1674
+ F: __dxlog_file6,
1675
+ L: 33,
1676
+ S: void 0,
1677
+ C: (f, a) => f(...a)
1678
+ });
1679
+ return Query.select(Filter2.nothing());
1680
+ }
1681
+ };
1682
+ var resolveSchemaWithRegistry = (registry, query) => {
1683
+ const resolve = Effect3.fn(function* (dxn) {
1684
+ const typename = DXN.parse(dxn).asTypeDXN()?.type;
1685
+ if (!typename) {
1686
+ return Option4.none();
1687
+ }
1688
+ const query2 = registry.query({
1689
+ typename,
1690
+ location: [
1691
+ "database",
1692
+ "runtime"
1693
+ ]
1694
+ });
1695
+ const schemas = yield* Effect3.promise(() => query2.run());
1696
+ return Array2.head(schemas);
1697
+ });
1698
+ return resolveSchema(query, resolve).pipe(Effect3.map((schema) => Option4.getOrUndefined(schema)), runAndForwardErrors3);
1699
+ };
1700
+ var resolveSchema = (query, resolve) => {
1701
+ return Match.value(query).pipe(
1702
+ Match.withReturnType(),
1703
+ // TODO(wittjosiah): Reconcile with filter match?
1704
+ Match.when({
1705
+ type: "select"
1706
+ }, ({ filter }) => typenameFromFilter(filter).pipe(Option4.map((typename) => resolve(typename)), Option4.getOrElse(() => Effect3.succeed(Option4.none())))),
1707
+ Match.when({
1708
+ type: "filter"
1709
+ }, ({ filter }) => typenameFromFilter(filter).pipe(Option4.map((typename) => resolve(typename)), Option4.getOrElse(() => Effect3.succeed(Option4.none())))),
1710
+ Match.when({
1711
+ type: "reference-traversal"
1712
+ }, ({ anchor, property }) => resolveSchema(anchor, resolve).pipe(Effect3.map((base) => base.pipe(Option4.map((schema) => SchemaAST.getPropertySignatures(schema.ast)), Option4.flatMap((properties) => Array2.findFirst(properties, (p) => p.name === property)), Option4.flatMap((property2) => SchemaAST.getAnnotation(ReferenceAnnotationId)(unwrapOptional(property2))), Option4.map((annotation) => annotation.typename))), Effect3.flatMap(Option4.match({
1713
+ onNone: () => Effect3.succeed(Option4.none()),
1714
+ onSome: (typename) => resolve(DXN.fromTypename(typename).toString())
1715
+ })))),
1716
+ Match.when({
1717
+ type: "relation",
1718
+ filter: Match.defined
1719
+ }, ({ filter }) => typenameFromFilter(filter).pipe(Option4.map((typename) => resolve(typename)), Option4.getOrElse(() => Effect3.succeed(Option4.none())))),
1720
+ Match.when({
1721
+ type: "relation-traversal"
1722
+ }, ({ anchor, direction }) => resolveSchema(anchor, resolve).pipe(Effect3.map((base) => base.pipe(Option4.map((schema) => getTypeAnnotation3(schema)), Option4.flatMap((annotation) => Option4.fromNullable(direction === "source" ? annotation?.sourceSchema : annotation?.targetSchema)))), Effect3.flatMap(Option4.match({
1723
+ onNone: () => Effect3.succeed(Option4.none()),
1724
+ onSome: (typename) => resolve(typename)
1725
+ })))),
1726
+ Match.when({
1727
+ type: "options"
1728
+ }, ({ query: query2 }) => resolveSchema(query2, resolve)),
1729
+ Match.orElse((_q) => {
1730
+ return Effect3.succeed(Option4.none());
1731
+ })
1732
+ );
1733
+ };
1734
+ var typenameFromFilter = (filter) => Match.value(filter).pipe(Match.withReturnType(), Match.when({
1735
+ type: "object"
1736
+ }, ({ typename }) => Option4.fromNullable(typename)), Match.when({
1737
+ type: "and"
1738
+ }, ({ filters }) => EffectFunction.pipe(filters, Array2.map(typenameFromFilter), Array2.findFirst(Option4.isSome), Option4.flatten)), Match.when({
1739
+ type: "or"
1740
+ }, ({ filters }) => EffectFunction.pipe(filters, Array2.map(typenameFromFilter), Array2.findFirst(Option4.isSome), Option4.flatten)), Match.orElse(() => Option4.none()));
1741
+ var getQueryTarget = (query, space) => {
1742
+ return Match.value(query).pipe(Match.when({
1743
+ type: "options"
1744
+ }, ({ options }) => {
1745
+ return Option4.fromNullable(options.queues).pipe(Option4.flatMap((queues) => Array2.head(queues)), Option4.flatMap((queueDxn) => Option4.fromNullable(DXN.tryParse(queueDxn))), Option4.flatMap((queueDxn) => Option4.fromNullable(space?.queues.get(queueDxn))), Option4.getOrElse(() => space?.db));
1746
+ }), Match.orElse(() => space?.db));
1747
+ };
1748
+
1749
+ // src/components/ViewEditor.tsx
1750
+ import * as Schema2 from "effect/Schema";
1751
+ import React17, { useCallback as useCallback11, useState as useState11 } from "react";
1752
+ import { useOperationInvoker as useOperationInvoker10 } from "@dxos/app-framework/ui";
1753
+ import { DXN as DXN2, Filter as Filter3, Obj as Obj9, Query as Query2, Tag, Type as Type2 } from "@dxos/echo";
1754
+ import { useClient as useClient9 } from "@dxos/react-client";
1755
+ import { getSpace as getSpace2, useQuery as useQuery2 } from "@dxos/react-client/echo";
1756
+ import { useAsyncEffect } from "@dxos/react-ui";
1757
+ import { ViewEditor as NaturalViewEditor } from "@dxos/react-ui-form";
1758
+ import { View } from "@dxos/schema";
1759
+ var ViewEditor = ({ view }) => {
1760
+ const { invokePromise } = useOperationInvoker10();
1761
+ const client = useClient9();
1762
+ const space = getSpace2(view);
1763
+ const [schema, setSchema] = useState11(() => Schema2.Struct({}));
1764
+ const tags = useQuery2(space?.db, Filter3.type(Tag.Tag));
1765
+ const types = useTypeOptions({
1766
+ space,
1767
+ annotation: {
1768
+ location: [
1769
+ "database",
1770
+ "runtime"
1771
+ ],
1772
+ kind: [
1773
+ "user"
1774
+ ],
1775
+ registered: [
1776
+ "registered"
1777
+ ]
1778
+ }
1779
+ });
1780
+ useAsyncEffect(async () => {
1781
+ if (!view?.query || !space) {
1782
+ return;
1783
+ }
1784
+ const foundSchema = await resolveSchemaWithRegistry(space.db.schemaRegistry, view.query.ast);
1785
+ if (foundSchema && foundSchema !== schema) {
1786
+ setSchema(() => foundSchema);
1787
+ }
1788
+ }, [
1789
+ client,
1790
+ space,
1791
+ view,
1792
+ schema
1793
+ ]);
1794
+ const handleQueryChanged = useCallback11(async (newQuery, target) => {
1795
+ if (!view || !space) {
1796
+ return;
1797
+ }
1798
+ const queue = target && DXN2.tryParse(target) ? target : void 0;
1799
+ const query = queue ? Query2.fromAst(newQuery).options({
1800
+ queues: [
1801
+ queue
1802
+ ]
1803
+ }) : Query2.fromAst(newQuery);
1804
+ Obj9.change(view, (v) => {
1805
+ v.query.ast = query.ast;
1806
+ });
1807
+ const newSchema = await resolveSchemaWithRegistry(space.db.schemaRegistry, query.ast);
1808
+ if (!newSchema) {
1809
+ return;
1810
+ }
1811
+ const newView = View.make({
1812
+ query,
1813
+ jsonSchema: Type2.toJsonSchema(newSchema)
1814
+ });
1815
+ Obj9.change(view, (v) => {
1816
+ v.projection = Obj9.getSnapshot(newView).projection;
1817
+ });
1818
+ setSchema(() => newSchema);
1819
+ }, [
1820
+ view,
1821
+ schema
1822
+ ]);
1823
+ const handleDelete = useCallback11((fieldId) => {
1824
+ void invokePromise(SpaceOperation.DeleteField, {
1825
+ view,
1826
+ fieldId
1827
+ });
1828
+ }, [
1829
+ invokePromise,
1830
+ view
1831
+ ]);
1832
+ if (!space || !schema) {
1833
+ return null;
1834
+ }
1835
+ return /* @__PURE__ */ React17.createElement(NaturalViewEditor, {
1836
+ registry: space.db.schemaRegistry,
1837
+ schema,
1838
+ view,
1839
+ mode: "tag",
1840
+ tags,
1841
+ types,
1842
+ onQueryChanged: handleQueryChanged,
1843
+ onDelete: Type2.isMutable(schema) ? handleDelete : void 0
1844
+ });
1845
+ };
1846
+
1847
+ // src/components/index.ts
1848
+ import { lazy } from "react";
1849
+ var CollectionArticle = lazy(() => import("./CollectionArticle-XXLUNK3F.mjs"));
1850
+ var ObjectCardStack = lazy(() => import("./ObjectCardStack-CXNBCSMR.mjs"));
1851
+ var ObjectDetails = lazy(() => import("./ObjectDetails-HXV4IQEM.mjs"));
1852
+ var RecordArticle = lazy(() => import("./RecordArticle-36LDKFWF.mjs"));
1853
+
1854
+ export {
1855
+ AwaitingObject,
1856
+ CREATE_OBJECT_DIALOG,
1857
+ CreateObjectDialog,
1858
+ CREATE_SPACE_DIALOG,
1859
+ CreateSpaceDialog,
1860
+ CollectionSection,
1861
+ JOIN_DIALOG,
1862
+ JoinDialog,
1863
+ MembersContainer,
1864
+ MenuFooter,
1865
+ OBJECT_RENAME_POPOVER,
1866
+ ObjectRenamePopover,
1867
+ SchemaContainer,
1868
+ useQuerySpaceSchemas,
1869
+ SpacePluginSettings,
1870
+ SpacePresence,
1871
+ FullPresence,
1872
+ SmallPresenceLive,
1873
+ SmallPresence,
1874
+ SPACE_RENAME_POPOVER,
1875
+ SpaceRenamePopover,
1876
+ SpaceSettingsContainer,
1877
+ InlineSyncStatus,
1878
+ SyncStatus,
1879
+ SyncStatusIndicator,
1880
+ evalQuery,
1881
+ resolveSchemaWithRegistry,
1882
+ getQueryTarget,
1883
+ ViewEditor,
1884
+ CollectionArticle,
1885
+ ObjectCardStack,
1886
+ ObjectDetails,
1887
+ RecordArticle
1888
+ };
1889
+ //# sourceMappingURL=chunk-CMLRMQNM.mjs.map