@dxos/plugin-space 0.6.14-staging.8758a12 → 0.6.14-staging.9b873ce
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-AVLRQF6L.mjs → chunk-DJE2HYFV.mjs} +3 -2
- package/dist/lib/browser/{chunk-AVLRQF6L.mjs.map → chunk-DJE2HYFV.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-WZAM3FNP.mjs → chunk-OWZKSWMX.mjs} +1 -1
- package/dist/lib/browser/{chunk-WZAM3FNP.mjs.map → chunk-OWZKSWMX.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +586 -576
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-HTAM5LQD.cjs → chunk-FYWGZYJB.cjs} +4 -4
- package/dist/lib/node/{chunk-HTAM5LQD.cjs.map → chunk-FYWGZYJB.cjs.map} +2 -2
- package/dist/lib/node/{chunk-P4XUXM7Y.cjs → chunk-JFDDZI4Y.cjs} +6 -5
- package/dist/lib/node/{chunk-P4XUXM7Y.cjs.map → chunk-JFDDZI4Y.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +816 -805
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +5 -5
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +11 -11
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-YPQGKWHJ.mjs → chunk-DVUZ7A7G.mjs} +3 -2
- package/dist/lib/node-esm/{chunk-YPQGKWHJ.mjs.map → chunk-DVUZ7A7G.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-TRJKV4PK.mjs → chunk-MCEAI4CV.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-TRJKV4PK.mjs.map → chunk-MCEAI4CV.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +586 -576
- 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 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/SpacePlugin.d.ts +9 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +7 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/components/ShareSpaceButton.d.ts +3 -2
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/{SpaceSettings.d.ts → SpacePluginSettings.d.ts} +2 -2
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +10 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/index.d.ts +3 -0
- package/dist/types/src/components/SpaceSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +5 -0
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +8 -4
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +35 -34
- package/src/SpacePlugin.tsx +225 -146
- package/src/components/AwaitingObject.tsx +1 -1
- package/src/components/JoinDialog.tsx +100 -0
- package/src/components/ShareSpaceButton.tsx +10 -6
- package/src/components/{SpaceSettings.tsx → SpacePluginSettings.tsx} +1 -1
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +44 -0
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +103 -0
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +32 -0
- package/src/components/{SpaceSettingsPanel.tsx → SpaceSettings/SpaceSettingsPanel.tsx} +15 -20
- package/src/components/SpaceSettings/index.ts +6 -0
- package/src/components/index.ts +2 -2
- package/src/meta.ts +2 -1
- package/src/translations.ts +4 -0
- package/src/types/types.ts +6 -0
- package/src/util.tsx +51 -23
- package/dist/types/src/components/SpaceMain/SpaceMain.d.ts +0 -10
- package/dist/types/src/components/SpaceMain/SpaceMain.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts +0 -6
- package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain/index.d.ts +0 -2
- package/dist/types/src/components/SpaceMain/index.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettingsPanel.d.ts.map +0 -1
- package/src/components/SpaceMain/SpaceMain.tsx +0 -60
- package/src/components/SpaceMain/SpaceMembersSection.tsx +0 -205
- package/src/components/SpaceMain/index.ts +0 -5
- /package/dist/types/src/components/{SpaceSettingsPanel.d.ts → SpaceSettings/SpaceSettingsPanel.d.ts} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
SPACE_PLUGIN_SHORT_ID,
|
|
5
5
|
SpaceAction,
|
|
6
6
|
meta_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DVUZ7A7G.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ActorSchema,
|
|
10
10
|
ChannelType,
|
|
@@ -16,26 +16,26 @@ import {
|
|
|
16
16
|
ThreadStatus,
|
|
17
17
|
ThreadType,
|
|
18
18
|
parseSpaceInitPlugin
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MCEAI4CV.mjs";
|
|
20
20
|
|
|
21
21
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
22
22
|
import { signal } from "@preact/signals-core";
|
|
23
23
|
import React17 from "react";
|
|
24
|
-
import { LayoutAction as LayoutAction2, NavigationAction as
|
|
24
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction4, Surface, findPlugin, firstIdInPart, openIds, parseGraphPlugin, parseIntentPlugin as parseIntentPlugin2, parseLayoutPlugin, parseMetadataResolverPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
25
25
|
import { EventSubscriptions } from "@dxos/async";
|
|
26
26
|
import { isReactiveObject as isReactiveObject2 } from "@dxos/echo-schema";
|
|
27
27
|
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
28
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
28
29
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
29
30
|
import { log as log3 } from "@dxos/log";
|
|
30
31
|
import { Migrations as Migrations2 } from "@dxos/migrations";
|
|
31
32
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
32
33
|
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
33
34
|
import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
|
|
34
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
35
|
+
import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/meta";
|
|
35
36
|
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
36
|
-
import { Expando, Filter, SpaceState as
|
|
37
|
-
import {
|
|
38
|
-
import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
|
|
37
|
+
import { Expando, Filter, SpaceState as SpaceState2, create as create2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace4, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace2, loadObjectReferences, parseId, FQ_ID_LENGTH } from "@dxos/react-client/echo";
|
|
38
|
+
import { osTranslations } from "@dxos/shell/react";
|
|
39
39
|
import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
|
|
40
40
|
|
|
41
41
|
// packages/plugins/plugin-space/src/components/AwaitingObject.tsx
|
|
@@ -71,7 +71,7 @@ var AwaitingObject = ({ id }) => {
|
|
|
71
71
|
useEffect(() => {
|
|
72
72
|
if (objects.findIndex((object) => fullyQualifiedId(object) === id) > -1) {
|
|
73
73
|
setFound(true);
|
|
74
|
-
if (navigationPlugin?.provides.location.active === id) {
|
|
74
|
+
if (navigationPlugin?.provides.location.active.solo?.[0].id === id) {
|
|
75
75
|
setOpen(false);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -178,15 +178,105 @@ var DefaultObjectSettings = ({ object }) => {
|
|
|
178
178
|
})));
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
+
// packages/plugins/plugin-space/src/components/JoinDialog.tsx
|
|
182
|
+
import React5, { useCallback } from "react";
|
|
183
|
+
import { LayoutAction, NavigationAction as NavigationAction2, useIntentDispatcher } from "@dxos/app-framework";
|
|
184
|
+
import { useGraph } from "@dxos/plugin-graph";
|
|
185
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
186
|
+
import { useSpaces } from "@dxos/react-client/echo";
|
|
187
|
+
import { Dialog, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
188
|
+
import { JoinPanel } from "@dxos/shell/react";
|
|
189
|
+
var JoinDialog = ({ navigableCollections, ...props }) => {
|
|
190
|
+
const { t } = useTranslation5(SPACE_PLUGIN);
|
|
191
|
+
const dispatch = useIntentDispatcher();
|
|
192
|
+
const spaces = useSpaces();
|
|
193
|
+
const { graph } = useGraph();
|
|
194
|
+
const handleDone = useCallback(async (result) => {
|
|
195
|
+
if (result?.spaceKey) {
|
|
196
|
+
await Promise.all([
|
|
197
|
+
dispatch({
|
|
198
|
+
action: LayoutAction.SET_LAYOUT,
|
|
199
|
+
data: {
|
|
200
|
+
element: "toast",
|
|
201
|
+
subject: {
|
|
202
|
+
id: `${SPACE_PLUGIN}/join-success`,
|
|
203
|
+
duration: 5e3,
|
|
204
|
+
title: t("join success label"),
|
|
205
|
+
closeLabel: t("dismiss label")
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
dispatch({
|
|
210
|
+
action: LayoutAction.SET_LAYOUT,
|
|
211
|
+
data: {
|
|
212
|
+
element: "dialog",
|
|
213
|
+
state: false
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
const space = spaces.find(({ key }) => result?.spaceKey?.equals(key));
|
|
219
|
+
const target = result?.target || (navigableCollections ? space?.id : void 0);
|
|
220
|
+
if (target) {
|
|
221
|
+
await graph.waitForPath({
|
|
222
|
+
target
|
|
223
|
+
}).catch(() => {
|
|
224
|
+
});
|
|
225
|
+
await Promise.all([
|
|
226
|
+
dispatch({
|
|
227
|
+
action: NavigationAction2.OPEN,
|
|
228
|
+
data: {
|
|
229
|
+
activeParts: {
|
|
230
|
+
main: [
|
|
231
|
+
target
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}),
|
|
236
|
+
dispatch({
|
|
237
|
+
action: NavigationAction2.EXPOSE,
|
|
238
|
+
data: {
|
|
239
|
+
id: target
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
]);
|
|
243
|
+
}
|
|
244
|
+
if (space) {
|
|
245
|
+
await dispatch({
|
|
246
|
+
action: ObservabilityAction.SEND_EVENT,
|
|
247
|
+
data: {
|
|
248
|
+
name: "space.join",
|
|
249
|
+
properties: {
|
|
250
|
+
spaceId: space.id
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}, [
|
|
256
|
+
dispatch,
|
|
257
|
+
spaces
|
|
258
|
+
]);
|
|
259
|
+
return /* @__PURE__ */ React5.createElement(Dialog.Content, null, /* @__PURE__ */ React5.createElement(JoinPanel, {
|
|
260
|
+
...props,
|
|
261
|
+
exitActionParent: /* @__PURE__ */ React5.createElement(Dialog.Close, {
|
|
262
|
+
asChild: true
|
|
263
|
+
}),
|
|
264
|
+
doneActionParent: /* @__PURE__ */ React5.createElement(Dialog.Close, {
|
|
265
|
+
asChild: true
|
|
266
|
+
}),
|
|
267
|
+
onDone: handleDone
|
|
268
|
+
}));
|
|
269
|
+
};
|
|
270
|
+
|
|
181
271
|
// packages/plugins/plugin-space/src/components/MenuFooter.tsx
|
|
182
272
|
import { Planet } from "@phosphor-icons/react";
|
|
183
|
-
import
|
|
273
|
+
import React6 from "react";
|
|
184
274
|
import { getSpace as getSpace2 } from "@dxos/client/echo";
|
|
185
275
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
186
|
-
import { DropdownMenu, toLocalizedString, useTranslation as
|
|
276
|
+
import { DropdownMenu, toLocalizedString, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
187
277
|
|
|
188
278
|
// packages/plugins/plugin-space/src/util.tsx
|
|
189
|
-
import { NavigationAction as
|
|
279
|
+
import { NavigationAction as NavigationAction3 } from "@dxos/app-framework";
|
|
190
280
|
import { create, isReactiveObject, getTypename, getSchema, getObjectAnnotation, EXPANDO_TYPENAME } from "@dxos/echo-schema";
|
|
191
281
|
import { invariant } from "@dxos/invariant";
|
|
192
282
|
import { Migrations } from "@dxos/migrations";
|
|
@@ -218,8 +308,9 @@ var getSpaceDisplayName = (space, { personal, namesCache = {} } = {}) => {
|
|
|
218
308
|
}
|
|
219
309
|
];
|
|
220
310
|
};
|
|
221
|
-
var getCollectionGraphNodePartials = ({ collection, space, resolve }) => {
|
|
311
|
+
var getCollectionGraphNodePartials = ({ navigable, collection, space, resolve }) => {
|
|
222
312
|
return {
|
|
313
|
+
disabled: !navigable,
|
|
223
314
|
acceptPersistenceClass: /* @__PURE__ */ new Set([
|
|
224
315
|
"echo"
|
|
225
316
|
]),
|
|
@@ -259,13 +350,14 @@ var getCollectionGraphNodePartials = ({ collection, space, resolve }) => {
|
|
|
259
350
|
var checkPendingMigration = (space) => {
|
|
260
351
|
return space.state.get() === SpaceState.SPACE_REQUIRES_MIGRATION || space.state.get() === SpaceState.SPACE_READY && !!Migrations.versionProperty && space.properties[Migrations.versionProperty] !== Migrations.targetVersion;
|
|
261
352
|
};
|
|
262
|
-
var constructSpaceNode = ({ space, personal, namesCache, resolve }) => {
|
|
353
|
+
var constructSpaceNode = ({ space, navigable = false, personal, namesCache, resolve }) => {
|
|
263
354
|
const hasPendingMigration = checkPendingMigration(space);
|
|
264
355
|
const collection = space.state.get() === SpaceState.SPACE_READY && space.properties[CollectionType.typename];
|
|
265
356
|
const partials = space.state.get() === SpaceState.SPACE_READY && collection instanceof CollectionType ? getCollectionGraphNodePartials({
|
|
266
357
|
collection,
|
|
267
358
|
space,
|
|
268
|
-
resolve
|
|
359
|
+
resolve,
|
|
360
|
+
navigable
|
|
269
361
|
}) : {};
|
|
270
362
|
return {
|
|
271
363
|
id: space.id,
|
|
@@ -279,12 +371,12 @@ var constructSpaceNode = ({ space, personal, namesCache, resolve }) => {
|
|
|
279
371
|
}),
|
|
280
372
|
description: space.state.get() === SpaceState.SPACE_READY && space.properties.description,
|
|
281
373
|
icon: "ph--planet--regular",
|
|
282
|
-
disabled: space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
374
|
+
disabled: !navigable || space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
283
375
|
testId: "spacePlugin.space"
|
|
284
376
|
}
|
|
285
377
|
};
|
|
286
378
|
};
|
|
287
|
-
var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
379
|
+
var constructSpaceActionGroups = ({ space, navigable, dispatch }) => {
|
|
288
380
|
const state = space.state.get();
|
|
289
381
|
const hasPendingMigration = checkPendingMigration(space);
|
|
290
382
|
const getId = (id) => `${id}/${space.id}`;
|
|
@@ -306,8 +398,6 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
306
398
|
],
|
|
307
399
|
icon: "ph--plus--regular",
|
|
308
400
|
disposition: "toolbar",
|
|
309
|
-
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
310
|
-
// mainAreaDisposition: 'in-flow',
|
|
311
401
|
menuType: "searchList",
|
|
312
402
|
testId: "spacePlugin.createObject"
|
|
313
403
|
},
|
|
@@ -327,9 +417,11 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
327
417
|
})
|
|
328
418
|
}
|
|
329
419
|
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
420
|
+
...navigable ? [
|
|
421
|
+
{
|
|
422
|
+
action: NavigationAction3.OPEN
|
|
423
|
+
}
|
|
424
|
+
] : []
|
|
333
425
|
]),
|
|
334
426
|
properties: {
|
|
335
427
|
label: [
|
|
@@ -374,7 +466,6 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
374
466
|
],
|
|
375
467
|
icon: "ph--database--regular",
|
|
376
468
|
disposition: "toolbar",
|
|
377
|
-
mainAreaDisposition: "in-flow",
|
|
378
469
|
disabled: migrating || Migrations.running(space)
|
|
379
470
|
}
|
|
380
471
|
});
|
|
@@ -392,7 +483,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
392
483
|
plugin: SPACE_PLUGIN,
|
|
393
484
|
action: SpaceAction.SHARE,
|
|
394
485
|
data: {
|
|
395
|
-
|
|
486
|
+
space
|
|
396
487
|
}
|
|
397
488
|
});
|
|
398
489
|
},
|
|
@@ -408,8 +499,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
408
499
|
keyBinding: {
|
|
409
500
|
macos: "meta+.",
|
|
410
501
|
windows: "alt+."
|
|
411
|
-
}
|
|
412
|
-
mainAreaDisposition: "absent"
|
|
502
|
+
}
|
|
413
503
|
}
|
|
414
504
|
}, {
|
|
415
505
|
id: locked ? getId(SpaceAction.UNLOCK) : getId(SpaceAction.LOCK),
|
|
@@ -456,8 +546,28 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
456
546
|
keyBinding: {
|
|
457
547
|
macos: "shift+F6",
|
|
458
548
|
windows: "shift+F6"
|
|
459
|
-
}
|
|
460
|
-
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}, {
|
|
552
|
+
id: getId(SpaceAction.OPEN_SETTINGS),
|
|
553
|
+
type: ACTION_TYPE,
|
|
554
|
+
data: async () => {
|
|
555
|
+
await dispatch({
|
|
556
|
+
plugin: SPACE_PLUGIN,
|
|
557
|
+
action: SpaceAction.OPEN_SETTINGS,
|
|
558
|
+
data: {
|
|
559
|
+
space
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
},
|
|
563
|
+
properties: {
|
|
564
|
+
label: [
|
|
565
|
+
"open space settings label",
|
|
566
|
+
{
|
|
567
|
+
ns: SPACE_PLUGIN
|
|
568
|
+
}
|
|
569
|
+
],
|
|
570
|
+
icon: "ph--gear--regular"
|
|
461
571
|
}
|
|
462
572
|
});
|
|
463
573
|
}
|
|
@@ -482,7 +592,6 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
482
592
|
}
|
|
483
593
|
],
|
|
484
594
|
icon: "ph--x--regular",
|
|
485
|
-
mainAreaDisposition: "menu",
|
|
486
595
|
disabled: personal
|
|
487
596
|
}
|
|
488
597
|
});
|
|
@@ -508,14 +617,13 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
508
617
|
}
|
|
509
618
|
],
|
|
510
619
|
icon: "ph--clock-counter-clockwise--regular",
|
|
511
|
-
disposition: "toolbar"
|
|
512
|
-
mainAreaDisposition: "in-flow"
|
|
620
|
+
disposition: "toolbar"
|
|
513
621
|
}
|
|
514
622
|
});
|
|
515
623
|
}
|
|
516
624
|
return actions;
|
|
517
625
|
};
|
|
518
|
-
var createObjectNode = ({ object, space, resolve }) => {
|
|
626
|
+
var createObjectNode = ({ object, space, navigable = false, resolve }) => {
|
|
519
627
|
const type = getTypename(object);
|
|
520
628
|
if (!type) {
|
|
521
629
|
return void 0;
|
|
@@ -527,7 +635,8 @@ var createObjectNode = ({ object, space, resolve }) => {
|
|
|
527
635
|
const partials = object instanceof CollectionType ? getCollectionGraphNodePartials({
|
|
528
636
|
collection: object,
|
|
529
637
|
space,
|
|
530
|
-
resolve
|
|
638
|
+
resolve,
|
|
639
|
+
navigable
|
|
531
640
|
}) : metadata.graphProps;
|
|
532
641
|
return {
|
|
533
642
|
id: fullyQualifiedId2(object),
|
|
@@ -548,7 +657,7 @@ var createObjectNode = ({ object, space, resolve }) => {
|
|
|
548
657
|
}
|
|
549
658
|
};
|
|
550
659
|
};
|
|
551
|
-
var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
660
|
+
var constructObjectActionGroups = ({ object, navigable, dispatch }) => {
|
|
552
661
|
if (!(object instanceof CollectionType)) {
|
|
553
662
|
return [];
|
|
554
663
|
}
|
|
@@ -568,8 +677,6 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
568
677
|
],
|
|
569
678
|
icon: "ph--plus--regular",
|
|
570
679
|
disposition: "toolbar",
|
|
571
|
-
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
572
|
-
// mainAreaDisposition: 'in-flow',
|
|
573
680
|
menuType: "searchList",
|
|
574
681
|
testId: "spacePlugin.createObject"
|
|
575
682
|
},
|
|
@@ -589,9 +696,11 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
589
696
|
})
|
|
590
697
|
}
|
|
591
698
|
},
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
699
|
+
...navigable ? [
|
|
700
|
+
{
|
|
701
|
+
action: NavigationAction3.OPEN
|
|
702
|
+
}
|
|
703
|
+
] : []
|
|
595
704
|
]),
|
|
596
705
|
properties: {
|
|
597
706
|
label: [
|
|
@@ -639,7 +748,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
639
748
|
}
|
|
640
749
|
},
|
|
641
750
|
{
|
|
642
|
-
id: getId(SpaceAction.
|
|
751
|
+
id: getId(SpaceAction.REMOVE_OBJECTS),
|
|
643
752
|
type: ACTION_TYPE,
|
|
644
753
|
data: async () => {
|
|
645
754
|
const graph = getGraph(node);
|
|
@@ -648,9 +757,11 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
648
757
|
}).find(({ data }) => data instanceof CollectionType)?.data;
|
|
649
758
|
await dispatch([
|
|
650
759
|
{
|
|
651
|
-
action: SpaceAction.
|
|
760
|
+
action: SpaceAction.REMOVE_OBJECTS,
|
|
652
761
|
data: {
|
|
653
|
-
|
|
762
|
+
objects: [
|
|
763
|
+
object
|
|
764
|
+
],
|
|
654
765
|
collection
|
|
655
766
|
}
|
|
656
767
|
}
|
|
@@ -723,7 +834,7 @@ var cloneObject = async (object, resolve, newSpace) => {
|
|
|
723
834
|
const serializer = metadata.serializer;
|
|
724
835
|
invariant(serializer, `No serializer for type: ${typename}`, {
|
|
725
836
|
F: __dxlog_file,
|
|
726
|
-
L:
|
|
837
|
+
L: 632,
|
|
727
838
|
S: void 0,
|
|
728
839
|
A: [
|
|
729
840
|
"serializer",
|
|
@@ -742,28 +853,28 @@ var cloneObject = async (object, resolve, newSpace) => {
|
|
|
742
853
|
|
|
743
854
|
// packages/plugins/plugin-space/src/components/MenuFooter.tsx
|
|
744
855
|
var MenuFooter = ({ object }) => {
|
|
745
|
-
const { t } =
|
|
856
|
+
const { t } = useTranslation6(SPACE_PLUGIN);
|
|
746
857
|
const client = useClient2();
|
|
747
858
|
const space = getSpace2(object);
|
|
748
859
|
const spaceName = space ? getSpaceDisplayName(space, {
|
|
749
860
|
personal: client.spaces.default === space
|
|
750
861
|
}) : "";
|
|
751
|
-
return space ? /* @__PURE__ */
|
|
862
|
+
return space ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React6.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React6.createElement("dl", {
|
|
752
863
|
className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
|
|
753
|
-
}, /* @__PURE__ */
|
|
864
|
+
}, /* @__PURE__ */ React6.createElement("dt", {
|
|
754
865
|
className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
|
|
755
|
-
}, t("location label")), /* @__PURE__ */
|
|
866
|
+
}, t("location label")), /* @__PURE__ */ React6.createElement("dd", {
|
|
756
867
|
className: "line-clamp-3"
|
|
757
|
-
}, /* @__PURE__ */
|
|
868
|
+
}, /* @__PURE__ */ React6.createElement(Planet, {
|
|
758
869
|
className: "inline-block mie-1"
|
|
759
870
|
}), toLocalizedString(spaceName, t)))) : null;
|
|
760
871
|
};
|
|
761
872
|
|
|
762
873
|
// packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
|
|
763
874
|
import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
|
|
764
|
-
import
|
|
875
|
+
import React7, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
765
876
|
import { debounce } from "@dxos/async";
|
|
766
|
-
import { Tooltip, useTranslation as
|
|
877
|
+
import { Tooltip, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
767
878
|
import { getSize as getSize2, mx as mx3, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
|
|
768
879
|
var Status;
|
|
769
880
|
(function(Status2) {
|
|
@@ -772,7 +883,7 @@ var Status;
|
|
|
772
883
|
Status2[Status2["ERROR"] = 2] = "ERROR";
|
|
773
884
|
})(Status || (Status = {}));
|
|
774
885
|
var PersistenceStatus = ({ db }) => {
|
|
775
|
-
const { t } =
|
|
886
|
+
const { t } = useTranslation7(SPACE_PLUGIN);
|
|
776
887
|
const [displayMessage, setDisplayMessage] = useState2(false);
|
|
777
888
|
const [status, naturalSetStatus] = useState2(0);
|
|
778
889
|
const [prevStatus, setPrevStatus] = useState2(0);
|
|
@@ -789,49 +900,49 @@ var PersistenceStatus = ({ db }) => {
|
|
|
789
900
|
]);
|
|
790
901
|
switch (status) {
|
|
791
902
|
case 2:
|
|
792
|
-
return /* @__PURE__ */
|
|
903
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
793
904
|
className: "flex items-center"
|
|
794
|
-
}, /* @__PURE__ */
|
|
905
|
+
}, /* @__PURE__ */ React7.createElement(Warning, {
|
|
795
906
|
className: mx3(getSize2(4), "me-1")
|
|
796
|
-
}), /* @__PURE__ */
|
|
907
|
+
}), /* @__PURE__ */ React7.createElement("span", {
|
|
797
908
|
className: mx3("text-sm", warningText)
|
|
798
909
|
}, t("persistence error label")));
|
|
799
910
|
case 1:
|
|
800
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
801
912
|
className: "flex items-center"
|
|
802
|
-
}, /* @__PURE__ */
|
|
913
|
+
}, /* @__PURE__ */ React7.createElement(ArrowsCounterClockwise, {
|
|
803
914
|
className: mx3(getSize2(4), "me-1")
|
|
804
|
-
}), /* @__PURE__ */
|
|
915
|
+
}), /* @__PURE__ */ React7.createElement("span", {
|
|
805
916
|
className: mx3("text-sm", staticPlaceholderText)
|
|
806
917
|
}, t("persistence pending label")));
|
|
807
918
|
case 0:
|
|
808
919
|
default:
|
|
809
|
-
return /* @__PURE__ */
|
|
920
|
+
return /* @__PURE__ */ React7.createElement(Tooltip.Root, {
|
|
810
921
|
delayDuration: 400
|
|
811
|
-
}, /* @__PURE__ */
|
|
922
|
+
}, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
|
|
812
923
|
role: "status",
|
|
813
924
|
className: "flex items-center"
|
|
814
|
-
}, /* @__PURE__ */
|
|
925
|
+
}, /* @__PURE__ */ React7.createElement(CheckCircle2, {
|
|
815
926
|
className: mx3(getSize2(4), "me-1")
|
|
816
|
-
}), displayMessage && /* @__PURE__ */
|
|
927
|
+
}), displayMessage && /* @__PURE__ */ React7.createElement("span", {
|
|
817
928
|
className: mx3("text-sm", staticPlaceholderText)
|
|
818
|
-
}, t("persisted locally label"))), /* @__PURE__ */
|
|
929
|
+
}, t("persisted locally label"))), /* @__PURE__ */ React7.createElement(Tooltip.Portal, null, /* @__PURE__ */ React7.createElement(Tooltip.Content, {
|
|
819
930
|
classNames: "z-10"
|
|
820
|
-
}, t("persisted locally message"), /* @__PURE__ */
|
|
931
|
+
}, t("persisted locally message"), /* @__PURE__ */ React7.createElement(Tooltip.Arrow, null))));
|
|
821
932
|
}
|
|
822
933
|
};
|
|
823
934
|
|
|
824
935
|
// packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
|
|
825
|
-
import
|
|
936
|
+
import React8, { useCallback as useCallback2, useRef, useState as useState3 } from "react";
|
|
826
937
|
import { log } from "@dxos/log";
|
|
827
|
-
import { Button as Button2, Input as Input2, Popover, useTranslation as
|
|
938
|
+
import { Button as Button2, Input as Input2, Popover, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
828
939
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
829
940
|
var PopoverRenameObject = ({ object: obj }) => {
|
|
830
|
-
const { t } =
|
|
941
|
+
const { t } = useTranslation8(SPACE_PLUGIN);
|
|
831
942
|
const doneButton = useRef(null);
|
|
832
943
|
const object = obj;
|
|
833
944
|
const [name, setName] = useState3(object.name || object.title || "");
|
|
834
|
-
const handleDone =
|
|
945
|
+
const handleDone = useCallback2(() => {
|
|
835
946
|
try {
|
|
836
947
|
object.name = name;
|
|
837
948
|
} catch {
|
|
@@ -852,23 +963,23 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
852
963
|
object,
|
|
853
964
|
name
|
|
854
965
|
]);
|
|
855
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
856
967
|
role: "none",
|
|
857
968
|
className: "p-1 flex gap-2"
|
|
858
|
-
}, /* @__PURE__ */
|
|
969
|
+
}, /* @__PURE__ */ React8.createElement("div", {
|
|
859
970
|
role: "none",
|
|
860
971
|
className: "flex-1"
|
|
861
|
-
}, /* @__PURE__ */
|
|
972
|
+
}, /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Label, {
|
|
862
973
|
srOnly: true
|
|
863
|
-
}, t("object name label")), /* @__PURE__ */
|
|
974
|
+
}, t("object name label")), /* @__PURE__ */ React8.createElement(Input2.TextInput, {
|
|
864
975
|
placeholder: t("object title placeholder"),
|
|
865
976
|
value: name,
|
|
866
977
|
"data-testid": "spacePlugin.renameObject.input",
|
|
867
978
|
onChange: ({ target: { value } }) => setName(value),
|
|
868
979
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
869
|
-
}))), /* @__PURE__ */
|
|
980
|
+
}))), /* @__PURE__ */ React8.createElement(Popover.Close, {
|
|
870
981
|
asChild: true
|
|
871
|
-
}, /* @__PURE__ */
|
|
982
|
+
}, /* @__PURE__ */ React8.createElement(Button2, {
|
|
872
983
|
ref: doneButton,
|
|
873
984
|
classNames: "self-stretch",
|
|
874
985
|
onClick: handleDone
|
|
@@ -878,36 +989,36 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
878
989
|
};
|
|
879
990
|
|
|
880
991
|
// packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
|
|
881
|
-
import
|
|
882
|
-
import { Button as Button3, Input as Input3, Popover as Popover2, useTranslation as
|
|
992
|
+
import React9, { useCallback as useCallback3, useRef as useRef2, useState as useState4 } from "react";
|
|
993
|
+
import { Button as Button3, Input as Input3, Popover as Popover2, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
883
994
|
var PopoverRenameSpace = ({ space }) => {
|
|
884
|
-
const { t } =
|
|
995
|
+
const { t } = useTranslation9(SPACE_PLUGIN);
|
|
885
996
|
const doneButton = useRef2(null);
|
|
886
997
|
const [name, setName] = useState4(space.properties.name ?? "");
|
|
887
|
-
const handleDone =
|
|
998
|
+
const handleDone = useCallback3(() => {
|
|
888
999
|
space.properties.name = name;
|
|
889
1000
|
}, [
|
|
890
1001
|
space,
|
|
891
1002
|
name
|
|
892
1003
|
]);
|
|
893
|
-
return /* @__PURE__ */
|
|
1004
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
894
1005
|
role: "none",
|
|
895
1006
|
className: "p-1 flex gap-2"
|
|
896
|
-
}, /* @__PURE__ */
|
|
1007
|
+
}, /* @__PURE__ */ React9.createElement("div", {
|
|
897
1008
|
role: "none",
|
|
898
1009
|
className: "flex-1"
|
|
899
|
-
}, /* @__PURE__ */
|
|
1010
|
+
}, /* @__PURE__ */ React9.createElement(Input3.Root, null, /* @__PURE__ */ React9.createElement(Input3.Label, {
|
|
900
1011
|
srOnly: true
|
|
901
|
-
}, t("space name label")), /* @__PURE__ */
|
|
1012
|
+
}, t("space name label")), /* @__PURE__ */ React9.createElement(Input3.TextInput, {
|
|
902
1013
|
defaultValue: space.properties.name ?? "",
|
|
903
1014
|
placeholder: t("unnamed space label"),
|
|
904
1015
|
onChange: ({ target: { value } }) => setName(value),
|
|
905
1016
|
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
906
1017
|
// Currently this is not possible because Radix does not expose the popover context.
|
|
907
1018
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
908
|
-
}))), /* @__PURE__ */
|
|
1019
|
+
}))), /* @__PURE__ */ React9.createElement(Popover2.Close, {
|
|
909
1020
|
asChild: true
|
|
910
|
-
}, /* @__PURE__ */
|
|
1021
|
+
}, /* @__PURE__ */ React9.createElement(Button3, {
|
|
911
1022
|
ref: doneButton,
|
|
912
1023
|
classNames: "self-stretch",
|
|
913
1024
|
onClick: handleDone
|
|
@@ -917,271 +1028,38 @@ var PopoverRenameSpace = ({ space }) => {
|
|
|
917
1028
|
};
|
|
918
1029
|
|
|
919
1030
|
// packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
|
|
920
|
-
import
|
|
921
|
-
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
922
|
-
import {
|
|
923
|
-
var ShareSpaceButton = ({
|
|
924
|
-
const dispatch =
|
|
925
|
-
return /* @__PURE__ */
|
|
1031
|
+
import React10 from "react";
|
|
1032
|
+
import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
1033
|
+
import { IconButton, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
1034
|
+
var ShareSpaceButton = ({ space }) => {
|
|
1035
|
+
const dispatch = useIntentDispatcher2();
|
|
1036
|
+
return /* @__PURE__ */ React10.createElement(ShareSpaceButtonImpl, {
|
|
926
1037
|
onClick: () => dispatch({
|
|
927
1038
|
action: SpaceAction.SHARE,
|
|
928
1039
|
data: {
|
|
929
|
-
|
|
1040
|
+
space
|
|
930
1041
|
}
|
|
931
1042
|
})
|
|
932
1043
|
});
|
|
933
1044
|
};
|
|
934
1045
|
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
935
|
-
const { t } = useTranslation9(SPACE_PLUGIN);
|
|
936
|
-
return /* @__PURE__ */ React9.createElement(Button4, {
|
|
937
|
-
"data-testid": "spacePlugin.shareSpaceButton",
|
|
938
|
-
onClick,
|
|
939
|
-
classNames: "mli-1"
|
|
940
|
-
}, t("share space label"));
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
944
|
-
import { Command } from "@phosphor-icons/react";
|
|
945
|
-
import React11 from "react";
|
|
946
|
-
import { Surface } from "@dxos/app-framework";
|
|
947
|
-
import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
|
|
948
|
-
import { Main, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
949
|
-
import { getSize as getSize4, mx as mx5, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
|
|
950
|
-
import { ClipboardProvider } from "@dxos/shell/react";
|
|
951
|
-
|
|
952
|
-
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMembersSection.tsx
|
|
953
|
-
import { CaretDown, Check, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
954
|
-
import React10, { useCallback as useCallback3, useState as useState5 } from "react";
|
|
955
|
-
import { LayoutAction, useIntent } from "@dxos/app-framework";
|
|
956
|
-
import { useMembers, SpaceMember, useSpaceInvitations } from "@dxos/react-client/echo";
|
|
957
|
-
import { InvitationEncoder } from "@dxos/react-client/invitations";
|
|
958
|
-
import { Invitation } from "@dxos/react-client/invitations";
|
|
959
|
-
import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
960
|
-
import { descriptionText as descriptionText2, getSize as getSize3, mx as mx4 } from "@dxos/react-ui-theme";
|
|
961
|
-
import { InvitationListItem, IdentityListItem } from "@dxos/shell/react";
|
|
962
|
-
var activeActionKeyStorageKey = "dxos:react-shell/space-manager/active-action";
|
|
963
|
-
var Presence = SpaceMember.PresenceState;
|
|
964
|
-
var handleCreateInvitationUrl = (invitationCode) => `${origin}?spaceInvitationCode=${invitationCode}`;
|
|
965
|
-
var SpaceMemberList = ({ members }) => {
|
|
966
|
-
return members.length > 0 ? /* @__PURE__ */ React10.createElement(List, {
|
|
967
|
-
classNames: "col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center"
|
|
968
|
-
}, members.map((member) => /* @__PURE__ */ React10.createElement(IdentityListItem, {
|
|
969
|
-
classNames: "contents",
|
|
970
|
-
key: member.identity.identityKey.toHex(),
|
|
971
|
-
identity: member.identity,
|
|
972
|
-
presence: member.presence
|
|
973
|
-
}))) : null;
|
|
974
|
-
};
|
|
975
|
-
var SpaceMembersSection = ({ space }) => {
|
|
976
1046
|
const { t } = useTranslation10(SPACE_PLUGIN);
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
element: "dialog",
|
|
983
|
-
state: false
|
|
984
|
-
}
|
|
985
|
-
});
|
|
986
|
-
const handleInvitationSelect = ({ invitation: invitationObservable }) => {
|
|
987
|
-
const invitation = invitationObservable.get();
|
|
988
|
-
void dispatch({
|
|
989
|
-
action: LayoutAction.SET_LAYOUT,
|
|
990
|
-
data: {
|
|
991
|
-
element: "dialog",
|
|
992
|
-
component: "dxos.org/plugin/space/InvitationManagerDialog",
|
|
993
|
-
subject: {
|
|
994
|
-
invitationUrl: handleCreateInvitationUrl(InvitationEncoder.encode(invitation)),
|
|
995
|
-
send: handleCloseDialog,
|
|
996
|
-
status: invitation.state,
|
|
997
|
-
type: invitation.type,
|
|
998
|
-
authCode: invitation.authCode,
|
|
999
|
-
id: invitation.invitationId
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
});
|
|
1003
|
-
};
|
|
1004
|
-
const inviteActions = {
|
|
1005
|
-
inviteOne: {
|
|
1006
|
-
label: t("invite one label", {
|
|
1007
|
-
ns: "os"
|
|
1008
|
-
}),
|
|
1009
|
-
description: t("invite one description", {
|
|
1010
|
-
ns: "os"
|
|
1011
|
-
}),
|
|
1012
|
-
icon: UserPlus,
|
|
1013
|
-
onClick: useCallback3(() => {
|
|
1014
|
-
space.share?.({
|
|
1015
|
-
type: Invitation.Type.INTERACTIVE,
|
|
1016
|
-
authMethod: Invitation.AuthMethod.SHARED_SECRET
|
|
1017
|
-
});
|
|
1018
|
-
}, [
|
|
1019
|
-
space
|
|
1020
|
-
])
|
|
1021
|
-
},
|
|
1022
|
-
inviteMany: {
|
|
1023
|
-
label: t("invite many label", {
|
|
1024
|
-
ns: "os"
|
|
1025
|
-
}),
|
|
1026
|
-
description: t("invite many description", {
|
|
1027
|
-
ns: "os"
|
|
1028
|
-
}),
|
|
1029
|
-
icon: UsersThree,
|
|
1030
|
-
onClick: useCallback3(() => {
|
|
1031
|
-
space.share?.({
|
|
1032
|
-
type: Invitation.Type.INTERACTIVE,
|
|
1033
|
-
authMethod: Invitation.AuthMethod.NONE,
|
|
1034
|
-
multiUse: true
|
|
1035
|
-
});
|
|
1036
|
-
}, [
|
|
1037
|
-
space
|
|
1038
|
-
])
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
|
-
const [activeActionKey, setInternalActiveActionKey] = useState5(localStorage.getItem(activeActionKeyStorageKey) ?? "inviteOne");
|
|
1042
|
-
const setActiveActionKey = (nextKey) => {
|
|
1043
|
-
setInternalActiveActionKey(nextKey);
|
|
1044
|
-
localStorage.setItem(activeActionKeyStorageKey, nextKey);
|
|
1045
|
-
};
|
|
1046
|
-
const activeAction = inviteActions[activeActionKey] ?? {};
|
|
1047
|
-
const members = useMembers(space.key).reduce((acc, member) => {
|
|
1048
|
-
acc[member.presence].push(member);
|
|
1049
|
-
return acc;
|
|
1050
|
-
}, {
|
|
1051
|
-
[Presence.ONLINE]: [],
|
|
1052
|
-
[Presence.OFFLINE]: []
|
|
1047
|
+
return /* @__PURE__ */ React10.createElement(IconButton, {
|
|
1048
|
+
"data-testid": "spacePlugin.shareSpaceButton",
|
|
1049
|
+
icon: "ph--users--regular",
|
|
1050
|
+
label: t("share space label"),
|
|
1051
|
+
onClick
|
|
1053
1052
|
});
|
|
1054
|
-
return /* @__PURE__ */ React10.createElement("section", {
|
|
1055
|
-
className: "mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min"
|
|
1056
|
-
}, /* @__PURE__ */ React10.createElement("h2", {
|
|
1057
|
-
className: "contents"
|
|
1058
|
-
}, /* @__PURE__ */ React10.createElement(UsersThree, {
|
|
1059
|
-
weight: "duotone",
|
|
1060
|
-
className: mx4(getSize3(5), "place-self-center")
|
|
1061
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
1062
|
-
className: "text-lg col-span-2"
|
|
1063
|
-
}, t("space members label"))), /* @__PURE__ */ React10.createElement("h3", {
|
|
1064
|
-
className: "col-start-2 col-span-3 text-sm italic text-description"
|
|
1065
|
-
}, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React10.createElement(List, {
|
|
1066
|
-
classNames: "col-start-2 col-span-2 gap-y-2 grid grid-cols-[var(--rail-size)_1fr_var(--rail-action)_var(--rail-action)]"
|
|
1067
|
-
}, invitations.map((invitation) => /* @__PURE__ */ React10.createElement(InvitationListItem, {
|
|
1068
|
-
reverseEffects: true,
|
|
1069
|
-
classNames: "pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid",
|
|
1070
|
-
key: invitation.get().invitationId,
|
|
1071
|
-
invitation,
|
|
1072
|
-
send: handleInvitationSelect,
|
|
1073
|
-
createInvitationUrl: handleCreateInvitationUrl
|
|
1074
|
-
}))), /* @__PURE__ */ React10.createElement(ButtonGroup, {
|
|
1075
|
-
classNames: "col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px"
|
|
1076
|
-
}, /* @__PURE__ */ React10.createElement(Button5, {
|
|
1077
|
-
classNames: "gap-2",
|
|
1078
|
-
onClick: activeAction.onClick
|
|
1079
|
-
}, /* @__PURE__ */ React10.createElement(activeAction.icon, {
|
|
1080
|
-
className: getSize3(5)
|
|
1081
|
-
}), /* @__PURE__ */ React10.createElement("span", null, t(activeAction.label, {
|
|
1082
|
-
ns: "os"
|
|
1083
|
-
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React10.createElement(DropdownMenu2.Trigger, {
|
|
1084
|
-
asChild: true
|
|
1085
|
-
}, /* @__PURE__ */ React10.createElement(Button5, {
|
|
1086
|
-
classNames: "pli-0"
|
|
1087
|
-
}, /* @__PURE__ */ React10.createElement(CaretDown, {
|
|
1088
|
-
className: getSize3(4)
|
|
1089
|
-
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React10.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
|
|
1090
|
-
return /* @__PURE__ */ React10.createElement(DropdownMenu2.CheckboxItem, {
|
|
1091
|
-
key: id,
|
|
1092
|
-
"aria-labelledby": `${id}__label`,
|
|
1093
|
-
"aria-describedby": `${id}__description`,
|
|
1094
|
-
checked: activeActionKey === id,
|
|
1095
|
-
onCheckedChange: (checked) => checked && setActiveActionKey(id),
|
|
1096
|
-
classNames: "gap-2"
|
|
1097
|
-
}, action.icon && /* @__PURE__ */ React10.createElement(action.icon, {
|
|
1098
|
-
className: getSize3(5)
|
|
1099
|
-
}), /* @__PURE__ */ React10.createElement("div", {
|
|
1100
|
-
role: "none",
|
|
1101
|
-
className: "flex-1 min-is-0 space-b-1"
|
|
1102
|
-
}, /* @__PURE__ */ React10.createElement("p", {
|
|
1103
|
-
id: `${id}__label`
|
|
1104
|
-
}, t(action.label, {
|
|
1105
|
-
ns: "os"
|
|
1106
|
-
})), action.description && /* @__PURE__ */ React10.createElement("p", {
|
|
1107
|
-
id: `${id}__description`,
|
|
1108
|
-
className: descriptionText2
|
|
1109
|
-
}, t(action.description, {
|
|
1110
|
-
ns: "os"
|
|
1111
|
-
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.ItemIndicator, {
|
|
1112
|
-
asChild: true
|
|
1113
|
-
}, /* @__PURE__ */ React10.createElement(Check, {
|
|
1114
|
-
className: getSize3(4)
|
|
1115
|
-
})));
|
|
1116
|
-
})), /* @__PURE__ */ React10.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React10.createElement("p", {
|
|
1117
|
-
className: mx4(descriptionText2, "text-center is-full mlb-2")
|
|
1118
|
-
}, t("empty space members message", {
|
|
1119
|
-
ns: "os"
|
|
1120
|
-
})) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("h3", {
|
|
1121
|
-
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1122
|
-
}, t("active space members heading", {
|
|
1123
|
-
count: members[Presence.ONLINE].length
|
|
1124
|
-
})), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
|
|
1125
|
-
members: members[Presence.ONLINE]
|
|
1126
|
-
}), /* @__PURE__ */ React10.createElement("h3", {
|
|
1127
|
-
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1128
|
-
}, t("inactive space members heading", {
|
|
1129
|
-
count: members[Presence.OFFLINE].length
|
|
1130
|
-
})), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
|
|
1131
|
-
members: members[Presence.OFFLINE]
|
|
1132
|
-
})));
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
|
-
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
1136
|
-
var KeyShortcuts = () => {
|
|
1137
|
-
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
1138
|
-
return /* @__PURE__ */ React11.createElement("section", {
|
|
1139
|
-
className: "mbe-4 col-span-4 md:col-start-5 md:col-end-7 grid grid-cols-subgrid gap-y-2 auto-rows-min"
|
|
1140
|
-
}, /* @__PURE__ */ React11.createElement("h2", {
|
|
1141
|
-
className: "contents"
|
|
1142
|
-
}, /* @__PURE__ */ React11.createElement(Command, {
|
|
1143
|
-
weight: "duotone",
|
|
1144
|
-
className: mx5(getSize4(5), "place-self-center")
|
|
1145
|
-
}), /* @__PURE__ */ React11.createElement("span", {
|
|
1146
|
-
className: "text-lg col-span-2 md:col-span-1"
|
|
1147
|
-
}, t("keyshortcuts label"))), /* @__PURE__ */ React11.createElement("div", {
|
|
1148
|
-
role: "none",
|
|
1149
|
-
className: "col-start-2 col-end-4 md:col-end-5 pie-2"
|
|
1150
|
-
}, /* @__PURE__ */ React11.createElement(Surface, {
|
|
1151
|
-
role: "keyshortcuts"
|
|
1152
|
-
})));
|
|
1153
|
-
};
|
|
1154
|
-
var spaceMainLayout = "grid gap-y-2 auto-rows-min before:bs-2 before:col-span-5 grid-cols-[var(--rail-size)_var(--rail-size)_1fr_var(--rail-size)] md:grid-cols-[var(--rail-size)_var(--rail-size)_minmax(max-content,1fr)_var(--rail-size)_var(--rail-size)_minmax(max-content,2fr)_var(--rail-size)]";
|
|
1155
|
-
var SpaceMain = ({ space, role }) => {
|
|
1156
|
-
const state = space.state.get();
|
|
1157
|
-
const ready = state === SpaceState2.SPACE_READY;
|
|
1158
|
-
const Root = role === "main" ? Main.Content : "div";
|
|
1159
|
-
return /* @__PURE__ */ React11.createElement(ClipboardProvider, null, /* @__PURE__ */ React11.createElement(Root, {
|
|
1160
|
-
...role === "main" ? {
|
|
1161
|
-
classNames: [
|
|
1162
|
-
topbarBlockPaddingStart,
|
|
1163
|
-
"min-bs-dvh",
|
|
1164
|
-
spaceMainLayout
|
|
1165
|
-
]
|
|
1166
|
-
} : {
|
|
1167
|
-
role: "none",
|
|
1168
|
-
className: mx5(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
|
|
1169
|
-
},
|
|
1170
|
-
"data-testid": `spacePlugin.${role}`,
|
|
1171
|
-
"data-isready": ready ? "true" : "false"
|
|
1172
|
-
}, ready && /* @__PURE__ */ React11.createElement(SpaceMembersSection, {
|
|
1173
|
-
space
|
|
1174
|
-
}), /* @__PURE__ */ React11.createElement(KeyShortcuts, null)));
|
|
1175
1053
|
};
|
|
1176
1054
|
|
|
1177
1055
|
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1178
|
-
import
|
|
1056
|
+
import React11, { useCallback as useCallback4, useEffect as useEffect3, useState as useState5 } from "react";
|
|
1179
1057
|
import { usePlugin } from "@dxos/app-framework";
|
|
1180
1058
|
import { generateName } from "@dxos/display-name";
|
|
1181
1059
|
import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
|
|
1182
|
-
import { getSpace as getSpace3, useMembers
|
|
1060
|
+
import { getSpace as getSpace3, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
|
|
1183
1061
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
1184
|
-
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as
|
|
1062
|
+
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation11, List, ListItem, useDefaultValue } from "@dxos/react-ui";
|
|
1185
1063
|
import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
|
|
1186
1064
|
import { ComplexMap, keyToFallback } from "@dxos/util";
|
|
1187
1065
|
var REFRESH_INTERVAL = 5e3;
|
|
@@ -1193,8 +1071,8 @@ var SpacePresence = ({ object, spaceKey }) => {
|
|
|
1193
1071
|
const client = useClient3();
|
|
1194
1072
|
const identity = useIdentity();
|
|
1195
1073
|
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
|
|
1196
|
-
const spaceMembers =
|
|
1197
|
-
const [_moment, setMoment] =
|
|
1074
|
+
const spaceMembers = useMembers(space?.key);
|
|
1075
|
+
const [_moment, setMoment] = useState5(Date.now());
|
|
1198
1076
|
useEffect3(() => {
|
|
1199
1077
|
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1200
1078
|
return () => clearInterval(interval);
|
|
@@ -1218,7 +1096,7 @@ var SpacePresence = ({ object, spaceKey }) => {
|
|
|
1218
1096
|
lastSeen
|
|
1219
1097
|
};
|
|
1220
1098
|
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1221
|
-
return /* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ React11.createElement(FullPresence, {
|
|
1222
1100
|
members: membersForObject
|
|
1223
1101
|
});
|
|
1224
1102
|
};
|
|
@@ -1228,38 +1106,38 @@ var FullPresence = (props) => {
|
|
|
1228
1106
|
if (members.length === 0) {
|
|
1229
1107
|
return null;
|
|
1230
1108
|
}
|
|
1231
|
-
return /* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ React11.createElement(AvatarGroup.Root, {
|
|
1232
1110
|
size,
|
|
1233
1111
|
classNames: "mbs-2 mie-4",
|
|
1234
1112
|
"data-testid": "spacePlugin.presence"
|
|
1235
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */
|
|
1113
|
+
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React11.createElement(Tooltip2.Root, {
|
|
1236
1114
|
key: member.identity.identityKey.toHex()
|
|
1237
|
-
}, /* @__PURE__ */
|
|
1115
|
+
}, /* @__PURE__ */ React11.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React11.createElement(PrensenceAvatar, {
|
|
1238
1116
|
identity: member.identity,
|
|
1239
1117
|
group: true,
|
|
1240
1118
|
match: member.currentlyAttended,
|
|
1241
1119
|
index: members.length - i,
|
|
1242
1120
|
onClick: () => onMemberClick?.(member)
|
|
1243
|
-
})), /* @__PURE__ */
|
|
1121
|
+
})), /* @__PURE__ */ React11.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React11.createElement(Tooltip2.Content, {
|
|
1244
1122
|
side: "bottom"
|
|
1245
|
-
}, /* @__PURE__ */
|
|
1123
|
+
}, /* @__PURE__ */ React11.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React11.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React11.createElement(Tooltip2.Root, null, /* @__PURE__ */ React11.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React11.createElement(AvatarGroupItem.Root, {
|
|
1246
1124
|
status: "inactive"
|
|
1247
|
-
}, /* @__PURE__ */
|
|
1125
|
+
}, /* @__PURE__ */ React11.createElement(Avatar.Frame, {
|
|
1248
1126
|
style: {
|
|
1249
1127
|
zIndex: members.length - 4
|
|
1250
1128
|
}
|
|
1251
|
-
}, /* @__PURE__ */
|
|
1129
|
+
}, /* @__PURE__ */ React11.createElement(Avatar.Fallback, {
|
|
1252
1130
|
text: `+${members.length - 3}`
|
|
1253
|
-
})))), /* @__PURE__ */
|
|
1131
|
+
})))), /* @__PURE__ */ React11.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React11.createElement(Tooltip2.Content, {
|
|
1254
1132
|
side: "bottom"
|
|
1255
|
-
}, /* @__PURE__ */
|
|
1133
|
+
}, /* @__PURE__ */ React11.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React11.createElement(List, {
|
|
1256
1134
|
classNames: "max-h-56 overflow-y-auto"
|
|
1257
|
-
}, members.map((member) => /* @__PURE__ */
|
|
1135
|
+
}, members.map((member) => /* @__PURE__ */ React11.createElement(ListItem.Root, {
|
|
1258
1136
|
key: member.identity.identityKey.toHex(),
|
|
1259
1137
|
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1260
1138
|
onClick: () => onMemberClick?.(member),
|
|
1261
1139
|
"data-testid": "identity-list-item"
|
|
1262
|
-
}, /* @__PURE__ */
|
|
1140
|
+
}, /* @__PURE__ */ React11.createElement(PrensenceAvatar, {
|
|
1263
1141
|
identity: member.identity,
|
|
1264
1142
|
showName: true,
|
|
1265
1143
|
match: member.currentlyAttended
|
|
@@ -1269,10 +1147,10 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1269
1147
|
const Root = group ? AvatarGroupItem.Root : Avatar.Root;
|
|
1270
1148
|
const status = match ? "current" : "active";
|
|
1271
1149
|
const fallbackValue = keyToFallback(identity.identityKey);
|
|
1272
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1273
1151
|
status,
|
|
1274
1152
|
hue: identity.profile?.data?.hue || fallbackValue.hue
|
|
1275
|
-
}, /* @__PURE__ */
|
|
1153
|
+
}, /* @__PURE__ */ React11.createElement(Avatar.Frame, {
|
|
1276
1154
|
"data-testid": "spacePlugin.presence.member",
|
|
1277
1155
|
"data-status": status,
|
|
1278
1156
|
...index ? {
|
|
@@ -1281,9 +1159,9 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1281
1159
|
}
|
|
1282
1160
|
} : {},
|
|
1283
1161
|
onClick: () => onClick?.()
|
|
1284
|
-
}, /* @__PURE__ */
|
|
1162
|
+
}, /* @__PURE__ */ React11.createElement(Avatar.Fallback, {
|
|
1285
1163
|
text: identity.profile?.data?.emoji || fallbackValue.emoji
|
|
1286
|
-
})), showName && /* @__PURE__ */
|
|
1164
|
+
})), showName && /* @__PURE__ */ React11.createElement(Avatar.Label, {
|
|
1287
1165
|
classNames: "text-sm truncate pli-2"
|
|
1288
1166
|
}, getName(identity)));
|
|
1289
1167
|
};
|
|
@@ -1292,7 +1170,7 @@ var SmallPresenceLive = ({ id, viewers }) => {
|
|
|
1292
1170
|
const moment = Date.now();
|
|
1293
1171
|
return Array.from(viewers2.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION);
|
|
1294
1172
|
};
|
|
1295
|
-
const [activeViewers, setActiveViewers] =
|
|
1173
|
+
const [activeViewers, setActiveViewers] = useState5(viewers ? getActiveViewers(viewers) : []);
|
|
1296
1174
|
useEffect3(() => {
|
|
1297
1175
|
if (viewers) {
|
|
1298
1176
|
setActiveViewers(getActiveViewers(viewers));
|
|
@@ -1304,44 +1182,44 @@ var SmallPresenceLive = ({ id, viewers }) => {
|
|
|
1304
1182
|
}, [
|
|
1305
1183
|
viewers
|
|
1306
1184
|
]);
|
|
1307
|
-
return /* @__PURE__ */
|
|
1185
|
+
return /* @__PURE__ */ React11.createElement(SmallPresence, {
|
|
1308
1186
|
id,
|
|
1309
1187
|
count: activeViewers.length
|
|
1310
1188
|
});
|
|
1311
1189
|
};
|
|
1312
1190
|
var SmallPresence = ({ id, count }) => {
|
|
1313
|
-
const { t } =
|
|
1191
|
+
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
1314
1192
|
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1315
1193
|
const attention = hasAttention || isAncestor || isRelated;
|
|
1316
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ React11.createElement(Tooltip2.Root, null, /* @__PURE__ */ React11.createElement(Tooltip2.Trigger, {
|
|
1317
1195
|
asChild: true
|
|
1318
|
-
}, /* @__PURE__ */
|
|
1196
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1319
1197
|
role: "none",
|
|
1320
1198
|
className: "flex",
|
|
1321
1199
|
"data-attention": attention
|
|
1322
|
-
}, /* @__PURE__ */
|
|
1200
|
+
}, /* @__PURE__ */ React11.createElement(AttentionGlyph, {
|
|
1323
1201
|
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1324
1202
|
classNames: "self-center mie-1"
|
|
1325
|
-
}))), /* @__PURE__ */
|
|
1203
|
+
}))), /* @__PURE__ */ React11.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React11.createElement(Tooltip2.Content, {
|
|
1326
1204
|
side: "bottom",
|
|
1327
1205
|
classNames: "z-[70]"
|
|
1328
|
-
}, /* @__PURE__ */
|
|
1206
|
+
}, /* @__PURE__ */ React11.createElement("span", null, t("presence label", {
|
|
1329
1207
|
count
|
|
1330
|
-
})), /* @__PURE__ */
|
|
1208
|
+
})), /* @__PURE__ */ React11.createElement(Tooltip2.Arrow, null))));
|
|
1331
1209
|
};
|
|
1332
1210
|
|
|
1333
|
-
// packages/plugins/plugin-space/src/components/
|
|
1334
|
-
import
|
|
1335
|
-
import { useIntentDispatcher as
|
|
1336
|
-
import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as
|
|
1211
|
+
// packages/plugins/plugin-space/src/components/SpacePluginSettings.tsx
|
|
1212
|
+
import React12 from "react";
|
|
1213
|
+
import { useIntentDispatcher as useIntentDispatcher3, useResolvePlugins } from "@dxos/app-framework";
|
|
1214
|
+
import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation12 } from "@dxos/react-ui";
|
|
1337
1215
|
import { DeprecatedFormInput } from "@dxos/react-ui-data";
|
|
1338
|
-
var
|
|
1339
|
-
const { t } =
|
|
1340
|
-
const dispatch =
|
|
1216
|
+
var SpacePluginSettings = ({ settings }) => {
|
|
1217
|
+
const { t } = useTranslation12(SPACE_PLUGIN);
|
|
1218
|
+
const dispatch = useIntentDispatcher3();
|
|
1341
1219
|
const plugins = useResolvePlugins(parseSpaceInitPlugin);
|
|
1342
|
-
return /* @__PURE__ */
|
|
1220
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(DeprecatedFormInput, {
|
|
1343
1221
|
label: t("show hidden spaces label")
|
|
1344
|
-
}, /* @__PURE__ */
|
|
1222
|
+
}, /* @__PURE__ */ React12.createElement(Input4.Switch, {
|
|
1345
1223
|
checked: settings.showHidden,
|
|
1346
1224
|
onCheckedChange: (checked) => dispatch({
|
|
1347
1225
|
plugin: SPACE_PLUGIN,
|
|
@@ -1350,41 +1228,49 @@ var SpaceSettings = ({ settings }) => {
|
|
|
1350
1228
|
state: !!checked
|
|
1351
1229
|
}
|
|
1352
1230
|
})
|
|
1353
|
-
})), /* @__PURE__ */
|
|
1231
|
+
})), /* @__PURE__ */ React12.createElement(DeprecatedFormInput, {
|
|
1354
1232
|
label: t("default on space create label")
|
|
1355
|
-
}, /* @__PURE__ */
|
|
1233
|
+
}, /* @__PURE__ */ React12.createElement(Select.Root, {
|
|
1356
1234
|
value: settings.onSpaceCreate,
|
|
1357
1235
|
onValueChange: (value) => {
|
|
1358
1236
|
settings.onSpaceCreate = value;
|
|
1359
1237
|
}
|
|
1360
|
-
}, /* @__PURE__ */
|
|
1238
|
+
}, /* @__PURE__ */ React12.createElement(Select.TriggerButton, null), /* @__PURE__ */ React12.createElement(Select.Portal, null, /* @__PURE__ */ React12.createElement(Select.Content, null, /* @__PURE__ */ React12.createElement(Select.Viewport, null, plugins.map(({ provides: { space: { onSpaceCreate } } }) => /* @__PURE__ */ React12.createElement(Select.Option, {
|
|
1361
1239
|
key: onSpaceCreate.action,
|
|
1362
1240
|
value: onSpaceCreate.action
|
|
1363
1241
|
}, toLocalizedString2(onSpaceCreate.label, t)))))))));
|
|
1364
1242
|
};
|
|
1365
1243
|
|
|
1366
|
-
// packages/plugins/plugin-space/src/components/
|
|
1367
|
-
import React14, {
|
|
1244
|
+
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1245
|
+
import React14, { useState as useState7 } from "react";
|
|
1246
|
+
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1247
|
+
import { Button as Button4, Dialog as Dialog2, Icon, toLocalizedString as toLocalizedString3, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1248
|
+
import { Tabs } from "@dxos/react-ui-tabs";
|
|
1249
|
+
import { ClipboardProvider, SpacePanel } from "@dxos/shell/react";
|
|
1250
|
+
|
|
1251
|
+
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx
|
|
1252
|
+
import React13, { useCallback as useCallback5, useState as useState6 } from "react";
|
|
1368
1253
|
import { log as log2 } from "@dxos/log";
|
|
1369
1254
|
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1370
1255
|
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1371
1256
|
import { DeviceType, useDevices } from "@dxos/react-client/halo";
|
|
1372
|
-
import { Input as Input5, useTranslation as
|
|
1373
|
-
|
|
1257
|
+
import { Input as Input5, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1258
|
+
import { DeprecatedFormInput as DeprecatedFormInput2 } from "@dxos/react-ui-data";
|
|
1259
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx";
|
|
1374
1260
|
var SpaceSettingsPanel = ({ space }) => {
|
|
1375
|
-
const { t } =
|
|
1261
|
+
const { t } = useTranslation13(SPACE_PLUGIN);
|
|
1376
1262
|
const client = useClient4();
|
|
1377
1263
|
const devices = useDevices();
|
|
1378
1264
|
const managedDeviceAvailable = devices.find((device) => device.profile?.type === DeviceType.AGENT_MANAGED);
|
|
1379
1265
|
const edgeAgents = Boolean(client.config.values.runtime?.client?.edgeFeatures?.agents);
|
|
1380
1266
|
const edgeReplicationAvailable = edgeAgents && managedDeviceAvailable;
|
|
1381
|
-
const [edgeReplication, setEdgeReplication] =
|
|
1267
|
+
const [edgeReplication, setEdgeReplication] = useState6(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
|
|
1382
1268
|
const toggleEdgeReplication = useCallback5(async (next) => {
|
|
1383
1269
|
setEdgeReplication(next);
|
|
1384
1270
|
await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1385
1271
|
log2.catch(err, void 0, {
|
|
1386
1272
|
F: __dxlog_file3,
|
|
1387
|
-
L:
|
|
1273
|
+
L: 39,
|
|
1388
1274
|
S: void 0,
|
|
1389
1275
|
C: (f, a) => f(...a)
|
|
1390
1276
|
});
|
|
@@ -1393,39 +1279,117 @@ var SpaceSettingsPanel = ({ space }) => {
|
|
|
1393
1279
|
}, [
|
|
1394
1280
|
space
|
|
1395
1281
|
]);
|
|
1396
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1397
1283
|
role: "form",
|
|
1398
|
-
className: "flex flex-col
|
|
1399
|
-
}, /* @__PURE__ */
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
placeholder: t("name placeholder"),
|
|
1284
|
+
className: "flex flex-col"
|
|
1285
|
+
}, /* @__PURE__ */ React13.createElement(DeprecatedFormInput2, {
|
|
1286
|
+
label: t("name label")
|
|
1287
|
+
}, /* @__PURE__ */ React13.createElement(Input5.TextInput, {
|
|
1288
|
+
placeholder: t("unnamed space label"),
|
|
1404
1289
|
value: space.properties.name ?? "",
|
|
1405
1290
|
onChange: (event) => {
|
|
1406
1291
|
space.properties.name = event.target.value;
|
|
1407
1292
|
}
|
|
1408
|
-
}))
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
}, /* @__PURE__ */ React14.createElement(Input5.Label, null, t("edge replication label")), /* @__PURE__ */ React14.createElement(Input5.Switch, {
|
|
1293
|
+
})), edgeReplicationAvailable && /* @__PURE__ */ React13.createElement(DeprecatedFormInput2, {
|
|
1294
|
+
label: t("edge replication label")
|
|
1295
|
+
}, /* @__PURE__ */ React13.createElement(Input5.Switch, {
|
|
1412
1296
|
checked: edgeReplication,
|
|
1413
1297
|
onCheckedChange: toggleEdgeReplication
|
|
1414
|
-
})))
|
|
1298
|
+
})));
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
// packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
|
|
1302
|
+
var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "members", namesCache }) => {
|
|
1303
|
+
const { t } = useTranslation14(SPACE_PLUGIN);
|
|
1304
|
+
const client = useClient5();
|
|
1305
|
+
const [tabsActivePart, setTabsActivePart] = useState7("list");
|
|
1306
|
+
const [selected, setSelected] = useState7(initialTab);
|
|
1307
|
+
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
1308
|
+
const name = getSpaceDisplayName(space, {
|
|
1309
|
+
personal: client.spaces.default === space,
|
|
1310
|
+
namesCache
|
|
1311
|
+
});
|
|
1312
|
+
return (
|
|
1313
|
+
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
1314
|
+
// Consider factoring it out to the tabs package.
|
|
1315
|
+
/* @__PURE__ */ React14.createElement(Dialog2.Content, {
|
|
1316
|
+
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
1317
|
+
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1318
|
+
role: "none",
|
|
1319
|
+
className: "flex justify-between pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
1320
|
+
}, /* @__PURE__ */ React14.createElement(Dialog2.Title, {
|
|
1321
|
+
onClick: () => setTabsActivePart("list"),
|
|
1322
|
+
"aria-description": t("click to return to tablist description"),
|
|
1323
|
+
classNames: "flex cursor-pointer items-center group/title"
|
|
1324
|
+
}, /* @__PURE__ */ React14.createElement(Icon, {
|
|
1325
|
+
icon: "ph--caret-left--regular",
|
|
1326
|
+
size: 4,
|
|
1327
|
+
classNames: [
|
|
1328
|
+
"@md:hidden",
|
|
1329
|
+
tabsActivePart === "list" && "invisible"
|
|
1330
|
+
]
|
|
1331
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1332
|
+
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
1333
|
+
}, toLocalizedString3(name, t))), /* @__PURE__ */ React14.createElement(Dialog2.Close, {
|
|
1334
|
+
asChild: true
|
|
1335
|
+
}, /* @__PURE__ */ React14.createElement(Button4, {
|
|
1336
|
+
density: "fine",
|
|
1337
|
+
variant: "ghost",
|
|
1338
|
+
autoFocus: true
|
|
1339
|
+
}, /* @__PURE__ */ React14.createElement(Icon, {
|
|
1340
|
+
icon: "ph--x--regular",
|
|
1341
|
+
size: 3
|
|
1342
|
+
})))), /* @__PURE__ */ React14.createElement(Tabs.Root, {
|
|
1343
|
+
orientation: "vertical",
|
|
1344
|
+
value: selected,
|
|
1345
|
+
onValueChange: setSelected,
|
|
1346
|
+
activePart: tabsActivePart,
|
|
1347
|
+
onActivePartChange: setTabsActivePart,
|
|
1348
|
+
classNames: "flex flex-col flex-1 mbs-2"
|
|
1349
|
+
}, /* @__PURE__ */ React14.createElement(Tabs.Viewport, {
|
|
1350
|
+
classNames: "flex-1 min-bs-0"
|
|
1351
|
+
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1352
|
+
role: "none",
|
|
1353
|
+
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
1354
|
+
}, /* @__PURE__ */ React14.createElement(Tabs.Tablist, {
|
|
1355
|
+
classNames: "flex flex-col max-bs-none min-is-[200px] gap-4 overflow-y-auto"
|
|
1356
|
+
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1357
|
+
role: "none",
|
|
1358
|
+
className: "flex flex-col ml-1"
|
|
1359
|
+
}, /* @__PURE__ */ React14.createElement(Tabs.Tab, {
|
|
1360
|
+
value: "settings"
|
|
1361
|
+
}, t("settings tab label")), /* @__PURE__ */ React14.createElement(Tabs.Tab, {
|
|
1362
|
+
value: "members",
|
|
1363
|
+
disabled: locked
|
|
1364
|
+
}, t("members tab label"))))), /* @__PURE__ */ React14.createElement(Tabs.Tabpanel, {
|
|
1365
|
+
value: "settings",
|
|
1366
|
+
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1367
|
+
}, /* @__PURE__ */ React14.createElement(SpaceSettingsPanel, {
|
|
1368
|
+
space
|
|
1369
|
+
})), /* @__PURE__ */ React14.createElement(Tabs.Tabpanel, {
|
|
1370
|
+
value: "members",
|
|
1371
|
+
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1372
|
+
}, /* @__PURE__ */ React14.createElement(ClipboardProvider, null, /* @__PURE__ */ React14.createElement(SpacePanel, {
|
|
1373
|
+
space,
|
|
1374
|
+
hideHeading: true,
|
|
1375
|
+
target,
|
|
1376
|
+
createInvitationUrl
|
|
1377
|
+
}))))))
|
|
1378
|
+
);
|
|
1415
1379
|
};
|
|
1416
1380
|
|
|
1417
1381
|
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1418
1382
|
import React16, { useEffect as useEffect6, useState as useState10 } from "react";
|
|
1419
1383
|
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1420
|
-
import { useClient as
|
|
1421
|
-
import { Icon as
|
|
1384
|
+
import { useClient as useClient7 } from "@dxos/react-client";
|
|
1385
|
+
import { Icon as Icon3, Popover as Popover3, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1422
1386
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
1423
|
-
import { mx as
|
|
1387
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
1424
1388
|
|
|
1425
1389
|
// packages/plugins/plugin-space/src/components/SyncStatus/Space.tsx
|
|
1426
1390
|
import React15, { useEffect as useEffect4, useState as useState8 } from "react";
|
|
1427
|
-
import { Icon } from "@dxos/react-ui";
|
|
1428
|
-
import { mx as
|
|
1391
|
+
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
1392
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1429
1393
|
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1430
1394
|
var styles = {
|
|
1431
1395
|
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
@@ -1459,15 +1423,15 @@ var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, mis
|
|
|
1459
1423
|
const downActive = useActive(localDocumentCount);
|
|
1460
1424
|
const upActive = useActive(remoteDocumentCount);
|
|
1461
1425
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
1462
|
-
className:
|
|
1426
|
+
className: mx4("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
|
|
1463
1427
|
title: spaceId,
|
|
1464
1428
|
onClick: () => {
|
|
1465
1429
|
void navigator.clipboard.writeText(spaceId);
|
|
1466
1430
|
}
|
|
1467
|
-
}, /* @__PURE__ */ React15.createElement(
|
|
1431
|
+
}, /* @__PURE__ */ React15.createElement(Icon2, {
|
|
1468
1432
|
icon: "ph--arrow-fat-line-left--regular",
|
|
1469
1433
|
size: 3,
|
|
1470
|
-
classNames:
|
|
1434
|
+
classNames: mx4(downActive && "animate-[pulse_1s_infinite]")
|
|
1471
1435
|
}), /* @__PURE__ */ React15.createElement(Candle, {
|
|
1472
1436
|
up: {
|
|
1473
1437
|
count: remoteDocumentCount,
|
|
@@ -1478,22 +1442,22 @@ var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, mis
|
|
|
1478
1442
|
total: localDocumentCount + missingOnLocal
|
|
1479
1443
|
},
|
|
1480
1444
|
title: spaceId
|
|
1481
|
-
}), /* @__PURE__ */ React15.createElement(
|
|
1445
|
+
}), /* @__PURE__ */ React15.createElement(Icon2, {
|
|
1482
1446
|
icon: "ph--arrow-fat-line-right--regular",
|
|
1483
1447
|
size: 3,
|
|
1484
|
-
classNames:
|
|
1448
|
+
classNames: mx4(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1485
1449
|
}));
|
|
1486
1450
|
};
|
|
1487
1451
|
var Candle = ({ classNames, up, down }) => {
|
|
1488
1452
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
1489
|
-
className:
|
|
1453
|
+
className: mx4("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1490
1454
|
}, /* @__PURE__ */ React15.createElement(Bar, {
|
|
1491
1455
|
classNames: "justify-end",
|
|
1492
1456
|
...up
|
|
1493
1457
|
}), /* @__PURE__ */ React15.createElement("div", {
|
|
1494
1458
|
className: "relative"
|
|
1495
1459
|
}, /* @__PURE__ */ React15.createElement("div", {
|
|
1496
|
-
className:
|
|
1460
|
+
className: mx4("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1497
1461
|
}, up.total)), /* @__PURE__ */ React15.createElement(Bar, down));
|
|
1498
1462
|
};
|
|
1499
1463
|
var Bar = ({ classNames, count, total }) => {
|
|
@@ -1502,9 +1466,9 @@ var Bar = ({ classNames, count, total }) => {
|
|
|
1502
1466
|
p = Math.min(p, 95);
|
|
1503
1467
|
}
|
|
1504
1468
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
1505
|
-
className:
|
|
1469
|
+
className: mx4("relative flex w-full", styles.barBg, classNames)
|
|
1506
1470
|
}, /* @__PURE__ */ React15.createElement("div", {
|
|
1507
|
-
className:
|
|
1471
|
+
className: mx4("shrink-0", styles.barFg),
|
|
1508
1472
|
style: {
|
|
1509
1473
|
width: `${p}%`
|
|
1510
1474
|
}
|
|
@@ -1608,7 +1572,7 @@ var getIcon = (status) => {
|
|
|
1608
1572
|
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
1609
1573
|
import { Context as Context2 } from "@dxos/context";
|
|
1610
1574
|
import { EdgeService } from "@dxos/protocols";
|
|
1611
|
-
import { useClient as
|
|
1575
|
+
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1612
1576
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts";
|
|
1613
1577
|
var createEmptyEdgeSyncState = () => ({
|
|
1614
1578
|
missingOnLocal: 0,
|
|
@@ -1629,7 +1593,7 @@ var getSyncSummary = (syncMap) => {
|
|
|
1629
1593
|
};
|
|
1630
1594
|
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1631
1595
|
var useSyncState = () => {
|
|
1632
|
-
const client =
|
|
1596
|
+
const client = useClient6();
|
|
1633
1597
|
const [spaceState, setSpaceState] = useState9({});
|
|
1634
1598
|
useEffect5(() => {
|
|
1635
1599
|
const ctx = new Context2(void 0, {
|
|
@@ -1667,7 +1631,7 @@ var useSyncState = () => {
|
|
|
1667
1631
|
|
|
1668
1632
|
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1669
1633
|
var SyncStatus = () => {
|
|
1670
|
-
const client =
|
|
1634
|
+
const client = useClient7();
|
|
1671
1635
|
const state = useSyncState();
|
|
1672
1636
|
const [saved, setSaved] = useState10(true);
|
|
1673
1637
|
useEffect6(() => {
|
|
@@ -1708,7 +1672,7 @@ var SyncStatusIndicator = ({ state, saved }) => {
|
|
|
1708
1672
|
needsToDownload
|
|
1709
1673
|
]);
|
|
1710
1674
|
const title = t(`${status} label`);
|
|
1711
|
-
const icon = /* @__PURE__ */ React16.createElement(
|
|
1675
|
+
const icon = /* @__PURE__ */ React16.createElement(Icon3, {
|
|
1712
1676
|
icon: getIcon(status),
|
|
1713
1677
|
size: 4,
|
|
1714
1678
|
classNames
|
|
@@ -1735,7 +1699,7 @@ var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
|
1735
1699
|
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1736
1700
|
const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1737
1701
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1738
|
-
className:
|
|
1702
|
+
className: mx5("flex flex-col gap-3 p-2 text-xs min-w-[16rem]", classNames)
|
|
1739
1703
|
}, /* @__PURE__ */ React16.createElement("h1", null, t("sync status title")), /* @__PURE__ */ React16.createElement("div", {
|
|
1740
1704
|
className: "flex flex-col gap-2"
|
|
1741
1705
|
}, entries.map(([spaceId, state2]) => /* @__PURE__ */ React16.createElement(SpaceRow, {
|
|
@@ -1791,6 +1755,7 @@ var translations_default = [
|
|
|
1791
1755
|
"delete object label": "Delete item",
|
|
1792
1756
|
"collection deleted label": "Collection deleted",
|
|
1793
1757
|
"object deleted label": "Item deleted",
|
|
1758
|
+
"objects deleted label": "Items deleted",
|
|
1794
1759
|
"go to object label": "Open item",
|
|
1795
1760
|
"found object label": "Ready.",
|
|
1796
1761
|
"found object description": "The requested object is now available.",
|
|
@@ -1840,7 +1805,10 @@ var translations_default = [
|
|
|
1840
1805
|
"uploading label": "Replicating to peers",
|
|
1841
1806
|
"offline persisted label": "Saved to disk (offline)",
|
|
1842
1807
|
"remote synced label": "Synced with peers",
|
|
1843
|
-
"open settings panel label": "Show Settings"
|
|
1808
|
+
"open settings panel label": "Show Settings",
|
|
1809
|
+
"open space settings label": "Space Settings",
|
|
1810
|
+
"members tab label": "Members",
|
|
1811
|
+
"settings tab label": "Settings"
|
|
1844
1812
|
}
|
|
1845
1813
|
}
|
|
1846
1814
|
}
|
|
@@ -1849,10 +1817,11 @@ var translations_default = [
|
|
|
1849
1817
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
1850
1818
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
|
|
1851
1819
|
var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
|
|
1820
|
+
var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
|
|
1852
1821
|
var SPACE_MAX_OBJECTS = 500;
|
|
1853
1822
|
var DIRECTORY_TYPE = "text/directory";
|
|
1854
1823
|
var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
|
|
1855
|
-
var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
1824
|
+
var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "spaceInvitationCode", firstRun, onFirstRun } = {}) => {
|
|
1856
1825
|
const settings = new LocalStorageStore(SPACE_PLUGIN, {
|
|
1857
1826
|
onSpaceCreate: "dxos.org/plugin/markdown/action/create"
|
|
1858
1827
|
});
|
|
@@ -1862,7 +1831,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1862
1831
|
viewersByObject: {},
|
|
1863
1832
|
// TODO(wittjosiah): Stop using (Complex)Map inside reactive object.
|
|
1864
1833
|
viewersByIdentity: new ComplexMap2(PublicKey2.hash),
|
|
1865
|
-
sdkMigrationRunning: {}
|
|
1834
|
+
sdkMigrationRunning: {},
|
|
1835
|
+
navigableCollections: false
|
|
1866
1836
|
});
|
|
1867
1837
|
const subscriptions = new EventSubscriptions();
|
|
1868
1838
|
const spaceSubscriptions = new EventSubscriptions();
|
|
@@ -1873,6 +1843,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1873
1843
|
let layoutPlugin;
|
|
1874
1844
|
let navigationPlugin;
|
|
1875
1845
|
let attentionPlugin;
|
|
1846
|
+
const createSpaceInvitationUrl = (invitationCode) => {
|
|
1847
|
+
const baseUrl = new URL(invitationUrl);
|
|
1848
|
+
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
1849
|
+
return baseUrl.toString();
|
|
1850
|
+
};
|
|
1876
1851
|
const onSpaceReady = async () => {
|
|
1877
1852
|
if (!clientPlugin || !intentPlugin || !graphPlugin || !navigationPlugin || !layoutPlugin || !attentionPlugin) {
|
|
1878
1853
|
return;
|
|
@@ -1905,20 +1880,26 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1905
1880
|
}
|
|
1906
1881
|
const node = graph.findNode(soloPart.id);
|
|
1907
1882
|
if (!node && soloPart.id.length === FQ_ID_LENGTH) {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1883
|
+
const timeout = setTimeout(async () => {
|
|
1884
|
+
const node2 = graph.findNode(soloPart.id);
|
|
1885
|
+
if (!node2) {
|
|
1886
|
+
await dispatch({
|
|
1887
|
+
plugin: SPACE_PLUGIN,
|
|
1888
|
+
action: SpaceAction.WAIT_FOR_OBJECT,
|
|
1889
|
+
data: {
|
|
1890
|
+
id: soloPart.id
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1913
1893
|
}
|
|
1914
|
-
});
|
|
1894
|
+
}, WAIT_FOR_OBJECT_TIMEOUT2);
|
|
1895
|
+
return () => clearTimeout(timeout);
|
|
1915
1896
|
}
|
|
1916
1897
|
}));
|
|
1917
1898
|
subscriptions.add(client.spaces.subscribe(async (spaces) => {
|
|
1918
|
-
if (defaultSpace.state.get() ===
|
|
1899
|
+
if (defaultSpace.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
1919
1900
|
await defaultSpace.internal.migrate();
|
|
1920
1901
|
}
|
|
1921
|
-
spaces.filter((space) => space.state.get() ===
|
|
1902
|
+
spaces.filter((space) => space.state.get() === SpaceState2.SPACE_READY).forEach((space) => {
|
|
1922
1903
|
subscriptions.add(scheduledEffect(() => ({
|
|
1923
1904
|
name: space.properties.name
|
|
1924
1905
|
}), ({ name }) => state.values.spaceNames[space.id] = name));
|
|
@@ -1961,7 +1942,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1961
1942
|
err: err.message
|
|
1962
1943
|
}, {
|
|
1963
1944
|
F: __dxlog_file6,
|
|
1964
|
-
L:
|
|
1945
|
+
L: 292,
|
|
1965
1946
|
S: void 0,
|
|
1966
1947
|
C: (f, a) => f(...a)
|
|
1967
1948
|
});
|
|
@@ -2019,6 +2000,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2019
2000
|
key: "spaceNames",
|
|
2020
2001
|
type: LocalStorageStore.json()
|
|
2021
2002
|
});
|
|
2003
|
+
if (findPlugin(plugins, "dxos.org/plugin/stack")) {
|
|
2004
|
+
state.values.navigableCollections = true;
|
|
2005
|
+
}
|
|
2022
2006
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
2023
2007
|
layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
|
|
2024
2008
|
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
|
|
@@ -2114,7 +2098,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2114
2098
|
component: ({ data, role, ...rest }) => {
|
|
2115
2099
|
switch (role) {
|
|
2116
2100
|
case "article":
|
|
2117
|
-
return isSpace2(data.object) && data.object.state.get() ===
|
|
2101
|
+
return isSpace2(data.object) && data.object.state.get() === SpaceState2.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface, {
|
|
2118
2102
|
data: {
|
|
2119
2103
|
object: data.object.properties[CollectionType.typename],
|
|
2120
2104
|
id: data.object.id
|
|
@@ -2137,11 +2121,13 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2137
2121
|
disposition: "fallback"
|
|
2138
2122
|
} : null;
|
|
2139
2123
|
case "dialog":
|
|
2140
|
-
if (data.component === "dxos.org/plugin/space/
|
|
2141
|
-
return /* @__PURE__ */ React17.createElement(
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
})
|
|
2124
|
+
if (data.component === "dxos.org/plugin/space/SpaceSettingsDialog") {
|
|
2125
|
+
return /* @__PURE__ */ React17.createElement(SpaceSettingsDialog, {
|
|
2126
|
+
...data.subject,
|
|
2127
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
2128
|
+
});
|
|
2129
|
+
} else if (data.component === "dxos.org/plugin/space/JoinDialog") {
|
|
2130
|
+
return /* @__PURE__ */ React17.createElement(JoinDialog, data.subject);
|
|
2145
2131
|
}
|
|
2146
2132
|
return null;
|
|
2147
2133
|
case "popover": {
|
|
@@ -2175,12 +2161,12 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2175
2161
|
return null;
|
|
2176
2162
|
}
|
|
2177
2163
|
const space = isSpace2(data.object) ? data.object : getSpace4(data.object);
|
|
2178
|
-
const object = isSpace2(data.object) ? data.object.state.get() ===
|
|
2164
|
+
const object = isSpace2(data.object) ? data.object.state.get() === SpaceState2.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
|
|
2179
2165
|
return space && object ? {
|
|
2180
2166
|
node: /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SpacePresence, {
|
|
2181
2167
|
object
|
|
2182
2168
|
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React17.createElement(ShareSpaceButton, {
|
|
2183
|
-
|
|
2169
|
+
space
|
|
2184
2170
|
})),
|
|
2185
2171
|
disposition: "hoist"
|
|
2186
2172
|
} : null;
|
|
@@ -2190,7 +2176,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2190
2176
|
collection: data.object
|
|
2191
2177
|
}) : null;
|
|
2192
2178
|
case "settings":
|
|
2193
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */ React17.createElement(
|
|
2179
|
+
return data.plugin === meta_default.id ? /* @__PURE__ */ React17.createElement(SpacePluginSettings, {
|
|
2194
2180
|
settings: settings.values
|
|
2195
2181
|
}) : null;
|
|
2196
2182
|
case "menu-footer":
|
|
@@ -2235,7 +2221,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2235
2221
|
}
|
|
2236
2222
|
});
|
|
2237
2223
|
return () => defaultSpaceUnsubscribe?.();
|
|
2238
|
-
}, () => client.spaces.isReady.get() && client.spaces.default.state.get() ===
|
|
2224
|
+
}, () => client.spaces.isReady.get() && client.spaces.default.state.get() === SpaceState2.SPACE_READY);
|
|
2239
2225
|
if (!isReady) {
|
|
2240
2226
|
return [];
|
|
2241
2227
|
}
|
|
@@ -2252,6 +2238,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2252
2238
|
],
|
|
2253
2239
|
testId: "spacePlugin.spaces",
|
|
2254
2240
|
role: "branch",
|
|
2241
|
+
disabled: true,
|
|
2255
2242
|
childrenPersistenceClass: "echo",
|
|
2256
2243
|
onRearrangeChildren: async (nextOrder) => {
|
|
2257
2244
|
graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
|
|
@@ -2263,7 +2250,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2263
2250
|
} else {
|
|
2264
2251
|
log3.warn("spaces order object not found", void 0, {
|
|
2265
2252
|
F: __dxlog_file6,
|
|
2266
|
-
L:
|
|
2253
|
+
L: 596,
|
|
2267
2254
|
S: void 0,
|
|
2268
2255
|
C: (f, a) => f(...a)
|
|
2269
2256
|
});
|
|
@@ -2282,15 +2269,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2282
2269
|
{
|
|
2283
2270
|
id: SpaceAction.CREATE,
|
|
2284
2271
|
data: async () => {
|
|
2285
|
-
await dispatch(
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
},
|
|
2290
|
-
{
|
|
2291
|
-
action: NavigationAction3.OPEN
|
|
2292
|
-
}
|
|
2293
|
-
]);
|
|
2272
|
+
await dispatch({
|
|
2273
|
+
plugin: SPACE_PLUGIN,
|
|
2274
|
+
action: SpaceAction.CREATE
|
|
2275
|
+
});
|
|
2294
2276
|
},
|
|
2295
2277
|
properties: {
|
|
2296
2278
|
label: [
|
|
@@ -2302,21 +2284,16 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2302
2284
|
icon: "ph--plus--regular",
|
|
2303
2285
|
disposition: "item",
|
|
2304
2286
|
testId: "spacePlugin.createSpace",
|
|
2305
|
-
className: "
|
|
2287
|
+
className: "border-t border-separator"
|
|
2306
2288
|
}
|
|
2307
2289
|
},
|
|
2308
2290
|
{
|
|
2309
2291
|
id: SpaceAction.JOIN,
|
|
2310
2292
|
data: async () => {
|
|
2311
|
-
await dispatch(
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
},
|
|
2316
|
-
{
|
|
2317
|
-
action: NavigationAction3.OPEN
|
|
2318
|
-
}
|
|
2319
|
-
]);
|
|
2293
|
+
await dispatch({
|
|
2294
|
+
plugin: SPACE_PLUGIN,
|
|
2295
|
+
action: SpaceAction.JOIN
|
|
2296
|
+
});
|
|
2320
2297
|
},
|
|
2321
2298
|
properties: {
|
|
2322
2299
|
label: [
|
|
@@ -2327,8 +2304,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2327
2304
|
],
|
|
2328
2305
|
icon: "ph--sign-in--regular",
|
|
2329
2306
|
disposition: "item",
|
|
2330
|
-
testId: "spacePlugin.joinSpace"
|
|
2331
|
-
className: "pbe-4"
|
|
2307
|
+
testId: "spacePlugin.joinSpace"
|
|
2332
2308
|
}
|
|
2333
2309
|
}
|
|
2334
2310
|
],
|
|
@@ -2338,23 +2314,27 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2338
2314
|
if (!spaces || !isReady) {
|
|
2339
2315
|
return;
|
|
2340
2316
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
id,
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
space
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2317
|
+
try {
|
|
2318
|
+
const [spacesOrder] = memoizeQuery(client.spaces.default, Filter.schema(Expando, {
|
|
2319
|
+
key: SHARED
|
|
2320
|
+
}));
|
|
2321
|
+
const order = spacesOrder?.order ?? [];
|
|
2322
|
+
const orderMap = new Map(order.map((id, index) => [
|
|
2323
|
+
id,
|
|
2324
|
+
index
|
|
2325
|
+
]));
|
|
2326
|
+
return [
|
|
2327
|
+
...spaces.filter((space) => orderMap.has(space.id)).sort((a, b) => orderMap.get(a.id) - orderMap.get(b.id)),
|
|
2328
|
+
...spaces.filter((space) => !orderMap.has(space.id))
|
|
2329
|
+
].filter((space) => settings.values.showHidden ? true : space.state.get() !== SpaceState2.SPACE_INACTIVE).map((space) => constructSpaceNode({
|
|
2330
|
+
space,
|
|
2331
|
+
navigable: state.values.navigableCollections,
|
|
2332
|
+
personal: space === client.spaces.default,
|
|
2333
|
+
namesCache: state.values.spaceNames,
|
|
2334
|
+
resolve
|
|
2335
|
+
}));
|
|
2336
|
+
} catch {
|
|
2337
|
+
}
|
|
2358
2338
|
}
|
|
2359
2339
|
}),
|
|
2360
2340
|
// Find an object by its fully qualified id.
|
|
@@ -2366,8 +2346,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2366
2346
|
if (!space) {
|
|
2367
2347
|
return;
|
|
2368
2348
|
}
|
|
2369
|
-
const
|
|
2370
|
-
if (
|
|
2349
|
+
const spaceState = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2350
|
+
if (spaceState !== SpaceState2.SPACE_READY) {
|
|
2371
2351
|
return;
|
|
2372
2352
|
}
|
|
2373
2353
|
const store = memoize2(() => signal(space.db.getObjectById(objectId)), id);
|
|
@@ -2383,7 +2363,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2383
2363
|
return createObjectNode({
|
|
2384
2364
|
object,
|
|
2385
2365
|
space,
|
|
2386
|
-
resolve
|
|
2366
|
+
resolve,
|
|
2367
|
+
navigable: state.values.navigableCollections
|
|
2387
2368
|
});
|
|
2388
2369
|
}
|
|
2389
2370
|
}),
|
|
@@ -2393,7 +2374,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2393
2374
|
filter: (node) => isSpace2(node.data),
|
|
2394
2375
|
actionGroups: ({ node }) => constructSpaceActionGroups({
|
|
2395
2376
|
space: node.data,
|
|
2396
|
-
dispatch
|
|
2377
|
+
dispatch,
|
|
2378
|
+
navigable: state.values.navigableCollections
|
|
2397
2379
|
}),
|
|
2398
2380
|
actions: ({ node }) => {
|
|
2399
2381
|
const space = node.data;
|
|
@@ -2411,8 +2393,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2411
2393
|
filter: (node) => isSpace2(node.data),
|
|
2412
2394
|
connector: ({ node }) => {
|
|
2413
2395
|
const space = node.data;
|
|
2414
|
-
const
|
|
2415
|
-
if (
|
|
2396
|
+
const spaceState = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2397
|
+
if (spaceState !== SpaceState2.SPACE_READY) {
|
|
2416
2398
|
return;
|
|
2417
2399
|
}
|
|
2418
2400
|
const collection = space.properties[CollectionType.typename];
|
|
@@ -2422,7 +2404,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2422
2404
|
return collection.objects.filter(nonNullable).map((object) => createObjectNode({
|
|
2423
2405
|
object,
|
|
2424
2406
|
space,
|
|
2425
|
-
resolve
|
|
2407
|
+
resolve,
|
|
2408
|
+
navigable: state.values.navigableCollections
|
|
2426
2409
|
})).filter(nonNullable);
|
|
2427
2410
|
}
|
|
2428
2411
|
}),
|
|
@@ -2432,7 +2415,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2432
2415
|
filter: (node) => isEchoObject2(node.data),
|
|
2433
2416
|
actionGroups: ({ node }) => constructObjectActionGroups({
|
|
2434
2417
|
object: node.data,
|
|
2435
|
-
dispatch
|
|
2418
|
+
dispatch,
|
|
2419
|
+
navigable: state.values.navigableCollections
|
|
2436
2420
|
}),
|
|
2437
2421
|
actions: ({ node }) => constructObjectActions({
|
|
2438
2422
|
node,
|
|
@@ -2452,7 +2436,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2452
2436
|
return collection.objects.filter(nonNullable).map((object) => createObjectNode({
|
|
2453
2437
|
object,
|
|
2454
2438
|
space,
|
|
2455
|
-
resolve
|
|
2439
|
+
resolve,
|
|
2440
|
+
navigable: state.values.navigableCollections
|
|
2456
2441
|
})).filter(nonNullable);
|
|
2457
2442
|
}
|
|
2458
2443
|
}),
|
|
@@ -2643,13 +2628,16 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2643
2628
|
}
|
|
2644
2629
|
},
|
|
2645
2630
|
{
|
|
2646
|
-
action:
|
|
2631
|
+
action: NavigationAction4.OPEN
|
|
2632
|
+
},
|
|
2633
|
+
{
|
|
2634
|
+
action: NavigationAction4.EXPOSE
|
|
2647
2635
|
}
|
|
2648
2636
|
]
|
|
2649
2637
|
] : [],
|
|
2650
2638
|
[
|
|
2651
2639
|
{
|
|
2652
|
-
action:
|
|
2640
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2653
2641
|
data: {
|
|
2654
2642
|
name: "space.create",
|
|
2655
2643
|
properties: {
|
|
@@ -2662,77 +2650,58 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2662
2650
|
};
|
|
2663
2651
|
}
|
|
2664
2652
|
case SpaceAction.JOIN: {
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
]
|
|
2678
|
-
}
|
|
2679
|
-
},
|
|
2680
|
-
intents: [
|
|
2681
|
-
[
|
|
2682
|
-
{
|
|
2683
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
2684
|
-
data: {
|
|
2685
|
-
element: "toast",
|
|
2686
|
-
subject: {
|
|
2687
|
-
id: `${SPACE_PLUGIN}/join-success`,
|
|
2688
|
-
duration: 1e4,
|
|
2689
|
-
title: translations_default[0]["en-US"][SPACE_PLUGIN]["join success label"],
|
|
2690
|
-
closeLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["dismiss label"]
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
],
|
|
2695
|
-
[
|
|
2696
|
-
{
|
|
2697
|
-
action: ObservabilityAction.SEND_EVENT,
|
|
2698
|
-
data: {
|
|
2699
|
-
name: "space.join",
|
|
2700
|
-
properties: {
|
|
2701
|
-
spaceId: space.id
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2653
|
+
return {
|
|
2654
|
+
data: true,
|
|
2655
|
+
intents: [
|
|
2656
|
+
[
|
|
2657
|
+
{
|
|
2658
|
+
action: LayoutAction2.SET_LAYOUT,
|
|
2659
|
+
data: {
|
|
2660
|
+
element: "dialog",
|
|
2661
|
+
component: "dxos.org/plugin/space/JoinDialog",
|
|
2662
|
+
dialogBlockAlign: "start",
|
|
2663
|
+
subject: {
|
|
2664
|
+
initialInvitationCode: intent.data?.invitationCode
|
|
2704
2665
|
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
]
|
|
2669
|
+
]
|
|
2670
|
+
};
|
|
2710
2671
|
break;
|
|
2711
2672
|
}
|
|
2712
2673
|
case SpaceAction.SHARE: {
|
|
2713
|
-
const
|
|
2714
|
-
if (
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
const target = firstIdInPart(navigationPlugin?.provides.location.active, "main");
|
|
2719
|
-
const result = await clientPlugin2.provides.client.shell.shareSpace({
|
|
2720
|
-
spaceId,
|
|
2721
|
-
target
|
|
2722
|
-
});
|
|
2674
|
+
const space = intent.data?.space;
|
|
2675
|
+
if (isSpace2(space) && !space.properties[COMPOSER_SPACE_LOCK]) {
|
|
2676
|
+
const active = navigationPlugin?.provides.location.active;
|
|
2677
|
+
const mode = layoutPlugin?.provides.layout.layoutMode;
|
|
2678
|
+
const target = active ? firstIdInPart(active, mode === "solo" ? "solo" : "main") : void 0;
|
|
2723
2679
|
return {
|
|
2724
|
-
data:
|
|
2680
|
+
data: true,
|
|
2725
2681
|
intents: [
|
|
2726
2682
|
[
|
|
2727
2683
|
{
|
|
2728
|
-
action:
|
|
2684
|
+
action: LayoutAction2.SET_LAYOUT,
|
|
2685
|
+
data: {
|
|
2686
|
+
element: "dialog",
|
|
2687
|
+
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
2688
|
+
dialogBlockAlign: "start",
|
|
2689
|
+
subject: {
|
|
2690
|
+
space,
|
|
2691
|
+
target,
|
|
2692
|
+
initialTab: "members",
|
|
2693
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
],
|
|
2698
|
+
[
|
|
2699
|
+
{
|
|
2700
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2729
2701
|
data: {
|
|
2730
2702
|
name: "space.share",
|
|
2731
2703
|
properties: {
|
|
2732
|
-
|
|
2733
|
-
members: result.members?.length,
|
|
2734
|
-
error: result.error?.message,
|
|
2735
|
-
cancelled: result.cancelled
|
|
2704
|
+
space: space.id
|
|
2736
2705
|
}
|
|
2737
2706
|
}
|
|
2738
2707
|
}
|
|
@@ -2751,7 +2720,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2751
2720
|
intents: [
|
|
2752
2721
|
[
|
|
2753
2722
|
{
|
|
2754
|
-
action:
|
|
2723
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2755
2724
|
data: {
|
|
2756
2725
|
name: "space.lock",
|
|
2757
2726
|
properties: {
|
|
@@ -2774,7 +2743,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2774
2743
|
intents: [
|
|
2775
2744
|
[
|
|
2776
2745
|
{
|
|
2777
|
-
action:
|
|
2746
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2778
2747
|
data: {
|
|
2779
2748
|
name: "space.unlock",
|
|
2780
2749
|
properties: {
|
|
@@ -2809,6 +2778,32 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2809
2778
|
}
|
|
2810
2779
|
break;
|
|
2811
2780
|
}
|
|
2781
|
+
case SpaceAction.OPEN_SETTINGS: {
|
|
2782
|
+
const space = intent.data?.space;
|
|
2783
|
+
if (isSpace2(space)) {
|
|
2784
|
+
return {
|
|
2785
|
+
data: true,
|
|
2786
|
+
intents: [
|
|
2787
|
+
[
|
|
2788
|
+
{
|
|
2789
|
+
action: LayoutAction2.SET_LAYOUT,
|
|
2790
|
+
data: {
|
|
2791
|
+
element: "dialog",
|
|
2792
|
+
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
2793
|
+
dialogBlockAlign: "start",
|
|
2794
|
+
subject: {
|
|
2795
|
+
space,
|
|
2796
|
+
initialTab: "settings",
|
|
2797
|
+
createInvitationUrl: createSpaceInvitationUrl
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
]
|
|
2802
|
+
]
|
|
2803
|
+
};
|
|
2804
|
+
}
|
|
2805
|
+
break;
|
|
2806
|
+
}
|
|
2812
2807
|
case SpaceAction.OPEN: {
|
|
2813
2808
|
const space = intent.data?.space;
|
|
2814
2809
|
if (isSpace2(space)) {
|
|
@@ -2832,7 +2827,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2832
2827
|
case SpaceAction.MIGRATE: {
|
|
2833
2828
|
const space = intent.data?.space;
|
|
2834
2829
|
if (isSpace2(space)) {
|
|
2835
|
-
if (space.state.get() ===
|
|
2830
|
+
if (space.state.get() === SpaceState2.SPACE_REQUIRES_MIGRATION) {
|
|
2836
2831
|
state.values.sdkMigrationRunning[space.id] = true;
|
|
2837
2832
|
await space.internal.migrate();
|
|
2838
2833
|
state.values.sdkMigrationRunning[space.id] = false;
|
|
@@ -2843,7 +2838,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2843
2838
|
intents: [
|
|
2844
2839
|
[
|
|
2845
2840
|
{
|
|
2846
|
-
action:
|
|
2841
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2847
2842
|
data: {
|
|
2848
2843
|
name: "space.migrate",
|
|
2849
2844
|
properties: {
|
|
@@ -2893,7 +2888,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2893
2888
|
],
|
|
2894
2889
|
[
|
|
2895
2890
|
{
|
|
2896
|
-
action:
|
|
2891
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2897
2892
|
data: {
|
|
2898
2893
|
name: "space.limit",
|
|
2899
2894
|
properties: {
|
|
@@ -2934,7 +2929,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2934
2929
|
intents: [
|
|
2935
2930
|
[
|
|
2936
2931
|
{
|
|
2937
|
-
action:
|
|
2932
|
+
action: ObservabilityAction2.SEND_EVENT,
|
|
2938
2933
|
data: {
|
|
2939
2934
|
name: "space.object.add",
|
|
2940
2935
|
properties: {
|
|
@@ -2948,10 +2943,19 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2948
2943
|
]
|
|
2949
2944
|
};
|
|
2950
2945
|
}
|
|
2951
|
-
case SpaceAction.
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
|
|
2946
|
+
case SpaceAction.REMOVE_OBJECTS: {
|
|
2947
|
+
const objects = intent.data?.objects ?? intent.data?.result;
|
|
2948
|
+
invariant2(Array.isArray(objects), void 0, {
|
|
2949
|
+
F: __dxlog_file6,
|
|
2950
|
+
L: 1291,
|
|
2951
|
+
S: void 0,
|
|
2952
|
+
A: [
|
|
2953
|
+
"Array.isArray(objects)",
|
|
2954
|
+
""
|
|
2955
|
+
]
|
|
2956
|
+
});
|
|
2957
|
+
const space = getSpace4(objects[0]);
|
|
2958
|
+
if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace4(obj) === space)) {
|
|
2955
2959
|
return;
|
|
2956
2960
|
}
|
|
2957
2961
|
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
@@ -2959,20 +2963,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2959
2963
|
const openObjectIds = new Set(openIds(activeParts ?? {}));
|
|
2960
2964
|
if (!intent.undo && resolve) {
|
|
2961
2965
|
const parentCollection = intent.data?.collection ?? space.properties[CollectionType.typename];
|
|
2962
|
-
const
|
|
2966
|
+
const nestedObjectsList = await Promise.all(objects.map((obj) => getNestedObjects(obj, resolve)));
|
|
2963
2967
|
const deletionData = {
|
|
2964
|
-
|
|
2968
|
+
objects,
|
|
2965
2969
|
parentCollection,
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
wasActive: [
|
|
2969
|
-
|
|
2970
|
-
...
|
|
2971
|
-
].map((obj) => fullyQualifiedId4(obj)).filter((id) => openObjectIds.has(id))
|
|
2970
|
+
indices: objects.map((obj) => parentCollection instanceof CollectionType ? parentCollection.objects.indexOf(obj) : -1),
|
|
2971
|
+
nestedObjectsList,
|
|
2972
|
+
wasActive: objects.flatMap((obj, i) => [
|
|
2973
|
+
obj,
|
|
2974
|
+
...nestedObjectsList[i]
|
|
2975
|
+
]).map((obj) => fullyQualifiedId4(obj)).filter((id) => openObjectIds.has(id))
|
|
2972
2976
|
};
|
|
2973
2977
|
if (deletionData.wasActive.length > 0) {
|
|
2974
2978
|
await intentPlugin?.provides.intent.dispatch({
|
|
2975
|
-
action:
|
|
2979
|
+
action: NavigationAction4.CLOSE,
|
|
2976
2980
|
data: {
|
|
2977
2981
|
activeParts: {
|
|
2978
2982
|
main: deletionData.wasActive,
|
|
@@ -2981,38 +2985,43 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2981
2985
|
}
|
|
2982
2986
|
});
|
|
2983
2987
|
}
|
|
2984
|
-
if (parentCollection instanceof CollectionType) {
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2988
|
+
if (deletionData.parentCollection instanceof CollectionType) {
|
|
2989
|
+
[
|
|
2990
|
+
...deletionData.indices
|
|
2991
|
+
].sort((a, b) => b - a).forEach((index) => {
|
|
2992
|
+
if (index !== -1) {
|
|
2993
|
+
deletionData.parentCollection.objects.splice(index, 1);
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2989
2996
|
}
|
|
2990
|
-
deletionData.
|
|
2997
|
+
deletionData.nestedObjectsList.flat().forEach((obj) => {
|
|
2991
2998
|
space.db.remove(obj);
|
|
2992
2999
|
});
|
|
2993
|
-
space.db.remove(
|
|
2994
|
-
const undoMessageKey =
|
|
3000
|
+
objects.forEach((obj) => space.db.remove(obj));
|
|
3001
|
+
const undoMessageKey = objects.some((obj) => obj instanceof CollectionType) ? "collection deleted label" : objects.length > 1 ? "objects deleted label" : "object deleted label";
|
|
2995
3002
|
return {
|
|
2996
3003
|
data: true,
|
|
2997
3004
|
undoable: {
|
|
2998
|
-
//
|
|
3005
|
+
// TODO(ZaymonFC): Pluralize if more than one object.
|
|
2999
3006
|
message: translations_default[0]["en-US"][SPACE_PLUGIN][undoMessageKey],
|
|
3000
3007
|
data: deletionData
|
|
3001
3008
|
}
|
|
3002
3009
|
};
|
|
3003
3010
|
} else {
|
|
3004
3011
|
const undoData = intent.data;
|
|
3005
|
-
if (undoData &&
|
|
3006
|
-
const
|
|
3007
|
-
undoData.
|
|
3012
|
+
if (undoData?.objects?.length && undoData.objects.every(isEchoObject2) && undoData.parentCollection instanceof CollectionType) {
|
|
3013
|
+
const restoredObjects = undoData.objects.map((obj) => space.db.add(obj));
|
|
3014
|
+
undoData.nestedObjectsList.flat().forEach((obj) => {
|
|
3008
3015
|
space.db.add(obj);
|
|
3009
3016
|
});
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3017
|
+
undoData.indices.forEach((index, i) => {
|
|
3018
|
+
if (index !== -1) {
|
|
3019
|
+
undoData.parentCollection.objects.splice(index, 0, restoredObjects[i]);
|
|
3020
|
+
}
|
|
3021
|
+
});
|
|
3013
3022
|
if (undoData.wasActive.length > 0) {
|
|
3014
3023
|
await intentPlugin?.provides.intent.dispatch({
|
|
3015
|
-
action:
|
|
3024
|
+
action: NavigationAction4.OPEN,
|
|
3016
3025
|
data: {
|
|
3017
3026
|
activeParts: {
|
|
3018
3027
|
main: undoData.wasActive
|
|
@@ -3099,6 +3108,7 @@ export {
|
|
|
3099
3108
|
ContactType,
|
|
3100
3109
|
DefaultObjectSettings,
|
|
3101
3110
|
FullPresence,
|
|
3111
|
+
JoinDialog,
|
|
3102
3112
|
MenuFooter,
|
|
3103
3113
|
MessageState,
|
|
3104
3114
|
MessageType,
|
|
@@ -3116,10 +3126,10 @@ export {
|
|
|
3116
3126
|
SmallPresence,
|
|
3117
3127
|
SmallPresenceLive,
|
|
3118
3128
|
SpaceAction,
|
|
3119
|
-
SpaceMain,
|
|
3120
3129
|
SpacePlugin,
|
|
3130
|
+
SpacePluginSettings,
|
|
3121
3131
|
SpacePresence,
|
|
3122
|
-
|
|
3132
|
+
SpaceSettingsDialog,
|
|
3123
3133
|
SpaceSettingsPanel,
|
|
3124
3134
|
SyncStatus,
|
|
3125
3135
|
SyncStatusDetail,
|