@dxos/plugin-space 0.6.14-staging.54a8bab → 0.6.14-staging.7b35391

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