@dxos/plugin-space 0.6.11 → 0.6.12-main.2d19bf1

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 (91) hide show
  1. package/dist/lib/browser/{chunk-LZEGRS7H.mjs → chunk-AVLRQF6L.mjs} +1 -1
  2. package/dist/lib/browser/chunk-AVLRQF6L.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-DTVUOG2C.mjs → chunk-QK5I2EPF.mjs} +23 -4
  4. package/dist/lib/browser/chunk-QK5I2EPF.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +581 -237
  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 +7 -3
  10. package/dist/lib/node/{chunk-CVZPI2P3.cjs → chunk-HE2GHO6Z.cjs} +29 -8
  11. package/dist/lib/node/chunk-HE2GHO6Z.cjs.map +7 -0
  12. package/dist/lib/node/{chunk-6CNYF6YU.cjs → chunk-P4XUXM7Y.cjs} +4 -4
  13. package/dist/lib/node/chunk-P4XUXM7Y.cjs.map +7 -0
  14. package/dist/lib/node/index.cjs +802 -461
  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 +14 -10
  20. package/dist/lib/node/types/index.cjs.map +2 -2
  21. package/dist/lib/node-esm/chunk-2TR4WD6U.mjs +116 -0
  22. package/dist/lib/node-esm/chunk-2TR4WD6U.mjs.map +7 -0
  23. package/dist/lib/node-esm/chunk-YPQGKWHJ.mjs +37 -0
  24. package/dist/lib/node-esm/chunk-YPQGKWHJ.mjs.map +7 -0
  25. package/dist/lib/node-esm/index.mjs +2985 -0
  26. package/dist/lib/node-esm/index.mjs.map +7 -0
  27. package/dist/lib/node-esm/meta.json +1 -0
  28. package/dist/lib/node-esm/meta.mjs +14 -0
  29. package/dist/lib/node-esm/meta.mjs.map +7 -0
  30. package/dist/lib/node-esm/types/index.mjs +26 -0
  31. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  32. package/dist/types/src/SpacePlugin.d.ts.map +1 -1
  33. package/dist/types/src/components/FallbackSettings.d.ts +8 -0
  34. package/dist/types/src/components/FallbackSettings.d.ts.map +1 -0
  35. package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
  36. package/dist/types/src/components/SaveStatus.d.ts +3 -0
  37. package/dist/types/src/components/SaveStatus.d.ts.map +1 -0
  38. package/dist/types/src/components/ShareSpaceButton.stories.d.ts +4 -0
  39. package/dist/types/src/components/ShareSpaceButton.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/SpaceMain/SpaceMain.d.ts.map +1 -1
  41. package/dist/types/src/components/SpacePresence.stories.d.ts +4 -0
  42. package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
  43. package/dist/types/src/components/SpaceSettings.d.ts.map +1 -1
  44. package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +13 -0
  45. package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -0
  46. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +117 -0
  47. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -0
  48. package/dist/types/src/components/SyncStatus/index.d.ts +2 -0
  49. package/dist/types/src/components/SyncStatus/index.d.ts.map +1 -0
  50. package/dist/types/src/components/SyncStatus/types.d.ts +14 -0
  51. package/dist/types/src/components/SyncStatus/types.d.ts.map +1 -0
  52. package/dist/types/src/components/index.d.ts +3 -2
  53. package/dist/types/src/components/index.d.ts.map +1 -1
  54. package/dist/types/src/meta.d.ts.map +1 -1
  55. package/dist/types/src/translations.d.ts +4 -0
  56. package/dist/types/src/translations.d.ts.map +1 -1
  57. package/dist/types/src/types/thread.d.ts +14 -0
  58. package/dist/types/src/types/thread.d.ts.map +1 -1
  59. package/dist/types/src/types/types.d.ts +18 -1
  60. package/dist/types/src/types/types.d.ts.map +1 -1
  61. package/dist/types/src/util.d.ts +1 -4
  62. package/dist/types/src/util.d.ts.map +1 -1
  63. package/package.json +43 -36
  64. package/src/SpacePlugin.tsx +93 -36
  65. package/src/components/FallbackSettings.tsx +35 -0
  66. package/src/components/MenuFooter.tsx +1 -0
  67. package/src/components/SaveStatus.tsx +95 -0
  68. package/src/components/SpaceMain/SpaceMain.tsx +1 -22
  69. package/src/components/SpacePresence.tsx +1 -1
  70. package/src/components/SpaceSettings.tsx +32 -3
  71. package/src/components/SyncStatus/SyncStatus.stories.tsx +62 -0
  72. package/src/components/SyncStatus/SyncStatus.tsx +188 -0
  73. package/src/components/SyncStatus/index.ts +5 -0
  74. package/src/components/SyncStatus/types.ts +77 -0
  75. package/src/components/index.ts +3 -2
  76. package/src/meta.ts +3 -1
  77. package/src/translations.ts +4 -0
  78. package/src/types/collection.ts +1 -1
  79. package/src/types/thread.ts +11 -1
  80. package/src/types/types.ts +25 -1
  81. package/src/util.tsx +15 -50
  82. package/dist/lib/browser/chunk-DTVUOG2C.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-LZEGRS7H.mjs.map +0 -7
  84. package/dist/lib/node/chunk-6CNYF6YU.cjs.map +0 -7
  85. package/dist/lib/node/chunk-CVZPI2P3.cjs.map +0 -7
  86. package/dist/types/src/components/EmptySpace.d.ts +0 -3
  87. package/dist/types/src/components/EmptySpace.d.ts.map +0 -1
  88. package/dist/types/src/components/EmptyTree.d.ts +0 -3
  89. package/dist/types/src/components/EmptyTree.d.ts.map +0 -1
  90. package/src/components/EmptySpace.tsx +0 -25
  91. package/src/components/EmptyTree.tsx +0 -25
@@ -3,23 +3,24 @@ import {
3
3
  SPACE_PLUGIN_SHORT_ID,
4
4
  SpaceAction,
5
5
  meta_default
6
- } from "./chunk-LZEGRS7H.mjs";
6
+ } from "./chunk-AVLRQF6L.mjs";
7
7
  import {
8
8
  ActorSchema,
9
9
  ChannelType,
10
10
  CollectionType,
11
11
  ContactType,
12
+ MessageState,
12
13
  MessageType,
13
14
  SPACE_DIRECTORY_HANDLE,
14
15
  ThreadStatus,
15
- ThreadType
16
- } from "./chunk-DTVUOG2C.mjs";
16
+ ThreadType,
17
+ parseSpaceInitPlugin
18
+ } from "./chunk-QK5I2EPF.mjs";
17
19
 
18
20
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
19
- import { Plus as Plus2, SignIn, CardsThree as CardsThree2, Warning as Warning2 } from "@phosphor-icons/react";
20
21
  import { effect, signal } from "@preact/signals-core";
21
22
  import React17 from "react";
22
- import { LayoutAction as LayoutAction2, Surface as Surface2, NavigationAction as NavigationAction3, openIds, firstIdInPart, parseIntentPlugin as parseIntentPlugin3, parseNavigationPlugin as parseNavigationPlugin2, parseMetadataResolverPlugin, resolvePlugin, parseGraphPlugin } from "@dxos/app-framework";
23
+ import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface2, firstIdInPart, openIds, parseGraphPlugin, parseIntentPlugin as parseIntentPlugin3, parseMetadataResolverPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
23
24
  import { EventSubscriptions } from "@dxos/async";
24
25
  import { isReactiveObject as isReactiveObject2 } from "@dxos/echo-schema";
25
26
  import { LocalStorageStore } from "@dxos/local-storage";
@@ -27,12 +28,12 @@ import { log as log2 } from "@dxos/log";
27
28
  import { Migrations as Migrations2 } from "@dxos/migrations";
28
29
  import { parseAttentionPlugin } from "@dxos/plugin-attention";
29
30
  import { parseClientPlugin } from "@dxos/plugin-client";
30
- import { createExtension, isGraphNode, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
31
+ import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
31
32
  import { ObservabilityAction } from "@dxos/plugin-observability/meta";
32
33
  import { PublicKey as PublicKey2 } from "@dxos/react-client";
33
- import { create as create2, Expando, Filter, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace4, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace2, loadObjectReferences, SpaceState as SpaceState3 } from "@dxos/react-client/echo";
34
+ 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 } from "@dxos/react-client/echo";
34
35
  import { Dialog } from "@dxos/react-ui";
35
- import { InvitationManager, osTranslations, ClipboardProvider as ClipboardProvider2 } from "@dxos/shell/react";
36
+ import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
36
37
  import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
37
38
 
38
39
  // packages/plugins/plugin-space/src/components/AwaitingObject.tsx
@@ -158,40 +159,34 @@ var CollectionSection = ({ collection }) => {
158
159
  }, collection.name ?? t("unnamed collection label")));
159
160
  };
160
161
 
161
- // packages/plugins/plugin-space/src/components/EmptySpace.tsx
162
+ // packages/plugins/plugin-space/src/components/FallbackSettings.tsx
162
163
  import React4 from "react";
163
- import { useTranslation as useTranslation4 } from "@dxos/react-ui";
164
- import { descriptionText as descriptionText2, mx as mx3 } from "@dxos/react-ui-theme";
165
- var EmptySpace = () => {
164
+ import { Input, useTranslation as useTranslation4 } from "@dxos/react-ui";
165
+ var FallbackSettings = ({ object }) => {
166
166
  const { t } = useTranslation4(SPACE_PLUGIN);
167
167
  return /* @__PURE__ */ React4.createElement("div", {
168
+ role: "form",
169
+ className: "p-3 flex flex-col gap-2"
170
+ }, /* @__PURE__ */ React4.createElement("div", {
168
171
  role: "none",
169
- className: mx3("p-2 mli-2 mbe-2 text-center border border-dashed border-neutral-400/50 rounded-lg", descriptionText2)
170
- }, t("empty space message"));
171
- };
172
-
173
- // packages/plugins/plugin-space/src/components/EmptyTree.tsx
174
- import React5 from "react";
175
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
176
- import { descriptionText as descriptionText3, mx as mx4 } from "@dxos/react-ui-theme";
177
- var EmptyTree = () => {
178
- const { t } = useTranslation5(SPACE_PLUGIN);
179
- return /* @__PURE__ */ React5.createElement("div", {
180
- role: "none",
181
- className: mx4("p-2 mli-2 mbe-2 text-center border border-dashed border-neutral-400/50 rounded-lg", descriptionText3)
182
- }, t("empty tree message"));
172
+ className: "space-b-1"
173
+ }, /* @__PURE__ */ React4.createElement(Input.Root, null, /* @__PURE__ */ React4.createElement(Input.Label, null, t("name label")), /* @__PURE__ */ React4.createElement(Input.TextInput, {
174
+ placeholder: t("name placeholder"),
175
+ value: object.name,
176
+ onChange: (event) => {
177
+ object.name = event.target.value;
178
+ }
179
+ }))));
183
180
  };
