@dxos/plugin-space 0.6.14-main.2b6a0f3 → 0.6.14-main.69511f5

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 (46) hide show
  1. package/dist/lib/browser/{chunk-47SVNCZM.mjs → chunk-FOI7DAUV.mjs} +1 -1
  2. package/dist/lib/browser/{chunk-47SVNCZM.mjs.map → chunk-FOI7DAUV.mjs.map} +2 -2
  3. package/dist/lib/browser/index.mjs +208 -108
  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-CTYDNFGG.cjs → chunk-OTDRTHT4.cjs} +4 -4
  8. package/dist/lib/node/{chunk-CTYDNFGG.cjs.map → chunk-OTDRTHT4.cjs.map} +2 -2
  9. package/dist/lib/node/index.cjs +234 -135
  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-PLPMYTLC.mjs → chunk-FYDGMPSC.mjs} +1 -1
  15. package/dist/lib/node-esm/{chunk-PLPMYTLC.mjs.map → chunk-FYDGMPSC.mjs.map} +2 -2
  16. package/dist/lib/node-esm/index.mjs +208 -108
  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/DefaultObjectSettings.d.ts +1 -1
  22. package/dist/types/src/components/DefaultObjectSettings.d.ts.map +1 -1
  23. package/dist/types/src/components/SpacePresence.d.ts +4 -2
  24. package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
  25. package/dist/types/src/components/SpaceSettingsPanel.d.ts +7 -0
  26. package/dist/types/src/components/SpaceSettingsPanel.d.ts.map +1 -0
  27. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/index.d.ts +1 -0
  29. package/dist/types/src/components/index.d.ts.map +1 -1
  30. package/dist/types/src/translations.d.ts +2 -0
  31. package/dist/types/src/translations.d.ts.map +1 -1
  32. package/dist/types/src/types/types.d.ts +3 -0
  33. package/dist/types/src/types/types.d.ts.map +1 -1
  34. package/dist/types/src/util.d.ts +1 -1
  35. package/dist/types/src/util.d.ts.map +1 -1
  36. package/package.json +40 -49
  37. package/src/SpacePlugin.tsx +62 -32
  38. package/src/components/DefaultObjectSettings.tsx +3 -2
  39. package/src/components/SpacePresence.tsx +33 -22
  40. package/src/components/SpaceSettings.tsx +5 -5
  41. package/src/components/SpaceSettingsPanel.tsx +59 -0
  42. package/src/components/SyncStatus/SyncStatus.tsx +1 -1
  43. package/src/components/index.ts +1 -0
  44. package/src/translations.ts +4 -2
  45. package/src/types/types.ts +3 -1
  46. package/src/util.tsx +3 -3
@@ -16,24 +16,24 @@ import {
16
16
  ThreadStatus,
17
17
  ThreadType,
18
18
  parseSpaceInitPlugin
19
- } from "./chunk-PLPMYTLC.mjs";
19
+ } from "./chunk-FYDGMPSC.mjs";
20
20
 
21
21
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
22
22
  import { signal } from "@preact/signals-core";
23
- import React17 from "react";
23
+ import React18 from "react";
24
24
  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";
25
25
  import { EventSubscriptions } from "@dxos/async";
26
26
  import { isReactiveObject as isReactiveObject2 } from "@dxos/echo-schema";
27
27
  import { scheduledEffect } from "@dxos/echo-signals/core";
28
28
  import { LocalStorageStore } from "@dxos/local-storage";
29
- import { log as log2 } from "@dxos/log";
29
+ import { log as log3 } from "@dxos/log";
30
30
  import { Migrations as Migrations2 } from "@dxos/migrations";
31
31
  import { parseAttentionPlugin } from "@dxos/plugin-attention";
32
32
  import { parseClientPlugin } from "@dxos/plugin-client";
33
33
  import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
34
34
  import { ObservabilityAction } from "@dxos/plugin-observability/meta";
35
35
  import { PublicKey as PublicKey2 } from "@dxos/react-client";
36
- 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, parseFullyQualifiedId } from "@dxos/react-client/echo";
36
+ 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";
37
37
  import { Dialog } from "@dxos/react-ui";
38
38
  import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
39
39
  import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
