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