@dxos/plugin-space 0.7.3-main.2dd075e → 0.7.3-staging.0905f03

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 (28) hide show
  1. package/dist/lib/browser/index.mjs +73 -74
  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 +59 -59
  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 +73 -74
  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/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
  13. package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts +1 -0
  14. package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
  15. package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts +6 -0
  16. package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +3 -2
  18. package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts +3 -2
  20. package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts.map +1 -1
  21. package/package.json +38 -38
  22. package/src/SpacePlugin.tsx +34 -53
  23. package/src/components/CreateDialog/CreateObjectDialog.tsx +3 -2
  24. package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +4 -4
  25. package/src/components/SyncStatus/InlineSyncStatus.stories.tsx +57 -0
  26. package/src/components/SyncStatus/InlineSyncStatus.tsx +20 -4
  27. package/src/components/SyncStatus/SyncStatus.stories.tsx +15 -13
  28. 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;
@@ -1059,13 +1061,13 @@ var JoinDialog = ({ navigableCollections, ...props }) => {
1059
1061
  // packages/plugins/plugin-space/src/components/MenuFooter.tsx
1060
1062
  import { Planet } from "@phosphor-icons/react";
1061
1063
  import React9 from "react";
1062
- import { getSpace as getSpace2 } from "@dxos/client/echo";
1064
+ import { getSpace as getSpace3 } from "@dxos/client/echo";
1063
1065
  import { useClient as useClient3 } from "@dxos/react-client";
1064
1066
  import { DropdownMenu, toLocalizedString as toLocalizedString2, useTranslation as useTranslation9 } from "@dxos/react-ui";
1065
1067
  var MenuFooter = ({ object }) => {
1066
1068
  const { t } = useTranslation9(SPACE_PLUGIN);
1067
1069
  const client = useClient3();
1068
- const space = getSpace2(object);
1070
+ const space = getSpace3(object);
1069
1071
  const spaceName = space ? getSpaceDisplayName(space, {
1070
1072
  personal: client.spaces.default === space
1071
1073
  }) : "";
@@ -1267,7 +1269,7 @@ import React14, { useCallback as useCallback7, useEffect as useEffect3, useState
1267
1269
  import { usePlugin } from "@dxos/app-framework";
1268
1270
  import { generateName } from "@dxos/display-name";
1269
1271
  import { PublicKey, useClient as useClient4 } from "@dxos/react-client";
1270
- import { getSpace as getSpace3, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1272
+ import { getSpace as getSpace4, useMembers, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
1271
1273
  import { useIdentity } from "@dxos/react-client/halo";
1272
1274
  import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation14, List, ListItem, useDefaultValue } from "@dxos/react-ui";
1273
1275
  import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
@@ -1280,7 +1282,7 @@ var SpacePresence = ({ object, spaceKey }) => {
1280
1282
  const spacePlugin = usePlugin(SPACE_PLUGIN);
1281
1283
  const client = useClient4();
1282
1284
  const identity = useIdentity();
1283
- const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
1285
+ const space = spaceKey ? client.spaces.get(spaceKey) : getSpace4(object);
1284
1286
  const spaceMembers = useMembers(space?.key);
1285
1287
  const [_moment, setMoment] = useState6(Date.now());
1286
1288
  useEffect3(() => {
@@ -1443,9 +1445,9 @@ var SpacePluginSettings = ({ settings }) => {
1443
1445
  // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsDialog.tsx
1444
1446
  import React17, { useState as useState8 } from "react";
1445
1447
  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";
1448
+ import { Button as Button6, Clipboard, Dialog as Dialog4, Icon as Icon4, toLocalizedString as toLocalizedString3, useTranslation as useTranslation17 } from "@dxos/react-ui";
1447
1449
  import { Tabs } from "@dxos/react-ui-tabs";
1448
- import { ClipboardProvider, SpacePanel } from "@dxos/shell/react";
1450
+ import { SpacePanel } from "@dxos/shell/react";
1449
1451
 
1450
1452
  // packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx
1451
1453
  import React16, { useCallback as useCallback8, useState as useState7 } from "react";
@@ -1564,7 +1566,7 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
1564
1566
  })), /* @__PURE__ */ React17.createElement(Tabs.Tabpanel, {
1565
1567
  value: "members",
1566
1568
  classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
1567
- }, /* @__PURE__ */ React17.createElement(ClipboardProvider, null, /* @__PURE__ */ React17.createElement(SpacePanel, {
1569
+ }, /* @__PURE__ */ React17.createElement(Clipboard.Provider, null, /* @__PURE__ */ React17.createElement(SpacePanel, {
1568
1570
  space,
1569
1571
  hideHeading: true,
1570
1572
  target,
@@ -1574,7 +1576,7 @@ var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "m
1574
1576
  };
1575
1577
 
1576
1578
  // packages/plugins/plugin-space/src/components/SyncStatus/InlineSyncStatus.tsx
1577
- import React18, { useEffect as useEffect5, useState as useState10 } from "react";
1579
+ import React18, { useEffect as useEffect5, useMemo, useState as useState10 } from "react";
1578
1580
  import { QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
1579
1581
  import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
1580
1582
  import { useClient as useClient8 } from "@dxos/react-client";
@@ -1676,21 +1678,29 @@ var useEdgeStatus = () => {
1676
1678
  return status;
1677
1679
  };
1678
1680
  var InlineSyncStatus = ({ space }) => {
1679
- const { t } = useTranslation18(SPACE_PLUGIN);
1680
1681
  const connectedToEdge = useEdgeStatus() === QueryEdgeStatusResponse.EdgeStatus.CONNECTED;
1681
1682
  const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
1682
1683
  const syncState = useSpaceSyncState(space);
1683
1684
  if (!connectedToEdge || !edgeSyncEnabled || !syncState || syncState.missingOnLocal === 0) {
1684
1685
  return null;
1685
1686
  }
1687
+ return /* @__PURE__ */ React18.createElement(InlineSyncStatusIndicator, null);
1688
+ };
1689
+ var InlineSyncStatusIndicator = () => {
1690
+ const { t } = useTranslation18(SPACE_PLUGIN);
1691
+ const animationProps = useMemo(() => ({
1692
+ // Synchronize animations.
1693
+ animationDelay: `-${Date.now() % 2e3}ms`
1694
+ }), []);
1686
1695
  return /* @__PURE__ */ React18.createElement("div", {
1687
1696
  role: "status",
1688
1697
  "aria-label": t("syncing message"),
1689
1698
  className: "flex items-center"
1690
1699
  }, /* @__PURE__ */ React18.createElement(Icon5, {
1691
- icon: "ph--arrows-clockwise--regular",
1700
+ icon: "ph--circle-notch--regular",
1692
1701
  size: 3,
1693
- classNames: "animate-spin"
1702
+ style: animationProps,
1703
+ classNames: "text-subdued animate-[spin_2s_linear_infinite]"
1694
1704
  }));
1695
1705
  };
1696
1706
 
@@ -2528,7 +2538,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2528
2538
  if (!isEchoObject2(data.object) && !isSpace4(data.object)) {
2529
2539
  return null;
2530
2540
  }
2531
- const space = isSpace4(data.object) ? data.object : getSpace4(data.object);
2541
+ const space = isSpace4(data.object) ? data.object : getSpace5(data.object);
2532
2542
  const object = isSpace4(data.object) ? data.object.state.get() === SpaceState2.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
2533
2543
  return space && object ? {
2534
2544
  node: /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(SpacePresence, {
@@ -2575,63 +2585,51 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2575
2585
  if (!client || !dispatch || !resolve || !graph) {
2576
2586
  return [];
2577
2587
  }
2588
+ const spacesNode = {
2589
+ id: SPACES,
2590
+ type: SPACES,
2591
+ cacheable: [
2592
+ "label",
2593
+ "role"
2594
+ ],
2595
+ properties: {
2596
+ label: [
2597
+ "spaces label",
2598
+ {
2599
+ ns: SPACE_PLUGIN
2600
+ }
2601
+ ],
2602
+ testId: "spacePlugin.spaces",
2603
+ role: "branch",
2604
+ disabled: true,
2605
+ childrenPersistenceClass: "echo",
2606
+ onRearrangeChildren: async (nextOrder) => {
2607
+ graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
2608
+ const { objects: [spacesOrder] } = await client.spaces.default.db.query(Filter3.schema(Expando, {
2609
+ key: SHARED
2610
+ })).run();
2611
+ if (spacesOrder) {
2612
+ spacesOrder.order = nextOrder.map(({ id }) => id);
2613
+ } else {
2614
+ log3.warn("spaces order object not found", void 0, {
2615
+ F: __dxlog_file6,
2616
+ L: 649,
2617
+ S: void 0,
2618
+ C: (f, a) => f(...a)
2619
+ });
2620
+ }
2621
+ }
2622
+ }
2623
+ };
2578
2624
  return [
2579
2625
  // Create spaces group node.
2580
2626
  createExtension({
2581
2627
  id: `${SPACE_PLUGIN}/root`,
2582
2628
  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
- }
2629
+ connector: () => [
2630
+ spacesNode
2631
+ ],
2632
+ resolver: ({ id }) => id === SPACES ? spacesNode : void 0
2635
2633
  }),
2636
2634
  // Create space nodes.
2637
2635
  createExtension({
@@ -2776,7 +2774,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2776
2774
  filter: (node) => node.data instanceof CollectionType,
2777
2775
  connector: ({ node }) => {
2778
2776
  const collection = node.data;
2779
- const space = getSpace4(collection);
2777
+ const space = getSpace5(collection);
2780
2778
  if (!space) {
2781
2779
  return;
2782
2780
  }
@@ -2812,7 +2810,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
2812
2810
  objectId
2813
2811
  }, {
2814
2812
  F: __dxlog_file6,
2815
- L: 891,
2813
+ L: 872,
2816
2814
  S: void 0,
2817
2815
  C: (f, a) => f(...a)
2818
2816
  }));
@@ -3276,7 +3274,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3276
3274
  if (!isReactiveObject3(object)) {
3277
3275
  return;
3278
3276
  }
3279
- const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
3277
+ const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace5(intent.data?.target);
3280
3278
  if (!space) {
3281
3279
  return;
3282
3280
  }
@@ -3365,15 +3363,15 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3365
3363
  const objects = intent.data?.objects ?? intent.data?.result;
3366
3364
  invariant2(Array.isArray(objects), void 0, {
3367
3365
  F: __dxlog_file6,
3368
- L: 1430,
3366
+ L: 1411,
3369
3367
  S: void 0,
3370
3368
  A: [
3371
3369
  "Array.isArray(objects)",
3372
3370
  ""
3373
3371
  ]
3374
3372
  });
3375
- const space = getSpace4(objects[0]);
3376
- if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace4(obj) === space)) {
3373
+ const space = getSpace5(objects[0]);
3374
+ if (!space || !objects.every((obj) => isEchoObject2(obj) && getSpace5(obj) === space)) {
3377
3375
  return;
3378
3376
  }
3379
3377
  const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
@@ -3481,7 +3479,7 @@ var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "
3481
3479
  case SpaceAction.DUPLICATE_OBJECT: {
3482
3480
  const originalObject = intent.data?.object ?? intent.data?.result;
3483
3481
  const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
3484
- const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
3482
+ const space = isSpace4(intent.data?.target) ? intent.data?.target : getSpace5(intent.data?.target);
3485
3483
  if (!isEchoObject2(originalObject) || !resolve || !space) {
3486
3484
  return;
3487
3485
  }
@@ -3540,6 +3538,7 @@ export {
3540
3538
  DefaultObjectSettings,
3541
3539
  FullPresence,
3542
3540
  InlineSyncStatus,
3541
+ InlineSyncStatusIndicator,
3543
3542
  JoinDialog,
3544
3543
  MenuFooter,
3545
3544
  MessageState,