184
181
 
185
182
  // packages/plugins/plugin-space/src/components/MenuFooter.tsx
186
- import { Planet as Planet2 } from "@phosphor-icons/react";
187
- import React7 from "react";
183
+ import { Planet } from "@phosphor-icons/react";
184
+ import React5 from "react";
188
185
  import { getSpace as getSpace2 } from "@dxos/client/echo";
189
186
  import { useClient as useClient2 } from "@dxos/react-client";
190
- import { DropdownMenu, toLocalizedString, useTranslation as useTranslation6 } from "@dxos/react-ui";
187
+ import { DropdownMenu, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
191
188
 
192
189
  // packages/plugins/plugin-space/src/util.tsx
193
- import { CardsThree, Database, PencilSimpleLine, Planet, Plus, Trash, Users, X, ClockCounterClockwise, LockSimpleOpen, LockSimple, Placeholder, Link } from "@phosphor-icons/react";
194
- import React6 from "react";
195
190
  import { NavigationAction as NavigationAction2 } from "@dxos/app-framework";
196
191
  import { create, isReactiveObject, getTypename, getSchema, getEchoObjectAnnotation, EXPANDO_TYPENAME } from "@dxos/echo-schema";
197
192
  import { invariant } from "@dxos/invariant";
@@ -284,8 +279,7 @@ var constructSpaceNode = ({ space, personal, namesCache, resolve }) => {
284
279
  namesCache
285
280
  }),
286
281
  description: space.state.get() === SpaceState.SPACE_READY && space.properties.description,
287
- icon: (props) => /* @__PURE__ */ React6.createElement(Planet, props),
288
- iconSymbol: "ph--planet--regular",
282
+ icon: "ph--planet--regular",
289
283
  disabled: space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
290
284
  testId: "spacePlugin.space"
291
285
  }
@@ -311,8 +305,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
311
305
  ns: SPACE_PLUGIN
312
306
  }
313
307
  ],
314
- icon: (props) => /* @__PURE__ */ React6.createElement(Plus, props),
315
- iconSymbol: "ph--plus--regular",
308
+ icon: "ph--plus--regular",
316
309
  disposition: "toolbar",
317
310
  // TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
318
311
  // mainAreaDisposition: 'in-flow',
@@ -346,8 +339,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
346
339
  ns: SPACE_PLUGIN
347
340
  }
348
341
  ],
349
- icon: (props) => /* @__PURE__ */ React6.createElement(CardsThree, props),
350
- iconSymbol: "ph--cards-three--regular",
342
+ icon: "ph--cards-three--regular",
351
343
  testId: "spacePlugin.createCollection"
352
344
  }
353
345
  }
@@ -381,8 +373,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
381
373
  ns: SPACE_PLUGIN
382
374
  }
383
375
  ],
384
- icon: (props) => /* @__PURE__ */ React6.createElement(Database, props),
385
- iconSymbol: "ph--database--regular",
376
+ icon: "ph--database--regular",
386
377
  disposition: "toolbar",
387
378
  mainAreaDisposition: "in-flow",
388
379
  disabled: migrating || Migrations.running(space)
@@ -413,8 +404,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
413
404
  ns: SPACE_PLUGIN
414
405
  }
415
406
  ],
416
- icon: (props) => /* @__PURE__ */ React6.createElement(Users, props),
417
- iconSymbol: "ph--users--regular",
407
+ icon: "ph--users--regular",
418
408
  disabled: locked,
419
409
  keyBinding: {
420
410
  macos: "meta+.",
@@ -441,8 +431,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
441
431
  ns: SPACE_PLUGIN
442
432
  }
443
433
  ],
444
- icon: locked ? (props) => /* @__PURE__ */ React6.createElement(LockSimpleOpen, props) : (props) => /* @__PURE__ */ React6.createElement(LockSimple, props),
445
- iconSymbol: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
434
+ icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
446
435
  }
447
436
  }, {
448
437
  id: getId(SpaceAction.RENAME),
@@ -464,8 +453,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
464
453
  ns: SPACE_PLUGIN
465
454
  }
466
455
  ],
467
- icon: (props) => /* @__PURE__ */ React6.createElement(PencilSimpleLine, props),
468
- iconSymbol: "ph--pencil-simple-line--regular",
456
+ icon: "ph--pencil-simple-line--regular",
469
457
  keyBinding: {
470
458
  macos: "shift+F6",
471
459
  windows: "shift+F6"
@@ -494,8 +482,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
494
482
  ns: SPACE_PLUGIN
495
483
  }
496
484
  ],
497
- icon: (props) => /* @__PURE__ */ React6.createElement(X, props),
498
- iconSymbol: "ph--x--regular",
485
+ icon: "ph--x--regular",
499
486
  mainAreaDisposition: "menu",
500
487
  disabled: personal
501
488
  }
@@ -521,8 +508,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
521
508
  ns: SPACE_PLUGIN
522
509
  }
523
510
  ],
524
- icon: (props) => /* @__PURE__ */ React6.createElement(ClockCounterClockwise, props),
525
- iconSymbol: "ph--clock-counter-clockwise--regular",
511
+ icon: "ph--clock-counter-clockwise--regular",
526
512
  disposition: "toolbar",
527
513
  mainAreaDisposition: "in-flow"
528
514
  }
@@ -556,8 +542,7 @@ var createObjectNode = ({ object, space, resolve }) => {
556
542
  ns: SPACE_PLUGIN
557
543
  }
558
544
  ],
559
- icon: metadata.icon ?? (() => /* @__PURE__ */ React6.createElement(Placeholder, null)),
560
- iconSymbol: metadata.iconSymbol ?? "ph--placeholder--regular",
545
+ icon: metadata.icon ?? "ph--placeholder--regular",
561
546
  testId: "spacePlugin.object",
562
547
  persistenceClass: "echo",
563
548
  persistenceKey: space?.id
@@ -582,8 +567,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
582
567
  ns: SPACE_PLUGIN
583
568
  }
584
569
  ],
585
- icon: (props) => /* @__PURE__ */ React6.createElement(Plus, props),
586
- iconSymbol: "ph--plus--regular",
570
+ icon: "ph--plus--regular",
587
571
  disposition: "toolbar",
588
572
  // TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
589
573
  // mainAreaDisposition: 'in-flow',
@@ -617,8 +601,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
617
601
  ns: SPACE_PLUGIN
618
602
  }
619
603
  ],
620
- icon: (props) => /* @__PURE__ */ React6.createElement(CardsThree, props),
621
- iconSymbol: "ph--cards-three--regular",
604
+ icon: "ph--cards-three--regular",
622
605
  testId: "spacePlugin.createCollection"
623
606
  }
624
607
  }
@@ -650,8 +633,7 @@ var constructObjectActions = ({ node, dispatch }) => {
650
633
  ns: SPACE_PLUGIN
651
634
  }
652
635
  ],
653
- icon: (props) => /* @__PURE__ */ React6.createElement(PencilSimpleLine, props),
654
- iconSymbol: "ph--pencil-simple-line--regular",
636
+ icon: "ph--pencil-simple-line--regular",
655
637
  // TODO(wittjosiah): Doesn't work.
656
638
  // keyBinding: 'shift+F6',
657
639
  testId: "spacePlugin.renameObject"
@@ -682,8 +664,7 @@ var constructObjectActions = ({ node, dispatch }) => {
682
664
  ns: SPACE_PLUGIN
683
665
  }
684
666
  ],
685
- icon: (props) => /* @__PURE__ */ React6.createElement(Trash, props),
686
- iconSymbol: "ph--trash--regular",
667
+ icon: "ph--trash--regular",
687
668
  keyBinding: object instanceof CollectionType ? void 0 : "shift+meta+Backspace",
688
669
  testId: "spacePlugin.deleteObject"
689
670
  }
@@ -702,8 +683,7 @@ var constructObjectActions = ({ node, dispatch }) => {
702
683
  ns: SPACE_PLUGIN
703
684
  }
704
685
  ],
705
- icon: (props) => /* @__PURE__ */ React6.createElement(Link, props),
706
- iconSymbol: "ph--link--regular",
686
+ icon: "ph--link--regular",
707
687
  testId: "spacePlugin.copyLink"
708
688
  }
709
689
  }
