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