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