@@ -171,7 +171,7 @@ var DefaultObjectSettings = ({ object }) => {
171
171
  className: "flex flex-col w-full p-2 gap-1"
172
172
  }, /* @__PURE__ */ React4.createElement(Input.Root, null, /* @__PURE__ */ React4.createElement(Input.Label, null, t("name label")), /* @__PURE__ */ React4.createElement(Input.TextInput, {
173
173
  placeholder: t("name placeholder"),
174
- value: object.name,
174
+ value: object.name ?? "",
175
175
  onChange: (event) => {
176
176
  object.name = event.target.value;
177
177
  }
@@ -246,7 +246,7 @@ var getCollectionGraphNodePartials = ({ collection, space, resolve }) => {
246
246
  }
247
247
  },
248
248
  onCopy: async (child, index) => {
249
- const newObject = await cloneObject(child.data, resolve);
249
+ const newObject = await cloneObject(child.data, resolve, space);
250
250
  space.db.add(newObject);
251
251
  if (typeof index !== "undefined") {
252
252
  collection.objects.splice(index, 0, newObject);
@@ -716,7 +716,7 @@ var getNestedObjects = async (object, resolve) => {
716
716
  ...nested.flat()
717
717
  ];
718
718
  };
719
- var cloneObject = async (object, resolve) => {
719
+ var cloneObject = async (object, resolve, newSpace) => {
720
720
  const schema = getSchema(object);
721
721
  const typename = schema ? getObjectAnnotation(schema)?.typename ?? EXPANDO_TYPENAME : EXPANDO_TYPENAME;
722
722
  const metadata = resolve(typename);
@@ -735,6 +735,7 @@ var cloneObject = async (object, resolve) => {
735
735
  });
736
736
  return serializer.deserialize({
737
737
  content,
738
+ space: newSpace,
738
739
  newId: true
739
740
  });
740
741
  };
@@ -1221,15 +1222,14 @@ import { generateName } from "@dxos/display-name";
1221
1222
  import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
1222
1223
  import { getSpace as getSpace3, useMembers as useMembers2, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1223
1224
  import { useIdentity } from "@dxos/react-client/halo";
1224
- import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useDensityContext, useTranslation as useTranslation13, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1225
- import { AttentionGlyph } from "@dxos/react-ui-attention";
1225
+ import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation13, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
1226
+ import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
1226
1227
  import { ComplexMap, keyToFallback } from "@dxos/util";
1227
1228
  var REFRESH_INTERVAL = 5e3;
1228
1229
  var ACTIVITY_DURATION = 3e4;
1229
1230
  var noViewers = new ComplexMap(PublicKey.hash);
1230
1231
  var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
1231
1232
  var SpacePresence = ({ object, spaceKey }) => {
1232
- const density = useDensityContext();
1233
1233
  const spacePlugin = usePlugin(SPACE_PLUGIN);
1234
1234
  const client = useClient3();
1235
1235
  const identity = useIdentity();
@@ -1259,9 +1259,7 @@ var SpacePresence = ({ object, spaceKey }) => {
1259
1259
  lastSeen
1260
1260
  };
1261
1261
  }).toSorted((a, b) => a.lastSeen - b.lastSeen);
1262
- return density === "fine" ? /* @__PURE__ */ React13.createElement(SmallPresence, {
1263
- count: membersForObject.length
1264
- }) : /* @__PURE__ */ React13.createElement(FullPresence, {
1262
+ return /* @__PURE__ */ React13.createElement(FullPresence, {
1265
1263
  members: membersForObject
1266
1264
  });
1267
1265
  };
@@ -1330,25 +1328,42 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
1330
1328
  classNames: "text-sm truncate pli-2"
1331
1329
  }, getName(identity)));
1332
1330
  };
1333
- var SmallPresenceLive = ({ viewers }) => {
1334
- const [moment, setMoment] = useState7(Date.now());
1331
+ var SmallPresenceLive = ({ id, viewers }) => {
1332
+ const getActiveViewers = (viewers2) => {
1333
+ const moment = Date.now();
1334
+ return Array.from(viewers2.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION);
1335
+ };
1336
+ const [activeViewers, setActiveViewers] = useState7(viewers ? getActiveViewers(viewers) : []);
1335
1337
  useEffect4(() => {
1336
- const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
1337
- return () => clearInterval(interval);
1338
- }, []);
1339
- const activeViewers = viewers ? Array.from(viewers.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION) : [];
1338
+ if (viewers) {
1339
+ setActiveViewers(getActiveViewers(viewers));
1340
+ const interval = setInterval(() => {
1341
+ setActiveViewers(getActiveViewers(viewers));
1342
+ }, REFRESH_INTERVAL);
1343
+ return () => clearInterval(interval);
1344
+ }
1345
+ }, [
1346
+ viewers
1347
+ ]);
1340
1348
  return /* @__PURE__ */ React13.createElement(SmallPresence, {
1349
+ id,
1341
1350
  count: activeViewers.length
1342
1351
  });
1343
1352
  };
