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