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