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