1344
- var SmallPresence = ({ count }) => {
1353
+ var SmallPresence = ({ id, count }) => {
1345
1354
  const { t } = useTranslation13(SPACE_PLUGIN);
1355
+ const { hasAttention, isAncestor, isRelated } = useAttention(id);
1356
+ const attention = hasAttention || isAncestor || isRelated;
1346
1357
  return /* @__PURE__ */ React13.createElement(Tooltip2.Root, null, /* @__PURE__ */ React13.createElement(Tooltip2.Trigger, {
1347
1358
  asChild: true
1359
+ }, /* @__PURE__ */ React13.createElement("div", {
1360
+ role: "none",
1361
+ className: "flex",
1362
+ "data-attention": attention
1348
1363
  }, /* @__PURE__ */ React13.createElement(AttentionGlyph, {
1349
1364
  presence: count > 1 ? "many" : count === 1 ? "one" : "none",
1350
1365
  classNames: "self-center mie-1"
1351
- })), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1366
+ }))), /* @__PURE__ */ React13.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React13.createElement(Tooltip2.Content, {
1352
1367
  side: "bottom",
1353
1368
  classNames: "z-[70]"
1354
1369
  }, /* @__PURE__ */ React13.createElement("span", null, t("presence label", {
@@ -1359,13 +1374,13 @@ var SmallPresence = ({ count }) => {
1359
1374
  // packages/plugins/plugin-space/src/components/SpaceSettings.tsx
1360
1375
  import React14 from "react";
1361
1376
  import { useIntentDispatcher as useIntentDispatcher2, useResolvePlugins } from "@dxos/app-framework";
1362
- import { SettingsValue } from "@dxos/plugin-settings";
1363
1377
  import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation14 } from "@dxos/react-ui";
1378
+ import { FormInput } from "@dxos/react-ui-data";
1364
1379
  var SpaceSettings = ({ settings }) => {
1365
1380
  const { t } = useTranslation14(SPACE_PLUGIN);
1366
1381
  const dispatch = useIntentDispatcher2();
1367
1382
  const plugins = useResolvePlugins(parseSpaceInitPlugin);
1368
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(SettingsValue, {
1383
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(FormInput, {
1369
1384
  label: t("show hidden spaces label")
1370
1385
  }, /* @__PURE__ */ React14.createElement(Input4.Switch, {
1371
1386
  checked: settings.showHidden,
@@ -1376,7 +1391,7 @@ var SpaceSettings = ({ settings }) => {
1376
1391
  state: !!checked
1377
1392
  }
1378
1393
  })
1379
- })), /* @__PURE__ */ React14.createElement(SettingsValue, {
1394
+ })), /* @__PURE__ */ React14.createElement(FormInput, {
1380
1395
  label: t("default on space create label")
1381
1396
  }, /* @__PURE__ */ React14.createElement(Select.Root, {
1382
1397
  value: settings.onSpaceCreate,
@@ -1389,25 +1404,69 @@ var SpaceSettings = ({ settings }) => {
1389
1404
  }, toLocalizedString2(onSpaceCreate.label, t)))))))));
1390
1405
  };
1391
1406
 
1407
+ // packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx
1408
+ import React15, { useCallback as useCallback5, useState as useState8 } from "react";
1409
+ import { log as log2 } from "@dxos/log";
1410
+ import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
1411
+ import { Input as Input5, useTranslation as useTranslation15 } from "@dxos/react-ui";
1412
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx";
1413
+ var SpaceSettingsPanel = ({ space }) => {
1414
+ const { t } = useTranslation15(SPACE_PLUGIN);
1415
+ const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
1416
+ const toggleEdgeReplication = useCallback5(async (next) => {
1417
+ setEdgeReplication(next);
1418
+ await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
1419
+ log2.catch(err, void 0, {
1420
+ F: __dxlog_file3,
1421
+ L: 30,
1422
+ S: void 0,
1423
+ C: (f, a) => f(...a)
1424
+ });
1425
+ setEdgeReplication(!next);
1426
+ });
1427
+ }, [
1428
+ space
1429
+ ]);
1430
+ return /* @__PURE__ */ React15.createElement("div", {
1431
+ role: "form",
1432
+ className: "flex flex-col w-full p-2 gap-4"
1433
+ }, /* @__PURE__ */ React15.createElement(Input5.Root, null, /* @__PURE__ */ React15.createElement("div", {
1434
+ role: "none",
1435
+ className: "flex flex-col gap-1"
1436
+ }, /* @__PURE__ */ React15.createElement(Input5.Label, null, t("name label")), /* @__PURE__ */ React15.createElement(Input5.TextInput, {
1437
+ placeholder: t("name placeholder"),
1438
+ value: space.properties.name,
1439
+ onChange: (event) => {
1440
+ space.properties.name = event.target.value;
1441
+ }
1442
+ }))), /* @__PURE__ */ React15.createElement(Input5.Root, null, /* @__PURE__ */ React15.createElement("div", {
1443
+ role: "none",
1444
+ className: "flex justify-between"
1445
+ }, /* @__PURE__ */ React15.createElement(Input5.Label, null, t("edge replication label")), /* @__PURE__ */ React15.createElement(Input5.Switch, {
1446
+ checked: edgeReplication,
1447
+ onCheckedChange: toggleEdgeReplication
1448
+ }))));
1449
+ };
1450
+
1392
1451
  // packages/plugins/plugin-space/src/components/SaveStatus.tsx
1393
- import React15, { useEffect as useEffect5, useState as useState8 } from "react";
1452
+ import React16, { useEffect as useEffect5, useState as useState9 } from "react";
1394
1453
  import { Context } from "@dxos/context";
1395
1454
  import { StatusBar } from "@dxos/plugin-status-bar";
1396
1455
  import { useClient as useClient4 } from "@dxos/react-client";
