@dxos/plugin-space 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
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-MGK5HWPZ.mjs +288 -0
- package/dist/lib/browser/app-graph-builder-MGK5HWPZ.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-FOWFLYGU.mjs +80 -0
- package/dist/lib/browser/app-graph-serializer-FOWFLYGU.mjs.map +7 -0
- package/dist/lib/browser/chunk-23RVI5FZ.mjs +539 -0
- package/dist/lib/browser/chunk-23RVI5FZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-NU7WDVGN.mjs +23 -0
- package/dist/lib/browser/chunk-NU7WDVGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-PQXZCNAU.mjs +13 -0
- package/dist/lib/browser/chunk-PQXZCNAU.mjs.map +7 -0
- package/dist/lib/browser/chunk-S6B7627U.mjs +1809 -0
- package/dist/lib/browser/chunk-S6B7627U.mjs.map +7 -0
- package/dist/lib/browser/chunk-UDWHTKB5.mjs +136 -0
- package/dist/lib/browser/chunk-UDWHTKB5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-54VE4GTA.mjs → chunk-ULA2UQJ4.mjs} +25 -15
- package/dist/lib/browser/chunk-ULA2UQJ4.mjs.map +7 -0
- package/dist/lib/browser/identity-created-FYGS6TBH.mjs +28 -0
- package/dist/lib/browser/identity-created-FYGS6TBH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +219 -3480
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-QVR4MSJV.mjs +555 -0
- package/dist/lib/browser/intent-resolver-QVR4MSJV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-root-IP2ZB245.mjs +28 -0
- package/dist/lib/browser/react-root-IP2ZB245.mjs.map +7 -0
- package/dist/lib/browser/react-surface-BT3EHB6V.mjs +225 -0
- package/dist/lib/browser/react-surface-BT3EHB6V.mjs.map +7 -0
- package/dist/lib/browser/schema-5W3DSY2E.mjs +24 -0
- package/dist/lib/browser/schema-5W3DSY2E.mjs.map +7 -0
- package/dist/lib/browser/settings-PHPCXX33.mjs +24 -0
- package/dist/lib/browser/settings-PHPCXX33.mjs.map +7 -0
- package/dist/lib/browser/spaces-ready-K47RR7N2.mjs +199 -0
- package/dist/lib/browser/spaces-ready-K47RR7N2.mjs.map +7 -0
- package/dist/lib/browser/state-INJ63O57.mjs +47 -0
- package/dist/lib/browser/state-INJ63O57.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -4
- package/dist/lib/node/app-graph-builder-ZIUBXRPA.cjs +291 -0
- package/dist/lib/node/app-graph-builder-ZIUBXRPA.cjs.map +7 -0
- package/dist/lib/node/app-graph-serializer-VQOGHKXL.cjs +88 -0
- package/dist/lib/node/app-graph-serializer-VQOGHKXL.cjs.map +7 -0
- package/dist/lib/node/chunk-N2FS7PRA.cjs +1807 -0
- package/dist/lib/node/chunk-N2FS7PRA.cjs.map +7 -0
- package/dist/lib/node/chunk-OVGKWJOC.cjs +567 -0
- package/dist/lib/node/chunk-OVGKWJOC.cjs.map +7 -0
- package/dist/lib/node/chunk-U6DYXAR3.cjs +153 -0
- package/dist/lib/node/chunk-U6DYXAR3.cjs.map +7 -0
- package/dist/lib/node/{chunk-YF2AQ7KP.cjs → chunk-WAJKBO3J.cjs} +31 -20
- package/dist/lib/node/chunk-WAJKBO3J.cjs.map +7 -0
- package/dist/lib/node/{chunk-46S3JOES.cjs → chunk-WZR6OAN3.cjs} +9 -12
- package/dist/lib/node/chunk-WZR6OAN3.cjs.map +7 -0
- package/dist/lib/node/chunk-YZKNRFHU.cjs +43 -0
- package/dist/lib/node/chunk-YZKNRFHU.cjs.map +7 -0
- package/dist/lib/node/identity-created-AXI64BLE.cjs +44 -0
- package/dist/lib/node/identity-created-AXI64BLE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +203 -3468
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-MLENGECT.cjs +553 -0
- package/dist/lib/node/intent-resolver-MLENGECT.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-root-3OX5Z5CX.cjs +50 -0
- package/dist/lib/node/react-root-3OX5Z5CX.cjs.map +7 -0
- package/dist/lib/node/react-surface-5NYCMXSM.cjs +221 -0
- package/dist/lib/node/react-surface-5NYCMXSM.cjs.map +7 -0
- package/dist/lib/node/schema-YN7WVFRX.cjs +40 -0
- package/dist/lib/node/schema-YN7WVFRX.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → settings-5QYFWNH7.cjs} +19 -13
- package/dist/lib/node/settings-5QYFWNH7.cjs.map +7 -0
- package/dist/lib/node/spaces-ready-FQNAKR7G.cjs +210 -0
- package/dist/lib/node/spaces-ready-FQNAKR7G.cjs.map +7 -0
- package/dist/lib/node/state-57UE3DYE.cjs +61 -0
- package/dist/lib/node/state-57UE3DYE.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +19 -17
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/app-graph-builder-TERVM2SL.mjs +289 -0
- package/dist/lib/node-esm/app-graph-builder-TERVM2SL.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-GZRSWHEN.mjs +81 -0
- package/dist/lib/node-esm/app-graph-serializer-GZRSWHEN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2TQ2AJEZ.mjs +137 -0
- package/dist/lib/node-esm/chunk-2TQ2AJEZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6RSVVEPS.mjs +24 -0
- package/dist/lib/node-esm/chunk-6RSVVEPS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DIKRH2IK.mjs +1810 -0
- package/dist/lib/node-esm/chunk-DIKRH2IK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2MNFEB23.mjs → chunk-ICCM4YRJ.mjs} +5 -7
- package/dist/lib/node-esm/chunk-ICCM4YRJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PGH5L7MV.mjs +540 -0
- package/dist/lib/node-esm/chunk-PGH5L7MV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CDZETPO7.mjs → chunk-TRNZQEEN.mjs} +25 -15
- package/dist/lib/node-esm/chunk-TRNZQEEN.mjs.map +7 -0
- package/dist/lib/node-esm/identity-created-3CGEXNPO.mjs +29 -0
- package/dist/lib/node-esm/identity-created-3CGEXNPO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +219 -3480
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-BLW4RM6X.mjs +556 -0
- package/dist/lib/node-esm/intent-resolver-BLW4RM6X.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-root-7XXGP56B.mjs +29 -0
- package/dist/lib/node-esm/react-root-7XXGP56B.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-R2ECJSFB.mjs +226 -0
- package/dist/lib/node-esm/react-surface-R2ECJSFB.mjs.map +7 -0
- package/dist/lib/node-esm/schema-LOR2EVGY.mjs +25 -0
- package/dist/lib/node-esm/schema-LOR2EVGY.mjs.map +7 -0
- package/dist/lib/node-esm/settings-H6MXTEQM.mjs +25 -0
- package/dist/lib/node-esm/settings-H6MXTEQM.mjs.map +7 -0
- package/dist/lib/node-esm/spaces-ready-HKAQG5SA.mjs +200 -0
- package/dist/lib/node-esm/spaces-ready-HKAQG5SA.mjs.map +7 -0
- package/dist/lib/node-esm/state-VYA6OFHD.mjs +48 -0
- package/dist/lib/node-esm/state-VYA6OFHD.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -4
- package/dist/types/src/SpacePlugin.d.ts +3 -22
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +4 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +22 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/identity-created.d.ts +4 -0
- package/dist/types/src/capabilities/identity-created.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +197 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +9 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +7 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +4 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts +4 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +5 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts +6 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts +7 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts +2 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/AwaitingObject.d.ts +1 -2
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/BaseObjectSettings.d.ts +6 -0
- package/dist/types/src/components/BaseObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/CollectionMain.d.ts +1 -2
- package/dist/types/src/components/CollectionMain.d.ts.map +1 -1
- package/dist/types/src/components/CollectionSection.d.ts +1 -2
- package/dist/types/src/components/CollectionSection.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +2 -5
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +9 -11
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -2
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -2
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts +1 -2
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/PersistenceStatus.d.ts +1 -2
- package/dist/types/src/components/PersistenceStatus.d.ts.map +1 -1
- package/dist/types/src/components/PopoverAddSpace.d.ts +3 -0
- package/dist/types/src/components/PopoverAddSpace.d.ts.map +1 -0
- package/dist/types/src/components/PopoverRenameObject.d.ts +1 -2
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -2
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/ShareSpaceButton.d.ts +2 -3
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts +1 -2
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts +4 -5
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +2 -3
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +1 -2
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts +3 -5
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts +1 -2
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/Space.d.ts +2 -3
- package/dist/types/src/components/SyncStatus/Space.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +3 -4
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +9 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +21 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/collection.d.ts +2 -2
- package/dist/types/src/types/thread.d.ts +34 -34
- package/dist/types/src/types/types.d.ts +41 -37
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +10 -8
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -47
- package/src/SpacePlugin.tsx +141 -1410
- package/src/capabilities/app-graph-builder.ts +319 -0
- package/src/capabilities/app-graph-serializer.ts +73 -0
- package/src/capabilities/capabilities.ts +28 -0
- package/src/capabilities/identity-created.ts +26 -0
- package/src/capabilities/index.ts +18 -0
- package/src/capabilities/intent-resolver.ts +536 -0
- package/src/capabilities/react-root.tsx +20 -0
- package/src/capabilities/react-surface.tsx +210 -0
- package/src/capabilities/schema.ts +27 -0
- package/src/capabilities/settings.ts +17 -0
- package/src/capabilities/spaces-ready.ts +230 -0
- package/src/capabilities/state.ts +45 -0
- package/src/components/AdvancedObjectSettings/AdvancedObjectSettings.tsx +72 -0
- package/src/components/AdvancedObjectSettings/ForeignKeys.tsx +51 -0
- package/src/components/AdvancedObjectSettings/index.ts +5 -0
- package/src/components/AwaitingObject.tsx +5 -11
- package/src/components/{DefaultObjectSettings.tsx → BaseObjectSettings.tsx} +9 -2
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +1 -3
- package/src/components/CreateDialog/CreateObjectDialog.tsx +43 -35
- package/src/components/CreateDialog/CreateObjectPanel.tsx +139 -105
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +18 -9
- package/src/components/JoinDialog.tsx +27 -19
- package/src/components/PopoverAddSpace.tsx +46 -0
- package/src/components/SpacePluginSettings.tsx +5 -10
- package/src/components/SpacePresence.stories.tsx +2 -2
- package/src/components/SpacePresence.tsx +7 -7
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +16 -1
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +5 -1
- package/src/components/SpaceSettings/SpaceSettingsPanel.tsx +30 -8
- package/src/components/SyncStatus/InlineSyncStatus.tsx +2 -2
- package/src/components/SyncStatus/SyncStatus.tsx +2 -1
- package/src/components/index.ts +3 -1
- package/src/events.ts +18 -0
- package/src/index.ts +3 -7
- package/src/meta.ts +2 -3
- package/src/translations.ts +7 -0
- package/src/types/types.ts +32 -51
- package/src/util.tsx +45 -29
- package/dist/lib/browser/chunk-54VE4GTA.mjs.map +0 -7
- package/dist/lib/browser/chunk-73BCBSLP.mjs +0 -15
- package/dist/lib/browser/chunk-73BCBSLP.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/chunk-46S3JOES.cjs.map +0 -7
- package/dist/lib/node/chunk-YF2AQ7KP.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-2MNFEB23.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CDZETPO7.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -12
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts.map +0 -1
|
@@ -1,3531 +1,273 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
translations_default
|
|
3
|
+
} from "./chunk-UDWHTKB5.mjs";
|
|
4
|
+
import {
|
|
5
|
+
AdvancedObjectSettings,
|
|
6
|
+
AppGraphBuilder,
|
|
7
|
+
AppGraphSerializer,
|
|
8
|
+
AwaitingObject,
|
|
9
|
+
BaseObjectSettings,
|
|
10
|
+
CREATE_OBJECT_DIALOG,
|
|
11
|
+
CREATE_SPACE_DIALOG,
|
|
12
|
+
CollectionMain,
|
|
13
|
+
CollectionSection,
|
|
14
|
+
CreateObjectDialog,
|
|
15
|
+
CreateSpaceDialog,
|
|
16
|
+
FullPresence,
|
|
17
|
+
IdentityCreated,
|
|
18
|
+
InlineSyncStatus,
|
|
19
|
+
IntentResolver,
|
|
20
|
+
JOIN_DIALOG,
|
|
21
|
+
JoinDialog,
|
|
22
|
+
MenuFooter,
|
|
23
|
+
POPOVER_ADD_SPACE,
|
|
24
|
+
POPOVER_RENAME_OBJECT,
|
|
25
|
+
POPOVER_RENAME_SPACE,
|
|
26
|
+
PersistenceStatus,
|
|
27
|
+
PopoverAddSpace,
|
|
28
|
+
PopoverRenameObject,
|
|
29
|
+
PopoverRenameSpace,
|
|
30
|
+
ReactRoot,
|
|
31
|
+
ReactSurface,
|
|
32
|
+
SPACE_SETTINGS_DIALOG,
|
|
33
|
+
Schema,
|
|
34
|
+
ShareSpaceButton,
|
|
35
|
+
ShareSpaceButtonImpl,
|
|
36
|
+
SmallPresence,
|
|
37
|
+
SmallPresenceLive,
|
|
38
|
+
SpacePluginSettings,
|
|
39
|
+
SpacePresence,
|
|
40
|
+
SpaceSettings,
|
|
41
|
+
SpaceSettingsDialog,
|
|
42
|
+
SpaceSettingsPanel,
|
|
43
|
+
SpaceState,
|
|
44
|
+
SpacesReady,
|
|
45
|
+
SyncStatus,
|
|
46
|
+
SyncStatusDetail,
|
|
47
|
+
SyncStatusIndicator
|
|
48
|
+
} from "./chunk-S6B7627U.mjs";
|
|
49
|
+
import {
|
|
50
|
+
SpaceCapabilities,
|
|
51
|
+
ThreadCapabilities
|
|
52
|
+
} from "./chunk-NU7WDVGN.mjs";
|
|
53
|
+
import {
|
|
54
|
+
COMPOSER_SPACE_LOCK,
|
|
55
|
+
SHARED,
|
|
56
|
+
SPACES,
|
|
57
|
+
SPACE_TYPE,
|
|
58
|
+
cloneObject,
|
|
59
|
+
constructObjectActions,
|
|
60
|
+
constructSpaceActions,
|
|
61
|
+
constructSpaceNode,
|
|
62
|
+
createObjectNode,
|
|
63
|
+
getActiveSpace,
|
|
64
|
+
getNestedObjects,
|
|
65
|
+
getSpaceDisplayName,
|
|
66
|
+
memoizeQuery
|
|
67
|
+
} from "./chunk-23RVI5FZ.mjs";
|
|
68
|
+
import {
|
|
4
69
|
CollectionAction,
|
|
5
70
|
CollectionType,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
MessageType,
|
|
9
|
-
SPACE_ACTION,
|
|
10
|
-
SPACE_DIRECTORY_HANDLE,
|
|
11
|
-
SpaceAction,
|
|
12
|
-
SpaceForm,
|
|
13
|
-
ThreadStatus,
|
|
14
|
-
ThreadType,
|
|
15
|
-
parseSchemaPlugin
|
|
16
|
-
} from "./chunk-54VE4GTA.mjs";
|
|
71
|
+
defineObjectForm
|
|
72
|
+
} from "./chunk-ULA2UQJ4.mjs";
|
|
17
73
|
import {
|
|
18
74
|
SPACE_PLUGIN,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
75
|
+
meta
|
|
76
|
+
} from "./chunk-PQXZCNAU.mjs";
|
|
77
|
+
|
|
78
|
+
// packages/plugins/plugin-space/src/events.ts
|
|
79
|
+
import { defineEvent } from "@dxos/app-framework";
|
|
80
|
+
var SpaceEvents;
|
|
81
|
+
(function(SpaceEvents2) {
|
|
82
|
+
SpaceEvents2.SetupSettingsPanel = defineEvent(`${SPACE_PLUGIN}/event/setup-settings-panel`);
|
|
83
|
+
SpaceEvents2.StateReady = defineEvent(`${SPACE_PLUGIN}/event/state-ready`);
|
|
84
|
+
SpaceEvents2.DefaultSpaceReady = defineEvent(`${SPACE_PLUGIN}/event/default-space-ready`);
|
|
85
|
+
})(SpaceEvents || (SpaceEvents = {}));
|
|
86
|
+
var ThreadEvents;
|
|
87
|
+
(function(ThreadEvents2) {
|
|
88
|
+
ThreadEvents2.SetupThread = defineEvent(`${SPACE_PLUGIN}/event/setup-thread`);
|
|
89
|
+
})(ThreadEvents || (ThreadEvents = {}));
|
|
22
90
|
|
|
23
91
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { LocalStorageStore } from "@dxos/local-storage";
|
|
32
|
-
import { log as log3 } from "@dxos/log";
|
|
33
|
-
import { Migrations as Migrations2 } from "@dxos/migrations";
|
|
34
|
-
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
35
|
-
import { parseClientPlugin } from "@dxos/plugin-client/types";
|
|
36
|
-
import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
|
|
37
|
-
import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/types";
|
|
38
|
-
import { EdgeReplicationSetting as EdgeReplicationSetting3 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
39
|
-
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
40
|
-
import { Expando, FQ_ID_LENGTH, Filter as Filter3, OBJECT_ID_LENGTH, QueryOptions, SPACE_ID_LENGTH, SpaceState as SpaceState2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace5, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace4, parseFullyQualifiedId, parseId } from "@dxos/react-client/echo";
|
|
92
|
+
import { allOf, Capabilities, contributes, createIntent, defineModule, definePlugin, Events, oneOf } from "@dxos/app-framework";
|
|
93
|
+
import { S } from "@dxos/echo-schema";
|
|
94
|
+
import { RefArray } from "@dxos/live-object";
|
|
95
|
+
import { AttentionEvents } from "@dxos/plugin-attention";
|
|
96
|
+
import { ClientEvents } from "@dxos/plugin-client";
|
|
97
|
+
import { DeckCapabilities, DeckEvents } from "@dxos/plugin-deck";
|
|
98
|
+
import { isEchoObject, getSpace } from "@dxos/react-client/echo";
|
|
41
99
|
import { osTranslations } from "@dxos/shell/react";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
import { useResolvePlugin, parseNavigationPlugin, NavigationAction, useIntentDispatcher, createIntent } from "@dxos/app-framework";
|
|
48
|
-
import { useClient } from "@dxos/react-client";
|
|
49
|
-
import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
|
|
50
|
-
import { Button, Toast, useTranslation } from "@dxos/react-ui";
|
|
51
|
-
import { getSize, mx } from "@dxos/react-ui-theme";
|
|
52
|
-
var WAIT_FOR_OBJECT_TIMEOUT = 18e4;
|
|
53
|
-
var TOAST_TIMEOUT = 24e4;
|
|
54
|
-
var AwaitingObject = ({ id }) => {
|
|
55
|
-
const [open, setOpen] = useState(true);
|
|
56
|
-
const [waiting, setWaiting] = useState(true);
|
|
57
|
-
const [found, setFound] = useState(false);
|
|
58
|
-
const { t } = useTranslation(SPACE_PLUGIN);
|
|
59
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
60
|
-
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
61
|
-
const client = useClient();
|
|
62
|
-
const objects = useQuery(client.spaces, Filter.all());
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (!id) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const timeout = setTimeout(() => {
|
|
68
|
-
setWaiting(false);
|
|
69
|
-
}, WAIT_FOR_OBJECT_TIMEOUT);
|
|
70
|
-
() => clearTimeout(timeout);
|
|
71
|
-
}, [
|
|
72
|
-
id
|
|
73
|
-
]);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (objects.findIndex((object) => fullyQualifiedId(object) === id) > -1) {
|
|
76
|
-
setFound(true);
|
|
77
|
-
if (navigationPlugin?.provides.location.active.solo?.[0].id === id) {
|
|
78
|
-
setOpen(false);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, [
|
|
82
|
-
id,
|
|
83
|
-
objects,
|
|
84
|
-
navigationPlugin
|
|
85
|
-
]);
|
|
86
|
-
const handleClose = useCallback(async () => dispatch(createIntent(SpaceAction.WaitForObject, {
|
|
87
|
-
id: void 0
|
|
88
|
-
})), [
|
|
89
|
-
dispatch
|
|
90
|
-
]);
|
|
91
|
-
const handleNavigate = useCallback(() => {
|
|
92
|
-
void dispatch(createIntent(NavigationAction.Open, {
|
|
93
|
-
activeParts: {
|
|
94
|
-
main: [
|
|
95
|
-
id
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
void handleClose();
|
|
100
|
-
}, [
|
|
101
|
-
id,
|
|
102
|
-
handleClose,
|
|
103
|
-
dispatch
|
|
104
|
-
]);
|
|
105
|
-
return /* @__PURE__ */ React.createElement(Toast.Root, {
|
|
106
|
-
open,
|
|
107
|
-
duration: TOAST_TIMEOUT,
|
|
108
|
-
onOpenChange: setOpen
|
|
109
|
-
}, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
|
|
110
|
-
classNames: "flex items-center gap-2"
|
|
111
|
-
}, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CheckCircle, {
|
|
112
|
-
className: getSize(5)
|
|
113
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleNotch, {
|
|
114
|
-
className: mx(getSize(5), "animate-spin")
|
|
115
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleDashed, {
|
|
116
|
-
className: getSize(5)
|
|
117
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("object not found label")))), /* @__PURE__ */ React.createElement(Toast.Description, null, t(found ? "found object description" : waiting ? "waiting for object description" : "object not found description"))), /* @__PURE__ */ React.createElement(Toast.Actions, null, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toast.Action, {
|
|
118
|
-
altText: t("go to object alt"),
|
|
119
|
-
asChild: true
|
|
120
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
121
|
-
variant: "primary",
|
|
122
|
-
onClick: handleNavigate
|
|
123
|
-
}, t("go to object label"))), /* @__PURE__ */ React.createElement(Toast.Close, {
|
|
124
|
-
asChild: true
|
|
125
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
126
|
-
onClick: handleClose
|
|
127
|
-
}, t("close label", {
|
|
128
|
-
ns: "appkit"
|
|
129
|
-
})))) : /* @__PURE__ */ React.createElement(Toast.Close, {
|
|
130
|
-
asChild: true
|
|
131
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
132
|
-
onClick: handleClose
|
|
133
|
-
}, t(waiting ? "close label" : "confirm label", {
|
|
134
|
-
ns: "appkit"
|
|
135
|
-
})))));
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
|
|
139
|
-
import { pipe } from "effect";
|
|
140
|
-
import React3, { useCallback as useCallback3, useRef } from "react";
|
|
141
|
-
import { chain, createIntent as createIntent3, NavigationAction as NavigationAction3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
142
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
143
|
-
import { getSpace as getSpace2, isReactiveObject as isReactiveObject2, isSpace as isSpace3, useSpaces } from "@dxos/react-client/echo";
|
|
144
|
-
import { Button as Button2, Dialog, Icon as Icon2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
145
|
-
|
|
146
|
-
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
|
|
147
|
-
import React2, { useCallback as useCallback2, useState as useState2 } from "react";
|
|
148
|
-
import { getObjectAnnotation as getObjectAnnotation2, S } from "@dxos/echo-schema";
|
|
149
|
-
import { isSpace as isSpace2 } from "@dxos/react-client/echo";
|
|
150
|
-
import { Icon, IconButton, Input, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
151
|
-
import { Form, InputHeader } from "@dxos/react-ui-form";
|
|
152
|
-
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
153
|
-
import { nonNullable } from "@dxos/util";
|
|
154
|
-
|
|
155
|
-
// packages/plugins/plugin-space/src/util.tsx
|
|
156
|
-
import { createIntent as createIntent2, NavigationAction as NavigationAction2 } from "@dxos/app-framework";
|
|
157
|
-
import { EXPANDO_TYPENAME, getObjectAnnotation, getTypename } from "@dxos/echo-schema";
|
|
158
|
-
import { invariant } from "@dxos/invariant";
|
|
159
|
-
import { getSchema, isReactiveObject, makeRef } from "@dxos/live-object";
|
|
160
|
-
import { Migrations } from "@dxos/migrations";
|
|
161
|
-
import { ACTION_GROUP_TYPE, ACTION_TYPE, cleanup, getGraph, memoize } from "@dxos/plugin-graph";
|
|
162
|
-
import { Filter as Filter2, fullyQualifiedId as fullyQualifiedId2, getSpace, isEchoObject, isSpace, SpaceState } from "@dxos/react-client/echo";
|
|
163
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/util.tsx";
|
|
164
|
-
var SPACES = `${SPACE_PLUGIN}-spaces`;
|
|
165
|
-
var SPACE_TYPE = "dxos.org/type/Space";
|
|
166
|
-
var COMPOSER_SPACE_LOCK = "dxos.org/plugin/space/lock";
|
|
167
|
-
var SHARED = "shared-spaces";
|
|
168
|
-
var EMPTY_ARRAY = [];
|
|
169
|
-
var memoizeQuery = (spaceOrEcho, filter, options) => {
|
|
170
|
-
const key = JSON.stringify({
|
|
171
|
-
space: isSpace(spaceOrEcho) ? spaceOrEcho.id : void 0,
|
|
172
|
-
filter: Filter2.from(filter).toProto()
|
|
173
|
-
});
|
|
174
|
-
const query = memoize(() => isSpace(spaceOrEcho) ? spaceOrEcho.db.query(filter, options) : spaceOrEcho?.query(filter, options), key);
|
|
175
|
-
const unsubscribe = memoize(() => query?.subscribe(), key);
|
|
176
|
-
cleanup(() => unsubscribe?.());
|
|
177
|
-
return query?.objects ?? EMPTY_ARRAY;
|
|
178
|
-
};
|
|
179
|
-
var getSpaceDisplayName = (space, { personal, namesCache = {} } = {}) => {
|
|
180
|
-
return space.state.get() === SpaceState.SPACE_READY && (space.properties.name?.length ?? 0) > 0 ? space.properties.name : namesCache[space.id] ? namesCache[space.id] : personal ? [
|
|
181
|
-
"personal space label",
|
|
182
|
-
{
|
|
183
|
-
ns: SPACE_PLUGIN
|
|
184
|
-
}
|
|
185
|
-
] : [
|
|
186
|
-
"unnamed space label",
|
|
187
|
-
{
|
|
188
|
-
ns: SPACE_PLUGIN
|
|
189
|
-
}
|
|
190
|
-
];
|
|
191
|
-
};
|
|
192
|
-
var getCollectionGraphNodePartials = ({ navigable, collection, space, resolve }) => {
|
|
193
|
-
return {
|
|
194
|
-
disabled: !navigable,
|
|
195
|
-
acceptPersistenceClass: /* @__PURE__ */ new Set([
|
|
196
|
-
"echo"
|
|
197
|
-
]),
|
|
198
|
-
acceptPersistenceKey: /* @__PURE__ */ new Set([
|
|
199
|
-
space.id
|
|
200
|
-
]),
|
|
201
|
-
role: "branch",
|
|
202
|
-
onRearrangeChildren: (nextOrder) => {
|
|
203
|
-
collection.objects = nextOrder.filter(isEchoObject).map(makeRef);
|
|
204
|
-
},
|
|
205
|
-
onTransferStart: (child, index) => {
|
|
206
|
-
if (!collection.objects.find((object) => object.target === child.data)) {
|
|
207
|
-
if (typeof index !== "undefined") {
|
|
208
|
-
collection.objects.splice(index, 0, makeRef(child.data));
|
|
209
|
-
} else {
|
|
210
|
-
collection.objects.push(makeRef(child.data));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
onTransferEnd: (child, destination) => {
|
|
215
|
-
const index = collection.objects.findIndex((object) => object.target === child.data);
|
|
216
|
-
if (index > -1) {
|
|
217
|
-
collection.objects.splice(index, 1);
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
onCopy: async (child, index) => {
|
|
221
|
-
const newObject = await cloneObject(child.data, resolve, space);
|
|
222
|
-
space.db.add(newObject);
|
|
223
|
-
if (typeof index !== "undefined") {
|
|
224
|
-
collection.objects.splice(index, 0, makeRef(newObject));
|
|
225
|
-
} else {
|
|
226
|
-
collection.objects.push(makeRef(newObject));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
var checkPendingMigration = (space) => {
|
|
232
|
-
return space.state.get() === SpaceState.SPACE_REQUIRES_MIGRATION || space.state.get() === SpaceState.SPACE_READY && !!Migrations.versionProperty && space.properties[Migrations.versionProperty] !== Migrations.targetVersion;
|
|
233
|
-
};
|
|
234
|
-
var constructSpaceNode = ({ space, navigable = false, personal, namesCache, resolve }) => {
|
|
235
|
-
const hasPendingMigration = checkPendingMigration(space);
|
|
236
|
-
const collection = space.state.get() === SpaceState.SPACE_READY && space.properties[CollectionType.typename]?.target;
|
|
237
|
-
const partials = space.state.get() === SpaceState.SPACE_READY && collection instanceof CollectionType ? getCollectionGraphNodePartials({
|
|
238
|
-
collection,
|
|
239
|
-
space,
|
|
240
|
-
resolve,
|
|
241
|
-
navigable
|
|
242
|
-
}) : {};
|
|
243
|
-
return {
|
|
244
|
-
id: space.id,
|
|
245
|
-
type: SPACE_TYPE,
|
|
246
|
-
cacheable: [
|
|
247
|
-
"label",
|
|
248
|
-
"icon",
|
|
249
|
-
"role"
|
|
250
|
-
],
|
|
251
|
-
data: space,
|
|
252
|
-
properties: {
|
|
253
|
-
...partials,
|
|
254
|
-
label: getSpaceDisplayName(space, {
|
|
255
|
-
personal,
|
|
256
|
-
namesCache
|
|
257
|
-
}),
|
|
258
|
-
description: space.state.get() === SpaceState.SPACE_READY && space.properties.description,
|
|
259
|
-
icon: "ph--planet--regular",
|
|
260
|
-
disabled: !navigable || space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
261
|
-
testId: "spacePlugin.space"
|
|
262
|
-
}
|
|
100
|
+
var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "spaceInvitationCode", observability = true } = {}) => {
|
|
101
|
+
const createInvitationUrl = (invitationCode) => {
|
|
102
|
+
const baseUrl = new URL(invitationUrl);
|
|
103
|
+
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
104
|
+
return baseUrl.toString();
|
|
263
105
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
type: ACTION_GROUP_TYPE,
|
|
274
|
-
data: async () => {
|
|
275
|
-
await dispatch(createIntent2(SpaceAction.Migrate, {
|
|
276
|
-
space
|
|
277
|
-
}));
|
|
278
|
-
},
|
|
279
|
-
properties: {
|
|
280
|
-
label: [
|
|
281
|
-
"migrate space label",
|
|
282
|
-
{
|
|
283
|
-
ns: SPACE_PLUGIN
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
icon: "ph--database--regular",
|
|
287
|
-
disposition: "toolbar",
|
|
288
|
-
disabled: migrating || Migrations.running(space)
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
if (state === SpaceState.SPACE_READY && !hasPendingMigration) {
|
|
293
|
-
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
294
|
-
actions.push({
|
|
295
|
-
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
296
|
-
type: ACTION_TYPE,
|
|
297
|
-
data: async () => {
|
|
298
|
-
await dispatch(createIntent2(SpaceAction.OpenCreateObject, {
|
|
299
|
-
target: space
|
|
300
|
-
}));
|
|
301
|
-
},
|
|
302
|
-
properties: {
|
|
303
|
-
label: [
|
|
304
|
-
"create object in space label",
|
|
305
|
-
{
|
|
306
|
-
ns: SPACE_PLUGIN
|
|
307
|
-
}
|
|
308
|
-
],
|
|
309
|
-
icon: "ph--plus--regular",
|
|
310
|
-
disposition: "toolbar",
|
|
311
|
-
testId: "spacePlugin.createObject"
|
|
312
|
-
}
|
|
313
|
-
}, {
|
|
314
|
-
id: getId(SpaceAction.Share._tag),
|
|
315
|
-
type: ACTION_TYPE,
|
|
316
|
-
data: async () => {
|
|
317
|
-
if (locked) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
await dispatch(createIntent2(SpaceAction.Share, {
|
|
321
|
-
space
|
|
322
|
-
}));
|
|
323
|
-
},
|
|
324
|
-
properties: {
|
|
325
|
-
label: [
|
|
326
|
-
"share space label",
|
|
327
|
-
{
|
|
328
|
-
ns: SPACE_PLUGIN
|
|
329
|
-
}
|
|
330
|
-
],
|
|
331
|
-
icon: "ph--users--regular",
|
|
332
|
-
disabled: locked,
|
|
333
|
-
keyBinding: {
|
|
334
|
-
macos: "meta+.",
|
|
335
|
-
windows: "alt+."
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}, {
|
|
339
|
-
id: locked ? getId(SpaceAction.Unlock._tag) : getId(SpaceAction.Lock._tag),
|
|
340
|
-
type: ACTION_TYPE,
|
|
341
|
-
data: async () => {
|
|
342
|
-
if (locked) {
|
|
343
|
-
await dispatch(createIntent2(SpaceAction.Unlock, {
|
|
344
|
-
space
|
|
345
|
-
}));
|
|
346
|
-
} else {
|
|
347
|
-
await dispatch(createIntent2(SpaceAction.Lock, {
|
|
348
|
-
space
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
properties: {
|
|
353
|
-
label: [
|
|
354
|
-
locked ? "unlock space label" : "lock space label",
|
|
355
|
-
{
|
|
356
|
-
ns: SPACE_PLUGIN
|
|
357
|
-
}
|
|
358
|
-
],
|
|
359
|
-
icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
360
|
-
}
|
|
361
|
-
}, {
|
|
362
|
-
id: getId(SpaceAction.Rename._tag),
|
|
363
|
-
type: ACTION_TYPE,
|
|
364
|
-
data: async (params) => {
|
|
365
|
-
await dispatch(createIntent2(SpaceAction.Rename, {
|
|
366
|
-
space,
|
|
367
|
-
caller: params.caller
|
|
368
|
-
}));
|
|
369
|
-
},
|
|
370
|
-
properties: {
|
|
371
|
-
label: [
|
|
372
|
-
"rename space label",
|
|
373
|
-
{
|
|
374
|
-
ns: SPACE_PLUGIN
|
|
375
|
-
}
|
|
376
|
-
],
|
|
377
|
-
icon: "ph--pencil-simple-line--regular",
|
|
378
|
-
keyBinding: {
|
|
379
|
-
macos: "shift+F6",
|
|
380
|
-
windows: "shift+F6"
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}, {
|
|
384
|
-
id: getId(SpaceAction.OpenSettings._tag),
|
|
385
|
-
type: ACTION_TYPE,
|
|
386
|
-
data: async () => {
|
|
387
|
-
await dispatch(createIntent2(SpaceAction.OpenSettings, {
|
|
388
|
-
space
|
|
389
|
-
}));
|
|
390
|
-
},
|
|
391
|
-
properties: {
|
|
392
|
-
label: [
|
|
393
|
-
"open space settings label",
|
|
394
|
-
{
|
|
395
|
-
ns: SPACE_PLUGIN
|
|
396
|
-
}
|
|
397
|
-
],
|
|
398
|
-
icon: "ph--gear--regular"
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
if (state !== SpaceState.SPACE_INACTIVE && !hasPendingMigration) {
|
|
403
|
-
actions.push({
|
|
404
|
-
id: getId(SpaceAction.Close._tag),
|
|
405
|
-
type: ACTION_TYPE,
|
|
406
|
-
data: async () => {
|
|
407
|
-
await dispatch(createIntent2(SpaceAction.Close, {
|
|
408
|
-
space
|
|
409
|
-
}));
|
|
410
|
-
},
|
|
411
|
-
properties: {
|
|
412
|
-
label: [
|
|
413
|
-
"close space label",
|
|
414
|
-
{
|
|
415
|
-
ns: SPACE_PLUGIN
|
|
416
|
-
}
|
|
417
|
-
],
|
|
418
|
-
icon: "ph--x--regular",
|
|
419
|
-
disabled: personal
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
if (state === SpaceState.SPACE_INACTIVE) {
|
|
424
|
-
actions.push({
|
|
425
|
-
id: getId(SpaceAction.Open._tag),
|
|
426
|
-
type: ACTION_TYPE,
|
|
427
|
-
data: async () => {
|
|
428
|
-
await dispatch(createIntent2(SpaceAction.Open, {
|
|
429
|
-
space
|
|
430
|
-
}));
|
|
431
|
-
},
|
|
432
|
-
properties: {
|
|
433
|
-
label: [
|
|
434
|
-
"open space label",
|
|
435
|
-
{
|
|
436
|
-
ns: SPACE_PLUGIN
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
icon: "ph--clock-counter-clockwise--regular",
|
|
440
|
-
disposition: "toolbar"
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
return actions;
|
|
445
|
-
};
|
|
446
|
-
var createObjectNode = ({ object, space, navigable = false, resolve }) => {
|
|
447
|
-
const type = getTypename(object);
|
|
448
|
-
if (!type) {
|
|
449
|
-
return void 0;
|
|
450
|
-
}
|
|
451
|
-
const metadata = resolve(type);
|
|
452
|
-
if (Object.keys(metadata).length === 0) {
|
|
453
|
-
return void 0;
|
|
454
|
-
}
|
|
455
|
-
const partials = object instanceof CollectionType ? getCollectionGraphNodePartials({
|
|
456
|
-
collection: object,
|
|
457
|
-
space,
|
|
458
|
-
resolve,
|
|
459
|
-
navigable
|
|
460
|
-
}) : metadata.graphProps;
|
|
461
|
-
return {
|
|
462
|
-
id: fullyQualifiedId2(object),
|
|
463
|
-
type,
|
|
464
|
-
cacheable: [
|
|
465
|
-
"label",
|
|
466
|
-
"icon",
|
|
467
|
-
"role"
|
|
468
|
-
],
|
|
469
|
-
data: object,
|
|
470
|
-
properties: {
|
|
471
|
-
...partials,
|
|
472
|
-
label: metadata.label?.(object) || object.name || metadata.placeholder || [
|
|
473
|
-
"unnamed object label",
|
|
474
|
-
{
|
|
475
|
-
ns: SPACE_PLUGIN
|
|
476
|
-
}
|
|
106
|
+
return definePlugin(meta, [
|
|
107
|
+
defineModule({
|
|
108
|
+
id: `${meta.id}/module/state`,
|
|
109
|
+
// TODO(wittjosiah): Does not integrate with settings store.
|
|
110
|
+
// Should this be a different event?
|
|
111
|
+
// Should settings store be renamed to be more generic?
|
|
112
|
+
activatesOn: oneOf(Events.SetupSettings, Events.SetupAppGraph),
|
|
113
|
+
activatesAfter: [
|
|
114
|
+
SpaceEvents.StateReady
|
|
477
115
|
],
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
"
|
|
116
|
+
activate: SpaceState
|
|
117
|
+
}),
|
|
118
|
+
defineModule({
|
|
119
|
+
id: `${meta.id}/module/settings`,
|
|
120
|
+
activatesOn: Events.SetupSettings,
|
|
121
|
+
activate: SpaceSettings
|
|
122
|
+
}),
|
|
123
|
+
defineModule({
|
|
124
|
+
id: `${meta.id}/module/translations`,
|
|
125
|
+
activatesOn: Events.SetupTranslations,
|
|
126
|
+
activate: () => contributes(Capabilities.Translations, [
|
|
127
|
+
...translations_default,
|
|
128
|
+
osTranslations
|
|
129
|
+
])
|
|
130
|
+
}),
|
|
131
|
+
defineModule({
|
|
132
|
+
id: `${meta.id}/module/metadata`,
|
|
133
|
+
activatesOn: Events.SetupMetadata,
|
|
134
|
+
activate: () => contributes(Capabilities.Metadata, {
|
|
135
|
+
id: CollectionType.typename,
|
|
136
|
+
metadata: {
|
|
137
|
+
placeholder: [
|
|
138
|
+
"unnamed collection label",
|
|
501
139
|
{
|
|
502
140
|
ns: SPACE_PLUGIN
|
|
503
141
|
}
|
|
504
142
|
],
|
|
505
|
-
icon: "ph--
|
|
506
|
-
|
|
507
|
-
|
|
143
|
+
icon: "ph--cards-three--regular",
|
|
144
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
145
|
+
loadReferences: async (collection) => await RefArray.loadAll([
|
|
146
|
+
...collection.objects,
|
|
147
|
+
...Object.values(collection.views)
|
|
148
|
+
])
|
|
508
149
|
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
{
|
|
512
|
-
id:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
})
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
icon: "ph--pencil-simple-line--regular",
|
|
528
|
-
// TODO(wittjosiah): Doesn't work.
|
|
529
|
-
// keyBinding: 'shift+F6',
|
|
530
|
-
testId: "spacePlugin.renameObject"
|
|
531
|
-
}
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
id: getId(SpaceAction.RemoveObjects._tag),
|
|
535
|
-
type: ACTION_TYPE,
|
|
536
|
-
data: async () => {
|
|
537
|
-
const graph = getGraph(node);
|
|
538
|
-
const collection = graph.nodes(node, {
|
|
539
|
-
relation: "inbound"
|
|
540
|
-
}).find(({ data }) => data instanceof CollectionType)?.data;
|
|
541
|
-
await dispatch(createIntent2(SpaceAction.RemoveObjects, {
|
|
542
|
-
objects: [
|
|
543
|
-
object
|
|
544
|
-
],
|
|
545
|
-
target: collection
|
|
546
|
-
}));
|
|
547
|
-
},
|
|
548
|
-
properties: {
|
|
549
|
-
label: [
|
|
550
|
-
object instanceof CollectionType ? "delete collection label" : "delete object label",
|
|
551
|
-
{
|
|
552
|
-
ns: SPACE_PLUGIN
|
|
553
|
-
}
|
|
554
|
-
],
|
|
555
|
-
icon: "ph--trash--regular",
|
|
556
|
-
keyBinding: object instanceof CollectionType ? void 0 : "shift+meta+Backspace",
|
|
557
|
-
testId: "spacePlugin.deleteObject"
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
id: getId("copy-link"),
|
|
562
|
-
type: ACTION_TYPE,
|
|
563
|
-
data: async () => {
|
|
564
|
-
const url = `${window.location.origin}/${fullyQualifiedId2(object)}`;
|
|
565
|
-
await navigator.clipboard.writeText(url);
|
|
566
|
-
},
|
|
567
|
-
properties: {
|
|
568
|
-
label: [
|
|
569
|
-
"copy link label",
|
|
570
|
-
{
|
|
571
|
-
ns: SPACE_PLUGIN
|
|
572
|
-
}
|
|
573
|
-
],
|
|
574
|
-
icon: "ph--link--regular",
|
|
575
|
-
testId: "spacePlugin.copyLink"
|
|
576
|
-
}
|
|
577
|
-
},
|
|
578
|
-
// TODO(wittjosiah): Factor out and apply to all nodes.
|
|
579
|
-
{
|
|
580
|
-
id: NavigationAction2.Expose._tag,
|
|
581
|
-
type: ACTION_TYPE,
|
|
582
|
-
data: async () => {
|
|
583
|
-
await dispatch(createIntent2(NavigationAction2.Expose, {
|
|
584
|
-
id: fullyQualifiedId2(object)
|
|
585
|
-
}));
|
|
586
|
-
},
|
|
587
|
-
properties: {
|
|
150
|
+
})
|
|
151
|
+
}),
|
|
152
|
+
defineModule({
|
|
153
|
+
id: `${meta.id}/module/object-form`,
|
|
154
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
155
|
+
activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
|
|
156
|
+
objectSchema: CollectionType,
|
|
157
|
+
formSchema: S.Struct({
|
|
158
|
+
name: S.optional(S.String)
|
|
159
|
+
}),
|
|
160
|
+
getIntent: (props) => createIntent(CollectionAction.Create, props)
|
|
161
|
+
}))
|
|
162
|
+
}),
|
|
163
|
+
defineModule({
|
|
164
|
+
id: `${meta.id}/module/complementary-panel`,
|
|
165
|
+
activatesOn: DeckEvents.SetupComplementaryPanels,
|
|
166
|
+
activate: () => contributes(DeckCapabilities.ComplementaryPanel, {
|
|
167
|
+
id: "settings",
|
|
588
168
|
label: [
|
|
589
|
-
"
|
|
169
|
+
"settings panel label",
|
|
590
170
|
{
|
|
591
171
|
ns: SPACE_PLUGIN
|
|
592
172
|
}
|
|
593
173
|
],
|
|
594
|
-
icon: "ph--
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
];
|
|
599
|
-
return actions;
|
|
600
|
-
};
|
|
601
|
-
var getActiveSpace = (graph, active) => {
|
|
602
|
-
if (!active) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
const node = graph.findNode(active);
|
|
606
|
-
if (!node || !isReactiveObject(node.data)) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
return getSpace(node.data);
|
|
610
|
-
};
|
|
611
|
-
var getNestedObjects = async (object, resolve) => {
|
|
612
|
-
const type = getTypename(object);
|
|
613
|
-
if (!type) {
|
|
614
|
-
return [];
|
|
615
|
-
}
|
|
616
|
-
const metadata = resolve(type);
|
|
617
|
-
const loadReferences = metadata.loadReferences;
|
|
618
|
-
if (typeof loadReferences !== "function") {
|
|
619
|
-
return [];
|
|
620
|
-
}
|
|
621
|
-
const objects = await loadReferences(object);
|
|
622
|
-
const nested = await Promise.all(objects.map((object2) => getNestedObjects(object2, resolve)));
|
|
623
|
-
return [
|
|
624
|
-
...objects,
|
|
625
|
-
...nested.flat()
|
|
626
|
-
];
|
|
627
|
-
};
|
|
628
|
-
var cloneObject = async (object, resolve, newSpace) => {
|
|
629
|
-
const schema = getSchema(object);
|
|
630
|
-
const typename = schema ? getObjectAnnotation(schema)?.typename ?? EXPANDO_TYPENAME : EXPANDO_TYPENAME;
|
|
631
|
-
const metadata = resolve(typename);
|
|
632
|
-
const serializer = metadata.serializer;
|
|
633
|
-
invariant(serializer, `No serializer for type: ${typename}`, {
|
|
634
|
-
F: __dxlog_file,
|
|
635
|
-
L: 551,
|
|
636
|
-
S: void 0,
|
|
637
|
-
A: [
|
|
638
|
-
"serializer",
|
|
639
|
-
"`No serializer for type: ${typename}`"
|
|
640
|
-
]
|
|
641
|
-
});
|
|
642
|
-
const content = await serializer.serialize({
|
|
643
|
-
object
|
|
644
|
-
});
|
|
645
|
-
return serializer.deserialize({
|
|
646
|
-
content,
|
|
647
|
-
space: newSpace,
|
|
648
|
-
newId: true
|
|
649
|
-
});
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
|
|
653
|
-
var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: initialTarget, name: initialName, defaultSpaceId, resolve, onCreateObject }) => {
|
|
654
|
-
const { t } = useTranslation2(SPACE_PLUGIN);
|
|
655
|
-
const [typename, setTypename] = useState2(initialTypename);
|
|
656
|
-
const [target, setTarget] = useState2(initialTarget);
|
|
657
|
-
const schema = schemas.find((schema2) => getObjectAnnotation2(schema2)?.typename === typename);
|
|
658
|
-
const options = schemas.map(getObjectAnnotation2).filter(nonNullable);
|
|
659
|
-
const handleClearSchema = useCallback2(() => setTypename(void 0), []);
|
|
660
|
-
const handleClearTarget = useCallback2(() => setTarget(void 0), []);
|
|
661
|
-
const handleCreateObject = useCallback2(async ({ name }) => {
|
|
662
|
-
if (!schema || !target) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
await onCreateObject?.({
|
|
666
|
-
schema,
|
|
667
|
-
target,
|
|
668
|
-
name
|
|
669
|
-
});
|
|
670
|
-
}, [
|
|
671
|
-
onCreateObject,
|
|
672
|
-
schema,
|
|
673
|
-
target
|
|
674
|
-
]);
|
|
675
|
-
const schemaInput = /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
676
|
-
label: t("schema input label"),
|
|
677
|
-
classNames: "flex flex-col grow overflow-hidden"
|
|
678
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
679
|
-
autoFocus: true,
|
|
680
|
-
"data-testid": "create-object-form.schema-input",
|
|
681
|
-
placeholder: t("schema input placeholder"),
|
|
682
|
-
classNames: "px-1 my-2"
|
|
683
|
-
}), /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
684
|
-
classNames: "max-bs-[24rem] overflow-auto"
|
|
685
|
-
}, options.map((option) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
686
|
-
key: option.typename,
|
|
687
|
-
value: t("typename label", {
|
|
688
|
-
ns: option.typename,
|
|
689
|
-
defaultValue: option.typename
|
|
174
|
+
icon: "ph--sliders--regular",
|
|
175
|
+
filter: (node) => isEchoObject(node.data) && !!getSpace(node.data)
|
|
176
|
+
})
|
|
690
177
|
}),
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}), t("typename label", {
|
|
699
|
-
ns: option.typename,
|
|
700
|
-
defaultValue: option.typename
|
|
701
|
-
}))))));
|
|
702
|
-
const spaceInput = /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
703
|
-
label: t("space input label"),
|
|
704
|
-
classNames: "flex flex-col grow overflow-hidden"
|
|
705
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
706
|
-
autoFocus: true,
|
|
707
|
-
"data-testid": "create-object-form.space-input",
|
|
708
|
-
placeholder: t("space input placeholder"),
|
|
709
|
-
classNames: "px-1 my-2"
|
|
710
|
-
}), /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
711
|
-
classNames: "max-bs-[24rem] overflow-auto"
|
|
712
|
-
}, spaces.map((space) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
713
|
-
key: space.id,
|
|
714
|
-
value: toLocalizedString(getSpaceDisplayName(space, {
|
|
715
|
-
personal: space.id === defaultSpaceId
|
|
716
|
-
}), t),
|
|
717
|
-
onSelect: () => setTarget(space),
|
|
718
|
-
classNames: "flex items-center gap-2"
|
|
719
|
-
}, /* @__PURE__ */ React2.createElement("span", {
|
|
720
|
-
className: "grow truncate"
|
|
721
|
-
}, toLocalizedString(getSpaceDisplayName(space, {
|
|
722
|
-
personal: space.id === defaultSpaceId
|
|
723
|
-
}), t))))));
|
|
724
|
-
const form = /* @__PURE__ */ React2.createElement(Form, {
|
|
725
|
-
autoFocus: true,
|
|
726
|
-
values: {
|
|
727
|
-
name: initialName
|
|
728
|
-
},
|
|
729
|
-
schema: S.Struct({
|
|
730
|
-
name: S.optional(S.String)
|
|
178
|
+
defineModule({
|
|
179
|
+
id: `${meta.id}/module/schema`,
|
|
180
|
+
activatesOn: ClientEvents.ClientReady,
|
|
181
|
+
activatesBefore: [
|
|
182
|
+
ClientEvents.SetupSchema
|
|
183
|
+
],
|
|
184
|
+
activate: Schema
|
|
731
185
|
}),
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
role: "form",
|
|
737
|
-
className: "flex flex-col gap-2"
|
|
738
|
-
}, target && /* @__PURE__ */ React2.createElement("div", {
|
|
739
|
-
role: "none"
|
|
740
|
-
}, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(InputHeader, null, /* @__PURE__ */ React2.createElement(Input.Label, null, t(isSpace2(target) ? "creating in space label" : "creating in collection label"))), /* @__PURE__ */ React2.createElement("div", {
|
|
741
|
-
role: "none",
|
|
742
|
-
className: "flex gap-2"
|
|
743
|
-
}, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
744
|
-
disabled: true,
|
|
745
|
-
value: isSpace2(target) ? toLocalizedString(getSpaceDisplayName(target, {
|
|
746
|
-
personal: target.id === defaultSpaceId
|
|
747
|
-
}), t) : target.name || t("unnamed collection label")
|
|
748
|
-
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
749
|
-
iconOnly: true,
|
|
750
|
-
icon: "ph--x--regular",
|
|
751
|
-
label: t("clear input label"),
|
|
752
|
-
onClick: handleClearTarget
|
|
753
|
-
})))), schema && /* @__PURE__ */ React2.createElement("div", {
|
|
754
|
-
role: "none"
|
|
755
|
-
}, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(InputHeader, null, /* @__PURE__ */ React2.createElement(Input.Label, null, t("creating object type label"))), /* @__PURE__ */ React2.createElement("div", {
|
|
756
|
-
role: "none",
|
|
757
|
-
className: "flex gap-2"
|
|
758
|
-
}, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
759
|
-
disabled: true,
|
|
760
|
-
value: t("typename label", {
|
|
761
|
-
ns: schema.typename,
|
|
762
|
-
defaultValue: schema.typename
|
|
763
|
-
})
|
|
764
|
-
}), /* @__PURE__ */ React2.createElement(IconButton, {
|
|
765
|
-
iconOnly: true,
|
|
766
|
-
icon: "ph--x--regular",
|
|
767
|
-
label: t("clear input label"),
|
|
768
|
-
onClick: handleClearSchema
|
|
769
|
-
})))), !schema ? schemaInput : !target ? spaceInput : form);
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
|
|
773
|
-
var CREATE_OBJECT_DIALOG = `${SPACE_PLUGIN}/CreateObjectDialog`;
|
|
774
|
-
var CreateObjectDialog = ({ schemas, target, typename, name, shouldNavigate: _shouldNavigate, resolve }) => {
|
|
775
|
-
const closeRef = useRef(null);
|
|
776
|
-
const { t } = useTranslation3(SPACE_PLUGIN);
|
|
777
|
-
const client = useClient2();
|
|
778
|
-
const spaces = useSpaces();
|
|
779
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
780
|
-
const handleCreateObject = useCallback3(async ({ schema, target: _target, name: name2 }) => {
|
|
781
|
-
const target2 = isSpace3(_target) ? _target.properties[CollectionType.typename]?.target : _target;
|
|
782
|
-
const createObjectIntent = resolve?.(schema.typename)?.createObject;
|
|
783
|
-
if (!createObjectIntent || !target2) {
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
closeRef.current?.click();
|
|
787
|
-
const space = isSpace3(target2) ? target2 : getSpace2(target2);
|
|
788
|
-
const result = await dispatch(createObjectIntent({
|
|
789
|
-
name: name2,
|
|
790
|
-
space
|
|
791
|
-
}));
|
|
792
|
-
const object = result.data?.object;
|
|
793
|
-
if (isReactiveObject2(object)) {
|
|
794
|
-
const addObjectIntent = createIntent3(SpaceAction.AddObject, {
|
|
795
|
-
target: target2,
|
|
796
|
-
object
|
|
797
|
-
});
|
|
798
|
-
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
799
|
-
if (shouldNavigate(object)) {
|
|
800
|
-
await dispatch(pipe(addObjectIntent, chain(NavigationAction3.Open, {})));
|
|
801
|
-
} else {
|
|
802
|
-
await dispatch(addObjectIntent);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}, [
|
|
806
|
-
dispatch,
|
|
807
|
-
resolve
|
|
808
|
-
]);
|
|
809
|
-
return (
|
|
810
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
811
|
-
// Consider factoring it out to the tabs package.
|
|
812
|
-
/* @__PURE__ */ React3.createElement(Dialog.Content, {
|
|
813
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
814
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
815
|
-
role: "none",
|
|
816
|
-
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
817
|
-
}, /* @__PURE__ */ React3.createElement(Dialog.Title, null, t("create object dialog title")), /* @__PURE__ */ React3.createElement(Dialog.Close, {
|
|
818
|
-
asChild: true
|
|
819
|
-
}, /* @__PURE__ */ React3.createElement(Button2, {
|
|
820
|
-
ref: closeRef,
|
|
821
|
-
density: "fine",
|
|
822
|
-
variant: "ghost",
|
|
823
|
-
autoFocus: true
|
|
824
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
825
|
-
icon: "ph--x--regular",
|
|
826
|
-
size: 4
|
|
827
|
-
})))), /* @__PURE__ */ React3.createElement("div", {
|
|
828
|
-
className: "p-4"
|
|
829
|
-
}, /* @__PURE__ */ React3.createElement(CreateObjectPanel, {
|
|
830
|
-
schemas,
|
|
831
|
-
spaces,
|
|
832
|
-
target,
|
|
833
|
-
typename,
|
|
834
|
-
name,
|
|
835
|
-
defaultSpaceId: client.spaces.default.id,
|
|
836
|
-
resolve,
|
|
837
|
-
onCreateObject: handleCreateObject
|
|
838
|
-
})))
|
|
839
|
-
);
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
// packages/plugins/plugin-space/src/components/CreateDialog/CreateSpaceDialog.tsx
|
|
843
|
-
import React4, { useCallback as useCallback4, useRef as useRef2 } from "react";
|
|
844
|
-
import { createIntent as createIntent4, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
845
|
-
import { Button as Button3, Dialog as Dialog2, Icon as Icon3, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
846
|
-
import { Form as Form2 } from "@dxos/react-ui-form";
|
|
847
|
-
var CREATE_SPACE_DIALOG = `${SPACE_PLUGIN}/CreateSpaceDialog`;
|
|
848
|
-
var initialValues = {
|
|
849
|
-
edgeReplication: true
|
|
850
|
-
};
|
|
851
|
-
var CreateSpaceDialog = () => {
|
|
852
|
-
const closeRef = useRef2(null);
|
|
853
|
-
const { t } = useTranslation4(SPACE_PLUGIN);
|
|
854
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
855
|
-
const handleCreateSpace = useCallback4(async (data) => {
|
|
856
|
-
const result = await dispatch(createIntent4(SpaceAction.Create, data));
|
|
857
|
-
const target = result.data?.space;
|
|
858
|
-
if (target) {
|
|
859
|
-
await dispatch(createIntent4(SpaceAction.OpenCreateObject, {
|
|
860
|
-
target
|
|
861
|
-
}));
|
|
862
|
-
}
|
|
863
|
-
}, [
|
|
864
|
-
dispatch
|
|
865
|
-
]);
|
|
866
|
-
return (
|
|
867
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
868
|
-
// Consider factoring it out to the tabs package.
|
|
869
|
-
/* @__PURE__ */ React4.createElement(Dialog2.Content, {
|
|
870
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
871
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
872
|
-
role: "none",
|
|
873
|
-
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
874
|
-
}, /* @__PURE__ */ React4.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React4.createElement(Dialog2.Close, {
|
|
875
|
-
asChild: true
|
|
876
|
-
}, /* @__PURE__ */ React4.createElement(Button3, {
|
|
877
|
-
ref: closeRef,
|
|
878
|
-
density: "fine",
|
|
879
|
-
variant: "ghost",
|
|
880
|
-
autoFocus: true
|
|
881
|
-
}, /* @__PURE__ */ React4.createElement(Icon3, {
|
|
882
|
-
icon: "ph--x--regular",
|
|
883
|
-
size: 4
|
|
884
|
-
})))), /* @__PURE__ */ React4.createElement("div", {
|
|
885
|
-
className: "p-4"
|
|
886
|
-
}, /* @__PURE__ */ React4.createElement(Form2, {
|
|
887
|
-
testId: "create-space-form",
|
|
888
|
-
values: initialValues,
|
|
889
|
-
schema: SpaceForm,
|
|
890
|
-
onSave: handleCreateSpace
|
|
891
|
-
})))
|
|
892
|
-
);
|
|
893
|
-
};
|
|
894
|
-
|
|
895
|
-
// packages/plugins/plugin-space/src/components/CollectionMain.tsx
|
|
896
|
-
import React5 from "react";
|
|
897
|
-
import { useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
898
|
-
import { baseSurface, descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
|
|
899
|
-
var CollectionMain = ({ collection }) => {
|
|
900
|
-
const { t } = useTranslation5(SPACE_PLUGIN);
|
|
901
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
902
|
-
role: "none",
|
|
903
|
-
className: mx2(baseSurface, "min-bs-screen is-full flex items-center justify-center p-8"),
|
|
904
|
-
"data-testid": "composer.firstRunMessage"
|
|
905
|
-
}, /* @__PURE__ */ React5.createElement("p", {
|
|
906
|
-
role: "alert",
|
|
907
|
-
className: mx2(descriptionText, "border border-dashed border-neutral-400/50 rounded-lg p-8 font-normal text-lg max-is-[24rem] break-words")
|
|
908
|
-
}, collection.name ?? t("unnamed collection label")));
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
// packages/plugins/plugin-space/src/components/CollectionSection.tsx
|
|
912
|
-
import React6 from "react";
|
|
913
|
-
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
914
|
-
var CollectionSection = ({ collection }) => {
|
|
915
|
-
const { t } = useTranslation6(SPACE_PLUGIN);
|
|
916
|
-
return /* @__PURE__ */ React6.createElement("div", {
|
|
917
|
-
className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
|
|
918
|
-
}, /* @__PURE__ */ React6.createElement("span", {
|
|
919
|
-
className: "truncate"
|
|
920
|
-
}, collection.name ?? t("unnamed collection label")));
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
// packages/plugins/plugin-space/src/components/DefaultObjectSettings.tsx
|
|
924
|
-
import React7 from "react";
|
|
925
|
-
import { Input as Input2, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
926
|
-
var DefaultObjectSettings = ({ object }) => {
|
|
927
|
-
const { t } = useTranslation7(SPACE_PLUGIN);
|
|
928
|
-
return /* @__PURE__ */ React7.createElement("div", {
|
|
929
|
-
role: "form",
|
|
930
|
-
className: "flex flex-col w-full p-2 gap-1"
|
|
931
|
-
}, /* @__PURE__ */ React7.createElement(Input2.Root, null, /* @__PURE__ */ React7.createElement(Input2.Label, null, t("name label")), /* @__PURE__ */ React7.createElement(Input2.TextInput, {
|
|
932
|
-
placeholder: t("name placeholder"),
|
|
933
|
-
value: object.name ?? "",
|
|
934
|
-
onChange: (event) => {
|
|
935
|
-
object.name = event.target.value;
|
|
936
|
-
}
|
|
937
|
-
})));
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
// packages/plugins/plugin-space/src/components/JoinDialog.tsx
|
|
941
|
-
import React8, { useCallback as useCallback5 } from "react";
|
|
942
|
-
import { createIntent as createIntent5, LayoutAction, NavigationAction as NavigationAction4, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
|
|
943
|
-
import { useGraph } from "@dxos/plugin-graph";
|
|
944
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
945
|
-
import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
|
|
946
|
-
import { Dialog as Dialog3, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
947
|
-
import { JoinPanel } from "@dxos/shell/react";
|
|
948
|
-
var JOIN_DIALOG = `${SPACE_PLUGIN}/JoinDialog`;
|
|
949
|
-
var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
|
|
950
|
-
const { t } = useTranslation8(SPACE_PLUGIN);
|
|
951
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
952
|
-
const spaces = useSpaces2();
|
|
953
|
-
const { graph } = useGraph();
|
|
954
|
-
const handleDone = useCallback5(async (result) => {
|
|
955
|
-
if (result?.spaceKey) {
|
|
956
|
-
await Promise.all([
|
|
957
|
-
dispatch(createIntent5(LayoutAction.SetLayout, {
|
|
958
|
-
element: "toast",
|
|
959
|
-
subject: {
|
|
960
|
-
id: `${SPACE_PLUGIN}/join-success`,
|
|
961
|
-
duration: 5e3,
|
|
962
|
-
title: t("join success label"),
|
|
963
|
-
closeLabel: t("dismiss label")
|
|
964
|
-
}
|
|
965
|
-
})),
|
|
966
|
-
dispatch(createIntent5(LayoutAction.SetLayout, {
|
|
967
|
-
element: "dialog",
|
|
968
|
-
state: false
|
|
969
|
-
}))
|
|
970
|
-
]);
|
|
971
|
-
}
|
|
972
|
-
const space = spaces.find(({ key }) => result?.spaceKey?.equals(key));
|
|
973
|
-
const target = result?.target || (navigableCollections ? space?.id : void 0);
|
|
974
|
-
if (target) {
|
|
975
|
-
await graph.waitForPath({
|
|
976
|
-
target
|
|
977
|
-
}).catch(() => {
|
|
978
|
-
});
|
|
979
|
-
await Promise.all([
|
|
980
|
-
dispatch(createIntent5(NavigationAction4.Open, {
|
|
981
|
-
activeParts: {
|
|
982
|
-
main: [
|
|
983
|
-
target
|
|
984
|
-
]
|
|
985
|
-
}
|
|
986
|
-
})),
|
|
987
|
-
dispatch(createIntent5(NavigationAction4.Expose, {
|
|
988
|
-
id: target
|
|
989
|
-
}))
|
|
990
|
-
]);
|
|
991
|
-
}
|
|
992
|
-
await onDone?.(result);
|
|
993
|
-
if (space) {
|
|
994
|
-
await dispatch(createIntent5(ObservabilityAction.SendEvent, {
|
|
995
|
-
name: "space.join",
|
|
996
|
-
properties: {
|
|
997
|
-
spaceId: space.id
|
|
998
|
-
}
|
|
999
|
-
}));
|
|
1000
|
-
}
|
|
1001
|
-
}, [
|
|
1002
|
-
dispatch,
|
|
1003
|
-
spaces
|
|
1004
|
-
]);
|
|
1005
|
-
return /* @__PURE__ */ React8.createElement(Dialog3.Content, null, /* @__PURE__ */ React8.createElement(JoinPanel, {
|
|
1006
|
-
...props,
|
|
1007
|
-
exitActionParent: /* @__PURE__ */ React8.createElement(Dialog3.Close, {
|
|
1008
|
-
asChild: true
|
|
186
|
+
defineModule({
|
|
187
|
+
id: `${meta.id}/module/react-root`,
|
|
188
|
+
activatesOn: Events.Startup,
|
|
189
|
+
activate: ReactRoot
|
|
1009
190
|
}),
|
|
1010
|
-
|
|
1011
|
-
|
|
191
|
+
defineModule({
|
|
192
|
+
id: `${meta.id}/module/react-surface`,
|
|
193
|
+
activatesOn: Events.SetupReactSurface,
|
|
194
|
+
// TODO(wittjosiah): Should occur before the settings dialog is loaded when surfaces activation is more granular.
|
|
195
|
+
activatesBefore: [
|
|
196
|
+
SpaceEvents.SetupSettingsPanel
|
|
197
|
+
],
|
|
198
|
+
activate: () => ReactSurface({
|
|
199
|
+
createInvitationUrl
|
|
200
|
+
})
|
|
1012
201
|
}),
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
}), toLocalizedString2(spaceName, t)))) : null;
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
|
-
// packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
|
|
1042
|
-
import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
|
|
1043
|
-
import React10, { useEffect as useEffect2, useState as useState3 } from "react";
|
|
1044
|
-
import { debounce } from "@dxos/async";
|
|
1045
|
-
import { Tooltip, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
1046
|
-
import { getSize as getSize2, mx as mx3, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
|
|
1047
|
-
var Status;
|
|
1048
|
-
(function(Status2) {
|
|
1049
|
-
Status2[Status2["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
|
|
1050
|
-
Status2[Status2["PENDING"] = 1] = "PENDING";
|
|
1051
|
-
Status2[Status2["ERROR"] = 2] = "ERROR";
|
|
1052
|
-
})(Status || (Status = {}));
|
|
1053
|
-
var PersistenceStatus = ({ db }) => {
|
|
1054
|
-
const { t } = useTranslation10(SPACE_PLUGIN);
|
|
1055
|
-
const [displayMessage, setDisplayMessage] = useState3(false);
|
|
1056
|
-
const [status, naturalSetStatus] = useState3(0);
|
|
1057
|
-
const [prevStatus, setPrevStatus] = useState3(0);
|
|
1058
|
-
const _setStatus = debounce(naturalSetStatus, 500);
|
|
1059
|
-
useEffect2(() => {
|
|
1060
|
-
setPrevStatus(status);
|
|
1061
|
-
if (prevStatus !== status && status === 0) {
|
|
1062
|
-
setDisplayMessage(true);
|
|
1063
|
-
const timeout = setTimeout(() => setDisplayMessage(false), 5e3);
|
|
1064
|
-
return () => clearTimeout(timeout);
|
|
1065
|
-
}
|
|
1066
|
-
}, [
|
|
1067
|
-
status
|
|
1068
|
-
]);
|
|
1069
|
-
switch (status) {
|
|
1070
|
-
case 2:
|
|
1071
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
1072
|
-
className: "flex items-center"
|
|
1073
|
-
}, /* @__PURE__ */ React10.createElement(Warning, {
|
|
1074
|
-
className: mx3(getSize2(4), "me-1")
|
|
1075
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
1076
|
-
className: mx3("text-sm", warningText)
|
|
1077
|
-
}, t("persistence error label")));
|
|
1078
|
-
case 1:
|
|
1079
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
1080
|
-
className: "flex items-center"
|
|
1081
|
-
}, /* @__PURE__ */ React10.createElement(ArrowsCounterClockwise, {
|
|
1082
|
-
className: mx3(getSize2(4), "me-1")
|
|
1083
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
1084
|
-
className: mx3("text-sm", staticPlaceholderText)
|
|
1085
|
-
}, t("persistence pending label")));
|
|
1086
|
-
case 0:
|
|
1087
|
-
default:
|
|
1088
|
-
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
1089
|
-
delayDuration: 400
|
|
1090
|
-
}, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
|
|
1091
|
-
role: "status",
|
|
1092
|
-
className: "flex items-center"
|
|
1093
|
-
}, /* @__PURE__ */ React10.createElement(CheckCircle2, {
|
|
1094
|
-
className: mx3(getSize2(4), "me-1")
|
|
1095
|
-
}), displayMessage && /* @__PURE__ */ React10.createElement("span", {
|
|
1096
|
-
className: mx3("text-sm", staticPlaceholderText)
|
|
1097
|
-
}, t("persisted locally label"))), /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, /* @__PURE__ */ React10.createElement(Tooltip.Content, null, t("persisted locally message"), /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null))));
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
// packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
|
|
1102
|
-
import React11, { useCallback as useCallback6, useRef as useRef3, useState as useState4 } from "react";
|
|
1103
|
-
import { log } from "@dxos/log";
|
|
1104
|
-
import { Button as Button4, Input as Input3, Popover, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
1105
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
1106
|
-
var POPOVER_RENAME_OBJECT = `${SPACE_PLUGIN}/PopoverRenameObject`;
|
|
1107
|
-
var PopoverRenameObject = ({ object: obj }) => {
|
|
1108
|
-
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
1109
|
-
const doneButton = useRef3(null);
|
|
1110
|
-
const object = obj;
|
|
1111
|
-
const [name, setName] = useState4(object.name || object.title || "");
|
|
1112
|
-
const handleDone = useCallback6(() => {
|
|
1113
|
-
try {
|
|
1114
|
-
object.name = name;
|
|
1115
|
-
} catch {
|
|
1116
|
-
try {
|
|
1117
|
-
object.title = name;
|
|
1118
|
-
} catch (err) {
|
|
1119
|
-
log.error("Failed to rename object", {
|
|
1120
|
-
err
|
|
1121
|
-
}, {
|
|
1122
|
-
F: __dxlog_file2,
|
|
1123
|
-
L: 30,
|
|
1124
|
-
S: void 0,
|
|
1125
|
-
C: (f, a) => f(...a)
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}, [
|
|
1130
|
-
object,
|
|
1131
|
-
name
|
|
1132
|
-
]);
|
|
1133
|
-
return /* @__PURE__ */ React11.createElement("div", {
|
|
1134
|
-
role: "none",
|
|
1135
|
-
className: "p-1 flex gap-2"
|
|
1136
|
-
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1137
|
-
role: "none",
|
|
1138
|
-
className: "flex-1"
|
|
1139
|
-
}, /* @__PURE__ */ React11.createElement(Input3.Root, null, /* @__PURE__ */ React11.createElement(Input3.Label, {
|
|
1140
|
-
srOnly: true
|
|
1141
|
-
}, t("object name label")), /* @__PURE__ */ React11.createElement(Input3.TextInput, {
|
|
1142
|
-
placeholder: t("object title placeholder"),
|
|
1143
|
-
value: name,
|
|
1144
|
-
"data-testid": "spacePlugin.renameObject.input",
|
|
1145
|
-
onChange: ({ target: { value } }) => setName(value),
|
|
1146
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
1147
|
-
}))), /* @__PURE__ */ React11.createElement(Popover.Close, {
|
|
1148
|
-
asChild: true
|
|
1149
|
-
}, /* @__PURE__ */ React11.createElement(Button4, {
|
|
1150
|
-
ref: doneButton,
|
|
1151
|
-
classNames: "self-stretch",
|
|
1152
|
-
onClick: handleDone
|
|
1153
|
-
}, t("done label", {
|
|
1154
|
-
ns: "os"
|
|
1155
|
-
}))));
|
|
1156
|
-
};
|
|
1157
|
-
|
|
1158
|
-
// packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
|
|
1159
|
-
import React12, { useCallback as useCallback7, useRef as useRef4, useState as useState5 } from "react";
|
|
1160
|
-
import { Button as Button5, Input as Input4, Popover as Popover2, useTranslation as useTranslation12 } from "@dxos/react-ui";
|
|
1161
|
-
var POPOVER_RENAME_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
|
|
1162
|
-
var PopoverRenameSpace = ({ space }) => {
|
|
1163
|
-
const { t } = useTranslation12(SPACE_PLUGIN);
|
|
1164
|
-
const doneButton = useRef4(null);
|
|
1165
|
-
const [name, setName] = useState5(space.properties.name ?? "");
|
|
1166
|
-
const handleDone = useCallback7(() => {
|
|
1167
|
-
space.properties.name = name;
|
|
1168
|
-
}, [
|
|
1169
|
-
space,
|
|
1170
|
-
name
|
|
1171
|
-
]);
|
|
1172
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1173
|
-
role: "none",
|
|
1174
|
-
className: "p-1 flex gap-2"
|
|
1175
|
-
}, /* @__PURE__ */ React12.createElement("div", {
|
|
1176
|
-
role: "none",
|
|
1177
|
-
className: "flex-1"
|
|
1178
|
-
}, /* @__PURE__ */ React12.createElement(Input4.Root, null, /* @__PURE__ */ React12.createElement(Input4.Label, {
|
|
1179
|
-
srOnly: true
|
|
1180
|
-
}, t("space name label")), /* @__PURE__ */ React12.createElement(Input4.TextInput, {
|
|
1181
|
-
defaultValue: space.properties.name ?? "",
|
|
1182
|
-
placeholder: t("unnamed space label"),
|
|
1183
|
-
onChange: ({ target: { value } }) => setName(value),
|
|
1184
|
-
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
1185
|
-
// Currently this is not possible because Radix does not expose the popover context.
|
|
1186
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
1187
|
-
}))), /* @__PURE__ */ React12.createElement(Popover2.Close, {
|
|
1188
|
-
asChild: true
|
|
1189
|
-
}, /* @__PURE__ */ React12.createElement(Button5, {
|
|
1190
|
-
ref: doneButton,
|
|
1191
|
-
classNames: "self-stretch",
|
|
1192
|
-
onClick: handleDone
|
|
1193
|
-
}, t("done label", {
|
|
1194
|
-
ns: "os"
|
|
1195
|
-
}))));
|
|
1196
|
-
};
|
|
1197
|
-
|
|
1198
|
-
// packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
|
|
1199
|
-
import React13 from "react";
|
|
1200
|
-
import { createIntent as createIntent6, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
|
|
1201
|
-
import { IconButton as IconButton2, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1202
|
-
var ShareSpaceButton = ({ space }) => {
|
|
1203
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
1204
|
-
return /* @__PURE__ */ React13.createElement(ShareSpaceButtonImpl, {
|
|
1205
|
-
onClick: () => dispatch(createIntent6(SpaceAction.Share, {
|
|
1206
|
-
space
|
|
1207
|
-
}))
|
|
1208
|
-
});
|
|
1209
|
-
};
|
|
1210
|
-
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
1211
|
-
const { t } = useTranslation13(SPACE_PLUGIN);
|
|
1212
|
-
return /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1213
|
-
"data-testid": "spacePlugin.shareSpaceButton",
|
|
1214
|
-
icon: "ph--users--regular",
|
|
1215
|
-
label: t("share space label"),
|
|
1216
|
-
onClick
|
|
1217
|
-
});
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
|
-
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1221
|
-
import React14, { useCallback as useCallback8, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1222
|
-
import { usePlugin } from "@dxos/app-framework";
|
|
1223
|
-
import { generateName } from "@dxos/display-name";
|
|
1224
|
-
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
1225
|
-
import { PublicKey, useClient as useClient4 } from "@dxos/react-client";
|
|
1226
|
-
import { getSpace as getSpace4, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
|
|
1227
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
1228
|
-
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation14, List, ListItem, useDefaultValue } from "@dxos/react-ui";
|
|
1229
|
-
import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
|
|
1230
|
-
import { ComplexMap, keyToFallback } from "@dxos/util";
|
|
1231
|
-
|
|
1232
|
-
// packages/plugins/plugin-space/src/hooks/usePath.ts
|
|
1233
|
-
import { useEffect as useEffect3, useState as useState6 } from "react";
|
|
1234
|
-
var usePath = (graph, id, timeout) => {
|
|
1235
|
-
const [pathState, setPathState] = useState6(id ? graph.getPath({
|
|
1236
|
-
target: id
|
|
1237
|
-
}) : void 0);
|
|
1238
|
-
useEffect3(() => {
|
|
1239
|
-
if (!id && pathState) {
|
|
1240
|
-
setPathState(void 0);
|
|
1241
|
-
}
|
|
1242
|
-
if (pathState?.at(-1) === id || !id) {
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
const frame = requestAnimationFrame(async () => {
|
|
1246
|
-
try {
|
|
1247
|
-
const path = await graph.waitForPath({
|
|
1248
|
-
target: id
|
|
1249
|
-
}, {
|
|
1250
|
-
timeout
|
|
1251
|
-
});
|
|
1252
|
-
if (path) {
|
|
1253
|
-
setPathState(path);
|
|
1254
|
-
}
|
|
1255
|
-
} catch {
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
return () => cancelAnimationFrame(frame);
|
|
1259
|
-
}, [
|
|
1260
|
-
graph,
|
|
1261
|
-
id,
|
|
1262
|
-
timeout,
|
|
1263
|
-
pathState
|
|
1264
|
-
]);
|
|
1265
|
-
return pathState;
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1269
|
-
var REFRESH_INTERVAL = 5e3;
|
|
1270
|
-
var ACTIVITY_DURATION = 3e4;
|
|
1271
|
-
var noViewers = new ComplexMap(PublicKey.hash);
|
|
1272
|
-
var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
|
|
1273
|
-
var SpacePresence = ({ object, spaceKey }) => {
|
|
1274
|
-
const spacePlugin = usePlugin(SPACE_PLUGIN);
|
|
1275
|
-
const client = useClient4();
|
|
1276
|
-
const identity = useIdentity();
|
|
1277
|
-
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace4(object);
|
|
1278
|
-
const spaceMembers = useMembers(space?.key);
|
|
1279
|
-
const [_moment, setMoment] = useState7(Date.now());
|
|
1280
|
-
useEffect4(() => {
|
|
1281
|
-
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1282
|
-
return () => clearInterval(interval);
|
|
1283
|
-
}, []);
|
|
1284
|
-
const memberOnline = useCallback8((member) => member.presence === 1, []);
|
|
1285
|
-
const memberIsNotSelf = useCallback8((member) => !identity?.identityKey.equals(member.identity.identityKey), [
|
|
1286
|
-
identity?.identityKey
|
|
1287
|
-
]);
|
|
1288
|
-
if (!identity || !spacePlugin || !space) {
|
|
1289
|
-
return null;
|
|
1290
|
-
}
|
|
1291
|
-
const spaceState = spacePlugin.provides.space;
|
|
1292
|
-
const currentObjectViewers = spaceState.viewersByObject[fullyQualifiedId3(object)] ?? noViewers;
|
|
1293
|
-
const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
|
|
1294
|
-
const objectView = currentObjectViewers.get(member.identity.identityKey);
|
|
1295
|
-
const lastSeen = objectView?.lastSeen ?? -Infinity;
|
|
1296
|
-
const currentlyAttended = objectView?.currentlyAttended ?? false;
|
|
1297
|
-
return {
|
|
1298
|
-
...member,
|
|
1299
|
-
currentlyAttended,
|
|
1300
|
-
lastSeen
|
|
1301
|
-
};
|
|
1302
|
-
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1303
|
-
return /* @__PURE__ */ React14.createElement(FullPresence, {
|
|
1304
|
-
members: membersForObject
|
|
1305
|
-
});
|
|
1306
|
-
};
|
|
1307
|
-
var FullPresence = (props) => {
|
|
1308
|
-
const { size = 9, onMemberClick } = props;
|
|
1309
|
-
const members = useDefaultValue(props.members, () => []);
|
|
1310
|
-
if (members.length === 0) {
|
|
1311
|
-
return null;
|
|
1312
|
-
}
|
|
1313
|
-
return /* @__PURE__ */ React14.createElement(AvatarGroup.Root, {
|
|
1314
|
-
size,
|
|
1315
|
-
classNames: "mbs-2 mie-4",
|
|
1316
|
-
"data-testid": "spacePlugin.presence"
|
|
1317
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React14.createElement(Tooltip2.Root, {
|
|
1318
|
-
key: member.identity.identityKey.toHex()
|
|
1319
|
-
}, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React14.createElement(PrensenceAvatar, {
|
|
1320
|
-
identity: member.identity,
|
|
1321
|
-
group: true,
|
|
1322
|
-
match: member.currentlyAttended,
|
|
1323
|
-
index: members.length - i,
|
|
1324
|
-
onClick: () => onMemberClick?.(member)
|
|
1325
|
-
})), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1326
|
-
side: "bottom"
|
|
1327
|
-
}, /* @__PURE__ */ React14.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React14.createElement(Tooltip2.Root, null, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React14.createElement(AvatarGroupItem.Root, {
|
|
1328
|
-
status: "inactive"
|
|
1329
|
-
}, /* @__PURE__ */ React14.createElement(Avatar.Frame, {
|
|
1330
|
-
style: {
|
|
1331
|
-
zIndex: members.length - 4
|
|
1332
|
-
}
|
|
1333
|
-
}, /* @__PURE__ */ React14.createElement(Avatar.Fallback, {
|
|
1334
|
-
text: `+${members.length - 3}`
|
|
1335
|
-
})))), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1336
|
-
side: "bottom"
|
|
1337
|
-
}, /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React14.createElement(List, {
|
|
1338
|
-
classNames: "max-h-56 overflow-y-auto"
|
|
1339
|
-
}, members.map((member) => /* @__PURE__ */ React14.createElement(ListItem.Root, {
|
|
1340
|
-
key: member.identity.identityKey.toHex(),
|
|
1341
|
-
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1342
|
-
onClick: () => onMemberClick?.(member),
|
|
1343
|
-
"data-testid": "identity-list-item"
|
|
1344
|
-
}, /* @__PURE__ */ React14.createElement(PrensenceAvatar, {
|
|
1345
|
-
identity: member.identity,
|
|
1346
|
-
showName: true,
|
|
1347
|
-
match: member.currentlyAttended
|
|
1348
|
-
}))))))));
|
|
1349
|
-
};
|
|
1350
|
-
var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) => {
|
|
1351
|
-
const Root = group ? AvatarGroupItem.Root : Avatar.Root;
|
|
1352
|
-
const status = match ? "current" : "active";
|
|
1353
|
-
const fallbackValue = keyToFallback(identity.identityKey);
|
|
1354
|
-
return /* @__PURE__ */ React14.createElement(Root, {
|
|
1355
|
-
status,
|
|
1356
|
-
hue: identity.profile?.data?.hue || fallbackValue.hue
|
|
1357
|
-
}, /* @__PURE__ */ React14.createElement(Avatar.Frame, {
|
|
1358
|
-
"data-testid": "spacePlugin.presence.member",
|
|
1359
|
-
"data-status": status,
|
|
1360
|
-
...index ? {
|
|
1361
|
-
style: {
|
|
1362
|
-
zIndex: index
|
|
1363
|
-
}
|
|
1364
|
-
} : {},
|
|
1365
|
-
onClick: () => onClick?.()
|
|
1366
|
-
}, /* @__PURE__ */ React14.createElement(Avatar.Fallback, {
|
|
1367
|
-
text: identity.profile?.data?.emoji || fallbackValue.emoji
|
|
1368
|
-
})), showName && /* @__PURE__ */ React14.createElement(Avatar.Label, {
|
|
1369
|
-
classNames: "text-sm truncate pli-2"
|
|
1370
|
-
}, getName(identity)));
|
|
1371
|
-
};
|
|
1372
|
-
var SmallPresenceLive = ({ id, open, viewers }) => {
|
|
1373
|
-
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1374
|
-
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1375
|
-
const { graph } = useGraph2();
|
|
1376
|
-
const attended = useAttended();
|
|
1377
|
-
const startOfAttention = attended.at(-1);
|
|
1378
|
-
const path = usePath(graph, startOfAttention);
|
|
1379
|
-
const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
|
|
1380
|
-
const getActiveViewers = (viewers2) => {
|
|
1381
|
-
const moment = Date.now();
|
|
1382
|
-
return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
|
|
1383
|
-
};
|
|
1384
|
-
const [activeViewers, setActiveViewers] = useState7(viewers ? getActiveViewers(viewers) : []);
|
|
1385
|
-
useEffect4(() => {
|
|
1386
|
-
if (viewers) {
|
|
1387
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1388
|
-
const interval = setInterval(() => {
|
|
1389
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1390
|
-
}, REFRESH_INTERVAL);
|
|
1391
|
-
return () => clearInterval(interval);
|
|
1392
|
-
}
|
|
1393
|
-
}, [
|
|
1394
|
-
viewers
|
|
1395
|
-
]);
|
|
1396
|
-
return /* @__PURE__ */ React14.createElement(SmallPresence, {
|
|
1397
|
-
count: activeViewers.length,
|
|
1398
|
-
attended: isAttended,
|
|
1399
|
-
containsAttended
|
|
1400
|
-
});
|
|
1401
|
-
};
|
|
1402
|
-
var SmallPresence = ({ count = 0, attended, containsAttended }) => {
|
|
1403
|
-
const { t } = useTranslation14(SPACE_PLUGIN);
|
|
1404
|
-
return /* @__PURE__ */ React14.createElement(Tooltip2.Root, null, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, {
|
|
1405
|
-
asChild: true
|
|
1406
|
-
}, /* @__PURE__ */ React14.createElement(AttentionGlyph, {
|
|
1407
|
-
attended,
|
|
1408
|
-
containsAttended,
|
|
1409
|
-
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1410
|
-
classNames: "self-center mie-1"
|
|
1411
|
-
})), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1412
|
-
side: "bottom"
|
|
1413
|
-
}, /* @__PURE__ */ React14.createElement("span", null, t("presence label", {
|
|
1414
|
-
count
|
|
1415
|
-
})), /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null))));
|
|
1416
|
-
};
|
|
1417
|
-
|
|
1418
|
-
// packages/plugins/plugin-space/src/components/SpacePluginSettings.tsx
|
|
1419
|
-
import React15 from "react";
|
|
1420
|
-
import { createIntent as createIntent7, useIntentDispatcher as useIntentDispatcher6 } from "@dxos/app-framework";
|
|
1421
|
-
import { Input as Input5, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1422
|
-
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1423
|
-
var SpacePluginSettings = ({ settings }) => {
|
|
1424
|
-
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1425
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
1426
|
-
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
1427
|
-
label: t("show hidden spaces label")
|
|
1428
|
-
}, /* @__PURE__ */ React15.createElement(Input5.Switch, {
|
|
1429
|
-
checked: settings.showHidden,
|
|
1430
|
-
onCheckedChange: (checked) => dispatch(createIntent7(SpaceAction.ToggleHidden, {
|
|
1431
|
-
state: !!checked
|
|
1432
|
-
}))
|
|
1433
|
-
})));
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1437
|
-
import React17, { useState as useState9 } from "react";
|
|
1438
|
-
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1439
|
-
import { Button as Button6, Clipboard, Dialog as Dialog4, Icon as Icon4, toLocalizedString as toLocalizedString3, useTranslation as useTranslation17 } from "@dxos/react-ui";
|
|
1440
|
-
import { Tabs } from "@dxos/react-ui-tabs";
|
|
1441
|
-
import { SpacePanel } from "@dxos/shell/react";
|
|
1442
|
-
|
|
1443
|
-
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx
|
|
1444
|
-
import React16, { useCallback as useCallback9, useState as useState8 } from "react";
|
|
1445
|
-
import { log as log2 } from "@dxos/log";
|
|
1446
|
-
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1447
|
-
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1448
|
-
import { Input as Input6, useTranslation as useTranslation16 } from "@dxos/react-ui";
|
|
1449
|
-
import { DeprecatedFormInput as DeprecatedFormInput2 } from "@dxos/react-ui-form";
|
|
1450
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1451
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx";
|
|
1452
|
-
var SpaceSettingsPanel = ({ classNames, space }) => {
|
|
1453
|
-
const { t } = useTranslation16(SPACE_PLUGIN);
|
|
1454
|
-
const client = useClient5();
|
|
1455
|
-
const edgeEnabled = Boolean(client.config.values.runtime?.client?.edgeFeatures?.echoReplicator);
|
|
1456
|
-
const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
|
|
1457
|
-
const toggleEdgeReplication = useCallback9(async (next) => {
|
|
1458
|
-
setEdgeReplication(next);
|
|
1459
|
-
await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1460
|
-
log2.catch(err, void 0, {
|
|
1461
|
-
F: __dxlog_file3,
|
|
1462
|
-
L: 36,
|
|
1463
|
-
S: void 0,
|
|
1464
|
-
C: (f, a) => f(...a)
|
|
1465
|
-
});
|
|
1466
|
-
setEdgeReplication(!next);
|
|
1467
|
-
});
|
|
1468
|
-
}, [
|
|
1469
|
-
space
|
|
1470
|
-
]);
|
|
1471
|
-
return /* @__PURE__ */ React16.createElement("div", {
|
|
1472
|
-
role: "form",
|
|
1473
|
-
className: mx4("flex flex-col", classNames)
|
|
1474
|
-
}, /* @__PURE__ */ React16.createElement(DeprecatedFormInput2, {
|
|
1475
|
-
label: t("name label")
|
|
1476
|
-
}, /* @__PURE__ */ React16.createElement(Input6.TextInput, {
|
|
1477
|
-
placeholder: t("unnamed space label"),
|
|
1478
|
-
value: space.properties.name ?? "",
|
|
1479
|
-
onChange: (event) => {
|
|
1480
|
-
space.properties.name = event.target.value;
|
|
1481
|
-
}
|
|
1482
|
-
})), edgeEnabled && /* @__PURE__ */ React16.createElement(DeprecatedFormInput2, {
|
|
1483
|
-
label: t("edge replication label")
|
|
1484
|
-
}, /* @__PURE__ */ React16.createElement(Input6.Switch, {
|
|
1485
|
-
checked: edgeReplication,
|
|
1486
|
-
onCheckedChange: toggleEdgeReplication
|
|
1487
|
-
})));
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1491
|
-
var SPACE_SETTINGS_DIALOG = `${SPACE_PLUGIN}/SpaceSettingsDialog`;
|
|
1492
|
-
var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "members", namesCache }) => {
|
|
1493
|
-
const { t } = useTranslation17(SPACE_PLUGIN);
|
|
1494
|
-
const client = useClient6();
|
|
1495
|
-
const [tabsActivePart, setTabsActivePart] = useState9("list");
|
|
1496
|
-
const [selected, setSelected] = useState9(initialTab);
|
|
1497
|
-
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
1498
|
-
const name = getSpaceDisplayName(space, {
|
|
1499
|
-
personal: client.spaces.default === space,
|
|
1500
|
-
namesCache
|
|
1501
|
-
});
|
|
1502
|
-
return (
|
|
1503
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
1504
|
-
// Consider factoring it out to the tabs package.
|
|
1505
|
-
/* @__PURE__ */ React17.createElement(Dialog4.Content, {
|
|
1506
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
1507
|
-
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1508
|
-
role: "none",
|
|
1509
|
-
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
1510
|
-
}, /* @__PURE__ */ React17.createElement(Dialog4.Title, {
|
|
1511
|
-
onClick: () => setTabsActivePart("list"),
|
|
1512
|
-
"aria-description": t("click to return to tablist description"),
|
|
1513
|
-
classNames: "flex cursor-pointer items-center group/title"
|
|
1514
|
-
}, /* @__PURE__ */ React17.createElement(Icon4, {
|
|
1515
|
-
icon: "ph--caret-left--regular",
|
|
1516
|
-
size: 4,
|
|
1517
|
-
classNames: [
|
|
1518
|
-
"@md:hidden",
|
|
1519
|
-
tabsActivePart === "list" && "invisible"
|
|
1520
|
-
]
|
|
1521
|
-
}), /* @__PURE__ */ React17.createElement("span", {
|
|
1522
|
-
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
1523
|
-
}, toLocalizedString3(name, t))), /* @__PURE__ */ React17.createElement(Dialog4.Close, {
|
|
1524
|
-
asChild: true
|
|
1525
|
-
}, /* @__PURE__ */ React17.createElement(Button6, {
|
|
1526
|
-
density: "fine",
|
|
1527
|
-
variant: "ghost",
|
|
1528
|
-
autoFocus: true
|
|
1529
|
-
}, /* @__PURE__ */ React17.createElement(Icon4, {
|
|
1530
|
-
icon: "ph--x--regular",
|
|
1531
|
-
size: 4
|
|
1532
|
-
})))), /* @__PURE__ */ React17.createElement(Tabs.Root, {
|
|
1533
|
-
orientation: "vertical",
|
|
1534
|
-
value: selected,
|
|
1535
|
-
onValueChange: setSelected,
|
|
1536
|
-
activePart: tabsActivePart,
|
|
1537
|
-
onActivePartChange: setTabsActivePart,
|
|
1538
|
-
classNames: "flex flex-col flex-1 mbs-2"
|
|
1539
|
-
}, /* @__PURE__ */ React17.createElement(Tabs.Viewport, {
|
|
1540
|
-
classNames: "flex-1 min-bs-0"
|
|
1541
|
-
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1542
|
-
role: "none",
|
|
1543
|
-
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
1544
|
-
}, /* @__PURE__ */ React17.createElement(Tabs.Tablist, {
|
|
1545
|
-
classNames: "flex flex-col max-bs-none min-is-[200px] gap-4 overflow-y-auto"
|
|
1546
|
-
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1547
|
-
role: "none",
|
|
1548
|
-
className: "flex flex-col ml-1"
|
|
1549
|
-
}, /* @__PURE__ */ React17.createElement(Tabs.Tab, {
|
|
1550
|
-
value: "settings"
|
|
1551
|
-
}, t("settings tab label")), /* @__PURE__ */ React17.createElement(Tabs.Tab, {
|
|
1552
|
-
value: "members",
|
|
1553
|
-
disabled: locked
|
|
1554
|
-
}, t("members tab label"))))), /* @__PURE__ */ React17.createElement(Tabs.Tabpanel, {
|
|
1555
|
-
value: "settings",
|
|
1556
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1557
|
-
}, /* @__PURE__ */ React17.createElement(SpaceSettingsPanel, {
|
|
1558
|
-
space
|
|
1559
|
-
})), /* @__PURE__ */ React17.createElement(Tabs.Tabpanel, {
|
|
1560
|
-
value: "members",
|
|
1561
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1562
|
-
}, /* @__PURE__ */ React17.createElement(Clipboard.Provider, null, /* @__PURE__ */ React17.createElement(SpacePanel, {
|
|
1563
|
-
space,
|
|
1564
|
-
hideHeading: true,
|
|
1565
|
-
target,
|
|
1566
|
-
createInvitationUrl
|
|
1567
|
-
}))))))
|
|
1568
|
-
);
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
|
|
1572
|
-
import React18, { useEffect as useEffect6, useState as useState11 } from "react";
|
|
1573
|
-
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
1574
|
-
import { QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
1575
|
-
import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1576
|
-
import { useClient as useClient8 } from "@dxos/react-client";
|
|
1577
|
-
import { Tooltip as Tooltip3, useTranslation as useTranslation18 } from "@dxos/react-ui";
|
|
1578
|
-
import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
1579
|
-
|
|
1580
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts
|
|
1581
|
-
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
1582
|
-
import { Context } from "@dxos/context";
|
|
1583
|
-
import { EdgeService } from "@dxos/protocols";
|
|
1584
|
-
import { useClient as useClient7 } from "@dxos/react-client";
|
|
1585
|
-
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts";
|
|
1586
|
-
var createEmptyEdgeSyncState = () => ({
|
|
1587
|
-
missingOnLocal: 0,
|
|
1588
|
-
missingOnRemote: 0,
|
|
1589
|
-
localDocumentCount: 0,
|
|
1590
|
-
remoteDocumentCount: 0,
|
|
1591
|
-
differentDocuments: 0
|
|
1592
|
-
});
|
|
1593
|
-
var getSyncSummary = (syncMap) => {
|
|
1594
|
-
return Object.entries(syncMap).reduce((summary, [_spaceId, peerState]) => {
|
|
1595
|
-
summary.missingOnLocal += peerState.missingOnLocal;
|
|
1596
|
-
summary.missingOnRemote += peerState.missingOnRemote;
|
|
1597
|
-
summary.localDocumentCount += peerState.localDocumentCount;
|
|
1598
|
-
summary.remoteDocumentCount += peerState.remoteDocumentCount;
|
|
1599
|
-
summary.differentDocuments += peerState.differentDocuments;
|
|
1600
|
-
return summary;
|
|
1601
|
-
}, createEmptyEdgeSyncState());
|
|
1602
|
-
};
|
|
1603
|
-
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1604
|
-
var useSyncState = () => {
|
|
1605
|
-
const client = useClient7();
|
|
1606
|
-
const [spaceState, setSpaceState] = useState10({});
|
|
1607
|
-
useEffect5(() => {
|
|
1608
|
-
const ctx = new Context(void 0, {
|
|
1609
|
-
F: __dxlog_file4,
|
|
1610
|
-
L: 48
|
|
1611
|
-
});
|
|
1612
|
-
const createSubscriptions = (spaces) => {
|
|
1613
|
-
for (const space of spaces) {
|
|
1614
|
-
if (spaceState[space.id]) {
|
|
1615
|
-
continue;
|
|
1616
|
-
}
|
|
1617
|
-
ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1618
|
-
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1619
|
-
if (syncState) {
|
|
1620
|
-
setSpaceState((spaceState2) => ({
|
|
1621
|
-
...spaceState2,
|
|
1622
|
-
[space.id]: syncState
|
|
1623
|
-
}));
|
|
1624
|
-
}
|
|
1625
|
-
}));
|
|
1626
|
-
}
|
|
1627
|
-
};
|
|
1628
|
-
createSubscriptions(client.spaces.get());
|
|
1629
|
-
client.spaces.subscribe((spaces) => {
|
|
1630
|
-
createSubscriptions(spaces);
|
|
1631
|
-
});
|
|
1632
|
-
return () => {
|
|
1633
|
-
void ctx.dispose();
|
|
1634
|
-
};
|
|
1635
|
-
}, [
|
|
1636
|
-
client
|
|
1637
|
-
]);
|
|
1638
|
-
return spaceState;
|
|
1639
|
-
};
|
|
1640
|
-
var useSpaceSyncState = (space) => {
|
|
1641
|
-
const [spaceState, setSpaceState] = useState10();
|
|
1642
|
-
useEffect5(() => {
|
|
1643
|
-
const ctx = new Context(void 0, {
|
|
1644
|
-
F: __dxlog_file4,
|
|
1645
|
-
L: 87
|
|
1646
|
-
});
|
|
1647
|
-
space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1648
|
-
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1649
|
-
if (syncState) {
|
|
1650
|
-
setSpaceState(syncState);
|
|
1651
|
-
}
|
|
1652
|
-
});
|
|
1653
|
-
return () => {
|
|
1654
|
-
void ctx.dispose();
|
|
1655
|
-
};
|
|
1656
|
-
}, [
|
|
1657
|
-
space
|
|
1658
|
-
]);
|
|
1659
|
-
return spaceState;
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
|
|
1663
|
-
var useEdgeStatus = () => {
|
|
1664
|
-
const [status, setStatus] = useState11(QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED);
|
|
1665
|
-
const client = useClient8();
|
|
1666
|
-
useEffect6(() => {
|
|
1667
|
-
client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
|
|
1668
|
-
setStatus(status2);
|
|
1669
|
-
});
|
|
1670
|
-
}, [
|
|
1671
|
-
client
|
|
1672
|
-
]);
|
|
1673
|
-
return status;
|
|
1674
|
-
};
|
|
1675
|
-
var InlineSyncStatus = ({ space, open }) => {
|
|
1676
|
-
const { t } = useTranslation18(SPACE_PLUGIN);
|
|
1677
|
-
const id = space.id;
|
|
1678
|
-
const { hasAttention, isAncestor, isRelated } = useAttention2(id);
|
|
1679
|
-
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1680
|
-
const { graph } = useGraph3();
|
|
1681
|
-
const attended = useAttended2();
|
|
1682
|
-
const startOfAttention = attended.at(-1);
|
|
1683
|
-
const path = usePath(graph, startOfAttention);
|
|
1684
|
-
const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
|
|
1685
|
-
const connectedToEdge = useEdgeStatus() === QueryEdgeStatusResponse.EdgeStatus.CONNECTED;
|
|
1686
|
-
const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
|
|
1687
|
-
const syncState = useSpaceSyncState(space);
|
|
1688
|
-
const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
|
|
1689
|
-
return /* @__PURE__ */ React18.createElement(Tooltip3.Root, null, /* @__PURE__ */ React18.createElement(Tooltip3.Trigger, {
|
|
1690
|
-
asChild: true
|
|
1691
|
-
}, /* @__PURE__ */ React18.createElement(AttentionGlyph2, {
|
|
1692
|
-
syncing,
|
|
1693
|
-
attended: isAttended,
|
|
1694
|
-
containsAttended,
|
|
1695
|
-
classNames: "self-center mie-1"
|
|
1696
|
-
})), /* @__PURE__ */ React18.createElement(Tooltip3.Portal, null, /* @__PURE__ */ React18.createElement(Tooltip3.Content, {
|
|
1697
|
-
side: "bottom",
|
|
1698
|
-
classNames: "z-[70]"
|
|
1699
|
-
}, /* @__PURE__ */ React18.createElement("span", null, t("syncing label")), /* @__PURE__ */ React18.createElement(Tooltip3.Arrow, null))));
|
|
1700
|
-
};
|
|
1701
|
-
|
|
1702
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1703
|
-
import React20, { useCallback as useCallback10, useEffect as useEffect8, useState as useState13 } from "react";
|
|
1704
|
-
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1705
|
-
import { useClient as useClient10 } from "@dxos/react-client";
|
|
1706
|
-
import { Icon as Icon6, Input as Input7, Popover as Popover3, useTranslation as useTranslation20 } from "@dxos/react-ui";
|
|
1707
|
-
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
1708
|
-
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
1709
|
-
|
|
1710
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/Space.tsx
|
|
1711
|
-
import React19, { useEffect as useEffect7, useState as useState12 } from "react";
|
|
1712
|
-
import { useClient as useClient9 } from "@dxos/react-client";
|
|
1713
|
-
import { useSpace } from "@dxos/react-client/echo";
|
|
1714
|
-
import { Icon as Icon5, toLocalizedString as toLocalizedString4, useTranslation as useTranslation19 } from "@dxos/react-ui";
|
|
1715
|
-
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
1716
|
-
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1717
|
-
var styles = {
|
|
1718
|
-
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
1719
|
-
barFg: "bg-neutral-100 bg-green-500",
|
|
1720
|
-
barHover: "dark:hover:bg-green-500"
|
|
1721
|
-
};
|
|
1722
|
-
var useActive = (count) => {
|
|
1723
|
-
const [current, setCurrent] = useState12(count);
|
|
1724
|
-
const [active, setActive] = useState12(false);
|
|
1725
|
-
useEffect7(() => {
|
|
1726
|
-
let t;
|
|
1727
|
-
if (count !== current) {
|
|
1728
|
-
setActive(true);
|
|
1729
|
-
setCurrent(count);
|
|
1730
|
-
t && clearTimeout(t);
|
|
1731
|
-
t = setTimeout(() => {
|
|
1732
|
-
setActive(false);
|
|
1733
|
-
}, SYNC_STALLED_TIMEOUT);
|
|
1734
|
-
}
|
|
1735
|
-
return () => {
|
|
1736
|
-
setActive(false);
|
|
1737
|
-
clearTimeout(t);
|
|
1738
|
-
};
|
|
1739
|
-
}, [
|
|
1740
|
-
count,
|
|
1741
|
-
current
|
|
1742
|
-
]);
|
|
1743
|
-
return active;
|
|
1744
|
-
};
|
|
1745
|
-
var SpaceRowContainer = ({ spaceId, state }) => {
|
|
1746
|
-
const { t } = useTranslation19(SPACE_PLUGIN);
|
|
1747
|
-
const client = useClient9();
|
|
1748
|
-
const space = useSpace(spaceId);
|
|
1749
|
-
if (!space) {
|
|
1750
|
-
return null;
|
|
1751
|
-
}
|
|
1752
|
-
const spaceName = toLocalizedString4(getSpaceDisplayName(space, {
|
|
1753
|
-
personal: space === client.spaces.default
|
|
1754
|
-
}), t);
|
|
1755
|
-
return /* @__PURE__ */ React19.createElement(SpaceRow, {
|
|
1756
|
-
spaceId,
|
|
1757
|
-
spaceName,
|
|
1758
|
-
state
|
|
1759
|
-
});
|
|
1760
|
-
};
|
|
1761
|
-
var SpaceRow = ({ spaceId, spaceName, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
|
|
1762
|
-
const downActive = useActive(localDocumentCount);
|
|
1763
|
-
const upActive = useActive(remoteDocumentCount);
|
|
1764
|
-
return /* @__PURE__ */ React19.createElement("div", {
|
|
1765
|
-
className: "flex items-center mx-0.5 gap-0.5 cursor-pointer",
|
|
1766
|
-
title: spaceId,
|
|
1767
|
-
onClick: () => {
|
|
1768
|
-
void navigator.clipboard.writeText(spaceId);
|
|
1769
|
-
}
|
|
1770
|
-
}, /* @__PURE__ */ React19.createElement("span", {
|
|
1771
|
-
className: "is-1/2 truncate"
|
|
1772
|
-
}, spaceName), /* @__PURE__ */ React19.createElement(Icon5, {
|
|
1773
|
-
icon: "ph--arrow-fat-line-left--regular",
|
|
1774
|
-
size: 3,
|
|
1775
|
-
classNames: mx5(downActive && "animate-[pulse_1s_infinite]")
|
|
1776
|
-
}), /* @__PURE__ */ React19.createElement(Candle, {
|
|
1777
|
-
up: {
|
|
1778
|
-
count: remoteDocumentCount,
|
|
1779
|
-
total: remoteDocumentCount + missingOnRemote
|
|
1780
|
-
},
|
|
1781
|
-
down: {
|
|
1782
|
-
count: localDocumentCount,
|
|
1783
|
-
total: localDocumentCount + missingOnLocal
|
|
1784
|
-
},
|
|
1785
|
-
title: spaceId
|
|
1786
|
-
}), /* @__PURE__ */ React19.createElement(Icon5, {
|
|
1787
|
-
icon: "ph--arrow-fat-line-right--regular",
|
|
1788
|
-
size: 3,
|
|
1789
|
-
classNames: mx5(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1790
|
-
}));
|
|
1791
|
-
};
|
|
1792
|
-
var Candle = ({ classNames, up, down }) => {
|
|
1793
|
-
return /* @__PURE__ */ React19.createElement("div", {
|
|
1794
|
-
className: mx5("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1795
|
-
}, /* @__PURE__ */ React19.createElement(Bar, {
|
|
1796
|
-
classNames: "justify-end",
|
|
1797
|
-
...up
|
|
1798
|
-
}), /* @__PURE__ */ React19.createElement("div", {
|
|
1799
|
-
className: "relative"
|
|
1800
|
-
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1801
|
-
className: mx5("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1802
|
-
}, up.total)), /* @__PURE__ */ React19.createElement(Bar, down));
|
|
1803
|
-
};
|
|
1804
|
-
var Bar = ({ classNames, count, total }) => {
|
|
1805
|
-
let p = count / total * 100;
|
|
1806
|
-
if (count < total) {
|
|
1807
|
-
p = Math.min(p, 95);
|
|
1808
|
-
}
|
|
1809
|
-
return /* @__PURE__ */ React19.createElement("div", {
|
|
1810
|
-
className: mx5("relative flex w-full", styles.barBg, classNames)
|
|
1811
|
-
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1812
|
-
className: mx5("shrink-0", styles.barFg),
|
|
1813
|
-
style: {
|
|
1814
|
-
width: `${p}%`
|
|
1815
|
-
}
|
|
1816
|
-
}), count !== total && /* @__PURE__ */ React19.createElement("div", {
|
|
1817
|
-
className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
|
|
1818
|
-
}, count));
|
|
1819
|
-
};
|
|
1820
|
-
|
|
1821
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts
|
|
1822
|
-
import { Context as Context2 } from "@dxos/context";
|
|
1823
|
-
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
|
|
1824
|
-
var createClientSaveTracker = (client, cb) => {
|
|
1825
|
-
const unsubscribeCallbacks = {};
|
|
1826
|
-
const state = {};
|
|
1827
|
-
const install = (spaces) => {
|
|
1828
|
-
for (const space of spaces) {
|
|
1829
|
-
if (state[space.id]) {
|
|
1830
|
-
continue;
|
|
1831
|
-
}
|
|
1832
|
-
state[space.id] = "saved";
|
|
1833
|
-
unsubscribeCallbacks[space.id] = createSpaceSaveTracker(space, (s) => {
|
|
1834
|
-
state[space.id] = s;
|
|
1835
|
-
cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
client.spaces.subscribe((spaces) => {
|
|
1840
|
-
install(spaces);
|
|
1841
|
-
});
|
|
1842
|
-
install(client.spaces.get());
|
|
1843
|
-
return () => {
|
|
1844
|
-
for (const unsubscribe of Object.values(unsubscribeCallbacks)) {
|
|
1845
|
-
unsubscribe();
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
};
|
|
1849
|
-
var createSpaceSaveTracker = (space, cb) => {
|
|
1850
|
-
const ctx = new Context2(void 0, {
|
|
1851
|
-
F: __dxlog_file5,
|
|
1852
|
-
L: 40
|
|
1853
|
-
});
|
|
1854
|
-
void space.waitUntilReady().then(() => {
|
|
1855
|
-
if (ctx.disposed) {
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
let hasUnsavedChanges = false;
|
|
1859
|
-
let lastFlushPromise;
|
|
1860
|
-
space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
|
|
1861
|
-
hasUnsavedChanges = unsavedDocuments.length > 0;
|
|
1862
|
-
});
|
|
1863
|
-
space.crud.saveStateChanged.debounce(500).on(ctx, () => {
|
|
1864
|
-
if (hasUnsavedChanges) {
|
|
1865
|
-
lastFlushPromise = void 0;
|
|
1866
|
-
cb("saving");
|
|
1867
|
-
} else {
|
|
1868
|
-
const flushPromise = space.crud.flush();
|
|
1869
|
-
lastFlushPromise = flushPromise;
|
|
1870
|
-
void flushPromise.then(() => {
|
|
1871
|
-
if (lastFlushPromise === flushPromise) {
|
|
1872
|
-
cb("saved");
|
|
1873
|
-
}
|
|
1874
|
-
});
|
|
1875
|
-
}
|
|
1876
|
-
});
|
|
1877
|
-
});
|
|
1878
|
-
return () => {
|
|
1879
|
-
void ctx.dispose();
|
|
1880
|
-
};
|
|
1881
|
-
};
|
|
1882
|
-
|
|
1883
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/status.ts
|
|
1884
|
-
var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
|
|
1885
|
-
if (!saved) {
|
|
1886
|
-
return "saving locally";
|
|
1887
|
-
} else if (!offline && needsToDownload) {
|
|
1888
|
-
return "downloading";
|
|
1889
|
-
} else if (!offline && needsToUpload) {
|
|
1890
|
-
return "uploading";
|
|
1891
|
-
} else if (offline && !needsToUpload && !needsToDownload) {
|
|
1892
|
-
return "offline persisted";
|
|
1893
|
-
} else {
|
|
1894
|
-
return "remote synced";
|
|
1895
|
-
}
|
|
1896
|
-
};
|
|
1897
|
-
var getIcon = (status) => {
|
|
1898
|
-
switch (status) {
|
|
1899
|
-
case "saving locally":
|
|
1900
|
-
return "ph--download--regular";
|
|
1901
|
-
case "downloading":
|
|
1902
|
-
return "ph--cloud-arrow-down--regular";
|
|
1903
|
-
case "uploading":
|
|
1904
|
-
return "ph--cloud-arrow-up--regular";
|
|
1905
|
-
case "offline persisted":
|
|
1906
|
-
return "ph--check-circle--regular";
|
|
1907
|
-
case "remote synced":
|
|
1908
|
-
return "ph--cloud-check--regular";
|
|
1909
|
-
}
|
|
1910
|
-
};
|
|
1911
|
-
|
|
1912
|
-
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1913
|
-
var SyncStatus = () => {
|
|
1914
|
-
const client = useClient10();
|
|
1915
|
-
const state = useSyncState();
|
|
1916
|
-
const [saved, setSaved] = useState13(true);
|
|
1917
|
-
useEffect8(() => {
|
|
1918
|
-
return createClientSaveTracker(client, (state2) => {
|
|
1919
|
-
setSaved(state2 === "saved");
|
|
1920
|
-
});
|
|
1921
|
-
}, []);
|
|
1922
|
-
return /* @__PURE__ */ React20.createElement(SyncStatusIndicator, {
|
|
1923
|
-
state,
|
|
1924
|
-
saved
|
|
1925
|
-
});
|
|
1926
|
-
};
|
|
1927
|
-
var SyncStatusIndicator = ({ state, saved }) => {
|
|
1928
|
-
const { t } = useTranslation20(SPACE_PLUGIN);
|
|
1929
|
-
const summary = getSyncSummary(state);
|
|
1930
|
-
const offline = Object.values(state).length === 0;
|
|
1931
|
-
const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
|
|
1932
|
-
const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
|
|
1933
|
-
const status = getStatus({
|
|
1934
|
-
offline,
|
|
1935
|
-
saved,
|
|
1936
|
-
needsToUpload,
|
|
1937
|
-
needsToDownload
|
|
1938
|
-
});
|
|
1939
|
-
const [classNames, setClassNames] = useState13();
|
|
1940
|
-
useEffect8(() => {
|
|
1941
|
-
setClassNames(void 0);
|
|
1942
|
-
if (offline || !needsToUpload && !needsToDownload) {
|
|
1943
|
-
return;
|
|
1944
|
-
}
|
|
1945
|
-
const t2 = setTimeout(() => {
|
|
1946
|
-
setClassNames("text-orange-500");
|
|
1947
|
-
}, SYNC_STALLED_TIMEOUT);
|
|
1948
|
-
return () => clearTimeout(t2);
|
|
1949
|
-
}, [
|
|
1950
|
-
offline,
|
|
1951
|
-
needsToUpload,
|
|
1952
|
-
needsToDownload
|
|
1953
|
-
]);
|
|
1954
|
-
const title = t(`${status} label`);
|
|
1955
|
-
const icon = /* @__PURE__ */ React20.createElement(Icon6, {
|
|
1956
|
-
icon: getIcon(status),
|
|
1957
|
-
size: 4,
|
|
1958
|
-
classNames
|
|
1959
|
-
});
|
|
1960
|
-
if (offline) {
|
|
1961
|
-
return /* @__PURE__ */ React20.createElement(StatusBar.Item, {
|
|
1962
|
-
title
|
|
1963
|
-
}, icon);
|
|
1964
|
-
} else {
|
|
1965
|
-
return /* @__PURE__ */ React20.createElement(Popover3.Root, null, /* @__PURE__ */ React20.createElement(Popover3.Trigger, {
|
|
1966
|
-
asChild: true
|
|
1967
|
-
}, /* @__PURE__ */ React20.createElement(StatusBar.Button, {
|
|
1968
|
-
title
|
|
1969
|
-
}, icon)), /* @__PURE__ */ React20.createElement(Popover3.Portal, null, /* @__PURE__ */ React20.createElement(Popover3.Content, {
|
|
1970
|
-
sideOffset: 16
|
|
1971
|
-
}, /* @__PURE__ */ React20.createElement(SyncStatusDetail, {
|
|
1972
|
-
state,
|
|
1973
|
-
summary,
|
|
1974
|
-
debug: false
|
|
1975
|
-
}))));
|
|
1976
|
-
}
|
|
1977
|
-
};
|
|
1978
|
-
var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
1979
|
-
const [showAll, setShowAll] = useState13(false);
|
|
1980
|
-
const { t } = useTranslation20(SPACE_PLUGIN);
|
|
1981
|
-
const entries = Object.entries(state).filter(([_, value]) => showAll || value.missingOnLocal + value.missingOnRemote > 0).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1982
|
-
const handleCheckedChange = useCallback10((state2) => setShowAll(state2), [
|
|
1983
|
-
setShowAll
|
|
1984
|
-
]);
|
|
1985
|
-
return /* @__PURE__ */ React20.createElement("div", {
|
|
1986
|
-
className: mx6("flex flex-col gap-3 p-2 text-xs min-w-96", classNames)
|
|
1987
|
-
}, /* @__PURE__ */ React20.createElement("div", {
|
|
1988
|
-
role: "none",
|
|
1989
|
-
className: "flex items-center"
|
|
1990
|
-
}, /* @__PURE__ */ React20.createElement("h1", {
|
|
1991
|
-
className: "flex-1"
|
|
1992
|
-
}, t("sync status title")), /* @__PURE__ */ React20.createElement("div", {
|
|
1993
|
-
className: "flex items-center gap-2"
|
|
1994
|
-
}, /* @__PURE__ */ React20.createElement(Input7.Root, null, /* @__PURE__ */ React20.createElement(Input7.Label, {
|
|
1995
|
-
classNames: "text-xs"
|
|
1996
|
-
}, t("show all label")), /* @__PURE__ */ React20.createElement(Input7.Checkbox, {
|
|
1997
|
-
checked: showAll,
|
|
1998
|
-
onCheckedChange: handleCheckedChange
|
|
1999
|
-
})))), /* @__PURE__ */ React20.createElement("div", {
|
|
2000
|
-
className: "flex flex-col gap-2"
|
|
2001
|
-
}, entries.length === 0 && /* @__PURE__ */ React20.createElement("div", {
|
|
2002
|
-
role: "none",
|
|
2003
|
-
className: "flex justify-center"
|
|
2004
|
-
}, t("no sync status label")), entries.map(([spaceId, state2]) => /* @__PURE__ */ React20.createElement(SpaceRowContainer, {
|
|
2005
|
-
key: spaceId,
|
|
2006
|
-
spaceId,
|
|
2007
|
-
state: state2
|
|
2008
|
-
}))), debug && /* @__PURE__ */ React20.createElement(SyntaxHighlighter, {
|
|
2009
|
-
language: "json"
|
|
2010
|
-
}, JSON.stringify(summary, null, 2)));
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
|
-
// packages/plugins/plugin-space/src/translations.ts
|
|
2014
|
-
var translations_default = [
|
|
2015
|
-
{
|
|
2016
|
-
"en-US": {
|
|
2017
|
-
[CollectionType.typename]: {
|
|
2018
|
-
"typename label": "Collection"
|
|
2019
|
-
},
|
|
2020
|
-
[SPACE_PLUGIN]: {
|
|
2021
|
-
"plugin name": "Spaces",
|
|
2022
|
-
"first run message": "Nothing selected.",
|
|
2023
|
-
"create space label": "Create space",
|
|
2024
|
-
"join space label": "Join space",
|
|
2025
|
-
"empty space message": "No documents",
|
|
2026
|
-
"empty tree message": "No spaces",
|
|
2027
|
-
"unnamed space label": "New space",
|
|
2028
|
-
"closed space label": "Closed",
|
|
2029
|
-
"loading space label": "Loading space\u2026",
|
|
2030
|
-
"lock space label": "Lock space",
|
|
2031
|
-
"unlock space label": "Unlock space",
|
|
2032
|
-
"rename space label": "Rename space",
|
|
2033
|
-
"active space label": "Active space:",
|
|
2034
|
-
"space name label": "Space name",
|
|
2035
|
-
"object name label": "Object name",
|
|
2036
|
-
"close space label": "Close space",
|
|
2037
|
-
"open space label": "Open space",
|
|
2038
|
-
"export data label": "Export data",
|
|
2039
|
-
"import data label": "Import data",
|
|
2040
|
-
"migrate space label": "Migrate space",
|
|
2041
|
-
"share space": "Share space",
|
|
2042
|
-
"save space to disk label": "Save to disk",
|
|
2043
|
-
"load space from disk label": "Load from disk",
|
|
2044
|
-
"confirm restore title": "Overwrite files in this space?",
|
|
2045
|
-
"confirm restore body": "Restoring from a backup will overwrite the contents of any documents that match.",
|
|
2046
|
-
"upload file message": "Drag file here or click to browse",
|
|
2047
|
-
"object title placeholder": "Type a title here\u2026",
|
|
2048
|
-
"personal space label": "Personal Space",
|
|
2049
|
-
"spaces label": "Spaces",
|
|
2050
|
-
"show hidden spaces label": "Show closed spaces",
|
|
2051
|
-
"save files to directory label": "Save files to disk",
|
|
2052
|
-
"select path label": "Select path",
|
|
2053
|
-
"rename collection label": "Rename collection",
|
|
2054
|
-
"rename object label": "Rename item",
|
|
2055
|
-
"duplicate object label": "Duplicate item",
|
|
2056
|
-
"delete collection label": "Delete collection",
|
|
2057
|
-
"delete object label": "Delete item",
|
|
2058
|
-
"collection deleted label": "Collection deleted",
|
|
2059
|
-
"object deleted label": "Item deleted",
|
|
2060
|
-
"objects deleted label": "Items deleted",
|
|
2061
|
-
"go to object label": "Open item",
|
|
2062
|
-
"found object label": "Ready.",
|
|
2063
|
-
"found object description": "The requested object is now available.",
|
|
2064
|
-
"waiting for object label": "Loading\u2026",
|
|
2065
|
-
"waiting for object description": "The requested object is still being synchronized.",
|
|
2066
|
-
"object not found label": "Nothing found.",
|
|
2067
|
-
"object not found description": "The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.",
|
|
2068
|
-
"missing object message": "Object not available.",
|
|
2069
|
-
"missing object description": "The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.",
|
|
2070
|
-
"create collection label": "Create collection",
|
|
2071
|
-
"unnamed object label": "New object",
|
|
2072
|
-
"unnamed collection label": "New collection",
|
|
2073
|
-
"create object in space label": "Add to space",
|
|
2074
|
-
"create object in collection label": "Add to collection",
|
|
2075
|
-
"share space label": "Share",
|
|
2076
|
-
"space members label": "Space members",
|
|
2077
|
-
"active space members heading": "Online ({{count}})",
|
|
2078
|
-
"inactive space members heading": "Offline ({{count}})",
|
|
2079
|
-
"presence label_zero": "No other viewers",
|
|
2080
|
-
"presence label_one": "1 other viewer",
|
|
2081
|
-
"presence label_other": "{{count}} other viewers",
|
|
2082
|
-
"persisted locally label": "Changes saved locally.",
|
|
2083
|
-
"persisted locally message": "All changes have been saved to disk on this device.",
|
|
2084
|
-
"persistence pending label": "Saving\u2026",
|
|
2085
|
-
"persistence error label": "Error saving changes.",
|
|
2086
|
-
"more actions label": "More actions",
|
|
2087
|
-
"invitations heading": "Invitations",
|
|
2088
|
-
"keyshortcuts label": "Keyboard shortcuts",
|
|
2089
|
-
"menu footer label": "Details",
|
|
2090
|
-
"location label": "Located in",
|
|
2091
|
-
"space limit label": "Space Limit Reached",
|
|
2092
|
-
"space limit description": "This space has reached the maximum number of objects for the beta. This limit includes deleted objects currently, but those can be permanently removed with the cleanup action.",
|
|
2093
|
-
"space limit close label": "Close",
|
|
2094
|
-
"remove deleted objects label": "Cleanup",
|
|
2095
|
-
"remove deleted objects alt": "Permanently remove deleted objects to free up space.",
|
|
2096
|
-
"copy link label": "Copy link",
|
|
2097
|
-
"default on space create label": "On space create",
|
|
2098
|
-
"sync status title": "Sync status",
|
|
2099
|
-
"dismiss label": "Dismiss",
|
|
2100
|
-
"join success label": "Successfully joined space",
|
|
2101
|
-
"name label": "Name",
|
|
2102
|
-
"name placeholder": "Name",
|
|
2103
|
-
"unnamed object settings label": "Settings",
|
|
2104
|
-
"edge replication label": "Enable EDGE Replication",
|
|
2105
|
-
"saving locally label": "Writing to disk",
|
|
2106
|
-
"downloading label": "Replicating from peers",
|
|
2107
|
-
"uploading label": "Replicating to peers",
|
|
2108
|
-
"offline persisted label": "Saved to disk (offline)",
|
|
2109
|
-
"remote synced label": "Synced with peers",
|
|
2110
|
-
"open settings panel label": "Show Settings",
|
|
2111
|
-
"open space settings label": "Space Settings",
|
|
2112
|
-
"members tab label": "Members",
|
|
2113
|
-
"settings tab label": "Settings",
|
|
2114
|
-
"syncing label": "Space syncing",
|
|
2115
|
-
"show all label": "Show all",
|
|
2116
|
-
"no sync status label": "No space with missing objects.",
|
|
2117
|
-
"create space dialog title": "Create Space",
|
|
2118
|
-
"create object dialog title": "Create Object",
|
|
2119
|
-
"space input placeholder": "Select space",
|
|
2120
|
-
"schema input placeholder": "Select object type",
|
|
2121
|
-
"creating object type label": "Type",
|
|
2122
|
-
"creating in space label": "Location",
|
|
2123
|
-
"creating in collection label": "In Collection",
|
|
2124
|
-
"clear input label": "Clear",
|
|
2125
|
-
"expose object label": "Expose in navtree"
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
];
|
|
2130
|
-
|
|
2131
|
-
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
2132
|
-
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
|
|
2133
|
-
var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
|
|
2134
|
-
var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
|
|
2135
|
-
var SPACE_MAX_OBJECTS = 500;
|
|
2136
|
-
var DIRECTORY_TYPE = "text/directory";
|
|
2137
|
-
var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
|
|
2138
|
-
var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "spaceInvitationCode", firstRun, onFirstRun } = {}) => {
|
|
2139
|
-
const settings = new LocalStorageStore(SPACE_PLUGIN, {});
|
|
2140
|
-
const state = new LocalStorageStore(SPACE_PLUGIN, {
|
|
2141
|
-
awaiting: void 0,
|
|
2142
|
-
spaceNames: {},
|
|
2143
|
-
viewersByObject: {},
|
|
2144
|
-
// TODO(wittjosiah): Stop using (Complex)Map inside reactive object.
|
|
2145
|
-
viewersByIdentity: new ComplexMap2(PublicKey2.hash),
|
|
2146
|
-
sdkMigrationRunning: {},
|
|
2147
|
-
navigableCollections: false,
|
|
2148
|
-
enabledEdgeReplication: false
|
|
2149
|
-
});
|
|
2150
|
-
const subscriptions = new EventSubscriptions();
|
|
2151
|
-
const spaceSubscriptions = new EventSubscriptions();
|
|
2152
|
-
const graphSubscriptions = /* @__PURE__ */ new Map();
|
|
2153
|
-
const schemas = [];
|
|
2154
|
-
let clientPlugin;
|
|
2155
|
-
let graphPlugin;
|
|
2156
|
-
let intentPlugin;
|
|
2157
|
-
let layoutPlugin;
|
|
2158
|
-
let navigationPlugin;
|
|
2159
|
-
let attentionPlugin;
|
|
2160
|
-
const createSpaceInvitationUrl = (invitationCode) => {
|
|
2161
|
-
const baseUrl = new URL(invitationUrl);
|
|
2162
|
-
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
2163
|
-
return baseUrl.toString();
|
|
2164
|
-
};
|
|
2165
|
-
const onSpaceReady = async () => {
|
|
2166
|
-
if (!clientPlugin || !intentPlugin || !graphPlugin || !navigationPlugin || !layoutPlugin || !attentionPlugin) {
|
|
2167
|
-
return;
|
|
2168
|
-
}
|
|
2169
|
-
const client = clientPlugin.provides.client;
|
|
2170
|
-
const dispatch = intentPlugin.provides.intent.dispatch;
|
|
2171
|
-
const graph = graphPlugin.provides.graph;
|
|
2172
|
-
const location = navigationPlugin.provides.location;
|
|
2173
|
-
const layout = layoutPlugin.provides.layout;
|
|
2174
|
-
const attention = attentionPlugin.provides.attention;
|
|
2175
|
-
const defaultSpace = client.spaces.default;
|
|
2176
|
-
if (typeof defaultSpace.properties[COMPOSER_SPACE_LOCK] !== "boolean") {
|
|
2177
|
-
defaultSpace.properties[COMPOSER_SPACE_LOCK] = true;
|
|
2178
|
-
}
|
|
2179
|
-
const { objects: [spacesOrder] } = await defaultSpace.db.query(Filter3.schema(Expando, {
|
|
2180
|
-
key: SHARED
|
|
2181
|
-
})).run();
|
|
2182
|
-
if (!spacesOrder) {
|
|
2183
|
-
defaultSpace.db.add(create({
|
|
2184
|
-
key: SHARED,
|
|
2185
|
-
order: []
|
|
2186
|
-
}));
|
|
2187
|
-
}
|
|
2188
|
-
subscriptions.add(scheduledEffect(() => ({
|
|
2189
|
-
layoutMode: layout.layoutMode,
|
|
2190
|
-
soloPart: location.active.solo?.[0]
|
|
2191
|
-
}), ({ layoutMode, soloPart }) => {
|
|
2192
|
-
if (layoutMode !== "solo" || !soloPart) {
|
|
2193
|
-
return;
|
|
2194
|
-
}
|
|
2195
|
-
const node = graph.findNode(soloPart.id);
|
|
2196
|
-
if (!node && soloPart.id.length === FQ_ID_LENGTH) {
|
|
2197
|
-
const timeout = setTimeout(async () => {
|
|
2198
|
-
const node2 = graph.findNode(soloPart.id);
|
|
2199
|
-
if (!node2) {
|
|
2200
|
-
await dispatch(createIntent8(SpaceAction.WaitForObject, {
|
|
2201
|
-
id: soloPart.id
|
|
2202
|
-
}));
|
|
2203
|
-
}
|
|
2204
|
-
}, WAIT_FOR_OBJECT_TIMEOUT2);
|
|
2205
|
-
return () => clearTimeout(timeout);
|
|
2206
|
-
}
|
|
2207
|
-
}));
|
|
2208
|
-
subscriptions.add(client.spaces.subscribe(async (spaces) => {
|
|
2209
|
-
if (defaultSpace.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
2210
|
-
await defaultSpace.internal.migrate();
|
|
2211
|
-
}
|
|
2212
|
-
spaces.filter((space) => space.state.get() === SpaceState2.SPACE_READY).forEach((space) => {
|
|
2213
|
-
subscriptions.add(scheduledEffect(() => ({
|
|
2214
|
-
name: space.properties.name
|
|
2215
|
-
}), ({ name }) => state.values.spaceNames[space.id] = name));
|
|
2216
|
-
});
|
|
2217
|
-
}).unsubscribe);
|
|
2218
|
-
subscriptions.add(scheduledEffect(() => ({
|
|
2219
|
-
open: openIds(location.active, layout.layoutMode === "solo" ? [
|
|
2220
|
-
"solo"
|
|
2221
|
-
] : [
|
|
2222
|
-
"main"
|
|
2223
|
-
]),
|
|
2224
|
-
closed: [
|
|
2225
|
-
...location.closed
|
|
2226
|
-
]
|
|
2227
|
-
}), ({ open, closed }) => {
|
|
2228
|
-
const send = () => {
|
|
2229
|
-
const spaces = client.spaces.get();
|
|
2230
|
-
const identity = client.halo.identity.get();
|
|
2231
|
-
if (identity && location.active) {
|
|
2232
|
-
const idsBySpace = reduceGroupBy(open, (id) => {
|
|
2233
|
-
try {
|
|
2234
|
-
const [spaceId] = parseFullyQualifiedId(id);
|
|
2235
|
-
return spaceId;
|
|
2236
|
-
} catch {
|
|
2237
|
-
return null;
|
|
2238
|
-
}
|
|
2239
|
-
});
|
|
2240
|
-
const removedBySpace = reduceGroupBy(closed, (id) => {
|
|
2241
|
-
try {
|
|
2242
|
-
const [spaceId] = parseFullyQualifiedId(id);
|
|
2243
|
-
return spaceId;
|
|
2244
|
-
} catch {
|
|
2245
|
-
return null;
|
|
2246
|
-
}
|
|
2247
|
-
});
|
|
2248
|
-
for (const space of spaces) {
|
|
2249
|
-
if (!idsBySpace.has(space.id)) {
|
|
2250
|
-
idsBySpace.set(space.id, []);
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
for (const [spaceId, added] of idsBySpace) {
|
|
2254
|
-
const removed = removedBySpace.get(spaceId) ?? [];
|
|
2255
|
-
const space = spaces.find((space2) => space2.id === spaceId);
|
|
2256
|
-
if (!space) {
|
|
2257
|
-
continue;
|
|
2258
|
-
}
|
|
2259
|
-
void space.postMessage("viewing", {
|
|
2260
|
-
identityKey: identity.identityKey.toHex(),
|
|
2261
|
-
attended: attention.attended ? [
|
|
2262
|
-
...attention.attended
|
|
2263
|
-
] : [],
|
|
2264
|
-
added,
|
|
2265
|
-
removed
|
|
2266
|
-
}).catch((err) => {
|
|
2267
|
-
log3.warn("Failed to broadcast active node for presence.", {
|
|
2268
|
-
err: err.message
|
|
2269
|
-
}, {
|
|
2270
|
-
F: __dxlog_file6,
|
|
2271
|
-
L: 324,
|
|
2272
|
-
S: void 0,
|
|
2273
|
-
C: (f, a) => f(...a)
|
|
2274
|
-
});
|
|
2275
|
-
});
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
};
|
|
2279
|
-
send();
|
|
2280
|
-
const interval = setInterval(() => send(), ACTIVE_NODE_BROADCAST_INTERVAL);
|
|
2281
|
-
return () => clearInterval(interval);
|
|
2282
|
-
}));
|
|
2283
|
-
subscriptions.add(client.spaces.subscribe((spaces) => {
|
|
2284
|
-
spaceSubscriptions.clear();
|
|
2285
|
-
spaces.forEach((space) => {
|
|
2286
|
-
spaceSubscriptions.add(space.listen("viewing", (message) => {
|
|
2287
|
-
const { added, removed, attended } = message.payload;
|
|
2288
|
-
const identityKey = PublicKey2.safeFrom(message.payload.identityKey);
|
|
2289
|
-
const currentIdentity = client.halo.identity.get();
|
|
2290
|
-
if (identityKey && !currentIdentity?.identityKey.equals(identityKey) && Array.isArray(added) && Array.isArray(removed)) {
|
|
2291
|
-
added.forEach((id) => {
|
|
2292
|
-
if (typeof id === "string") {
|
|
2293
|
-
if (!(id in state.values.viewersByObject)) {
|
|
2294
|
-
state.values.viewersByObject[id] = new ComplexMap2(PublicKey2.hash);
|
|
2295
|
-
}
|
|
2296
|
-
state.values.viewersByObject[id].set(identityKey, {
|
|
2297
|
-
lastSeen: Date.now(),
|
|
2298
|
-
currentlyAttended: new Set(attended).has(id)
|
|
2299
|
-
});
|
|
2300
|
-
if (!state.values.viewersByIdentity.has(identityKey)) {
|
|
2301
|
-
state.values.viewersByIdentity.set(identityKey, /* @__PURE__ */ new Set());
|
|
2302
|
-
}
|
|
2303
|
-
state.values.viewersByIdentity.get(identityKey).add(id);
|
|
2304
|
-
}
|
|
2305
|
-
});
|
|
2306
|
-
removed.forEach((id) => {
|
|
2307
|
-
if (typeof id === "string") {
|
|
2308
|
-
state.values.viewersByObject[id]?.delete(identityKey);
|
|
2309
|
-
state.values.viewersByIdentity.get(identityKey)?.delete(id);
|
|
2310
|
-
}
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
}));
|
|
2314
|
-
});
|
|
2315
|
-
}).unsubscribe);
|
|
2316
|
-
};
|
|
2317
|
-
const setEdgeReplicationDefault = async (client) => {
|
|
2318
|
-
try {
|
|
2319
|
-
await Promise.all(client.spaces.get().map((space) => space.internal.setEdgeReplicationPreference(EdgeReplicationSetting3.ENABLED)));
|
|
2320
|
-
state.values.enabledEdgeReplication = true;
|
|
2321
|
-
} catch (err) {
|
|
2322
|
-
log3.catch(err, void 0, {
|
|
2323
|
-
F: __dxlog_file6,
|
|
2324
|
-
L: 393,
|
|
2325
|
-
S: void 0,
|
|
2326
|
-
C: (f, a) => f(...a)
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
};
|
|
2330
|
-
return {
|
|
2331
|
-
meta: meta_default,
|
|
2332
|
-
ready: async ({ plugins }) => {
|
|
2333
|
-
settings.prop({
|
|
2334
|
-
key: "showHidden",
|
|
2335
|
-
type: LocalStorageStore.bool({
|
|
2336
|
-
allowUndefined: true
|
|
2337
|
-
})
|
|
2338
|
-
});
|
|
2339
|
-
state.prop({
|
|
2340
|
-
key: "spaceNames",
|
|
2341
|
-
type: LocalStorageStore.json()
|
|
2342
|
-
}).prop({
|
|
2343
|
-
key: "enabledEdgeReplication",
|
|
2344
|
-
type: LocalStorageStore.bool()
|
|
2345
|
-
});
|
|
2346
|
-
if (findPlugin(plugins, "dxos.org/plugin/stack")) {
|
|
2347
|
-
state.values.navigableCollections = true;
|
|
2348
|
-
}
|
|
2349
|
-
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
2350
|
-
layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
|
|
2351
|
-
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
|
|
2352
|
-
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
2353
|
-
clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
2354
|
-
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
2355
|
-
if (!clientPlugin || !intentPlugin) {
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
const client = clientPlugin.provides.client;
|
|
2359
|
-
const dispatch = intentPlugin.provides.intent.dispatchPromise;
|
|
2360
|
-
schemas.push(...filterPlugins(plugins, parseSchemaPlugin).map((plugin) => plugin.provides.echo.schema).filter(nonNullable2).reduce((acc, schema) => {
|
|
2361
|
-
return [
|
|
2362
|
-
...acc,
|
|
2363
|
-
...schema
|
|
2364
|
-
];
|
|
2365
|
-
}));
|
|
2366
|
-
client.addTypes(schemas);
|
|
2367
|
-
filterPlugins(plugins, parseSchemaPlugin).forEach((plugin) => {
|
|
2368
|
-
if (plugin.provides.echo.system) {
|
|
2369
|
-
client.addTypes(plugin.provides.echo.system);
|
|
2370
|
-
}
|
|
2371
|
-
});
|
|
2372
|
-
const handleFirstRun = async () => {
|
|
2373
|
-
const defaultSpace = client.spaces.default;
|
|
2374
|
-
defaultSpace.properties[CollectionType.typename] = makeRef2(create(CollectionType, {
|
|
2375
|
-
objects: [],
|
|
2376
|
-
views: {}
|
|
2377
|
-
}));
|
|
2378
|
-
if (Migrations2.versionProperty) {
|
|
2379
|
-
defaultSpace.properties[Migrations2.versionProperty] = Migrations2.targetVersion;
|
|
2380
|
-
}
|
|
2381
|
-
await onFirstRun?.({
|
|
2382
|
-
client,
|
|
2383
|
-
dispatch
|
|
2384
|
-
});
|
|
2385
|
-
};
|
|
2386
|
-
subscriptions.add(client.spaces.isReady.subscribe(async (ready) => {
|
|
2387
|
-
if (ready) {
|
|
2388
|
-
await clientPlugin?.provides.client.spaces.default.waitUntilReady();
|
|
2389
|
-
if (firstRun) {
|
|
2390
|
-
void firstRun?.wait().then(handleFirstRun);
|
|
2391
|
-
} else {
|
|
2392
|
-
await handleFirstRun();
|
|
2393
|
-
}
|
|
2394
|
-
await onSpaceReady();
|
|
2395
|
-
await setEdgeReplicationDefault(client);
|
|
2396
|
-
}
|
|
2397
|
-
}).unsubscribe);
|
|
2398
|
-
},
|
|
2399
|
-
unload: async () => {
|
|
2400
|
-
settings.close();
|
|
2401
|
-
spaceSubscriptions.clear();
|
|
2402
|
-
subscriptions.clear();
|
|
2403
|
-
graphSubscriptions.forEach((cb) => cb());
|
|
2404
|
-
graphSubscriptions.clear();
|
|
2405
|
-
},
|
|
2406
|
-
provides: {
|
|
2407
|
-
space: state.values,
|
|
2408
|
-
settings: settings.values,
|
|
2409
|
-
translations: [
|
|
2410
|
-
...translations_default,
|
|
2411
|
-
osTranslations
|
|
202
|
+
defineModule({
|
|
203
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
204
|
+
activatesOn: Events.SetupIntentResolver,
|
|
205
|
+
activate: (context) => IntentResolver({
|
|
206
|
+
createInvitationUrl,
|
|
207
|
+
context,
|
|
208
|
+
observability
|
|
209
|
+
})
|
|
210
|
+
}),
|
|
211
|
+
defineModule({
|
|
212
|
+
id: `${meta.id}/module/app-graph-builder`,
|
|
213
|
+
activatesOn: Events.SetupAppGraph,
|
|
214
|
+
activate: AppGraphBuilder
|
|
215
|
+
}),
|
|
216
|
+
// TODO(wittjosiah): This could probably be deferred.
|
|
217
|
+
defineModule({
|
|
218
|
+
id: `${meta.id}/module/app-graph-serializer`,
|
|
219
|
+
activatesOn: Events.AppGraphReady,
|
|
220
|
+
activate: AppGraphSerializer
|
|
221
|
+
}),
|
|
222
|
+
defineModule({
|
|
223
|
+
id: `${meta.id}/module/identity-created`,
|
|
224
|
+
activatesOn: ClientEvents.IdentityCreated,
|
|
225
|
+
activatesAfter: [
|
|
226
|
+
SpaceEvents.DefaultSpaceReady
|
|
2412
227
|
],
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
}
|
|
2422
|
-
],
|
|
2423
|
-
icon: "ph--gear--regular"
|
|
2424
|
-
}
|
|
2425
|
-
]
|
|
2426
|
-
},
|
|
2427
|
-
root: () => state.values.awaiting ? /* @__PURE__ */ React21.createElement(AwaitingObject, {
|
|
2428
|
-
id: state.values.awaiting
|
|
2429
|
-
}) : null,
|
|
2430
|
-
metadata: {
|
|
2431
|
-
records: {
|
|
2432
|
-
[CollectionType.typename]: {
|
|
2433
|
-
createObject: (props) => createIntent8(CollectionAction.Create, props),
|
|
2434
|
-
placeholder: [
|
|
2435
|
-
"unnamed collection label",
|
|
2436
|
-
{
|
|
2437
|
-
ns: SPACE_PLUGIN
|
|
2438
|
-
}
|
|
2439
|
-
],
|
|
2440
|
-
icon: "ph--cards-three--regular",
|
|
2441
|
-
// TODO(wittjosiah): Move out of metadata.
|
|
2442
|
-
loadReferences: async (collection) => await RefArray.loadAll([
|
|
2443
|
-
...collection.objects,
|
|
2444
|
-
...Object.values(collection.views)
|
|
2445
|
-
])
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
echo: {
|
|
2450
|
-
schema: [
|
|
2451
|
-
CollectionType
|
|
2452
|
-
]
|
|
2453
|
-
},
|
|
2454
|
-
surface: {
|
|
2455
|
-
definitions: ({ plugins }) => {
|
|
2456
|
-
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
2457
|
-
const attention = resolvePlugin(plugins, parseAttentionPlugin)?.provides.attention;
|
|
2458
|
-
invariant2(resolve, "Metadata plugin not found.", {
|
|
2459
|
-
F: __dxlog_file6,
|
|
2460
|
-
L: 503,
|
|
2461
|
-
S: void 0,
|
|
2462
|
-
A: [
|
|
2463
|
-
"resolve",
|
|
2464
|
-
"'Metadata plugin not found.'"
|
|
2465
|
-
]
|
|
2466
|
-
});
|
|
2467
|
-
invariant2(attention, "Attention plugin not found.", {
|
|
2468
|
-
F: __dxlog_file6,
|
|
2469
|
-
L: 504,
|
|
2470
|
-
S: void 0,
|
|
2471
|
-
A: [
|
|
2472
|
-
"attention",
|
|
2473
|
-
"'Attention plugin not found.'"
|
|
2474
|
-
]
|
|
2475
|
-
});
|
|
2476
|
-
return [
|
|
2477
|
-
createSurface({
|
|
2478
|
-
id: `${SPACE_PLUGIN}/article`,
|
|
2479
|
-
role: "article",
|
|
2480
|
-
filter: (data) => (
|
|
2481
|
-
// TODO(wittjosiah): Need to avoid shotgun parsing space state everywhere.
|
|
2482
|
-
isSpace4(data.subject) && data.subject.state.get() === SpaceState2.SPACE_READY
|
|
2483
|
-
),
|
|
2484
|
-
component: ({ data, role, ...rest }) => /* @__PURE__ */ React21.createElement(Surface, {
|
|
2485
|
-
data: {
|
|
2486
|
-
id: data.subject.id,
|
|
2487
|
-
subject: data.subject.properties[CollectionType.typename]?.target
|
|
2488
|
-
},
|
|
2489
|
-
role,
|
|
2490
|
-
...rest
|
|
2491
|
-
})
|
|
2492
|
-
}),
|
|
2493
|
-
createSurface({
|
|
2494
|
-
id: `${SPACE_PLUGIN}/collection-fallback`,
|
|
2495
|
-
role: "article",
|
|
2496
|
-
disposition: "fallback",
|
|
2497
|
-
filter: (data) => data.subject instanceof CollectionType,
|
|
2498
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(CollectionMain, {
|
|
2499
|
-
collection: data.subject
|
|
2500
|
-
})
|
|
2501
|
-
}),
|
|
2502
|
-
createSurface({
|
|
2503
|
-
id: `${SPACE_PLUGIN}/settings-panel`,
|
|
2504
|
-
// TODO(burdon): Add role name syntax to minimal plugin docs.
|
|
2505
|
-
role: "complementary--settings",
|
|
2506
|
-
filter: (data) => isSpace4(data.subject),
|
|
2507
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(SpaceSettingsPanel, {
|
|
2508
|
-
space: data.subject
|
|
2509
|
-
})
|
|
2510
|
-
}),
|
|
2511
|
-
createSurface({
|
|
2512
|
-
id: `${SPACE_PLUGIN}/object-settings-panel-fallback`,
|
|
2513
|
-
role: "complementary--settings",
|
|
2514
|
-
disposition: "fallback",
|
|
2515
|
-
filter: (data) => isEchoObject2(data.subject),
|
|
2516
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(DefaultObjectSettings, {
|
|
2517
|
-
object: data.subject
|
|
2518
|
-
})
|
|
2519
|
-
}),
|
|
2520
|
-
createSurface({
|
|
2521
|
-
id: SPACE_SETTINGS_DIALOG,
|
|
2522
|
-
role: "dialog",
|
|
2523
|
-
filter: (data) => data.component === SPACE_SETTINGS_DIALOG,
|
|
2524
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(SpaceSettingsDialog, {
|
|
2525
|
-
...data.subject,
|
|
2526
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
2527
|
-
})
|
|
2528
|
-
}),
|
|
2529
|
-
createSurface({
|
|
2530
|
-
id: JOIN_DIALOG,
|
|
2531
|
-
role: "dialog",
|
|
2532
|
-
filter: (data) => data.component === JOIN_DIALOG,
|
|
2533
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(JoinDialog, data.subject)
|
|
2534
|
-
}),
|
|
2535
|
-
createSurface({
|
|
2536
|
-
id: CREATE_SPACE_DIALOG,
|
|
2537
|
-
role: "dialog",
|
|
2538
|
-
filter: (data) => data.component === CREATE_SPACE_DIALOG,
|
|
2539
|
-
component: () => /* @__PURE__ */ React21.createElement(CreateSpaceDialog, null)
|
|
2540
|
-
}),
|
|
2541
|
-
createSurface({
|
|
2542
|
-
id: CREATE_OBJECT_DIALOG,
|
|
2543
|
-
role: "dialog",
|
|
2544
|
-
filter: (data) => data.component === CREATE_OBJECT_DIALOG,
|
|
2545
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(CreateObjectDialog, {
|
|
2546
|
-
schemas,
|
|
2547
|
-
resolve,
|
|
2548
|
-
...data.subject
|
|
2549
|
-
})
|
|
2550
|
-
}),
|
|
2551
|
-
createSurface({
|
|
2552
|
-
id: POPOVER_RENAME_SPACE,
|
|
2553
|
-
role: "popover",
|
|
2554
|
-
filter: (data) => data.component === POPOVER_RENAME_SPACE && isSpace4(data.subject),
|
|
2555
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(PopoverRenameSpace, {
|
|
2556
|
-
space: data.subject
|
|
2557
|
-
})
|
|
2558
|
-
}),
|
|
2559
|
-
createSurface({
|
|
2560
|
-
id: POPOVER_RENAME_OBJECT,
|
|
2561
|
-
role: "popover",
|
|
2562
|
-
filter: (data) => data.component === POPOVER_RENAME_OBJECT && isReactiveObject3(data.subject),
|
|
2563
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(PopoverRenameObject, {
|
|
2564
|
-
object: data.subject
|
|
2565
|
-
})
|
|
2566
|
-
}),
|
|
2567
|
-
createSurface({
|
|
2568
|
-
id: `${SPACE_PLUGIN}/navtree-presence`,
|
|
2569
|
-
role: "navtree-item-end",
|
|
2570
|
-
filter: (data) => typeof data.id === "string" && isEchoObject2(data.subject),
|
|
2571
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(SmallPresenceLive, {
|
|
2572
|
-
id: data.id,
|
|
2573
|
-
open: data.open,
|
|
2574
|
-
viewers: state.values.viewersByObject[data.id]
|
|
2575
|
-
})
|
|
2576
|
-
}),
|
|
2577
|
-
createSurface({
|
|
2578
|
-
// TODO(wittjosiah): Attention glyph for non-echo items should be handled elsewhere.
|
|
2579
|
-
id: `${SPACE_PLUGIN}/navtree-presence-fallback`,
|
|
2580
|
-
role: "navtree-item-end",
|
|
2581
|
-
disposition: "fallback",
|
|
2582
|
-
filter: (data) => typeof data.id === "string",
|
|
2583
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(SmallPresenceLive, {
|
|
2584
|
-
id: data.id,
|
|
2585
|
-
open: data.open
|
|
2586
|
-
})
|
|
2587
|
-
}),
|
|
2588
|
-
createSurface({
|
|
2589
|
-
id: `${SPACE_PLUGIN}/navtree-sync-status`,
|
|
2590
|
-
role: "navtree-item-end",
|
|
2591
|
-
filter: (data) => isSpace4(data.subject),
|
|
2592
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(InlineSyncStatus, {
|
|
2593
|
-
space: data.subject,
|
|
2594
|
-
open: data.open
|
|
2595
|
-
})
|
|
2596
|
-
}),
|
|
2597
|
-
createSurface({
|
|
2598
|
-
id: `${SPACE_PLUGIN}/navbar-presence`,
|
|
2599
|
-
role: "navbar-end",
|
|
2600
|
-
disposition: "hoist",
|
|
2601
|
-
filter: (data) => isSpace4(data.subject) || isEchoObject2(data.subject),
|
|
2602
|
-
component: ({ data }) => {
|
|
2603
|
-
const space = isSpace4(data.subject) ? data.subject : getSpace5(data.subject);
|
|
2604
|
-
const object = isSpace4(data.subject) ? data.subject.state.get() === SpaceState2.SPACE_READY ? space?.properties[CollectionType.typename]?.target : void 0 : data.subject;
|
|
2605
|
-
return space && object ? /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(SpacePresence, {
|
|
2606
|
-
object
|
|
2607
|
-
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React21.createElement(ShareSpaceButton, {
|
|
2608
|
-
space
|
|
2609
|
-
})) : null;
|
|
2610
|
-
}
|
|
2611
|
-
}),
|
|
2612
|
-
createSurface({
|
|
2613
|
-
id: `${SPACE_PLUGIN}/collection-section`,
|
|
2614
|
-
role: "section",
|
|
2615
|
-
filter: (data) => data.subject instanceof CollectionType,
|
|
2616
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(CollectionSection, {
|
|
2617
|
-
collection: data.subject
|
|
2618
|
-
})
|
|
2619
|
-
}),
|
|
2620
|
-
createSurface({
|
|
2621
|
-
id: `${SPACE_PLUGIN}/settings`,
|
|
2622
|
-
role: "settings",
|
|
2623
|
-
filter: (data) => data.subject === SPACE_PLUGIN,
|
|
2624
|
-
component: () => /* @__PURE__ */ React21.createElement(SpacePluginSettings, {
|
|
2625
|
-
settings: settings.values
|
|
2626
|
-
})
|
|
2627
|
-
}),
|
|
2628
|
-
createSurface({
|
|
2629
|
-
id: `${SPACE_PLUGIN}/menu-footer`,
|
|
2630
|
-
role: "menu-footer",
|
|
2631
|
-
filter: (data) => isEchoObject2(data.subject),
|
|
2632
|
-
component: ({ data }) => /* @__PURE__ */ React21.createElement(MenuFooter, {
|
|
2633
|
-
object: data.subject
|
|
2634
|
-
})
|
|
2635
|
-
}),
|
|
2636
|
-
createSurface({
|
|
2637
|
-
id: `${SPACE_PLUGIN}/status`,
|
|
2638
|
-
role: "status",
|
|
2639
|
-
component: () => /* @__PURE__ */ React21.createElement(SyncStatus, null)
|
|
2640
|
-
})
|
|
2641
|
-
];
|
|
2642
|
-
}
|
|
2643
|
-
},
|
|
2644
|
-
graph: {
|
|
2645
|
-
builder: (plugins) => {
|
|
2646
|
-
const clientPlugin2 = resolvePlugin(plugins, parseClientPlugin);
|
|
2647
|
-
const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
|
|
2648
|
-
const graphPlugin2 = resolvePlugin(plugins, parseGraphPlugin);
|
|
2649
|
-
const client = clientPlugin2?.provides.client;
|
|
2650
|
-
const dispatch = intentPlugin?.provides.intent.dispatchPromise;
|
|
2651
|
-
const resolve = metadataPlugin?.provides.metadata.resolver;
|
|
2652
|
-
const graph = graphPlugin2?.provides.graph;
|
|
2653
|
-
if (!client || !dispatch || !resolve || !graph) {
|
|
2654
|
-
return [];
|
|
2655
|
-
}
|
|
2656
|
-
const spacesNode = {
|
|
2657
|
-
id: SPACES,
|
|
2658
|
-
type: SPACES,
|
|
2659
|
-
cacheable: [
|
|
2660
|
-
"label",
|
|
2661
|
-
"role"
|
|
2662
|
-
],
|
|
2663
|
-
properties: {
|
|
2664
|
-
label: [
|
|
2665
|
-
"spaces label",
|
|
2666
|
-
{
|
|
2667
|
-
ns: SPACE_PLUGIN
|
|
2668
|
-
}
|
|
2669
|
-
],
|
|
2670
|
-
testId: "spacePlugin.spaces",
|
|
2671
|
-
role: "branch",
|
|
2672
|
-
disabled: true,
|
|
2673
|
-
childrenPersistenceClass: "echo",
|
|
2674
|
-
onRearrangeChildren: async (nextOrder) => {
|
|
2675
|
-
graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
|
|
2676
|
-
const { objects: [spacesOrder] } = await client.spaces.default.db.query(Filter3.schema(Expando, {
|
|
2677
|
-
key: SHARED
|
|
2678
|
-
})).run();
|
|
2679
|
-
if (spacesOrder) {
|
|
2680
|
-
spacesOrder.order = nextOrder.map(({ id }) => id);
|
|
2681
|
-
} else {
|
|
2682
|
-
log3.warn("spaces order object not found", void 0, {
|
|
2683
|
-
F: __dxlog_file6,
|
|
2684
|
-
L: 694,
|
|
2685
|
-
S: void 0,
|
|
2686
|
-
C: (f, a) => f(...a)
|
|
2687
|
-
});
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
}
|
|
2691
|
-
};
|
|
2692
|
-
return [
|
|
2693
|
-
// Primary actions.
|
|
2694
|
-
createExtension({
|
|
2695
|
-
id: `${SPACE_PLUGIN}/primary-actions`,
|
|
2696
|
-
filter: (node) => node.id === "root",
|
|
2697
|
-
actions: () => [
|
|
2698
|
-
{
|
|
2699
|
-
id: SpaceAction.OpenCreateSpace._tag,
|
|
2700
|
-
data: async () => {
|
|
2701
|
-
await dispatch(createIntent8(SpaceAction.OpenCreateSpace));
|
|
2702
|
-
},
|
|
2703
|
-
properties: {
|
|
2704
|
-
label: [
|
|
2705
|
-
"create space label",
|
|
2706
|
-
{
|
|
2707
|
-
ns: SPACE_PLUGIN
|
|
2708
|
-
}
|
|
2709
|
-
],
|
|
2710
|
-
icon: "ph--plus--regular",
|
|
2711
|
-
testId: "spacePlugin.createSpace",
|
|
2712
|
-
disposition: "item"
|
|
2713
|
-
}
|
|
2714
|
-
},
|
|
2715
|
-
{
|
|
2716
|
-
id: SpaceAction.Join._tag,
|
|
2717
|
-
data: async () => {
|
|
2718
|
-
await dispatch(createIntent8(SpaceAction.Join));
|
|
2719
|
-
},
|
|
2720
|
-
properties: {
|
|
2721
|
-
label: [
|
|
2722
|
-
"join space label",
|
|
2723
|
-
{
|
|
2724
|
-
ns: SPACE_PLUGIN
|
|
2725
|
-
}
|
|
2726
|
-
],
|
|
2727
|
-
icon: "ph--sign-in--regular",
|
|
2728
|
-
testId: "spacePlugin.joinSpace",
|
|
2729
|
-
disposition: "item",
|
|
2730
|
-
className: "border-b border-separator"
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
]
|
|
2734
|
-
}),
|
|
2735
|
-
// Create spaces group node.
|
|
2736
|
-
createExtension({
|
|
2737
|
-
id: `${SPACE_PLUGIN}/root`,
|
|
2738
|
-
filter: (node) => node.id === "root",
|
|
2739
|
-
connector: () => [
|
|
2740
|
-
spacesNode
|
|
2741
|
-
],
|
|
2742
|
-
resolver: ({ id }) => id === SPACES ? spacesNode : void 0
|
|
2743
|
-
}),
|
|
2744
|
-
// Create space nodes.
|
|
2745
|
-
createExtension({
|
|
2746
|
-
id: SPACES,
|
|
2747
|
-
filter: (node) => node.id === SPACES,
|
|
2748
|
-
connector: () => {
|
|
2749
|
-
const spaces = toSignal((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2750
|
-
const isReady = toSignal((onChange) => client.spaces.isReady.subscribe(() => onChange()).unsubscribe, () => client.spaces.isReady.get());
|
|
2751
|
-
if (!spaces || !isReady) {
|
|
2752
|
-
return;
|
|
2753
|
-
}
|
|
2754
|
-
try {
|
|
2755
|
-
const [spacesOrder] = memoizeQuery(client.spaces.default, Filter3.schema(Expando, {
|
|
2756
|
-
key: SHARED
|
|
2757
|
-
}));
|
|
2758
|
-
const order = spacesOrder?.order ?? [];
|
|
2759
|
-
const orderMap = new Map(order.map((id, index) => [
|
|
2760
|
-
id,
|
|
2761
|
-
index
|
|
2762
|
-
]));
|
|
2763
|
-
return [
|
|
2764
|
-
...spaces.filter((space) => orderMap.has(space.id)).sort((a, b) => orderMap.get(a.id) - orderMap.get(b.id)),
|
|
2765
|
-
...spaces.filter((space) => !orderMap.has(space.id))
|
|
2766
|
-
].filter((space) => settings.values.showHidden ? true : space.state.get() !== SpaceState2.SPACE_INACTIVE).map((space) => constructSpaceNode({
|
|
2767
|
-
space,
|
|
2768
|
-
navigable: state.values.navigableCollections,
|
|
2769
|
-
personal: space === client.spaces.default,
|
|
2770
|
-
namesCache: state.values.spaceNames,
|
|
2771
|
-
resolve
|
|
2772
|
-
}));
|
|
2773
|
-
} catch {
|
|
2774
|
-
}
|
|
2775
|
-
},
|
|
2776
|
-
resolver: ({ id }) => {
|
|
2777
|
-
if (id.length !== SPACE_ID_LENGTH) {
|
|
2778
|
-
return;
|
|
2779
|
-
}
|
|
2780
|
-
const spaces = toSignal((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2781
|
-
const isReady = toSignal((onChange) => client.spaces.isReady.subscribe(() => onChange()).unsubscribe, () => client.spaces.isReady.get());
|
|
2782
|
-
if (!spaces || !isReady) {
|
|
2783
|
-
return;
|
|
2784
|
-
}
|
|
2785
|
-
const space = spaces.find((space2) => space2.id === id);
|
|
2786
|
-
if (!space) {
|
|
2787
|
-
return;
|
|
2788
|
-
}
|
|
2789
|
-
if (space.state.get() === SpaceState2.SPACE_INACTIVE) {
|
|
2790
|
-
return false;
|
|
2791
|
-
} else {
|
|
2792
|
-
return constructSpaceNode({
|
|
2793
|
-
space,
|
|
2794
|
-
navigable: state.values.navigableCollections,
|
|
2795
|
-
personal: space === client.spaces.default,
|
|
2796
|
-
namesCache: state.values.spaceNames,
|
|
2797
|
-
resolve
|
|
2798
|
-
});
|
|
2799
|
-
}
|
|
2800
|
-
}
|
|
2801
|
-
}),
|
|
2802
|
-
// Create space actions.
|
|
2803
|
-
createExtension({
|
|
2804
|
-
id: `${SPACE_PLUGIN}/actions`,
|
|
2805
|
-
filter: (node) => isSpace4(node.data),
|
|
2806
|
-
actions: ({ node }) => {
|
|
2807
|
-
const space = node.data;
|
|
2808
|
-
return constructSpaceActions({
|
|
2809
|
-
space,
|
|
2810
|
-
dispatch,
|
|
2811
|
-
personal: space === client.spaces.default,
|
|
2812
|
-
migrating: state.values.sdkMigrationRunning[space.id]
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
}),
|
|
2816
|
-
// Create nodes for objects in the root collection of a space.
|
|
2817
|
-
createExtension({
|
|
2818
|
-
id: `${SPACE_PLUGIN}/root-collection`,
|
|
2819
|
-
filter: (node) => isSpace4(node.data),
|
|
2820
|
-
connector: ({ node }) => {
|
|
2821
|
-
const space = node.data;
|
|
2822
|
-
const spaceState = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2823
|
-
if (spaceState !== SpaceState2.SPACE_READY) {
|
|
2824
|
-
return;
|
|
2825
|
-
}
|
|
2826
|
-
const collection = space.properties[CollectionType.typename]?.target;
|
|
2827
|
-
if (!collection) {
|
|
2828
|
-
return;
|
|
2829
|
-
}
|
|
2830
|
-
return collection.objects.map((object) => object.target).filter(nonNullable2).map((object) => createObjectNode({
|
|
2831
|
-
object,
|
|
2832
|
-
space,
|
|
2833
|
-
resolve,
|
|
2834
|
-
navigable: state.values.navigableCollections
|
|
2835
|
-
})).filter(nonNullable2);
|
|
2836
|
-
}
|
|
2837
|
-
}),
|
|
2838
|
-
// Create nodes for objects in a collection or by its fully qualified id.
|
|
2839
|
-
createExtension({
|
|
2840
|
-
id: `${SPACE_PLUGIN}/objects`,
|
|
2841
|
-
filter: (node) => node.data instanceof CollectionType,
|
|
2842
|
-
connector: ({ node }) => {
|
|
2843
|
-
const collection = node.data;
|
|
2844
|
-
const space = getSpace5(collection);
|
|
2845
|
-
if (!space) {
|
|
2846
|
-
return;
|
|
2847
|
-
}
|
|
2848
|
-
return collection.objects.map((object) => object.target).filter(nonNullable2).map((object) => createObjectNode({
|
|
2849
|
-
object,
|
|
2850
|
-
space,
|
|
2851
|
-
resolve,
|
|
2852
|
-
navigable: state.values.navigableCollections
|
|
2853
|
-
})).filter(nonNullable2);
|
|
2854
|
-
},
|
|
2855
|
-
resolver: ({ id }) => {
|
|
2856
|
-
if (id.length !== FQ_ID_LENGTH) {
|
|
2857
|
-
return;
|
|
2858
|
-
}
|
|
2859
|
-
const [spaceId, objectId] = id.split(":");
|
|
2860
|
-
if (spaceId.length !== SPACE_ID_LENGTH && objectId.length !== OBJECT_ID_LENGTH) {
|
|
2861
|
-
return;
|
|
2862
|
-
}
|
|
2863
|
-
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
2864
|
-
if (!space) {
|
|
2865
|
-
return;
|
|
2866
|
-
}
|
|
2867
|
-
const spaceState = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2868
|
-
if (spaceState !== SpaceState2.SPACE_READY) {
|
|
2869
|
-
return;
|
|
2870
|
-
}
|
|
2871
|
-
const store = memoize2(() => signal(space.db.getObjectById(objectId)), id);
|
|
2872
|
-
memoize2(() => {
|
|
2873
|
-
if (!store.value) {
|
|
2874
|
-
void space.db.query({
|
|
2875
|
-
id: objectId
|
|
2876
|
-
}, {
|
|
2877
|
-
deleted: QueryOptions.ShowDeletedOption.SHOW_DELETED
|
|
2878
|
-
}).first().then((o) => store.value = o).catch((err) => log3.catch(err, {
|
|
2879
|
-
objectId
|
|
2880
|
-
}, {
|
|
2881
|
-
F: __dxlog_file6,
|
|
2882
|
-
L: 919,
|
|
2883
|
-
S: void 0,
|
|
2884
|
-
C: (f, a) => f(...a)
|
|
2885
|
-
}));
|
|
2886
|
-
}
|
|
2887
|
-
}, id);
|
|
2888
|
-
const object = store.value;
|
|
2889
|
-
if (!object) {
|
|
2890
|
-
return;
|
|
2891
|
-
}
|
|
2892
|
-
if (isDeleted(object)) {
|
|
2893
|
-
return false;
|
|
2894
|
-
} else {
|
|
2895
|
-
return createObjectNode({
|
|
2896
|
-
object,
|
|
2897
|
-
space,
|
|
2898
|
-
resolve,
|
|
2899
|
-
navigable: state.values.navigableCollections
|
|
2900
|
-
});
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
}),
|
|
2904
|
-
// Create collection actions and action groups.
|
|
2905
|
-
createExtension({
|
|
2906
|
-
id: `${SPACE_PLUGIN}/object-actions`,
|
|
2907
|
-
filter: (node) => isEchoObject2(node.data),
|
|
2908
|
-
actions: ({ node }) => constructObjectActions({
|
|
2909
|
-
node,
|
|
2910
|
-
dispatch
|
|
2911
|
-
})
|
|
2912
|
-
}),
|
|
2913
|
-
// Create nodes for object settings.
|
|
2914
|
-
createExtension({
|
|
2915
|
-
id: `${SPACE_PLUGIN}/settings-for-subject`,
|
|
2916
|
-
resolver: ({ id }) => {
|
|
2917
|
-
if (!id.endsWith("~settings")) {
|
|
2918
|
-
return;
|
|
2919
|
-
}
|
|
2920
|
-
const type = "orphan-settings-for-subject";
|
|
2921
|
-
const icon = "ph--gear--regular";
|
|
2922
|
-
const [subjectId] = id.split("~");
|
|
2923
|
-
const { spaceId, objectId } = parseId(subjectId);
|
|
2924
|
-
const spaces = toSignal((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2925
|
-
const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === SpaceState2.SPACE_READY);
|
|
2926
|
-
if (!objectId) {
|
|
2927
|
-
const label2 = space ? space.properties.name || [
|
|
2928
|
-
"unnamed space label",
|
|
2929
|
-
{
|
|
2930
|
-
ns: SPACE_PLUGIN
|
|
2931
|
-
}
|
|
2932
|
-
] : [
|
|
2933
|
-
"unnamed object settings label",
|
|
2934
|
-
{
|
|
2935
|
-
ns: SPACE_PLUGIN
|
|
2936
|
-
}
|
|
2937
|
-
];
|
|
2938
|
-
return {
|
|
2939
|
-
id,
|
|
2940
|
-
type,
|
|
2941
|
-
data: null,
|
|
2942
|
-
properties: {
|
|
2943
|
-
icon,
|
|
2944
|
-
label: label2,
|
|
2945
|
-
showResolvedThreads: false,
|
|
2946
|
-
object: null,
|
|
2947
|
-
space
|
|
2948
|
-
}
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
const [object] = memoizeQuery(space, {
|
|
2952
|
-
id: objectId
|
|
2953
|
-
});
|
|
2954
|
-
if (!object || !subjectId) {
|
|
2955
|
-
return;
|
|
2956
|
-
}
|
|
2957
|
-
const meta = resolve(getTypename2(object) ?? "");
|
|
2958
|
-
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
2959
|
-
"unnamed object settings label",
|
|
2960
|
-
{
|
|
2961
|
-
ns: SPACE_PLUGIN
|
|
2962
|
-
}
|
|
2963
|
-
];
|
|
2964
|
-
return {
|
|
2965
|
-
id,
|
|
2966
|
-
type,
|
|
2967
|
-
data: null,
|
|
2968
|
-
properties: {
|
|
2969
|
-
icon,
|
|
2970
|
-
label,
|
|
2971
|
-
object
|
|
2972
|
-
}
|
|
2973
|
-
};
|
|
2974
|
-
}
|
|
2975
|
-
})
|
|
2976
|
-
];
|
|
2977
|
-
},
|
|
2978
|
-
serializer: (plugins) => {
|
|
2979
|
-
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
2980
|
-
if (!dispatch) {
|
|
2981
|
-
return [];
|
|
2982
|
-
}
|
|
2983
|
-
return [
|
|
2984
|
-
{
|
|
2985
|
-
inputType: SPACES,
|
|
2986
|
-
outputType: DIRECTORY_TYPE,
|
|
2987
|
-
serialize: (node) => ({
|
|
2988
|
-
name: translations_default[0]["en-US"][SPACE_PLUGIN]["spaces label"],
|
|
2989
|
-
data: translations_default[0]["en-US"][SPACE_PLUGIN]["spaces label"],
|
|
2990
|
-
type: DIRECTORY_TYPE
|
|
2991
|
-
}),
|
|
2992
|
-
deserialize: () => {
|
|
2993
|
-
}
|
|
2994
|
-
},
|
|
2995
|
-
{
|
|
2996
|
-
inputType: SPACE_TYPE,
|
|
2997
|
-
outputType: DIRECTORY_TYPE,
|
|
2998
|
-
serialize: (node) => ({
|
|
2999
|
-
name: node.data.properties.name ?? translations_default[0]["en-US"][SPACE_PLUGIN]["unnamed space label"],
|
|
3000
|
-
data: node.data.properties.name ?? translations_default[0]["en-US"][SPACE_PLUGIN]["unnamed space label"],
|
|
3001
|
-
type: DIRECTORY_TYPE
|
|
3002
|
-
}),
|
|
3003
|
-
deserialize: async (data) => {
|
|
3004
|
-
const result = await dispatch(createIntent8(SpaceAction.Create, {
|
|
3005
|
-
name: data.name,
|
|
3006
|
-
edgeReplication: true
|
|
3007
|
-
}));
|
|
3008
|
-
return result.data?.space;
|
|
3009
|
-
}
|
|
3010
|
-
},
|
|
3011
|
-
{
|
|
3012
|
-
inputType: CollectionType.typename,
|
|
3013
|
-
outputType: DIRECTORY_TYPE,
|
|
3014
|
-
serialize: (node) => ({
|
|
3015
|
-
name: node.data.name ?? translations_default[0]["en-US"][SPACE_PLUGIN]["unnamed collection label"],
|
|
3016
|
-
data: node.data.name ?? translations_default[0]["en-US"][SPACE_PLUGIN]["unnamed collection label"],
|
|
3017
|
-
type: DIRECTORY_TYPE
|
|
3018
|
-
}),
|
|
3019
|
-
deserialize: async (data, ancestors) => {
|
|
3020
|
-
const space = ancestors.find(isSpace4);
|
|
3021
|
-
const collection = ancestors.findLast((ancestor) => ancestor instanceof CollectionType) ?? space?.properties[CollectionType.typename]?.target;
|
|
3022
|
-
if (!space || !collection) {
|
|
3023
|
-
return;
|
|
3024
|
-
}
|
|
3025
|
-
const result = await dispatch(createIntent8(SpaceAction.AddObject, {
|
|
3026
|
-
target: collection,
|
|
3027
|
-
object: create(CollectionType, {
|
|
3028
|
-
name: data.name,
|
|
3029
|
-
objects: [],
|
|
3030
|
-
views: {}
|
|
3031
|
-
})
|
|
3032
|
-
}));
|
|
3033
|
-
return result.data?.object;
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
];
|
|
3037
|
-
}
|
|
3038
|
-
},
|
|
3039
|
-
intent: {
|
|
3040
|
-
resolvers: ({ plugins, dispatchPromise: dispatch }) => {
|
|
3041
|
-
const activeParts = resolvePlugin(plugins, parseNavigationPlugin2)?.provides.location.active;
|
|
3042
|
-
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
3043
|
-
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
3044
|
-
invariant2(activeParts, "Active parts not available.", {
|
|
3045
|
-
F: __dxlog_file6,
|
|
3046
|
-
L: 1078,
|
|
3047
|
-
S: void 0,
|
|
3048
|
-
A: [
|
|
3049
|
-
"activeParts",
|
|
3050
|
-
"'Active parts not available.'"
|
|
3051
|
-
]
|
|
3052
|
-
});
|
|
3053
|
-
invariant2(client, "Client not available.", {
|
|
3054
|
-
F: __dxlog_file6,
|
|
3055
|
-
L: 1079,
|
|
3056
|
-
S: void 0,
|
|
3057
|
-
A: [
|
|
3058
|
-
"client",
|
|
3059
|
-
"'Client not available.'"
|
|
3060
|
-
]
|
|
3061
|
-
});
|
|
3062
|
-
invariant2(resolve, "Metadata resolver not available.", {
|
|
3063
|
-
F: __dxlog_file6,
|
|
3064
|
-
L: 1080,
|
|
3065
|
-
S: void 0,
|
|
3066
|
-
A: [
|
|
3067
|
-
"resolve",
|
|
3068
|
-
"'Metadata resolver not available.'"
|
|
3069
|
-
]
|
|
3070
|
-
});
|
|
3071
|
-
return [
|
|
3072
|
-
createResolver(SpaceAction.OpenCreateSpace, () => ({
|
|
3073
|
-
intents: [
|
|
3074
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3075
|
-
element: "dialog",
|
|
3076
|
-
component: CREATE_SPACE_DIALOG,
|
|
3077
|
-
dialogBlockAlign: "start"
|
|
3078
|
-
})
|
|
3079
|
-
]
|
|
3080
|
-
})),
|
|
3081
|
-
createResolver(SpaceAction.Create, async ({ name, edgeReplication }) => {
|
|
3082
|
-
const space = await client.spaces.create({
|
|
3083
|
-
name
|
|
3084
|
-
});
|
|
3085
|
-
if (edgeReplication) {
|
|
3086
|
-
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting3.ENABLED);
|
|
3087
|
-
}
|
|
3088
|
-
await space.waitUntilReady();
|
|
3089
|
-
const collection = create(CollectionType, {
|
|
3090
|
-
objects: [],
|
|
3091
|
-
views: {}
|
|
3092
|
-
});
|
|
3093
|
-
space.properties[CollectionType.typename] = makeRef2(collection);
|
|
3094
|
-
if (Migrations2.versionProperty) {
|
|
3095
|
-
space.properties[Migrations2.versionProperty] = Migrations2.targetVersion;
|
|
3096
|
-
}
|
|
3097
|
-
return {
|
|
3098
|
-
data: {
|
|
3099
|
-
space,
|
|
3100
|
-
id: space.id,
|
|
3101
|
-
activeParts: {
|
|
3102
|
-
main: [
|
|
3103
|
-
space.id
|
|
3104
|
-
]
|
|
3105
|
-
}
|
|
3106
|
-
},
|
|
3107
|
-
intents: [
|
|
3108
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3109
|
-
name: "space.create",
|
|
3110
|
-
properties: {
|
|
3111
|
-
spaceId: space.id
|
|
3112
|
-
}
|
|
3113
|
-
})
|
|
3114
|
-
]
|
|
3115
|
-
};
|
|
3116
|
-
}),
|
|
3117
|
-
createResolver(SpaceAction.Join, ({ invitationCode }) => ({
|
|
3118
|
-
intents: [
|
|
3119
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3120
|
-
element: "dialog",
|
|
3121
|
-
component: JOIN_DIALOG,
|
|
3122
|
-
dialogBlockAlign: "start",
|
|
3123
|
-
subject: {
|
|
3124
|
-
initialInvitationCode: invitationCode
|
|
3125
|
-
}
|
|
3126
|
-
})
|
|
3127
|
-
]
|
|
3128
|
-
})),
|
|
3129
|
-
createResolver(SpaceAction.Share, ({ space }) => {
|
|
3130
|
-
const active = navigationPlugin?.provides.location.active;
|
|
3131
|
-
const mode = layoutPlugin?.provides.layout.layoutMode;
|
|
3132
|
-
const current = active ? firstIdInPart(active, mode === "solo" ? "solo" : "main") : void 0;
|
|
3133
|
-
const target = current?.startsWith(space.id) ? current : void 0;
|
|
3134
|
-
return {
|
|
3135
|
-
intents: [
|
|
3136
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3137
|
-
element: "dialog",
|
|
3138
|
-
component: SPACE_SETTINGS_DIALOG,
|
|
3139
|
-
dialogBlockAlign: "start",
|
|
3140
|
-
subject: {
|
|
3141
|
-
space,
|
|
3142
|
-
target,
|
|
3143
|
-
initialTab: "members",
|
|
3144
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3145
|
-
}
|
|
3146
|
-
}),
|
|
3147
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3148
|
-
name: "space.share",
|
|
3149
|
-
properties: {
|
|
3150
|
-
space: space.id
|
|
3151
|
-
}
|
|
3152
|
-
})
|
|
3153
|
-
]
|
|
3154
|
-
};
|
|
3155
|
-
}, {
|
|
3156
|
-
filter: (data) => !data.space.properties[COMPOSER_SPACE_LOCK]
|
|
3157
|
-
}),
|
|
3158
|
-
createResolver(SpaceAction.Lock, ({ space }) => {
|
|
3159
|
-
space.properties[COMPOSER_SPACE_LOCK] = true;
|
|
3160
|
-
return {
|
|
3161
|
-
intents: [
|
|
3162
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3163
|
-
name: "space.lock",
|
|
3164
|
-
properties: {
|
|
3165
|
-
spaceId: space.id
|
|
3166
|
-
}
|
|
3167
|
-
})
|
|
3168
|
-
]
|
|
3169
|
-
};
|
|
3170
|
-
}),
|
|
3171
|
-
createResolver(SpaceAction.Unlock, ({ space }) => {
|
|
3172
|
-
space.properties[COMPOSER_SPACE_LOCK] = false;
|
|
3173
|
-
return {
|
|
3174
|
-
intents: [
|
|
3175
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3176
|
-
name: "space.unlock",
|
|
3177
|
-
properties: {
|
|
3178
|
-
spaceId: space.id
|
|
3179
|
-
}
|
|
3180
|
-
})
|
|
3181
|
-
]
|
|
3182
|
-
};
|
|
3183
|
-
}),
|
|
3184
|
-
createResolver(SpaceAction.Rename, ({ caller, space }) => {
|
|
3185
|
-
return {
|
|
3186
|
-
intents: [
|
|
3187
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3188
|
-
element: "popover",
|
|
3189
|
-
anchorId: `dxos.org/ui/${caller}/${space.id}`,
|
|
3190
|
-
component: POPOVER_RENAME_SPACE,
|
|
3191
|
-
subject: space
|
|
3192
|
-
})
|
|
3193
|
-
]
|
|
3194
|
-
};
|
|
3195
|
-
}),
|
|
3196
|
-
createResolver(SpaceAction.OpenSettings, ({ space }) => {
|
|
3197
|
-
return {
|
|
3198
|
-
intents: [
|
|
3199
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3200
|
-
element: "dialog",
|
|
3201
|
-
component: SPACE_SETTINGS_DIALOG,
|
|
3202
|
-
dialogBlockAlign: "start",
|
|
3203
|
-
subject: {
|
|
3204
|
-
space,
|
|
3205
|
-
initialTab: "settings",
|
|
3206
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3207
|
-
}
|
|
3208
|
-
})
|
|
3209
|
-
]
|
|
3210
|
-
};
|
|
3211
|
-
}),
|
|
3212
|
-
createResolver(SpaceAction.Open, async ({ space }) => {
|
|
3213
|
-
await space.open();
|
|
3214
|
-
}),
|
|
3215
|
-
createResolver(SpaceAction.Close, async ({ space }) => {
|
|
3216
|
-
await space.close();
|
|
3217
|
-
}),
|
|
3218
|
-
createResolver(SpaceAction.Migrate, async ({ space, version }) => {
|
|
3219
|
-
if (space.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
3220
|
-
state.values.sdkMigrationRunning[space.id] = true;
|
|
3221
|
-
await space.internal.migrate();
|
|
3222
|
-
state.values.sdkMigrationRunning[space.id] = false;
|
|
3223
|
-
}
|
|
3224
|
-
const result = await Migrations2.migrate(space, version);
|
|
3225
|
-
return {
|
|
3226
|
-
data: result,
|
|
3227
|
-
intents: [
|
|
3228
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3229
|
-
name: "space.migrate",
|
|
3230
|
-
properties: {
|
|
3231
|
-
spaceId: space.id,
|
|
3232
|
-
version
|
|
3233
|
-
}
|
|
3234
|
-
})
|
|
3235
|
-
]
|
|
3236
|
-
};
|
|
3237
|
-
}),
|
|
3238
|
-
createResolver(SpaceAction.OpenCreateObject, ({ target, navigable = true }) => {
|
|
3239
|
-
return {
|
|
3240
|
-
intents: [
|
|
3241
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3242
|
-
element: "dialog",
|
|
3243
|
-
component: CREATE_OBJECT_DIALOG,
|
|
3244
|
-
dialogBlockAlign: "start",
|
|
3245
|
-
subject: {
|
|
3246
|
-
target,
|
|
3247
|
-
shouldNavigate: navigable ? (object) => !(object instanceof CollectionType) || state.values.navigableCollections : () => false
|
|
3248
|
-
}
|
|
3249
|
-
})
|
|
3250
|
-
]
|
|
3251
|
-
};
|
|
3252
|
-
}),
|
|
3253
|
-
createResolver(SpaceAction.AddObject, async ({ target, object }) => {
|
|
3254
|
-
const space = isSpace4(target) ? target : getSpace5(target);
|
|
3255
|
-
invariant2(space, "Space not found.", {
|
|
3256
|
-
F: __dxlog_file6,
|
|
3257
|
-
L: 1265,
|
|
3258
|
-
S: void 0,
|
|
3259
|
-
A: [
|
|
3260
|
-
"space",
|
|
3261
|
-
"'Space not found.'"
|
|
3262
|
-
]
|
|
3263
|
-
});
|
|
3264
|
-
if (space.db.coreDatabase.getAllObjectIds().length >= SPACE_MAX_OBJECTS) {
|
|
3265
|
-
void dispatch(createIntent8(LayoutAction2.SetLayout, {
|
|
3266
|
-
element: "toast",
|
|
3267
|
-
subject: {
|
|
3268
|
-
id: `${SPACE_PLUGIN}/space-limit`,
|
|
3269
|
-
title: [
|
|
3270
|
-
"space limit label",
|
|
3271
|
-
{
|
|
3272
|
-
ns: SPACE_PLUGIN
|
|
3273
|
-
}
|
|
3274
|
-
],
|
|
3275
|
-
description: [
|
|
3276
|
-
"space limit description",
|
|
3277
|
-
{
|
|
3278
|
-
ns: SPACE_PLUGIN
|
|
3279
|
-
}
|
|
3280
|
-
],
|
|
3281
|
-
duration: 5e3,
|
|
3282
|
-
icon: "ph--warning--regular",
|
|
3283
|
-
actionLabel: [
|
|
3284
|
-
"remove deleted objects label",
|
|
3285
|
-
{
|
|
3286
|
-
ns: SPACE_PLUGIN
|
|
3287
|
-
}
|
|
3288
|
-
],
|
|
3289
|
-
actionAlt: [
|
|
3290
|
-
"remove deleted objects alt",
|
|
3291
|
-
{
|
|
3292
|
-
ns: SPACE_PLUGIN
|
|
3293
|
-
}
|
|
3294
|
-
],
|
|
3295
|
-
closeLabel: [
|
|
3296
|
-
"close label",
|
|
3297
|
-
{
|
|
3298
|
-
ns: "os"
|
|
3299
|
-
}
|
|
3300
|
-
],
|
|
3301
|
-
onAction: () => space.db.coreDatabase.unlinkDeletedObjects()
|
|
3302
|
-
}
|
|
3303
|
-
}));
|
|
3304
|
-
void dispatch(createIntent8(ObservabilityAction2.SendEvent, {
|
|
3305
|
-
name: "space.limit",
|
|
3306
|
-
properties: {
|
|
3307
|
-
spaceId: space.id
|
|
3308
|
-
}
|
|
3309
|
-
}));
|
|
3310
|
-
throw new Error("Space limit reached.");
|
|
3311
|
-
}
|
|
3312
|
-
if (target instanceof CollectionType) {
|
|
3313
|
-
target.objects.push(makeRef2(object));
|
|
3314
|
-
} else if (isSpace4(target)) {
|
|
3315
|
-
const collection = space.properties[CollectionType.typename]?.target;
|
|
3316
|
-
if (collection instanceof CollectionType) {
|
|
3317
|
-
collection.objects.push(makeRef2(object));
|
|
3318
|
-
} else {
|
|
3319
|
-
const collection2 = create(CollectionType, {
|
|
3320
|
-
objects: [
|
|
3321
|
-
makeRef2(object)
|
|
3322
|
-
],
|
|
3323
|
-
views: {}
|
|
3324
|
-
});
|
|
3325
|
-
space.properties[CollectionType.typename] = makeRef2(collection2);
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
return {
|
|
3329
|
-
data: {
|
|
3330
|
-
id: fullyQualifiedId4(object),
|
|
3331
|
-
object,
|
|
3332
|
-
activeParts: {
|
|
3333
|
-
main: [
|
|
3334
|
-
fullyQualifiedId4(object)
|
|
3335
|
-
]
|
|
3336
|
-
}
|
|
3337
|
-
},
|
|
3338
|
-
intents: [
|
|
3339
|
-
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3340
|
-
name: "space.object.add",
|
|
3341
|
-
properties: {
|
|
3342
|
-
spaceId: space.id,
|
|
3343
|
-
objectId: object.id,
|
|
3344
|
-
typename: getTypename2(object)
|
|
3345
|
-
}
|
|
3346
|
-
})
|
|
3347
|
-
]
|
|
3348
|
-
};
|
|
3349
|
-
}),
|
|
3350
|
-
createResolver(SpaceAction.RemoveObjects, async ({ objects, target, deletionData }, undo) => {
|
|
3351
|
-
const space = getSpace5(objects[0]);
|
|
3352
|
-
invariant2(space && objects.every((obj) => isEchoObject2(obj) && getSpace5(obj) === space), void 0, {
|
|
3353
|
-
F: __dxlog_file6,
|
|
3354
|
-
L: 1330,
|
|
3355
|
-
S: void 0,
|
|
3356
|
-
A: [
|
|
3357
|
-
"space && objects.every((obj) => isEchoObject(obj) && getSpace(obj) === space)",
|
|
3358
|
-
""
|
|
3359
|
-
]
|
|
3360
|
-
});
|
|
3361
|
-
const openObjectIds = new Set(openIds(activeParts ?? {}));
|
|
3362
|
-
if (!undo) {
|
|
3363
|
-
const parentCollection = target ?? space.properties[CollectionType.typename]?.target;
|
|
3364
|
-
const nestedObjectsList = await Promise.all(objects.map((obj) => getNestedObjects(obj, resolve)));
|
|
3365
|
-
const deletionData2 = {
|
|
3366
|
-
objects,
|
|
3367
|
-
parentCollection,
|
|
3368
|
-
indices: objects.map((obj) => parentCollection instanceof CollectionType ? parentCollection.objects.findIndex((object) => object.target === obj) : -1),
|
|
3369
|
-
nestedObjectsList,
|
|
3370
|
-
wasActive: objects.flatMap((obj, i) => [
|
|
3371
|
-
obj,
|
|
3372
|
-
...nestedObjectsList[i]
|
|
3373
|
-
]).map((obj) => fullyQualifiedId4(obj)).filter((id) => openObjectIds.has(id))
|
|
3374
|
-
};
|
|
3375
|
-
if (deletionData2.parentCollection instanceof CollectionType) {
|
|
3376
|
-
[
|
|
3377
|
-
...deletionData2.indices
|
|
3378
|
-
].sort((a, b) => b - a).forEach((index) => {
|
|
3379
|
-
if (index !== -1) {
|
|
3380
|
-
deletionData2.parentCollection.objects.splice(index, 1);
|
|
3381
|
-
}
|
|
3382
|
-
});
|
|
3383
|
-
}
|
|
3384
|
-
deletionData2.nestedObjectsList.flat().forEach((obj) => {
|
|
3385
|
-
space.db.remove(obj);
|
|
3386
|
-
});
|
|
3387
|
-
objects.forEach((obj) => space.db.remove(obj));
|
|
3388
|
-
const undoMessageKey = objects.some((obj) => obj instanceof CollectionType) ? "collection deleted label" : objects.length > 1 ? "objects deleted label" : "object deleted label";
|
|
3389
|
-
return {
|
|
3390
|
-
undoable: {
|
|
3391
|
-
// TODO(ZaymonFC): Pluralize if more than one object.
|
|
3392
|
-
message: [
|
|
3393
|
-
undoMessageKey,
|
|
3394
|
-
{
|
|
3395
|
-
ns: SPACE_PLUGIN
|
|
3396
|
-
}
|
|
3397
|
-
],
|
|
3398
|
-
data: {
|
|
3399
|
-
deletionData: deletionData2
|
|
3400
|
-
}
|
|
3401
|
-
},
|
|
3402
|
-
intents: deletionData2.wasActive.length > 0 ? [
|
|
3403
|
-
createIntent8(NavigationAction5.Close, {
|
|
3404
|
-
activeParts: {
|
|
3405
|
-
main: deletionData2.wasActive
|
|
3406
|
-
}
|
|
3407
|
-
})
|
|
3408
|
-
] : void 0
|
|
3409
|
-
};
|
|
3410
|
-
} else {
|
|
3411
|
-
if (deletionData?.objects?.length && deletionData.objects.every(isEchoObject2) && deletionData.parentCollection instanceof CollectionType) {
|
|
3412
|
-
const restoredObjects = deletionData.objects.map((obj) => space.db.add(obj));
|
|
3413
|
-
deletionData.nestedObjectsList.flat().forEach((obj) => {
|
|
3414
|
-
space.db.add(obj);
|
|
3415
|
-
});
|
|
3416
|
-
deletionData.indices.forEach((index, i) => {
|
|
3417
|
-
if (index !== -1) {
|
|
3418
|
-
deletionData.parentCollection.objects.splice(index, 0, makeRef2(restoredObjects[i]));
|
|
3419
|
-
}
|
|
3420
|
-
});
|
|
3421
|
-
return {
|
|
3422
|
-
intents: deletionData.wasActive.length > 0 ? [
|
|
3423
|
-
createIntent8(NavigationAction5.Open, {
|
|
3424
|
-
activeParts: {
|
|
3425
|
-
main: deletionData.wasActive
|
|
3426
|
-
}
|
|
3427
|
-
})
|
|
3428
|
-
] : void 0
|
|
3429
|
-
};
|
|
3430
|
-
}
|
|
3431
|
-
}
|
|
3432
|
-
}),
|
|
3433
|
-
createResolver(SpaceAction.RenameObject, async ({ object, caller }) => ({
|
|
3434
|
-
intents: [
|
|
3435
|
-
createIntent8(LayoutAction2.SetLayout, {
|
|
3436
|
-
element: "popover",
|
|
3437
|
-
anchorId: `dxos.org/ui/${caller}/${fullyQualifiedId4(object)}`,
|
|
3438
|
-
component: POPOVER_RENAME_OBJECT,
|
|
3439
|
-
subject: object
|
|
3440
|
-
})
|
|
3441
|
-
]
|
|
3442
|
-
})),
|
|
3443
|
-
createResolver(SpaceAction.DuplicateObject, async ({ object, target }) => {
|
|
3444
|
-
const space = isSpace4(target) ? target : getSpace5(target);
|
|
3445
|
-
invariant2(space, "Space not found.", {
|
|
3446
|
-
F: __dxlog_file6,
|
|
3447
|
-
L: 1429,
|
|
3448
|
-
S: void 0,
|
|
3449
|
-
A: [
|
|
3450
|
-
"space",
|
|
3451
|
-
"'Space not found.'"
|
|
3452
|
-
]
|
|
3453
|
-
});
|
|
3454
|
-
const newObject = await cloneObject(object, resolve, space);
|
|
3455
|
-
return {
|
|
3456
|
-
intents: [
|
|
3457
|
-
createIntent8(SpaceAction.AddObject, {
|
|
3458
|
-
object: newObject,
|
|
3459
|
-
target
|
|
3460
|
-
})
|
|
3461
|
-
]
|
|
3462
|
-
};
|
|
3463
|
-
}),
|
|
3464
|
-
createResolver(SpaceAction.WaitForObject, async ({ id }) => {
|
|
3465
|
-
state.values.awaiting = id;
|
|
3466
|
-
}),
|
|
3467
|
-
createResolver(SpaceAction.ToggleHidden, async ({ state: state2 }) => {
|
|
3468
|
-
settings.values.showHidden = state2;
|
|
3469
|
-
}),
|
|
3470
|
-
createResolver(CollectionAction.Create, async ({ name }) => ({
|
|
3471
|
-
data: {
|
|
3472
|
-
object: create(CollectionType, {
|
|
3473
|
-
name,
|
|
3474
|
-
objects: [],
|
|
3475
|
-
views: {}
|
|
3476
|
-
})
|
|
3477
|
-
}
|
|
3478
|
-
}))
|
|
3479
|
-
];
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
};
|
|
228
|
+
activate: IdentityCreated
|
|
229
|
+
}),
|
|
230
|
+
defineModule({
|
|
231
|
+
id: `${meta.id}/module/spaces-ready`,
|
|
232
|
+
activatesOn: allOf(Events.DispatcherReady, Events.LayoutReady, Events.AppGraphReady, AttentionEvents.AttentionReady, SpaceEvents.StateReady, ClientEvents.SpacesReady),
|
|
233
|
+
activate: SpacesReady
|
|
234
|
+
})
|
|
235
|
+
]);
|
|
3484
236
|
};
|
|
3485
|
-
|
|
3486
|
-
// packages/plugins/plugin-space/src/index.ts
|
|
3487
|
-
var src_default = SpacePlugin;
|
|
3488
237
|
export {
|
|
3489
|
-
|
|
238
|
+
AdvancedObjectSettings,
|
|
3490
239
|
AwaitingObject,
|
|
240
|
+
BaseObjectSettings,
|
|
3491
241
|
COMPOSER_SPACE_LOCK,
|
|
3492
242
|
CREATE_OBJECT_DIALOG,
|
|
3493
243
|
CREATE_SPACE_DIALOG,
|
|
3494
|
-
ChannelType,
|
|
3495
|
-
CollectionAction,
|
|
3496
244
|
CollectionMain,
|
|
3497
245
|
CollectionSection,
|
|
3498
|
-
CollectionType,
|
|
3499
|
-
ContactType,
|
|
3500
246
|
CreateObjectDialog,
|
|
3501
247
|
CreateSpaceDialog,
|
|
3502
|
-
DefaultObjectSettings,
|
|
3503
248
|
FullPresence,
|
|
3504
249
|
InlineSyncStatus,
|
|
3505
250
|
JOIN_DIALOG,
|
|
3506
251
|
JoinDialog,
|
|
3507
252
|
MenuFooter,
|
|
3508
|
-
|
|
3509
|
-
MessageType,
|
|
253
|
+
POPOVER_ADD_SPACE,
|
|
3510
254
|
POPOVER_RENAME_OBJECT,
|
|
3511
255
|
POPOVER_RENAME_SPACE,
|
|
3512
256
|
PersistenceStatus,
|
|
257
|
+
PopoverAddSpace,
|
|
3513
258
|
PopoverRenameObject,
|
|
3514
259
|
PopoverRenameSpace,
|
|
3515
260
|
SHARED,
|
|
3516
261
|
SPACES,
|
|
3517
|
-
SPACE_ACTION,
|
|
3518
|
-
SPACE_DIRECTORY_HANDLE,
|
|
3519
262
|
SPACE_PLUGIN,
|
|
3520
|
-
SPACE_PLUGIN_SHORT_ID,
|
|
3521
263
|
SPACE_SETTINGS_DIALOG,
|
|
3522
264
|
SPACE_TYPE,
|
|
3523
265
|
ShareSpaceButton,
|
|
3524
266
|
ShareSpaceButtonImpl,
|
|
3525
267
|
SmallPresence,
|
|
3526
268
|
SmallPresenceLive,
|
|
3527
|
-
|
|
3528
|
-
|
|
269
|
+
SpaceCapabilities,
|
|
270
|
+
SpaceEvents,
|
|
3529
271
|
SpacePlugin,
|
|
3530
272
|
SpacePluginSettings,
|
|
3531
273
|
SpacePresence,
|
|
@@ -3534,20 +276,17 @@ export {
|
|
|
3534
276
|
SyncStatus,
|
|
3535
277
|
SyncStatusDetail,
|
|
3536
278
|
SyncStatusIndicator,
|
|
3537
|
-
|
|
3538
|
-
|
|
279
|
+
ThreadCapabilities,
|
|
280
|
+
ThreadEvents,
|
|
3539
281
|
cloneObject,
|
|
3540
282
|
constructObjectActions,
|
|
3541
283
|
constructSpaceActions,
|
|
3542
284
|
constructSpaceNode,
|
|
3543
285
|
createObjectNode,
|
|
3544
|
-
src_default as default,
|
|
3545
286
|
getActiveSpace,
|
|
3546
287
|
getNestedObjects,
|
|
3547
288
|
getSpaceDisplayName,
|
|
3548
289
|
memoizeQuery,
|
|
3549
|
-
|
|
3550
|
-
parseSpacePlugin,
|
|
3551
|
-
translations_default as translations
|
|
290
|
+
meta
|
|
3552
291
|
};
|
|
3553
292
|
//# sourceMappingURL=index.mjs.map
|