@dxos/plugin-space 0.6.14-main.f49f251 → 0.6.14-staging.54a8bab

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 (58) hide show
  1. package/dist/lib/browser/{chunk-FOI7DAUV.mjs → chunk-WZAM3FNP.mjs} +1 -1
  2. package/dist/lib/browser/{chunk-FOI7DAUV.mjs.map → chunk-WZAM3FNP.mjs.map} +2 -2
  3. package/dist/lib/browser/index.mjs +432 -387
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-OTDRTHT4.cjs → chunk-HTAM5LQD.cjs} +4 -4
  8. package/dist/lib/node/{chunk-OTDRTHT4.cjs.map → chunk-HTAM5LQD.cjs.map} +2 -2
  9. package/dist/lib/node/index.cjs +474 -433
  10. package/dist/lib/node/index.cjs.map +4 -4
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/types/index.cjs +11 -11
  13. package/dist/lib/node/types/index.cjs.map +1 -1
  14. package/dist/lib/node-esm/{chunk-FYDGMPSC.mjs → chunk-TRJKV4PK.mjs} +1 -1
  15. package/dist/lib/node-esm/{chunk-FYDGMPSC.mjs.map → chunk-TRJKV4PK.mjs.map} +2 -2
  16. package/dist/lib/node-esm/index.mjs +432 -387
  17. package/dist/lib/node-esm/index.mjs.map +4 -4
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/lib/node-esm/types/index.mjs +1 -1
  20. package/dist/types/src/SpacePlugin.d.ts.map +1 -1
  21. package/dist/types/src/components/SpaceSettingsPanel.d.ts.map +1 -1
  22. package/dist/types/src/components/SyncStatus/Space.d.ts +8 -0
  23. package/dist/types/src/components/SyncStatus/Space.d.ts.map +1 -0
  24. package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +3 -2
  25. package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
  26. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +5 -20
  27. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/SyncStatus/save-tracker.d.ts +3 -0
  29. package/dist/types/src/components/SyncStatus/save-tracker.d.ts.map +1 -0
  30. package/dist/types/src/components/SyncStatus/status.d.ts +9 -0
  31. package/dist/types/src/components/SyncStatus/status.d.ts.map +1 -0
  32. package/dist/types/src/components/SyncStatus/{types.d.ts → sync-state.d.ts} +1 -1
  33. package/dist/types/src/components/SyncStatus/sync-state.d.ts.map +1 -0
  34. package/dist/types/src/components/index.d.ts +0 -2
  35. package/dist/types/src/components/index.d.ts.map +1 -1
  36. package/dist/types/src/translations.d.ts +6 -0
  37. package/dist/types/src/translations.d.ts.map +1 -1
  38. package/dist/types/src/types/types.d.ts +2 -1
  39. package/dist/types/src/types/types.d.ts.map +1 -1
  40. package/package.json +34 -33
  41. package/src/SpacePlugin.tsx +55 -30
  42. package/src/components/SpaceSettings.tsx +5 -5
  43. package/src/components/SpaceSettingsPanel.tsx +18 -8
  44. package/src/components/SyncStatus/Space.tsx +109 -0
  45. package/src/components/SyncStatus/SyncStatus.stories.tsx +13 -4
  46. package/src/components/SyncStatus/SyncStatus.tsx +43 -129
  47. package/src/components/{SaveStatus.tsx → SyncStatus/save-tracker.ts} +1 -25
  48. package/src/components/SyncStatus/status.ts +44 -0
  49. package/src/components/index.ts +0 -2
  50. package/src/translations.ts +6 -0
  51. package/src/types/types.ts +3 -1
  52. package/dist/types/src/components/MissingObject.d.ts +0 -5
  53. package/dist/types/src/components/MissingObject.d.ts.map +0 -1
  54. package/dist/types/src/components/SaveStatus.d.ts +0 -3
  55. package/dist/types/src/components/SaveStatus.d.ts.map +0 -1
  56. package/dist/types/src/components/SyncStatus/types.d.ts.map +0 -1
  57. package/src/components/MissingObject.tsx +0 -54
  58. /package/src/components/SyncStatus/{types.ts → sync-state.ts} +0 -0
@@ -15,12 +15,12 @@ import {
15
15
  ThreadStatus,
16
16
  ThreadType,
17
17
  parseSpaceInitPlugin
18
- } from "./chunk-FOI7DAUV.mjs";
18
+ } from "./chunk-WZAM3FNP.mjs";
19
19
 
20
20
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
21
21
  import { signal } from "@preact/signals-core";
22
- import React18 from "react";
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";
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";
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";
@@ -32,7 +32,7 @@ import { parseClientPlugin } from "@dxos/plugin-client";
32
32
  import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
33
33
  import { ObservabilityAction } from "@dxos/plugin-observability/meta";
34
34
  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 } from "@dxos/react-client/echo";
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
36
  import { Dialog } from "@dxos/react-ui";
37
37
  import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
38
38
  import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
@@ -758,66 +758,25 @@ var MenuFooter = ({ object }) => {
758
758
  }), toLocalizedString(spaceName, t)))) : null;
759
759
  };
760
760
 