1397
- import { Icon, useTranslation as useTranslation15 } from "@dxos/react-ui";
1398
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SaveStatus.tsx";
1456
+ import { Icon, useTranslation as useTranslation16 } from "@dxos/react-ui";
1457
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SaveStatus.tsx";
1399
1458
  var SaveStatus = () => {
1400
- const { t } = useTranslation15(SPACE_PLUGIN);
1459
+ const { t } = useTranslation16(SPACE_PLUGIN);
1401
1460
  const client = useClient4();
1402
- const [state, setState] = useState8("saved");
1461
+ const [state, setState] = useState9("saved");
1403
1462
  useEffect5(() => {
1404
1463
  return createClientSaveTracker(client, (state2) => {
1405
1464
  setState(state2);
1406
1465
  });
1407
1466
  }, []);
1408
- return /* @__PURE__ */ React15.createElement(StatusBar.Item, {
1467
+ return /* @__PURE__ */ React16.createElement(StatusBar.Item, {
1409
1468
  title: state === "saving" ? t("saving label") : t("saved label")
1410
- }, /* @__PURE__ */ React15.createElement(Icon, {
1469
+ }, /* @__PURE__ */ React16.createElement(Icon, {
1411
1470
  icon: state === "saving" ? "ph--arrows-clockwise--regular" : "ph--check-circle--regular",
1412
1471
  size: 4
1413
1472
  }));
@@ -1439,7 +1498,7 @@ var createClientSaveTracker = (client, cb) => {
1439
1498
  };
1440
1499
  var createSpaceSaveTracker = (space, cb) => {
1441
1500
  const ctx = new Context(void 0, {
1442
- F: __dxlog_file3,
1501
+ F: __dxlog_file4,
1443
1502
  L: 64
1444
1503
  });
1445
1504
  void space.waitUntilReady().then(() => {
@@ -1472,18 +1531,18 @@ var createSpaceSaveTracker = (space, cb) => {
1472
1531
  };
1473
1532
 
1474
1533
  // packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
1475
- import React16, { useEffect as useEffect7, useState as useState10 } from "react";
1534
+ import React17, { useEffect as useEffect7, useState as useState11 } from "react";
1476
1535
  import { StatusBar as StatusBar2 } from "@dxos/plugin-status-bar";
1477
- import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation16 } from "@dxos/react-ui";
1536
+ import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation17 } from "@dxos/react-ui";
1478
1537
  import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
1479
1538
  import { mx as mx7 } from "@dxos/react-ui-theme";
1480
1539
 
1481
1540
  // packages/plugins/plugin-space/src/components/SyncStatus/types.ts
1482
- import { useEffect as useEffect6, useState as useState9 } from "react";
1541
+ import { useEffect as useEffect6, useState as useState10 } from "react";
1483
1542
  import { Context as Context2 } from "@dxos/context";
1484
1543
  import { EdgeService } from "@dxos/protocols";
1485
1544
  import { useClient as useClient5 } from "@dxos/react-client";
1486
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/types.ts";
1545
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/types.ts";
1487
1546
  var createEmptyEdgeSyncState = () => ({
1488
1547
  missingOnLocal: 0,
1489
1548
  missingOnRemote: 0,
@@ -1504,10 +1563,10 @@ var getSyncSummary = (syncMap) => {
1504
1563
  var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
1505
1564
  var useSyncState = () => {
1506
1565
  const client = useClient5();
1507
- const [spaceState, setSpaceState] = useState9({});
1566
+ const [spaceState, setSpaceState] = useState10({});
1508
1567
  useEffect6(() => {
1509
1568
  const ctx = new Context2(void 0, {
1510
- F: __dxlog_file4,
1569
+ F: __dxlog_file5,
1511
1570
  L: 48
1512
1571
  });
1513
1572
  const createSubscriptions = (spaces) => {
@@ -1548,7 +1607,7 @@ var styles = {
1548
1607
  };
1549
1608
  var SyncStatus = () => {
1550
1609
  const state = useSyncState();
1551
- return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
1610
+ return /* @__PURE__ */ React17.createElement(SyncStatusIndicator, {
1552
1611
  state
1553
1612
  });
1554
1613
  };
@@ -1557,7 +1616,7 @@ var SyncStatusIndicator = ({ state }) => {
1557
1616
  const offline = false;
1558
1617
  const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
1559
1618
  const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
1560
- const [classNames, setClassNames] = useState10();
1619
+ const [classNames, setClassNames] = useState11();
1561
1620
  useEffect7(() => {
1562
1621
  setClassNames(void 0);
1563
1622
  if (!needsToUpload && !needsToDownload) {
@@ -1571,36 +1630,38 @@ var SyncStatusIndicator = ({ state }) => {
1571
1630
  needsToUpload,
1572
1631
  needsToDownload
1573
1632
  ]);
1574
- return /* @__PURE__ */ React16.createElement(StatusBar2.Item, null, /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, null, /* @__PURE__ */ React16.createElement(Icon2, {
1633
+ return /* @__PURE__ */ React17.createElement(StatusBar2.Item, null, /* @__PURE__ */ React17.createElement(Popover3.Root, null, /* @__PURE__ */ React17.createElement(Popover3.Trigger, null, /* @__PURE__ */ React17.createElement(Icon2, {
1575
1634
  icon: offline ? "ph--cloud-x--regular" : needsToUpload ? "ph--cloud-arrow-up--regular" : needsToDownload ? "ph--cloud-arrow-down--regular" : "ph--cloud-check--regular",
1576
1635
  size: 4,
1577
1636
  classNames
1578
- })), /* @__PURE__ */ React16.createElement(Popover3.Content, null, /* @__PURE__ */ React16.createElement(SyncStatusDetail, {
1637
+ })), /* @__PURE__ */ React17.createElement(Popover3.Content, {
1638
+ sideOffset: 16
1639
+ }, /* @__PURE__ */ React17.createElement(SyncStatusDetail, {
1579
1640
  state,
1580
1641
  summary,
1581
1642
  debug: false
1582
1643
  }))));
1583
1644
  };
1584
1645
  var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
1585
- const { t } = useTranslation16(SPACE_PLUGIN);
1646
+ const { t } = useTranslation17(SPACE_PLUGIN);
1586
1647
  const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
1587
- return /* @__PURE__ */ React16.createElement("div", {
1648
+ return /* @__PURE__ */ React17.createElement("div", {
1588
1649
  className: mx7("flex flex-col text-xs min-w-[16rem]", classNames)
1589
- }, /* @__PURE__ */ React16.createElement("h1", {
1650
+ }, /* @__PURE__ */ React17.createElement("h1", {
1590
1651
  className: "p-2"
1591
- }, t("sync status title")), /* @__PURE__ */ React16.createElement("div", {
1652
+ }, t("sync status title")), /* @__PURE__ */ React17.createElement("div", {
1592
1653
  className: "flex flex-col gap-[2px] my-[2px]"
1593
- }, entries.map(([spaceId, state2]) => /* @__PURE__ */ React16.createElement(SpaceRow, {
1654
+ }, entries.map(([spaceId, state2]) => /* @__PURE__ */ React17.createElement(SpaceRow, {
1594
1655
  key: spaceId,
1595
1656
  spaceId,
1596
1657
  state: state2
1597
- }))), debug && /* @__PURE__ */ React16.createElement(SyntaxHighlighter, {
1658
+ }))), debug && /* @__PURE__ */ React17.createElement(SyntaxHighlighter, {
1598
1659
  language: "json"
1599
1660
  }, JSON.stringify(summary, null, 2)));
1600
1661
  };
1601
1662
  var useActive = (count) => {
1602
- const [current, setCurrent] = useState10(count);
1603
- const [active, setActive] = useState10(false);
1663
+ const [current, setCurrent] = useState11(count);
1664
+ const [active, setActive] = useState11(false);
1604
1665
  useEffect7(() => {
1605
1666
  let t;
1606
1667
  if (count !== current) {
@@ -1624,17 +1685,17 @@ var useActive = (count) => {
1624
1685
  var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
1625
1686
  const downActive = useActive(localDocumentCount);
1626
1687
  const upActive = useActive(remoteDocumentCount);
1627
- return /* @__PURE__ */ React16.createElement("div", {
1688
+ return /* @__PURE__ */ React17.createElement("div", {
1628
1689
  className: mx7("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
1629
1690
  title: spaceId,
1630
1691
  onClick: () => {
1631
1692
  void navigator.clipboard.writeText(spaceId);
1632
1693
  }
1633
- }, /* @__PURE__ */ React16.createElement(Icon2, {
1694
+ }, /* @__PURE__ */ React17.createElement(Icon2, {
1634
1695
  icon: "ph--arrow-fat-line-left--regular",
1635
1696
  size: 3,
1636
1697
  classNames: mx7(downActive && "animate-[pulse_1s_infinite]")
1637
- }), /* @__PURE__ */ React16.createElement(Candle, {
1698
+ }), /* @__PURE__ */ React17.createElement(Candle, {
1638
1699
  up: {
1639
1700
  count: remoteDocumentCount,
1640
1701
  total: remoteDocumentCount + missingOnRemote
@@ -1644,37 +1705,37 @@ var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, mis
1644
1705
  total: localDocumentCount + missingOnLocal
1645
1706
  },
1646
1707
  title: spaceId
1647
- }), /* @__PURE__ */ React16.createElement(Icon2, {
1708
+ }), /* @__PURE__ */ React17.createElement(Icon2, {
1648
1709
  icon: "ph--arrow-fat-line-right--regular",
1649
1710
  size: 3,
1650
1711
  classNames: mx7(upActive && "animate-[pulse_1s_step-start_infinite]")
1651
1712
  }));
1652
1713
  };
1653
1714
  var Candle = ({ classNames, up, down }) => {
1654
- return /* @__PURE__ */ React16.createElement("div", {
1715
+ return /* @__PURE__ */ React17.createElement("div", {
1655
1716
  className: mx7("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
1656
- }, /* @__PURE__ */ React16.createElement(Bar, {
1717
+ }, /* @__PURE__ */ React17.createElement(Bar, {
1657
1718
  classNames: "justify-end",
1658
1719
  ...up
1659
- }), /* @__PURE__ */ React16.createElement("div", {
1720
+ }), /* @__PURE__ */ React17.createElement("div", {
1660
1721
  className: "relative"
1661
- }, /* @__PURE__ */ React16.createElement("div", {
1722
+ }, /* @__PURE__ */ React17.createElement("div", {
1662
1723
  className: mx7("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
1663
- }, up.total)), /* @__PURE__ */ React16.createElement(Bar, down));
1724
+ }, up.total)), /* @__PURE__ */ React17.createElement(Bar, down));
1664
1725
  };
1665
1726
  var Bar = ({ classNames, count, total }) => {
1666
1727
  let p = count / total * 100;
1667
1728
  if (count < total) {
1668
1729
  p = Math.min(p, 95);
1669
1730
  }
1670
- return /* @__PURE__ */ React16.createElement("div", {
1731
+ return /* @__PURE__ */ React17.createElement("div", {
1671
1732
  className: mx7("relative flex w-full", styles.barBg, classNames)
1672
- }, /* @__PURE__ */ React16.createElement("div", {
1733
+ }, /* @__PURE__ */ React17.createElement("div", {
1673
1734
  className: mx7("shrink-0", styles.barFg),
1674
1735
  style: {
1675
1736
  width: `${p}%`
1676
1737
  }
1677
- }), count !== total && /* @__PURE__ */ React16.createElement("div", {
1738
+ }), count !== total && /* @__PURE__ */ React17.createElement("div", {
1678
1739
  className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
1679
1740
  }, count));
1680
1741
  };
@@ -1686,8 +1747,8 @@ var translations_default = [
1686
1747
  [SPACE_PLUGIN]: {
1687
1748
  "plugin name": "Spaces",
1688
1749
  "first run message": "Nothing selected.",
1689
- "create space label": "Create a new space",
1690
- "join space label": "Join a space",
1750
+ "create space label": "Create space",
1751
+ "join space label": "Join space",
1691
1752
  "empty space message": "No documents",
1692
1753
  "empty tree message": "No spaces",
1693
1754
  "unnamed space label": "New space",
@@ -1764,14 +1825,16 @@ var translations_default = [
1764
1825
  "dismiss label": "Dismiss",
1765
1826
  "join success label": "Successfully joined space",
1766
1827
  "name label": "Name",
1767
- "name placeholder": "Name"
1828
+ "name placeholder": "Name",
1829
+ "unnamed object settings label": "Settings",
1830
+ "edge replication label": "Enable EDGE Replication"
1768
1831
  }
1769
1832
  }
1770
1833
  }
1771
1834
  ];
1772
1835
 
1773
1836
  // packages/plugins/plugin-space/src/SpacePlugin.tsx
1774
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
1837
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
1775
1838
  var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
1776
1839
  var OBJECT_ID_LENGTH = 60;
1777
1840
  var SPACE_MAX_OBJECTS = 500;
@@ -1785,6 +1848,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1785
1848
  awaiting: void 0,
1786
1849
  spaceNames: {},
1787
1850
  viewersByObject: {},
1851
+ // TODO(wittjosiah): Stop using (Complex)Map inside reactive object.
1788
1852
  viewersByIdentity: new ComplexMap2(PublicKey2.hash),
1789
1853
  sdkMigrationRunning: {}
1790
1854
  });
@@ -1858,11 +1922,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1858
1922
  // TODO(Zan): When we re-open a part, we should remove it from the removed list in the navigation plugin.
1859
1923
  removed: removed.filter((id) => !ids2.includes(id))
1860
1924
  }).catch((err) => {
1861
- log2.warn("Failed to broadcast active node for presence.", {
1925
+ log3.warn("Failed to broadcast active node for presence.", {
1862
1926
  err: err.message
1863
1927
  }, {
1864
- F: __dxlog_file5,
1865
- L: 229,
1928
+ F: __dxlog_file6,
1929
+ L: 231,
1866
1930
  S: void 0,
1867
1931
  C: (f, a) => f(...a)
1868
1932
  });
@@ -1912,14 +1976,12 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1912
1976
  ready: async (plugins) => {
1913
1977
  settings.prop({
1914
1978
  key: "showHidden",
1915
- storageKey: "show-hidden",
1916
1979
  type: LocalStorageStore.bool({
1917
1980
  allowUndefined: true
1918
1981
  })
1919
1982
  });
1920
1983
  state.prop({
1921
1984
  key: "spaceNames",
1922
- storageKey: "space-names",
1923
1985
  type: LocalStorageStore.json()
1924
1986
  });
1925
1987
  navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
@@ -1971,7 +2033,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
1971
2033
  ...translations_default,
1972
2034
  osTranslations
1973
2035
  ],
1974
- root: () => state.values.awaiting ? /* @__PURE__ */ React17.createElement(AwaitingObject, {
2036
+ root: () => state.values.awaiting ? /* @__PURE__ */ React18.createElement(AwaitingObject, {
1975
2037
  id: state.values.awaiting
1976
2038
  }) : null,
1977
2039
  metadata: {
@@ -2003,7 +2065,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2003
2065
  switch (role) {
2004
2066
  case "article":
2005
2067
  case "main":
2006
- return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface2, {
2068
+ return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React18.createElement(Surface2, {
2007
2069
  data: {
2008
2070
  active: primary.properties[CollectionType.typename],
2009
2071
  id: primary.id
@@ -2011,43 +2073,50 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2011
2073
  role,
2012
2074
  ...rest
2013
2075
  }) : primary instanceof CollectionType ? {
2014
- node: /* @__PURE__ */ React17.createElement(CollectionMain, {
2076
+ node: /* @__PURE__ */ React18.createElement(CollectionMain, {
2015
2077
  collection: primary
2016
2078
  }),
2017
2079
  disposition: "fallback"
2018
- } : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */ React17.createElement(MissingObject, {
2080
+ } : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */ React18.createElement(MissingObject, {
2019
2081
  id: primary
2020
2082
  }) : null;
2021
2083
  case "complementary--settings":
2022
- return isEchoObject2(data.subject) ? /* @__PURE__ */ React17.createElement(DefaultObjectSettings, {
2023
- object: data.subject
2024
- }) : null;
2084
+ return isSpace2(data.subject) ? /* @__PURE__ */ React18.createElement(SpaceSettingsPanel, {
2085
+ space: data.subject
2086
+ }) : isEchoObject2(data.subject) ? {
2087
+ node: /* @__PURE__ */ React18.createElement(DefaultObjectSettings, {
2088
+ object: data.subject
2089
+ }),
2090
+ disposition: "fallback"
2091
+ } : null;
2025
2092
  case "dialog":
2026
2093
  if (data.component === "dxos.org/plugin/space/InvitationManagerDialog") {
2027
- return /* @__PURE__ */ React17.createElement(Dialog.Content, null, /* @__PURE__ */ React17.createElement(ClipboardProvider2, null, /* @__PURE__ */ React17.createElement(InvitationManager, {
2094
+ return /* @__PURE__ */ React18.createElement(Dialog.Content, null, /* @__PURE__ */ React18.createElement(ClipboardProvider2, null, /* @__PURE__ */ React18.createElement(InvitationManager, {
2028
2095
  active: true,
2029
2096
  ...data.subject
2030
2097
  })));
2031
- } else {
2032
- return null;
2033
2098
  }
2034
- case "popover":
2099
+ return null;
2100
+ case "popover": {
2035
2101
  if (data.component === "dxos.org/plugin/space/RenameSpacePopover" && isSpace2(data.subject)) {
2036
- return /* @__PURE__ */ React17.createElement(PopoverRenameSpace, {
2102
+ return /* @__PURE__ */ React18.createElement(PopoverRenameSpace, {
2037
2103
  space: data.subject
2038
2104
  });
2039
2105
  }
2040
2106
  if (data.component === "dxos.org/plugin/space/RenameObjectPopover" && isReactiveObject2(data.subject)) {
2041
- return /* @__PURE__ */ React17.createElement(PopoverRenameObject, {
2107
+ return /* @__PURE__ */ React18.createElement(PopoverRenameObject, {
2042
2108
  object: data.subject
2043
2109
  });
2044
2110
  }
2045
2111
  return null;
2112
+ }
2046
2113
  // TODO(burdon): Add role name syntax to minimal plugin docs.
2047
2114
  case "presence--glyph": {
2048
- return isReactiveObject2(data.object) ? /* @__PURE__ */ React17.createElement(SmallPresenceLive, {
2115
+ return isReactiveObject2(data.object) ? /* @__PURE__ */ React18.createElement(SmallPresenceLive, {
2116
+ id: data.id,
2049
2117
  viewers: state.values.viewersByObject[fullyQualifiedId4(data.object)]
2050
- }) : /* @__PURE__ */ React17.createElement(SmallPresence, {
2118
+ }) : /* @__PURE__ */ React18.createElement(SmallPresence, {
2119
+ id: data.id,
2051
2120
  count: 0
2052
2121
  });
2053
2122
  }
@@ -2061,32 +2130,32 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2061
2130
  const space = isSpace2(data.object) ? data.object : getSpace4(data.object);
2062
2131
  const object = isSpace2(data.object) ? data.object.state.get() === SpaceState3.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
2063
2132
  return space && object ? {
2064
- node: /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SpacePresence, {
2133
+ node: /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SpacePresence, {
2065
2134
  object
2066
- }), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React17.createElement(ShareSpaceButton, {
2135
+ }), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React18.createElement(ShareSpaceButton, {
2067
2136
  spaceId: space.id
2068
2137
  })),
2069
2138
  disposition: "hoist"
2070
2139
  } : null;
2071
2140
  }
2072
2141
  case "section":
2073
- return data.object instanceof CollectionType ? /* @__PURE__ */ React17.createElement(CollectionSection, {
2142
+ return data.object instanceof CollectionType ? /* @__PURE__ */ React18.createElement(CollectionSection, {
2074
2143
  collection: data.object
2075
2144
  }) : null;
2076
2145
  case "settings":
2077
- return data.plugin === meta_default.id ? /* @__PURE__ */ React17.createElement(SpaceSettings, {
2146
+ return data.plugin === meta_default.id ? /* @__PURE__ */ React18.createElement(SpaceSettings, {
2078
2147
  settings: settings.values
2079
2148
  }) : null;
2080
2149
  case "menu-footer":
2081
- if (!isEchoObject2(data.object)) {
2082
- return null;
2083
- } else {
2084
- return /* @__PURE__ */ React17.createElement(MenuFooter, {
2150
+ if (isEchoObject2(data.object)) {
2151
+ return /* @__PURE__ */ React18.createElement(MenuFooter, {
2085
2152
  object: data.object
2086
2153
  });
2154
+ } else {
2155
+ return null;
2087
2156
  }
2088
2157
  case "status": {
2089
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SyncStatus, null), /* @__PURE__ */ React17.createElement(SaveStatus, null));
2158
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SyncStatus, null), /* @__PURE__ */ React18.createElement(SaveStatus, null));
2090
2159
  }
2091
2160
  default:
2092
2161
  return null;
@@ -2102,7 +2171,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2102
2171
  const dispatch = intentPlugin?.provides.intent.dispatch;
2103
2172
  const resolve = metadataPlugin?.provides.metadata.resolver;
2104
2173
  const graph = graphPlugin?.provides.graph;
2105
- if (!graph || !dispatch || !resolve || !client) {
2174
+ if (!client || !dispatch || !resolve || !graph) {
2106
2175
  return [];
2107
2176
  }
2108
2177
  return [
@@ -2134,7 +2203,6 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2134
2203
  ns: SPACE_PLUGIN
2135
2204
  }
2136
2205
  ],
2137
- palette: "teal",
2138
2206
  testId: "spacePlugin.spaces",
2139
2207
  role: "branch",
2140
2208
  childrenPersistenceClass: "echo",
@@ -2146,9 +2214,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2146
2214
  if (spacesOrder) {
2147
2215
  spacesOrder.order = nextOrder.map(({ id }) => id);
2148
2216
  } else {
2149
- log2.warn("spaces order object not found", void 0, {
2150
- F: __dxlog_file5,
2151
- L: 526,
2217
+ log3.warn("spaces order object not found", void 0, {
2218
+ F: __dxlog_file6,
2219
+ L: 528,
2152
2220
  S: void 0,
2153
2221
  C: (f, a) => f(...a)
2154
2222
  });
@@ -2185,8 +2253,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2185
2253
  }
2186
2254
  ],
2187
2255
  icon: "ph--plus--regular",
2188
- disposition: "toolbar",
2189
- testId: "spacePlugin.createSpace"
2256
+ disposition: "item",
2257
+ testId: "spacePlugin.createSpace",
2258
+ className: "pbs-4"
2190
2259
  }
2191
2260
  },
2192
2261
  {
@@ -2210,7 +2279,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2210
2279
  }
2211
2280
  ],
2212
2281
  icon: "ph--sign-in--regular",
2213
- testId: "spacePlugin.joinSpace"
2282
+ disposition: "item",
2283
+ testId: "spacePlugin.joinSpace",
2284
+ className: "pbe-4"
2214
2285
  }
2215
2286
  }
2216
2287
  ],
@@ -2345,9 +2416,36 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2345
2416
  if (!id.endsWith("~settings")) {
2346
2417
  return;
2347
2418
  }
2419
+ const type = "orphan-settings-for-subject";
2420
+ const icon = "ph--gear--regular";
2348
2421
  const [subjectId] = id.split("~");
2349
- const [spaceId, objectId] = parseFullyQualifiedId(subjectId);
2422
+ const { spaceId, objectId } = parseId(subjectId);
2350
2423
  const space = client.spaces.get().find((space2) => space2.id === spaceId);
2424
+ if (!objectId) {
2425
+ const label2 = space ? space.properties.name || [
2426
+ "unnamed space label",
2427
+ {
2428
+ ns: SPACE_PLUGIN
2429
+ }
2430
+ ] : [
2431
+ "unnamed object settings label",
2432
+ {
2433
+ ns: SPACE_PLUGIN
2434
+ }
2435
+ ];
2436
+ return {
2437
+ id,
2438
+ type,
2439
+ data: null,
2440
+ properties: {
2441
+ icon,
2442
+ label: label2,
2443
+ showResolvedThreads: false,
2444
+ object: null,
2445
+ space
2446
+ }
2447
+ };
2448
+ }
2351
2449
  const object = toSignal((onChange) => {
2352
2450
  const timeout = setTimeout(async () => {
2353
2451
  await space?.db.loadObjectById(objectId);
@@ -2367,10 +2465,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2367
2465
  ];
2368
2466
  return {
2369
2467
  id,
2370
- type: "orphan-settings-for-subject",
2468
+ type,
2371
2469
  data: null,
2372
2470
  properties: {
2373
- icon: "ph--gear--regular",
2471
+ icon,
2374
2472
  label,
2375
2473
  object
2376
2474
  }
@@ -2909,10 +3007,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
2909
3007
  case SpaceAction.DUPLICATE_OBJECT: {
2910
3008
  const originalObject = intent.data?.object ?? intent.data?.result;
2911
3009
  const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
2912
- if (!isEchoObject2(originalObject) || !resolve) {
3010
+ const space = isSpace2(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
3011
+ if (!isEchoObject2(originalObject) || !resolve || !space) {
2913
3012
  return;
2914
3013
  }
2915
- const newObject = await cloneObject(originalObject, resolve);
3014
+ const newObject = await cloneObject(originalObject, resolve, space);
2916
3015
  return {
2917
3016
  intents: [
2918
3017
  [
@@ -2976,6 +3075,7 @@ export {
2976
3075
  SpacePlugin,
2977
3076
  SpacePresence,
2978
3077
  SpaceSettings,
3078
+ SpaceSettingsPanel,
2979
3079
  SyncStatus,
2980
3080
  SyncStatusDetail,
2981
3081
  SyncStatusIndicator,