@dxos/plugin-space 0.8.4-main.66e292d → 0.8.4-main.69d29f4

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