@dxos/plugin-space 0.7.3-staging.cc8dd3e → 0.7.3

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 (31) hide show
  1. package/dist/lib/browser/index.mjs +77 -76
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +63 -61
  5. package/dist/lib/node/index.cjs.map +3 -3
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +77 -76
  8. package/dist/lib/node-esm/index.mjs.map +3 -3
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/SpacePlugin.d.ts.map +1 -1
  11. package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
  12. package/dist/types/src/components/JoinDialog.d.ts +1 -1
  13. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  14. package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
  15. package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts +1 -0
  16. package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
  17. package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts +6 -0
  18. package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts.map +1 -0
  19. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +3 -2
  20. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts +3 -2
  22. package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts.map +1 -1
  23. package/package.json +38 -38
  24. package/src/SpacePlugin.tsx +35 -53
  25. package/src/components/CreateDialog/CreateObjectDialog.tsx +3 -2
  26. package/src/components/JoinDialog.tsx +3 -1
  27. package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +4 -4
  28. package/src/components/SyncStatus/InlineSyncStatus.stories.tsx +57 -0
  29. package/src/components/SyncStatus/InlineSyncStatus.tsx +20 -4
  30. package/src/components/SyncStatus/SyncStatus.stories.tsx +15 -13
  31. package/src/components/SyncStatus/SyncStatusDetail.stories.tsx +10 -8
@@ -37,7 +37,7 @@ import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-gra
37
37
  import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/meta";
38
38
  import { EdgeReplicationSetting as EdgeReplicationSetting3 } from "@dxos/protocols/proto/dxos/echo/metadata";
39
39
  import { PublicKey as PublicKey2 } from "@dxos/react-client";
40
- import { Expando, FQ_ID_LENGTH, Filter as Filter3, OBJECT_ID_LENGTH, SPACE_ID_LENGTH, SpaceState as SpaceState2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace4, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace4, loadObjectReferences, parseFullyQualifiedId, parseId } from "@dxos/react-client/echo";
40
+ import { Expando, FQ_ID_LENGTH, Filter as Filter3, OBJECT_ID_LENGTH, SPACE_ID_LENGTH, SpaceState as SpaceState2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace5, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace4, loadObjectReferences, parseFullyQualifiedId, parseId } from "@dxos/react-client/echo";
41
41
  import { osTranslations } from "@dxos/shell/react";
42
42
  import { ComplexMap as ComplexMap2, nonNullable as nonNullable2, reduceGroupBy } from "@dxos/util";
43
43
 
@@ -140,7 +140,7 @@ var AwaitingObject = ({ id }) => {
140
140
  import React3, { useCallback as useCallback2, useRef } from "react";
141
141
  import { NavigationAction as NavigationAction2, useIntentDispatcher } from "@dxos/app-framework";
142
142
  import { useClient as useClient2 } from "@dxos/react-client";
143
- import { isReactiveObject as isReactiveObject2, isSpace as isSpace3, useSpaces } from "@dxos/react-client/echo";
143
+ import { getSpace as getSpace2, isReactiveObject as isReactiveObject2, isSpace as isSpace3, useSpaces } from "@dxos/react-client/echo";
144
144
  import { Button as Button2, Dialog, Icon as Icon2, useTranslation as useTranslation3 } from "@dxos/react-ui";
145
145
 
146
146
  // packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectPanel.tsx
@@ -802,10 +802,12 @@ var CreateObjectDialog = ({ schemas, target, typename, name, navigableCollection
802
802
  return;
803
803
  }
804
804
  closeRef.current?.click();
805
+ const space = isSpace3(target2) ? target2 : getSpace2(target2);
805
806
  const result = await dispatch({
806
807
  action: createObjectAction,
807
808
  data: {
808
- name: name2
809
+ name: name2,
810
+ space
809
811
  }
810
812
  });
811
813
  const object = result?.data;
@@ -974,7 +976,7 @@ import { ObservabilityAction } from "@dxos/plugin-observability/meta";
974
976
  import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
975
977
  import { Dialog as Dialog3, useTranslation as useTranslation8 } from "@dxos/react-ui";
976
978
  import { JoinPanel } from "@dxos/shell/react";
977
- var JoinDialog = ({ navigableCollections, ...props }) => {
979
+ var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
978
980
  const { t } = useTranslation8(SPACE_PLUGIN);
979
981
  const dispatch = useIntentDispatcher3();
980
982
  const spaces = useSpaces2();
@@ -1029,6 +1031,7 @@ var JoinDialog = ({ navigableCollections, ...props }) => {
1029
1031
  })
1030
1032
  ]);
