@dxos/plugin-space 0.7.4 → 0.7.5-main.9cb18ac
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/chunk-54VE4GTA.mjs +315 -0
- package/dist/lib/browser/chunk-54VE4GTA.mjs.map +7 -0
- package/dist/lib/browser/chunk-73BCBSLP.mjs +15 -0
- package/dist/lib/browser/chunk-73BCBSLP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +928 -962
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -5
- package/dist/lib/browser/types/index.mjs +8 -1
- package/dist/lib/node/chunk-46S3JOES.cjs +39 -0
- package/dist/lib/node/chunk-46S3JOES.cjs.map +7 -0
- package/dist/lib/node/chunk-YF2AQ7KP.cjs +343 -0
- package/dist/lib/node/chunk-YF2AQ7KP.cjs.map +7 -0
- package/dist/lib/node/index.cjs +1053 -1086
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +5 -9
- package/dist/lib/node/meta.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +19 -12
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/chunk-2MNFEB23.mjs +17 -0
- package/dist/lib/node-esm/chunk-2MNFEB23.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CDZETPO7.mjs +316 -0
- package/dist/lib/node-esm/chunk-CDZETPO7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +928 -962
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -5
- package/dist/lib/node-esm/types/index.mjs +8 -1
- package/dist/types/src/SpacePlugin.d.ts +2 -2
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +4 -2
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +3 -3
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -0
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts +9 -6
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts +4 -3
- 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 +3 -3
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts +2 -2
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/usePath.d.ts +11 -0
- package/dist/types/src/hooks/usePath.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +0 -23
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/collection.d.ts +8 -12
- package/dist/types/src/types/collection.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +180 -186
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +234 -4
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +3 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -38
- package/src/SpacePlugin.tsx +477 -602
- package/src/components/AwaitingObject.tsx +19 -17
- package/src/components/CreateDialog/CreateObjectDialog.tsx +33 -22
- package/src/components/CreateDialog/CreateObjectPanel.tsx +7 -7
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +10 -14
- package/src/components/JoinDialog.tsx +18 -34
- package/src/components/PersistenceStatus.tsx +1 -1
- package/src/components/PopoverRenameObject.tsx +2 -0
- package/src/components/PopoverRenameSpace.tsx +2 -0
- package/src/components/ShareSpaceButton.tsx +5 -4
- package/src/components/SpacePluginSettings.tsx +5 -11
- package/src/components/SpacePresence.stories.tsx +25 -17
- package/src/components/SpacePresence.tsx +36 -16
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +2 -3
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +3 -1
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +7 -5
- package/src/components/SpaceSettings/SpaceSettingsPanel.tsx +6 -5
- package/src/components/SyncStatus/InlineSyncStatus.tsx +37 -27
- package/src/components/SyncStatus/SyncStatusDetail.stories.tsx +55 -51
- package/src/hooks/index.ts +5 -0
- package/src/hooks/usePath.ts +44 -0
- package/src/meta.ts +0 -26
- package/src/translations.ts +3 -2
- package/src/types/collection.ts +3 -3
- package/src/types/thread.ts +6 -6
- package/src/types/types.ts +182 -13
- package/src/util.tsx +59 -52
- package/dist/lib/browser/chunk-FTKV32QZ.mjs +0 -43
- package/dist/lib/browser/chunk-FTKV32QZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-MWKXNS5S.mjs +0 -124
- package/dist/lib/browser/chunk-MWKXNS5S.mjs.map +0 -7
- package/dist/lib/node/chunk-6SNOZF7Y.cjs +0 -152
- package/dist/lib/node/chunk-6SNOZF7Y.cjs.map +0 -7
- package/dist/lib/node/chunk-QNVEU2UD.cjs +0 -69
- package/dist/lib/node/chunk-QNVEU2UD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs +0 -126
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs +0 -45
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs.map +0 -7
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts +0 -6
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts.map +0 -1
- package/src/components/SyncStatus/InlineSyncStatus.stories.tsx +0 -57
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
CollectionAction,
|
|
4
|
-
SPACE_PLUGIN,
|
|
5
|
-
SPACE_PLUGIN_SHORT_ID,
|
|
6
|
-
SpaceAction,
|
|
7
|
-
meta_default
|
|
8
|
-
} from "./chunk-UMV7XREB.mjs";
|
|
9
2
|
import {
|
|
10
3
|
ActorSchema,
|
|
11
4
|
ChannelType,
|
|
5
|
+
CollectionAction,
|
|
12
6
|
CollectionType,
|
|
13
7
|
ContactType,
|
|
14
8
|
MessageState,
|
|
15
9
|
MessageType,
|
|
10
|
+
SPACE_ACTION,
|
|
16
11
|
SPACE_DIRECTORY_HANDLE,
|
|
12
|
+
SpaceAction,
|
|
17
13
|
SpaceForm,
|
|
18
14
|
ThreadStatus,
|
|
19
15
|
ThreadType,
|
|
20
16
|
parseSchemaPlugin
|
|
21
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CDZETPO7.mjs";
|
|
18
|
+
import {
|
|
19
|
+
SPACE_PLUGIN,
|
|
20
|
+
SPACE_PLUGIN_SHORT_ID,
|
|
21
|
+
meta_default
|
|
22
|
+
} from "./chunk-2MNFEB23.mjs";
|
|
22
23
|
|
|
23
24
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
24
25
|
import { signal } from "@preact/signals-core";
|
|
25
26
|
import React21 from "react";
|
|
26
|
-
import { LayoutAction as LayoutAction2, NavigationAction as
|
|
27
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction5, Surface, createIntent as createIntent8, createResolver, createSurface, filterPlugins, findPlugin, firstIdInPart, openIds, parseGraphPlugin, parseIntentPlugin, parseLayoutPlugin, parseMetadataResolverPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
27
28
|
import { EventSubscriptions } from "@dxos/async";
|
|
28
|
-
import { S as S2 } from "@dxos/echo-schema";
|
|
29
29
|
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
30
30
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
31
|
-
import { create, isDeleted, isReactiveObject as isReactiveObject3 } from "@dxos/live-object";
|
|
31
|
+
import { RefArray, create, isDeleted, isReactiveObject as isReactiveObject3, makeRef as makeRef2 } from "@dxos/live-object";
|
|
32
32
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
33
33
|
import { log as log3 } from "@dxos/log";
|
|
34
34
|
import { Migrations as Migrations2 } from "@dxos/migrations";
|
|
35
35
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
36
|
-
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
36
|
+
import { parseClientPlugin } from "@dxos/plugin-client/types";
|
|
37
37
|
import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
|
|
38
|
-
import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/
|
|
38
|
+
import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/types";
|
|
39
39
|
import { EdgeReplicationSetting as EdgeReplicationSetting3 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
40
40
|
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
41
|
-
import { Expando, FQ_ID_LENGTH, Filter as Filter3, OBJECT_ID_LENGTH, SPACE_ID_LENGTH, SpaceState as SpaceState2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace5, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace4,
|
|
41
|
+
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";
|
|
42
42
|
import { osTranslations } from "@dxos/shell/react";
|
|
43
43
|
import { ComplexMap as ComplexMap2, nonNullable as nonNullable2, reduceGroupBy } from "@dxos/util";
|
|
44
44
|
|
|
45
45
|
// packages/plugins/plugin-space/src/components/AwaitingObject.tsx
|
|
46
46
|
import { CheckCircle, CircleDashed, CircleNotch } from "@phosphor-icons/react";
|
|
47
|
-
import React, { useEffect, useState } from "react";
|
|
48
|
-
import {
|
|
47
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
48
|
+
import { useResolvePlugin, parseNavigationPlugin, NavigationAction, useIntentDispatcher, createIntent } from "@dxos/app-framework";
|
|
49
49
|
import { useClient } from "@dxos/react-client";
|
|
50
50
|
import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
|
|
51
51
|
import { Button, Toast, useTranslation } from "@dxos/react-ui";
|
|
@@ -57,7 +57,7 @@ var AwaitingObject = ({ id }) => {
|
|
|
57
57
|
const [waiting, setWaiting] = useState(true);
|
|
58
58
|
const [found, setFound] = useState(false);
|
|
59
59
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
60
|
-
const
|
|
60
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
61
61
|
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
62
62
|
const client = useClient();
|
|
63
63
|
const objects = useQuery(client.spaces, Filter.all());
|
|
@@ -82,28 +82,27 @@ var AwaitingObject = ({ id }) => {
|
|
|
82
82
|
}, [
|
|
83
83
|
id,
|
|
84
84
|
objects,
|
|
85
|
-
|
|
85
|
+
navigationPlugin
|
|
86
86
|
]);
|
|
87
|
-
const handleClose = async () =>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
activeParts: {
|
|
99
|
-
main: [
|
|
100
|
-
id
|
|
101
|
-
]
|
|
102
|
-
}
|
|
87
|
+
const handleClose = useCallback(async () => dispatch(createIntent(SpaceAction.WaitForObject, {
|
|
88
|
+
id: void 0
|
|
89
|
+
})), [
|
|
90
|
+
dispatch
|
|
91
|
+
]);
|
|
92
|
+
const handleNavigate = useCallback(() => {
|
|
93
|
+
void dispatch(createIntent(NavigationAction.Open, {
|
|
94
|
+
activeParts: {
|
|
95
|
+
main: [
|
|
96
|
+
id
|
|
97
|
+
]
|
|
103
98
|
}
|
|
104
|
-
});
|
|
99
|
+
}));
|
|
105
100
|
void handleClose();
|
|
106
|
-
}
|
|
101
|
+
}, [
|
|
102
|
+
id,
|
|
103
|
+
handleClose,
|
|
104
|
+
dispatch
|
|
105
|
+
]);
|
|
107
106
|
return /* @__PURE__ */ React.createElement(Toast.Root, {
|
|
108
107
|
open,
|
|
109
108
|
duration: TOAST_TIMEOUT,
|
|
@@ -138,14 +137,15 @@ var AwaitingObject = ({ id }) => {
|
|
|
138
137
|
};
|
|
139
138
|
|
|
140
139
|
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
|
|
141
|
-
import
|
|
142
|
-
import {
|
|
140
|
+
import { pipe } from "effect";
|
|
141
|
+
import React3, { useCallback as useCallback3, useRef } from "react";
|
|
142
|
+
import { chain, createIntent as createIntent3, NavigationAction as NavigationAction3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
143
143
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
144
144
|
import { getSpace as getSpace2, isReactiveObject as isReactiveObject2, isSpace as isSpace3, useSpaces } from "@dxos/react-client/echo";
|
|
145
145
|
import { Button as Button2, Dialog, Icon as Icon2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
146
146
|
|
|
147
147
|
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
|
|
148
|
-
import React2, { useCallback, useState as useState2 } from "react";
|
|
148
|
+
import React2, { useCallback as useCallback2, useState as useState2 } from "react";
|
|
149
149
|
import { getObjectAnnotation as getObjectAnnotation2, S } from "@dxos/echo-schema";
|
|
150
150
|
import { isSpace as isSpace2 } from "@dxos/react-client/echo";
|
|
151
151
|
import { Icon, IconButton, Input, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
@@ -154,9 +154,10 @@ import { SearchList } from "@dxos/react-ui-searchlist";
|
|
|
154
154
|
import { nonNullable } from "@dxos/util";
|
|
155
155
|
|
|
156
156
|
// packages/plugins/plugin-space/src/util.tsx
|
|
157
|
+
import { createIntent as createIntent2, NavigationAction as NavigationAction2 } from "@dxos/app-framework";
|
|
157
158
|
import { EXPANDO_TYPENAME, getObjectAnnotation, getTypename } from "@dxos/echo-schema";
|
|
158
159
|
import { invariant } from "@dxos/invariant";
|
|
159
|
-
import { getSchema, isReactiveObject } from "@dxos/live-object";
|
|
160
|
+
import { getSchema, isReactiveObject, makeRef } from "@dxos/live-object";
|
|
160
161
|
import { Migrations } from "@dxos/migrations";
|
|
161
162
|
import { ACTION_GROUP_TYPE, ACTION_TYPE, cleanup, getGraph, memoize } from "@dxos/plugin-graph";
|
|
162
163
|
import { Filter as Filter2, fullyQualifiedId as fullyQualifiedId2, getSpace, isEchoObject, isSpace, SpaceState } from "@dxos/react-client/echo";
|
|
@@ -200,19 +201,19 @@ var getCollectionGraphNodePartials = ({ navigable, collection, space, resolve })
|
|
|
200
201
|
]),
|
|
201
202
|
role: "branch",
|
|
202
203
|
onRearrangeChildren: (nextOrder) => {
|
|
203
|
-
collection.objects = nextOrder.filter(isEchoObject);
|
|
204
|
+
collection.objects = nextOrder.filter(isEchoObject).map(makeRef);
|
|
204
205
|
},
|
|
205
206
|
onTransferStart: (child, index) => {
|
|
206
|
-
if (!collection.objects.
|
|
207
|
+
if (!collection.objects.find((object) => object.target === child.data)) {
|
|
207
208
|
if (typeof index !== "undefined") {
|
|
208
|
-
collection.objects.splice(index, 0, child.data);
|
|
209
|
+
collection.objects.splice(index, 0, makeRef(child.data));
|
|
209
210
|
} else {
|
|
210
|
-
collection.objects.push(child.data);
|
|
211
|
+
collection.objects.push(makeRef(child.data));
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
},
|
|
214
215
|
onTransferEnd: (child, destination) => {
|
|
215
|
-
const index = collection.objects.
|
|
216
|
+
const index = collection.objects.findIndex((object) => object.target === child.data);
|
|
216
217
|
if (index > -1) {
|
|
217
218
|
collection.objects.splice(index, 1);
|
|
218
219
|
}
|
|
@@ -221,9 +222,9 @@ var getCollectionGraphNodePartials = ({ navigable, collection, space, resolve })
|
|
|
221
222
|
const newObject = await cloneObject(child.data, resolve, space);
|
|
222
223
|
space.db.add(newObject);
|
|
223
224
|
if (typeof index !== "undefined") {
|
|
224
|
-
collection.objects.splice(index, 0, newObject);
|
|
225
|
+
collection.objects.splice(index, 0, makeRef(newObject));
|
|
225
226
|
} else {
|
|
226
|
-
collection.objects.push(newObject);
|
|
227
|
+
collection.objects.push(makeRef(newObject));
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
};
|
|
@@ -233,7 +234,7 @@ var checkPendingMigration = (space) => {
|
|
|
233
234
|
};
|
|
234
235
|
var constructSpaceNode = ({ space, navigable = false, personal, namesCache, resolve }) => {
|
|
235
236
|
const hasPendingMigration = checkPendingMigration(space);
|
|
236
|
-
const collection = space.state.get() === SpaceState.SPACE_READY && space.properties[CollectionType.typename];
|
|
237
|
+
const collection = space.state.get() === SpaceState.SPACE_READY && space.properties[CollectionType.typename]?.target;
|
|
237
238
|
const partials = space.state.get() === SpaceState.SPACE_READY && collection instanceof CollectionType ? getCollectionGraphNodePartials({
|
|
238
239
|
collection,
|
|
239
240
|
space,
|
|
@@ -269,16 +270,12 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
269
270
|
const actions = [];
|
|
270
271
|
if (hasPendingMigration) {
|
|
271
272
|
actions.push({
|
|
272
|
-
id: getId(SpaceAction.
|
|
273
|
+
id: getId(SpaceAction.Migrate._tag),
|
|
273
274
|
type: ACTION_GROUP_TYPE,
|
|
274
275
|
data: async () => {
|
|
275
|
-
await dispatch({
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
data: {
|
|
279
|
-
space
|
|
280
|
-
}
|
|
281
|
-
});
|
|
276
|
+
await dispatch(createIntent2(SpaceAction.Migrate, {
|
|
277
|
+
space
|
|
278
|
+
}));
|
|
282
279
|
},
|
|
283
280
|
properties: {
|
|
284
281
|
label: [
|
|
@@ -296,16 +293,12 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
296
293
|
if (state === SpaceState.SPACE_READY && !hasPendingMigration) {
|
|
297
294
|
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
298
295
|
actions.push({
|
|
299
|
-
id: getId(SpaceAction.
|
|
296
|
+
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
300
297
|
type: ACTION_TYPE,
|
|
301
298
|
data: async () => {
|
|
302
|
-
await dispatch({
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
data: {
|
|
306
|
-
target: space
|
|
307
|
-
}
|
|
308
|
-
});
|
|
299
|
+
await dispatch(createIntent2(SpaceAction.OpenCreateObject, {
|
|
300
|
+
target: space
|
|
301
|
+
}));
|
|
309
302
|
},
|
|
310
303
|
properties: {
|
|
311
304
|
label: [
|
|
@@ -319,19 +312,15 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
319
312
|
testId: "spacePlugin.createObject"
|
|
320
313
|
}
|
|
321
314
|
}, {
|
|
322
|
-
id: getId(SpaceAction.
|
|
315
|
+
id: getId(SpaceAction.Share._tag),
|
|
323
316
|
type: ACTION_TYPE,
|
|
324
317
|
data: async () => {
|
|
325
318
|
if (locked) {
|
|
326
319
|
return;
|
|
327
320
|
}
|
|
328
|
-
await dispatch({
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
data: {
|
|
332
|
-
space
|
|
333
|
-
}
|
|
334
|
-
});
|
|
321
|
+
await dispatch(createIntent2(SpaceAction.Share, {
|
|
322
|
+
space
|
|
323
|
+
}));
|
|
335
324
|
},
|
|
336
325
|
properties: {
|
|
337
326
|
label: [
|
|
@@ -348,16 +337,18 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
348
337
|
}
|
|
349
338
|
}
|
|
350
339
|
}, {
|
|
351
|
-
id: locked ? getId(SpaceAction.
|
|
340
|
+
id: locked ? getId(SpaceAction.Unlock._tag) : getId(SpaceAction.Lock._tag),
|
|
352
341
|
type: ACTION_TYPE,
|
|
353
342
|
data: async () => {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
action: locked ? SpaceAction.UNLOCK : SpaceAction.LOCK,
|
|
357
|
-
data: {
|
|
343
|
+
if (locked) {
|
|
344
|
+
await dispatch(createIntent2(SpaceAction.Unlock, {
|
|
358
345
|
space
|
|
359
|
-
}
|
|
360
|
-
}
|
|
346
|
+
}));
|
|
347
|
+
} else {
|
|
348
|
+
await dispatch(createIntent2(SpaceAction.Lock, {
|
|
349
|
+
space
|
|
350
|
+
}));
|
|
351
|
+
}
|
|
361
352
|
},
|
|
362
353
|
properties: {
|
|
363
354
|
label: [
|
|
@@ -369,17 +360,13 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
369
360
|
icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
370
361
|
}
|
|
371
362
|
}, {
|
|
372
|
-
id: getId(SpaceAction.
|
|
363
|
+
id: getId(SpaceAction.Rename._tag),
|
|
373
364
|
type: ACTION_TYPE,
|
|
374
365
|
data: async (params) => {
|
|
375
|
-
await dispatch({
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
space,
|
|
380
|
-
...params
|
|
381
|
-
}
|
|
382
|
-
});
|
|
366
|
+
await dispatch(createIntent2(SpaceAction.Rename, {
|
|
367
|
+
space,
|
|
368
|
+
caller: params.caller
|
|
369
|
+
}));
|
|
383
370
|
},
|
|
384
371
|
properties: {
|
|
385
372
|
label: [
|
|
@@ -395,16 +382,12 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
395
382
|
}
|
|
396
383
|
}
|
|
397
384
|
}, {
|
|
398
|
-
id: getId(SpaceAction.
|
|
385
|
+
id: getId(SpaceAction.OpenSettings._tag),
|
|
399
386
|
type: ACTION_TYPE,
|
|
400
387
|
data: async () => {
|
|
401
|
-
await dispatch({
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
data: {
|
|
405
|
-
space
|
|
406
|
-
}
|
|
407
|
-
});
|
|
388
|
+
await dispatch(createIntent2(SpaceAction.OpenSettings, {
|
|
389
|
+
space
|
|
390
|
+
}));
|
|
408
391
|
},
|
|
409
392
|
properties: {
|
|
410
393
|
label: [
|
|
@@ -419,16 +402,12 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
419
402
|
}
|
|
420
403
|
if (state !== SpaceState.SPACE_INACTIVE && !hasPendingMigration) {
|
|
421
404
|
actions.push({
|
|
422
|
-
id: getId(SpaceAction.
|
|
405
|
+
id: getId(SpaceAction.Close._tag),
|
|
423
406
|
type: ACTION_TYPE,
|
|
424
407
|
data: async () => {
|
|
425
|
-
await dispatch({
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
data: {
|
|
429
|
-
space
|
|
430
|
-
}
|
|
431
|
-
});
|
|
408
|
+
await dispatch(createIntent2(SpaceAction.Close, {
|
|
409
|
+
space
|
|
410
|
+
}));
|
|
432
411
|
},
|
|
433
412
|
properties: {
|
|
434
413
|
label: [
|
|
@@ -444,16 +423,12 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
444
423
|
}
|
|
445
424
|
if (state === SpaceState.SPACE_INACTIVE) {
|
|
446
425
|
actions.push({
|
|
447
|
-
id: getId(SpaceAction.
|
|
426
|
+
id: getId(SpaceAction.Open._tag),
|
|
448
427
|
type: ACTION_TYPE,
|
|
449
428
|
data: async () => {
|
|
450
|
-
await dispatch({
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
data: {
|
|
454
|
-
space
|
|
455
|
-
}
|
|
456
|
-
});
|
|
429
|
+
await dispatch(createIntent2(SpaceAction.Open, {
|
|
430
|
+
space
|
|
431
|
+
}));
|
|
457
432
|
},
|
|
458
433
|
properties: {
|
|
459
434
|
label: [
|
|
@@ -514,16 +489,12 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
514
489
|
const actions = [
|
|
515
490
|
...object instanceof CollectionType ? [
|
|
516
491
|
{
|
|
517
|
-
id: getId(SpaceAction.
|
|
492
|
+
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
518
493
|
type: ACTION_TYPE,
|
|
519
494
|
data: async () => {
|
|
520
|
-
await dispatch({
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
data: {
|
|
524
|
-
target: object
|
|
525
|
-
}
|
|
526
|
-
});
|
|
495
|
+
await dispatch(createIntent2(SpaceAction.OpenCreateObject, {
|
|
496
|
+
target: object
|
|
497
|
+
}));
|
|
527
498
|
},
|
|
528
499
|
properties: {
|
|
529
500
|
label: [
|
|
@@ -539,16 +510,13 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
539
510
|
}
|
|
540
511
|
] : [],
|
|
541
512
|
{
|
|
542
|
-
id: getId(SpaceAction.
|
|
513
|
+
id: getId(SpaceAction.RenameObject._tag),
|
|
543
514
|
type: ACTION_TYPE,
|
|
544
515
|
data: async (params) => {
|
|
545
|
-
await dispatch({
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
...params
|
|
550
|
-
}
|
|
551
|
-
});
|
|
516
|
+
await dispatch(createIntent2(SpaceAction.RenameObject, {
|
|
517
|
+
object,
|
|
518
|
+
caller: params.caller
|
|
519
|
+
}));
|
|
552
520
|
},
|
|
553
521
|
properties: {
|
|
554
522
|
label: [
|
|
@@ -564,24 +532,19 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
564
532
|
}
|
|
565
533
|
},
|
|
566
534
|
{
|
|
567
|
-
id: getId(SpaceAction.
|
|
535
|
+
id: getId(SpaceAction.RemoveObjects._tag),
|
|
568
536
|
type: ACTION_TYPE,
|
|
569
537
|
data: async () => {
|
|
570
538
|
const graph = getGraph(node);
|
|
571
539
|
const collection = graph.nodes(node, {
|
|
572
540
|
relation: "inbound"
|
|
573
541
|
}).find(({ data }) => data instanceof CollectionType)?.data;
|
|
574
|
-
await dispatch(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
],
|
|
581
|
-
collection
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
]);
|
|
542
|
+
await dispatch(createIntent2(SpaceAction.RemoveObjects, {
|
|
543
|
+
objects: [
|
|
544
|
+
object
|
|
545
|
+
],
|
|
546
|
+
target: collection
|
|
547
|
+
}));
|
|
585
548
|
},
|
|
586
549
|
properties: {
|
|
587
550
|
label: [
|
|
@@ -612,6 +575,26 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
612
575
|
icon: "ph--link--regular",
|
|
613
576
|
testId: "spacePlugin.copyLink"
|
|
614
577
|
}
|
|
578
|
+
},
|
|
579
|
+
// TODO(wittjosiah): Factor out and apply to all nodes.
|
|
580
|
+
{
|
|
581
|
+
id: NavigationAction2.Expose._tag,
|
|
582
|
+
type: ACTION_TYPE,
|
|
583
|
+
data: async () => {
|
|
584
|
+
await dispatch(createIntent2(NavigationAction2.Expose, {
|
|
585
|
+
id: fullyQualifiedId2(object)
|
|
586
|
+
}));
|
|
587
|
+
},
|
|
588
|
+
properties: {
|
|
589
|
+
label: [
|
|
590
|
+
"expose object label",
|
|
591
|
+
{
|
|
592
|
+
ns: SPACE_PLUGIN
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
icon: "ph--eye--regular",
|
|
596
|
+
testId: "spacePlugin.exposeObject"
|
|
597
|
+
}
|
|
615
598
|
}
|
|
616
599
|
];
|
|
617
600
|
return actions;
|
|
@@ -650,7 +633,7 @@ var cloneObject = async (object, resolve, newSpace) => {
|
|
|
650
633
|
const serializer = metadata.serializer;
|
|
651
634
|
invariant(serializer, `No serializer for type: ${typename}`, {
|
|
652
635
|
F: __dxlog_file,
|
|
653
|
-
L:
|
|
636
|
+
L: 551,
|
|
654
637
|
S: void 0,
|
|
655
638
|
A: [
|
|
656
639
|
"serializer",
|
|
@@ -674,9 +657,9 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
674
657
|
const [target, setTarget] = useState2(initialTarget);
|
|
675
658
|
const schema = schemas.find((schema2) => getObjectAnnotation2(schema2)?.typename === typename);
|
|
676
659
|
const options = schemas.map(getObjectAnnotation2).filter(nonNullable);
|
|
677
|
-
const handleClearSchema =
|
|
678
|
-
const handleClearTarget =
|
|
679
|
-
const handleCreateObject =
|
|
660
|
+
const handleClearSchema = useCallback2(() => setTypename(void 0), []);
|
|
661
|
+
const handleClearTarget = useCallback2(() => setTarget(void 0), []);
|
|
662
|
+
const handleCreateObject = useCallback2(async ({ name }) => {
|
|
680
663
|
if (!schema || !target) {
|
|
681
664
|
return;
|
|
682
665
|
}
|
|
@@ -692,7 +675,7 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
692
675
|
]);
|
|
693
676
|
const schemaInput = /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
694
677
|
label: t("schema input label"),
|
|
695
|
-
classNames: "flex flex-col grow overflow-hidden
|
|
678
|
+
classNames: "flex flex-col grow overflow-hidden"
|
|
696
679
|
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
697
680
|
autoFocus: true,
|
|
698
681
|
"data-testid": "create-object-form.schema-input",
|
|
@@ -719,7 +702,7 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
719
702
|
}))))));
|
|
720
703
|
const spaceInput = /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
721
704
|
label: t("space input label"),
|
|
722
|
-
classNames: "flex flex-col grow overflow-hidden
|
|
705
|
+
classNames: "flex flex-col grow overflow-hidden"
|
|
723
706
|
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
724
707
|
autoFocus: true,
|
|
725
708
|
"data-testid": "create-object-form.space-input",
|
|
@@ -754,8 +737,7 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
754
737
|
role: "form",
|
|
755
738
|
className: "flex flex-col gap-2"
|
|
756
739
|
}, target && /* @__PURE__ */ React2.createElement("div", {
|
|
757
|
-
role: "none"
|
|
758
|
-
className: "px-2"
|
|
740
|
+
role: "none"
|
|
759
741
|
}, /* @__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", {
|
|
760
742
|
role: "none",
|
|
761
743
|
className: "flex gap-2"
|
|
@@ -770,8 +752,7 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
770
752
|
label: t("clear input label"),
|
|
771
753
|
onClick: handleClearTarget
|
|
772
754
|
})))), schema && /* @__PURE__ */ React2.createElement("div", {
|
|
773
|
-
role: "none"
|
|
774
|
-
className: "px-2"
|
|
755
|
+
role: "none"
|
|
775
756
|
}, /* @__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", {
|
|
776
757
|
role: "none",
|
|
777
758
|
className: "flex gap-2"
|
|
@@ -790,44 +771,37 @@ var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: i
|
|
|
790
771
|
};
|
|
791
772
|
|
|
792
773
|
// packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
|
|
793
|
-
var
|
|
774
|
+
var CREATE_OBJECT_DIALOG = `${SPACE_PLUGIN}/CreateObjectDialog`;
|
|
775
|
+
var CreateObjectDialog = ({ schemas, target, typename, name, shouldNavigate: _shouldNavigate, resolve }) => {
|
|
794
776
|
const closeRef = useRef(null);
|
|
795
777
|
const { t } = useTranslation3(SPACE_PLUGIN);
|
|
796
778
|
const client = useClient2();
|
|
797
779
|
const spaces = useSpaces();
|
|
798
|
-
const dispatch =
|
|
799
|
-
const handleCreateObject =
|
|
800
|
-
const target2 = isSpace3(_target) ? _target.properties[CollectionType.typename] : _target;
|
|
801
|
-
const
|
|
802
|
-
if (!
|
|
780
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
781
|
+
const handleCreateObject = useCallback3(async ({ schema, target: _target, name: name2 }) => {
|
|
782
|
+
const target2 = isSpace3(_target) ? _target.properties[CollectionType.typename]?.target : _target;
|
|
783
|
+
const createObjectIntent = resolve?.(schema.typename)?.createObject;
|
|
784
|
+
if (!createObjectIntent || !target2) {
|
|
803
785
|
return;
|
|
804
786
|
}
|
|
805
787
|
closeRef.current?.click();
|
|
806
788
|
const space = isSpace3(target2) ? target2 : getSpace2(target2);
|
|
807
|
-
const result = await dispatch({
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
});
|
|
814
|
-
const object = result?.data;
|
|
789
|
+
const result = await dispatch(createObjectIntent({
|
|
790
|
+
name: name2,
|
|
791
|
+
space
|
|
792
|
+
}));
|
|
793
|
+
const object = result.data?.object;
|
|
815
794
|
if (isReactiveObject2(object)) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
{
|
|
827
|
-
action: NavigationAction2.OPEN
|
|
828
|
-
}
|
|
829
|
-
] : []
|
|
830
|
-
]);
|
|
795
|
+
const addObjectIntent = createIntent3(SpaceAction.AddObject, {
|
|
796
|
+
target: target2,
|
|
797
|
+
object
|
|
798
|
+
});
|
|
799
|
+
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
800
|
+
if (shouldNavigate(object)) {
|
|
801
|
+
await dispatch(pipe(addObjectIntent, chain(NavigationAction3.Open, {})));
|
|
802
|
+
} else {
|
|
803
|
+
await dispatch(addObjectIntent);
|
|
804
|
+
}
|
|
831
805
|
}
|
|
832
806
|
}, [
|
|
833
807
|
dispatch,
|
|
@@ -840,7 +814,7 @@ var CreateObjectDialog = ({ schemas, target, typename, name, navigableCollection
|
|
|
840
814
|
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
841
815
|
}, /* @__PURE__ */ React3.createElement("div", {
|
|
842
816
|
role: "none",
|
|
843
|
-
className: "flex justify-between pbs-
|
|
817
|
+
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
844
818
|
}, /* @__PURE__ */ React3.createElement(Dialog.Title, null, t("create object dialog title")), /* @__PURE__ */ React3.createElement(Dialog.Close, {
|
|
845
819
|
asChild: true
|
|
846
820
|
}, /* @__PURE__ */ React3.createElement(Button2, {
|
|
@@ -867,30 +841,25 @@ var CreateObjectDialog = ({ schemas, target, typename, name, navigableCollection
|
|
|
867
841
|
};
|
|
868
842
|
|
|
869
843
|
// packages/plugins/plugin-space/src/components/CreateDialog/CreateSpaceDialog.tsx
|
|
870
|
-
import React4, { useCallback as
|
|
871
|
-
import { useIntentDispatcher as
|
|
844
|
+
import React4, { useCallback as useCallback4, useRef as useRef2 } from "react";
|
|
845
|
+
import { createIntent as createIntent4, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
872
846
|
import { Button as Button3, Dialog as Dialog2, Icon as Icon3, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
873
847
|
import { Form as Form2 } from "@dxos/react-ui-form";
|
|
848
|
+
var CREATE_SPACE_DIALOG = `${SPACE_PLUGIN}/CreateSpaceDialog`;
|
|
874
849
|
var initialValues = {
|
|
875
850
|
edgeReplication: true
|
|
876
851
|
};
|
|
877
852
|
var CreateSpaceDialog = () => {
|
|
878
853
|
const closeRef = useRef2(null);
|
|
879
854
|
const { t } = useTranslation4(SPACE_PLUGIN);
|
|
880
|
-
const dispatch =
|
|
881
|
-
const handleCreateSpace =
|
|
882
|
-
const result = await dispatch(
|
|
883
|
-
|
|
884
|
-
data
|
|
885
|
-
});
|
|
886
|
-
const target = result?.data.space;
|
|
855
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
856
|
+
const handleCreateSpace = useCallback4(async (data) => {
|
|
857
|
+
const result = await dispatch(createIntent4(SpaceAction.Create, data));
|
|
858
|
+
const target = result.data?.space;
|
|
887
859
|
if (target) {
|
|
888
|
-
await dispatch({
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
target
|
|
892
|
-
}
|
|
893
|
-
});
|
|
860
|
+
await dispatch(createIntent4(SpaceAction.OpenCreateObject, {
|
|
861
|
+
target
|
|
862
|
+
}));
|
|
894
863
|
}
|
|
895
864
|
}, [
|
|
896
865
|
dispatch
|
|
@@ -902,7 +871,7 @@ var CreateSpaceDialog = () => {
|
|
|
902
871
|
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
903
872
|
}, /* @__PURE__ */ React4.createElement("div", {
|
|
904
873
|
role: "none",
|
|
905
|
-
className: "flex justify-between pbs-
|
|
874
|
+
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
906
875
|
}, /* @__PURE__ */ React4.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React4.createElement(Dialog2.Close, {
|
|
907
876
|
asChild: true
|
|
908
877
|
}, /* @__PURE__ */ React4.createElement(Button3, {
|
|
@@ -970,40 +939,35 @@ var DefaultObjectSettings = ({ object }) => {
|
|
|
970
939
|
};
|
|
971
940
|
|
|
972
941
|
// packages/plugins/plugin-space/src/components/JoinDialog.tsx
|
|
973
|
-
import React8, { useCallback as
|
|
974
|
-
import { LayoutAction, NavigationAction as
|
|
942
|
+
import React8, { useCallback as useCallback5 } from "react";
|
|
943
|
+
import { createIntent as createIntent5, LayoutAction, NavigationAction as NavigationAction4, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
|
|
975
944
|
import { useGraph } from "@dxos/plugin-graph";
|
|
976
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/
|
|
945
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
977
946
|
import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
|
|
978
947
|
import { Dialog as Dialog3, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
979
948
|
import { JoinPanel } from "@dxos/shell/react";
|
|
949
|
+
var JOIN_DIALOG = `${SPACE_PLUGIN}/JoinDialog`;
|
|
980
950
|
var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
|
|
981
951
|
const { t } = useTranslation8(SPACE_PLUGIN);
|
|
982
|
-
const dispatch =
|
|
952
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
983
953
|
const spaces = useSpaces2();
|
|
984
954
|
const { graph } = useGraph();
|
|
985
|
-
const handleDone =
|
|
955
|
+
const handleDone = useCallback5(async (result) => {
|
|
986
956
|
if (result?.spaceKey) {
|
|
987
957
|
await Promise.all([
|
|
988
|
-
dispatch({
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
title: t("join success label"),
|
|
996
|
-
closeLabel: t("dismiss label")
|
|
997
|
-
}
|
|
958
|
+
dispatch(createIntent5(LayoutAction.SetLayout, {
|
|
959
|
+
element: "toast",
|
|
960
|
+
subject: {
|
|
961
|
+
id: `${SPACE_PLUGIN}/join-success`,
|
|
962
|
+
duration: 5e3,
|
|
963
|
+
title: t("join success label"),
|
|
964
|
+
closeLabel: t("dismiss label")
|
|
998
965
|
}
|
|
999
|
-
}),
|
|
1000
|
-
dispatch({
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
state: false
|
|
1005
|
-
}
|
|
1006
|
-
})
|
|
966
|
+
})),
|
|
967
|
+
dispatch(createIntent5(LayoutAction.SetLayout, {
|
|
968
|
+
element: "dialog",
|
|
969
|
+
state: false
|
|
970
|
+
}))
|
|
1007
971
|
]);
|
|
1008
972
|
}
|
|
1009
973
|
const space = spaces.find(({ key }) => result?.spaceKey?.equals(key));
|
|
@@ -1014,35 +978,26 @@ var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
|
|
|
1014
978
|
}).catch(() => {
|
|
1015
979
|
});
|
|
1016
980
|
await Promise.all([
|
|
1017
|
-
dispatch({
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
target
|
|
1023
|
-
]
|
|
1024
|
-
}
|
|
981
|
+
dispatch(createIntent5(NavigationAction4.Open, {
|
|
982
|
+
activeParts: {
|
|
983
|
+
main: [
|
|
984
|
+
target
|
|
985
|
+
]
|
|
1025
986
|
}
|
|
1026
|
-
}),
|
|
1027
|
-
dispatch({
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
id: target
|
|
1031
|
-
}
|
|
1032
|
-
})
|
|
987
|
+
})),
|
|
988
|
+
dispatch(createIntent5(NavigationAction4.Expose, {
|
|
989
|
+
id: target
|
|
990
|
+
}))
|
|
1033
991
|
]);
|
|
1034
992
|
}
|
|
1035
993
|
await onDone?.(result);
|
|
1036
994
|
if (space) {
|
|
1037
|
-
await dispatch({
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
properties: {
|
|
1042
|
-
spaceId: space.id
|
|
1043
|
-
}
|
|
995
|
+
await dispatch(createIntent5(ObservabilityAction.SendEvent, {
|
|
996
|
+
name: "space.join",
|
|
997
|
+
properties: {
|
|
998
|
+
spaceId: space.id
|
|
1044
999
|
}
|
|
1045
|
-
});
|
|
1000
|
+
}));
|
|
1046
1001
|
}
|
|
1047
1002
|
}, [
|
|
1048
1003
|
dispatch,
|
|
@@ -1140,23 +1095,22 @@ var PersistenceStatus = ({ db }) => {
|
|
|
1140
1095
|
className: mx3(getSize2(4), "me-1")
|
|
1141
1096
|
}), displayMessage && /* @__PURE__ */ React10.createElement("span", {
|
|
1142
1097
|
className: mx3("text-sm", staticPlaceholderText)
|
|
1143
|
-
}, t("persisted locally label"))), /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, /* @__PURE__ */ React10.createElement(Tooltip.Content,
|
|
1144
|
-
classNames: "z-10"
|
|
1145
|
-
}, t("persisted locally message"), /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null))));
|
|
1098
|
+
}, 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))));
|
|
1146
1099
|
}
|
|
1147
1100
|
};
|
|
1148
1101
|
|
|
1149
1102
|
// packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
|
|
1150
|
-
import React11, { useCallback as
|
|
1103
|
+
import React11, { useCallback as useCallback6, useRef as useRef3, useState as useState4 } from "react";
|
|
1151
1104
|
import { log } from "@dxos/log";
|
|
1152
1105
|
import { Button as Button4, Input as Input3, Popover, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
1153
1106
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
1107
|
+
var POPOVER_RENAME_OBJECT = `${SPACE_PLUGIN}/PopoverRenameObject`;
|
|
1154
1108
|
var PopoverRenameObject = ({ object: obj }) => {
|
|
1155
1109
|
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
1156
1110
|
const doneButton = useRef3(null);
|
|
1157
1111
|
const object = obj;
|
|
1158
1112
|
const [name, setName] = useState4(object.name || object.title || "");
|
|
1159
|
-
const handleDone =
|
|
1113
|
+
const handleDone = useCallback6(() => {
|
|
1160
1114
|
try {
|
|
1161
1115
|
object.name = name;
|
|
1162
1116
|
} catch {
|
|
@@ -1167,7 +1121,7 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
1167
1121
|
err
|
|
1168
1122
|
}, {
|
|
1169
1123
|
F: __dxlog_file2,
|
|
1170
|
-
L:
|
|
1124
|
+
L: 30,
|
|
1171
1125
|
S: void 0,
|
|
1172
1126
|
C: (f, a) => f(...a)
|
|
1173
1127
|
});
|
|
@@ -1203,13 +1157,14 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
1203
1157
|
};
|
|
1204
1158
|
|
|
1205
1159
|
// packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
|
|
1206
|
-
import React12, { useCallback as
|
|
1160
|
+
import React12, { useCallback as useCallback7, useRef as useRef4, useState as useState5 } from "react";
|
|
1207
1161
|
import { Button as Button5, Input as Input4, Popover as Popover2, useTranslation as useTranslation12 } from "@dxos/react-ui";
|
|
1162
|
+
var POPOVER_RENAME_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
|
|
1208
1163
|
var PopoverRenameSpace = ({ space }) => {
|
|
1209
1164
|
const { t } = useTranslation12(SPACE_PLUGIN);
|
|
1210
1165
|
const doneButton = useRef4(null);
|
|
1211
1166
|
const [name, setName] = useState5(space.properties.name ?? "");
|
|
1212
|
-
const handleDone =
|
|
1167
|
+
const handleDone = useCallback7(() => {
|
|
1213
1168
|
space.properties.name = name;
|
|
1214
1169
|
}, [
|
|
1215
1170
|
space,
|
|
@@ -1243,17 +1198,14 @@ var PopoverRenameSpace = ({ space }) => {
|
|
|
1243
1198
|
|
|
1244
1199
|
// packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
|
|
1245
1200
|
import React13 from "react";
|
|
1246
|
-
import { useIntentDispatcher as
|
|
1201
|
+
import { createIntent as createIntent6, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
|
|
1247
1202
|
import { IconButton as IconButton2, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1248
1203
|
var ShareSpaceButton = ({ space }) => {
|
|
1249
|
-
const dispatch =
|
|
1204
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
1250
1205
|
return /* @__PURE__ */ React13.createElement(ShareSpaceButtonImpl, {
|
|
1251
|
-
onClick: () => dispatch({
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
space
|
|
1255
|
-
}
|
|
1256
|
-
})
|
|
1206
|
+
onClick: () => dispatch(createIntent6(SpaceAction.Share, {
|
|
1207
|
+
space
|
|
1208
|
+
}))
|
|
1257
1209
|
});
|
|
1258
1210
|
};
|
|
1259
1211
|
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
@@ -1267,15 +1219,54 @@ var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
|
1267
1219
|
};
|
|
1268
1220
|
|
|
1269
1221
|
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1270
|
-
import React14, { useCallback as
|
|
1222
|
+
import React14, { useCallback as useCallback8, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1271
1223
|
import { usePlugin } from "@dxos/app-framework";
|
|
1272
1224
|
import { generateName } from "@dxos/display-name";
|
|
1225
|
+
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
1273
1226
|
import { PublicKey, useClient as useClient4 } from "@dxos/react-client";
|
|
1274
1227
|
import { getSpace as getSpace4, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
|
|
1275
1228
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
1276
1229
|
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation14, List, ListItem, useDefaultValue } from "@dxos/react-ui";
|
|
1277
|
-
import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
|
|
1230
|
+
import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
|
|
1278
1231
|
import { ComplexMap, keyToFallback } from "@dxos/util";
|
|
1232
|
+
|
|
1233
|
+
// packages/plugins/plugin-space/src/hooks/usePath.ts
|
|
1234
|
+
import { useEffect as useEffect3, useState as useState6 } from "react";
|
|
1235
|
+
var usePath = (graph, id, timeout) => {
|
|
1236
|
+
const [pathState, setPathState] = useState6(id ? graph.getPath({
|
|
1237
|
+
target: id
|
|
1238
|
+
}) : void 0);
|
|
1239
|
+
useEffect3(() => {
|
|
1240
|
+
if (!id && pathState) {
|
|
1241
|
+
setPathState(void 0);
|
|
1242
|
+
}
|
|
1243
|
+
if (pathState?.at(-1) === id || !id) {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
const frame = requestAnimationFrame(async () => {
|
|
1247
|
+
try {
|
|
1248
|
+
const path = await graph.waitForPath({
|
|
1249
|
+
target: id
|
|
1250
|
+
}, {
|
|
1251
|
+
timeout
|
|
1252
|
+
});
|
|
1253
|
+
if (path) {
|
|
1254
|
+
setPathState(path);
|
|
1255
|
+
}
|
|
1256
|
+
} catch {
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
return () => cancelAnimationFrame(frame);
|
|
1260
|
+
}, [
|
|
1261
|
+
graph,
|
|
1262
|
+
id,
|
|
1263
|
+
timeout,
|
|
1264
|
+
pathState
|
|
1265
|
+
]);
|
|
1266
|
+
return pathState;
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1269
|
+
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1279
1270
|
var REFRESH_INTERVAL = 5e3;
|
|
1280
1271
|
var ACTIVITY_DURATION = 3e4;
|
|
1281
1272
|
var noViewers = new ComplexMap(PublicKey.hash);
|
|
@@ -1286,13 +1277,13 @@ var SpacePresence = ({ object, spaceKey }) => {
|
|
|
1286
1277
|
const identity = useIdentity();
|
|
1287
1278
|
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace4(object);
|
|
1288
1279
|
const spaceMembers = useMembers(space?.key);
|
|
1289
|
-
const [_moment, setMoment] =
|
|
1290
|
-
|
|
1280
|
+
const [_moment, setMoment] = useState7(Date.now());
|
|
1281
|
+
useEffect4(() => {
|
|
1291
1282
|
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1292
1283
|
return () => clearInterval(interval);
|
|
1293
1284
|
}, []);
|
|
1294
|
-
const memberOnline =
|
|
1295
|
-
const memberIsNotSelf =
|
|
1285
|
+
const memberOnline = useCallback8((member) => member.presence === 1, []);
|
|
1286
|
+
const memberIsNotSelf = useCallback8((member) => !identity?.identityKey.equals(member.identity.identityKey), [
|
|
1296
1287
|
identity?.identityKey
|
|
1297
1288
|
]);
|
|
1298
1289
|
if (!identity || !spacePlugin || !space) {
|
|
@@ -1379,13 +1370,20 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1379
1370
|
classNames: "text-sm truncate pli-2"
|
|
1380
1371
|
}, getName(identity)));
|
|
1381
1372
|
};
|
|
1382
|
-
var SmallPresenceLive = ({ id, viewers }) => {
|
|
1373
|
+
var SmallPresenceLive = ({ id, open, viewers }) => {
|
|
1374
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1375
|
+
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1376
|
+
const { graph } = useGraph2();
|
|
1377
|
+
const attended = useAttended();
|
|
1378
|
+
const startOfAttention = attended.at(-1);
|
|
1379
|
+
const path = usePath(graph, startOfAttention);
|
|
1380
|
+
const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
|
|
1383
1381
|
const getActiveViewers = (viewers2) => {
|
|
1384
1382
|
const moment = Date.now();
|
|
1385
|
-
return Array.from(viewers2.values()).filter((
|
|
1383
|
+
return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
|
|
1386
1384
|
};
|
|
1387
|
-
const [activeViewers, setActiveViewers] =
|
|
1388
|
-
|
|
1385
|
+
const [activeViewers, setActiveViewers] = useState7(viewers ? getActiveViewers(viewers) : []);
|
|
1386
|
+
useEffect4(() => {
|
|
1389
1387
|
if (viewers) {
|
|
1390
1388
|
setActiveViewers(getActiveViewers(viewers));
|
|
1391
1389
|
const interval = setInterval(() => {
|
|
@@ -1397,26 +1395,22 @@ var SmallPresenceLive = ({ id, viewers }) => {
|
|
|
1397
1395
|
viewers
|
|
1398
1396
|
]);
|
|
1399
1397
|
return /* @__PURE__ */ React14.createElement(SmallPresence, {
|
|
1400
|
-
|
|
1401
|
-
|
|
1398
|
+
count: activeViewers.length,
|
|
1399
|
+
attended: isAttended,
|
|
1400
|
+
containsAttended
|
|
1402
1401
|
});
|
|
1403
1402
|
};
|
|
1404
|
-
var SmallPresence = ({
|
|
1403
|
+
var SmallPresence = ({ count = 0, attended, containsAttended }) => {
|
|
1405
1404
|
const { t } = useTranslation14(SPACE_PLUGIN);
|
|
1406
|
-
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1407
|
-
const attention = hasAttention || isAncestor || isRelated;
|
|
1408
1405
|
return /* @__PURE__ */ React14.createElement(Tooltip2.Root, null, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, {
|
|
1409
1406
|
asChild: true
|
|
1410
|
-
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1411
|
-
role: "none",
|
|
1412
|
-
className: "flex",
|
|
1413
|
-
"data-attention": attention
|
|
1414
1407
|
}, /* @__PURE__ */ React14.createElement(AttentionGlyph, {
|
|
1408
|
+
attended,
|
|
1409
|
+
containsAttended,
|
|
1415
1410
|
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1416
1411
|
classNames: "self-center mie-1"
|
|
1417
|
-
}))
|
|
1418
|
-
side: "bottom"
|
|
1419
|
-
classNames: "z-[70]"
|
|
1412
|
+
})), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1413
|
+
side: "bottom"
|
|
1420
1414
|
}, /* @__PURE__ */ React14.createElement("span", null, t("presence label", {
|
|
1421
1415
|
count
|
|
1422
1416
|
})), /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null))));
|
|
@@ -1424,52 +1418,49 @@ var SmallPresence = ({ id, count }) => {
|
|
|
1424
1418
|
|
|
1425
1419
|
// packages/plugins/plugin-space/src/components/SpacePluginSettings.tsx
|
|
1426
1420
|
import React15 from "react";
|
|
1427
|
-
import { useIntentDispatcher as
|
|
1421
|
+
import { createIntent as createIntent7, useIntentDispatcher as useIntentDispatcher6 } from "@dxos/app-framework";
|
|
1428
1422
|
import { Input as Input5, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1429
1423
|
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1430
1424
|
var SpacePluginSettings = ({ settings }) => {
|
|
1431
1425
|
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1432
|
-
const dispatch =
|
|
1426
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
1433
1427
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
1434
1428
|
label: t("show hidden spaces label")
|
|
1435
1429
|
}, /* @__PURE__ */ React15.createElement(Input5.Switch, {
|
|
1436
1430
|
checked: settings.showHidden,
|
|
1437
|
-
onCheckedChange: (checked) => dispatch({
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
data: {
|
|
1441
|
-
state: !!checked
|
|
1442
|
-
}
|
|
1443
|
-
})
|
|
1431
|
+
onCheckedChange: (checked) => dispatch(createIntent7(SpaceAction.ToggleHidden, {
|
|
1432
|
+
state: !!checked
|
|
1433
|
+
}))
|
|
1444
1434
|
})));
|
|
1445
1435
|
};
|
|
1446
1436
|
|
|
1447
1437
|
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1448
|
-
import React17, { useState as
|
|
1438
|
+
import React17, { useState as useState9 } from "react";
|
|
1449
1439
|
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1450
1440
|
import { Button as Button6, Clipboard, Dialog as Dialog4, Icon as Icon4, toLocalizedString as toLocalizedString3, useTranslation as useTranslation17 } from "@dxos/react-ui";
|
|
1451
1441
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
1452
1442
|
import { SpacePanel } from "@dxos/shell/react";
|
|
1453
1443
|
|
|
1454
1444
|
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx
|
|
1455
|
-
import React16, { useCallback as
|
|
1445
|
+
import React16, { useCallback as useCallback9, useState as useState8 } from "react";
|
|
1456
1446
|
import { log as log2 } from "@dxos/log";
|
|
1457
1447
|
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1458
1448
|
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1459
1449
|
import { Input as Input6, useTranslation as useTranslation16 } from "@dxos/react-ui";
|
|
1460
1450
|
import { DeprecatedFormInput as DeprecatedFormInput2 } from "@dxos/react-ui-form";
|
|
1451
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1461
1452
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx";
|
|
1462
|
-
var SpaceSettingsPanel = ({ space }) => {
|
|
1453
|
+
var SpaceSettingsPanel = ({ classNames, space }) => {
|
|
1463
1454
|
const { t } = useTranslation16(SPACE_PLUGIN);
|
|
1464
1455
|
const client = useClient5();
|
|
1465
1456
|
const edgeEnabled = Boolean(client.config.values.runtime?.client?.edgeFeatures?.echoReplicator);
|
|
1466
|
-
const [edgeReplication, setEdgeReplication] =
|
|
1467
|
-
const toggleEdgeReplication =
|
|
1457
|
+
const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
|
|
1458
|
+
const toggleEdgeReplication = useCallback9(async (next) => {
|
|
1468
1459
|
setEdgeReplication(next);
|
|
1469
1460
|
await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1470
1461
|
log2.catch(err, void 0, {
|
|
1471
1462
|
F: __dxlog_file3,
|
|
1472
|
-
L:
|
|
1463
|
+
L: 36,
|
|
1473
1464
|
S: void 0,
|
|
1474
1465
|
C: (f, a) => f(...a)
|
|
1475
1466
|
});
|
|
@@ -1480,7 +1471,7 @@ var SpaceSettingsPanel = ({ space }) => {
|
|
|
1480
1471
|
]);
|
|
1481
1472
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1482
1473
|
role: "form",
|
|
1483
|
-
className: "flex flex-col"
|
|
1474
|
+
className: mx4("flex flex-col", classNames)
|
|
1484
1475
|
}, /* @__PURE__ */ React16.createElement(DeprecatedFormInput2, {
|
|
1485
1476
|
label: t("name label")
|
|
1486
1477
|
}, /* @__PURE__ */ React16.createElement(Input6.TextInput, {
|
|
@@ -1498,11 +1489,12 @@ var SpaceSettingsPanel = ({ space }) => {
|
|
|
1498
1489
|
};
|
|
1499
1490
|
|
|
1500
1491
|
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1492
|
+
var SPACE_SETTINGS_DIALOG = `${SPACE_PLUGIN}/SpaceSettingsDialog`;
|
|
1501
1493
|
var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "members", namesCache }) => {
|
|
1502
1494
|
const { t } = useTranslation17(SPACE_PLUGIN);
|
|
1503
1495
|
const client = useClient6();
|
|
1504
|
-
const [tabsActivePart, setTabsActivePart] =
|
|
1505
|
-
const [selected, setSelected] =
|
|
1496
|
+
const [tabsActivePart, setTabsActivePart] = useState9("list");
|
|
1497
|
+
const [selected, setSelected] = useState9(initialTab);
|
|
1506
1498
|
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
1507
1499
|
const name = getSpaceDisplayName(space, {
|
|
1508
1500
|
personal: client.spaces.default === space,
|
|
@@ -1515,7 +1507,7 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
|
|
|
1515
1507
|
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
1516
1508
|
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1517
1509
|
role: "none",
|
|
1518
|
-
className: "flex justify-between pbs-
|
|
1510
|
+
className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
|
|
1519
1511
|
}, /* @__PURE__ */ React17.createElement(Dialog4.Title, {
|
|
1520
1512
|
onClick: () => setTabsActivePart("list"),
|
|
1521
1513
|
"aria-description": t("click to return to tablist description"),
|
|
@@ -1578,14 +1570,16 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
|
|
|
1578
1570
|
};
|
|
1579
1571
|
|
|
1580
1572
|
// packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
|
|
1581
|
-
import React18, { useEffect as
|
|
1573
|
+
import React18, { useEffect as useEffect6, useState as useState11 } from "react";
|
|
1574
|
+
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
1582
1575
|
import { QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
1583
1576
|
import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1584
1577
|
import { useClient as useClient8 } from "@dxos/react-client";
|
|
1585
|
-
import {
|
|
1578
|
+
import { Tooltip as Tooltip3, useTranslation as useTranslation18 } from "@dxos/react-ui";
|
|
1579
|
+
import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
1586
1580
|
|
|
1587
1581
|
// packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts
|
|
1588
|
-
import { useEffect as
|
|
1582
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
1589
1583
|
import { Context } from "@dxos/context";
|
|
1590
1584
|
import { EdgeService } from "@dxos/protocols";
|
|
1591
1585
|
import { useClient as useClient7 } from "@dxos/react-client";
|
|
@@ -1610,8 +1604,8 @@ var getSyncSummary = (syncMap) => {
|
|
|
1610
1604
|
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1611
1605
|
var useSyncState = () => {
|
|
1612
1606
|
const client = useClient7();
|
|
1613
|
-
const [spaceState, setSpaceState] =
|
|
1614
|
-
|
|
1607
|
+
const [spaceState, setSpaceState] = useState10({});
|
|
1608
|
+
useEffect5(() => {
|
|
1615
1609
|
const ctx = new Context(void 0, {
|
|
1616
1610
|
F: __dxlog_file4,
|
|
1617
1611
|
L: 48
|
|
@@ -1645,8 +1639,8 @@ var useSyncState = () => {
|
|
|
1645
1639
|
return spaceState;
|
|
1646
1640
|
};
|
|
1647
1641
|
var useSpaceSyncState = (space) => {
|
|
1648
|
-
const [spaceState, setSpaceState] =
|
|
1649
|
-
|
|
1642
|
+
const [spaceState, setSpaceState] = useState10();
|
|
1643
|
+
useEffect5(() => {
|
|
1650
1644
|
const ctx = new Context(void 0, {
|
|
1651
1645
|
F: __dxlog_file4,
|
|
1652
1646
|
L: 87
|
|
@@ -1668,9 +1662,9 @@ var useSpaceSyncState = (space) => {
|
|
|
1668
1662
|
|
|
1669
1663
|
// packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
|
|
1670
1664
|
var useEdgeStatus = () => {
|
|
1671
|
-
const [status, setStatus] =
|
|
1665
|
+
const [status, setStatus] = useState11(QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED);
|
|
1672
1666
|
const client = useClient8();
|
|
1673
|
-
|
|
1667
|
+
useEffect6(() => {
|
|
1674
1668
|
client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
|
|
1675
1669
|
setStatus(status2);
|
|
1676
1670
|
});
|
|
@@ -1679,47 +1673,47 @@ var useEdgeStatus = () => {
|
|
|
1679
1673
|
]);
|
|
1680
1674
|
return status;
|
|
1681
1675
|
};
|
|
1682
|
-
var InlineSyncStatus = ({ space }) => {
|
|
1676
|
+
var InlineSyncStatus = ({ space, open }) => {
|
|
1677
|
+
const { t } = useTranslation18(SPACE_PLUGIN);
|
|
1678
|
+
const id = space.id;
|
|
1679
|
+
const { hasAttention, isAncestor, isRelated } = useAttention2(id);
|
|
1680
|
+
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1681
|
+
const { graph } = useGraph3();
|
|
1682
|
+
const attended = useAttended2();
|
|
1683
|
+
const startOfAttention = attended.at(-1);
|
|
1684
|
+
const path = usePath(graph, startOfAttention);
|
|
1685
|
+
const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
|
|
1683
1686
|
const connectedToEdge = useEdgeStatus() === QueryEdgeStatusResponse.EdgeStatus.CONNECTED;
|
|
1684
1687
|
const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
|
|
1685
1688
|
const syncState = useSpaceSyncState(space);
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
role: "status",
|
|
1699
|
-
"aria-label": t("syncing message"),
|
|
1700
|
-
className: "flex items-center"
|
|
1701
|
-
}, /* @__PURE__ */ React18.createElement(Icon5, {
|
|
1702
|
-
icon: "ph--circle-notch--regular",
|
|
1703
|
-
size: 3,
|
|
1704
|
-
style: animationProps,
|
|
1705
|
-
classNames: "text-subdued animate-[spin_2s_linear_infinite]"
|
|
1706
|
-
}));
|
|
1689
|
+
const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
|
|
1690
|
+
return /* @__PURE__ */ React18.createElement(Tooltip3.Root, null, /* @__PURE__ */ React18.createElement(Tooltip3.Trigger, {
|
|
1691
|
+
asChild: true
|
|
1692
|
+
}, /* @__PURE__ */ React18.createElement(AttentionGlyph2, {
|
|
1693
|
+
syncing,
|
|
1694
|
+
attended: isAttended,
|
|
1695
|
+
containsAttended,
|
|
1696
|
+
classNames: "self-center mie-1"
|
|
1697
|
+
})), /* @__PURE__ */ React18.createElement(Tooltip3.Portal, null, /* @__PURE__ */ React18.createElement(Tooltip3.Content, {
|
|
1698
|
+
side: "bottom",
|
|
1699
|
+
classNames: "z-[70]"
|
|
1700
|
+
}, /* @__PURE__ */ React18.createElement("span", null, t("syncing label")), /* @__PURE__ */ React18.createElement(Tooltip3.Arrow, null))));
|
|
1707
1701
|
};
|
|
1708
1702
|
|
|
1709
1703
|
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1710
|
-
import React20, { useCallback as
|
|
1704
|
+
import React20, { useCallback as useCallback10, useEffect as useEffect8, useState as useState13 } from "react";
|
|
1711
1705
|
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1712
1706
|
import { useClient as useClient10 } from "@dxos/react-client";
|
|
1713
|
-
import { Icon as
|
|
1707
|
+
import { Icon as Icon6, Input as Input7, Popover as Popover3, useTranslation as useTranslation20 } from "@dxos/react-ui";
|
|
1714
1708
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
1715
|
-
import { mx as
|
|
1709
|
+
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
1716
1710
|
|
|
1717
1711
|
// packages/plugins/plugin-space/src/components/SyncStatus/Space.tsx
|
|
1718
|
-
import React19, { useEffect as
|
|
1712
|
+
import React19, { useEffect as useEffect7, useState as useState12 } from "react";
|
|
1719
1713
|
import { useClient as useClient9 } from "@dxos/react-client";
|
|
1720
1714
|
import { useSpace } from "@dxos/react-client/echo";
|
|
1721
|
-
import { Icon as
|
|
1722
|
-
import { mx as
|
|
1715
|
+
import { Icon as Icon5, toLocalizedString as toLocalizedString4, useTranslation as useTranslation19 } from "@dxos/react-ui";
|
|
1716
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
1723
1717
|
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1724
1718
|
var styles = {
|
|
1725
1719
|
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
@@ -1727,9 +1721,9 @@ var styles = {
|
|
|
1727
1721
|
barHover: "dark:hover:bg-green-500"
|
|
1728
1722
|
};
|
|
1729
1723
|
var useActive = (count) => {
|
|
1730
|
-
const [current, setCurrent] =
|
|
1731
|
-
const [active, setActive] =
|
|
1732
|
-
|
|
1724
|
+
const [current, setCurrent] = useState12(count);
|
|
1725
|
+
const [active, setActive] = useState12(false);
|
|
1726
|
+
useEffect7(() => {
|
|
1733
1727
|
let t;
|
|
1734
1728
|
if (count !== current) {
|
|
1735
1729
|
setActive(true);
|
|
@@ -1776,10 +1770,10 @@ var SpaceRow = ({ spaceId, spaceName, state: { localDocumentCount, remoteDocumen
|
|
|
1776
1770
|
}
|
|
1777
1771
|
}, /* @__PURE__ */ React19.createElement("span", {
|
|
1778
1772
|
className: "is-1/2 truncate"
|
|
1779
|
-
}, spaceName), /* @__PURE__ */ React19.createElement(
|
|
1773
|
+
}, spaceName), /* @__PURE__ */ React19.createElement(Icon5, {
|
|
1780
1774
|
icon: "ph--arrow-fat-line-left--regular",
|
|
1781
1775
|
size: 3,
|
|
1782
|
-
classNames:
|
|
1776
|
+
classNames: mx5(downActive && "animate-[pulse_1s_infinite]")
|
|
1783
1777
|
}), /* @__PURE__ */ React19.createElement(Candle, {
|
|
1784
1778
|
up: {
|
|
1785
1779
|
count: remoteDocumentCount,
|
|
@@ -1790,22 +1784,22 @@ var SpaceRow = ({ spaceId, spaceName, state: { localDocumentCount, remoteDocumen
|
|
|
1790
1784
|
total: localDocumentCount + missingOnLocal
|
|
1791
1785
|
},
|
|
1792
1786
|
title: spaceId
|
|
1793
|
-
}), /* @__PURE__ */ React19.createElement(
|
|
1787
|
+
}), /* @__PURE__ */ React19.createElement(Icon5, {
|
|
1794
1788
|
icon: "ph--arrow-fat-line-right--regular",
|
|
1795
1789
|
size: 3,
|
|
1796
|
-
classNames:
|
|
1790
|
+
classNames: mx5(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1797
1791
|
}));
|
|
1798
1792
|
};
|
|
1799
1793
|
var Candle = ({ classNames, up, down }) => {
|
|
1800
1794
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
1801
|
-
className:
|
|
1795
|
+
className: mx5("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1802
1796
|
}, /* @__PURE__ */ React19.createElement(Bar, {
|
|
1803
1797
|
classNames: "justify-end",
|
|
1804
1798
|
...up
|
|
1805
1799
|
}), /* @__PURE__ */ React19.createElement("div", {
|
|
1806
1800
|
className: "relative"
|
|
1807
1801
|
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1808
|
-
className:
|
|
1802
|
+
className: mx5("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1809
1803
|
}, up.total)), /* @__PURE__ */ React19.createElement(Bar, down));
|
|
1810
1804
|
};
|
|
1811
1805
|
var Bar = ({ classNames, count, total }) => {
|
|
@@ -1814,9 +1808,9 @@ var Bar = ({ classNames, count, total }) => {
|
|
|
1814
1808
|
p = Math.min(p, 95);
|
|
1815
1809
|
}
|
|
1816
1810
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
1817
|
-
className:
|
|
1811
|
+
className: mx5("relative flex w-full", styles.barBg, classNames)
|
|
1818
1812
|
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1819
|
-
className:
|
|
1813
|
+
className: mx5("shrink-0", styles.barFg),
|
|
1820
1814
|
style: {
|
|
1821
1815
|
width: `${p}%`
|
|
1822
1816
|
}
|
|
@@ -1920,8 +1914,8 @@ var getIcon = (status) => {
|
|
|
1920
1914
|
var SyncStatus = () => {
|
|
1921
1915
|
const client = useClient10();
|
|
1922
1916
|
const state = useSyncState();
|
|
1923
|
-
const [saved, setSaved] =
|
|
1924
|
-
|
|
1917
|
+
const [saved, setSaved] = useState13(true);
|
|
1918
|
+
useEffect8(() => {
|
|
1925
1919
|
return createClientSaveTracker(client, (state2) => {
|
|
1926
1920
|
setSaved(state2 === "saved");
|
|
1927
1921
|
});
|
|
@@ -1943,8 +1937,8 @@ var SyncStatusIndicator = ({ state, saved }) => {
|
|
|
1943
1937
|
needsToUpload,
|
|
1944
1938
|
needsToDownload
|
|
1945
1939
|
});
|
|
1946
|
-
const [classNames, setClassNames] =
|
|
1947
|
-
|
|
1940
|
+
const [classNames, setClassNames] = useState13();
|
|
1941
|
+
useEffect8(() => {
|
|
1948
1942
|
setClassNames(void 0);
|
|
1949
1943
|
if (offline || !needsToUpload && !needsToDownload) {
|
|
1950
1944
|
return;
|
|
@@ -1959,7 +1953,7 @@ var SyncStatusIndicator = ({ state, saved }) => {
|
|
|
1959
1953
|
needsToDownload
|
|
1960
1954
|
]);
|
|
1961
1955
|
const title = t(`${status} label`);
|
|
1962
|
-
const icon = /* @__PURE__ */ React20.createElement(
|
|
1956
|
+
const icon = /* @__PURE__ */ React20.createElement(Icon6, {
|
|
1963
1957
|
icon: getIcon(status),
|
|
1964
1958
|
size: 4,
|
|
1965
1959
|
classNames
|
|
@@ -1983,14 +1977,14 @@ var SyncStatusIndicator = ({ state, saved }) => {
|
|
|
1983
1977
|
}
|
|
1984
1978
|
};
|
|
1985
1979
|
var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
1986
|
-
const [showAll, setShowAll] =
|
|
1980
|
+
const [showAll, setShowAll] = useState13(false);
|
|
1987
1981
|
const { t } = useTranslation20(SPACE_PLUGIN);
|
|
1988
1982
|
const entries = Object.entries(state).filter(([_, value]) => showAll || value.missingOnLocal + value.missingOnRemote > 0).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1989
|
-
const handleCheckedChange =
|
|
1983
|
+
const handleCheckedChange = useCallback10((state2) => setShowAll(state2), [
|
|
1990
1984
|
setShowAll
|
|
1991
1985
|
]);
|
|
1992
1986
|
return /* @__PURE__ */ React20.createElement("div", {
|
|
1993
|
-
className:
|
|
1987
|
+
className: mx6("flex flex-col gap-3 p-2 text-xs min-w-96", classNames)
|
|
1994
1988
|
}, /* @__PURE__ */ React20.createElement("div", {
|
|
1995
1989
|
role: "none",
|
|
1996
1990
|
className: "flex items-center"
|
|
@@ -2118,7 +2112,7 @@ var translations_default = [
|
|
|
2118
2112
|
"open space settings label": "Space Settings",
|
|
2119
2113
|
"members tab label": "Members",
|
|
2120
2114
|
"settings tab label": "Settings",
|
|
2121
|
-
"syncing
|
|
2115
|
+
"syncing label": "Space syncing",
|
|
2122
2116
|
"show all label": "Show all",
|
|
2123
2117
|
"no sync status label": "No space with missing objects.",
|
|
2124
2118
|
"create space dialog title": "Create Space",
|
|
@@ -2126,9 +2120,10 @@ var translations_default = [
|
|
|
2126
2120
|
"space input placeholder": "Select space",
|
|
2127
2121
|
"schema input placeholder": "Select object type",
|
|
2128
2122
|
"creating object type label": "Type",
|
|
2129
|
-
"creating in space label": "
|
|
2123
|
+
"creating in space label": "Location",
|
|
2130
2124
|
"creating in collection label": "In Collection",
|
|
2131
|
-
"clear input label": "Clear"
|
|
2125
|
+
"clear input label": "Clear",
|
|
2126
|
+
"expose object label": "Expose in navtree"
|
|
2132
2127
|
}
|
|
2133
2128
|
}
|
|
2134
2129
|
}
|
|
@@ -2163,7 +2158,6 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2163
2158
|
let layoutPlugin;
|
|
2164
2159
|
let navigationPlugin;
|
|
2165
2160
|
let attentionPlugin;
|
|
2166
|
-
let metadataPlugin;
|
|
2167
2161
|
const createSpaceInvitationUrl = (invitationCode) => {
|
|
2168
2162
|
const baseUrl = new URL(invitationUrl);
|
|
2169
2163
|
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
@@ -2204,13 +2198,9 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2204
2198
|
const timeout = setTimeout(async () => {
|
|
2205
2199
|
const node2 = graph.findNode(soloPart.id);
|
|
2206
2200
|
if (!node2) {
|
|
2207
|
-
await dispatch({
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
data: {
|
|
2211
|
-
id: soloPart.id
|
|
2212
|
-
}
|
|
2213
|
-
});
|
|
2201
|
+
await dispatch(createIntent8(SpaceAction.WaitForObject, {
|
|
2202
|
+
id: soloPart.id
|
|
2203
|
+
}));
|
|
2214
2204
|
}
|
|
2215
2205
|
}, WAIT_FOR_OBJECT_TIMEOUT2);
|
|
2216
2206
|
return () => clearTimeout(timeout);
|
|
@@ -2279,7 +2269,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2279
2269
|
err: err.message
|
|
2280
2270
|
}, {
|
|
2281
2271
|
F: __dxlog_file6,
|
|
2282
|
-
L:
|
|
2272
|
+
L: 324,
|
|
2283
2273
|
S: void 0,
|
|
2284
2274
|
C: (f, a) => f(...a)
|
|
2285
2275
|
});
|
|
@@ -2332,7 +2322,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2332
2322
|
} catch (err) {
|
|
2333
2323
|
log3.catch(err, void 0, {
|
|
2334
2324
|
F: __dxlog_file6,
|
|
2335
|
-
L:
|
|
2325
|
+
L: 393,
|
|
2336
2326
|
S: void 0,
|
|
2337
2327
|
C: (f, a) => f(...a)
|
|
2338
2328
|
});
|
|
@@ -2340,7 +2330,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2340
2330
|
};
|
|
2341
2331
|
return {
|
|
2342
2332
|
meta: meta_default,
|
|
2343
|
-
ready: async (plugins) => {
|
|
2333
|
+
ready: async ({ plugins }) => {
|
|
2344
2334
|
settings.prop({
|
|
2345
2335
|
key: "showHidden",
|
|
2346
2336
|
type: LocalStorageStore.bool({
|
|
@@ -2359,16 +2349,15 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2359
2349
|
}
|
|
2360
2350
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
2361
2351
|
layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
|
|
2362
|
-
metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
|
|
2363
2352
|
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
|
|
2364
2353
|
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
2365
2354
|
clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
2366
|
-
intentPlugin = resolvePlugin(plugins,
|
|
2355
|
+
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
2367
2356
|
if (!clientPlugin || !intentPlugin) {
|
|
2368
2357
|
return;
|
|
2369
2358
|
}
|
|
2370
2359
|
const client = clientPlugin.provides.client;
|
|
2371
|
-
const dispatch = intentPlugin.provides.intent.
|
|
2360
|
+
const dispatch = intentPlugin.provides.intent.dispatchPromise;
|
|
2372
2361
|
schemas.push(...filterPlugins(plugins, parseSchemaPlugin).map((plugin) => plugin.provides.echo.schema).filter(nonNullable2).reduce((acc, schema) => {
|
|
2373
2362
|
return [
|
|
2374
2363
|
...acc,
|
|
@@ -2383,10 +2372,10 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2383
2372
|
});
|
|
2384
2373
|
const handleFirstRun = async () => {
|
|
2385
2374
|
const defaultSpace = client.spaces.default;
|
|
2386
|
-
defaultSpace.properties[CollectionType.typename] = create(CollectionType, {
|
|
2375
|
+
defaultSpace.properties[CollectionType.typename] = makeRef2(create(CollectionType, {
|
|
2387
2376
|
objects: [],
|
|
2388
2377
|
views: {}
|
|
2389
|
-
});
|
|
2378
|
+
}));
|
|
2390
2379
|
if (Migrations2.versionProperty) {
|
|
2391
2380
|
defaultSpace.properties[Migrations2.versionProperty] = Migrations2.targetVersion;
|
|
2392
2381
|
}
|
|
@@ -2442,7 +2431,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2442
2431
|
metadata: {
|
|
2443
2432
|
records: {
|
|
2444
2433
|
[CollectionType.typename]: {
|
|
2445
|
-
createObject: CollectionAction.
|
|
2434
|
+
createObject: (props) => createIntent8(CollectionAction.Create, props),
|
|
2446
2435
|
placeholder: [
|
|
2447
2436
|
"unnamed collection label",
|
|
2448
2437
|
{
|
|
@@ -2451,9 +2440,9 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2451
2440
|
],
|
|
2452
2441
|
icon: "ph--cards-three--regular",
|
|
2453
2442
|
// TODO(wittjosiah): Move out of metadata.
|
|
2454
|
-
loadReferences: (collection) =>
|
|
2455
|
-
...
|
|
2456
|
-
...Object.values(
|
|
2443
|
+
loadReferences: async (collection) => await RefArray.loadAll([
|
|
2444
|
+
...collection.objects,
|
|
2445
|
+
...Object.values(collection.views)
|
|
2457
2446
|
])
|
|
2458
2447
|
}
|
|
2459
2448
|
}
|
|
@@ -2464,125 +2453,203 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2464
2453
|
]
|
|
2465
2454
|
},
|
|
2466
2455
|
surface: {
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2456
|
+
definitions: ({ plugins }) => {
|
|
2457
|
+
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
2458
|
+
const attention = resolvePlugin(plugins, parseAttentionPlugin)?.provides.attention;
|
|
2459
|
+
invariant2(resolve, "Metadata plugin not found.", {
|
|
2460
|
+
F: __dxlog_file6,
|
|
2461
|
+
L: 503,
|
|
2462
|
+
S: void 0,
|
|
2463
|
+
A: [
|
|
2464
|
+
"resolve",
|
|
2465
|
+
"'Metadata plugin not found.'"
|
|
2466
|
+
]
|
|
2467
|
+
});
|
|
2468
|
+
invariant2(attention, "Attention plugin not found.", {
|
|
2469
|
+
F: __dxlog_file6,
|
|
2470
|
+
L: 504,
|
|
2471
|
+
S: void 0,
|
|
2472
|
+
A: [
|
|
2473
|
+
"attention",
|
|
2474
|
+
"'Attention plugin not found.'"
|
|
2475
|
+
]
|
|
2476
|
+
});
|
|
2477
|
+
return [
|
|
2478
|
+
createSurface({
|
|
2479
|
+
id: `${SPACE_PLUGIN}/article`,
|
|
2480
|
+
role: "article",
|
|
2481
|
+
filter: (data) => (
|
|
2482
|
+
// TODO(wittjosiah): Need to avoid shotgun parsing space state everywhere.
|
|
2483
|
+
isSpace4(data.subject) && data.subject.state.get() === SpaceState2.SPACE_READY
|
|
2484
|
+
),
|
|
2485
|
+
component: ({ data, role, ...rest }) => /* @__PURE__ */ React21.createElement(Surface, {
|
|
2471
2486
|
data: {
|
|
2472
|
-
|
|
2473
|
-
|
|
2487
|
+
id: data.subject.id,
|
|
2488
|
+
subject: data.subject.properties[CollectionType.typename]?.target
|
|
2474
2489
|
},
|
|
2475
2490
|
role,
|
|
2476
2491
|
...rest
|
|
2477
|
-
})
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2492
|
+
})
|
|
2493
|
+
}),
|
|
2494
|
+
createSurface({
|
|
2495
|
+
id: `${SPACE_PLUGIN}/collection-fallback`,
|
|
2496
|
+
role: "article",
|
|
2497
|
+
disposition: "fallback",
|
|
2498
|
+
filter: (data) => data.subject instanceof CollectionType,
|
|
2499
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(CollectionMain, {
|
|
2500
|
+
collection: data.subject
|
|
2501
|
+
})
|
|
2502
|
+
}),
|
|
2503
|
+
createSurface({
|
|
2504
|
+
id: `${SPACE_PLUGIN}/settings-panel`,
|
|
2505
|
+
// TODO(burdon): Add role name syntax to minimal plugin docs.
|
|
2506
|
+
role: "complementary--settings",
|
|
2507
|
+
filter: (data) => isSpace4(data.subject),
|
|
2508
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(SpaceSettingsPanel, {
|
|
2486
2509
|
space: data.subject
|
|
2487
|
-
})
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2510
|
+
})
|
|
2511
|
+
}),
|
|
2512
|
+
createSurface({
|
|
2513
|
+
id: `${SPACE_PLUGIN}/object-settings-panel-fallback`,
|
|
2514
|
+
role: "complementary--settings",
|
|
2515
|
+
disposition: "fallback",
|
|
2516
|
+
filter: (data) => isEchoObject2(data.subject),
|
|
2517
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(DefaultObjectSettings, {
|
|
2518
|
+
object: data.subject
|
|
2519
|
+
})
|
|
2520
|
+
}),
|
|
2521
|
+
createSurface({
|
|
2522
|
+
id: SPACE_SETTINGS_DIALOG,
|
|
2523
|
+
role: "dialog",
|
|
2524
|
+
filter: (data) => data.component === SPACE_SETTINGS_DIALOG,
|
|
2525
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(SpaceSettingsDialog, {
|
|
2526
|
+
...data.subject,
|
|
2527
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
2528
|
+
})
|
|
2529
|
+
}),
|
|
2530
|
+
createSurface({
|
|
2531
|
+
id: JOIN_DIALOG,
|
|
2532
|
+
role: "dialog",
|
|
2533
|
+
filter: (data) => data.component === JOIN_DIALOG,
|
|
2534
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(JoinDialog, data.subject)
|
|
2535
|
+
}),
|
|
2536
|
+
createSurface({
|
|
2537
|
+
id: CREATE_SPACE_DIALOG,
|
|
2538
|
+
role: "dialog",
|
|
2539
|
+
filter: (data) => data.component === CREATE_SPACE_DIALOG,
|
|
2540
|
+
component: () => /* @__PURE__ */ React21.createElement(CreateSpaceDialog, null)
|
|
2541
|
+
}),
|
|
2542
|
+
createSurface({
|
|
2543
|
+
id: CREATE_OBJECT_DIALOG,
|
|
2544
|
+
role: "dialog",
|
|
2545
|
+
filter: (data) => data.component === CREATE_OBJECT_DIALOG,
|
|
2546
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(CreateObjectDialog, {
|
|
2547
|
+
schemas,
|
|
2548
|
+
resolve,
|
|
2549
|
+
...data.subject
|
|
2550
|
+
})
|
|
2551
|
+
}),
|
|
2552
|
+
createSurface({
|
|
2553
|
+
id: POPOVER_RENAME_SPACE,
|
|
2554
|
+
role: "popover",
|
|
2555
|
+
filter: (data) => data.component === POPOVER_RENAME_SPACE && isSpace4(data.subject),
|
|
2556
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(PopoverRenameSpace, {
|
|
2557
|
+
space: data.subject
|
|
2558
|
+
})
|
|
2559
|
+
}),
|
|
2560
|
+
createSurface({
|
|
2561
|
+
id: POPOVER_RENAME_OBJECT,
|
|
2562
|
+
role: "popover",
|
|
2563
|
+
filter: (data) => data.component === POPOVER_RENAME_OBJECT && isReactiveObject3(data.subject),
|
|
2564
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(PopoverRenameObject, {
|
|
2565
|
+
object: data.subject
|
|
2566
|
+
})
|
|
2567
|
+
}),
|
|
2568
|
+
createSurface({
|
|
2569
|
+
id: `${SPACE_PLUGIN}/navtree-presence`,
|
|
2570
|
+
role: "navtree-item-end",
|
|
2571
|
+
filter: (data) => typeof data.id === "string" && isEchoObject2(data.subject),
|
|
2572
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(SmallPresenceLive, {
|
|
2527
2573
|
id: data.id,
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
)
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2574
|
+
open: data.open,
|
|
2575
|
+
viewers: state.values.viewersByObject[data.id]
|
|
2576
|
+
})
|
|
2577
|
+
}),
|
|
2578
|
+
createSurface({
|
|
2579
|
+
// TODO(wittjosiah): Attention glyph for non-echo items should be handled elsewhere.
|
|
2580
|
+
id: `${SPACE_PLUGIN}/navtree-presence-fallback`,
|
|
2581
|
+
role: "navtree-item-end",
|
|
2582
|
+
disposition: "fallback",
|
|
2583
|
+
filter: (data) => typeof data.id === "string",
|
|
2584
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(SmallPresenceLive, {
|
|
2585
|
+
id: data.id,
|
|
2586
|
+
open: data.open
|
|
2587
|
+
})
|
|
2588
|
+
}),
|
|
2589
|
+
createSurface({
|
|
2590
|
+
id: `${SPACE_PLUGIN}/navtree-sync-status`,
|
|
2591
|
+
role: "navtree-item-end",
|
|
2592
|
+
filter: (data) => isSpace4(data.subject),
|
|
2593
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(InlineSyncStatus, {
|
|
2594
|
+
space: data.subject,
|
|
2595
|
+
open: data.open
|
|
2596
|
+
})
|
|
2597
|
+
}),
|
|
2598
|
+
createSurface({
|
|
2599
|
+
id: `${SPACE_PLUGIN}/navbar-presence`,
|
|
2600
|
+
role: "navbar-end",
|
|
2601
|
+
disposition: "hoist",
|
|
2602
|
+
filter: (data) => isSpace4(data.subject) || isEchoObject2(data.subject),
|
|
2603
|
+
component: ({ data }) => {
|
|
2604
|
+
const space = isSpace4(data.subject) ? data.subject : getSpace5(data.subject);
|
|
2605
|
+
const object = isSpace4(data.subject) ? data.subject.state.get() === SpaceState2.SPACE_READY ? space?.properties[CollectionType.typename]?.target : void 0 : data.subject;
|
|
2606
|
+
return space && object ? /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(SpacePresence, {
|
|
2547
2607
|
object
|
|
2548
2608
|
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React21.createElement(ShareSpaceButton, {
|
|
2549
2609
|
space
|
|
2550
|
-
}))
|
|
2551
|
-
disposition: "hoist"
|
|
2552
|
-
} : null;
|
|
2553
|
-
}
|
|
2554
|
-
case "section":
|
|
2555
|
-
return data.object instanceof CollectionType ? /* @__PURE__ */ React21.createElement(CollectionSection, {
|
|
2556
|
-
collection: data.object
|
|
2557
|
-
}) : null;
|
|
2558
|
-
case "settings":
|
|
2559
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */ React21.createElement(SpacePluginSettings, {
|
|
2560
|
-
settings: settings.values
|
|
2561
|
-
}) : null;
|
|
2562
|
-
case "menu-footer":
|
|
2563
|
-
if (isEchoObject2(data.object)) {
|
|
2564
|
-
return /* @__PURE__ */ React21.createElement(MenuFooter, {
|
|
2565
|
-
object: data.object
|
|
2566
|
-
});
|
|
2567
|
-
} else {
|
|
2568
|
-
return null;
|
|
2610
|
+
})) : null;
|
|
2569
2611
|
}
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2612
|
+
}),
|
|
2613
|
+
createSurface({
|
|
2614
|
+
id: `${SPACE_PLUGIN}/collection-section`,
|
|
2615
|
+
role: "section",
|
|
2616
|
+
filter: (data) => data.subject instanceof CollectionType,
|
|
2617
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(CollectionSection, {
|
|
2618
|
+
collection: data.subject
|
|
2619
|
+
})
|
|
2620
|
+
}),
|
|
2621
|
+
createSurface({
|
|
2622
|
+
id: `${SPACE_PLUGIN}/settings`,
|
|
2623
|
+
role: "settings",
|
|
2624
|
+
filter: (data) => data.subject === SPACE_PLUGIN,
|
|
2625
|
+
component: () => /* @__PURE__ */ React21.createElement(SpacePluginSettings, {
|
|
2626
|
+
settings: settings.values
|
|
2627
|
+
})
|
|
2628
|
+
}),
|
|
2629
|
+
createSurface({
|
|
2630
|
+
id: `${SPACE_PLUGIN}/menu-footer`,
|
|
2631
|
+
role: "menu-footer",
|
|
2632
|
+
filter: (data) => isEchoObject2(data.subject),
|
|
2633
|
+
component: ({ data }) => /* @__PURE__ */ React21.createElement(MenuFooter, {
|
|
2634
|
+
object: data.subject
|
|
2635
|
+
})
|
|
2636
|
+
}),
|
|
2637
|
+
createSurface({
|
|
2638
|
+
id: `${SPACE_PLUGIN}/status`,
|
|
2639
|
+
role: "status",
|
|
2640
|
+
component: () => /* @__PURE__ */ React21.createElement(SyncStatus, null)
|
|
2641
|
+
})
|
|
2642
|
+
];
|
|
2576
2643
|
}
|
|
2577
2644
|
},
|
|
2578
2645
|
graph: {
|
|
2579
2646
|
builder: (plugins) => {
|
|
2580
2647
|
const clientPlugin2 = resolvePlugin(plugins, parseClientPlugin);
|
|
2581
|
-
const
|
|
2648
|
+
const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
|
|
2582
2649
|
const graphPlugin2 = resolvePlugin(plugins, parseGraphPlugin);
|
|
2583
2650
|
const client = clientPlugin2?.provides.client;
|
|
2584
|
-
const dispatch = intentPlugin?.provides.intent.
|
|
2585
|
-
const resolve =
|
|
2651
|
+
const dispatch = intentPlugin?.provides.intent.dispatchPromise;
|
|
2652
|
+
const resolve = metadataPlugin?.provides.metadata.resolver;
|
|
2586
2653
|
const graph = graphPlugin2?.provides.graph;
|
|
2587
2654
|
if (!client || !dispatch || !resolve || !graph) {
|
|
2588
2655
|
return [];
|
|
@@ -2615,7 +2682,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2615
2682
|
} else {
|
|
2616
2683
|
log3.warn("spaces order object not found", void 0, {
|
|
2617
2684
|
F: __dxlog_file6,
|
|
2618
|
-
L:
|
|
2685
|
+
L: 694,
|
|
2619
2686
|
S: void 0,
|
|
2620
2687
|
C: (f, a) => f(...a)
|
|
2621
2688
|
});
|
|
@@ -2624,27 +2691,15 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2624
2691
|
}
|
|
2625
2692
|
};
|
|
2626
2693
|
return [
|
|
2627
|
-
//
|
|
2694
|
+
// Primary actions.
|
|
2628
2695
|
createExtension({
|
|
2629
|
-
id: `${SPACE_PLUGIN}/
|
|
2696
|
+
id: `${SPACE_PLUGIN}/primary-actions`,
|
|
2630
2697
|
filter: (node) => node.id === "root",
|
|
2631
|
-
connector: () => [
|
|
2632
|
-
spacesNode
|
|
2633
|
-
],
|
|
2634
|
-
resolver: ({ id }) => id === SPACES ? spacesNode : void 0
|
|
2635
|
-
}),
|
|
2636
|
-
// Create space nodes.
|
|
2637
|
-
createExtension({
|
|
2638
|
-
id: SPACES,
|
|
2639
|
-
filter: (node) => node.id === SPACES,
|
|
2640
2698
|
actions: () => [
|
|
2641
2699
|
{
|
|
2642
|
-
id: SpaceAction.
|
|
2700
|
+
id: SpaceAction.OpenCreateSpace._tag,
|
|
2643
2701
|
data: async () => {
|
|
2644
|
-
await dispatch(
|
|
2645
|
-
plugin: SPACE_PLUGIN,
|
|
2646
|
-
action: SpaceAction.OPEN_CREATE_SPACE
|
|
2647
|
-
});
|
|
2702
|
+
await dispatch(createIntent8(SpaceAction.OpenCreateSpace));
|
|
2648
2703
|
},
|
|
2649
2704
|
properties: {
|
|
2650
2705
|
label: [
|
|
@@ -2655,17 +2710,13 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2655
2710
|
],
|
|
2656
2711
|
icon: "ph--plus--regular",
|
|
2657
2712
|
testId: "spacePlugin.createSpace",
|
|
2658
|
-
disposition: "item"
|
|
2659
|
-
className: "border-t border-separator"
|
|
2713
|
+
disposition: "item"
|
|
2660
2714
|
}
|
|
2661
2715
|
},
|
|
2662
2716
|
{
|
|
2663
|
-
id: SpaceAction.
|
|
2717
|
+
id: SpaceAction.Join._tag,
|
|
2664
2718
|
data: async () => {
|
|
2665
|
-
await dispatch(
|
|
2666
|
-
plugin: SPACE_PLUGIN,
|
|
2667
|
-
action: SpaceAction.JOIN
|
|
2668
|
-
});
|
|
2719
|
+
await dispatch(createIntent8(SpaceAction.Join));
|
|
2669
2720
|
},
|
|
2670
2721
|
properties: {
|
|
2671
2722
|
label: [
|
|
@@ -2676,10 +2727,25 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2676
2727
|
],
|
|
2677
2728
|
icon: "ph--sign-in--regular",
|
|
2678
2729
|
testId: "spacePlugin.joinSpace",
|
|
2679
|
-
disposition: "item"
|
|
2730
|
+
disposition: "item",
|
|
2731
|
+
className: "border-b border-separator"
|
|
2680
2732
|
}
|
|
2681
2733
|
}
|
|
2734
|
+
]
|
|
2735
|
+
}),
|
|
2736
|
+
// Create spaces group node.
|
|
2737
|
+
createExtension({
|
|
2738
|
+
id: `${SPACE_PLUGIN}/root`,
|
|
2739
|
+
filter: (node) => node.id === "root",
|
|
2740
|
+
connector: () => [
|
|
2741
|
+
spacesNode
|
|
2682
2742
|
],
|
|
2743
|
+
resolver: ({ id }) => id === SPACES ? spacesNode : void 0
|
|
2744
|
+
}),
|
|
2745
|
+
// Create space nodes.
|
|
2746
|
+
createExtension({
|
|
2747
|
+
id: SPACES,
|
|
2748
|
+
filter: (node) => node.id === SPACES,
|
|
2683
2749
|
connector: () => {
|
|
2684
2750
|
const spaces = toSignal((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2685
2751
|
const isReady = toSignal((onChange) => client.spaces.isReady.subscribe(() => onChange()).unsubscribe, () => client.spaces.isReady.get());
|
|
@@ -2758,11 +2824,11 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2758
2824
|
if (spaceState !== SpaceState2.SPACE_READY) {
|
|
2759
2825
|
return;
|
|
2760
2826
|
}
|
|
2761
|
-
const collection = space.properties[CollectionType.typename];
|
|
2827
|
+
const collection = space.properties[CollectionType.typename]?.target;
|
|
2762
2828
|
if (!collection) {
|
|
2763
2829
|
return;
|
|
2764
2830
|
}
|
|
2765
|
-
return collection.objects.filter(nonNullable2).map((object) => createObjectNode({
|
|
2831
|
+
return collection.objects.map((object) => object.target).filter(nonNullable2).map((object) => createObjectNode({
|
|
2766
2832
|
object,
|
|
2767
2833
|
space,
|
|
2768
2834
|
resolve,
|
|
@@ -2780,7 +2846,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2780
2846
|
if (!space) {
|
|
2781
2847
|
return;
|
|
2782
2848
|
}
|
|
2783
|
-
return collection.objects.filter(nonNullable2).map((object) => createObjectNode({
|
|
2849
|
+
return collection.objects.map((object) => object.target).filter(nonNullable2).map((object) => createObjectNode({
|
|
2784
2850
|
object,
|
|
2785
2851
|
space,
|
|
2786
2852
|
resolve,
|
|
@@ -2808,11 +2874,13 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2808
2874
|
if (!store.value) {
|
|
2809
2875
|
void space.db.query({
|
|
2810
2876
|
id: objectId
|
|
2877
|
+
}, {
|
|
2878
|
+
deleted: QueryOptions.ShowDeletedOption.SHOW_DELETED
|
|
2811
2879
|
}).first().then((o) => store.value = o).catch((err) => log3.catch(err, {
|
|
2812
2880
|
objectId
|
|
2813
2881
|
}, {
|
|
2814
2882
|
F: __dxlog_file6,
|
|
2815
|
-
L:
|
|
2883
|
+
L: 919,
|
|
2816
2884
|
S: void 0,
|
|
2817
2885
|
C: (f, a) => f(...a)
|
|
2818
2886
|
}));
|
|
@@ -2909,7 +2977,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2909
2977
|
];
|
|
2910
2978
|
},
|
|
2911
2979
|
serializer: (plugins) => {
|
|
2912
|
-
const dispatch = resolvePlugin(plugins,
|
|
2980
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
2913
2981
|
if (!dispatch) {
|
|
2914
2982
|
return [];
|
|
2915
2983
|
}
|
|
@@ -2934,14 +3002,11 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2934
3002
|
type: DIRECTORY_TYPE
|
|
2935
3003
|
}),
|
|
2936
3004
|
deserialize: async (data) => {
|
|
2937
|
-
const result = await dispatch({
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
}
|
|
2943
|
-
});
|
|
2944
|
-
return result?.data.space;
|
|
3005
|
+
const result = await dispatch(createIntent8(SpaceAction.Create, {
|
|
3006
|
+
name: data.name,
|
|
3007
|
+
edgeReplication: true
|
|
3008
|
+
}));
|
|
3009
|
+
return result.data?.space;
|
|
2945
3010
|
}
|
|
2946
3011
|
},
|
|
2947
3012
|
{
|
|
@@ -2954,65 +3019,71 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
2954
3019
|
}),
|
|
2955
3020
|
deserialize: async (data, ancestors) => {
|
|
2956
3021
|
const space = ancestors.find(isSpace4);
|
|
2957
|
-
const collection = ancestors.findLast((ancestor) => ancestor instanceof CollectionType) ?? space?.properties[CollectionType.typename];
|
|
3022
|
+
const collection = ancestors.findLast((ancestor) => ancestor instanceof CollectionType) ?? space?.properties[CollectionType.typename]?.target;
|
|
2958
3023
|
if (!space || !collection) {
|
|
2959
3024
|
return;
|
|
2960
3025
|
}
|
|
2961
|
-
const result = await dispatch({
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
})
|
|
2971
|
-
}
|
|
2972
|
-
});
|
|
2973
|
-
return result?.data.object;
|
|
3026
|
+
const result = await dispatch(createIntent8(SpaceAction.AddObject, {
|
|
3027
|
+
target: collection,
|
|
3028
|
+
object: create(CollectionType, {
|
|
3029
|
+
name: data.name,
|
|
3030
|
+
objects: [],
|
|
3031
|
+
views: {}
|
|
3032
|
+
})
|
|
3033
|
+
}));
|
|
3034
|
+
return result.data?.object;
|
|
2974
3035
|
}
|
|
2975
3036
|
}
|
|
2976
3037
|
];
|
|
2977
3038
|
}
|
|
2978
3039
|
},
|
|
2979
3040
|
intent: {
|
|
2980
|
-
|
|
2981
|
-
const
|
|
2982
|
-
const client =
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3041
|
+
resolvers: ({ plugins, dispatchPromise: dispatch }) => {
|
|
3042
|
+
const activeParts = resolvePlugin(plugins, parseNavigationPlugin2)?.provides.location.active;
|
|
3043
|
+
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
3044
|
+
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
3045
|
+
invariant2(activeParts, "Active parts not available.", {
|
|
3046
|
+
F: __dxlog_file6,
|
|
3047
|
+
L: 1078,
|
|
3048
|
+
S: void 0,
|
|
3049
|
+
A: [
|
|
3050
|
+
"activeParts",
|
|
3051
|
+
"'Active parts not available.'"
|
|
3052
|
+
]
|
|
3053
|
+
});
|
|
3054
|
+
invariant2(client, "Client not available.", {
|
|
3055
|
+
F: __dxlog_file6,
|
|
3056
|
+
L: 1079,
|
|
3057
|
+
S: void 0,
|
|
3058
|
+
A: [
|
|
3059
|
+
"client",
|
|
3060
|
+
"'Client not available.'"
|
|
3061
|
+
]
|
|
3062
|
+
});
|
|
3063
|
+
invariant2(resolve, "Metadata resolver not available.", {
|
|
3064
|
+
F: __dxlog_file6,
|
|
3065
|
+
L: 1080,
|
|
3066
|
+
S: void 0,
|
|
3067
|
+
A: [
|
|
3068
|
+
"resolve",
|
|
3069
|
+
"'Metadata resolver not available.'"
|
|
3070
|
+
]
|
|
3071
|
+
});
|
|
3072
|
+
return [
|
|
3073
|
+
createResolver(SpaceAction.OpenCreateSpace, () => ({
|
|
3074
|
+
intents: [
|
|
3075
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3076
|
+
element: "dialog",
|
|
3077
|
+
component: CREATE_SPACE_DIALOG,
|
|
3078
|
+
dialogBlockAlign: "start"
|
|
3079
|
+
})
|
|
3080
|
+
]
|
|
3081
|
+
})),
|
|
3082
|
+
createResolver(SpaceAction.Create, async ({ name, edgeReplication }) => {
|
|
3012
3083
|
const space = await client.spaces.create({
|
|
3013
|
-
name
|
|
3084
|
+
name
|
|
3014
3085
|
});
|
|
3015
|
-
if (
|
|
3086
|
+
if (edgeReplication) {
|
|
3016
3087
|
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting3.ENABLED);
|
|
3017
3088
|
}
|
|
3018
3089
|
await space.waitUntilReady();
|
|
@@ -3020,7 +3091,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
3020
3091
|
objects: [],
|
|
3021
3092
|
views: {}
|
|
3022
3093
|
});
|
|
3023
|
-
space.properties[CollectionType.typename] = collection;
|
|
3094
|
+
space.properties[CollectionType.typename] = makeRef2(collection);
|
|
3024
3095
|
if (Migrations2.versionProperty) {
|
|
3025
3096
|
space.properties[Migrations2.versionProperty] = Migrations2.targetVersion;
|
|
3026
3097
|
}
|
|
@@ -3035,304 +3106,224 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
3035
3106
|
}
|
|
3036
3107
|
},
|
|
3037
3108
|
intents: [
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
name: "space.create",
|
|
3043
|
-
properties: {
|
|
3044
|
-
spaceId: space.id
|
|
3045
|
-
}
|
|
3046
|
-
}
|
|
3109
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3110
|
+
name: "space.create",
|
|
3111
|
+
properties: {
|
|
3112
|
+
spaceId: space.id
|
|
3047
3113
|
}
|
|
3048
|
-
|
|
3114
|
+
})
|
|
3049
3115
|
]
|
|
3050
3116
|
};
|
|
3051
|
-
}
|
|
3052
|
-
|
|
3117
|
+
}),
|
|
3118
|
+
createResolver(SpaceAction.Join, ({ invitationCode }) => ({
|
|
3119
|
+
intents: [
|
|
3120
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3121
|
+
element: "dialog",
|
|
3122
|
+
component: JOIN_DIALOG,
|
|
3123
|
+
dialogBlockAlign: "start",
|
|
3124
|
+
subject: {
|
|
3125
|
+
initialInvitationCode: invitationCode
|
|
3126
|
+
}
|
|
3127
|
+
})
|
|
3128
|
+
]
|
|
3129
|
+
})),
|
|
3130
|
+
createResolver(SpaceAction.Share, ({ space }) => {
|
|
3131
|
+
const active = navigationPlugin?.provides.location.active;
|
|
3132
|
+
const mode = layoutPlugin?.provides.layout.layoutMode;
|
|
3133
|
+
const current = active ? firstIdInPart(active, mode === "solo" ? "solo" : "main") : void 0;
|
|
3134
|
+
const target = current?.startsWith(space.id) ? current : void 0;
|
|
3053
3135
|
return {
|
|
3054
|
-
data: true,
|
|
3055
3136
|
intents: [
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3137
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3138
|
+
element: "dialog",
|
|
3139
|
+
component: SPACE_SETTINGS_DIALOG,
|
|
3140
|
+
dialogBlockAlign: "start",
|
|
3141
|
+
subject: {
|
|
3142
|
+
space,
|
|
3143
|
+
target,
|
|
3144
|
+
initialTab: "members",
|
|
3145
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
3146
|
+
}
|
|
3147
|
+
}),
|
|
3148
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3149
|
+
name: "space.share",
|
|
3150
|
+
properties: {
|
|
3151
|
+
space: space.id
|
|
3068
3152
|
}
|
|
3069
|
-
|
|
3153
|
+
})
|
|
3070
3154
|
]
|
|
3071
3155
|
};
|
|
3072
|
-
}
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
const mode = layoutPlugin?.provides.layout.layoutMode;
|
|
3078
|
-
const current = active ? firstIdInPart(active, mode === "solo" ? "solo" : "main") : void 0;
|
|
3079
|
-
const target = current?.startsWith(space.id) ? current : void 0;
|
|
3080
|
-
return {
|
|
3081
|
-
data: true,
|
|
3082
|
-
intents: [
|
|
3083
|
-
[
|
|
3084
|
-
{
|
|
3085
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
3086
|
-
data: {
|
|
3087
|
-
element: "dialog",
|
|
3088
|
-
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
3089
|
-
dialogBlockAlign: "start",
|
|
3090
|
-
subject: {
|
|
3091
|
-
space,
|
|
3092
|
-
target,
|
|
3093
|
-
initialTab: "members",
|
|
3094
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
}
|
|
3098
|
-
],
|
|
3099
|
-
[
|
|
3100
|
-
{
|
|
3101
|
-
action: ObservabilityAction2.SEND_EVENT,
|
|
3102
|
-
data: {
|
|
3103
|
-
name: "space.share",
|
|
3104
|
-
properties: {
|
|
3105
|
-
space: space.id
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
|
-
]
|
|
3110
|
-
]
|
|
3111
|
-
};
|
|
3112
|
-
}
|
|
3113
|
-
break;
|
|
3114
|
-
}
|
|
3115
|
-
case SpaceAction.LOCK: {
|
|
3116
|
-
const space = intent.data?.space;
|
|
3117
|
-
if (isSpace4(space)) {
|
|
3118
|
-
space.properties[COMPOSER_SPACE_LOCK] = true;
|
|
3119
|
-
return {
|
|
3120
|
-
data: true,
|
|
3121
|
-
intents: [
|
|
3122
|
-
[
|
|
3123
|
-
{
|
|
3124
|
-
action: ObservabilityAction2.SEND_EVENT,
|
|
3125
|
-
data: {
|
|
3126
|
-
name: "space.lock",
|
|
3127
|
-
properties: {
|
|
3128
|
-
spaceId: space.id
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
]
|
|
3133
|
-
]
|
|
3134
|
-
};
|
|
3135
|
-
}
|
|
3136
|
-
break;
|
|
3137
|
-
}
|
|
3138
|
-
case SpaceAction.UNLOCK: {
|
|
3139
|
-
const space = intent.data?.space;
|
|
3140
|
-
if (isSpace4(space)) {
|
|
3141
|
-
space.properties[COMPOSER_SPACE_LOCK] = false;
|
|
3142
|
-
return {
|
|
3143
|
-
data: true,
|
|
3144
|
-
intents: [
|
|
3145
|
-
[
|
|
3146
|
-
{
|
|
3147
|
-
action: ObservabilityAction2.SEND_EVENT,
|
|
3148
|
-
data: {
|
|
3149
|
-
name: "space.unlock",
|
|
3150
|
-
properties: {
|
|
3151
|
-
spaceId: space.id
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
}
|
|
3155
|
-
]
|
|
3156
|
-
]
|
|
3157
|
-
};
|
|
3158
|
-
}
|
|
3159
|
-
break;
|
|
3160
|
-
}
|
|
3161
|
-
case SpaceAction.RENAME: {
|
|
3162
|
-
const { caller, space } = intent.data ?? {};
|
|
3163
|
-
if (typeof caller === "string" && isSpace4(space)) {
|
|
3164
|
-
return {
|
|
3165
|
-
intents: [
|
|
3166
|
-
[
|
|
3167
|
-
{
|
|
3168
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
3169
|
-
data: {
|
|
3170
|
-
element: "popover",
|
|
3171
|
-
anchorId: `dxos.org/ui/${caller}/${space.id}`,
|
|
3172
|
-
component: "dxos.org/plugin/space/RenameSpacePopover",
|
|
3173
|
-
subject: space
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
]
|
|
3177
|
-
]
|
|
3178
|
-
};
|
|
3179
|
-
}
|
|
3180
|
-
break;
|
|
3181
|
-
}
|
|
3182
|
-
case SpaceAction.OPEN_SETTINGS: {
|
|
3183
|
-
const space = intent.data?.space;
|
|
3184
|
-
if (isSpace4(space)) {
|
|
3185
|
-
return {
|
|
3186
|
-
data: true,
|
|
3187
|
-
intents: [
|
|
3188
|
-
[
|
|
3189
|
-
{
|
|
3190
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
3191
|
-
data: {
|
|
3192
|
-
element: "dialog",
|
|
3193
|
-
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
3194
|
-
dialogBlockAlign: "start",
|
|
3195
|
-
subject: {
|
|
3196
|
-
space,
|
|
3197
|
-
initialTab: "settings",
|
|
3198
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3199
|
-
}
|
|
3200
|
-
}
|
|
3201
|
-
}
|
|
3202
|
-
]
|
|
3203
|
-
]
|
|
3204
|
-
};
|
|
3205
|
-
}
|
|
3206
|
-
break;
|
|
3207
|
-
}
|
|
3208
|
-
case SpaceAction.OPEN: {
|
|
3209
|
-
const space = intent.data?.space;
|
|
3210
|
-
if (isSpace4(space)) {
|
|
3211
|
-
await space.open();
|
|
3212
|
-
return {
|
|
3213
|
-
data: true
|
|
3214
|
-
};
|
|
3215
|
-
}
|
|
3216
|
-
break;
|
|
3217
|
-
}
|
|
3218
|
-
case SpaceAction.CLOSE: {
|
|
3219
|
-
const space = intent.data?.space;
|
|
3220
|
-
if (isSpace4(space)) {
|
|
3221
|
-
await space.close();
|
|
3222
|
-
return {
|
|
3223
|
-
data: true
|
|
3224
|
-
};
|
|
3225
|
-
}
|
|
3226
|
-
break;
|
|
3227
|
-
}
|
|
3228
|
-
case SpaceAction.MIGRATE: {
|
|
3229
|
-
const space = intent.data?.space;
|
|
3230
|
-
if (isSpace4(space)) {
|
|
3231
|
-
if (space.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
3232
|
-
state.values.sdkMigrationRunning[space.id] = true;
|
|
3233
|
-
await space.internal.migrate();
|
|
3234
|
-
state.values.sdkMigrationRunning[space.id] = false;
|
|
3235
|
-
}
|
|
3236
|
-
const result = await Migrations2.migrate(space, intent.data?.version);
|
|
3237
|
-
return {
|
|
3238
|
-
data: result,
|
|
3239
|
-
intents: [
|
|
3240
|
-
[
|
|
3241
|
-
{
|
|
3242
|
-
action: ObservabilityAction2.SEND_EVENT,
|
|
3243
|
-
data: {
|
|
3244
|
-
name: "space.migrate",
|
|
3245
|
-
properties: {
|
|
3246
|
-
spaceId: space.id,
|
|
3247
|
-
version: intent.data?.version
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
]
|
|
3252
|
-
]
|
|
3253
|
-
};
|
|
3254
|
-
}
|
|
3255
|
-
break;
|
|
3256
|
-
}
|
|
3257
|
-
case SpaceAction.OPEN_CREATE_OBJECT: {
|
|
3156
|
+
}, {
|
|
3157
|
+
filter: (data) => !data.space.properties[COMPOSER_SPACE_LOCK]
|
|
3158
|
+
}),
|
|
3159
|
+
createResolver(SpaceAction.Lock, ({ space }) => {
|
|
3160
|
+
space.properties[COMPOSER_SPACE_LOCK] = true;
|
|
3258
3161
|
return {
|
|
3259
|
-
data: true,
|
|
3260
3162
|
intents: [
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
element: "dialog",
|
|
3266
|
-
component: "dxos.org/plugin/space/CreateObjectDialog",
|
|
3267
|
-
dialogBlockAlign: "start",
|
|
3268
|
-
subject: intent.data
|
|
3269
|
-
}
|
|
3163
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3164
|
+
name: "space.lock",
|
|
3165
|
+
properties: {
|
|
3166
|
+
spaceId: space.id
|
|
3270
3167
|
}
|
|
3271
|
-
|
|
3168
|
+
})
|
|
3272
3169
|
]
|
|
3273
3170
|
};
|
|
3274
|
-
}
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3171
|
+
}),
|
|
3172
|
+
createResolver(SpaceAction.Unlock, ({ space }) => {
|
|
3173
|
+
space.properties[COMPOSER_SPACE_LOCK] = false;
|
|
3174
|
+
return {
|
|
3175
|
+
intents: [
|
|
3176
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3177
|
+
name: "space.unlock",
|
|
3178
|
+
properties: {
|
|
3179
|
+
spaceId: space.id
|
|
3180
|
+
}
|
|
3181
|
+
})
|
|
3182
|
+
]
|
|
3183
|
+
};
|
|
3184
|
+
}),
|
|
3185
|
+
createResolver(SpaceAction.Rename, ({ caller, space }) => {
|
|
3186
|
+
return {
|
|
3187
|
+
intents: [
|
|
3188
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3189
|
+
element: "popover",
|
|
3190
|
+
anchorId: `dxos.org/ui/${caller}/${space.id}`,
|
|
3191
|
+
component: POPOVER_RENAME_SPACE,
|
|
3192
|
+
subject: space
|
|
3193
|
+
})
|
|
3194
|
+
]
|
|
3195
|
+
};
|
|
3196
|
+
}),
|
|
3197
|
+
createResolver(SpaceAction.OpenSettings, ({ space }) => {
|
|
3198
|
+
return {
|
|
3199
|
+
intents: [
|
|
3200
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3201
|
+
element: "dialog",
|
|
3202
|
+
component: SPACE_SETTINGS_DIALOG,
|
|
3203
|
+
dialogBlockAlign: "start",
|
|
3204
|
+
subject: {
|
|
3205
|
+
space,
|
|
3206
|
+
initialTab: "settings",
|
|
3207
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
3208
|
+
}
|
|
3209
|
+
})
|
|
3210
|
+
]
|
|
3211
|
+
};
|
|
3212
|
+
}),
|
|
3213
|
+
createResolver(SpaceAction.Open, async ({ space }) => {
|
|
3214
|
+
await space.open();
|
|
3215
|
+
}),
|
|
3216
|
+
createResolver(SpaceAction.Close, async ({ space }) => {
|
|
3217
|
+
await space.close();
|
|
3218
|
+
}),
|
|
3219
|
+
createResolver(SpaceAction.Migrate, async ({ space, version }) => {
|
|
3220
|
+
if (space.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
3221
|
+
state.values.sdkMigrationRunning[space.id] = true;
|
|
3222
|
+
await space.internal.migrate();
|
|
3223
|
+
state.values.sdkMigrationRunning[space.id] = false;
|
|
3283
3224
|
}
|
|
3225
|
+
const result = await Migrations2.migrate(space, version);
|
|
3226
|
+
return {
|
|
3227
|
+
data: result,
|
|
3228
|
+
intents: [
|
|
3229
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3230
|
+
name: "space.migrate",
|
|
3231
|
+
properties: {
|
|
3232
|
+
spaceId: space.id,
|
|
3233
|
+
version
|
|
3234
|
+
}
|
|
3235
|
+
})
|
|
3236
|
+
]
|
|
3237
|
+
};
|
|
3238
|
+
}),
|
|
3239
|
+
createResolver(SpaceAction.OpenCreateObject, ({ target, navigable = true }) => {
|
|
3240
|
+
return {
|
|
3241
|
+
intents: [
|
|
3242
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3243
|
+
element: "dialog",
|
|
3244
|
+
component: CREATE_OBJECT_DIALOG,
|
|
3245
|
+
dialogBlockAlign: "start",
|
|
3246
|
+
subject: {
|
|
3247
|
+
target,
|
|
3248
|
+
shouldNavigate: navigable ? (object) => !(object instanceof CollectionType) || state.values.navigableCollections : () => false
|
|
3249
|
+
}
|
|
3250
|
+
})
|
|
3251
|
+
]
|
|
3252
|
+
};
|
|
3253
|
+
}),
|
|
3254
|
+
createResolver(SpaceAction.AddObject, async ({ target, object }) => {
|
|
3255
|
+
const space = isSpace4(target) ? target : getSpace5(target);
|
|
3256
|
+
invariant2(space, "Space not found.", {
|
|
3257
|
+
F: __dxlog_file6,
|
|
3258
|
+
L: 1265,
|
|
3259
|
+
S: void 0,
|
|
3260
|
+
A: [
|
|
3261
|
+
"space",
|
|
3262
|
+
"'Space not found.'"
|
|
3263
|
+
]
|
|
3264
|
+
});
|
|
3284
3265
|
if (space.db.coreDatabase.getAllObjectIds().length >= SPACE_MAX_OBJECTS) {
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3266
|
+
void dispatch(createIntent8(LayoutAction2.SetLayout, {
|
|
3267
|
+
element: "toast",
|
|
3268
|
+
subject: {
|
|
3269
|
+
id: `${SPACE_PLUGIN}/space-limit`,
|
|
3270
|
+
title: [
|
|
3271
|
+
"space limit label",
|
|
3289
3272
|
{
|
|
3290
|
-
|
|
3291
|
-
data: {
|
|
3292
|
-
element: "toast",
|
|
3293
|
-
subject: {
|
|
3294
|
-
id: `${SPACE_PLUGIN}/space-limit`,
|
|
3295
|
-
title: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit label"],
|
|
3296
|
-
description: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit description"],
|
|
3297
|
-
duration: 5e3,
|
|
3298
|
-
icon: "ph--warning--regular",
|
|
3299
|
-
actionLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects label"],
|
|
3300
|
-
actionAlt: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects alt"],
|
|
3301
|
-
// TODO(wittjosiah): Use OS namespace.
|
|
3302
|
-
closeLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit close label"],
|
|
3303
|
-
onAction: () => space.db.coreDatabase.unlinkDeletedObjects()
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3273
|
+
ns: SPACE_PLUGIN
|
|
3306
3274
|
}
|
|
3307
3275
|
],
|
|
3308
|
-
[
|
|
3276
|
+
description: [
|
|
3277
|
+
"space limit description",
|
|
3309
3278
|
{
|
|
3310
|
-
|
|
3311
|
-
data: {
|
|
3312
|
-
name: "space.limit",
|
|
3313
|
-
properties: {
|
|
3314
|
-
spaceId: space.id
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3279
|
+
ns: SPACE_PLUGIN
|
|
3317
3280
|
}
|
|
3318
|
-
]
|
|
3319
|
-
|
|
3320
|
-
|
|
3281
|
+
],
|
|
3282
|
+
duration: 5e3,
|
|
3283
|
+
icon: "ph--warning--regular",
|
|
3284
|
+
actionLabel: [
|
|
3285
|
+
"remove deleted objects label",
|
|
3286
|
+
{
|
|
3287
|
+
ns: SPACE_PLUGIN
|
|
3288
|
+
}
|
|
3289
|
+
],
|
|
3290
|
+
actionAlt: [
|
|
3291
|
+
"remove deleted objects alt",
|
|
3292
|
+
{
|
|
3293
|
+
ns: SPACE_PLUGIN
|
|
3294
|
+
}
|
|
3295
|
+
],
|
|
3296
|
+
closeLabel: [
|
|
3297
|
+
"close label",
|
|
3298
|
+
{
|
|
3299
|
+
ns: "os"
|
|
3300
|
+
}
|
|
3301
|
+
],
|
|
3302
|
+
onAction: () => space.db.coreDatabase.unlinkDeletedObjects()
|
|
3303
|
+
}
|
|
3304
|
+
}));
|
|
3305
|
+
void dispatch(createIntent8(ObservabilityAction2.SendEvent, {
|
|
3306
|
+
name: "space.limit",
|
|
3307
|
+
properties: {
|
|
3308
|
+
spaceId: space.id
|
|
3309
|
+
}
|
|
3310
|
+
}));
|
|
3311
|
+
throw new Error("Space limit reached.");
|
|
3321
3312
|
}
|
|
3322
|
-
if (
|
|
3323
|
-
|
|
3324
|
-
} else if (isSpace4(
|
|
3325
|
-
const collection = space.properties[CollectionType.typename];
|
|
3313
|
+
if (target instanceof CollectionType) {
|
|
3314
|
+
target.objects.push(makeRef2(object));
|
|
3315
|
+
} else if (isSpace4(target)) {
|
|
3316
|
+
const collection = space.properties[CollectionType.typename]?.target;
|
|
3326
3317
|
if (collection instanceof CollectionType) {
|
|
3327
|
-
collection.objects.push(object);
|
|
3318
|
+
collection.objects.push(makeRef2(object));
|
|
3328
3319
|
} else {
|
|
3329
3320
|
const collection2 = create(CollectionType, {
|
|
3330
3321
|
objects: [
|
|
3331
|
-
object
|
|
3322
|
+
makeRef2(object)
|
|
3332
3323
|
],
|
|
3333
3324
|
views: {}
|
|
3334
3325
|
});
|
|
3335
|
-
space.properties[CollectionType.typename] = collection2;
|
|
3326
|
+
space.properties[CollectionType.typename] = makeRef2(collection2);
|
|
3336
3327
|
}
|
|
3337
3328
|
}
|
|
3338
3329
|
return {
|
|
@@ -3346,178 +3337,147 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
|
|
|
3346
3337
|
}
|
|
3347
3338
|
},
|
|
3348
3339
|
intents: [
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
spaceId: space.id,
|
|
3356
|
-
objectId: object.id,
|
|
3357
|
-
typename: getTypename2(object)
|
|
3358
|
-
}
|
|
3359
|
-
}
|
|
3340
|
+
createIntent8(ObservabilityAction2.SendEvent, {
|
|
3341
|
+
name: "space.object.add",
|
|
3342
|
+
properties: {
|
|
3343
|
+
spaceId: space.id,
|
|
3344
|
+
objectId: object.id,
|
|
3345
|
+
typename: getTypename2(object)
|
|
3360
3346
|
}
|
|
3361
|
-
|
|
3347
|
+
})
|
|
3362
3348
|
]
|
|
3363
3349
|
};
|
|
3364
|
-
}
|
|
3365
|
-
|
|
3366
|
-
const
|
|
3367
|
-
invariant2(
|
|
3350
|
+
}),
|
|
3351
|
+
createResolver(SpaceAction.RemoveObjects, async ({ objects, target, deletionData }, undo) => {
|
|
3352
|
+
const space = getSpace5(objects[0]);
|
|
3353
|
+
invariant2(space && objects.every((obj) => isEchoObject2(obj) && getSpace5(obj) === space), void 0, {
|
|
3368
3354
|
F: __dxlog_file6,
|
|
3369
|
-
L:
|
|
3355
|
+
L: 1330,
|
|
3370
3356
|
S: void 0,
|
|
3371
3357
|
A: [
|
|
3372
|
-
"
|
|
3358
|
+
"space && objects.every((obj) => isEchoObject(obj) && getSpace(obj) === space)",
|
|
3373
3359
|
""
|
|
3374
3360
|
]
|
|
3375
3361
|
});
|
|
3376
|
-
const space = getSpace5(objects[0]);
|
|
3377
|
-
if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace5(obj) === space)) {
|
|
3378
|
-
return;
|
|
3379
|
-
}
|
|
3380
|
-
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
3381
|
-
const activeParts = navigationPlugin?.provides.location.active;
|
|
3382
3362
|
const openObjectIds = new Set(openIds(activeParts ?? {}));
|
|
3383
|
-
if (!
|
|
3384
|
-
const parentCollection =
|
|
3363
|
+
if (!undo) {
|
|
3364
|
+
const parentCollection = target ?? space.properties[CollectionType.typename]?.target;
|
|
3385
3365
|
const nestedObjectsList = await Promise.all(objects.map((obj) => getNestedObjects(obj, resolve)));
|
|
3386
|
-
const
|
|
3366
|
+
const deletionData2 = {
|
|
3387
3367
|
objects,
|
|
3388
3368
|
parentCollection,
|
|
3389
|
-
indices: objects.map((obj) => parentCollection instanceof CollectionType ? parentCollection.objects.
|
|
3369
|
+
indices: objects.map((obj) => parentCollection instanceof CollectionType ? parentCollection.objects.findIndex((object) => object.target === obj) : -1),
|
|
3390
3370
|
nestedObjectsList,
|
|
3391
3371
|
wasActive: objects.flatMap((obj, i) => [
|
|
3392
3372
|
obj,
|
|
3393
3373
|
...nestedObjectsList[i]
|
|
3394
3374
|
]).map((obj) => fullyQualifiedId4(obj)).filter((id) => openObjectIds.has(id))
|
|
3395
3375
|
};
|
|
3396
|
-
if (
|
|
3397
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
3398
|
-
action: NavigationAction4.CLOSE,
|
|
3399
|
-
data: {
|
|
3400
|
-
activeParts: {
|
|
3401
|
-
main: deletionData.wasActive,
|
|
3402
|
-
sidebar: deletionData.wasActive
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
});
|
|
3406
|
-
}
|
|
3407
|
-
if (deletionData.parentCollection instanceof CollectionType) {
|
|
3376
|
+
if (deletionData2.parentCollection instanceof CollectionType) {
|
|
3408
3377
|
[
|
|
3409
|
-
...
|
|
3378
|
+
...deletionData2.indices
|
|
3410
3379
|
].sort((a, b) => b - a).forEach((index) => {
|
|
3411
3380
|
if (index !== -1) {
|
|
3412
|
-
|
|
3381
|
+
deletionData2.parentCollection.objects.splice(index, 1);
|
|
3413
3382
|
}
|
|
3414
3383
|
});
|
|
3415
3384
|
}
|
|
3416
|
-
|
|
3385
|
+
deletionData2.nestedObjectsList.flat().forEach((obj) => {
|
|
3417
3386
|
space.db.remove(obj);
|
|
3418
3387
|
});
|
|
3419
3388
|
objects.forEach((obj) => space.db.remove(obj));
|
|
3420
3389
|
const undoMessageKey = objects.some((obj) => obj instanceof CollectionType) ? "collection deleted label" : objects.length > 1 ? "objects deleted label" : "object deleted label";
|
|
3421
3390
|
return {
|
|
3422
|
-
data: true,
|
|
3423
3391
|
undoable: {
|
|
3424
3392
|
// TODO(ZaymonFC): Pluralize if more than one object.
|
|
3425
|
-
message:
|
|
3426
|
-
|
|
3427
|
-
|
|
3393
|
+
message: [
|
|
3394
|
+
undoMessageKey,
|
|
3395
|
+
{
|
|
3396
|
+
ns: SPACE_PLUGIN
|
|
3397
|
+
}
|
|
3398
|
+
],
|
|
3399
|
+
data: {
|
|
3400
|
+
deletionData: deletionData2
|
|
3401
|
+
}
|
|
3402
|
+
},
|
|
3403
|
+
intents: deletionData2.wasActive.length > 0 ? [
|
|
3404
|
+
createIntent8(NavigationAction5.Close, {
|
|
3405
|
+
activeParts: {
|
|
3406
|
+
main: deletionData2.wasActive
|
|
3407
|
+
}
|
|
3408
|
+
})
|
|
3409
|
+
] : void 0
|
|
3428
3410
|
};
|
|
3429
3411
|
} else {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
undoData.nestedObjectsList.flat().forEach((obj) => {
|
|
3412
|
+
if (deletionData?.objects?.length && deletionData.objects.every(isEchoObject2) && deletionData.parentCollection instanceof CollectionType) {
|
|
3413
|
+
const restoredObjects = deletionData.objects.map((obj) => space.db.add(obj));
|
|
3414
|
+
deletionData.nestedObjectsList.flat().forEach((obj) => {
|
|
3434
3415
|
space.db.add(obj);
|
|
3435
3416
|
});
|
|
3436
|
-
|
|
3417
|
+
deletionData.indices.forEach((index, i) => {
|
|
3437
3418
|
if (index !== -1) {
|
|
3438
|
-
|
|
3419
|
+
deletionData.parentCollection.objects.splice(index, 0, makeRef2(restoredObjects[i]));
|
|
3439
3420
|
}
|
|
3440
3421
|
});
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
data: {
|
|
3422
|
+
return {
|
|
3423
|
+
intents: deletionData.wasActive.length > 0 ? [
|
|
3424
|
+
createIntent8(NavigationAction5.Open, {
|
|
3445
3425
|
activeParts: {
|
|
3446
|
-
main:
|
|
3426
|
+
main: deletionData.wasActive
|
|
3447
3427
|
}
|
|
3448
|
-
}
|
|
3449
|
-
|
|
3450
|
-
}
|
|
3451
|
-
return {
|
|
3452
|
-
data: true
|
|
3428
|
+
})
|
|
3429
|
+
] : void 0
|
|
3453
3430
|
};
|
|
3454
3431
|
}
|
|
3455
|
-
return {
|
|
3456
|
-
data: false
|
|
3457
|
-
};
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
|
-
case SpaceAction.RENAME_OBJECT: {
|
|
3461
|
-
const object = intent.data?.object ?? intent.data?.result;
|
|
3462
|
-
const caller = intent.data?.caller;
|
|
3463
|
-
if (isReactiveObject3(object) && caller) {
|
|
3464
|
-
return {
|
|
3465
|
-
intents: [
|
|
3466
|
-
[
|
|
3467
|
-
{
|
|
3468
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
3469
|
-
data: {
|
|
3470
|
-
element: "popover",
|
|
3471
|
-
anchorId: `dxos.org/ui/${caller}/${fullyQualifiedId4(object)}`,
|
|
3472
|
-
component: "dxos.org/plugin/space/RenameObjectPopover",
|
|
3473
|
-
subject: object
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
]
|
|
3477
|
-
]
|
|
3478
|
-
};
|
|
3479
3432
|
}
|
|
3480
|
-
|
|
3481
|
-
}
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
]
|
|
3433
|
+
}),
|
|
3434
|
+
createResolver(SpaceAction.RenameObject, async ({ object, caller }) => ({
|
|
3435
|
+
intents: [
|
|
3436
|
+
createIntent8(LayoutAction2.SetLayout, {
|
|
3437
|
+
element: "popover",
|
|
3438
|
+
anchorId: `dxos.org/ui/${caller}/${fullyQualifiedId4(object)}`,
|
|
3439
|
+
component: POPOVER_RENAME_OBJECT,
|
|
3440
|
+
subject: object
|
|
3441
|
+
})
|
|
3442
|
+
]
|
|
3443
|
+
})),
|
|
3444
|
+
createResolver(SpaceAction.DuplicateObject, async ({ object, target }) => {
|
|
3445
|
+
const space = isSpace4(target) ? target : getSpace5(target);
|
|
3446
|
+
invariant2(space, "Space not found.", {
|
|
3447
|
+
F: __dxlog_file6,
|
|
3448
|
+
L: 1429,
|
|
3449
|
+
S: void 0,
|
|
3450
|
+
A: [
|
|
3451
|
+
"space",
|
|
3452
|
+
"'Space not found.'"
|
|
3501
3453
|
]
|
|
3502
|
-
};
|
|
3503
|
-
}
|
|
3504
|
-
case SpaceAction.TOGGLE_HIDDEN: {
|
|
3505
|
-
settings.values.showHidden = intent.data?.state ?? !settings.values.showHidden;
|
|
3506
|
-
return {
|
|
3507
|
-
data: true
|
|
3508
|
-
};
|
|
3509
|
-
}
|
|
3510
|
-
case CollectionAction.CREATE: {
|
|
3511
|
-
const collection = create(CollectionType, {
|
|
3512
|
-
name: intent.data?.name,
|
|
3513
|
-
objects: [],
|
|
3514
|
-
views: {}
|
|
3515
3454
|
});
|
|
3455
|
+
const newObject = await cloneObject(object, resolve, space);
|
|
3516
3456
|
return {
|
|
3517
|
-
|
|
3457
|
+
intents: [
|
|
3458
|
+
createIntent8(SpaceAction.AddObject, {
|
|
3459
|
+
object: newObject,
|
|
3460
|
+
target
|
|
3461
|
+
})
|
|
3462
|
+
]
|
|
3518
3463
|
};
|
|
3519
|
-
}
|
|
3520
|
-
|
|
3464
|
+
}),
|
|
3465
|
+
createResolver(SpaceAction.WaitForObject, async ({ id }) => {
|
|
3466
|
+
state.values.awaiting = id;
|
|
3467
|
+
}),
|
|
3468
|
+
createResolver(SpaceAction.ToggleHidden, async ({ state: state2 }) => {
|
|
3469
|
+
settings.values.showHidden = state2;
|
|
3470
|
+
}),
|
|
3471
|
+
createResolver(CollectionAction.Create, async ({ name }) => ({
|
|
3472
|
+
data: {
|
|
3473
|
+
object: create(CollectionType, {
|
|
3474
|
+
name,
|
|
3475
|
+
objects: [],
|
|
3476
|
+
views: {}
|
|
3477
|
+
})
|
|
3478
|
+
}
|
|
3479
|
+
}))
|
|
3480
|
+
];
|
|
3521
3481
|
}
|
|
3522
3482
|
}
|
|
3523
3483
|
}
|
|
@@ -3530,6 +3490,8 @@ export {
|
|
|
3530
3490
|
ActorSchema,
|
|
3531
3491
|
AwaitingObject,
|
|
3532
3492
|
COMPOSER_SPACE_LOCK,
|
|
3493
|
+
CREATE_OBJECT_DIALOG,
|
|
3494
|
+
CREATE_SPACE_DIALOG,
|
|
3533
3495
|
ChannelType,
|
|
3534
3496
|
CollectionAction,
|
|
3535
3497
|
CollectionMain,
|
|
@@ -3541,19 +3503,23 @@ export {
|
|
|
3541
3503
|
DefaultObjectSettings,
|
|
3542
3504
|
FullPresence,
|
|
3543
3505
|
InlineSyncStatus,
|
|
3544
|
-
|
|
3506
|
+
JOIN_DIALOG,
|
|
3545
3507
|
JoinDialog,
|
|
3546
3508
|
MenuFooter,
|
|
3547
3509
|
MessageState,
|
|
3548
3510
|
MessageType,
|
|
3511
|
+
POPOVER_RENAME_OBJECT,
|
|
3512
|
+
POPOVER_RENAME_SPACE,
|
|
3549
3513
|
PersistenceStatus,
|
|
3550
3514
|
PopoverRenameObject,
|
|
3551
3515
|
PopoverRenameSpace,
|
|
3552
3516
|
SHARED,
|
|
3553
3517
|
SPACES,
|
|
3518
|
+
SPACE_ACTION,
|
|
3554
3519
|
SPACE_DIRECTORY_HANDLE,
|
|
3555
3520
|
SPACE_PLUGIN,
|
|
3556
3521
|
SPACE_PLUGIN_SHORT_ID,
|
|
3522
|
+
SPACE_SETTINGS_DIALOG,
|
|
3557
3523
|
SPACE_TYPE,
|
|
3558
3524
|
ShareSpaceButton,
|
|
3559
3525
|
ShareSpaceButtonImpl,
|