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