@dxos/plugin-space 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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 (156) hide show
  1. package/dist/lib/browser/{app-graph-builder-7X3SIPCD.mjs → app-graph-builder-DCWUULKX.mjs} +5 -5
  2. package/dist/lib/browser/{app-graph-serializer-VRU57AEZ.mjs → app-graph-serializer-MLU7XI2P.mjs} +4 -4
  3. package/dist/lib/browser/{chunk-KVRYWFZU.mjs → chunk-3LN4LJN6.mjs} +3 -8
  4. package/dist/lib/{node-esm/chunk-PIYAWT5N.mjs.map → browser/chunk-3LN4LJN6.mjs.map} +3 -3
  5. package/dist/lib/browser/{chunk-AR5R2F6B.mjs → chunk-7Y4M7GXO.mjs} +37 -31
  6. package/dist/lib/browser/{chunk-AR5R2F6B.mjs.map → chunk-7Y4M7GXO.mjs.map} +1 -1
  7. package/dist/lib/browser/{chunk-IQFFOAWD.mjs → chunk-N5QMRLKI.mjs} +2 -2
  8. package/dist/lib/browser/chunk-Q4BTFH2P.mjs +1900 -0
  9. package/dist/lib/{node-esm/chunk-FI3WV22Y.mjs.map → browser/chunk-Q4BTFH2P.mjs.map} +3 -3
  10. package/dist/lib/browser/{chunk-UBSVH2NQ.mjs → chunk-VEBKN45O.mjs} +2 -2
  11. package/dist/lib/browser/chunk-W46VVHFM.mjs +288 -0
  12. package/dist/lib/browser/chunk-W46VVHFM.mjs.map +7 -0
  13. package/dist/lib/browser/{identity-created-ANRJHNMQ.mjs → identity-created-O63SIYOF.mjs} +2 -2
  14. package/dist/lib/browser/index.mjs +9 -12
  15. package/dist/lib/browser/index.mjs.map +1 -1
  16. package/dist/lib/browser/{intent-resolver-KRINV5QI.mjs → intent-resolver-KBF3YU6I.mjs} +25 -9
  17. package/dist/lib/browser/intent-resolver-KBF3YU6I.mjs.map +7 -0
  18. package/dist/lib/browser/meta.json +1 -1
  19. package/dist/lib/browser/{react-root-J3SP2HVW.mjs → react-root-PVKJE4EZ.mjs} +6 -6
  20. package/dist/lib/browser/{react-surface-J7T2IMH4.mjs → react-surface-252P4NCK.mjs} +6 -6
  21. package/dist/lib/browser/{schema-defs-OCBY7APN.mjs → schema-defs-JMN74RNK.mjs} +2 -2
  22. package/dist/lib/browser/{schema-tools-MYC4LTQD.mjs → schema-tools-JIEMHUXV.mjs} +9 -9
  23. package/dist/lib/browser/schema-tools-JIEMHUXV.mjs.map +7 -0
  24. package/dist/lib/browser/{settings-G24447B7.mjs → settings-2IN2WLUK.mjs} +2 -2
  25. package/dist/lib/browser/{spaces-ready-5I3RKYTT.mjs → spaces-ready-L4QAGTDE.mjs} +5 -5
  26. package/dist/lib/browser/{spaces-ready-5I3RKYTT.mjs.map → spaces-ready-L4QAGTDE.mjs.map} +1 -1
  27. package/dist/lib/browser/{state-SI4B5GHC.mjs → state-6HOSHLIN.mjs} +2 -2
  28. package/dist/lib/browser/types/index.mjs +1 -7
  29. package/dist/lib/node/{app-graph-builder-C2ISDMSL.cjs → app-graph-builder-WC445X77.cjs} +40 -40
  30. package/dist/lib/node/{app-graph-serializer-VLBCR3IX.cjs → app-graph-serializer-UPQOQVMJ.cjs} +20 -20
  31. package/dist/lib/node/{chunk-DQN4ZQDW.cjs → chunk-5WLAXYE3.cjs} +40 -34
  32. package/dist/lib/node/{chunk-DQN4ZQDW.cjs.map → chunk-5WLAXYE3.cjs.map} +1 -1
  33. package/dist/lib/node/{chunk-IKIDS6XF.cjs → chunk-7GQGM4ZF.cjs} +7 -13
  34. package/dist/lib/node/{chunk-IKIDS6XF.cjs.map → chunk-7GQGM4ZF.cjs.map} +3 -3
  35. package/dist/lib/node/{chunk-SCATWJKX.cjs → chunk-COQYISES.cjs} +27 -27
  36. package/dist/lib/node/{chunk-5YHUQJVB.cjs → chunk-DXL5TDFP.cjs} +6 -6
  37. package/dist/lib/node/{chunk-K6ZO4WDJ.cjs → chunk-FXHI7JNY.cjs} +121 -130
  38. package/dist/lib/node/chunk-FXHI7JNY.cjs.map +7 -0
  39. package/dist/lib/node/chunk-Q3YZEYZT.cjs +1904 -0
  40. package/dist/lib/node/{chunk-MXBE2VET.cjs.map → chunk-Q3YZEYZT.cjs.map} +3 -3
  41. package/dist/lib/node/{identity-created-NIPYGVG3.cjs → identity-created-UXEAUGC7.cjs} +6 -6
  42. package/dist/lib/node/index.cjs +68 -72
  43. package/dist/lib/node/index.cjs.map +1 -1
  44. package/dist/lib/node/{intent-resolver-MJVRY6YE.cjs → intent-resolver-SVFJKUH7.cjs} +75 -59
  45. package/dist/lib/node/intent-resolver-SVFJKUH7.cjs.map +7 -0
  46. package/dist/lib/node/meta.json +1 -1
  47. package/dist/lib/node/{react-root-M4BZ6VXB.cjs → react-root-DDPDUMCG.cjs} +11 -11
  48. package/dist/lib/node/{react-surface-RYKSYYKM.cjs → react-surface-JUIU37BX.cjs} +44 -44
  49. package/dist/lib/node/{schema-defs-2HJLXSNK.cjs → schema-defs-XLFBG3XK.cjs} +6 -6
  50. package/dist/lib/node/{schema-tools-OE3MFYYH.cjs → schema-tools-ZG6Z2QRC.cjs} +16 -16
  51. package/dist/lib/node/schema-tools-ZG6Z2QRC.cjs.map +7 -0
  52. package/dist/lib/node/{settings-AFWO4AWK.cjs → settings-FOH7EB5C.cjs} +6 -6
  53. package/dist/lib/node/{spaces-ready-BMPXSFHF.cjs → spaces-ready-VXQYCBII.cjs} +14 -14
  54. package/dist/lib/node/{spaces-ready-BMPXSFHF.cjs.map → spaces-ready-VXQYCBII.cjs.map} +1 -1
  55. package/dist/lib/node/{state-L2ZSDKLS.cjs → state-ZT3MTZXB.cjs} +6 -6
  56. package/dist/lib/node/types/index.cjs +12 -18
  57. package/dist/lib/node/types/index.cjs.map +2 -2
  58. package/dist/lib/node-esm/{app-graph-builder-WVCQZ324.mjs → app-graph-builder-E7CCGPQJ.mjs} +5 -5
  59. package/dist/lib/node-esm/{app-graph-serializer-GEUYYXKD.mjs → app-graph-serializer-UCMSLPIA.mjs} +4 -4
  60. package/dist/lib/node-esm/{chunk-PIYAWT5N.mjs → chunk-4X4Y63ND.mjs} +3 -8
  61. package/dist/lib/{browser/chunk-KVRYWFZU.mjs.map → node-esm/chunk-4X4Y63ND.mjs.map} +3 -3
  62. package/dist/lib/node-esm/chunk-FTELJGEG.mjs +289 -0
  63. package/dist/lib/node-esm/chunk-FTELJGEG.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-HNKAG5CX.mjs → chunk-GH2FGJXH.mjs} +37 -31
  65. package/dist/lib/node-esm/{chunk-HNKAG5CX.mjs.map → chunk-GH2FGJXH.mjs.map} +1 -1
  66. package/dist/lib/node-esm/chunk-HL2Z2GNW.mjs +1901 -0
  67. package/dist/lib/{browser/chunk-43UQWMD3.mjs.map → node-esm/chunk-HL2Z2GNW.mjs.map} +3 -3
  68. package/dist/lib/node-esm/{chunk-5NIBYPVF.mjs → chunk-OSPEGYX3.mjs} +2 -2
  69. package/dist/lib/node-esm/{chunk-S2W6HS4A.mjs → chunk-XAZNQ3QN.mjs} +2 -2
  70. package/dist/lib/node-esm/{identity-created-O5X2FFWU.mjs → identity-created-ZECO4NH3.mjs} +2 -2
  71. package/dist/lib/node-esm/index.mjs +9 -12
  72. package/dist/lib/node-esm/index.mjs.map +1 -1
  73. package/dist/lib/node-esm/{intent-resolver-JT6EB47M.mjs → intent-resolver-K2UDBF2R.mjs} +25 -9
  74. package/dist/lib/node-esm/intent-resolver-K2UDBF2R.mjs.map +7 -0
  75. package/dist/lib/node-esm/meta.json +1 -1
  76. package/dist/lib/node-esm/{react-root-S2LW4FS7.mjs → react-root-6F7B3OVO.mjs} +6 -6
  77. package/dist/lib/node-esm/{react-surface-ZNNMO7QQ.mjs → react-surface-NP3Y6BNZ.mjs} +6 -6
  78. package/dist/lib/node-esm/{schema-defs-B74N3GQ5.mjs → schema-defs-QZJS6UXN.mjs} +2 -2
  79. package/dist/lib/node-esm/{schema-tools-YTJLA3NQ.mjs → schema-tools-2Y4D42PD.mjs} +9 -9
  80. package/dist/lib/node-esm/schema-tools-2Y4D42PD.mjs.map +7 -0
  81. package/dist/lib/node-esm/{settings-MJVSCOI4.mjs → settings-Q4XDFSYD.mjs} +2 -2
  82. package/dist/lib/node-esm/{spaces-ready-XKG57SL5.mjs → spaces-ready-JHKPD4PH.mjs} +5 -5
  83. package/dist/lib/node-esm/{spaces-ready-XKG57SL5.mjs.map → spaces-ready-JHKPD4PH.mjs.map} +1 -1
  84. package/dist/lib/node-esm/{state-QUDYGEU6.mjs → state-4ATRHSKA.mjs} +2 -2
  85. package/dist/lib/node-esm/types/index.mjs +1 -7
  86. package/dist/types/src/capabilities/capabilities.d.ts +0 -8
  87. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/index.d.ts +1 -1
  89. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  90. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  91. package/dist/types/src/capabilities/schema-tools.d.ts +1 -1
  92. package/dist/types/src/capabilities/schema-tools.d.ts.map +1 -1
  93. package/dist/types/src/index.d.ts +2 -2
  94. package/dist/types/src/index.d.ts.map +1 -1
  95. package/dist/types/src/types/index.d.ts +0 -1
  96. package/dist/types/src/types/index.d.ts.map +1 -1
  97. package/dist/types/src/types/types.d.ts +17 -1
  98. package/dist/types/src/types/types.d.ts.map +1 -1
  99. package/package.json +48 -48
  100. package/src/capabilities/capabilities.ts +0 -9
  101. package/src/capabilities/intent-resolver.ts +13 -1
  102. package/src/capabilities/schema-tools.ts +8 -8
  103. package/src/capabilities/spaces-ready.ts +1 -1
  104. package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +2 -2
  105. package/src/components/PopoverRenameObject.tsx +1 -1
  106. package/src/components/PopoverRenameSpace.tsx +1 -1
  107. package/src/index.ts +2 -2
  108. package/src/types/index.ts +0 -1
  109. package/src/types/types.ts +16 -1
  110. package/dist/lib/browser/chunk-43UQWMD3.mjs +0 -1731
  111. package/dist/lib/browser/chunk-CY35NLWL.mjs +0 -296
  112. package/dist/lib/browser/chunk-CY35NLWL.mjs.map +0 -7
  113. package/dist/lib/browser/intent-resolver-KRINV5QI.mjs.map +0 -7
  114. package/dist/lib/browser/schema-tools-MYC4LTQD.mjs.map +0 -7
  115. package/dist/lib/node/chunk-K6ZO4WDJ.cjs.map +0 -7
  116. package/dist/lib/node/chunk-MXBE2VET.cjs +0 -1735
  117. package/dist/lib/node/intent-resolver-MJVRY6YE.cjs.map +0 -7
  118. package/dist/lib/node/schema-tools-OE3MFYYH.cjs.map +0 -7
  119. package/dist/lib/node-esm/chunk-CLRCW6PU.mjs +0 -297
  120. package/dist/lib/node-esm/chunk-CLRCW6PU.mjs.map +0 -7
  121. package/dist/lib/node-esm/chunk-FI3WV22Y.mjs +0 -1732
  122. package/dist/lib/node-esm/intent-resolver-JT6EB47M.mjs.map +0 -7
  123. package/dist/lib/node-esm/schema-tools-YTJLA3NQ.mjs.map +0 -7
  124. package/dist/types/src/types/thread.d.ts +0 -223
  125. package/dist/types/src/types/thread.d.ts.map +0 -1
  126. package/src/types/thread.ts +0 -30
  127. /package/dist/lib/browser/{app-graph-builder-7X3SIPCD.mjs.map → app-graph-builder-DCWUULKX.mjs.map} +0 -0
  128. /package/dist/lib/browser/{app-graph-serializer-VRU57AEZ.mjs.map → app-graph-serializer-MLU7XI2P.mjs.map} +0 -0
  129. /package/dist/lib/browser/{chunk-IQFFOAWD.mjs.map → chunk-N5QMRLKI.mjs.map} +0 -0
  130. /package/dist/lib/browser/{chunk-UBSVH2NQ.mjs.map → chunk-VEBKN45O.mjs.map} +0 -0
  131. /package/dist/lib/browser/{identity-created-ANRJHNMQ.mjs.map → identity-created-O63SIYOF.mjs.map} +0 -0
  132. /package/dist/lib/browser/{react-root-J3SP2HVW.mjs.map → react-root-PVKJE4EZ.mjs.map} +0 -0
  133. /package/dist/lib/browser/{react-surface-J7T2IMH4.mjs.map → react-surface-252P4NCK.mjs.map} +0 -0
  134. /package/dist/lib/browser/{schema-defs-OCBY7APN.mjs.map → schema-defs-JMN74RNK.mjs.map} +0 -0
  135. /package/dist/lib/browser/{settings-G24447B7.mjs.map → settings-2IN2WLUK.mjs.map} +0 -0
  136. /package/dist/lib/browser/{state-SI4B5GHC.mjs.map → state-6HOSHLIN.mjs.map} +0 -0
  137. /package/dist/lib/node/{app-graph-builder-C2ISDMSL.cjs.map → app-graph-builder-WC445X77.cjs.map} +0 -0
  138. /package/dist/lib/node/{app-graph-serializer-VLBCR3IX.cjs.map → app-graph-serializer-UPQOQVMJ.cjs.map} +0 -0
  139. /package/dist/lib/node/{chunk-SCATWJKX.cjs.map → chunk-COQYISES.cjs.map} +0 -0
  140. /package/dist/lib/node/{chunk-5YHUQJVB.cjs.map → chunk-DXL5TDFP.cjs.map} +0 -0
  141. /package/dist/lib/node/{identity-created-NIPYGVG3.cjs.map → identity-created-UXEAUGC7.cjs.map} +0 -0
  142. /package/dist/lib/node/{react-root-M4BZ6VXB.cjs.map → react-root-DDPDUMCG.cjs.map} +0 -0
  143. /package/dist/lib/node/{react-surface-RYKSYYKM.cjs.map → react-surface-JUIU37BX.cjs.map} +0 -0
  144. /package/dist/lib/node/{schema-defs-2HJLXSNK.cjs.map → schema-defs-XLFBG3XK.cjs.map} +0 -0
  145. /package/dist/lib/node/{settings-AFWO4AWK.cjs.map → settings-FOH7EB5C.cjs.map} +0 -0
  146. /package/dist/lib/node/{state-L2ZSDKLS.cjs.map → state-ZT3MTZXB.cjs.map} +0 -0
  147. /package/dist/lib/node-esm/{app-graph-builder-WVCQZ324.mjs.map → app-graph-builder-E7CCGPQJ.mjs.map} +0 -0
  148. /package/dist/lib/node-esm/{app-graph-serializer-GEUYYXKD.mjs.map → app-graph-serializer-UCMSLPIA.mjs.map} +0 -0
  149. /package/dist/lib/node-esm/{chunk-5NIBYPVF.mjs.map → chunk-OSPEGYX3.mjs.map} +0 -0
  150. /package/dist/lib/node-esm/{chunk-S2W6HS4A.mjs.map → chunk-XAZNQ3QN.mjs.map} +0 -0
  151. /package/dist/lib/node-esm/{identity-created-O5X2FFWU.mjs.map → identity-created-ZECO4NH3.mjs.map} +0 -0
  152. /package/dist/lib/node-esm/{react-root-S2LW4FS7.mjs.map → react-root-6F7B3OVO.mjs.map} +0 -0
  153. /package/dist/lib/node-esm/{react-surface-ZNNMO7QQ.mjs.map → react-surface-NP3Y6BNZ.mjs.map} +0 -0
  154. /package/dist/lib/node-esm/{schema-defs-B74N3GQ5.mjs.map → schema-defs-QZJS6UXN.mjs.map} +0 -0
  155. /package/dist/lib/node-esm/{settings-MJVSCOI4.mjs.map → settings-Q4XDFSYD.mjs.map} +0 -0
  156. /package/dist/lib/node-esm/{state-QUDYGEU6.mjs.map → state-4ATRHSKA.mjs.map} +0 -0
