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