761
- // packages/plugins/plugin-space/src/components/MissingObject.tsx
762
- import React6, { useEffect as useEffect2, useState as useState2 } from "react";
763
- import { parseIntentPlugin as parseIntentPlugin2, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
764
- import { Status, useTranslation as useTranslation6 } from "@dxos/react-ui";
765
- import { baseSurface as baseSurface2, descriptionText as descriptionText2, mx as mx3 } from "@dxos/react-ui-theme";
766
- var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
767
- var MissingObject = ({ id }) => {
768
- const { t } = useTranslation6(SPACE_PLUGIN);
769
- const [waiting, setWaiting] = useState2(false);
770
- const intentPlugin = useResolvePlugin2(parseIntentPlugin2);
771
- useEffect2(() => {
772
- if (!intentPlugin) {
773
- return;
774
- }
775
- const timeout = setTimeout(async () => {
776
- setWaiting(true);
777
- await intentPlugin.provides.intent.dispatch({
778
- plugin: SPACE_PLUGIN,
779
- action: SpaceAction.WAIT_FOR_OBJECT,
780
- data: {
781
- id
782
- }
783
- });
784
- }, WAIT_FOR_OBJECT_TIMEOUT2);
785
- return () => clearTimeout(timeout);
786
- }, [
787
- intentPlugin,
788
- id
789
- ]);
790
- return /* @__PURE__ */ React6.createElement("div", {
791
- role: "none",
792
- className: mx3(baseSurface2, "min-bs-screen is-full flex items-center justify-center p-8")
793
- }, waiting ? /* @__PURE__ */ React6.createElement("p", {
794
- role: "alert",
795
- className: mx3(descriptionText2, "border border-dashed border-neutral-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
796
- }, t("missing object message")) : /* @__PURE__ */ React6.createElement(Status, {
797
- indeterminate: true,
798
- "aria-label": "Initializing"
799
- }));
800
- };
801
-
802
761
  // packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
803
762
  import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
804
- import React7, { useEffect as useEffect3, useState as useState3 } from "react";
763
+ import React6, { useEffect as useEffect2, useState as useState2 } from "react";
805
764
  import { debounce } from "@dxos/async";
806
- import { Tooltip, useTranslation as useTranslation7 } from "@dxos/react-ui";
807
- import { getSize as getSize2, mx as mx4, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
808
- var Status2;
809
- (function(Status3) {
810
- Status3[Status3["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
811
- Status3[Status3["PENDING"] = 1] = "PENDING";
812
- Status3[Status3["ERROR"] = 2] = "ERROR";
813
- })(Status2 || (Status2 = {}));
765
+ import { Tooltip, useTranslation as useTranslation6 } from "@dxos/react-ui";
766
+ import { getSize as getSize2, mx as mx3, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
767
+ var Status;
768
+ (function(Status2) {
769
+ Status2[Status2["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
770
+ Status2[Status2["PENDING"] = 1] = "PENDING";
771
+ Status2[Status2["ERROR"] = 2] = "ERROR";
772
+ })(Status || (Status = {}));
814
773
  var PersistenceStatus = ({ db }) => {
815
- const { t } = useTranslation7(SPACE_PLUGIN);
816
- const [displayMessage, setDisplayMessage] = useState3(false);
817
- const [status, naturalSetStatus] = useState3(0);
818
- const [prevStatus, setPrevStatus] = useState3(0);
774
+ const { t } = useTranslation6(SPACE_PLUGIN);
775
+ const [displayMessage, setDisplayMessage] = useState2(false);
776
+ const [status, naturalSetStatus] = useState2(0);
777
+ const [prevStatus, setPrevStatus] = useState2(0);
819
778
  const _setStatus = debounce(naturalSetStatus, 500);
820
- useEffect3(() => {
779
+ useEffect2(() => {
821
780
  setPrevStatus(status);
822
781
  if (prevStatus !== status && status === 0) {
823
782
  setDisplayMessage(true);
@@ -829,48 +788,48 @@ var PersistenceStatus = ({ db }) => {
829
788
  ]);
830
789
  switch (status) {
831
790
  case 2:
832
- return /* @__PURE__ */ React7.createElement("div", {
791
+ return /* @__PURE__ */ React6.createElement("div", {
833
792
  className: "flex items-center"
834
- }, /* @__PURE__ */ React7.createElement(Warning, {
835
- className: mx4(getSize2(4), "me-1")
836
- }), /* @__PURE__ */ React7.createElement("span", {
837
- className: mx4("text-sm", warningText)
793
+ }, /* @__PURE__ */ React6.createElement(Warning, {
794
+ className: mx3(getSize2(4), "me-1")
795
+ }), /* @__PURE__ */ React6.createElement("span", {
796
+ className: mx3("text-sm", warningText)
838
797
  }, t("persistence error label")));
839
798
  case 1:
840
- return /* @__PURE__ */ React7.createElement("div", {
799
+ return /* @__PURE__ */ React6.createElement("div", {
841
800
  className: "flex items-center"
842
- }, /* @__PURE__ */ React7.createElement(ArrowsCounterClockwise, {
843
- className: mx4(getSize2(4), "me-1")
844
- }), /* @__PURE__ */ React7.createElement("span", {
845
- className: mx4("text-sm", staticPlaceholderText)
801
+ }, /* @__PURE__ */ React6.createElement(ArrowsCounterClockwise, {
802
+ className: mx3(getSize2(4), "me-1")
803
+ }), /* @__PURE__ */ React6.createElement("span", {
804
+ className: mx3("text-sm", staticPlaceholderText)
846
805
  }, t("persistence pending label")));
847
806
  case 0:
848
807
  default:
849
- return /* @__PURE__ */ React7.createElement(Tooltip.Root, {
808
+ return /* @__PURE__ */ React6.createElement(Tooltip.Root, {
850
809
  delayDuration: 400
851
- }, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
810
+ }, /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
852
811
  role: "status",
853
812
  className: "flex items-center"
854
- }, /* @__PURE__ */ React7.createElement(CheckCircle2, {
855
- className: mx4(getSize2(4), "me-1")
856
- }), displayMessage && /* @__PURE__ */ React7.createElement("span", {
857
- className: mx4("text-sm", staticPlaceholderText)
858
- }, t("persisted locally label"))), /* @__PURE__ */ React7.createElement(Tooltip.Portal, null, /* @__PURE__ */ React7.createElement(Tooltip.Content, {
813
+ }, /* @__PURE__ */ React6.createElement(CheckCircle2, {
814
+ className: mx3(getSize2(4), "me-1")
815
+ }), displayMessage && /* @__PURE__ */ React6.createElement("span", {
816
+ className: mx3("text-sm", staticPlaceholderText)
817
+ }, t("persisted locally label"))), /* @__PURE__ */ React6.createElement(Tooltip.Portal, null, /* @__PURE__ */ React6.createElement(Tooltip.Content, {
859
818
  classNames: "z-10"
860
- }, t("persisted locally message"), /* @__PURE__ */ React7.createElement(Tooltip.Arrow, null))));
819
+ }, t("persisted locally message"), /* @__PURE__ */ React6.createElement(Tooltip.Arrow, null))));
861
820
  }
862
821
  };
863
822
 
864
823
  // packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
865
- import React8, { useCallback, useRef, useState as useState4 } from "react";
824
+ import React7, { useCallback, useRef, useState as useState3 } from "react";
866
825
  import { log } from "@dxos/log";
867
- import { Button as Button2, Input as Input2, Popover, useTranslation as useTranslation8 } from "@dxos/react-ui";
826
+ import { Button as Button2, Input as Input2, Popover, useTranslation as useTranslation7 } from "@dxos/react-ui";
868
827
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
869
828
  var PopoverRenameObject = ({ object: obj }) => {
870
- const { t } = useTranslation8(SPACE_PLUGIN);
829
+ const { t } = useTranslation7(SPACE_PLUGIN);
871
830
  const doneButton = useRef(null);
872
831
  const object = obj;
873
- const [name, setName] = useState4(object.name || object.title || "");
832
+ const [name, setName] = useState3(object.name || object.title || "");
874
833
  const handleDone = useCallback(() => {
875
834
  try {
876
835
  object.name = name;
@@ -892,23 +851,23 @@ var PopoverRenameObject = ({ object: obj }) => {
892
851
  object,
893
852
  name
894
853
  ]);
895
- return /* @__PURE__ */ React8.createElement("div", {
854
+ return /* @__PURE__ */ React7.createElement("div", {
896
855
  role: "none",
897
856
  className: "p-1 flex gap-2"
898
- }, /* @__PURE__ */ React8.createElement("div", {
857
+ }, /* @__PURE__ */ React7.createElement("div", {
899
858
  role: "none",
900
859
  className: "flex-1"
901
- }, /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Label, {
860
+ }, /* @__PURE__ */ React7.createElement(Input2.Root, null, /* @__PURE__ */ React7.createElement(Input2.Label, {
902
861
  srOnly: true
903
- }, t("object name label")), /* @__PURE__ */ React8.createElement(Input2.TextInput, {
862
+ }, t("object name label")), /* @__PURE__ */ React7.createElement(Input2.TextInput, {
904
863
  placeholder: t("object title placeholder"),
905
864
  value: name,
906
865
  "data-testid": "spacePlugin.renameObject.input",
907
866
  onChange: ({ target: { value } }) => setName(value),
908
867
  onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
909
- }))), /* @__PURE__ */ React8.createElement(Popover.Close, {
868
+ }))), /* @__PURE__ */ React7.createElement(Popover.Close, {
910
869
  asChild: true
911
- }, /* @__PURE__ */ React8.createElement(Button2, {
870
+ }, /* @__PURE__ */ React7.createElement(Button2, {
912
871
  ref: doneButton,
913
872
  classNames: "self-stretch",
914
873
  onClick: handleDone
@@ -918,36 +877,36 @@ var PopoverRenameObject = ({ object: obj }) => {
918
877
  };
919
878
 
920
879
  // packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
921
- import React9, { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
922
- import { Button as Button3, Input as Input3, Popover as Popover2, useTranslation as useTranslation9 } from "@dxos/react-ui";
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";
923
882
  var PopoverRenameSpace = ({ space }) => {
924
- const { t } = useTranslation9(SPACE_PLUGIN);
883
+ const { t } = useTranslation8(SPACE_PLUGIN);
925
884
  const doneButton = useRef2(null);
926
- const [name, setName] = useState5(space.properties.name ?? "");
885
+ const [name, setName] = useState4(space.properties.name ?? "");
927
886
  const handleDone = useCallback2(() => {
928
887
  space.properties.name = name;
929
888
  }, [
930
889
  space,
931
890
  name
932
891
  ]);
933
- return /* @__PURE__ */ React9.createElement("div", {
892
+ return /* @__PURE__ */ React8.createElement("div", {
934
893
  role: "none",
935
894
  className: "p-1 flex gap-2"
936
- }, /* @__PURE__ */ React9.createElement("div", {
895
+ }, /* @__PURE__ */ React8.createElement("div", {
937
896
  role: "none",
938
897
  className: "flex-1"
939
- }, /* @__PURE__ */ React9.createElement(Input3.Root, null, /* @__PURE__ */ React9.createElement(Input3.Label, {
898
+ }, /* @__PURE__ */ React8.createElement(Input3.Root, null, /* @__PURE__ */ React8.createElement(Input3.Label, {
940
899
  srOnly: true
941
- }, t("space name label")), /* @__PURE__ */ React9.createElement(Input3.TextInput, {
900
+ }, t("space name label")), /* @__PURE__ */ React8.createElement(Input3.TextInput, {
942
901
  defaultValue: space.properties.name ?? "",
943
902
  placeholder: t("unnamed space label"),
944
903
  onChange: ({ target: { value } }) => setName(value),
945
904
  // TODO(wittjosiah): Ideally this should access the popover context to close the popover.
946
905
  // Currently this is not possible because Radix does not expose the popover context.
947
906
  onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
948
- }))), /* @__PURE__ */ React9.createElement(Popover2.Close, {
907
+ }))), /* @__PURE__ */ React8.createElement(Popover2.Close, {
949
908
  asChild: true
950
- }, /* @__PURE__ */ React9.createElement(Button3, {
909
+ }, /* @__PURE__ */ React8.createElement(Button3, {
951
910
  ref: doneButton,
952
911
  classNames: "self-stretch",
953
912
  onClick: handleDone
@@ -957,12 +916,12 @@ var PopoverRenameSpace = ({ space }) => {
957
916
  };
958
917
 
959
918
  // packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
960
- import React10 from "react";
919
+ import React9 from "react";
961
920
  import { useIntentDispatcher } from "@dxos/app-framework";
962
- import { Button as Button4, useTranslation as useTranslation10 } from "@dxos/react-ui";
921
+ import { Button as Button4, useTranslation as useTranslation9 } from "@dxos/react-ui";
963
922
  var ShareSpaceButton = ({ spaceId }) => {
964
923
  const dispatch = useIntentDispatcher();
965
- return /* @__PURE__ */ React10.createElement(ShareSpaceButtonImpl, {
924
+ return /* @__PURE__ */ React9.createElement(ShareSpaceButtonImpl, {
966
925
  onClick: () => dispatch({
967
926
  action: SpaceAction.SHARE,
968
927
  data: {
@@ -972,8 +931,8 @@ var ShareSpaceButton = ({ spaceId }) => {
972
931
  });
973
932
  };
974
933
  var ShareSpaceButtonImpl = ({ onClick }) => {
975
- const { t } = useTranslation10(SPACE_PLUGIN);
976
- return /* @__PURE__ */ React10.createElement(Button4, {
934
+ const { t } = useTranslation9(SPACE_PLUGIN);
935
+ return /* @__PURE__ */ React9.createElement(Button4, {
977
936
  "data-testid": "spacePlugin.shareSpaceButton",
978
937
  onClick,
979
938
  classNames: "mli-1"
@@ -982,30 +941,30 @@ var ShareSpaceButtonImpl = ({ onClick }) => {
982
941
 
983
942
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
984
943
  import { Command } from "@phosphor-icons/react";
985
- import React12 from "react";
944
+ import React11 from "react";
986
945
  import { Surface } from "@dxos/app-framework";
987
946
  import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
988
- import { Main, useTranslation as useTranslation12 } from "@dxos/react-ui";
989
- import { getSize as getSize4, mx as mx6, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
947
+ import { Main, useTranslation as useTranslation11 } from "@dxos/react-ui";
948
+ import { getSize as getSize4, mx as mx5, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
990
949
  import { ClipboardProvider } from "@dxos/shell/react";
991
950
 
992
951
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMembersSection.tsx
993
952
  import { CaretDown, Check, UserPlus, UsersThree } from "@phosphor-icons/react";
994
- import React11, { useCallback as useCallback3, useState as useState6 } from "react";
953
+ import React10, { useCallback as useCallback3, useState as useState5 } from "react";
995
954
  import { LayoutAction, useIntent } from "@dxos/app-framework";
996
955
  import { useMembers, SpaceMember, useSpaceInvitations } from "@dxos/react-client/echo";
997
956
  import { InvitationEncoder } from "@dxos/react-client/invitations";
998
957
  import { Invitation } from "@dxos/react-client/invitations";
999
- import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as useTranslation11 } from "@dxos/react-ui";
1000
- import { descriptionText as descriptionText3, getSize as getSize3, mx as mx5 } from "@dxos/react-ui-theme";
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";
1001
960
  import { InvitationListItem, IdentityListItem } from "@dxos/shell/react";
1002
961
  var activeActionKeyStorageKey = "dxos:react-shell/space-manager/active-action";
1003
962
  var Presence = SpaceMember.PresenceState;
1004
963
  var handleCreateInvitationUrl = (invitationCode) => `${origin}?spaceInvitationCode=${invitationCode}`;
1005
964
  var SpaceMemberList = ({ members }) => {
1006
- return members.length > 0 ? /* @__PURE__ */ React11.createElement(List, {
965
+ return members.length > 0 ? /* @__PURE__ */ React10.createElement(List, {
1007
966
  classNames: "col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center"
1008
- }, members.map((member) => /* @__PURE__ */ React11.createElement(IdentityListItem, {
967
+ }, members.map((member) => /* @__PURE__ */ React10.createElement(IdentityListItem, {
1009
968
  classNames: "contents",
1010
969
  key: member.identity.identityKey.toHex(),
1011
970
  identity: member.identity,
@@ -1013,7 +972,7 @@ var SpaceMemberList = ({ members }) => {
1013
972
  }))) : null;
1014
973
  };
1015
974
  var SpaceMembersSection = ({ space }) => {
1016
- const { t } = useTranslation11(SPACE_PLUGIN);
975
+ const { t } = useTranslation10(SPACE_PLUGIN);
1017
976
  const invitations = useSpaceInvitations(space.key);
1018
977
  const { dispatch } = useIntent();
1019
978
  const handleCloseDialog = () => dispatch({
@@ -1078,7 +1037,7 @@ var SpaceMembersSection = ({ space }) => {
1078
1037
  ])
1079
1038
  }
1080
1039
  };
1081
- const [activeActionKey, setInternalActiveActionKey] = useState6(localStorage.getItem(activeActionKeyStorageKey) ?? "inviteOne");
1040
+ const [activeActionKey, setInternalActiveActionKey] = useState5(localStorage.getItem(activeActionKeyStorageKey) ?? "inviteOne");
1082
1041
  const setActiveActionKey = (nextKey) => {
1083
1042
  setInternalActiveActionKey(nextKey);
1084
1043
  localStorage.setItem(activeActionKeyStorageKey, nextKey);
@@ -1091,103 +1050,103 @@ var SpaceMembersSection = ({ space }) => {
1091
1050
  [Presence.ONLINE]: [],
1092
1051
  [Presence.OFFLINE]: []
1093
1052
  });
1094
- return /* @__PURE__ */ React11.createElement("section", {
1053
+ return /* @__PURE__ */ React10.createElement("section", {
1095
1054
  className: "mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min"
1096
- }, /* @__PURE__ */ React11.createElement("h2", {
1055
+ }, /* @__PURE__ */ React10.createElement("h2", {
1097
1056
  className: "contents"
1098
- }, /* @__PURE__ */ React11.createElement(UsersThree, {
1057
+ }, /* @__PURE__ */ React10.createElement(UsersThree, {
1099
1058
  weight: "duotone",
1100
- className: mx5(getSize3(5), "place-self-center")
1101
- }), /* @__PURE__ */ React11.createElement("span", {
1059
+ className: mx4(getSize3(5), "place-self-center")
1060
+ }), /* @__PURE__ */ React10.createElement("span", {
1102
1061
  className: "text-lg col-span-2"
1103
- }, t("space members label"))), /* @__PURE__ */ React11.createElement("h3", {
1062
+ }, t("space members label"))), /* @__PURE__ */ React10.createElement("h3", {
1104
1063
  className: "col-start-2 col-span-3 text-sm italic text-description"
1105
- }, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React11.createElement(List, {
1064
+ }, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React10.createElement(List, {
1106
1065
  classNames: "col-start-2 col-span-2 gap-y-2 grid grid-cols-[var(--rail-size)_1fr_var(--rail-action)_var(--rail-action)]"
1107
- }, invitations.map((invitation) => /* @__PURE__ */ React11.createElement(InvitationListItem, {
1066
+ }, invitations.map((invitation) => /* @__PURE__ */ React10.createElement(InvitationListItem, {
1108
1067
  reverseEffects: true,
1109
1068
  classNames: "pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid",
1110
1069
  key: invitation.get().invitationId,
1111
1070
  invitation,
1112
1071
  send: handleInvitationSelect,
1113
1072
  createInvitationUrl: handleCreateInvitationUrl
1114
- }))), /* @__PURE__ */ React11.createElement(ButtonGroup, {
1073
+ }))), /* @__PURE__ */ React10.createElement(ButtonGroup, {
1115
1074
  classNames: "col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px"
1116
- }, /* @__PURE__ */ React11.createElement(Button5, {
1075
+ }, /* @__PURE__ */ React10.createElement(Button5, {
1117
1076
  classNames: "gap-2",
1118
1077
  onClick: activeAction.onClick
1119
- }, /* @__PURE__ */ React11.createElement(activeAction.icon, {
1078
+ }, /* @__PURE__ */ React10.createElement(activeAction.icon, {
1120
1079
  className: getSize3(5)
1121
- }), /* @__PURE__ */ React11.createElement("span", null, t(activeAction.label, {
1080
+ }), /* @__PURE__ */ React10.createElement("span", null, t(activeAction.label, {
1122
1081
  ns: "os"
1123
- }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React11.createElement(DropdownMenu2.Trigger, {
1082
+ }))), /* @__PURE__ */ React10.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React10.createElement(DropdownMenu2.Trigger, {
1124
1083
  asChild: true
1125
- }, /* @__PURE__ */ React11.createElement(Button5, {
1084
+ }, /* @__PURE__ */ React10.createElement(Button5, {
1126
1085
  classNames: "pli-0"
1127
- }, /* @__PURE__ */ React11.createElement(CaretDown, {
1086
+ }, /* @__PURE__ */ React10.createElement(CaretDown, {
1128
1087
  className: getSize3(4)
1129
- }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React11.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
1130
- return /* @__PURE__ */ React11.createElement(DropdownMenu2.CheckboxItem, {
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, {
1131
1090
  key: id,
1132
1091
  "aria-labelledby": `${id}__label`,
1133
1092
  "aria-describedby": `${id}__description`,
1134
1093
  checked: activeActionKey === id,
1135
1094
  onCheckedChange: (checked) => checked && setActiveActionKey(id),
1136
1095
  classNames: "gap-2"
1137
- }, action.icon && /* @__PURE__ */ React11.createElement(action.icon, {
1096
+ }, action.icon && /* @__PURE__ */ React10.createElement(action.icon, {
1138
1097
  className: getSize3(5)
1139
- }), /* @__PURE__ */ React11.createElement("div", {
1098
+ }), /* @__PURE__ */ React10.createElement("div", {
1140
1099
  role: "none",
1141
1100
  className: "flex-1 min-is-0 space-b-1"
1142
- }, /* @__PURE__ */ React11.createElement("p", {
1101
+ }, /* @__PURE__ */ React10.createElement("p", {
1143
1102
  id: `${id}__label`
1144
1103
  }, t(action.label, {
1145
1104
  ns: "os"
1146
- })), action.description && /* @__PURE__ */ React11.createElement("p", {
1105
+ })), action.description && /* @__PURE__ */ React10.createElement("p", {
1147
1106
  id: `${id}__description`,
1148
- className: descriptionText3
1107
+ className: descriptionText2
1149
1108
  }, t(action.description, {
1150
1109
  ns: "os"
1151
- }))), /* @__PURE__ */ React11.createElement(DropdownMenu2.ItemIndicator, {
1110
+ }))), /* @__PURE__ */ React10.createElement(DropdownMenu2.ItemIndicator, {
1152
1111
  asChild: true
1153
- }, /* @__PURE__ */ React11.createElement(Check, {
1112
+ }, /* @__PURE__ */ React10.createElement(Check, {
1154
1113
  className: getSize3(4)
1155
1114
  })));
1156
- })), /* @__PURE__ */ React11.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React11.createElement("p", {
1157
- className: mx5(descriptionText3, "text-center is-full mlb-2")
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")
1158
1117
  }, t("empty space members message", {
1159
1118
  ns: "os"
1160
- })) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("h3", {
1119
+ })) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("h3", {
1161
1120
  className: "col-start-2 col-end-5 text-sm italic text-description"
1162
1121
  }, t("active space members heading", {
1163
1122
  count: members[Presence.ONLINE].length
1164
- })), /* @__PURE__ */ React11.createElement(SpaceMemberList, {
1123
+ })), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
1165
1124
  members: members[Presence.ONLINE]
1166
- }), /* @__PURE__ */ React11.createElement("h3", {
1125
+ }), /* @__PURE__ */ React10.createElement("h3", {
1167
1126
  className: "col-start-2 col-end-5 text-sm italic text-description"
1168
1127
  }, t("inactive space members heading", {
1169
1128
  count: members[Presence.OFFLINE].length
1170
- })), /* @__PURE__ */ React11.createElement(SpaceMemberList, {
1129
+ })), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
1171
1130
  members: members[Presence.OFFLINE]
1172
1131
  })));
1173
1132
  };
1174
1133
 
1175
1134
  // packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
1176
1135
  var KeyShortcuts = () => {
1177
- const { t } = useTranslation12(SPACE_PLUGIN);
1178
- return /* @__PURE__ */ React12.createElement("section", {
1136
+ const { t } = useTranslation11(SPACE_PLUGIN);
1137
+ return /* @__PURE__ */ React11.createElement("section", {
1179
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"
1180
- }, /* @__PURE__ */ React12.createElement("h2", {
1139
+ }, /* @__PURE__ */ React11.createElement("h2", {
1181
1140
  className: "contents"
1182
- }, /* @__PURE__ */ React12.createElement(Command, {
1141
+ }, /* @__PURE__ */ React11.createElement(Command, {
1183
1142
  weight: "duotone",
1184
- className: mx6(getSize4(5), "place-self-center")
1185
- }), /* @__PURE__ */ React12.createElement("span", {
1143
+ className: mx5(getSize4(5), "place-self-center")
1144
+ }), /* @__PURE__ */ React11.createElement("span", {
1186
1145
  className: "text-lg col-span-2 md:col-span-1"
1187
- }, t("keyshortcuts label"))), /* @__PURE__ */ React12.createElement("div", {
1146
+ }, t("keyshortcuts label"))), /* @__PURE__ */ React11.createElement("div", {
1188
1147
  role: "none",
1189
1148
  className: "col-start-2 col-end-4 md:col-end-5 pie-2"
1190
- }, /* @__PURE__ */ React12.createElement(Surface, {
1149
+ }, /* @__PURE__ */ React11.createElement(Surface, {
1191
1150
  role: "keyshortcuts"
1192
1151
  })));
1193
1152
  };
@@ -1196,7 +1155,7 @@ var SpaceMain = ({ space, role }) => {
1196
1155
  const state = space.state.get();
1197
1156
  const ready = state === SpaceState2.SPACE_READY;
1198
1157
  const Root = role === "main" ? Main.Content : "div";
1199
- return /* @__PURE__ */ React12.createElement(ClipboardProvider, null, /* @__PURE__ */ React12.createElement(Root, {
1158
+ return /* @__PURE__ */ React11.createElement(ClipboardProvider, null, /* @__PURE__ */ React11.createElement(Root, {
1200
1159
  ...role === "main" ? {
1201
1160
  classNames: [
1202
1161
  topbarBlockPaddingStart,
@@ -1205,23 +1164,23 @@ var SpaceMain = ({ space, role }) => {
1205
1164
  ]
1206
1165
  } : {
1207
1166
  role: "none",
1208
- className: mx6(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
1167
+ className: mx5(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
1209
1168
  },
1210
1169
  "data-testid": `spacePlugin.${role}`,
1211
1170
  "data-isready": ready ? "true" : "false"
1212
- }, ready && /* @__PURE__ */ React12.createElement(SpaceMembersSection, {
1171
+ }, ready && /* @__PURE__ */ React11.createElement(SpaceMembersSection, {
1213
1172
  space
1214
- }), /* @__PURE__ */ React12.createElement(KeyShortcuts, null)));
1173
+ }), /* @__PURE__ */ React11.createElement(KeyShortcuts, null)));
1215
1174
  };
1216
1175
 
1217
1176
  // packages/plugins/plugin-space/src/components/SpacePresence.tsx
1218
- import React13, { useCallback as useCallback4, useEffect as useEffect4, useState as useState7 } from "react";
1177
+ import React12, { useCallback as useCallback4, useEffect as useEffect3, useState as useState6 } from "react";
1219
1178
  import { usePlugin } from "@dxos/app-framework";
1220
1179
  import { generateName } from "@dxos/display-name";
1221
1180
  import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
1222
1181
  import { getSpace as getSpace3, useMembers as useMembers2, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1223
1182
  import { useIdentity } from "@dxos/react-client/halo";
1224
- import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation13, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1183
+ import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation12, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1225
1184
  import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
1226
1185
  import { ComplexMap, keyToFallback } from "@dxos/util";
1227
1186
  var REFRESH_INTERVAL = 5e3;
@@ -1234,8 +1193,8 @@ var SpacePresence = ({ object, spaceKey }) => {
1234
1193
  const identity = useIdentity();
1235
1194
  const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
1236
1195
  const spaceMembers = useMembers2(space?.key);
1237
- const [_moment, setMoment] = useState7(Date.now());
1238
- useEffect4(() => {
1196
+ const [_moment, setMoment] = useState6(Date.now());
1197
+ useEffect3(() => {
1239
1198
  const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
1240
1199
  return () => clearInterval(interval);
1241
1200
  }, []);
@@ -1258,7 +1217,7 @@ var SpacePresence = ({ object, spaceKey }) => {
1258
1217
  lastSeen
1259
1218
  };
1260
1219
  }).toSorted((a, b) => a.lastSeen - b.lastSeen);
1261
- return /* @__PURE__ */ React13.createElement(FullPresence, {
1220
+ return /* @__PURE__ */ React12.createElement(FullPresence, {
1262
1221
  members: membersForObject
1263
1222
  });
1264
1223
  };
@@ -1268,38 +1227,38 @@ var FullPresence = (props) => {
1268
1227
  if (members.length === 0) {
1269
1228
  return null;
1270
1229
  }
1271
- return /* @__PURE__ */ React13.createElement(AvatarGroup.Root, {
1230
+ return /* @__PURE__ */ React12.createElement(AvatarGroup.Root, {
1272
1231
  size,
1273
1232
  classNames: "mbs-2 mie-4",
1274
1233
  "data-testid": "spacePlugin.presence"
1275
- }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React13.createElement(Tooltip2.Root, {
1234
+ }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React12.createElement(Tooltip2.Root, {
1276
1235
  key: member.identity.identityKey.toHex()
1277
- }, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React13.createElement(PrensenceAvatar, {
1236
+ }, /* @__PURE__ */ React12.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React12.createElement(PrensenceAvatar, {
1278
1237
  identity: member.identity,
1279
1238
  group: true,
1280
1239
  match: member.currentlyAttended,
1281
1240
  index: members.length - i,
1282
1241
  onClick: () => onMemberClick?.(member)
1283
- })), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1242
+ })), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
1284
1243
  side: "bottom"
1285
- }, /* @__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, {
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, {
1286
1245
  status: "inactive"
1287
- }, /* @__PURE__ */ React13.createElement(Avatar.Frame, {
1246
+ }, /* @__PURE__ */ React12.createElement(Avatar.Frame, {
1288
1247
  style: {
1289
1248
  zIndex: members.length - 4
1290
1249
  }
1291
- }, /* @__PURE__ */ React13.createElement(Avatar.Fallback, {
1250
+ }, /* @__PURE__ */ React12.createElement(Avatar.Fallback, {
1292
1251
  text: `+${members.length - 3}`
1293
- })))), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1252
+ })))), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
1294
1253
  side: "bottom"
1295
- }, /* @__PURE__ */ React13.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React13.createElement(List2, {
1254
+ }, /* @__PURE__ */ React12.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React12.createElement(List2, {
1296
1255
  classNames: "max-h-56 overflow-y-auto"
1297
- }, members.map((member) => /* @__PURE__ */ React13.createElement(ListItem.Root, {
1256
+ }, members.map((member) => /* @__PURE__ */ React12.createElement(ListItem.Root, {
1298
1257
  key: member.identity.identityKey.toHex(),
1299
1258
  classNames: "flex gap-2 items-center cursor-pointer mbe-2",
1300
1259
  onClick: () => onMemberClick?.(member),
1301
1260
  "data-testid": "identity-list-item"
1302
- }, /* @__PURE__ */ React13.createElement(PrensenceAvatar, {
1261
+ }, /* @__PURE__ */ React12.createElement(PrensenceAvatar, {
1303
1262
  identity: member.identity,
1304
1263
  showName: true,
1305
1264
  match: member.currentlyAttended
@@ -1309,10 +1268,10 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
1309
1268
  const Root = group ? AvatarGroupItem.Root : Avatar.Root;
1310
1269
  const status = match ? "current" : "active";
1311
1270
  const fallbackValue = keyToFallback(identity.identityKey);
1312
- return /* @__PURE__ */ React13.createElement(Root, {
1271
+ return /* @__PURE__ */ React12.createElement(Root, {
1313
1272
  status,
1314
1273
  hue: identity.profile?.data?.hue || fallbackValue.hue
1315
- }, /* @__PURE__ */ React13.createElement(Avatar.Frame, {
1274
+ }, /* @__PURE__ */ React12.createElement(Avatar.Frame, {
1316
1275
  "data-testid": "spacePlugin.presence.member",
1317
1276
  "data-status": status,
1318
1277
  ...index ? {
@@ -1321,9 +1280,9 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
1321
1280
  }
1322
1281
  } : {},
1323
1282
  onClick: () => onClick?.()
1324
- }, /* @__PURE__ */ React13.createElement(Avatar.Fallback, {
1283
+ }, /* @__PURE__ */ React12.createElement(Avatar.Fallback, {
1325
1284
  text: identity.profile?.data?.emoji || fallbackValue.emoji
1326
- })), showName && /* @__PURE__ */ React13.createElement(Avatar.Label, {
1285
+ })), showName && /* @__PURE__ */ React12.createElement(Avatar.Label, {
1327
1286
  classNames: "text-sm truncate pli-2"
1328
1287
  }, getName(identity)));
1329
1288
  };
@@ -1332,8 +1291,8 @@ var SmallPresenceLive = ({ id, viewers }) => {
1332
1291
  const moment = Date.now();
1333
1292
  return Array.from(viewers2.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION);
1334
1293
  };
1335
- const [activeViewers, setActiveViewers] = useState7(viewers ? getActiveViewers(viewers) : []);
1336
- useEffect4(() => {
1294
+ const [activeViewers, setActiveViewers] = useState6(viewers ? getActiveViewers(viewers) : []);
1295
+ useEffect3(() => {
1337
1296
  if (viewers) {
1338
1297
  setActiveViewers(getActiveViewers(viewers));
1339
1298
  const interval = setInterval(() => {
@@ -1344,44 +1303,44 @@ var SmallPresenceLive = ({ id, viewers }) => {
1344
1303
  }, [
1345
1304
  viewers
1346
1305
  ]);
1347
- return /* @__PURE__ */ React13.createElement(SmallPresence, {
1306
+ return /* @__PURE__ */ React12.createElement(SmallPresence, {
1348
1307
  id,
1349
1308
  count: activeViewers.length
1350
1309
  });
1351
1310
  };
1352
1311
  var SmallPresence = ({ id, count }) => {
1353
- const { t } = useTranslation13(SPACE_PLUGIN);
1312
+ const { t } = useTranslation12(SPACE_PLUGIN);
1354
1313
  const { hasAttention, isAncestor, isRelated } = useAttention(id);
1355
1314
  const attention = hasAttention || isAncestor || isRelated;
1356
- return /* @__PURE__ */ React13.createElement(Tooltip2.Root, null, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, {
1315
+ return /* @__PURE__ */ React12.createElement(Tooltip2.Root, null, /* @__PURE__ */ React12.createElement(Tooltip2.Trigger, {
1357
1316
  asChild: true
1358
- }, /* @__PURE__ */ React13.createElement("div", {
1317
+ }, /* @__PURE__ */ React12.createElement("div", {
1359
1318
  role: "none",
1360
1319
  className: "flex",
1361
1320
  "data-attention": attention
1362
- }, /* @__PURE__ */ React13.createElement(AttentionGlyph, {
1321
+ }, /* @__PURE__ */ React12.createElement(AttentionGlyph, {
1363
1322
  presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1364
1323
  classNames: "self-center mie-1"
1365
- }))), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1324
+ }))), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
1366
1325
  side: "bottom",
1367
1326
  classNames: "z-[70]"
1368
- }, /* @__PURE__ */ React13.createElement("span", null, t("presence label", {
1327
+ }, /* @__PURE__ */ React12.createElement("span", null, t("presence label", {
1369
1328
  count
1370
- })), /* @__PURE__ */ React13.createElement(Tooltip2.Arrow, null))));
1329
+ })), /* @__PURE__ */ React12.createElement(Tooltip2.Arrow, null))));
1371
1330
  };
1372
1331
 
1373
1332
  // packages/plugins/plugin-space/src/components/SpaceSettings.tsx
1374
- import React14 from "react";
1333
+ import React13 from "react";
1375
1334
  import { useIntentDispatcher as useIntentDispatcher2, useResolvePlugins } from "@dxos/app-framework";
1376
- import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation14 } from "@dxos/react-ui";
1377
- import { FormInput } from "@dxos/react-ui-data";
1335
+ import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation13 } from "@dxos/react-ui";
1336
+ import { DeprecatedFormInput } from "@dxos/react-ui-data";
1378
1337
  var SpaceSettings = ({ settings }) => {
1379
- const { t } = useTranslation14(SPACE_PLUGIN);
1338
+ const { t } = useTranslation13(SPACE_PLUGIN);
1380
1339
  const dispatch = useIntentDispatcher2();
1381
1340
  const plugins = useResolvePlugins(parseSpaceInitPlugin);
1382
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(FormInput, {
1341
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(DeprecatedFormInput, {
1383
1342
  label: t("show hidden spaces label")
1384
- }, /* @__PURE__ */ React14.createElement(Input4.Switch, {
1343
+ }, /* @__PURE__ */ React13.createElement(Input4.Switch, {
1385
1344
  checked: settings.showHidden,
1386
1345
  onCheckedChange: (checked) => dispatch({
1387
1346
  plugin: SPACE_PLUGIN,
@@ -1390,34 +1349,41 @@ var SpaceSettings = ({ settings }) => {
1390
1349
  state: !!checked
1391
1350
  }
1392
1351
  })
1393
- })), /* @__PURE__ */ React14.createElement(FormInput, {
1352
+ })), /* @__PURE__ */ React13.createElement(DeprecatedFormInput, {
1394
1353
  label: t("default on space create label")
1395
- }, /* @__PURE__ */ React14.createElement(Select.Root, {
1354
+ }, /* @__PURE__ */ React13.createElement(Select.Root, {
1396
1355
  value: settings.onSpaceCreate,
1397
1356
  onValueChange: (value) => {
1398
1357
  settings.onSpaceCreate = value;
1399
1358
  }
1400
- }, /* @__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, {
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, {
1401
1360
  key: onSpaceCreate.action,
1402
1361
  value: onSpaceCreate.action
1403
1362
  }, toLocalizedString2(onSpaceCreate.label, t)))))))));
1404
1363
  };
1405
1364
 
1406
1365
  // packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx
1407
- import React15, { useCallback as useCallback5, useState as useState8 } from "react";
1366
+ import React14, { useCallback as useCallback5, useState as useState7 } from "react";
1408
1367
  import { log as log2 } from "@dxos/log";
1409
1368
  import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
1410
- import { Input as Input5, useTranslation as useTranslation15 } from "@dxos/react-ui";
1369
+ import { useClient as useClient4 } from "@dxos/react-client";
1370
+ import { DeviceType, useDevices } from "@dxos/react-client/halo";
1371
+ import { Input as Input5, useTranslation as useTranslation14 } from "@dxos/react-ui";
1411
1372
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx";
1412
1373
  var SpaceSettingsPanel = ({ space }) => {
1413
- const { t } = useTranslation15(SPACE_PLUGIN);
1414
- const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1374
+ const { t } = useTranslation14(SPACE_PLUGIN);
1375
+ const client = useClient4();
1376
+ const devices = useDevices();
1377
+ const managedDeviceAvailable = devices.find((device) => device.profile?.type === DeviceType.AGENT_MANAGED);
1378
+ const edgeAgents = Boolean(client.config.values.runtime?.client?.edgeFeatures?.agents);
1379
+ const edgeReplicationAvailable = edgeAgents && managedDeviceAvailable;
1380
+ const [edgeReplication, setEdgeReplication] = useState7(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1415
1381
  const toggleEdgeReplication = useCallback5(async (next) => {
1416
1382
  setEdgeReplication(next);
1417
1383
  await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
1418
1384
  log2.catch(err, void 0, {
1419
1385
  F: __dxlog_file3,
1420
- L: 30,
1386
+ L: 38,
1421
1387
  S: void 0,
1422
1388
  C: (f, a) => f(...a)
1423
1389
  });
@@ -1426,50 +1392,129 @@ var SpaceSettingsPanel = ({ space }) => {
1426
1392
  }, [
1427
1393
  space
1428
1394
  ]);
1429
- return /* @__PURE__ */ React15.createElement("div", {
1395
+ return /* @__PURE__ */ React14.createElement("div", {
1430
1396
  role: "form",
1431
1397
  className: "flex flex-col w-full p-2 gap-4"
1432
- }, /* @__PURE__ */ React15.createElement(Input5.Root, null, /* @__PURE__ */ React15.createElement("div", {
1398
+ }, /* @__PURE__ */ React14.createElement(Input5.Root, null, /* @__PURE__ */ React14.createElement("div", {
1433
1399
  role: "none",
1434
1400
  className: "flex flex-col gap-1"
1435
- }, /* @__PURE__ */ React15.createElement(Input5.Label, null, t("name label")), /* @__PURE__ */ React15.createElement(Input5.TextInput, {
1401
+ }, /* @__PURE__ */ React14.createElement(Input5.Label, null, t("name label")), /* @__PURE__ */ React14.createElement(Input5.TextInput, {
1436
1402
  placeholder: t("name placeholder"),
1437
- value: space.properties.name,
1403
+ value: space.properties.name ?? "",
1438
1404
  onChange: (event) => {
1439
1405
  space.properties.name = event.target.value;
1440
1406
  }
1441
- }))), /* @__PURE__ */ React15.createElement(Input5.Root, null, /* @__PURE__ */ React15.createElement("div", {
1407
+ }))), edgeReplicationAvailable && /* @__PURE__ */ React14.createElement(Input5.Root, null, /* @__PURE__ */ React14.createElement("div", {
1442
1408
  role: "none",
1443
1409
  className: "flex justify-between"
1444
- }, /* @__PURE__ */ React15.createElement(Input5.Label, null, t("edge replication label")), /* @__PURE__ */ React15.createElement(Input5.Switch, {
1410
+ }, /* @__PURE__ */ React14.createElement(Input5.Label, null, t("edge replication label")), /* @__PURE__ */ React14.createElement(Input5.Switch, {
1445
1411
  checked: edgeReplication,
1446
1412
  onCheckedChange: toggleEdgeReplication
1447
1413
  }))));
1448
1414
  };
1449
1415
 
1450
- // packages/plugins/plugin-space/src/components/SaveStatus.tsx
1451
- import React16, { useEffect as useEffect5, useState as useState9 } from "react";
1452
- import { Context } from "@dxos/context";
1416
+ // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1417
+ import React16, { useEffect as useEffect6, useState as useState10 } from "react";
1453
1418
  import { StatusBar } from "@dxos/plugin-status-bar";
1454
- import { useClient as useClient4 } from "@dxos/react-client";
1455
- import { Icon, useTranslation as useTranslation16 } from "@dxos/react-ui";
1456
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SaveStatus.tsx";
1457
- var SaveStatus = () => {
1458
- const { t } = useTranslation16(SPACE_PLUGIN);
1459
- const client = useClient4();
1460
- const [state, setState] = useState9("saved");
1461
- useEffect5(() => {
1462
- return createClientSaveTracker(client, (state2) => {
1463
- setState(state2);
1464
- });
1465
- }, []);
1466
- return /* @__PURE__ */ React16.createElement(StatusBar.Item, {
1467
- title: state === "saving" ? t("saving label") : t("saved label")
1468
- }, /* @__PURE__ */ React16.createElement(Icon, {
1469
- icon: state === "saving" ? "ph--arrows-clockwise--regular" : "ph--check-circle--regular",
1470
- size: 4
1419
+ import { useClient as useClient6 } from "@dxos/react-client";
1420
+ import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation15 } from "@dxos/react-ui";
1421
+ import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
1422
+ import { mx as mx7 } from "@dxos/react-ui-theme";
1423
+
1424
+ // packages/plugins/plugin-space/src/components/SyncStatus/Space.tsx
1425
+ 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";
1428
+ var SYNC_STALLED_TIMEOUT = 5e3;
1429
+ var styles = {
1430
+ barBg: "bg-neutral-50 dark:bg-green-900 text-black",
1431
+ barFg: "bg-neutral-100 bg-green-500",
1432
+ barHover: "dark:hover:bg-green-500"
1433
+ };
1434
+ var useActive = (count) => {
1435
+ const [current, setCurrent] = useState8(count);
1436
+ const [active, setActive] = useState8(false);
1437
+ useEffect4(() => {
1438
+ let t;
1439
+ if (count !== current) {
1440
+ setActive(true);
1441
+ setCurrent(count);
1442
+ t && clearTimeout(t);
1443
+ t = setTimeout(() => {
1444
+ setActive(false);
1445
+ }, SYNC_STALLED_TIMEOUT);
1446
+ }
1447
+ return () => {
1448
+ setActive(false);
1449
+ clearTimeout(t);
1450
+ };
1451
+ }, [
1452
+ count,
1453
+ current
1454
+ ]);
1455
+ return active;
1456
+ };
1457
+ var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
1458
+ const downActive = useActive(localDocumentCount);
1459
+ const upActive = useActive(remoteDocumentCount);
1460
+ return /* @__PURE__ */ React15.createElement("div", {
1461
+ className: mx6("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
1462
+ title: spaceId,
1463
+ onClick: () => {
1464
+ void navigator.clipboard.writeText(spaceId);
1465
+ }
1466
+ }, /* @__PURE__ */ React15.createElement(Icon, {
1467
+ icon: "ph--arrow-fat-line-left--regular",
1468
+ size: 3,
1469
+ classNames: mx6(downActive && "animate-[pulse_1s_infinite]")
1470
+ }), /* @__PURE__ */ React15.createElement(Candle, {
1471
+ up: {
1472
+ count: remoteDocumentCount,
1473
+ total: remoteDocumentCount + missingOnRemote
1474
+ },
1475
+ down: {
1476
+ count: localDocumentCount,
1477
+ total: localDocumentCount + missingOnLocal
1478
+ },
1479
+ title: spaceId
1480
+ }), /* @__PURE__ */ React15.createElement(Icon, {
1481
+ icon: "ph--arrow-fat-line-right--regular",
1482
+ size: 3,
1483
+ classNames: mx6(upActive && "animate-[pulse_1s_step-start_infinite]")
1471
1484
  }));
1472
1485
  };
1486
+ var Candle = ({ classNames, up, down }) => {
1487
+ return /* @__PURE__ */ React15.createElement("div", {
1488
+ className: mx6("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
1489
+ }, /* @__PURE__ */ React15.createElement(Bar, {
1490
+ classNames: "justify-end",
1491
+ ...up
1492
+ }), /* @__PURE__ */ React15.createElement("div", {
1493
+ className: "relative"
1494
+ }, /* @__PURE__ */ React15.createElement("div", {
1495
+ className: mx6("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
1496
+ }, up.total)), /* @__PURE__ */ React15.createElement(Bar, down));
1497
+ };
1498
+ var Bar = ({ classNames, count, total }) => {
1499
+ let p = count / total * 100;
1500
+ if (count < total) {
1501
+ p = Math.min(p, 95);
1502
+ }
1503
+ return /* @__PURE__ */ React15.createElement("div", {
1504
+ className: mx6("relative flex w-full", styles.barBg, classNames)
1505
+ }, /* @__PURE__ */ React15.createElement("div", {
1506
+ className: mx6("shrink-0", styles.barFg),
1507
+ style: {
1508
+ width: `${p}%`
1509
+ }
1510
+ }), count !== total && /* @__PURE__ */ React15.createElement("div", {
1511
+ className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
1512
+ }, count));
1513
+ };
1514
+
1515
+ // packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts
1516
+ import { Context } from "@dxos/context";
1517
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
1473
1518
  var createClientSaveTracker = (client, cb) => {
1474
1519
  const unsubscribeCallbacks = {};
1475
1520
  const state = {};
@@ -1498,7 +1543,7 @@ var createClientSaveTracker = (client, cb) => {
1498
1543
  var createSpaceSaveTracker = (space, cb) => {
1499
1544
  const ctx = new Context(void 0, {
1500
1545
  F: __dxlog_file4,
1501
- L: 64
1546
+ L: 40
1502
1547
  });
1503
1548
  void space.waitUntilReady().then(() => {
1504
1549
  if (ctx.disposed) {
@@ -1529,19 +1574,41 @@ var createSpaceSaveTracker = (space, cb) => {
1529
1574
  };
1530
1575
  };
1531
1576
 
1532
- // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1533
- import React17, { useEffect as useEffect7, useState as useState11 } from "react";
1534
- import { StatusBar as StatusBar2 } from "@dxos/plugin-status-bar";
1535
- import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation17 } from "@dxos/react-ui";
1536
- import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
1537
- import { mx as mx7 } from "@dxos/react-ui-theme";
1577
+ // packages/plugins/plugin-space/src/components/SyncStatus/status.ts
1578
+ var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
1579
+ if (!saved) {
1580
+ return "saving locally";
1581
+ } else if (!offline && needsToDownload) {
1582
+ return "downloading";
1583
+ } else if (!offline && needsToUpload) {
1584
+ return "uploading";
1585
+ } else if (offline && !needsToUpload && !needsToDownload) {
1586
+ return "offline persisted";
1587
+ } else {
1588
+ return "remote synced";
1589
+ }
1590
+ };
1591
+ var getIcon = (status) => {
1592
+ switch (status) {
1593
+ case "saving locally":
1594
+ return "ph--download--regular";
1595
+ case "downloading":
1596
+ return "ph--cloud-arrow-down--regular";
1597
+ case "uploading":
1598
+ return "ph--cloud-arrow-up--regular";
1599
+ case "offline persisted":
1600
+ return "ph--check-circle--regular";
1601
+ case "remote synced":
1602
+ return "ph--cloud-check--regular";
1603
+ }
1604
+ };
1538
1605
 
1539
- // packages/plugins/plugin-space/src/components/SyncStatus/types.ts
1540
- import { useEffect as useEffect6, useState as useState10 } from "react";
1606
+ // packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts
1607
+ import { useEffect as useEffect5, useState as useState9 } from "react";
1541
1608
  import { Context as Context2 } from "@dxos/context";
1542
1609
  import { EdgeService } from "@dxos/protocols";
1543
1610
  import { useClient as useClient5 } from "@dxos/react-client";
1544
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/types.ts";
1611
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts";
1545
1612
  var createEmptyEdgeSyncState = () => ({
1546
1613
  missingOnLocal: 0,
1547
1614
  missingOnRemote: 0,
@@ -1562,8 +1629,8 @@ var getSyncSummary = (syncMap) => {
1562
1629
  var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
1563
1630
  var useSyncState = () => {
1564
1631
  const client = useClient5();
1565
- const [spaceState, setSpaceState] = useState10({});
1566
- useEffect6(() => {
1632
+ const [spaceState, setSpaceState] = useState9({});
1633
+ useEffect5(() => {
1567
1634
  const ctx = new Context2(void 0, {
1568
1635
  F: __dxlog_file5,
1569
1636
  L: 48
@@ -1598,146 +1665,86 @@ var useSyncState = () => {
1598
1665
  };
1599
1666
 
1600
1667
  // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1601
- var SYNC_STALLED_TIMEOUT = 5e3;
1602
- var styles = {
1603
- barBg: "bg-neutral-50 dark:bg-green-900 text-black",
1604
- barFg: "bg-neutral-100 bg-green-500",
1605
- barHover: "dark:hover:bg-green-500"
1606
- };
1607
1668
  var SyncStatus = () => {
1669
+ const client = useClient6();
1608
1670
  const state = useSyncState();
1609
- return /* @__PURE__ */ React17.createElement(SyncStatusIndicator, {
1610
- state
1671
+ const [saved, setSaved] = useState10(true);
1672
+ useEffect6(() => {
1673
+ return createClientSaveTracker(client, (state2) => {
1674
+ setSaved(state2 === "saved");
1675
+ });
1676
+ }, []);
1677
+ return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
1678
+ state,
1679
+ saved
1611
1680
  });
1612
1681
  };
1613
- var SyncStatusIndicator = ({ state }) => {
1682
+ var SyncStatusIndicator = ({ state, saved }) => {
1683
+ const { t } = useTranslation15(SPACE_PLUGIN);
1614
1684
  const summary = getSyncSummary(state);
1615
- const offline = false;
1685
+ const offline = Object.values(state).length === 0;
1616
1686
  const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1617
1687
  const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1618
- const [classNames, setClassNames] = useState11();
1619
- useEffect7(() => {
1688
+ const status = getStatus({
1689
+ offline,
1690
+ saved,
1691
+ needsToUpload,
1692
+ needsToDownload
1693
+ });
1694
+ const [classNames, setClassNames] = useState10();
1695
+ useEffect6(() => {
1620
1696
  setClassNames(void 0);
1621
- if (!needsToUpload && !needsToDownload) {
1697
+ if (offline || !needsToUpload && !needsToDownload) {
1622
1698
  return;
1623
1699
  }
1624
- const t = setTimeout(() => {
1700
+ const t2 = setTimeout(() => {
1625
1701
  setClassNames("text-orange-500");
1626
1702
  }, SYNC_STALLED_TIMEOUT);
1627
- return () => clearTimeout(t);
1703
+ return () => clearTimeout(t2);
1628
1704
  }, [
1705
+ offline,
1629
1706
  needsToUpload,
1630
1707
  needsToDownload
1631
1708
  ]);
1632
- return /* @__PURE__ */ React17.createElement(StatusBar2.Item, null, /* @__PURE__ */ React17.createElement(Popover3.Root, null, /* @__PURE__ */ React17.createElement(Popover3.Trigger, null, /* @__PURE__ */ React17.createElement(Icon2, {
1633
- icon: offline ? "ph--cloud-x--regular" : needsToUpload ? "ph--cloud-arrow-up--regular" : needsToDownload ? "ph--cloud-arrow-down--regular" : "ph--cloud-check--regular",
1709
+ const title = t(`${status} label`);
1710
+ const icon = /* @__PURE__ */ React16.createElement(Icon2, {
1711
+ icon: getIcon(status),
1634
1712
  size: 4,
1635
1713
  classNames
1636
- })), /* @__PURE__ */ React17.createElement(Popover3.Content, {
1637
- sideOffset: 16
1638
- }, /* @__PURE__ */ React17.createElement(SyncStatusDetail, {
1639
- state,
1640
- summary,
1641
- debug: false
1642
- }))));
1714
+ });
1715
+ if (offline) {
1716
+ return /* @__PURE__ */ React16.createElement(StatusBar.Item, {
1717
+ title
1718
+ }, icon);
1719
+ } else {
1720
+ return /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, {
1721
+ asChild: true
1722
+ }, /* @__PURE__ */ React16.createElement(StatusBar.Button, {
1723
+ title
1724
+ }, icon)), /* @__PURE__ */ React16.createElement(Popover3.Portal, null, /* @__PURE__ */ React16.createElement(Popover3.Content, {
1725
+ sideOffset: 16
1726
+ }, /* @__PURE__ */ React16.createElement(SyncStatusDetail, {
1727
+ state,
1728
+ summary,
1729
+ debug: false
1730
+ }))));
1731
+ }
1643
1732
  };
1644
1733
  var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
1645
- const { t } = useTranslation17(SPACE_PLUGIN);
1734
+ const { t } = useTranslation15(SPACE_PLUGIN);
1646
1735
  const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
1647
- return /* @__PURE__ */ React17.createElement("div", {
1648
- className: mx7("flex flex-col text-xs min-w-[16rem]", classNames)
1649
- }, /* @__PURE__ */ React17.createElement("h1", {
1650
- className: "p-2"
1651
- }, t("sync status title")), /* @__PURE__ */ React17.createElement("div", {
1652
- className: "flex flex-col gap-[2px] my-[2px]"
1653
- }, entries.map(([spaceId, state2]) => /* @__PURE__ */ React17.createElement(SpaceRow, {
1736
+ return /* @__PURE__ */ React16.createElement("div", {
1737
+ className: mx7("flex flex-col gap-3 p-2 text-xs min-w-[16rem]", classNames)
1738
+ }, /* @__PURE__ */ React16.createElement("h1", null, t("sync status title")), /* @__PURE__ */ React16.createElement("div", {
1739
+ className: "flex flex-col gap-2"
1740
+ }, entries.map(([spaceId, state2]) => /* @__PURE__ */ React16.createElement(SpaceRow, {
1654
1741
  key: spaceId,
1655
1742
  spaceId,
1656
1743
  state: state2
1657
- }))), debug && /* @__PURE__ */ React17.createElement(SyntaxHighlighter, {
1744
+ }))), debug && /* @__PURE__ */ React16.createElement(SyntaxHighlighter, {
1658
1745
  language: "json"
1659
1746
  }, JSON.stringify(summary, null, 2)));
1660
1747
  };
1661
- var useActive = (count) => {
1662
- const [current, setCurrent] = useState11(count);
1663
- const [active, setActive] = useState11(false);
1664
- useEffect7(() => {
1665
- let t;
1666
- if (count !== current) {
1667
- setActive(true);
1668
- setCurrent(count);
1669
- t && clearTimeout(t);
1670
- t = setTimeout(() => {
1671
- setActive(false);
1672
- }, SYNC_STALLED_TIMEOUT);
1673
- }
1674
- return () => {
1675
- setActive(false);
1676
- clearTimeout(t);
1677
- };
1678
- }, [
1679
- count,
1680
- current
1681
- ]);
1682
- return active;
1683
- };
1684
- var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
1685
- const downActive = useActive(localDocumentCount);
1686
- const upActive = useActive(remoteDocumentCount);
1687
- return /* @__PURE__ */ React17.createElement("div", {
1688
- className: mx7("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
1689
- title: spaceId,
1690
- onClick: () => {
1691
- void navigator.clipboard.writeText(spaceId);
1692
- }
1693
- }, /* @__PURE__ */ React17.createElement(Icon2, {
1694
- icon: "ph--arrow-fat-line-left--regular",
1695
- size: 3,
1696
- classNames: mx7(downActive && "animate-[pulse_1s_infinite]")
1697
- }), /* @__PURE__ */ React17.createElement(Candle, {
1698
- up: {
1699
- count: remoteDocumentCount,
1700
- total: remoteDocumentCount + missingOnRemote
1701
- },
1702
- down: {
1703
- count: localDocumentCount,
1704
- total: localDocumentCount + missingOnLocal
1705
- },
1706
- title: spaceId
1707
- }), /* @__PURE__ */ React17.createElement(Icon2, {
1708
- icon: "ph--arrow-fat-line-right--regular",
1709
- size: 3,
1710
- classNames: mx7(upActive && "animate-[pulse_1s_step-start_infinite]")
1711
- }));
1712
- };
1713
- var Candle = ({ classNames, up, down }) => {
1714
- return /* @__PURE__ */ React17.createElement("div", {
1715
- className: mx7("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
1716
- }, /* @__PURE__ */ React17.createElement(Bar, {
1717
- classNames: "justify-end",
1718
- ...up
1719
- }), /* @__PURE__ */ React17.createElement("div", {
1720
- className: "relative"
1721
- }, /* @__PURE__ */ React17.createElement("div", {
1722
- className: mx7("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
1723
- }, up.total)), /* @__PURE__ */ React17.createElement(Bar, down));
1724
- };
1725
- var Bar = ({ classNames, count, total }) => {
1726
- let p = count / total * 100;
1727
- if (count < total) {
1728
- p = Math.min(p, 95);
1729
- }
1730
- return /* @__PURE__ */ React17.createElement("div", {
1731
- className: mx7("relative flex w-full", styles.barBg, classNames)
1732
- }, /* @__PURE__ */ React17.createElement("div", {
1733
- className: mx7("shrink-0", styles.barFg),
1734
- style: {
1735
- width: `${p}%`
1736
- }
1737
- }), count !== total && /* @__PURE__ */ React17.createElement("div", {
1738
- className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
1739
- }, count));
1740
- };
1741
1748
 
1742
1749
  // packages/plugins/plugin-space/src/translations.ts
1743
1750
  var translations_default = [
@@ -1826,7 +1833,13 @@ var translations_default = [
1826
1833
  "name label": "Name",
1827
1834
  "name placeholder": "Name",
1828
1835
  "unnamed object settings label": "Settings",
1829
- "edge replication label": "Enable EDGE Replication"
1836
+ "edge replication label": "Enable EDGE Replication",
1837
+ "saving locally label": "Writing to disk",
1838
+ "downloading label": "Replicating from peers",
1839
+ "uploading label": "Replicating to peers",
1840
+ "offline persisted label": "Saved to disk (offline)",
1841
+ "remote synced label": "Synced with peers",
1842
+ "open settings panel label": "Show Settings"
1830
1843
  }
1831
1844
  }
1832
1845
  }
@@ -1835,7 +1848,6 @@ var translations_default = [
1835
1848
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
1836
1849
  var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
1837
1850
  var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
1838
- var OBJECT_ID_LENGTH = 60;
1839
1851
  var SPACE_MAX_OBJECTS = 500;
1840
1852
  var DIRECTORY_TYPE = "text/directory";
1841
1853
  var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
@@ -1855,15 +1867,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1855
1867
  const spaceSubscriptions = new EventSubscriptions();
1856
1868
  const graphSubscriptions = /* @__PURE__ */ new Map();
1857
1869
  let clientPlugin;
1870
+ let graphPlugin;
1858
1871
  let intentPlugin;
1872
+ let layoutPlugin;
1859
1873
  let navigationPlugin;
1860
1874
  let attentionPlugin;
1861
1875
  const onSpaceReady = async () => {
1862
- if (!clientPlugin || !navigationPlugin || !attentionPlugin) {
1876
+ if (!clientPlugin || !intentPlugin || !graphPlugin || !navigationPlugin || !layoutPlugin || !attentionPlugin) {
1863
1877
  return;
1864
1878
  }
1865
1879
  const client = clientPlugin.provides.client;
1880
+ const dispatch = intentPlugin.provides.intent.dispatch;
1881
+ const graph = graphPlugin.provides.graph;
1866
1882
  const location = navigationPlugin.provides.location;
1883
+ const layout = layoutPlugin.provides.layout;
1867
1884
  const attention = attentionPlugin.provides.attention;
1868
1885
  const defaultSpace = client.spaces.default;
1869
1886
  if (typeof defaultSpace.properties[COMPOSER_SPACE_LOCK] !== "boolean") {
@@ -1878,6 +1895,24 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1878
1895
  order: []
1879
1896
  }));
1880
1897
  }
1898
+ subscriptions.add(scheduledEffect(() => ({
1899
+ layoutMode: layout.layoutMode,
1900
+ soloPart: location.active.solo?.[0]
1901
+ }), ({ layoutMode, soloPart }) => {
1902
+ if (layoutMode !== "solo" || !soloPart) {
1903
+ return;
1904
+ }
1905
+ const node = graph.findNode(soloPart.id);
1906
+ 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
1912
+ }
1913
+ });
1914
+ }
1915
+ }));
1881
1916
  subscriptions.add(client.spaces.subscribe(async (spaces) => {
1882
1917
  if (defaultSpace.state.get() === SpaceState3.SPACE_REQUIRES_MIGRATION) {
1883
1918
  await defaultSpace.internal.migrate();
@@ -1925,7 +1960,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1925
1960
  err: err.message
1926
1961
  }, {
1927
1962
  F: __dxlog_file6,
1928
- L: 231,
1963
+ L: 257,
1929
1964
  S: void 0,
1930
1965
  C: (f, a) => f(...a)
1931
1966
  });
@@ -1983,10 +2018,12 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1983
2018
  key: "spaceNames",
1984
2019
  type: LocalStorageStore.json()
1985
2020
  });
2021
+ graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
2022
+ layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
1986
2023
  navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
1987
2024
  attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
1988
2025
  clientPlugin = resolvePlugin(plugins, parseClientPlugin);
1989
- intentPlugin = resolvePlugin(plugins, parseIntentPlugin3);
2026
+ intentPlugin = resolvePlugin(plugins, parseIntentPlugin2);
1990
2027
  if (!clientPlugin || !intentPlugin) {
1991
2028
  return;
1992
2029
  }
@@ -2006,7 +2043,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2006
2043
  dispatch
2007
2044
  });
2008
2045
  };
2009
- client.spaces.isReady.subscribe(async (ready) => {
2046
+ subscriptions.add(client.spaces.isReady.subscribe(async (ready) => {
2010
2047
  if (ready) {
2011
2048
  await clientPlugin?.provides.client.spaces.default.waitUntilReady();
2012
2049
  if (firstRun) {
@@ -2016,7 +2053,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2016
2053
  }
2017
2054
  await onSpaceReady();
2018
2055
  }
2019
- });
2056
+ }).unsubscribe);
2020
2057
  },
2021
2058
  unload: async () => {
2022
2059
  settings.close();
@@ -2032,7 +2069,21 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2032
2069
  ...translations_default,
2033
2070
  osTranslations
2034
2071
  ],
2035
- root: () => state.values.awaiting ? /* @__PURE__ */ React18.createElement(AwaitingObject, {
2072
+ complementary: {
2073
+ panels: [
2074
+ {
2075
+ id: "settings",
2076
+ label: [
2077
+ "open settings panel label",
2078
+ {
2079
+ ns: SPACE_PLUGIN
2080
+ }
2081
+ ],
2082
+ icon: "ph--gear--regular"
2083
+ }
2084
+ ]
2085
+ },
2086
+ root: () => state.values.awaiting ? /* @__PURE__ */ React17.createElement(AwaitingObject, {
2036
2087
  id: state.values.awaiting
2037
2088
  }) : null,
2038
2089
  metadata: {
@@ -2060,37 +2111,33 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2060
2111
  },
2061
2112
  surface: {
2062
2113
  component: ({ data, role, ...rest }) => {
2063
- const primary = data.active ?? data.object;
2064
2114
  switch (role) {
2065
2115
  case "article":
2066
- case "main":
2067
- return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React18.createElement(Surface2, {
2116
+ return isSpace2(data.object) && data.object.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface2, {
2068
2117
  data: {
2069
- active: primary.properties[CollectionType.typename],
2070
- id: primary.id
2118
+ object: data.object.properties[CollectionType.typename],
2119
+ id: data.object.id
2071
2120
  },
2072
2121
  role,
2073
2122
  ...rest
2074
- }) : primary instanceof CollectionType ? {
2075
- node: /* @__PURE__ */ React18.createElement(CollectionMain, {
2076
- collection: primary
2123
+ }) : data.object instanceof CollectionType ? {
2124
+ node: /* @__PURE__ */ React17.createElement(CollectionMain, {
2125
+ collection: data.object
2077
2126
  }),
2078
2127
  disposition: "fallback"
2079
- } : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */ React18.createElement(MissingObject, {
2080
- id: primary
2081
- }) : null;
2128
+ } : null;
2082
2129
  case "complementary--settings":
2083
- return isSpace2(data.subject) ? /* @__PURE__ */ React18.createElement(SpaceSettingsPanel, {
2130
+ return isSpace2(data.subject) ? /* @__PURE__ */ React17.createElement(SpaceSettingsPanel, {
2084
2131
  space: data.subject
2085
2132
  }) : isEchoObject2(data.subject) ? {
2086
- node: /* @__PURE__ */ React18.createElement(DefaultObjectSettings, {
2133
+ node: /* @__PURE__ */ React17.createElement(DefaultObjectSettings, {
2087
2134
  object: data.subject
2088
2135
  }),
2089
2136
  disposition: "fallback"
2090
2137
  } : null;
2091
2138
  case "dialog":
2092
2139
  if (data.component === "dxos.org/plugin/space/InvitationManagerDialog") {
2093
- return /* @__PURE__ */ React18.createElement(Dialog.Content, null, /* @__PURE__ */ React18.createElement(ClipboardProvider2, null, /* @__PURE__ */ React18.createElement(InvitationManager, {
2140
+ return /* @__PURE__ */ React17.createElement(Dialog.Content, null, /* @__PURE__ */ React17.createElement(ClipboardProvider2, null, /* @__PURE__ */ React17.createElement(InvitationManager, {
2094
2141
  active: true,
2095
2142
  ...data.subject
2096
2143
  })));
@@ -2098,12 +2145,12 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2098
2145
  return null;
2099
2146
  case "popover": {
2100
2147
  if (data.component === "dxos.org/plugin/space/RenameSpacePopover" && isSpace2(data.subject)) {
2101
- return /* @__PURE__ */ React18.createElement(PopoverRenameSpace, {
2148
+ return /* @__PURE__ */ React17.createElement(PopoverRenameSpace, {
2102
2149
  space: data.subject
2103
2150
  });
2104
2151
  }
2105
2152
  if (data.component === "dxos.org/plugin/space/RenameObjectPopover" && isReactiveObject2(data.subject)) {
2106
- return /* @__PURE__ */ React18.createElement(PopoverRenameObject, {
2153
+ return /* @__PURE__ */ React17.createElement(PopoverRenameObject, {
2107
2154
  object: data.subject
2108
2155
  });
2109
2156
  }
@@ -2111,10 +2158,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2111
2158
  }
2112
2159
  // TODO(burdon): Add role name syntax to minimal plugin docs.
2113
2160
  case "presence--glyph": {
2114
- return isReactiveObject2(data.object) ? /* @__PURE__ */ React18.createElement(SmallPresenceLive, {
2161
+ return isReactiveObject2(data.object) ? /* @__PURE__ */ React17.createElement(SmallPresenceLive, {
2115
2162
  id: data.id,
2116
2163
  viewers: state.values.viewersByObject[fullyQualifiedId4(data.object)]
2117
- }) : /* @__PURE__ */ React18.createElement(SmallPresence, {
2164
+ }) : /* @__PURE__ */ React17.createElement(SmallPresence, {
2118
2165
  id: data.id,
2119
2166
  count: 0
2120
2167
  });
@@ -2129,32 +2176,32 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2129
2176
  const space = isSpace2(data.object) ? data.object : getSpace4(data.object);
2130
2177
  const object = isSpace2(data.object) ? data.object.state.get() === SpaceState3.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
2131
2178
  return space && object ? {
2132
- node: /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SpacePresence, {
2179
+ node: /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SpacePresence, {
2133
2180
  object
2134
- }), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React18.createElement(ShareSpaceButton, {
2181
+ }), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React17.createElement(ShareSpaceButton, {
2135
2182
  spaceId: space.id
2136
2183
  })),
2137
2184
  disposition: "hoist"
2138
2185
  } : null;
2139
2186
  }
2140
2187
  case "section":
2141
- return data.object instanceof CollectionType ? /* @__PURE__ */ React18.createElement(CollectionSection, {
2188
+ return data.object instanceof CollectionType ? /* @__PURE__ */ React17.createElement(CollectionSection, {
2142
2189
  collection: data.object
2143
2190
  }) : null;
2144
2191
  case "settings":
2145
- return data.plugin === meta_default.id ? /* @__PURE__ */ React18.createElement(SpaceSettings, {
2192
+ return data.plugin === meta_default.id ? /* @__PURE__ */ React17.createElement(SpaceSettings, {
2146
2193
  settings: settings.values
2147
2194
  }) : null;
2148
2195
  case "menu-footer":
2149
2196
  if (isEchoObject2(data.object)) {
2150
- return /* @__PURE__ */ React18.createElement(MenuFooter, {
2197
+ return /* @__PURE__ */ React17.createElement(MenuFooter, {
2151
2198
  object: data.object
2152
2199
  });
2153
2200
  } else {
2154
2201
  return null;
2155
2202
  }
2156
2203
  case "status": {
2157
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SyncStatus, null), /* @__PURE__ */ React18.createElement(SaveStatus, null));
2204
+ return /* @__PURE__ */ React17.createElement(SyncStatus, null);
2158
2205
  }
2159
2206
  default:
2160
2207
  return null;
@@ -2165,11 +2212,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2165
2212
  builder: (plugins) => {
2166
2213
  const clientPlugin2 = resolvePlugin(plugins, parseClientPlugin);
2167
2214
  const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
2168
- const graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
2215
+ const graphPlugin2 = resolvePlugin(plugins, parseGraphPlugin);
2169
2216
  const client = clientPlugin2?.provides.client;
2170
2217
  const dispatch = intentPlugin?.provides.intent.dispatch;
2171
2218
  const resolve = metadataPlugin?.provides.metadata.resolver;
2172
- const graph = graphPlugin?.provides.graph;
2219
+ const graph = graphPlugin2?.provides.graph;
2173
2220
  if (!client || !dispatch || !resolve || !graph) {
2174
2221
  return [];
2175
2222
  }
@@ -2215,7 +2262,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2215
2262
  } else {
2216
2263
  log3.warn("spaces order object not found", void 0, {
2217
2264
  F: __dxlog_file6,
2218
- L: 528,
2265
+ L: 553,
2219
2266
  S: void 0,
2220
2267
  C: (f, a) => f(...a)
2221
2268
  });
@@ -2477,7 +2524,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2477
2524
  ];
2478
2525
  },
2479
2526
  serializer: (plugins) => {
2480
- const dispatch = resolvePlugin(plugins, parseIntentPlugin3)?.provides.intent.dispatch;
2527
+ const dispatch = resolvePlugin(plugins, parseIntentPlugin2)?.provides.intent.dispatch;
2481
2528
  if (!dispatch) {
2482
2529
  return [];
2483
2530
  }
@@ -3054,7 +3101,6 @@ export {
3054
3101
  MenuFooter,
3055
3102
  MessageState,
3056
3103
  MessageType,
3057
- MissingObject,
3058
3104
  PersistenceStatus,
3059
3105
  PopoverRenameObject,
3060
3106
  PopoverRenameSpace,
@@ -3064,7 +3110,6 @@ export {
3064
3110
  SPACE_PLUGIN,
3065
3111
  SPACE_PLUGIN_SHORT_ID,
3066
3112
  SPACE_TYPE,
3067
- SaveStatus,
3068
3113
  ShareSpaceButton,
3069
3114
  ShareSpaceButtonImpl,
3070
3115
  SmallPresence,