1031
1033
  }
1034
+ await onDone?.(result);
1032
1035
  if (space) {
1033
1036
  await dispatch({
1034
1037
  action: ObservabilityAction.SEND_EVENT,
@@ -1059,13 +1062,13 @@ var JoinDialog = ({ navigableCollections, ...props }) => {
1059
1062
  // packages/plugins/plugin-space/src/components/MenuFooter.tsx
1060
1063
  import { Planet } from "@phosphor-icons/react";
1061
1064
  import React9 from "react";
1062
- import { getSpace as getSpace2 } from "@dxos/client/echo";
1065
+ import { getSpace as getSpace3 } from "@dxos/client/echo";
1063
1066
  import { useClient as useClient3 } from "@dxos/react-client";
1064
1067
  import { DropdownMenu, toLocalizedString as toLocalizedString2, useTranslation as useTranslation9 } from "@dxos/react-ui";
1065
1068
  var MenuFooter = ({ object }) => {
1066
1069
  const { t } = useTranslation9(SPACE_PLUGIN);
1067
1070
  const client = useClient3();
1068
- const space = getSpace2(object);
1071
+ const space = getSpace3(object);
1069
1072
  const spaceName = space ? getSpaceDisplayName(space, {
1070
1073
  personal: client.spaces.default === space
1071
1074
  }) : "";
@@ -1267,7 +1270,7 @@ import React14, { useCallback as useCallback7, useEffect as useEffect3, useState
1267
1270
  import { usePlugin } from "@dxos/app-framework";
1268
1271
  import { generateName } from "@dxos/display-name";
1269
1272
  import { PublicKey, useClient as useClient4 } from "@dxos/react-client";
1270
- import { getSpace as getSpace3, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1273
+ import { getSpace as getSpace4, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1271
1274
  import { useIdentity } from "@dxos/react-client/halo";
1272
1275
  import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation14, List, ListItem, useDefaultValue } from "@dxos/react-ui";
1273
1276
  import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
@@ -1280,7 +1283,7 @@ var SpacePresence = ({ object, spaceKey }) => {
1280
1283
  const spacePlugin = usePlugin(SPACE_PLUGIN);
1281
1284
  const client = useClient4();
1282
1285
  const identity = useIdentity();
1283
- const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
1286
+ const space = spaceKey ? client.spaces.get(spaceKey) : getSpace4(object);
1284
1287
  const spaceMembers = useMembers(space?.key);
1285
1288
  const [_moment, setMoment] = useState6(Date.now());
1286
1289
  useEffect3(() => {
@@ -1443,9 +1446,9 @@ var SpacePluginSettings = ({ settings }) => {
1443
1446
  // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
1444
1447
  import React17, { useState as useState8 } from "react";
1445
1448
  import { useClient as useClient6 } from "@dxos/react-client";
1446
- import { Button as Button6, Dialog as Dialog4, Icon as Icon4, toLocalizedString as toLocalizedString3, useTranslation as useTranslation17 } from "@dxos/react-ui";
1449
+ import { Button as Button6, Clipboard, Dialog as Dialog4, Icon as Icon4, toLocalizedString as toLocalizedString3, useTranslation as useTranslation17 } from "@dxos/react-ui";
1447
1450
  import { Tabs } from "@dxos/react-ui-tabs";
1448
- import { ClipboardProvider, SpacePanel } from "@dxos/shell/react";
1451
+ import { SpacePanel } from "@dxos/shell/react";
1449
1452
 
1450
1453
  // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx
1451
1454
  import React16, { useCallback as useCallback8, useState as useState7 } from "react";
@@ -1564,7 +1567,7 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
1564
1567
  })), /* @__PURE__ */ React17.createElement(Tabs.Tabpanel, {
1565
1568
  value: "members",
1566
1569
  classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
1567
- }, /* @__PURE__ */ React17.createElement(ClipboardProvider, null, /* @__PURE__ */ React17.createElement(SpacePanel, {
1570
+ }, /* @__PURE__ */ React17.createElement(Clipboard.Provider, null, /* @__PURE__ */ React17.createElement(SpacePanel, {
1568
1571
  space,
1569
1572
  hideHeading: true,
1570
1573
  target,
@@ -1574,7 +1577,7 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
1574
1577
  };
1575
1578
 
1576
1579
  // packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
1577
- import React18, { useEffect as useEffect5, useState as useState10 } from "react";
1580
+ import React18, { useEffect as useEffect5, useMemo, useState as useState10 } from "react";
1578
1581
  import { QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
1579
1582
  import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
1580
1583
  import { useClient as useClient8 } from "@dxos/react-client";
@@ -1676,21 +1679,29 @@ var useEdgeStatus = () => {
1676
1679
  return status;
1677
1680
  };
1678
1681
  var InlineSyncStatus = ({ space }) => {
1679
- const { t } = useTranslation18(SPACE_PLUGIN);
1680
1682
  const connectedToEdge = useEdgeStatus() === QueryEdgeStatusResponse.EdgeStatus.CONNECTED;
1681
1683
  const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
1682
1684
  const syncState = useSpaceSyncState(space);
1683
1685
  if (!connectedToEdge || !edgeSyncEnabled || !syncState || syncState.missingOnLocal === 0) {
1684
1686
  return null;
1685
1687
  }
1688
+ return /* @__PURE__ */ React18.createElement(InlineSyncStatusIndicator, null);
1689
+ };
1690
+ var InlineSyncStatusIndicator = () => {
1691
+ const { t } = useTranslation18(SPACE_PLUGIN);
1692
+ const animationProps = useMemo(() => ({
1693
+ // Synchronize animations.
1694
+ animationDelay: `-${Date.now() % 2e3}ms`
1695
+ }), []);
1686
1696
  return /* @__PURE__ */ React18.createElement("div", {
1687
1697
  role: "status",
1688
1698
  "aria-label": t("syncing message"),
1689
1699
  className: "flex items-center"
1690
1700
  }, /* @__PURE__ */ React18.createElement(Icon5, {
1691
- icon: "ph--arrows-clockwise--regular",
1701
+ icon: "ph--circle-notch--regular",
1692
1702
  size: 3,
1693
- classNames: "animate-spin"
1703
+ style: animationProps,
1704
+ classNames: "text-subdued animate-[spin_2s_linear_infinite]"
1694
1705
  }));
1695
1706
  };
1696
1707
 
@@ -2528,7 +2539,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2528
2539
  if (!isEchoObject2(data.object) && !isSpace4(data.object)) {
2529
2540
  return null;
2530
2541
  }
2531
- const space = isSpace4(data.object) ? data.object : getSpace4(data.object);
2542
+ const space = isSpace4(data.object) ? data.object : getSpace5(data.object);
2532
2543
  const object = isSpace4(data.object) ? data.object.state.get() === SpaceState2.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
2533
2544
  return space && object ? {
2534
2545
  node: /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(SpacePresence, {
@@ -2575,63 +2586,51 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2575
2586
  if (!client || !dispatch || !resolve || !graph) {
2576
2587
  return [];
2577
2588
  }
2589
+ const spacesNode = {
2590
+ id: SPACES,
2591
+ type: SPACES,
2592
+ cacheable: [
2593
+ "label",
2594
+ "role"
2595
+ ],
2596
+ properties: {
2597
+ label: [
2598
+ "spaces label",
2599
+ {
2600
+ ns: SPACE_PLUGIN
2601
+ }
2602
+ ],
2603
+ testId: "spacePlugin.spaces",
2604
+ role: "branch",
2605
+ disabled: true,
2606
+ childrenPersistenceClass: "echo",
2607
+ onRearrangeChildren: async (nextOrder) => {
2608
+ graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
2609
+ const { objects: [spacesOrder] } = await client.spaces.default.db.query(Filter3.schema(Expando, {
2610
+ key: SHARED
2611
+ })).run();
2612
+ if (spacesOrder) {
2613
+ spacesOrder.order = nextOrder.map(({ id }) => id);
2614
+ } else {
2615
+ log3.warn("spaces order object not found", void 0, {
2616
+ F: __dxlog_file6,
2617
+ L: 649,
2618
+ S: void 0,
2619
+ C: (f, a) => f(...a)
2620
+ });
2621
+ }
2622
+ }
2623
+ }
2624
+ };
2578
2625
  return [
2579
2626
  // Create spaces group node.
2580
2627
  createExtension({
2581
2628
  id: `${SPACE_PLUGIN}/root`,
2582
2629
  filter: (node) => node.id === "root",
2583
- connector: () => {
2584
- const isReady = toSignal((onChange) => {
2585
- let defaultSpaceUnsubscribe;
2586
- client.spaces.isReady.subscribe((ready) => {
2587
- if (ready) {
2588
- defaultSpaceUnsubscribe = client.spaces.default.state.subscribe(() => onChange()).unsubscribe;
2589
- }
2590
- });
2591
- return () => defaultSpaceUnsubscribe?.();
2592
- }, () => client.spaces.isReady.get() && client.spaces.default.state.get() === SpaceState2.SPACE_READY);
2593
- if (!isReady) {
2594
- return [];
2595
- }
2596
- return [
2597
- {
2598
- id: SPACES,
2599
- type: SPACES,
2600
- cacheable: [
2601
- "label",
2602
- "role"
2603
- ],
2604
- properties: {
2605
- label: [
2606
- "spaces label",
2607
- {
2608
- ns: SPACE_PLUGIN
2609
- }
2610
- ],
2611
- testId: "spacePlugin.spaces",
2612
- role: "branch",
2613
- disabled: true,
2614
- childrenPersistenceClass: "echo",
2615
- onRearrangeChildren: async (nextOrder) => {
2616
- graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
2617
- const { objects: [spacesOrder] } = await client.spaces.default.db.query(Filter3.schema(Expando, {
2618
- key: SHARED
2619
- })).run();
2620
- if (spacesOrder) {
2621
- spacesOrder.order = nextOrder.map(({ id }) => id);
2622
- } else {
2623
- log3.warn("spaces order object not found", void 0, {
2624
- F: __dxlog_file6,
2625
- L: 674,
2626
- S: void 0,
2627
- C: (f, a) => f(...a)
2628
- });
2629
- }
2630
- }
2631
- }
2632
- }
2633
- ];
2634
- }
2630
+ connector: () => [
2631
+ spacesNode
2632
+ ],
2633
+ resolver: ({ id }) => id === SPACES ? spacesNode : void 0
2635
2634
  }),
2636
2635
  // Create space nodes.
2637
2636
  createExtension({
@@ -2776,7 +2775,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2776
2775
  filter: (node) => node.data instanceof CollectionType,
2777
2776
  connector: ({ node }) => {
2778
2777
  const collection = node.data;
2779
- const space = getSpace4(collection);
2778
+ const space = getSpace5(collection);
2780
2779
  if (!space) {
2781
2780
  return;
2782
2781
  }
@@ -2812,7 +2811,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2812
2811
  objectId
2813
2812
  }, {
2814
2813
  F: __dxlog_file6,
2815
- L: 891,
2814
+ L: 872,
2816
2815
  S: void 0,
2817
2816
  C: (f, a) => f(...a)
2818
2817
  }));
@@ -3061,7 +3060,8 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3061
3060
  component: "dxos.org/plugin/space/JoinDialog",
3062
3061
  dialogBlockAlign: "start",
3063
3062
  subject: {
3064
- initialInvitationCode: intent.data?.invitationCode
3063
+ initialInvitationCode: intent.data?.invitationCode,
3064
+ onDone: intent.data?.onDone
3065
3065
  }
3066
3066
  }
3067
3067
  }
@@ -3276,7 +3276,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3276
3276
  if (!isReactiveObject3(object)) {
3277
3277
  return;
3278
3278
  }
3279
- const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
3279
+ const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace5(intent.data?.target);
3280
3280
  if (!space) {
3281
3281
  return;
3282
3282
  }
@@ -3365,15 +3365,15 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3365
3365
  const objects = intent.data?.objects ?? intent.data?.result;
3366
3366
  invariant2(Array.isArray(objects), void 0, {
3367
3367
  F: __dxlog_file6,
3368
- L: 1430,
3368
+ L: 1412,
3369
3369
  S: void 0,
3370
3370
  A: [
3371
3371
  "Array.isArray(objects)",
3372
3372
  ""
3373
3373
  ]
3374
3374
  });
3375
- const space = getSpace4(objects[0]);
3376
- if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace4(obj) === space)) {
3375
+ const space = getSpace5(objects[0]);
3376
+ if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace5(obj) === space)) {
3377
3377
  return;
3378
3378
  }
3379
3379
  const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
@@ -3481,7 +3481,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3481
3481
  case SpaceAction.DUPLICATE_OBJECT: {
3482
3482
  const originalObject = intent.data?.object ?? intent.data?.result;
3483
3483
  const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
3484
- const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
3484
+ const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace5(intent.data?.target);
3485
3485
  if (!isEchoObject2(originalObject) || !resolve || !space) {
3486
3486
  return;
3487
3487
  }
@@ -3540,6 +3540,7 @@ export {
3540
3540
  DefaultObjectSettings,
3541
3541
  FullPresence,
3542
3542
  InlineSyncStatus,
3543
+ InlineSyncStatusIndicator,
3543
3544
  JoinDialog,
3544
3545
  MenuFooter,
3545
3546
  MessageState,