@@ -1,1731 +0,0 @@
1
- import {
2
- useInputSurfaceLookup,
3
- usePath
4
- } from "./chunk-AR5R2F6B.mjs";
5
- import {
6
- SpaceCapabilities
7
- } from "./chunk-KVRYWFZU.mjs";
8
- import {
9
- COMPOSER_SPACE_LOCK,
10
- getSpaceDisplayName
11
- } from "./chunk-IQFFOAWD.mjs";
12
- import {
13
- CollectionType,
14
- SpaceAction,
15
- SpaceForm
16
- } from "./chunk-CY35NLWL.mjs";
17
- import {
18
- SPACE_PLUGIN,
19
- meta
20
- } from "./chunk-PTKYMZWO.mjs";
21
-
22
- // packages/plugins/plugin-space/src/components/AwaitingObject.tsx
23
- import { CheckCircle, CircleDashed, CircleNotch } from "@phosphor-icons/react";
24
- import React, { useCallback, useEffect, useState } from "react";
25
- import { createIntent, LayoutAction, useIntentDispatcher, useLayout } from "@dxos/app-framework";
26
- import { useClient } from "@dxos/react-client";
27
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
28
- import { Button, Toast, useTranslation } from "@dxos/react-ui";
29
- import { getSize, mx } from "@dxos/react-ui-theme";
30
- var WAIT_FOR_OBJECT_TIMEOUT = 18e4;
31
- var TOAST_TIMEOUT = 24e4;
32
- var AwaitingObject = ({ id }) => {
33
- const [open, setOpen] = useState(true);
34
- const [waiting, setWaiting] = useState(true);
35
- const [found, setFound] = useState(false);
36
- const { t } = useTranslation(SPACE_PLUGIN);
37
- const { dispatchPromise: dispatch } = useIntentDispatcher();
38
- const layout = useLayout();
39
- const client = useClient();
40
- const objects = useQuery(client.spaces, Filter.everything());
41
- useEffect(() => {
42
- if (!id) {
43
- return;
44
- }
45
- const timeout = setTimeout(() => {
46
- setWaiting(false);
47
- }, WAIT_FOR_OBJECT_TIMEOUT);
48
- () => clearTimeout(timeout);
49
- }, [
50
- id
51
- ]);
52
- useEffect(() => {
53
- if (objects.findIndex((object) => fullyQualifiedId(object) === id) > -1) {
54
- setFound(true);
55
- if (layout.active.includes(id)) {
56
- setOpen(false);
57
- }
58
- }
59
- }, [
60
- id,
61
- objects,
62
- layout
63
- ]);
64
- const handleClose = useCallback(async () => dispatch(createIntent(SpaceAction.WaitForObject, {
65
- id: void 0
66
- })), [
67
- dispatch
68
- ]);
69
- const handleNavigate = useCallback(() => {
70
- void dispatch(createIntent(LayoutAction.Open, {
71
- part: "main",
72
- subject: [
73
- id
74
- ]
75
- }));
76
- void handleClose();
77
- }, [
78
- id,
79
- handleClose,
80
- dispatch
81
- ]);
82
- return /* @__PURE__ */ React.createElement(Toast.Root, {
83
- open,
84
- duration: TOAST_TIMEOUT,
85
- onOpenChange: setOpen
86
- }, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
87
- classNames: "flex items-center gap-2"
88
- }, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CheckCircle, {
89
- className: getSize(5)
90
- }), /* @__PURE__ */ React.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleNotch, {
91
- className: mx(getSize(5), "animate-spin")
92
- }), /* @__PURE__ */ React.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CircleDashed, {
93
- className: getSize(5)
94
- }), /* @__PURE__ */ React.createElement("span", null, t("object not found label")))), /* @__PURE__ */ React.createElement(Toast.Description, null, t(found ? "found object description" : waiting ? "waiting for object description" : "object not found description"))), /* @__PURE__ */ React.createElement(Toast.Actions, null, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toast.Action, {
95
- altText: t("go to object alt"),
96
- asChild: true
97
- }, /* @__PURE__ */ React.createElement(Button, {
98
- variant: "primary",
99
- onClick: handleNavigate
100
- }, t("go to object label"))), /* @__PURE__ */ React.createElement(Toast.Close, {
101
- asChild: true
102
- }, /* @__PURE__ */ React.createElement(Button, {
103
- onClick: handleClose
104
- }, t("close label", {
105
- ns: "appkit"
106
- })))) : /* @__PURE__ */ React.createElement(Toast.Close, {
107
- asChild: true
108
- }, /* @__PURE__ */ React.createElement(Button, {
109
- onClick: handleClose
110
- }, t(waiting ? "close label" : "confirm label", {
111
- ns: "appkit"
112
- })))));
113
- };
114
-
115
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
116
- import { pipe } from "effect";
117
- import React3, { useCallback as useCallback3, useRef } from "react";
118
- import { Capabilities, chain, createIntent as createIntent2, LayoutAction as LayoutAction2, useCapabilities, useIntentDispatcher as useIntentDispatcher2, usePluginManager } from "@dxos/app-framework";
119
- import { invariant as invariant2 } from "@dxos/invariant";
120
- import { useClient as useClient2 } from "@dxos/react-client";
121
- import { getSpace, isLiveObject, isSpace, useSpaces } from "@dxos/react-client/echo";
122
- import { Button as Button2, Dialog, Icon as Icon2, useTranslation as useTranslation3 } from "@dxos/react-ui";
123
-
124
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
125
- import React2, { useCallback as useCallback2, useState as useState2 } from "react";
126
- import { getTypeAnnotation } from "@dxos/echo-schema";
127
- import { invariant } from "@dxos/invariant";
128
- import { Icon, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
129
- import { Form } from "@dxos/react-ui-form";
130
- import { SearchList } from "@dxos/react-ui-searchlist";
131
- import { mx as mx2 } from "@dxos/react-ui-theme";
132
- import { isNonNullable } from "@dxos/util";
133
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx";
134
- var CreateObjectPanel = ({ classNames, forms, spaces, typename: initialTypename, target: initialTarget, name: initialName, defaultSpaceId, resolve, onCreateObject }) => {
135
- const { t } = useTranslation2(SPACE_PLUGIN);
136
- const [typename, setTypename] = useState2(initialTypename);
137
- const [target, setTarget] = useState2(initialTarget);
138
- const form = forms.find((form2) => getTypeAnnotation(form2.objectSchema)?.typename === typename);
139
- const options = forms.map((form2) => getTypeAnnotation(form2.objectSchema)).filter(isNonNullable).sort((a, b) => {
140
- const nameA = t("typename label", {
141
- ns: a.typename,
142
- defaultValue: a.typename
143
- });
144
- const nameB = t("typename label", {
145
- ns: b.typename,
146
- defaultValue: b.typename
147
- });
148
- return nameA.localeCompare(nameB);
149
- });
150
- const handleCreateObject = useCallback2(async (props) => {
151
- if (!form || !target) {
152
- return;
153
- }
154
- await onCreateObject?.({
155
- form,
156
- target,
157
- data: props
158
- });
159
- }, [
160
- onCreateObject,
161
- form,
162
- target
163
- ]);
164
- const handleSetTypename = useCallback2(async (typename2) => {
165
- invariant(target, "target is required", {
166
- F: __dxlog_file,
167
- L: 72,
168
- S: void 0,
169
- A: [
170
- "target",
171
- "'target is required'"
172
- ]
173
- });
174
- const form2 = forms.find((form3) => getTypeAnnotation(form3.objectSchema)?.typename === typename2);
175
- if (form2 && !form2.formSchema) {
176
- await onCreateObject?.({
177
- form: form2,
178
- target
179
- });
180
- } else {
181
- setTypename(typename2);
182
- }
183
- }, [
184
- forms,
185
- onCreateObject,
186
- target
187
- ]);
188
- const inputSurfaceLookup = useInputSurfaceLookup({
189
- target
190
- });
191
- return /* @__PURE__ */ React2.createElement("div", {
192
- role: "form",
193
- className: mx2("flex flex-col gap-2", classNames)
194
- }, !form ? /* @__PURE__ */ React2.createElement(SelectSchema, {
195
- options,
196
- resolve,
197
- onChange: handleSetTypename
198
- }) : !target ? /* @__PURE__ */ React2.createElement(SelectSpace, {
199
- spaces,
200
- defaultSpaceId,
201
- onChange: setTarget
202
- }) : form.formSchema ? /* @__PURE__ */ React2.createElement(Form, {
203
- classNames: "!p-0",
204
- autoFocus: true,
205
- values: {
206
- name: initialName
207
- },
208
- schema: form.formSchema,
209
- testId: "create-object-form",
210
- onSave: handleCreateObject,
211
- lookupComponent: inputSurfaceLookup
212
- }) : void 0);
213
- };
214
- var SelectSpace = ({ spaces, defaultSpaceId, onChange }) => {
215
- const { t } = useTranslation2(SPACE_PLUGIN);
216
- return /* @__PURE__ */ React2.createElement(SearchList.Root, {
217
- label: t("space input label"),
218
- classNames: "flex flex-col grow overflow-hidden"
219
- }, /* @__PURE__ */ React2.createElement(SearchList.Input, {
220
- autoFocus: true,
221
- "data-testid": "create-object-form.space-input",
222
- placeholder: t("space input placeholder"),
223
- classNames: "px-1 my-2"
224
- }), /* @__PURE__ */ React2.createElement(SearchList.Content, {
225
- classNames: "max-bs-[24rem] overflow-auto"
226
- }, spaces.sort((a, b) => {
227
- const aName = toLocalizedString(getSpaceDisplayName(a, {
228
- personal: a.id === defaultSpaceId
229
- }), t);
230
- const bName = toLocalizedString(getSpaceDisplayName(b, {
231
- personal: b.id === defaultSpaceId
232
- }), t);
233
- return aName.localeCompare(bName);
234
- }).map((space) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
235
- key: space.id,
236
- value: toLocalizedString(getSpaceDisplayName(space, {
237
- personal: space.id === defaultSpaceId
238
- }), t),
239
- onSelect: () => onChange(space),
240
- classNames: "flex items-center gap-2"
241
- }, /* @__PURE__ */ React2.createElement("span", {
242
- className: "grow truncate"
243
- }, toLocalizedString(getSpaceDisplayName(space, {
244
- personal: space.id === defaultSpaceId
245
- }), t))))));
246
- };
247
- var SelectSchema = ({ options, resolve, onChange }) => {
248
- const { t } = useTranslation2(SPACE_PLUGIN);
249
- return /* @__PURE__ */ React2.createElement(SearchList.Root, {
250
- label: t("schema input label"),
251
- classNames: "flex flex-col grow overflow-hidden"
252
- }, /* @__PURE__ */ React2.createElement(SearchList.Input, {
253
- autoFocus: true,
254
- "data-testid": "create-object-form.schema-input",
255
- placeholder: t("schema input placeholder"),
256
- classNames: "px-1 my-2"
257
- }), /* @__PURE__ */ React2.createElement(SearchList.Content, {
258
- classNames: "max-bs-[24rem] overflow-auto"
259
- }, options.map((option) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
260
- key: option.typename,
261
- value: t("typename label", {
262
- ns: option.typename,
263
- defaultValue: option.typename
264
- }),
265
- onSelect: () => onChange(option.typename),
266
- classNames: "flex items-center gap-2"
267
- }, /* @__PURE__ */ React2.createElement("span", {
268
- className: "flex gap-2 items-center grow truncate"
269
- }, /* @__PURE__ */ React2.createElement(Icon, {
270
- icon: resolve?.(option.typename).icon ?? "ph--placeholder--regular",
271
- size: 5
272
- }), t("typename label", {
273
- ns: option.typename,
274
- defaultValue: option.typename
275
- }))))));
276
- };
277
-
278
- // packages/plugins/plugin-space/src/capabilities/index.ts
279
- import { lazy } from "@dxos/app-framework";
280
- var AppGraphBuilder = lazy(() => import("./app-graph-builder-7X3SIPCD.mjs"));
281
- var AppGraphSerializer = lazy(() => import("./app-graph-serializer-VRU57AEZ.mjs"));
282
- var IdentityCreated = lazy(() => import("./identity-created-ANRJHNMQ.mjs"));
283
- var IntentResolver = lazy(() => import("./intent-resolver-KRINV5QI.mjs"));
284
- var ReactRoot = lazy(() => import("./react-root-J3SP2HVW.mjs"));
285
- var ReactSurface = lazy(() => import("./react-surface-J7T2IMH4.mjs"));
286
- var SchemaDefs = lazy(() => import("./schema-defs-OCBY7APN.mjs"));
287
- var SchemaTools = lazy(() => import("./schema-tools-MYC4LTQD.mjs"));
288
- var SpaceSettings = lazy(() => import("./settings-G24447B7.mjs"));
289
- var SpaceState = lazy(() => import("./state-SI4B5GHC.mjs"));
290
- var SpacesReady = lazy(() => import("./spaces-ready-5I3RKYTT.mjs"));
291
-
292
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx
293
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx";
294
- var CREATE_OBJECT_DIALOG = `${SPACE_PLUGIN}/CreateObjectDialog`;
295
- var CreateObjectDialog = ({ target, typename, name, shouldNavigate: _shouldNavigate }) => {
296
- const closeRef = useRef(null);
297
- const manager = usePluginManager();
298
- const { t } = useTranslation3(SPACE_PLUGIN);
299
- const client = useClient2();
300
- const spaces = useSpaces();
301
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
302
- const forms = useCapabilities(SpaceCapabilities.ObjectForm);
303
- const resolve = useCallback3((typename2) => manager.context.getCapabilities(Capabilities.Metadata).find(({ id }) => id === typename2)?.metadata ?? {}, [
304
- manager
305
- ]);
306
- const handleCreateObject = useCallback3(async ({ form, target: target2, data = {} }) => {
307
- if (!target2) {
308
- return;
309
- }
310
- closeRef.current?.click();
311
- const space = isSpace(target2) ? target2 : getSpace(target2);
312
- invariant2(space, "Missing space", {
313
- F: __dxlog_file2,
314
- L: 72,
315
- S: void 0,
316
- A: [
317
- "space",
318
- "'Missing space'"
319
- ]
320
- });
321
- const result = await dispatch(form.getIntent(data, {
322
- space
323
- }));
324
- const object = result.data?.object;
325
- if (isLiveObject(object)) {
326
- const addObjectIntent = createIntent2(SpaceAction.AddObject, {
327
- target: target2,
328
- object,
329
- hidden: form.hidden
330
- });
331
- const shouldNavigate = _shouldNavigate ?? (() => true);
332
- if (shouldNavigate(object)) {
333
- await dispatch(pipe(addObjectIntent, chain(LayoutAction2.Open, {
334
- part: "main"
335
- })));
336
- } else {
337
- await dispatch(addObjectIntent);
338
- }
339
- }
340
- }, [
341
- dispatch,
342
- resolve
343
- ]);
344
- return (
345
- // TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
346
- // Consider factoring it out to the tabs package.
347
- /* @__PURE__ */ React3.createElement(Dialog.Content, {
348
- classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
349
- }, /* @__PURE__ */ React3.createElement("div", {
350
- role: "none",
351
- className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
352
- }, /* @__PURE__ */ React3.createElement(Dialog.Title, null, t("create object dialog title")), /* @__PURE__ */ React3.createElement(Dialog.Close, {
353
- asChild: true
354
- }, /* @__PURE__ */ React3.createElement(Button2, {
355
- ref: closeRef,
356
- density: "fine",
357
- variant: "ghost",
358
- autoFocus: true
359
- }, /* @__PURE__ */ React3.createElement(Icon2, {
360
- icon: "ph--x--regular",
361
- size: 4
362
- })))), /* @__PURE__ */ React3.createElement(CreateObjectPanel, {
363
- classNames: "p-4",
364
- forms,
365
- spaces,
366
- target,
367
- typename,
368
- name,
369
- defaultSpaceId: client.spaces.default.id,
370
- resolve,
371
- onCreateObject: handleCreateObject
372
- }))
373
- );
374
- };
375
-
376
- // packages/plugins/plugin-space/src/components/CreateDialog/CreateSpaceDialog.tsx
377
- import { Effect } from "effect";
378
- import React4, { useCallback as useCallback4, useRef as useRef2 } from "react";
379
- import { createIntent as createIntent3, LayoutAction as LayoutAction3, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
380
- import { Button as Button3, Dialog as Dialog2, Icon as Icon3, useTranslation as useTranslation4 } from "@dxos/react-ui";
381
- import { Form as Form2 } from "@dxos/react-ui-form";
382
- var CREATE_SPACE_DIALOG = `${SPACE_PLUGIN}/CreateSpaceDialog`;
383
- var initialValues = {
384
- edgeReplication: true
385
- };
386
- var CreateSpaceDialog = () => {
387
- const closeRef = useRef2(null);
388
- const { t } = useTranslation4(SPACE_PLUGIN);
389
- const { dispatch } = useIntentDispatcher3();
390
- const inputSurfaceLookup = useInputSurfaceLookup();
391
- const handleCreateSpace = useCallback4(async (data) => {
392
- const program = Effect.gen(function* () {
393
- const { space } = yield* dispatch(createIntent3(SpaceAction.Create, data));
394
- yield* dispatch(createIntent3(LayoutAction3.SwitchWorkspace, {
395
- part: "workspace",
396
- subject: space.id
397
- }));
398
- yield* dispatch(createIntent3(SpaceAction.OpenCreateObject, {
399
- target: space
400
- }));
401
- });
402
- await Effect.runPromise(program);
403
- }, [
404
- dispatch
405
- ]);
406
- return (
407
- // TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
408
- // Consider factoring it out to the tabs package.
409
- /* @__PURE__ */ React4.createElement(Dialog2.Content, {
410
- classNames: "p-0 bs-content min-bs-[16rem] max-bs-full md:max-is-[32rem] overflow-hidden"
411
- }, /* @__PURE__ */ React4.createElement("div", {
412
- role: "none",
413
- className: "flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4"
414
- }, /* @__PURE__ */ React4.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React4.createElement(Dialog2.Close, {
415
- asChild: true
416
- }, /* @__PURE__ */ React4.createElement(Button3, {
417
- ref: closeRef,
418
- density: "fine",
419
- variant: "ghost",
420
- autoFocus: true
421
- }, /* @__PURE__ */ React4.createElement(Icon3, {
422
- icon: "ph--x--regular",
423
- size: 4
424
- })))), /* @__PURE__ */ React4.createElement("div", {
425
- className: "p-4"
426
- }, /* @__PURE__ */ React4.createElement(Form2, {
427
- testId: "create-space-form",
428
- classNames: "!p-0",
429
- autoFocus: true,
430
- values: initialValues,
431
- schema: SpaceForm,
432
- lookupComponent: inputSurfaceLookup,
433
- onSave: handleCreateSpace
434
- })))
435
- );
436
- };
437
-
438
- // packages/plugins/plugin-space/src/components/CollectionMain.tsx
439
- import React5 from "react";
440
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
441
- import { baseSurface, descriptionMessage, mx as mx3 } from "@dxos/react-ui-theme";
442
- var CollectionMain = ({ collection }) => {
443
- const { t } = useTranslation5(SPACE_PLUGIN);
444
- return /* @__PURE__ */ React5.createElement("div", {
445
- role: "none",
446
- className: mx3(baseSurface, "min-bs-screen is-full flex items-center justify-center p-8"),
447
- "data-testid": "composer.firstRunMessage"
448
- }, /* @__PURE__ */ React5.createElement("p", {
449
- role: "alert",
450
- className: mx3(descriptionMessage, "rounded-lg p-8 font-normal text-lg max-is-[24rem] break-words")
451
- }, collection.name ?? t("unnamed collection label")));
452
- };
453
-
454
- // packages/plugins/plugin-space/src/components/CollectionSection.tsx
455
- import React6 from "react";
456
- import { useTranslation as useTranslation6 } from "@dxos/react-ui";
457
- var CollectionSection = ({ collection }) => {
458
- const { t } = useTranslation6(SPACE_PLUGIN);
459
- return /* @__PURE__ */ React6.createElement("div", {
460
- className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
461
- }, /* @__PURE__ */ React6.createElement("span", {
462
- className: "truncate"
463
- }, collection.name ?? t("unnamed collection label")));
464
- };
465
-
466
- // packages/plugins/plugin-space/src/components/JoinDialog.tsx
467
- import React7, { useCallback as useCallback5 } from "react";
468
- import { createIntent as createIntent4, LayoutAction as LayoutAction4, useAppGraph, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
469
- import { Trigger } from "@dxos/async";
470
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
471
- import { useClient as useClient3 } from "@dxos/react-client";
472
- import { Dialog as Dialog3, useTranslation as useTranslation7 } from "@dxos/react-ui";
473
- import { JoinPanel } from "@dxos/shell/react";
474
- var JOIN_DIALOG = `${SPACE_PLUGIN}/JoinDialog`;
475
- var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
476
- const { dispatchPromise: dispatch } = useIntentDispatcher4();
477
- const client = useClient3();
478
- const { graph } = useAppGraph();
479
- const { t } = useTranslation7(SPACE_PLUGIN);
480
- const handleDone = useCallback5(async (result) => {
481
- const spaceKey = result?.spaceKey;
482
- if (!spaceKey) {
483
- return;
484
- }
485
- await Promise.all([
486
- dispatch(createIntent4(LayoutAction4.AddToast, {
487
- part: "toast",
488
- subject: {
489
- id: `${SPACE_PLUGIN}/join-success`,
490
- duration: 5e3,
491
- title: [
492
- "join success label",
493
- {
494
- ns: SPACE_PLUGIN
495
- }
496
- ],
497
- closeLabel: [
498
- "dismiss label",
499
- {
500
- ns: SPACE_PLUGIN
501
- }
502
- ]
503
- }
504
- })),
505
- dispatch(createIntent4(LayoutAction4.UpdateDialog, {
506
- part: "dialog",
507
- options: {
508
- state: false
509
- }
510
- }))
511
- ]);
512
- let space = client.spaces.get(spaceKey);
513
- if (!space) {
514
- const trigger = new Trigger();
515
- client.spaces.subscribe(() => {
516
- const space2 = client.spaces.get(spaceKey);
517
- if (space2) {
518
- trigger.wake(space2);
519
- }
520
- });
521
- space = await trigger.wait();
522
- }
523
- await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
524
- part: "workspace",
525
- subject: space.id
526
- }));
527
- const target = result?.target || (navigableCollections ? space?.id : void 0);
528
- if (target) {
529
- await graph.waitForPath({
530
- target
531
- }).catch(() => {
532
- });
533
- await Promise.all([
534
- dispatch(createIntent4(LayoutAction4.Open, {
535
- part: "main",
536
- subject: [
537
- target
538
- ]
539
- })),
540
- dispatch(createIntent4(LayoutAction4.Expose, {
541
- part: "navigation",
542
- subject: target
543
- }))
544
- ]);
545
- }
546
- await onDone?.(result);
547
- if (space) {
548
- await dispatch(createIntent4(ObservabilityAction.SendEvent, {
549
- name: "space.join",
550
- properties: {
551
- spaceId: space.id
552
- }
553
- }));
554
- }
555
- }, [
556
- dispatch,
557
- client,
558
- graph
559
- ]);
560
- return /* @__PURE__ */ React7.createElement(Dialog3.Content, null, /* @__PURE__ */ React7.createElement(Dialog3.Title, {
561
- classNames: "sr-only"
562
- }, t("join space label", {
563
- ns: "os"
564
- })), /* @__PURE__ */ React7.createElement(JoinPanel, {
565
- ...props,
566
- exitActionParent: /* @__PURE__ */ React7.createElement(Dialog3.Close, {
567
- asChild: true
568
- }),
569
- doneActionParent: /* @__PURE__ */ React7.createElement(Dialog3.Close, {
570
- asChild: true
571
- }),
572
- onDone: handleDone
573
- }));
574
- };
575
-
576
- // packages/plugins/plugin-space/src/components/MembersContainer.tsx
577
- import { Check, X } from "@phosphor-icons/react";
578
- import React8, { useCallback as useCallback6, useMemo, useState as useState3 } from "react";
579
- import { QR } from "react-qr-rounded";
580
- import { createIntent as createIntent5, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
581
- import { log } from "@dxos/log";
582
- import { useConfig } from "@dxos/react-client";
583
- import { fullyQualifiedId as fullyQualifiedId2, useSpaceInvitations } from "@dxos/react-client/echo";
584
- import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
585
- import { Button as Button4, Clipboard, Icon as Icon4, Input, useId, useTranslation as useTranslation8 } from "@dxos/react-ui";
586
- import { ControlPage, ControlSection, ControlFrame, ControlFrameItem, ControlItemInput } from "@dxos/react-ui-form";
587
- import { StackItem } from "@dxos/react-ui-stack";
588
- import { getSize as getSize2, mx as mx4 } from "@dxos/react-ui-theme";
589
- import { AuthCode, BifurcatedAction, Centered, Emoji, InvitationList, SpaceMemberList, Viewport } from "@dxos/shell/react";
590
- import { hexToEmoji } from "@dxos/util";
591
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/MembersContainer.tsx";
592
- var activeActionKey = "dxos:react-shell/space-manager/active-action";
593
- var handleInvitationEvent = (invitation, subscription) => {
594
- const invitationCode = InvitationEncoder.encode(invitation);
595
- if (invitation.state === Invitation.State.CONNECTING) {
596
- log.info(JSON.stringify({
597
- invitationCode,
598
- authCode: invitation.authCode
599
- }), void 0, {
600
- F: __dxlog_file3,
601
- L: 40,
602
- S: void 0,
603
- C: (f, a) => f(...a)
604
- });
605
- subscription.unsubscribe();
606
- }
607
- };
608
- var MembersContainer = ({ space, createInvitationUrl }) => {
609
- const { t } = useTranslation8(SPACE_PLUGIN);
610
- const config = useConfig();
611
- const { dispatchPromise: dispatch } = useIntentDispatcher5();
612
- const invitations = useSpaceInvitations(space.key);
613
- const visibleInvitations = invitations?.filter((invitation) => ![
614
- Invitation.State.CANCELLED
615
- ].includes(invitation.get().state));
616
- const [activeAction, setInternalActiveAction] = useState3(localStorage.getItem(activeActionKey) ?? "inviteMany");
617
- const setActiveAction = (nextAction) => {
618
- setInternalActiveAction(nextAction);
619
- localStorage.setItem(activeActionKey, nextAction);
620
- };
621
- const target = space.properties[CollectionType.typename]?.target?.objects[0]?.target;
622
- const locked = space.properties[COMPOSER_SPACE_LOCK];
623
- const handleChangeLocked = useCallback6(() => {
624
- space.properties[COMPOSER_SPACE_LOCK] = !locked;
625
- }, [
626
- locked,
627
- space
628
- ]);
629
- const inviteActions = useMemo(() => ({
630
- inviteOne: {
631
- label: t("invite one label", {
632
- ns: "os"
633
- }),
634
- description: t("invite one description", {
635
- ns: "os"
636
- }),
637
- icon: () => /* @__PURE__ */ React8.createElement(Icon4, {
638
- icon: "ph--user-plus--regular",
639
- size: 5
640
- }),
641
- testId: "membersContainer.inviteOne",
642
- onClick: async () => {
643
- const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
644
- space,
645
- type: Invitation.Type.INTERACTIVE,
646
- authMethod: Invitation.AuthMethod.SHARED_SECRET,
647
- multiUse: false,
648
- target: target && fullyQualifiedId2(target)
649
- }));
650
- if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
651
- const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
652
- }
653
- }
654
- },
655
- inviteMany: {
656
- label: t("invite many label", {
657
- ns: "os"
658
- }),
659
- description: t("invite many description", {
660
- ns: "os"
661
- }),
662
- icon: () => /* @__PURE__ */ React8.createElement(Icon4, {
663
- icon: "ph--users-three--regular",
664
- size: 5
665
- }),
666
- testId: "membersContainer.inviteMany",
667
- onClick: async () => {
668
- const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
669
- space,
670
- type: Invitation.Type.DELEGATED,
671
- authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
672
- multiUse: true,
673
- target: target && fullyQualifiedId2(target)
674
- }));
675
- if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
676
- const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
677
- }
678
- }
679
- }
680
- }), [
681
- t,
682
- space,
683
- target
684
- ]);
685
- const [selectedInvitation, setSelectedInvitation] = useState3(null);
686
- const handleSend = (event) => {
687
- setSelectedInvitation(event.invitation);
688
- };
689
- const handleBack = () => {
690
- setSelectedInvitation(null);
691
- };
692
- return /* @__PURE__ */ React8.createElement(Clipboard.Provider, null, /* @__PURE__ */ React8.createElement(StackItem.Content, {
693
- classNames: "block overflow-y-auto"
694
- }, /* @__PURE__ */ React8.createElement(ControlPage, null, /* @__PURE__ */ React8.createElement(ControlSection, {
695
- title: t("members verbose label"),
696
- description: t("members description")
697
- }, /* @__PURE__ */ React8.createElement(ControlFrame, null, /* @__PURE__ */ React8.createElement(ControlFrameItem, {
698
- title: t("members label")
699
- }, /* @__PURE__ */ React8.createElement(SpaceMemberList, {
700
- spaceKey: space.key,
701
- includeSelf: true
702
- })), locked && /* @__PURE__ */ React8.createElement(ControlFrameItem, {
703
- title: t("invitations label")
704
- }, /* @__PURE__ */ React8.createElement("p", {
705
- className: "text-description mbe-2"
706
- }, t("locked space description"))), !locked && /* @__PURE__ */ React8.createElement(ControlFrameItem, {
707
- title: t("invitations label")
708
- }, selectedInvitation && /* @__PURE__ */ React8.createElement(InvitationSection, {
709
- ...selectedInvitation,
710
- onBack: handleBack
711
- }), !selectedInvitation && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("p", {
712
- className: "text-description mbe-2"
713
- }, t("space invitation description")), /* @__PURE__ */ React8.createElement(InvitationList, {
714
- className: "mb-2",
715
- send: handleSend,
716
- invitations: visibleInvitations ?? [],
717
- onClickRemove: (invitation) => invitation.cancel(),
718
- createInvitationUrl
719
- }), /* @__PURE__ */ React8.createElement(BifurcatedAction, {
720
- actions: inviteActions,
721
- activeAction,
722
- onChangeActiveAction: setActiveAction,
723
- "data-testid": "membersContainer.createInvitation"
724
- })))), /* @__PURE__ */ React8.createElement("div", {
725
- className: "justify-center gap-4 p-0 mbs-4 container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
726
- }, /* @__PURE__ */ React8.createElement(ControlItemInput, {
727
- title: t("space locked label"),
728
- description: t("space locked description")
729
- }, /* @__PURE__ */ React8.createElement(Input.Switch, {
730
- checked: locked,
731
- onCheckedChange: handleChangeLocked,
732
- classNames: "justify-self-end"
733
- })))))));
734
- };
735
- var InvitationSection = ({ state = Invitation.State.INIT, authCode, invitationId = "never", url = "never", onBack }) => {
736
- const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
737
- return /* @__PURE__ */ React8.createElement(Viewport.Root, {
738
- activeView
739
- }, /* @__PURE__ */ React8.createElement(Viewport.Views, null, /* @__PURE__ */ React8.createElement(Viewport.View, {
740
- id: "init"
741
- }), /* @__PURE__ */ React8.createElement(Viewport.View, {
742
- id: "complete"
743
- }, /* @__PURE__ */ React8.createElement(InvitationComplete, {
744
- statusValue: state
745
- })), /* @__PURE__ */ React8.createElement(Viewport.View, {
746
- id: "auth-code"
747
- }, /* @__PURE__ */ React8.createElement(InvitationAuthCode, {
748
- id: invitationId,
749
- code: authCode ?? "never",
750
- onCancel: onBack
751
- })), /* @__PURE__ */ React8.createElement(Viewport.View, {
752
- id: "qr-code"
753
- }, /* @__PURE__ */ React8.createElement(InvitationQR, {
754
- id: invitationId,
755
- url,
756
- onCancel: onBack
757
- }))));
758
- };
759
- var InvitationQR = ({ id, url, onCancel }) => {
760
- const { t } = useTranslation8("os");
761
- const qrLabel = useId("members-container__qr-code");
762
- const emoji = hexToEmoji(id);
763
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("p", {
764
- className: "text-description"
765
- }, t("qr code description", {
766
- ns: SPACE_PLUGIN
767
- })), /* @__PURE__ */ React8.createElement("div", {
768
- role: "group",
769
- className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
770
- }, /* @__PURE__ */ React8.createElement("div", {
771
- role: "none",
772
- className: "is-full aspect-square relative text-description"
773
- }, /* @__PURE__ */ React8.createElement(QR, {
774
- rounding: 100,
775
- backgroundColor: "transparent",
776
- color: "currentColor",
777
- "aria-labelledby": qrLabel,
778
- errorCorrectionLevel: "Q",
779
- cutout: true
780
- }, url ?? "never"), /* @__PURE__ */ React8.createElement(Centered, null, /* @__PURE__ */ React8.createElement(Emoji, {
781
- text: emoji
782
- }))), /* @__PURE__ */ React8.createElement("span", {
783
- id: qrLabel,
784
- className: "sr-only"
785
- }, t("qr label")), /* @__PURE__ */ React8.createElement(Clipboard.Button, {
786
- value: url ?? "never"
787
- })), /* @__PURE__ */ React8.createElement(Button4, {
788
- variant: "ghost",
789
- onClick: onCancel
790
- }, t("cancel label")));
791
- };
792
- var InvitationAuthCode = ({ id, code, onCancel }) => {
793
- const { t } = useTranslation8("os");
794
- const emoji = hexToEmoji(id);
795
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("p", {
796
- className: "text-description"
797
- }, t("auth other device emoji message")), emoji && /* @__PURE__ */ React8.createElement(Emoji, {
798
- text: emoji,
799
- className: "mli-auto mlb-2 text-center"
800
- }), /* @__PURE__ */ React8.createElement("p", {
801
- className: "text-description"
802
- }, t("auth code message")), /* @__PURE__ */ React8.createElement(AuthCode, {
803
- code,
804
- large: true,
805
- classNames: "mli-auto mlb-2 text-center grow"
806
- }), /* @__PURE__ */ React8.createElement(Button4, {
807
- variant: "ghost",
808
- onClick: onCancel
809
- }, t("cancel label")));
810
- };
811
- var InvitationComplete = ({ statusValue }) => {
812
- return statusValue > 0 ? /* @__PURE__ */ React8.createElement(Check, {
813
- className: mx4("m-1.5", getSize2(6))
814
- }) : /* @__PURE__ */ React8.createElement(X, {
815
- className: mx4("m-1.5", getSize2(6))
816
- });
817
- };
818
-
819
- // packages/plugins/plugin-space/src/components/MenuFooter.tsx
820
- import { Planet } from "@phosphor-icons/react";
821
- import React9 from "react";
822
- import { getSpace as getSpace2 } from "@dxos/client/echo";
823
- import { useClient as useClient4 } from "@dxos/react-client";
824
- import { DropdownMenu, toLocalizedString as toLocalizedString2, useTranslation as useTranslation9 } from "@dxos/react-ui";
825
- var MenuFooter = ({ object }) => {
826
- const { t } = useTranslation9(SPACE_PLUGIN);
827
- const client = useClient4();
828
- const space = getSpace2(object);
829
- const spaceName = space ? getSpaceDisplayName(space, {
830
- personal: client.spaces.default === space
831
- }) : "";
832
- return space ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React9.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React9.createElement("dl", {
833
- className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
834
- }, /* @__PURE__ */ React9.createElement("dt", {
835
- className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
836
- }, t("location label")), /* @__PURE__ */ React9.createElement("dd", {
837
- className: "line-clamp-3"
838
- }, /* @__PURE__ */ React9.createElement(Planet, {
839
- className: "inline-block mie-1"
840
- }), toLocalizedString2(spaceName, t)))) : null;
841
- };
842
-
843
- // packages/plugins/plugin-space/src/components/ObjectSettings/ObjectSettingsContainer.tsx
844
- import React11, { useMemo as useMemo2 } from "react";
845
- import { Surface } from "@dxos/app-framework";
846
- import { Clipboard as Clipboard2 } from "@dxos/react-ui";
847
- import { StackItem as StackItem2 } from "@dxos/react-ui-stack";
848
-
849
- // packages/plugins/plugin-space/src/components/ObjectSettings/BaseObjectSettings.tsx
850
- import React10, { useRef as useRef3 } from "react";
851
- import { Input as Input2, useTranslation as useTranslation10 } from "@dxos/react-ui";
852
- import { mx as mx5 } from "@dxos/react-ui-theme";
853
- var BaseObjectSettings = ({ classNames, children, object }) => {
854
- const { t } = useTranslation10(meta.id);
855
- const inputRef = useRef3(null);
856
- return /* @__PURE__ */ React10.createElement("form", {
857
- className: mx5("flex flex-col p-2 gap-2", classNames)
858
- }, /* @__PURE__ */ React10.createElement(Input2.Root, null, /* @__PURE__ */ React10.createElement(Input2.Label, null, t("name label")), /* @__PURE__ */ React10.createElement(Input2.TextInput, {
859
- ref: inputRef,
860
- placeholder: t("name placeholder"),
861
- value: object.name ?? "",
862
- onChange: (event) => {
863
- object.name = event.target.value;
864
- },
865
- onKeyDown: (event) => {
866
- if (event.key === "Enter") {
867
- inputRef.current?.blur();
868
- }
869
- }
870
- })), children);
871
- };
872
-
873
- // packages/plugins/plugin-space/src/components/ObjectSettings/ObjectSettingsContainer.tsx
874
- var ObjectSettingsContainer = ({ object, role }) => {
875
- const data = useMemo2(() => ({
876
- subject: object
877
- }), [
878
- object
879
- ]);
880
- return /* @__PURE__ */ React11.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React11.createElement(StackItem2.Content, {
881
- toolbar: false,
882
- role
883
- }, /* @__PURE__ */ React11.createElement("div", {
884
- className: "flex flex-col overflow-y-auto divide-y divide-separator"
885
- }, /* @__PURE__ */ React11.createElement(BaseObjectSettings, {
886
- object
887
- }, /* @__PURE__ */ React11.createElement(Surface, {
888
- role: "base-object-settings",
889
- data
890
- })), /* @__PURE__ */ React11.createElement(Surface, {
891
- role: "object-settings",
892
- data
893
- }))));
894
- };
895
-
896
- // packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
897
- import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
898
- import React12, { useEffect as useEffect2, useState as useState4 } from "react";
899
- import { debounce } from "@dxos/async";
900
- import { Tooltip, useTranslation as useTranslation11 } from "@dxos/react-ui";
901
- import { getSize as getSize3, mx as mx6, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
902
- var Status;
903
- (function(Status2) {
904
- Status2[Status2["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
905
- Status2[Status2["PENDING"] = 1] = "PENDING";
906
- Status2[Status2["ERROR"] = 2] = "ERROR";
907
- })(Status || (Status = {}));
908
- var PersistenceStatus = ({ db }) => {
909
- const { t } = useTranslation11(SPACE_PLUGIN);
910
- const [displayMessage, setDisplayMessage] = useState4(false);
911
- const [status, naturalSetStatus] = useState4(0);
912
- const [prevStatus, setPrevStatus] = useState4(0);
913
- const _setStatus = debounce(naturalSetStatus, 500);
914
- useEffect2(() => {
915
- setPrevStatus(status);
916
- if (prevStatus !== status && status === 0) {
917
- setDisplayMessage(true);
918
- const timeout = setTimeout(() => setDisplayMessage(false), 5e3);
919
- return () => clearTimeout(timeout);
920
- }
921
- }, [
922
- status
923
- ]);
924
- switch (status) {
925
- case 2:
926
- return /* @__PURE__ */ React12.createElement("div", {
927
- className: "flex items-center"
928
- }, /* @__PURE__ */ React12.createElement(Warning, {
929
- className: mx6(getSize3(4), "me-1")
930
- }), /* @__PURE__ */ React12.createElement("span", {
931
- className: mx6("text-sm", warningText)
932
- }, t("persistence error label")));
933
- case 1:
934
- return /* @__PURE__ */ React12.createElement("div", {
935
- className: "flex items-center"
936
- }, /* @__PURE__ */ React12.createElement(ArrowsCounterClockwise, {
937
- className: mx6(getSize3(4), "me-1")
938
- }), /* @__PURE__ */ React12.createElement("span", {
939
- className: mx6("text-sm", staticPlaceholderText)
940
- }, t("persistence pending label")));
941
- case 0:
942
- default:
943
- return /* @__PURE__ */ React12.createElement(Tooltip.Trigger, {
944
- delayDuration: 400,
945
- role: "status",
946
- content: t("persisted locally message"),
947
- className: "flex items-center"
948
- }, /* @__PURE__ */ React12.createElement(CheckCircle2, {
949
- className: mx6(getSize3(4), "me-1")
950
- }), displayMessage && /* @__PURE__ */ React12.createElement("span", {
951
- className: mx6("text-sm", staticPlaceholderText)
952
- }, t("persisted locally label")));
953
- }
954
- };
955
-
956
- // packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
957
- import React13, { useCallback as useCallback7, useRef as useRef4, useState as useState5 } from "react";
958
- import { createIntent as createIntent6, LayoutAction as LayoutAction5, useIntentDispatcher as useIntentDispatcher6 } from "@dxos/app-framework";
959
- import { log as log2 } from "@dxos/log";
960
- import { Button as Button5, Input as Input3, useTranslation as useTranslation12 } from "@dxos/react-ui";
961
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
962
- var POPOVER_RENAME_OBJECT = `${SPACE_PLUGIN}/PopoverRenameObject`;
963
- var PopoverRenameObject = ({ object: obj }) => {
964
- const { t } = useTranslation12(SPACE_PLUGIN);
965
- const doneButton = useRef4(null);
966
- const object = obj;
967
- const [name, setName] = useState5(object.name || object.title || "");
968
- const { dispatchPromise: dispatch } = useIntentDispatcher6();
969
- const handleDone = useCallback7(() => {
970
- try {
971
- object.name = name;
972
- } catch {
973
- try {
974
- object.title = name;
975
- } catch (err) {
976
- log2.error("Failed to rename object", {
977
- err
978
- }, {
979
- F: __dxlog_file4,
980
- L: 32,
981
- S: void 0,
982
- C: (f, a) => f(...a)
983
- });
984
- }
985
- }
986
- void dispatch(createIntent6(LayoutAction5.UpdatePopover, {
987
- part: "popover",
988
- options: {
989
- variant: "react",
990
- anchorId: "",
991
- state: false
992
- }
993
- }));
994
- }, [
995
- object,
996
- name
997
- ]);
998
- return /* @__PURE__ */ React13.createElement("div", {
999
- role: "none",
1000
- className: "p-1 flex gap-2"
1001
- }, /* @__PURE__ */ React13.createElement("div", {
1002
- role: "none",
1003
- className: "flex-1"
1004
- }, /* @__PURE__ */ React13.createElement(Input3.Root, null, /* @__PURE__ */ React13.createElement(Input3.Label, {
1005
- srOnly: true
1006
- }, t("object name label")), /* @__PURE__ */ React13.createElement(Input3.TextInput, {
1007
- placeholder: t("object placeholder"),
1008
- value: name,
1009
- "data-testid": "spacePlugin.renameObject.input",
1010
- onChange: ({ target: { value } }) => setName(value),
1011
- onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
1012
- }))), /* @__PURE__ */ React13.createElement(Button5, {
1013
- ref: doneButton,
1014
- classNames: "self-stretch",
1015
- onClick: handleDone
1016
- }, t("done label", {
1017
- ns: "os"
1018
- })));
1019
- };
1020
-
1021
- // packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
1022
- import React14, { useCallback as useCallback8, useRef as useRef5, useState as useState6 } from "react";
1023
- import { createIntent as createIntent7, LayoutAction as LayoutAction6, useIntentDispatcher as useIntentDispatcher7 } from "@dxos/app-framework";
1024
- import { Button as Button6, Input as Input4, Popover, useTranslation as useTranslation13 } from "@dxos/react-ui";
1025
- var POPOVER_RENAME_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
1026
- var PopoverRenameSpace = ({ space }) => {
1027
- const { t } = useTranslation13(SPACE_PLUGIN);
1028
- const doneButton = useRef5(null);
1029
- const [name, setName] = useState6(space.properties.name ?? "");
1030
- const { dispatchPromise: dispatch } = useIntentDispatcher7();
1031
- const handleDone = useCallback8(() => {
1032
- space.properties.name = name;
1033
- void dispatch(createIntent7(LayoutAction6.UpdatePopover, {
1034
- part: "popover",
1035
- options: {
1036
- variant: "react",
1037
- anchorId: "",
1038
- state: false
1039
- }
1040
- }));
1041
- }, [
1042
- space,
1043
- name
1044
- ]);
1045
- return /* @__PURE__ */ React14.createElement("div", {
1046
- role: "none",
1047
- className: "p-1 flex gap-2"
1048
- }, /* @__PURE__ */ React14.createElement("div", {
1049
- role: "none",
1050
- className: "flex-1"
1051
- }, /* @__PURE__ */ React14.createElement(Input4.Root, null, /* @__PURE__ */ React14.createElement(Input4.Label, {
1052
- srOnly: true
1053
- }, t("space name label")), /* @__PURE__ */ React14.createElement(Input4.TextInput, {
1054
- defaultValue: space.properties.name ?? "",
1055
- placeholder: t("unnamed space label"),
1056
- onChange: ({ target: { value } }) => setName(value),
1057
- // TODO(wittjosiah): Ideally this should access the popover context to close the popover.
1058
- // Currently this is not possible because Radix does not expose the popover context.
1059
- onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
1060
- }))), /* @__PURE__ */ React14.createElement(Popover.Close, {
1061
- asChild: true
1062
- }, /* @__PURE__ */ React14.createElement(Button6, {
1063
- ref: doneButton,
1064
- classNames: "self-stretch",
1065
- onClick: handleDone
1066
- }, t("done label", {
1067
- ns: "os"
1068
- }))));
1069
- };
1070
-
1071
- // packages/plugins/plugin-space/src/components/SchemaContainer.tsx
1072
- import React15, { useState as useState7, useEffect as useEffect3 } from "react";
1073
- import { useTranslation as useTranslation14 } from "@dxos/react-ui";
1074
- import { controlItemClasses, ControlPage as ControlPage2, ControlSection as ControlSection2 } from "@dxos/react-ui-form";
1075
- import { StackItem as StackItem3 } from "@dxos/react-ui-stack";
1076
- var useQuerySpaceSchemas = (space) => {
1077
- const [schemas, setSchemas] = useState7([]);
1078
- useEffect3(() => {
1079
- const query = space.db.schemaRegistry.query();
1080
- const initialResults = query.runSync();
1081
- setSchemas(initialResults);
1082
- const unsubscribe = query.subscribe(() => setSchemas(query.results));
1083
- return () => unsubscribe();
1084
- }, [
1085
- space
1086
- ]);
1087
- return schemas;
1088
- };
1089
- var SchemaContainer = ({ space }) => {
1090
- const { t } = useTranslation14(SPACE_PLUGIN);
1091
- const schemas = useQuerySpaceSchemas(space);
1092
- return /* @__PURE__ */ React15.createElement(StackItem3.Content, {
1093
- classNames: "block overflow-y-auto"
1094
- }, /* @__PURE__ */ React15.createElement(ControlPage2, null, /* @__PURE__ */ React15.createElement(ControlSection2, {
1095
- title: t("schema verbose label"),
1096
- description: t("schema description")
1097
- }, /* @__PURE__ */ React15.createElement("div", {
1098
- role: "none",
1099
- className: controlItemClasses
1100
- }, schemas.length === 0 && /* @__PURE__ */ React15.createElement("div", {
1101
- className: "text-center plb-4"
1102
- }, t("no schemas found message")), schemas.map((schema) => /* @__PURE__ */ React15.createElement("div", {
1103
- key: schema.id
1104
- }, /* @__PURE__ */ React15.createElement("div", null, schema.typename)))))));
1105
- };
1106
-
1107
- // packages/plugins/plugin-space/src/components/SpacePresence.tsx
1108
- import { Option } from "effect";
1109
- import React16, { forwardRef, useCallback as useCallback9, useEffect as useEffect4, useState as useState8 } from "react";
1110
- import { useAppGraph as useAppGraph2, useCapability } from "@dxos/app-framework";
1111
- import { generateName } from "@dxos/display-name";
1112
- import { PublicKey, useClient as useClient5 } from "@dxos/react-client";
1113
- import { getSpace as getSpace3, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1114
- import { useIdentity } from "@dxos/react-client/halo";
1115
- import { Avatar, Tooltip as Tooltip2, Popover as Popover2, useTranslation as useTranslation15, List, ListItem, useDefaultValue } from "@dxos/react-ui";
1116
- import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
1117
- import { ComplexMap, keyToFallback } from "@dxos/util";
1118
- var REFRESH_INTERVAL = 5e3;
1119
- var ACTIVITY_DURATION = 3e4;
1120
- var noViewers = new ComplexMap(PublicKey.hash);
1121
- var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
1122
- var SpacePresence = ({ object, spaceKey }) => {
1123
- const spaceState = useCapability(SpaceCapabilities.MutableState);
1124
- const client = useClient5();
1125
- const identity = useIdentity();
1126
- const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
1127
- const spaceMembers = useMembers(space?.key);
1128
- const [_moment, setMoment] = useState8(Date.now());
1129
- useEffect4(() => {
1130
- const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
1131
- return () => clearInterval(interval);
1132
- }, []);
1133
- const memberOnline = useCallback9((member) => member.presence === 1, []);
1134
- const memberIsNotSelf = useCallback9((member) => !identity?.identityKey.equals(member.identity.identityKey), [
1135
- identity?.identityKey
1136
- ]);
1137
- if (!identity || !spaceState || !space) {
1138
- return null;
1139
- }
1140
- const currentObjectViewers = spaceState.viewersByObject[fullyQualifiedId3(object)] ?? noViewers;
1141
- const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
1142
- const objectView = currentObjectViewers.get(member.identity.identityKey);
1143
- const lastSeen = objectView?.lastSeen ?? -Infinity;
1144
- const currentlyAttended = objectView?.currentlyAttended ?? false;
1145
- return {
1146
- ...member,
1147
- currentlyAttended,
1148
- lastSeen
1149
- };
1150
- }).toSorted((a, b) => a.lastSeen - b.lastSeen);
1151
- return /* @__PURE__ */ React16.createElement(FullPresence, {
1152
- members: membersForObject
1153
- });
1154
- };
1155
- var FullPresence = (props) => {
1156
- const { size = 9, onMemberClick } = props;
1157
- const members = useDefaultValue(props.members, () => []);
1158
- if (members.length === 0) {
1159
- return null;
1160
- }
1161
- return /* @__PURE__ */ React16.createElement("div", {
1162
- className: "dx-avatar-group",
1163
- "data-testid": "spacePlugin.presence"
1164
- }, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React16.createElement(Tooltip2.Trigger, {
1165
- key: member.identity.identityKey.toHex(),
1166
- side: "bottom",
1167
- content: getName(member.identity),
1168
- className: "grid focus:outline-none"
1169
- }, /* @__PURE__ */ React16.createElement(PresenceAvatar, {
1170
- identity: member.identity,
1171
- match: member.currentlyAttended,
1172
- index: members.length - i,
1173
- onClick: () => onMemberClick?.(member),
1174
- size
1175
- }))), members.length > 3 && /* @__PURE__ */ React16.createElement(Popover2.Root, null, /* @__PURE__ */ React16.createElement(Popover2.Trigger, {
1176
- className: "grid focus:outline-none"
1177
- }, /* @__PURE__ */ React16.createElement(Avatar.Root, null, /* @__PURE__ */ React16.createElement(Avatar.Content, {
1178
- status: "inactive",
1179
- style: {
1180
- zIndex: members.length - 4
1181
- },
1182
- fallback: `+${members.length - 3}`,
1183
- size
1184
- }))), /* @__PURE__ */ React16.createElement(Popover2.Portal, null, /* @__PURE__ */ React16.createElement(Popover2.Content, {
1185
- side: "bottom"
1186
- }, /* @__PURE__ */ React16.createElement(Popover2.Arrow, null), /* @__PURE__ */ React16.createElement(List, {
1187
- classNames: "max-h-56 overflow-y-auto"
1188
- }, members.map((member) => /* @__PURE__ */ React16.createElement(ListItem.Root, {
1189
- key: member.identity.identityKey.toHex(),
1190
- classNames: "flex gap-2 items-center cursor-pointer mbe-2",
1191
- onClick: () => onMemberClick?.(member),
1192
- "data-testid": "identity-list-item"
1193
- }, /* @__PURE__ */ React16.createElement(PresenceAvatar, {
1194
- identity: member.identity,
1195
- size,
1196
- showName: true,
1197
- match: member.currentlyAttended
1198
- }))))))));
1199
- };
1200
- var PresenceAvatar = /* @__PURE__ */ forwardRef(({ identity, showName, match, index, onClick, size }, forwardedRef) => {
1201
- const status = match ? "current" : "active";
1202
- const fallbackValue = keyToFallback(identity.identityKey);
1203
- return /* @__PURE__ */ React16.createElement(Avatar.Root, null, /* @__PURE__ */ React16.createElement(Avatar.Content, {
1204
- status,
1205
- hue: identity.profile?.data?.hue || fallbackValue.hue,
1206
- "data-testid": "spacePlugin.presence.member",
1207
- "data-status": status,
1208
- size,
1209
- ...index ? {
1210
- style: {
1211
- zIndex: index
1212
- }
1213
- } : {},
1214
- onClick,
1215
- fallback: identity.profile?.data?.emoji || fallbackValue.emoji,
1216
- ref: forwardedRef
1217
- }), /* @__PURE__ */ React16.createElement(Avatar.Label, {
1218
- classNames: showName ? "text-sm truncate pli-2" : "sr-only"
1219
- }, getName(identity)));
1220
- });
1221
- var SmallPresenceLive = ({ id, open, viewers }) => {
1222
- const { hasAttention, isAncestor, isRelated } = useAttention(id);
1223
- const isAttended = hasAttention || isAncestor || isRelated;
1224
- const { graph } = useAppGraph2();
1225
- const attended = useAttended();
1226
- const startOfAttention = attended.at(-1);
1227
- const path = usePath(graph, startOfAttention);
1228
- const containsAttended = !open && !isAttended && id && Option.isSome(path) ? path.value.includes(id) : false;
1229
- const getActiveViewers = (viewers2) => {
1230
- const moment = Date.now();
1231
- return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
1232
- };
1233
- const [activeViewers, setActiveViewers] = useState8(viewers ? getActiveViewers(viewers) : []);
1234
- useEffect4(() => {
1235
- if (viewers) {
1236
- setActiveViewers(getActiveViewers(viewers));
1237
- const interval = setInterval(() => {
1238
- setActiveViewers(getActiveViewers(viewers));
1239
- }, REFRESH_INTERVAL);
1240
- return () => clearInterval(interval);
1241
- }
1242
- }, [
1243
- viewers
1244
- ]);
1245
- return /* @__PURE__ */ React16.createElement(SmallPresence, {
1246
- count: activeViewers.length,
1247
- attended: isAttended,
1248
- containsAttended
1249
- });
1250
- };
1251
- var SmallPresence = ({ count = 0, attended, containsAttended }) => {
1252
- const { t } = useTranslation15(SPACE_PLUGIN);
1253
- return /* @__PURE__ */ React16.createElement(Tooltip2.Trigger, {
1254
- asChild: true,
1255
- content: t("presence label", {
1256
- count
1257
- }),
1258
- side: "bottom"
1259
- }, /* @__PURE__ */ React16.createElement(AttentionGlyph, {
1260
- attended,
1261
- containsAttended,
1262
- presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1263
- classNames: "self-center mie-1"
1264
- }));
1265
- };
1266
-
1267
- // packages/plugins/plugin-space/src/components/SpacePluginSettings.tsx
1268
- import React17 from "react";
1269
- import { createIntent as createIntent8, useIntentDispatcher as useIntentDispatcher8 } from "@dxos/app-framework";
1270
- import { useClient as useClient6 } from "@dxos/react-client";
1271
- import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
1272
- import { Input as Input5, toLocalizedString as toLocalizedString3, useTranslation as useTranslation16, List as List2, ListItem as ListItem2, Button as Button7 } from "@dxos/react-ui";
1273
- import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
1274
- var SpacePluginSettings = ({ settings }) => {
1275
- const { t } = useTranslation16(SPACE_PLUGIN);
1276
- const { dispatchPromise: dispatch } = useIntentDispatcher8();
1277
- const client = useClient6();
1278
- const spaces = useSpaces2({
1279
- all: settings.showHidden
1280
- });
1281
- return /* @__PURE__ */ React17.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React17.createElement(DeprecatedFormInput, {
1282
- label: t("show hidden spaces label")
1283
- }, /* @__PURE__ */ React17.createElement(Input5.Switch, {
1284
- checked: settings.showHidden,
1285
- onCheckedChange: (checked) => settings.showHidden = !!checked
1286
- })), /* @__PURE__ */ React17.createElement("div", {
1287
- role: "none"
1288
- }, /* @__PURE__ */ React17.createElement("h2", {
1289
- className: "text-xl my-4"
1290
- }, "Space Settings"), /* @__PURE__ */ React17.createElement(List2, {
1291
- classNames: "max-w-md mx-auto"
1292
- }, spaces.map((space) => /* @__PURE__ */ React17.createElement(ListItem2.Root, {
1293
- key: space.id
1294
- }, /* @__PURE__ */ React17.createElement(ListItem2.Heading, {
1295
- classNames: "flex flex-col grow truncate mbe-2"
1296
- }, toLocalizedString3(getSpaceDisplayName(space, {
1297
- personal: space === client.spaces.default
1298
- }), t)), /* @__PURE__ */ React17.createElement(ListItem2.Endcap, null, /* @__PURE__ */ React17.createElement(Button7, {
1299
- onClick: () => dispatch(createIntent8(SpaceAction.OpenSettings, {
1300
- space
1301
- }))
1302
- }, t("open space settings label"))))))));
1303
- };
1304
-
1305
- // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx
1306
- import { pipe as pipe2, Schema } from "effect";
1307
- import React18, { useCallback as useCallback10, useMemo as useMemo3, useState as useState9 } from "react";
1308
- import { chain as chain2, createIntent as createIntent9, LayoutAction as LayoutAction7, useIntentDispatcher as useIntentDispatcher9 } from "@dxos/app-framework";
1309
- import { log as log3 } from "@dxos/log";
1310
- import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
1311
- import { useClient as useClient7 } from "@dxos/react-client";
1312
- import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
1313
- import { Button as Button8, Input as Input6, useMulticastObservable, useTranslation as useTranslation17 } from "@dxos/react-ui";
1314
- import { Form as Form3, ControlItem, ControlItemInput as ControlItemInput2, ControlSection as ControlSection3, ControlPage as ControlPage3 } from "@dxos/react-ui-form";
1315
- import { HuePicker, IconPicker } from "@dxos/react-ui-pickers";
1316
- import { StackItem as StackItem4 } from "@dxos/react-ui-stack";
1317
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx";
1318
- var FormSchema = SpaceForm.pipe(Schema.extend(Schema.Struct({
1319
- archived: Schema.Boolean.annotations({
1320
- title: "Archive space"
1321
- })
1322
- })));
1323
- var SpaceSettingsContainer = ({ space }) => {
1324
- const { t } = useTranslation17(SPACE_PLUGIN);
1325
- const { dispatchPromise: dispatch } = useIntentDispatcher9();
1326
- const client = useClient7();
1327
- const archived = useMulticastObservable(space.state) === SpaceState2.SPACE_INACTIVE;
1328
- const [edgeReplication, setEdgeReplication] = useState9(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1329
- const toggleEdgeReplication = useCallback10(async (next) => {
1330
- setEdgeReplication(next);
1331
- await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
1332
- log3.catch(err, void 0, {
1333
- F: __dxlog_file5,
1334
- L: 51,
1335
- S: void 0,
1336
- C: (f, a) => f(...a)
1337
- });
1338
- setEdgeReplication(!next);
1339
- });
1340
- }, [
1341
- space
1342
- ]);
1343
- const handleSave = useCallback10((properties) => {
1344
- void toggleEdgeReplication(properties.edgeReplication);
1345
- if (properties.name !== space.properties.name) {
1346
- space.properties.name = properties.name;
1347
- }
1348
- if (properties.icon !== space.properties.icon) {
1349
- space.properties.icon = properties.icon;
1350
- }
1351
- if (properties.hue !== space.properties.hue) {
1352
- space.properties.hue = properties.hue;
1353
- }
1354
- if (properties.archived && !archived) {
1355
- void dispatch(pipe2(createIntent9(SpaceAction.Close, {
1356
- space
1357
- }), chain2(LayoutAction7.SwitchWorkspace, {
1358
- part: "workspace",
1359
- subject: client.spaces.default.id
1360
- })));
1361
- } else if (!properties.archived && archived) {
1362
- void dispatch(createIntent9(SpaceAction.Open, {
1363
- space
1364
- }));
1365
- }
1366
- }, [
1367
- space,
1368
- toggleEdgeReplication,
1369
- archived
1370
- ]);
1371
- const values = useMemo3(() => ({
1372
- name: space.properties.name,
1373
- icon: space.properties.icon,
1374
- hue: space.properties.hue,
1375
- edgeReplication,
1376
- archived
1377
- }), [
1378
- space.properties.name,
1379
- space.properties.icon,
1380
- space.properties.hue,
1381
- edgeReplication,
1382
- archived
1383
- ]);
1384
- const customElements = useMemo3(() => ({
1385
- name: ({ type, label, getValue, onValueChange }) => {
1386
- const handleChange = useCallback10(({ target: { value } }) => onValueChange(type, value), [
1387
- onValueChange,
1388
- type
1389
- ]);
1390
- return /* @__PURE__ */ React18.createElement(ControlItemInput2, {
1391
- title: label,
1392
- description: t("display name description")
1393
- }, /* @__PURE__ */ React18.createElement(Input6.TextInput, {
1394
- value: getValue(),
1395
- onChange: handleChange,
1396
- placeholder: t("display name input placeholder"),
1397
- classNames: "min-is-64"
1398
- }));
1399
- },
1400
- icon: ({ type, label, getValue, onValueChange }) => {
1401
- const handleChange = useCallback10((nextEmoji) => onValueChange(type, nextEmoji), [
1402
- onValueChange,
1403
- type
1404
- ]);
1405
- const handleEmojiReset = useCallback10(() => onValueChange(type, void 0), [
1406
- onValueChange,
1407
- type
1408
- ]);
1409
- return /* @__PURE__ */ React18.createElement(ControlItem, {
1410
- title: label,
1411
- description: t("icon description")
1412
- }, /* @__PURE__ */ React18.createElement(IconPicker, {
1413
- value: getValue(),
1414
- onChange: handleChange,
1415
- onReset: handleEmojiReset,
1416
- classNames: "justify-self-end",
1417
- iconSize: 5
1418
- }));
1419
- },
1420
- hue: ({ type, label, getValue, onValueChange }) => {
1421
- const handleChange = useCallback10((nextHue) => onValueChange(type, nextHue), [
1422
- onValueChange,
1423
- type
1424
- ]);
1425
- const handleHueReset = useCallback10(() => onValueChange(type, void 0), [
1426
- onValueChange,
1427
- type
1428
- ]);
1429
- return /* @__PURE__ */ React18.createElement(ControlItem, {
1430
- title: label,
1431
- description: t("hue description")
1432
- }, /* @__PURE__ */ React18.createElement(HuePicker, {
1433
- value: getValue(),
1434
- onChange: handleChange,
1435
- onReset: handleHueReset,
1436
- classNames: "[--hue-preview-size:1.25rem] justify-self-end"
1437
- }));
1438
- },
1439
- edgeReplication: ({ type, label, getValue, onValueChange }) => {
1440
- const handleChange = useCallback10((checked) => onValueChange(type, checked), [
1441
- onValueChange,
1442
- type
1443
- ]);
1444
- return /* @__PURE__ */ React18.createElement(ControlItemInput2, {
1445
- title: label,
1446
- description: t("edge replication description")
1447
- }, /* @__PURE__ */ React18.createElement(Input6.Switch, {
1448
- checked: getValue(),
1449
- onCheckedChange: handleChange,
1450
- classNames: "justify-self-end"
1451
- }));
1452
- },
1453
- archived: ({ type, label, getValue, onValueChange }) => {
1454
- const handleChange = useCallback10(() => onValueChange(type, !getValue()), [
1455
- onValueChange,
1456
- type,
1457
- getValue
1458
- ]);
1459
- return /* @__PURE__ */ React18.createElement(ControlItemInput2, {
1460
- title: label,
1461
- description: t("archive space description")
1462
- }, /* @__PURE__ */ React18.createElement(Button8, {
1463
- disabled: space === client.spaces.default,
1464
- onClick: handleChange
1465
- }, getValue() ? t("unarchive space label") : t("archive space label")));
1466
- }
1467
- }), [
1468
- t,
1469
- space
1470
- ]);
1471
- return /* @__PURE__ */ React18.createElement(StackItem4.Content, {
1472
- classNames: "block overflow-y-auto pli-2"
1473
- }, /* @__PURE__ */ React18.createElement(ControlPage3, null, /* @__PURE__ */ React18.createElement(ControlSection3, {
1474
- title: t("space properties settings verbose label", {
1475
- ns: SPACE_PLUGIN
1476
- }),
1477
- description: t("space properties settings description", {
1478
- ns: SPACE_PLUGIN
1479
- })
1480
- }, /* @__PURE__ */ React18.createElement(Form3, {
1481
- schema: FormSchema,
1482
- values,
1483
- autoSave: true,
1484
- onSave: handleSave,
1485
- Custom: customElements,
1486
- classNames: 'p-0 container-max-width [&_[role="form"]]:grid [&_[role="form"]]:grid-cols-1 md:[&_[role="form"]]:grid-cols-[1fr_min-content] [&_[role="form"]]:gap-4'
1487
- }))));
1488
- };
1489
-
1490
- // packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
1491
- import { Option as Option2 } from "effect";
1492
- import React19, { useEffect as useEffect5, useState as useState10 } from "react";
1493
- import { useAppGraph as useAppGraph3 } from "@dxos/app-framework";
1494
- import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
1495
- import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
1496
- import { useClient as useClient8 } from "@dxos/react-client";
1497
- import { useSpaceSyncState } from "@dxos/react-client/echo";
1498
- import { Tooltip as Tooltip3, useTranslation as useTranslation18 } from "@dxos/react-ui";
1499
- import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
1500
- var useEdgeStatus = () => {
1501
- const [status, setStatus] = useState10(EdgeStatus.NOT_CONNECTED);
1502
- const client = useClient8();
1503
- useEffect5(() => {
1504
- client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
1505
- setStatus(status2);
1506
- });
1507
- }, [
1508
- client
1509
- ]);
1510
- return status;
1511
- };
1512
- var InlineSyncStatus = ({ space, open }) => {
1513
- const { t } = useTranslation18(SPACE_PLUGIN);
1514
- const id = space.id;
1515
- const { hasAttention, isAncestor, isRelated } = useAttention2(id);
1516
- const isAttended = hasAttention || isAncestor || isRelated;
1517
- const { graph } = useAppGraph3();
1518
- const attended = useAttended2();
1519
- const startOfAttention = attended.at(-1);
1520
- const path = usePath(graph, startOfAttention);
1521
- const containsAttended = !open && !isAttended && id && Option2.isSome(path) ? path.value.includes(id) : false;
1522
- const connectedToEdge = useEdgeStatus() === EdgeStatus.CONNECTED;
1523
- const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
1524
- const syncState = useSpaceSyncState(space);
1525
- const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
1526
- return /* @__PURE__ */ React19.createElement(Tooltip3.Trigger, {
1527
- asChild: true,
1528
- content: t("syncing label"),
1529
- side: "bottom"
1530
- }, /* @__PURE__ */ React19.createElement(AttentionGlyph2, {
1531
- syncing,
1532
- attended: isAttended,
1533
- containsAttended,
1534
- classNames: "self-center mie-1"
1535
- }));
1536
- };
1537
-
1538
- // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1539
- import React20, { useEffect as useEffect6, useState as useState11 } from "react";
1540
- import { StatusBar } from "@dxos/plugin-status-bar";
1541
- import { useClient as useClient9 } from "@dxos/react-client";
1542
- import { getSyncSummary, useSyncState } from "@dxos/react-client/echo";
1543
- import { Icon as Icon5, useTranslation as useTranslation19 } from "@dxos/react-ui";
1544
-
1545
- // packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts
1546
- import { Context } from "@dxos/context";
1547
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
1548
- var createClientSaveTracker = (client, cb) => {
1549
- const CleanupFns = {};
1550
- const state = {};
1551
- const install = (spaces) => {
1552
- for (const space of spaces) {
1553
- if (state[space.id]) {
1554
- continue;
1555
- }
1556
- state[space.id] = "saved";
1557
- CleanupFns[space.id] = createSpaceSaveTracker(space, (s) => {
1558
- state[space.id] = s;
1559
- cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
1560
- });
1561
- }
1562
- };
1563
- client.spaces.subscribe((spaces) => {
1564
- install(spaces);
1565
- });
1566
- install(client.spaces.get());
1567
- return () => {
1568
- for (const unsubscribe of Object.values(CleanupFns)) {
1569
- unsubscribe();
1570
- }
1571
- };
1572
- };
1573
- var createSpaceSaveTracker = (space, cb) => {
1574
- const ctx = new Context(void 0, {
1575
- F: __dxlog_file6,
1576
- L: 40
1577
- });
1578
- void space.waitUntilReady().then(() => {
1579
- if (ctx.disposed) {
1580
- return;
1581
- }
1582
- let hasUnsavedChanges = false;
1583
- let lastFlushPromise;
1584
- space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
1585
- hasUnsavedChanges = unsavedDocuments.length > 0;
1586
- });
1587
- space.crud.saveStateChanged.debounce(500).on(ctx, () => {
1588
- if (hasUnsavedChanges) {
1589
- lastFlushPromise = void 0;
1590
- cb("saving");
1591
- } else {
1592
- const flushPromise = space.crud.flush();
1593
- lastFlushPromise = flushPromise;
1594
- void flushPromise.then(() => {
1595
- if (lastFlushPromise === flushPromise) {
1596
- cb("saved");
1597
- }
1598
- });
1599
- }
1600
- });
1601
- });
1602
- return () => {
1603
- void ctx.dispose();
1604
- };
1605
- };
1606
-
1607
- // packages/plugins/plugin-space/src/components/SyncStatus/status.ts
1608
- var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
1609
- if (!saved) {
1610
- return "saving locally";
1611
- } else if (!offline && needsToDownload) {
1612
- return "downloading";
1613
- } else if (!offline && needsToUpload) {
1614
- return "uploading";
1615
- } else if (offline && !needsToUpload && !needsToDownload) {
1616
- return "offline persisted";
1617
- } else {
1618
- return "remote synced";
1619
- }
1620
- };
1621
- var getIcon = (status) => {
1622
- switch (status) {
1623
- case "saving locally":
1624
- return "ph--download--regular";
1625
- case "downloading":
1626
- return "ph--cloud-arrow-down--regular";
1627
- case "uploading":
1628
- return "ph--cloud-arrow-up--regular";
1629
- case "offline persisted":
1630
- return "ph--check-circle--regular";
1631
- case "remote synced":
1632
- return "ph--cloud-check--regular";
1633
- }
1634
- };
1635
-
1636
- // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1637
- var SYNC_STALLED_TIMEOUT = 5e3;
1638
- var SyncStatus = () => {
1639
- const client = useClient9();
1640
- const state = useSyncState();
1641
- const [saved, setSaved] = useState11(true);
1642
- useEffect6(() => {
1643
- return createClientSaveTracker(client, (state2) => {
1644
- setSaved(state2 === "saved");
1645
- });
1646
- }, []);
1647
- return /* @__PURE__ */ React20.createElement(SyncStatusIndicator, {
1648
- state,
1649
- saved
1650
- });
1651
- };
1652
- var SyncStatusIndicator = ({ state, saved }) => {
1653
- const { t } = useTranslation19(SPACE_PLUGIN);
1654
- const summary = getSyncSummary(state);
1655
- const offline = Object.values(state).length === 0;
1656
- const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1657
- const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1658
- const status = getStatus({
1659
- offline,
1660
- saved,
1661
- needsToUpload,
1662
- needsToDownload
1663
- });
1664
- const [classNames, setClassNames] = useState11();
1665
- useEffect6(() => {
1666
- setClassNames(void 0);
1667
- if (offline || !needsToUpload && !needsToDownload) {
1668
- return;
1669
- }
1670
- const t2 = setTimeout(() => {
1671
- setClassNames("text-orange-500");
1672
- }, SYNC_STALLED_TIMEOUT);
1673
- return () => clearTimeout(t2);
1674
- }, [
1675
- offline,
1676
- needsToUpload,
1677
- needsToDownload
1678
- ]);
1679
- const title = t(`${status} label`);
1680
- const icon = /* @__PURE__ */ React20.createElement(Icon5, {
1681
- icon: getIcon(status),
1682
- size: 4,
1683
- classNames
1684
- });
1685
- return /* @__PURE__ */ React20.createElement(StatusBar.Item, {
1686
- title
1687
- }, icon);
1688
- };
1689
-
1690
- export {
1691
- AwaitingObject,
1692
- CREATE_OBJECT_DIALOG,
1693
- CreateObjectDialog,
1694
- CREATE_SPACE_DIALOG,
1695
- CreateSpaceDialog,
1696
- CollectionMain,
1697
- CollectionSection,
1698
- JOIN_DIALOG,
1699
- JoinDialog,
1700
- MembersContainer,
1701
- MenuFooter,
1702
- ObjectSettingsContainer,
1703
- PersistenceStatus,
1704
- POPOVER_RENAME_OBJECT,
1705
- PopoverRenameObject,
1706
- POPOVER_RENAME_SPACE,
1707
- PopoverRenameSpace,
1708
- useQuerySpaceSchemas,
1709
- SchemaContainer,
1710
- SpacePresence,
1711
- FullPresence,
1712
- SmallPresenceLive,
1713
- SmallPresence,
1714
- SpacePluginSettings,
1715
- SpaceSettingsContainer,
1716
- InlineSyncStatus,
1717
- SyncStatus,
1718
- SyncStatusIndicator,
1719
- AppGraphBuilder,
1720
- AppGraphSerializer,
1721
- IdentityCreated,
1722
- IntentResolver,
1723
- ReactRoot,
1724
- ReactSurface,
1725
- SchemaDefs,
1726
- SchemaTools,
1727
- SpaceSettings,
1728
- SpaceState,
1729
- SpacesReady
1730
- };
1731
- //# sourceMappingURL=chunk-43UQWMD3.mjs.map