@@ -744,7 +724,7 @@ var cloneObject = async (object, resolve) => {
744
724
  const serializer = metadata.serializer;
745
725
  invariant(serializer, `No serializer for type: ${typename}`, {
746
726
  F: __dxlog_file,
747
- L: 639,
727
+ L: 604,
748
728
  S: void 0,
749
729
  A: [
750
730
  "serializer",
@@ -762,31 +742,31 @@ var cloneObject = async (object, resolve) => {
762
742
 
763
743
  // packages/plugins/plugin-space/src/components/MenuFooter.tsx
764
744
  var MenuFooter = ({ object }) => {
765
- const { t } = useTranslation6(SPACE_PLUGIN);
745
+ const { t } = useTranslation5(SPACE_PLUGIN);
766
746
  const client = useClient2();
767
747
  const space = getSpace2(object);
768
748
  const spaceName = space ? getSpaceDisplayName(space, {
769
749
  personal: client.spaces.default === space
770
750
  }) : "";
771
- return space ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React7.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React7.createElement("dl", {
751
+ 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", {
772
752
  className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
773
- }, /* @__PURE__ */ React7.createElement("dt", {
753
+ }, /* @__PURE__ */ React5.createElement("dt", {
774
754
  className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
775
- }, t("location label")), /* @__PURE__ */ React7.createElement("dd", {
755
+ }, t("location label")), /* @__PURE__ */ React5.createElement("dd", {
776
756
  className: "line-clamp-3"
777
- }, /* @__PURE__ */ React7.createElement(Planet2, {
757
+ }, /* @__PURE__ */ React5.createElement(Planet, {
778
758
  className: "inline-block mie-1"
779
759
  }), toLocalizedString(spaceName, t)))) : null;
780
760
  };
781
761
 
782
762
  // packages/plugins/plugin-space/src/components/MissingObject.tsx
783
- import React8, { useEffect as useEffect2, useState as useState2 } from "react";
763
+ import React6, { useEffect as useEffect2, useState as useState2 } from "react";
784
764
  import { parseIntentPlugin as parseIntentPlugin2, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
785
- import { Status, useTranslation as useTranslation7 } from "@dxos/react-ui";
786
- import { baseSurface as baseSurface2, descriptionText as descriptionText4, mx as mx5 } from "@dxos/react-ui-theme";
765
+ import { Status, useTranslation as useTranslation6 } from "@dxos/react-ui";
766
+ import { baseSurface as baseSurface2, descriptionText as descriptionText2, mx as mx3 } from "@dxos/react-ui-theme";
787
767
  var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
788
768
  var MissingObject = ({ id }) => {
789
- const { t } = useTranslation7(SPACE_PLUGIN);
769
+ const { t } = useTranslation6(SPACE_PLUGIN);
790
770
  const [waiting, setWaiting] = useState2(false);
791
771
  const intentPlugin = useResolvePlugin2(parseIntentPlugin2);
792
772
  useEffect2(() => {
@@ -808,13 +788,13 @@ var MissingObject = ({ id }) => {
808
788
  intentPlugin,
809
789
  id
810
790
  ]);
811
- return /* @__PURE__ */ React8.createElement("div", {
791
+ return /* @__PURE__ */ React6.createElement("div", {
812
792
  role: "none",
813
- className: mx5(baseSurface2, "min-bs-screen is-full flex items-center justify-center p-8")
814
- }, waiting ? /* @__PURE__ */ React8.createElement("p", {
793
+ className: mx3(baseSurface2, "min-bs-screen is-full flex items-center justify-center p-8")
794
+ }, waiting ? /* @__PURE__ */ React6.createElement("p", {
815
795
  role: "alert",
816
- className: mx5(descriptionText4, "border border-dashed border-neutral-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
817
- }, t("missing object message")) : /* @__PURE__ */ React8.createElement(Status, {
796
+ className: mx3(descriptionText2, "border border-dashed border-neutral-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
797
+ }, t("missing object message")) : /* @__PURE__ */ React6.createElement(Status, {
818
798
  indeterminate: true,
819
799
  "aria-label": "Initializing"
820
800
  }));
@@ -822,10 +802,10 @@ var MissingObject = ({ id }) => {
822
802
 
823
803
  // packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
824
804
  import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
825
- import React9, { useEffect as useEffect3, useState as useState3 } from "react";
805
+ import React7, { useEffect as useEffect3, useState as useState3 } from "react";
826
806
  import { debounce } from "@dxos/async";
827
- import { Tooltip, useTranslation as useTranslation8 } from "@dxos/react-ui";
828
- import { getSize as getSize2, mx as mx6, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
807
+ import { Tooltip, useTranslation as useTranslation7 } from "@dxos/react-ui";
808
+ import { getSize as getSize2, mx as mx4, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
829
809
  var Status2;
830
810
  (function(Status3) {
831
811
  Status3[Status3["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
@@ -833,7 +813,7 @@ var Status2;
833
813
  Status3[Status3["ERROR"] = 2] = "ERROR";
834
814
  })(Status2 || (Status2 = {}));
835
815
  var PersistenceStatus = ({ db }) => {
836
- const { t } = useTranslation8(SPACE_PLUGIN);
816
+ const { t } = useTranslation7(SPACE_PLUGIN);
837
817
  const [displayMessage, setDisplayMessage] = useState3(false);
838
818
  const [status, naturalSetStatus] = useState3(0);
839
819
  const [prevStatus, setPrevStatus] = useState3(0);
@@ -850,45 +830,45 @@ var PersistenceStatus = ({ db }) => {
850
830
  ]);
851
831
  switch (status) {
852
832
  case 2:
853
- return /* @__PURE__ */ React9.createElement("div", {
833
+ return /* @__PURE__ */ React7.createElement("div", {
854
834
  className: "flex items-center"
855
- }, /* @__PURE__ */ React9.createElement(Warning, {
856
- className: mx6(getSize2(4), "me-1")
857
- }), /* @__PURE__ */ React9.createElement("span", {
858
- className: mx6("text-sm", warningText)
835
+ }, /* @__PURE__ */ React7.createElement(Warning, {
836
+ className: mx4(getSize2(4), "me-1")
837
+ }), /* @__PURE__ */ React7.createElement("span", {
838
+ className: mx4("text-sm", warningText)
859
839
  }, t("persistence error label")));
860
840
  case 1:
861
- return /* @__PURE__ */ React9.createElement("div", {
841
+ return /* @__PURE__ */ React7.createElement("div", {
862
842
  className: "flex items-center"
863
- }, /* @__PURE__ */ React9.createElement(ArrowsCounterClockwise, {
864
- className: mx6(getSize2(4), "me-1")
865
- }), /* @__PURE__ */ React9.createElement("span", {
866
- className: mx6("text-sm", staticPlaceholderText)
843
+ }, /* @__PURE__ */ React7.createElement(ArrowsCounterClockwise, {
844
+ className: mx4(getSize2(4), "me-1")
845
+ }), /* @__PURE__ */ React7.createElement("span", {
846
+ className: mx4("text-sm", staticPlaceholderText)
867
847
  }, t("persistence pending label")));
868
848
  case 0:
869
849
  default:
870
- return /* @__PURE__ */ React9.createElement(Tooltip.Root, {
850
+ return /* @__PURE__ */ React7.createElement(Tooltip.Root, {
871
851
  delayDuration: 400
872
- }, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
852
+ }, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
873
853
  role: "status",
874
854
  className: "flex items-center"
875
- }, /* @__PURE__ */ React9.createElement(CheckCircle2, {
876
- className: mx6(getSize2(4), "me-1")
877
- }), displayMessage && /* @__PURE__ */ React9.createElement("span", {
878
- className: mx6("text-sm", staticPlaceholderText)
879
- }, t("persisted locally label"))), /* @__PURE__ */ React9.createElement(Tooltip.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip.Content, {
855
+ }, /* @__PURE__ */ React7.createElement(CheckCircle2, {
856
+ className: mx4(getSize2(4), "me-1")
857
+ }), displayMessage && /* @__PURE__ */ React7.createElement("span", {
858
+ className: mx4("text-sm", staticPlaceholderText)
859
+ }, t("persisted locally label"))), /* @__PURE__ */ React7.createElement(Tooltip.Portal, null, /* @__PURE__ */ React7.createElement(Tooltip.Content, {
880
860
  classNames: "z-10"
881
- }, t("persisted locally message"), /* @__PURE__ */ React9.createElement(Tooltip.Arrow, null))));
861
+ }, t("persisted locally message"), /* @__PURE__ */ React7.createElement(Tooltip.Arrow, null))));
882
862
  }
883
863
  };
884
864
 
885
865
  // packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
886
- import React10, { useCallback, useRef, useState as useState4 } from "react";
866
+ import React8, { useCallback, useRef, useState as useState4 } from "react";
887
867
  import { log } from "@dxos/log";
888
- import { Button as Button2, Input, Popover, useTranslation as useTranslation9 } from "@dxos/react-ui";
868
+ import { Button as Button2, Input as Input2, Popover, useTranslation as useTranslation8 } from "@dxos/react-ui";
889
869
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
890
870
  var PopoverRenameObject = ({ object: obj }) => {
891
- const { t } = useTranslation9(SPACE_PLUGIN);
871
+ const { t } = useTranslation8(SPACE_PLUGIN);
892
872
  const doneButton = useRef(null);
893
873
  const object = obj;
894
874
  const [name, setName] = useState4(object.name || object.title || "");
@@ -913,23 +893,23 @@ var PopoverRenameObject = ({ object: obj }) => {
913
893
  object,
914
894
  name
915
895
  ]);
916
- return /* @__PURE__ */ React10.createElement("div", {
896
+ return /* @__PURE__ */ React8.createElement("div", {
917
897
  role: "none",
918
898
  className: "p-1 flex gap-2"
919
- }, /* @__PURE__ */ React10.createElement("div", {
899
+ }, /* @__PURE__ */ React8.createElement("div", {
920
900
  role: "none",
921
901
  className: "flex-1"
922
- }, /* @__PURE__ */ React10.createElement(Input.Root, null, /* @__PURE__ */ React10.createElement(Input.Label, {
902
+ }, /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Label, {
923
903
  srOnly: true
924
- }, t("object name label")), /* @__PURE__ */ React10.createElement(Input.TextInput, {
904
+ }, t("object name label")), /* @__PURE__ */ React8.createElement(Input2.TextInput, {
925
905
  placeholder: t("object title placeholder"),
926
906
  value: name,
927
907
  "data-testid": "spacePlugin.renameObject.input",
928
908
  onChange: ({ target: { value } }) => setName(value),
929
909
  onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
930
- }))), /* @__PURE__ */ React10.createElement(Popover.Close, {
910
+ }))), /* @__PURE__ */ React8.createElement(Popover.Close, {
931
911
  asChild: true
932
- }, /* @__PURE__ */ React10.createElement(Button2, {
912
+ }, /* @__PURE__ */ React8.createElement(Button2, {
933
913
  ref: doneButton,
934
914
  classNames: "self-stretch",
935
915
  onClick: handleDone
@@ -939,10 +919,10 @@ var PopoverRenameObject = ({ object: obj }) => {
939
919
  };
940
920
 
941
921
  // packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
942
- import React11, { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
943
- import { Button as Button3, Input as Input2, Popover as Popover2, useTranslation as useTranslation10 } from "@dxos/react-ui";
922
+ import React9, { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
923
+ import { Button as Button3, Input as Input3, Popover as Popover2, useTranslation as useTranslation9 } from "@dxos/react-ui";
944
924
  var PopoverRenameSpace = ({ space }) => {
945
- const { t } = useTranslation10(SPACE_PLUGIN);
925
+ const { t } = useTranslation9(SPACE_PLUGIN);
946
926
  const doneButton = useRef2(null);
947
927
  const [name, setName] = useState5(space.properties.name ?? "");
948
928
  const handleDone = useCallback2(() => {
@@ -951,24 +931,24 @@ var PopoverRenameSpace = ({ space }) => {
951
931
  space,
952
932
  name
953
933
  ]);
954
- return /* @__PURE__ */ React11.createElement("div", {
934
+ return /* @__PURE__ */ React9.createElement("div", {
955
935
  role: "none",
956
936
  className: "p-1 flex gap-2"
957
- }, /* @__PURE__ */ React11.createElement("div", {
937
+ }, /* @__PURE__ */ React9.createElement("div", {
958
938
  role: "none",
959
939
  className: "flex-1"
960
- }, /* @__PURE__ */ React11.createElement(Input2.Root, null, /* @__PURE__ */ React11.createElement(Input2.Label, {
940
+ }, /* @__PURE__ */ React9.createElement(Input3.Root, null, /* @__PURE__ */ React9.createElement(Input3.Label, {
961
941
  srOnly: true
962
- }, t("space name label")), /* @__PURE__ */ React11.createElement(Input2.TextInput, {
942
+ }, t("space name label")), /* @__PURE__ */ React9.createElement(Input3.TextInput, {
963
943
  defaultValue: space.properties.name ?? "",
964
944
  placeholder: t("unnamed space label"),
965
945
  onChange: ({ target: { value } }) => setName(value),
966
946
  // TODO(wittjosiah): Ideally this should access the popover context to close the popover.
967
947
  // Currently this is not possible because Radix does not expose the popover context.
968
948
  onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
969
- }))), /* @__PURE__ */ React11.createElement(Popover2.Close, {
949
+ }))), /* @__PURE__ */ React9.createElement(Popover2.Close, {
970
950
  asChild: true
971
- }, /* @__PURE__ */ React11.createElement(Button3, {
951
+ }, /* @__PURE__ */ React9.createElement(Button3, {
972
952
  ref: doneButton,
973
953
  classNames: "self-stretch",
974
954
  onClick: handleDone
@@ -978,12 +958,12 @@ var PopoverRenameSpace = ({ space }) => {
978
958
  };
979
959
 
980
960
  // packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
981
- import React12 from "react";
961
+ import React10 from "react";
982
962
  import { useIntentDispatcher } from "@dxos/app-framework";
983
- import { Button as Button4, useTranslation as useTranslation11 } from "@dxos/react-ui";
963
+ import { Button as Button4, useTranslation as useTranslation10 } from "@dxos/react-ui";
984
964
  var ShareSpaceButton = ({ spaceId }) => {
985
965
  const dispatch = useIntentDispatcher();
986
- return /* @__PURE__ */ React12.createElement(ShareSpaceButtonImpl, {
966
+ return /* @__PURE__ */ React10.createElement(ShareSpaceButtonImpl, {
987
967
  onClick: () => dispatch({
988
968
  action: SpaceAction.SHARE,
989
969
  data: {
@@ -993,8 +973,8 @@ var ShareSpaceButton = ({ spaceId }) => {
993
973
  });
994
974
  };
995
975
  var ShareSpaceButtonImpl = ({ onClick }) => {
996
- const { t } = useTranslation11(SPACE_PLUGIN);
997
- return /* @__PURE__ */ React12.createElement(Button4, {
976
+ const { t } = useTranslation10(SPACE_PLUGIN);
977
+ return /* @__PURE__ */ React10.createElement(Button4, {
998
978
  "data-testid": "spacePlugin.shareSpaceButton",
999
979
  onClick,
1000
980
  classNames: "mli-1"
@@ -1003,30 +983,30 @@ var ShareSpaceButtonImpl = ({ onClick }) => {
1003
983
 
1004
984
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
1005
985
  import { Command } from "@phosphor-icons/react";
1006
- import React14 from "react";
986
+ import React12 from "react";
1007
987
  import { Surface } from "@dxos/app-framework";
1008
988
  import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
1009
- import { Button as Button6, Main, useTranslation as useTranslation13, toLocalizedString as toLocalizedString2 } from "@dxos/react-ui";
1010
- import { getSize as getSize4, mx as mx8, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
989
+ import { Main, useTranslation as useTranslation12 } from "@dxos/react-ui";
990
+ import { getSize as getSize4, mx as mx6, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
1011
991
  import { ClipboardProvider } from "@dxos/shell/react";
1012
992
 
1013
993
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMembersSection.tsx
1014
994
  import { CaretDown, Check, UserPlus, UsersThree } from "@phosphor-icons/react";
1015
- import React13, { useCallback as useCallback3, useState as useState6 } from "react";
995
+ import React11, { useCallback as useCallback3, useState as useState6 } from "react";
1016
996
  import { LayoutAction, useIntent } from "@dxos/app-framework";
1017
997
  import { useMembers, SpaceMember, useSpaceInvitations } from "@dxos/react-client/echo";
1018
998
  import { InvitationEncoder } from "@dxos/react-client/invitations";
1019
999
  import { Invitation } from "@dxos/react-client/invitations";
1020
- import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as useTranslation12 } from "@dxos/react-ui";
1021
- import { descriptionText as descriptionText5, getSize as getSize3, mx as mx7 } from "@dxos/react-ui-theme";
1000
+ import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as useTranslation11 } from "@dxos/react-ui";
1001
+ import { descriptionText as descriptionText3, getSize as getSize3, mx as mx5 } from "@dxos/react-ui-theme";
1022
1002
  import { InvitationListItem, IdentityListItem } from "@dxos/shell/react";
1023
1003
  var activeActionKeyStorageKey = "dxos:react-shell/space-manager/active-action";
1024
1004
  var Presence = SpaceMember.PresenceState;
1025
1005
  var handleCreateInvitationUrl = (invitationCode) => `${origin}?spaceInvitationCode=${invitationCode}`;
1026
1006
  var SpaceMemberList = ({ members }) => {
1027
- return members.length > 0 ? /* @__PURE__ */ React13.createElement(List, {
1007
+ return members.length > 0 ? /* @__PURE__ */ React11.createElement(List, {
1028
1008
  classNames: "col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center"
1029
- }, members.map((member) => /* @__PURE__ */ React13.createElement(IdentityListItem, {
1009
+ }, members.map((member) => /* @__PURE__ */ React11.createElement(IdentityListItem, {
1030
1010
  classNames: "contents",
1031
1011
  key: member.identity.identityKey.toHex(),
1032
1012
  identity: member.identity,
@@ -1034,7 +1014,7 @@ var SpaceMemberList = ({ members }) => {
1034
1014
  }))) : null;
1035
1015
  };
1036
1016
  var SpaceMembersSection = ({ space }) => {
1037
- const { t } = useTranslation12(SPACE_PLUGIN);
1017
+ const { t } = useTranslation11(SPACE_PLUGIN);
1038
1018
  const invitations = useSpaceInvitations(space.key);
1039
1019
  const { dispatch } = useIntent();
1040
1020
  const handleCloseDialog = () => dispatch({
@@ -1112,103 +1092,103 @@ var SpaceMembersSection = ({ space }) => {
1112
1092
  [Presence.ONLINE]: [],
1113
1093
  [Presence.OFFLINE]: []
1114
1094
  });
1115
- return /* @__PURE__ */ React13.createElement("section", {
1095
+ return /* @__PURE__ */ React11.createElement("section", {
1116
1096
  className: "mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min"
1117
- }, /* @__PURE__ */ React13.createElement("h2", {
1097
+ }, /* @__PURE__ */ React11.createElement("h2", {
1118
1098
  className: "contents"
1119
- }, /* @__PURE__ */ React13.createElement(UsersThree, {
1099
+ }, /* @__PURE__ */ React11.createElement(UsersThree, {
1120
1100
  weight: "duotone",
1121
- className: mx7(getSize3(5), "place-self-center")
1122
- }), /* @__PURE__ */ React13.createElement("span", {
1101
+ className: mx5(getSize3(5), "place-self-center")
1102
+ }), /* @__PURE__ */ React11.createElement("span", {
1123
1103
  className: "text-lg col-span-2"
1124
- }, t("space members label"))), /* @__PURE__ */ React13.createElement("h3", {
1104
+ }, t("space members label"))), /* @__PURE__ */ React11.createElement("h3", {
1125
1105
  className: "col-start-2 col-span-3 text-sm italic text-description"
1126
- }, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React13.createElement(List, {
1106
+ }, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React11.createElement(List, {
1127
1107
  classNames: "col-start-2 col-span-2 gap-y-2 grid grid-cols-[var(--rail-size)_1fr_var(--rail-action)_var(--rail-action)]"
1128
- }, invitations.map((invitation) => /* @__PURE__ */ React13.createElement(InvitationListItem, {
1108
+ }, invitations.map((invitation) => /* @__PURE__ */ React11.createElement(InvitationListItem, {
1129
1109
  reverseEffects: true,
1130
1110
  classNames: "pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid",
1131
1111
  key: invitation.get().invitationId,
1132
1112
  invitation,
1133
1113
  send: handleInvitationSelect,
1134
1114
  createInvitationUrl: handleCreateInvitationUrl
1135
- }))), /* @__PURE__ */ React13.createElement(ButtonGroup, {
1115
+ }))), /* @__PURE__ */ React11.createElement(ButtonGroup, {
1136
1116
  classNames: "col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px"
1137
- }, /* @__PURE__ */ React13.createElement(Button5, {
1117
+ }, /* @__PURE__ */ React11.createElement(Button5, {
1138
1118
  classNames: "gap-2",
1139
1119
  onClick: activeAction.onClick
1140
- }, /* @__PURE__ */ React13.createElement(activeAction.icon, {
1120
+ }, /* @__PURE__ */ React11.createElement(activeAction.icon, {
1141
1121
  className: getSize3(5)
1142
- }), /* @__PURE__ */ React13.createElement("span", null, t(activeAction.label, {
1122
+ }), /* @__PURE__ */ React11.createElement("span", null, t(activeAction.label, {
1143
1123
  ns: "os"
1144
- }))), /* @__PURE__ */ React13.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React13.createElement(DropdownMenu2.Trigger, {
1124
+ }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React11.createElement(DropdownMenu2.Trigger, {
1145
1125
  asChild: true
1146
- }, /* @__PURE__ */ React13.createElement(Button5, {
1126
+ }, /* @__PURE__ */ React11.createElement(Button5, {
1147
1127
  classNames: "pli-0"
1148
- }, /* @__PURE__ */ React13.createElement(CaretDown, {
1128
+ }, /* @__PURE__ */ React11.createElement(CaretDown, {
1149
1129
  className: getSize3(4)
1150
- }))), /* @__PURE__ */ React13.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React13.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
1151
- return /* @__PURE__ */ React13.createElement(DropdownMenu2.CheckboxItem, {
1130
+ }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React11.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
1131
+ return /* @__PURE__ */ React11.createElement(DropdownMenu2.CheckboxItem, {
1152
1132
  key: id,
1153
1133
  "aria-labelledby": `${id}__label`,
1154
1134
  "aria-describedby": `${id}__description`,
1155
1135
  checked: activeActionKey === id,
1156
1136
  onCheckedChange: (checked) => checked && setActiveActionKey(id),
1157
1137
  classNames: "gap-2"
1158
- }, action.icon && /* @__PURE__ */ React13.createElement(action.icon, {
1138
+ }, action.icon && /* @__PURE__ */ React11.createElement(action.icon, {
1159
1139
  className: getSize3(5)
1160
- }), /* @__PURE__ */ React13.createElement("div", {
1140
+ }), /* @__PURE__ */ React11.createElement("div", {
1161
1141
  role: "none",
1162
1142
  className: "flex-1 min-is-0 space-b-1"
1163
- }, /* @__PURE__ */ React13.createElement("p", {
1143
+ }, /* @__PURE__ */ React11.createElement("p", {
1164
1144
  id: `${id}__label`
1165
1145
  }, t(action.label, {
1166
1146
  ns: "os"
1167
- })), action.description && /* @__PURE__ */ React13.createElement("p", {
1147
+ })), action.description && /* @__PURE__ */ React11.createElement("p", {
1168
1148
  id: `${id}__description`,
1169
- className: descriptionText5
1149
+ className: descriptionText3
1170
1150
  }, t(action.description, {
1171
1151
  ns: "os"
1172
- }))), /* @__PURE__ */ React13.createElement(DropdownMenu2.ItemIndicator, {
1152
+ }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.ItemIndicator, {
1173
1153
  asChild: true
1174
- }, /* @__PURE__ */ React13.createElement(Check, {
1154
+ }, /* @__PURE__ */ React11.createElement(Check, {
1175
1155
  className: getSize3(4)
1176
1156
  })));
1177
- })), /* @__PURE__ */ React13.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React13.createElement("p", {
1178
- className: mx7(descriptionText5, "text-center is-full mlb-2")
1157
+ })), /* @__PURE__ */ React11.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React11.createElement("p", {
1158
+ className: mx5(descriptionText3, "text-center is-full mlb-2")
1179
1159
  }, t("empty space members message", {
1180
1160
  ns: "os"
1181
- })) : /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("h3", {
1161
+ })) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("h3", {
1182
1162
  className: "col-start-2 col-end-5 text-sm italic text-description"
1183
1163
  }, t("active space members heading", {
1184
1164
  count: members[Presence.ONLINE].length
1185
- })), /* @__PURE__ */ React13.createElement(SpaceMemberList, {
1165
+ })), /* @__PURE__ */ React11.createElement(SpaceMemberList, {
1186
1166
  members: members[Presence.ONLINE]
1187
- }), /* @__PURE__ */ React13.createElement("h3", {
1167
+ }), /* @__PURE__ */ React11.createElement("h3", {
1188
1168
  className: "col-start-2 col-end-5 text-sm italic text-description"
1189
1169
  }, t("inactive space members heading", {
1190
1170
  count: members[Presence.OFFLINE].length
1191
- })), /* @__PURE__ */ React13.createElement(SpaceMemberList, {
1171
+ })), /* @__PURE__ */ React11.createElement(SpaceMemberList, {
1192
1172
  members: members[Presence.OFFLINE]
1193
1173
  })));
1194
1174
  };
1195
1175
 
1196
1176
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
1197
1177
  var KeyShortcuts = () => {
1198
- const { t } = useTranslation13(SPACE_PLUGIN);
1199
- return /* @__PURE__ */ React14.createElement("section", {
1178
+ const { t } = useTranslation12(SPACE_PLUGIN);
1179
+ return /* @__PURE__ */ React12.createElement("section", {
1200
1180
  className: "mbe-4 col-span-4 md:col-start-5 md:col-end-7 grid grid-cols-subgrid gap-y-2 auto-rows-min"
1201
- }, /* @__PURE__ */ React14.createElement("h2", {
1181
+ }, /* @__PURE__ */ React12.createElement("h2", {
1202
1182
  className: "contents"
1203
- }, /* @__PURE__ */ React14.createElement(Command, {
1183
+ }, /* @__PURE__ */ React12.createElement(Command, {
1204
1184
  weight: "duotone",
1205
- className: mx8(getSize4(5), "place-self-center")
1206
- }), /* @__PURE__ */ React14.createElement("span", {
1185
+ className: mx6(getSize4(5), "place-self-center")
1186
+ }), /* @__PURE__ */ React12.createElement("span", {
1207
1187
  className: "text-lg col-span-2 md:col-span-1"
1208
- }, t("keyshortcuts label"))), /* @__PURE__ */ React14.createElement("div", {
1188
+ }, t("keyshortcuts label"))), /* @__PURE__ */ React12.createElement("div", {
1209
1189
  role: "none",
1210
1190
  className: "col-start-2 col-end-4 md:col-end-5 pie-2"
1211
- }, /* @__PURE__ */ React14.createElement(Surface, {
1191
+ }, /* @__PURE__ */ React12.createElement(Surface, {
1212
1192
  role: "keyshortcuts"
1213
1193
  })));
1214
1194
  };
@@ -1217,7 +1197,7 @@ var SpaceMain = ({ space, role }) => {
1217
1197
  const state = space.state.get();
1218
1198
  const ready = state === SpaceState2.SPACE_READY;
1219
1199
  const Root = role === "main" ? Main.Content : "div";
1220
- return /* @__PURE__ */ React14.createElement(ClipboardProvider, null, /* @__PURE__ */ React14.createElement(Root, {
1200
+ return /* @__PURE__ */ React12.createElement(ClipboardProvider, null, /* @__PURE__ */ React12.createElement(Root, {
1221
1201
  ...role === "main" ? {
1222
1202
  classNames: [
1223
1203
  topbarBlockPaddingStart,
@@ -1226,23 +1206,23 @@ var SpaceMain = ({ space, role }) => {
1226
1206
  ]
1227
1207
  } : {
1228
1208
  role: "none",
1229
- className: mx8(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
1209
+ className: mx6(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
1230
1210
  },
1231
1211
  "data-testid": `spacePlugin.${role}`,
1232
1212
  "data-isready": ready ? "true" : "false"
1233
- }, ready && /* @__PURE__ */ React14.createElement(SpaceMembersSection, {
1213
+ }, ready && /* @__PURE__ */ React12.createElement(SpaceMembersSection, {
1234
1214
  space
1235
- }), /* @__PURE__ */ React14.createElement(KeyShortcuts, null)));
1215
+ }), /* @__PURE__ */ React12.createElement(KeyShortcuts, null)));
1236
1216
  };
1237
1217
 
1238
1218
  // packages/plugins/plugin-space/src/components/SpacePresence.tsx
1239
- import React15, { useCallback as useCallback4, useEffect as useEffect4, useState as useState7 } from "react";
1219
+ import React13, { useCallback as useCallback4, useEffect as useEffect4, useState as useState7 } from "react";
1240
1220
  import { usePlugin } from "@dxos/app-framework";
1241
1221
  import { generateName } from "@dxos/display-name";
1242
1222
  import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
1243
1223
  import { getSpace as getSpace3, useMembers as useMembers2, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1244
1224
  import { useIdentity } from "@dxos/react-client/halo";
1245
- import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useDensityContext, useTranslation as useTranslation14, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1225
+ import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useDensityContext, useTranslation as useTranslation13, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1246
1226
  import { AttentionGlyph } from "@dxos/react-ui-attention";
1247
1227
  import { ComplexMap, keyToFallback } from "@dxos/util";
1248
1228
  var REFRESH_INTERVAL = 5e3;
@@ -1280,50 +1260,50 @@ var SpacePresence = ({ object, spaceKey }) => {
1280
1260
  lastSeen
1281
1261
  };
1282
1262
  }).toSorted((a, b) => a.lastSeen - b.lastSeen);
1283
- return density === "fine" ? /* @__PURE__ */ React15.createElement(SmallPresence, {
1263
+ return density === "fine" ? /* @__PURE__ */ React13.createElement(SmallPresence, {
1284
1264
  count: membersForObject.length
1285
- }) : /* @__PURE__ */ React15.createElement(FullPresence, {
1265
+ }) : /* @__PURE__ */ React13.createElement(FullPresence, {
1286
1266
  members: membersForObject
1287
1267
  });
1288
1268
  };
1289
1269
  var FullPresence = (props) => {
1290
1270
  const { size = 9, onMemberClick } = props;
1291
- const members = useDefaultValue(props.members, []);
1271
+ const members = useDefaultValue(props.members, () => []);
1292
1272
  if (members.length === 0) {
1293
1273
  return null;
1294
1274
  }
1295
- return /* @__PURE__ */ React15.createElement(AvatarGroup.Root, {
1275
+ return /* @__PURE__ */ React13.createElement(AvatarGroup.Root, {
1296
1276
  size,
1297
1277
  classNames: "mbs-2 mie-4",
1298
1278
  "data-testid": "spacePlugin.presence"
1299
- }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React15.createElement(Tooltip2.Root, {
1279
+ }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React13.createElement(Tooltip2.Root, {
1300
1280
  key: member.identity.identityKey.toHex()
1301
- }, /* @__PURE__ */ React15.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React15.createElement(PrensenceAvatar, {
1281
+ }, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React13.createElement(PrensenceAvatar, {
1302
1282
  identity: member.identity,
1303
1283
  group: true,
1304
1284
  match: member.currentlyAttended,
1305
1285
  index: members.length - i,
1306
1286
  onClick: () => onMemberClick?.(member)
1307
- })), /* @__PURE__ */ React15.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React15.createElement(Tooltip2.Content, {
1287
+ })), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1308
1288
  side: "bottom"
1309
- }, /* @__PURE__ */ React15.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React15.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React15.createElement(Tooltip2.Root, null, /* @__PURE__ */ React15.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React15.createElement(AvatarGroupItem.Root, {
1289
+ }, /* @__PURE__ */ React13.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React13.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React13.createElement(Tooltip2.Root, null, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React13.createElement(AvatarGroupItem.Root, {
1310
1290
  status: "inactive"
1311
- }, /* @__PURE__ */ React15.createElement(Avatar.Frame, {
1291
+ }, /* @__PURE__ */ React13.createElement(Avatar.Frame, {
1312
1292
  style: {
1313
1293
  zIndex: members.length - 4
1314
1294
  }
1315
- }, /* @__PURE__ */ React15.createElement(Avatar.Fallback, {
1295
+ }, /* @__PURE__ */ React13.createElement(Avatar.Fallback, {
1316
1296
  text: `+${members.length - 3}`
1317
- })))), /* @__PURE__ */ React15.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React15.createElement(Tooltip2.Content, {
1297
+ })))), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1318
1298
  side: "bottom"
1319
- }, /* @__PURE__ */ React15.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React15.createElement(List2, {
1299
+ }, /* @__PURE__ */ React13.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React13.createElement(List2, {
1320
1300
  classNames: "max-h-56 overflow-y-auto"
1321
- }, members.map((member) => /* @__PURE__ */ React15.createElement(ListItem.Root, {
1301
+ }, members.map((member) => /* @__PURE__ */ React13.createElement(ListItem.Root, {
1322
1302
  key: member.identity.identityKey.toHex(),
1323
1303
  classNames: "flex gap-2 items-center cursor-pointer mbe-2",
1324
1304
  onClick: () => onMemberClick?.(member),
1325
1305
  "data-testid": "identity-list-item"
1326
- }, /* @__PURE__ */ React15.createElement(PrensenceAvatar, {
1306
+ }, /* @__PURE__ */ React13.createElement(PrensenceAvatar, {
1327
1307
  identity: member.identity,
1328
1308
  showName: true,
1329
1309
  match: member.currentlyAttended
@@ -1333,10 +1313,10 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
1333
1313
  const Root = group ? AvatarGroupItem.Root : Avatar.Root;
1334
1314
  const status = match ? "current" : "active";
1335
1315
  const fallbackValue = keyToFallback(identity.identityKey);
1336
- return /* @__PURE__ */ React15.createElement(Root, {
1316
+ return /* @__PURE__ */ React13.createElement(Root, {
1337
1317
  status,
1338
1318
  hue: identity.profile?.data?.hue || fallbackValue.hue
1339
- }, /* @__PURE__ */ React15.createElement(Avatar.Frame, {
1319
+ }, /* @__PURE__ */ React13.createElement(Avatar.Frame, {
1340
1320
  "data-testid": "spacePlugin.presence.member",
1341
1321
  "data-status": status,
1342
1322
  ...index ? {
@@ -1345,9 +1325,9 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
1345
1325
  }
1346
1326
  } : {},
1347
1327
  onClick: () => onClick?.()
1348
- }, /* @__PURE__ */ React15.createElement(Avatar.Fallback, {
1328
+ }, /* @__PURE__ */ React13.createElement(Avatar.Fallback, {
1349
1329
  text: identity.profile?.data?.emoji || fallbackValue.emoji
1350
- })), showName && /* @__PURE__ */ React15.createElement(Avatar.Label, {
1330
+ })), showName && /* @__PURE__ */ React13.createElement(Avatar.Label, {
1351
1331
  classNames: "text-sm truncate pli-2"
1352
1332
  }, getName(identity)));
1353
1333
  };
@@ -1358,36 +1338,37 @@ var SmallPresenceLive = ({ viewers }) => {
1358
1338
  return () => clearInterval(interval);
1359
1339
  }, []);
1360
1340
  const activeViewers = viewers ? Array.from(viewers.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION) : [];
1361
- return /* @__PURE__ */ React15.createElement(SmallPresence, {
1341
+ return /* @__PURE__ */ React13.createElement(SmallPresence, {
1362
1342
  count: activeViewers.length
1363
1343
  });
1364
1344
  };
1365
1345
  var SmallPresence = ({ count }) => {
1366
- const { t } = useTranslation14(SPACE_PLUGIN);
1367
- return /* @__PURE__ */ React15.createElement(Tooltip2.Root, null, /* @__PURE__ */ React15.createElement(Tooltip2.Trigger, {
1346
+ const { t } = useTranslation13(SPACE_PLUGIN);
1347
+ return /* @__PURE__ */ React13.createElement(Tooltip2.Root, null, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, {
1368
1348
  asChild: true
1369
- }, /* @__PURE__ */ React15.createElement(AttentionGlyph, {
1349
+ }, /* @__PURE__ */ React13.createElement(AttentionGlyph, {
1370
1350
  presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1371
1351
  classNames: "self-center mie-1"
1372
- })), /* @__PURE__ */ React15.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React15.createElement(Tooltip2.Content, {
1352
+ })), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1373
1353
  side: "bottom",
1374
1354
  classNames: "z-[70]"
1375
- }, /* @__PURE__ */ React15.createElement("span", null, t("presence label", {
1355
+ }, /* @__PURE__ */ React13.createElement("span", null, t("presence label", {
1376
1356
  count
1377
- })), /* @__PURE__ */ React15.createElement(Tooltip2.Arrow, null))));
1357
+ })), /* @__PURE__ */ React13.createElement(Tooltip2.Arrow, null))));
1378
1358
  };
1379
1359
 
1380
1360
  // packages/plugins/plugin-space/src/components/SpaceSettings.tsx
1381
- import React16 from "react";
1382
- import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
1361
+ import React14 from "react";
1362
+ import { useIntentDispatcher as useIntentDispatcher2, useResolvePlugins } from "@dxos/app-framework";
1383
1363
  import { SettingsValue } from "@dxos/plugin-settings";
1384
- import { Input as Input3, useTranslation as useTranslation15 } from "@dxos/react-ui";
1364
+ import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation14 } from "@dxos/react-ui";
1385
1365
  var SpaceSettings = ({ settings }) => {
1386
- const { t } = useTranslation15(SPACE_PLUGIN);
1366
+ const { t } = useTranslation14(SPACE_PLUGIN);
1387
1367
  const dispatch = useIntentDispatcher2();
1388
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(SettingsValue, {
1368
+ const plugins = useResolvePlugins(parseSpaceInitPlugin);
1369
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(SettingsValue, {
1389
1370
  label: t("show hidden spaces label")
1390
- }, /* @__PURE__ */ React16.createElement(Input3.Switch, {
1371
+ }, /* @__PURE__ */ React14.createElement(Input4.Switch, {
1391
1372
  checked: settings.showHidden,
1392
1373
  onCheckedChange: (checked) => dispatch({
1393
1374
  plugin: SPACE_PLUGIN,
@@ -1396,7 +1377,307 @@ var SpaceSettings = ({ settings }) => {
1396
1377
  state: !!checked
1397
1378
  }
1398
1379
  })
1399
- })));
1380
+ })), /* @__PURE__ */ React14.createElement(SettingsValue, {
1381
+ label: t("default on space create label")
1382
+ }, /* @__PURE__ */ React14.createElement(Select.Root, {
1383
+ value: settings.onSpaceCreate,
1384
+ onValueChange: (value) => {
1385
+ settings.onSpaceCreate = value;
1386
+ }
1387
+ }, /* @__PURE__ */ React14.createElement(Select.TriggerButton, null), /* @__PURE__ */ React14.createElement(Select.Portal, null, /* @__PURE__ */ React14.createElement(Select.Content, null, /* @__PURE__ */ React14.createElement(Select.Viewport, null, plugins.map(({ provides: { space: { onSpaceCreate } } }) => /* @__PURE__ */ React14.createElement(Select.Option, {
1388
+ key: onSpaceCreate.action,
1389
+ value: onSpaceCreate.action
1390
+ }, toLocalizedString2(onSpaceCreate.label, t)))))))));
1391
+ };
1392
+
1393
+ // packages/plugins/plugin-space/src/components/SaveStatus.tsx
1394
+ import React15, { useEffect as useEffect5, useState as useState8 } from "react";
1395
+ import { Context } from "@dxos/context";
1396
+ import { StatusBar } from "@dxos/plugin-status-bar";
1397
+ import { useClient as useClient4 } from "@dxos/react-client";
1398
+ import { Icon, useTranslation as useTranslation15 } from "@dxos/react-ui";
1399
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SaveStatus.tsx";
1400
+ var SaveStatus = () => {
1401
+ const { t } = useTranslation15(SPACE_PLUGIN);
1402
+ const client = useClient4();
1403
+ const [state, setState] = useState8("saved");
1404
+ useEffect5(() => {
1405
+ return createClientSaveTracker(client, (state2) => {
1406
+ setState(state2);
1407
+ });
1408
+ }, []);
1409
+ return /* @__PURE__ */ React15.createElement(StatusBar.Item, {
1410
+ title: state === "saving" ? t("saving label") : t("saved label")
1411
+ }, /* @__PURE__ */ React15.createElement(Icon, {
1412
+ icon: state === "saving" ? "ph--arrows-clockwise--regular" : "ph--check-circle--regular",
1413
+ size: 4
1414
+ }));
1415
+ };
1416
+ var createClientSaveTracker = (client, cb) => {
1417
+ const unsubscribeCallbacks = {};
1418
+ const state = {};
1419
+ const install = (spaces) => {
1420
+ for (const space of spaces) {
1421
+ if (state[space.id]) {
1422
+ continue;
1423
+ }
1424
+ state[space.id] = "saved";
1425
+ unsubscribeCallbacks[space.id] = createSpaceSaveTracker(space, (s) => {
1426
+ state[space.id] = s;
1427
+ cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
1428
+ });
1429
+ }
1430
+ };
1431
+ client.spaces.subscribe((spaces) => {
1432
+ install(spaces);
1433
+ });
1434
+ install(client.spaces.get());
1435
+ return () => {
1436
+ for (const unsubscribe of Object.values(unsubscribeCallbacks)) {
1437
+ unsubscribe();
1438
+ }
1439
+ };
1440
+ };
1441
+ var createSpaceSaveTracker = (space, cb) => {
1442
+ const ctx = new Context(void 0, {
1443
+ F: __dxlog_file3,
1444
+ L: 64
1445
+ });
1446
+ void space.waitUntilReady().then(() => {
1447
+ if (ctx.disposed) {
1448
+ return;
1449
+ }
1450
+ let hasUnsavedChanges = false;
1451
+ let lastFlushPromise;
1452
+ space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
1453
+ hasUnsavedChanges = unsavedDocuments.length > 0;
1454
+ });
1455
+ space.crud.saveStateChanged.debounce(500).on(ctx, () => {
1456
+ if (hasUnsavedChanges) {
1457
+ lastFlushPromise = void 0;
1458
+ cb("saving");
1459
+ } else {
1460
+ const flushPromise = space.crud.flush();
1461
+ lastFlushPromise = flushPromise;
1462
+ void flushPromise.then(() => {
1463
+ if (lastFlushPromise === flushPromise) {
1464
+ cb("saved");
1465
+ }
1466
+ });
1467
+ }
1468
+ });
1469
+ });
1470
+ return () => {
1471
+ void ctx.dispose();
1472
+ };
1473
+ };
1474
+
1475
+ // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1476
+ import React16, { useEffect as useEffect7, useState as useState10 } from "react";
1477
+ import { StatusBar as StatusBar2 } from "@dxos/plugin-status-bar";
1478
+ import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation16 } from "@dxos/react-ui";
1479
+ import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
1480
+ import { mx as mx7 } from "@dxos/react-ui-theme";
1481
+
1482
+ // packages/plugins/plugin-space/src/components/SyncStatus/types.ts
1483
+ import { useEffect as useEffect6, useState as useState9 } from "react";
1484
+ import { Context as Context2 } from "@dxos/context";
1485
+ import { EdgeService } from "@dxos/protocols";
1486
+ import { useClient as useClient5 } from "@dxos/react-client";
1487
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/types.ts";
1488
+ var createEmptyEdgeSyncState = () => ({
1489
+ missingOnLocal: 0,
1490
+ missingOnRemote: 0,
1491
+ localDocumentCount: 0,
1492
+ remoteDocumentCount: 0,
1493
+ differentDocuments: 0
1494
+ });
1495
+ var getSyncSummary = (syncMap) => {
1496
+ return Object.entries(syncMap).reduce((summary, [_spaceId, peerState]) => {
1497
+ summary.missingOnLocal += peerState.missingOnLocal;
1498
+ summary.missingOnRemote += peerState.missingOnRemote;
1499
+ summary.localDocumentCount += peerState.localDocumentCount;
1500
+ summary.remoteDocumentCount += peerState.remoteDocumentCount;
1501
+ summary.differentDocuments += peerState.differentDocuments;
1502
+ return summary;
1503
+ }, createEmptyEdgeSyncState());
1504
+ };
1505
+ var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
1506
+ var useSyncState = () => {
1507
+ const client = useClient5();
1508
+ const [spaceState, setSpaceState] = useState9({});
1509
+ useEffect6(() => {
1510
+ const ctx = new Context2(void 0, {
1511
+ F: __dxlog_file4,
1512
+ L: 48
1513
+ });
1514
+ const createSubscriptions = (spaces) => {
1515
+ for (const space of spaces) {
1516
+ if (spaceState[space.id]) {
1517
+ continue;
1518
+ }
1519
+ ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
1520
+ const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
1521
+ if (syncState) {
1522
+ setSpaceState((spaceState2) => ({
1523
+ ...spaceState2,
1524
+ [space.id]: syncState
1525
+ }));
1526
+ }
1527
+ }));
1528
+ }
1529
+ };
1530
+ createSubscriptions(client.spaces.get());
1531
+ client.spaces.subscribe((spaces) => {
1532
+ createSubscriptions(spaces);
1533
+ });
1534
+ return () => {
1535
+ void ctx.dispose();
1536
+ };
1537
+ }, [
1538
+ client
1539
+ ]);
1540
+ return spaceState;
1541
+ };
1542
+
1543
+ // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1544
+ var SYNC_STALLED_TIMEOUT = 5e3;
1545
+ var styles = {
1546
+ barBg: "bg-neutral-50 dark:bg-green-900 text-black",
1547
+ barFg: "bg-neutral-100 bg-green-500",
1548
+ barHover: "dark:hover:bg-green-500"
1549
+ };
1550
+ var SyncStatus = () => {
1551
+ const state = useSyncState();
1552
+ return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
1553
+ state
1554
+ });
1555
+ };
1556
+ var SyncStatusIndicator = ({ state }) => {
1557
+ const summary = getSyncSummary(state);
1558
+ const offline = false;
1559
+ const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1560
+ const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1561
+ const [classNames, setClassNames] = useState10();
1562
+ useEffect7(() => {
1563
+ setClassNames(void 0);
1564
+ if (!needsToUpload && !needsToDownload) {
1565
+ return;
1566
+ }
1567
+ const t = setTimeout(() => {
1568
+ setClassNames("text-orange-500");
1569
+ }, SYNC_STALLED_TIMEOUT);
1570
+ return () => clearTimeout(t);
1571
+ }, [
1572
+ needsToUpload,
1573
+ needsToDownload
1574
+ ]);
1575
+ return /* @__PURE__ */ React16.createElement(StatusBar2.Item, null, /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, null, /* @__PURE__ */ React16.createElement(Icon2, {
1576
+ icon: offline ? "ph--cloud-x--regular" : needsToUpload ? "ph--cloud-arrow-up--regular" : needsToDownload ? "ph--cloud-arrow-down--regular" : "ph--cloud-check--regular",
1577
+ size: 4,
1578
+ classNames
1579
+ })), /* @__PURE__ */ React16.createElement(Popover3.Content, null, /* @__PURE__ */ React16.createElement(SyncStatusDetail, {
1580
+ state,
1581
+ summary,
1582
+ debug: false
1583
+ }))));
1584
+ };
1585
+ var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
1586
+ const { t } = useTranslation16(SPACE_PLUGIN);
1587
+ const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
1588
+ return /* @__PURE__ */ React16.createElement("div", {
1589
+ className: mx7("flex flex-col text-xs min-w-[16rem]", classNames)
1590
+ }, /* @__PURE__ */ React16.createElement("h1", {
1591
+ className: "p-2"
1592
+ }, t("sync status title")), /* @__PURE__ */ React16.createElement("div", {
1593
+ className: "flex flex-col gap-[2px] my-[2px]"
1594
+ }, entries.map(([spaceId, state2]) => /* @__PURE__ */ React16.createElement(SpaceRow, {
1595
+ key: spaceId,
1596
+ spaceId,
1597
+ state: state2
1598
+ }))), debug && /* @__PURE__ */ React16.createElement(SyntaxHighlighter, {
1599
+ language: "json"
1600
+ }, JSON.stringify(summary, null, 2)));
1601
+ };
1602
+ var useActive = (count) => {
1603
+ const [current, setCurrent] = useState10(count);
1604
+ const [active, setActive] = useState10(false);
1605
+ useEffect7(() => {
1606
+ let t;
1607
+ if (count !== current) {
1608
+ setActive(true);
1609
+ setCurrent(count);
1610
+ t && clearTimeout(t);
1611
+ t = setTimeout(() => {
1612
+ setActive(false);
1613
+ }, SYNC_STALLED_TIMEOUT);
1614
+ }
1615
+ return () => {
1616
+ setActive(false);
1617
+ clearTimeout(t);
1618
+ };
1619
+ }, [
1620
+ count,
1621
+ current
1622
+ ]);
1623
+ return active;
1624
+ };
1625
+ var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
1626
+ const downActive = useActive(localDocumentCount);
1627
+ const upActive = useActive(remoteDocumentCount);
1628
+ return /* @__PURE__ */ React16.createElement("div", {
1629
+ className: mx7("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
1630
+ title: spaceId,
1631
+ onClick: () => {
1632
+ void navigator.clipboard.writeText(spaceId);
1633
+ }
1634
+ }, /* @__PURE__ */ React16.createElement(Icon2, {
1635
+ icon: "ph--arrow-fat-line-left--regular",
1636
+ size: 3,
1637
+ classNames: mx7(downActive && "animate-[pulse_1s_infinite]")
1638
+ }), /* @__PURE__ */ React16.createElement(Candle, {
1639
+ up: {
1640
+ count: remoteDocumentCount,
1641
+ total: remoteDocumentCount + missingOnRemote
1642
+ },
1643
+ down: {
1644
+ count: localDocumentCount,
1645
+ total: localDocumentCount + missingOnLocal
1646
+ },
1647
+ title: spaceId
1648
+ }), /* @__PURE__ */ React16.createElement(Icon2, {
1649
+ icon: "ph--arrow-fat-line-right--regular",
1650
+ size: 3,
1651
+ classNames: mx7(upActive && "animate-[pulse_1s_step-start_infinite]")
1652
+ }));
1653
+ };
1654
+ var Candle = ({ classNames, up, down }) => {
1655
+ return /* @__PURE__ */ React16.createElement("div", {
1656
+ className: mx7("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
1657
+ }, /* @__PURE__ */ React16.createElement(Bar, {
1658
+ classNames: "justify-end",
1659
+ ...up
1660
+ }), /* @__PURE__ */ React16.createElement("div", {
1661
+ className: "relative"
1662
+ }, /* @__PURE__ */ React16.createElement("div", {
1663
+ className: mx7("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
1664
+ }, up.total)), /* @__PURE__ */ React16.createElement(Bar, down));
1665
+ };
1666
+ var Bar = ({ classNames, count, total }) => {
1667
+ let p = count / total * 100;
1668
+ if (count < total) {
1669
+ p = Math.min(p, 95);
1670
+ }
1671
+ return /* @__PURE__ */ React16.createElement("div", {
1672
+ className: mx7("relative flex w-full", styles.barBg, classNames)
1673
+ }, /* @__PURE__ */ React16.createElement("div", {
1674
+ className: mx7("shrink-0", styles.barFg),
1675
+ style: {
1676
+ width: `${p}%`
1677
+ }
1678
+ }), count !== total && /* @__PURE__ */ React16.createElement("div", {
1679
+ className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
1680
+ }, count));
1400
1681
  };
1401
1682
 
1402
1683
  // packages/plugins/plugin-space/src/translations.ts
@@ -1478,21 +1759,27 @@ var translations_default = [
1478
1759
  "space limit close label": "Close",
1479
1760
  "remove deleted objects label": "Cleanup",
1480
1761
  "remove deleted objects alt": "Permanently remove deleted objects to free up space.",
1481
- "copy link label": "Copy link"
1762
+ "copy link label": "Copy link",
1763
+ "default on space create label": "On space create",
1764
+ "sync status title": "Sync status",
1765
+ "name label": "Name",
1766
+ "name placeholder": "Name"
1482
1767
  }
1483
1768
  }
1484
1769
  }
1485
1770
  ];
1486
1771
 
1487
1772
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
1488
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
1773
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
1489
1774
  var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
1490
1775
  var OBJECT_ID_LENGTH = 60;
1491
1776
  var SPACE_MAX_OBJECTS = 500;
1492
1777
  var DIRECTORY_TYPE = "text/directory";
1493
1778
  var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
1494
1779
  var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1495
- const settings = new LocalStorageStore(SPACE_PLUGIN);
1780
+ const settings = new LocalStorageStore(SPACE_PLUGIN, {
1781
+ onSpaceCreate: "dxos.org/plugin/markdown/action/create"
1782
+ });
1496
1783
  const state = new LocalStorageStore(SPACE_PLUGIN, {
1497
1784
  awaiting: void 0,
1498
1785
  spaceNames: {},
@@ -1572,8 +1859,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1572
1859
  log2.warn("Failed to broadcast active node for presence.", {
1573
1860
  err: err.message
1574
1861
  }, {
1575
- F: __dxlog_file3,
1576
- L: 222,
1862
+ F: __dxlog_file5,
1863
+ L: 224,
1577
1864
  S: void 0,
1578
1865
  C: (f, a) => f(...a)
1579
1866
  });
@@ -1694,8 +1981,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1694
1981
  ns: SPACE_PLUGIN
1695
1982
  }
1696
1983
  ],
1697
- icon: (props) => /* @__PURE__ */ React17.createElement(CardsThree2, props),
1698
- iconSymbol: "ph--cards-three--regular",
1984
+ icon: "ph--cards-three--regular",
1699
1985
  // TODO(wittjosiah): Move out of metadata.
1700
1986
  loadReferences: (collection) => loadObjectReferences(collection, (collection2) => [
1701
1987
  ...collection2.objects,
@@ -1717,7 +2003,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1717
2003
  case "main":
1718
2004
  return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface2, {
1719
2005
  data: {
1720
- active: primary.properties[CollectionType.typename]
2006
+ active: primary.properties[CollectionType.typename],
2007
+ id: primary.id
1721
2008
  },
1722
2009
  role,
1723
2010
  ...rest
@@ -1729,16 +2016,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1729
2016
  } : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */ React17.createElement(MissingObject, {
1730
2017
  id: primary
1731
2018
  }) : null;
1732
- // TODO(burdon): Add role name syntax to minimal plugin docs.
1733
- case "tree--empty":
1734
- switch (true) {
1735
- case data.plugin === SPACE_PLUGIN:
1736
- return /* @__PURE__ */ React17.createElement(EmptyTree, null);
1737
- case (isGraphNode(data.activeNode) && isSpace2(data.activeNode.data)):
1738
- return /* @__PURE__ */ React17.createElement(EmptySpace, null);
1739
- default:
1740
- return null;
1741
- }
2019
+ case "complementary--settings":
2020
+ return isEchoObject2(data.subject) ? /* @__PURE__ */ React17.createElement(FallbackSettings, {
2021
+ object: data.subject
2022
+ }) : null;
1742
2023
  case "dialog":
1743
2024
  if (data.component === "dxos.org/plugin/space/InvitationManagerDialog") {
1744
2025
  return /* @__PURE__ */ React17.createElement(Dialog.Content, null, /* @__PURE__ */ React17.createElement(ClipboardProvider2, null, /* @__PURE__ */ React17.createElement(InvitationManager, {
@@ -1760,6 +2041,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1760
2041
  });
1761
2042
  }
1762
2043
  return null;
2044
+ // TODO(burdon): Add role name syntax to minimal plugin docs.
1763
2045
  case "presence--glyph": {
1764
2046
  return isReactiveObject2(data.object) ? /* @__PURE__ */ React17.createElement(SmallPresenceLive, {
1765
2047
  viewers: state.values.viewersByObject[fullyQualifiedId4(data.object)]
@@ -1801,6 +2083,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1801
2083
  object: data.object
1802
2084
  });
1803
2085
  }
2086
+ case "status": {
2087
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SyncStatus, null), /* @__PURE__ */ React17.createElement(SaveStatus, null));
2088
+ }
1804
2089
  default:
1805
2090
  return null;
1806
2091
  }
@@ -1860,8 +2145,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1860
2145
  spacesOrder.order = nextOrder.map(({ id }) => id);
1861
2146
  } else {
1862
2147
  log2.warn("spaces order object not found", void 0, {
1863
- F: __dxlog_file3,
1864
- L: 514,
2148
+ F: __dxlog_file5,
2149
+ L: 520,
1865
2150
  S: void 0,
1866
2151
  C: (f, a) => f(...a)
1867
2152
  });
@@ -1897,8 +2182,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1897
2182
  ns: SPACE_PLUGIN
1898
2183
  }
1899
2184
  ],
1900
- icon: (props) => /* @__PURE__ */ React17.createElement(Plus2, props),
1901
- iconSymbol: "ph--plus--regular",
2185
+ icon: "ph--plus--regular",
1902
2186
  disposition: "toolbar",
1903
2187
  testId: "spacePlugin.createSpace"
1904
2188
  }
@@ -1923,8 +2207,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1923
2207
  ns: SPACE_PLUGIN
1924
2208
  }
1925
2209
  ],
1926
- icon: (props) => /* @__PURE__ */ React17.createElement(SignIn, props),
1927
- iconSymbol: "ph--sign-in--regular",
2210
+ icon: "ph--sign-in--regular",
1928
2211
  testId: "spacePlugin.joinSpace"
1929
2212
  }
1930
2213
  }
@@ -2052,6 +2335,45 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2052
2335
  resolve
2053
2336
  })).filter(nonNullable);
2054
2337
  }
2338
+ }),
2339
+ // Create nodes for object settings.
2340
+ createExtension({
2341
+ id: `${SPACE_PLUGIN}/settings-for-subject`,
2342
+ resolver: ({ id }) => {
2343
+ if (!id.endsWith("~settings")) {
2344
+ return;
2345
+ }
2346
+ const subjectId = id.split("~").at(0);
2347
+ const [spaceId, objectId] = subjectId?.split(":") ?? [];
2348
+ const space = client.spaces.get().find((space2) => space2.id === spaceId);
2349
+ const object = toSignal((onChange) => {
2350
+ const timeout = setTimeout(async () => {
2351
+ await space?.db.loadObjectById(objectId);
2352
+ onChange();
2353
+ });
2354
+ return () => clearTimeout(timeout);
2355
+ }, () => space?.db.getObjectById(objectId), subjectId);
2356
+ if (!object || !subjectId) {
2357
+ return;
2358
+ }
2359
+ const meta = resolve(getTypename2(object) ?? "");
2360
+ const label = meta.label?.(object) || object.name || meta.placeholder || [
2361
+ "unnamed object settings label",
2362
+ {
2363
+ ns: SPACE_PLUGIN
2364
+ }
2365
+ ];
2366
+ return {
2367
+ id,
2368
+ type: "orphan-settings-for-subject",
2369
+ data: null,
2370
+ properties: {
2371
+ icon: "ph--gear--regular",
2372
+ label,
2373
+ object
2374
+ }
2375
+ };
2376
+ }
2055
2377
  })
2056
2378
  ];
2057
2379
  },
@@ -2159,6 +2481,25 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2159
2481
  }
2160
2482
  },
2161
2483
  intents: [
2484
+ ...settings.values.onSpaceCreate ? [
2485
+ [
2486
+ {
2487
+ action: settings.values.onSpaceCreate,
2488
+ data: {
2489
+ space
2490
+ }
2491
+ },
2492
+ {
2493
+ action: SpaceAction.ADD_OBJECT,
2494
+ data: {
2495
+ target: space
2496
+ }
2497
+ },
2498
+ {
2499
+ action: NavigationAction3.EXPOSE
2500
+ }
2501
+ ]
2502
+ ] : [],
2162
2503
  [
2163
2504
  {
2164
2505
  action: ObservabilityAction.SEND_EVENT,
@@ -2379,8 +2720,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2379
2720
  title: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit label"],
2380
2721
  description: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit description"],
2381
2722
  duration: 5e3,
2382
- icon: (props) => /* @__PURE__ */ React17.createElement(Warning2, props),
2383
- iconSymbol: "ph--warning--regular",
2723
+ icon: "ph--warning--regular",
2384
2724
  actionLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects label"],
2385
2725
  actionAlt: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects alt"],
2386
2726
  // TODO(wittjosiah): Use OS namespace.
@@ -2422,7 +2762,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2422
2762
  }
2423
2763
  return {
2424
2764
  data: {
2425
- id: object.id,
2765
+ id: fullyQualifiedId4(object),
2426
2766
  object,
2427
2767
  activeParts: {
2428
2768
  main: [
@@ -2475,8 +2815,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2475
2815
  data: {
2476
2816
  activeParts: {
2477
2817
  main: deletionData.wasActive,
2478
- sidebar: deletionData.wasActive,
2479
- complementary: deletionData.wasActive
2818
+ sidebar: deletionData.wasActive
2480
2819
  }
2481
2820
  }
2482
2821
  });
@@ -2596,10 +2935,10 @@ export {
2596
2935
  CollectionSection,
2597
2936
  CollectionType,
2598
2937
  ContactType,
2599
- EmptySpace,
2600
- EmptyTree,
2938
+ FallbackSettings,
2601
2939
  FullPresence,
2602
2940
  MenuFooter,
2941
+ MessageState,
2603
2942
  MessageType,
2604
2943
  MissingObject,
2605
2944
  PersistenceStatus,
@@ -2611,6 +2950,7 @@ export {
2611
2950
  SPACE_PLUGIN,
2612
2951
  SPACE_PLUGIN_SHORT_ID,
2613
2952
  SPACE_TYPE,
2953
+ SaveStatus,
2614
2954
  ShareSpaceButton,
2615
2955
  ShareSpaceButtonImpl,
2616
2956
  SmallPresence,
@@ -2620,6 +2960,9 @@ export {
2620
2960
  SpacePlugin,
2621
2961
  SpacePresence,
2622
2962
  SpaceSettings,
2963
+ SyncStatus,
2964
+ SyncStatusDetail,
2965
+ SyncStatusIndicator,
2623
2966
  ThreadStatus,
2624
2967
  ThreadType,
2625
2968
  cloneObject,
@@ -2634,6 +2977,7 @@ export {
2634
2977
  getNestedObjects,
2635
2978
  getSpaceDisplayName,
2636
2979
  memoizeQuery,
2980
+ parseSpaceInitPlugin,
2637
2981
  parseSpacePlugin,
2638
2982
  translations_default as translations
2639
2983
  };