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