@dxos/plugin-space 0.6.11 → 0.6.12-main.568932b
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.
- package/dist/lib/browser/{chunk-DTVUOG2C.mjs → chunk-NMD7OZMX.mjs} +22 -4
- package/dist/lib/browser/chunk-NMD7OZMX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +500 -187
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +7 -3
- package/dist/lib/node/{chunk-CVZPI2P3.cjs → chunk-K7CSJ7HL.cjs} +28 -8
- package/dist/lib/node/chunk-K7CSJ7HL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +588 -279
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +14 -10
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/chunk-GM2YUC77.mjs +37 -0
- package/dist/lib/node-esm/chunk-GM2YUC77.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-P73EVC4A.mjs +115 -0
- package/dist/lib/node-esm/chunk-P73EVC4A.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2954 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/meta.mjs +14 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +26 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/SaveStatus.d.ts +3 -0
- package/dist/types/src/components/SaveStatus.d.ts.map +1 -0
- package/dist/types/src/components/ShareSpaceButton.stories.d.ts +2 -0
- package/dist/types/src/components/ShareSpaceButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceMain/SpaceMain.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +2 -0
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +13 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +115 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/index.d.ts +2 -0
- package/dist/types/src/components/SyncStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/types.d.ts +14 -0
- package/dist/types/src/components/SyncStatus/types.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +13 -0
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +18 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -4
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +43 -36
- package/src/SpacePlugin.tsx +43 -24
- package/src/components/MenuFooter.tsx +1 -0
- package/src/components/SaveStatus.tsx +95 -0
- package/src/components/SpaceMain/SpaceMain.tsx +1 -22
- package/src/components/SpacePresence.tsx +1 -1
- package/src/components/SpaceSettings.tsx +32 -3
- package/src/components/SyncStatus/SyncStatus.stories.tsx +62 -0
- package/src/components/SyncStatus/SyncStatus.tsx +188 -0
- package/src/components/SyncStatus/index.ts +5 -0
- package/src/components/SyncStatus/types.ts +77 -0
- package/src/components/index.ts +2 -0
- package/src/translations.ts +2 -0
- package/src/types/collection.ts +1 -1
- package/src/types/thread.ts +10 -1
- package/src/types/types.ts +25 -1
- package/src/util.tsx +15 -50
- package/dist/lib/browser/chunk-DTVUOG2C.mjs.map +0 -7
- package/dist/lib/node/chunk-CVZPI2P3.cjs.map +0 -7
|
@@ -9,17 +9,18 @@ import {
|
|
|
9
9
|
ChannelType,
|
|
10
10
|
CollectionType,
|
|
11
11
|
ContactType,
|
|
12
|
+
MessageState,
|
|
12
13
|
MessageType,
|
|
13
14
|
SPACE_DIRECTORY_HANDLE,
|
|
14
15
|
ThreadStatus,
|
|
15
|
-
ThreadType
|
|
16
|
-
|
|
16
|
+
ThreadType,
|
|
17
|
+
parseSpaceInitPlugin
|
|
18
|
+
} from "./chunk-NMD7OZMX.mjs";
|
|
17
19
|
|
|
18
20
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
19
|
-
import { Plus as Plus2, SignIn, CardsThree as CardsThree2, Warning as Warning2 } from "@phosphor-icons/react";
|
|
20
21
|
import { effect, signal } from "@preact/signals-core";
|
|
21
|
-
import
|
|
22
|
-
import { LayoutAction as LayoutAction2,
|
|
22
|
+
import React18 from "react";
|
|
23
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface2, firstIdInPart, openIds, parseGraphPlugin, parseIntentPlugin as parseIntentPlugin3, parseMetadataResolverPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
23
24
|
import { EventSubscriptions } from "@dxos/async";
|
|
24
25
|
import { isReactiveObject as isReactiveObject2 } from "@dxos/echo-schema";
|
|
25
26
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
@@ -30,9 +31,9 @@ import { parseClientPlugin } from "@dxos/plugin-client";
|
|
|
30
31
|
import { createExtension, isGraphNode, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
|
|
31
32
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
32
33
|
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
33
|
-
import {
|
|
34
|
+
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 } from "@dxos/react-client/echo";
|
|
34
35
|
import { Dialog } from "@dxos/react-ui";
|
|
35
|
-
import {
|
|
36
|
+
import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
|
|
36
37
|
import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
|
|
37
38
|
|
|
38
39
|
// packages/plugins/plugin-space/src/components/AwaitingObject.tsx
|
|
@@ -183,15 +184,13 @@ var EmptyTree = () => {
|
|
|
183
184
|
};
|
|
184
185
|
|
|
185
186
|
// packages/plugins/plugin-space/src/components/MenuFooter.tsx
|
|
186
|
-
import { Planet
|
|
187
|
-
import
|
|
187
|
+
import { Planet } from "@phosphor-icons/react";
|
|
188
|
+
import React6 from "react";
|
|
188
189
|
import { getSpace as getSpace2 } from "@dxos/client/echo";
|
|
189
190
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
190
191
|
import { DropdownMenu, toLocalizedString, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
191
192
|
|
|
192
193
|
// packages/plugins/plugin-space/src/util.tsx
|
|
193
|
-
import { CardsThree, Database, PencilSimpleLine, Planet, Plus, Trash, Users, X, ClockCounterClockwise, LockSimpleOpen, LockSimple, Placeholder, Link } from "@phosphor-icons/react";
|
|
194
|
-
import React6 from "react";
|
|
195
194
|
import { NavigationAction as NavigationAction2 } from "@dxos/app-framework";
|
|
196
195
|
import { create, isReactiveObject, getTypename, getSchema, getEchoObjectAnnotation, EXPANDO_TYPENAME } from "@dxos/echo-schema";
|
|
197
196
|
import { invariant } from "@dxos/invariant";
|
|
@@ -284,8 +283,7 @@ var constructSpaceNode = ({ space, personal, namesCache, resolve }) => {
|
|
|
284
283
|
namesCache
|
|
285
284
|
}),
|
|
286
285
|
description: space.state.get() === SpaceState.SPACE_READY && space.properties.description,
|
|
287
|
-
icon:
|
|
288
|
-
iconSymbol: "ph--planet--regular",
|
|
286
|
+
icon: "ph--planet--regular",
|
|
289
287
|
disabled: space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
290
288
|
testId: "spacePlugin.space"
|
|
291
289
|
}
|
|
@@ -311,8 +309,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
311
309
|
ns: SPACE_PLUGIN
|
|
312
310
|
}
|
|
313
311
|
],
|
|
314
|
-
icon:
|
|
315
|
-
iconSymbol: "ph--plus--regular",
|
|
312
|
+
icon: "ph--plus--regular",
|
|
316
313
|
disposition: "toolbar",
|
|
317
314
|
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
318
315
|
// mainAreaDisposition: 'in-flow',
|
|
@@ -346,8 +343,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
346
343
|
ns: SPACE_PLUGIN
|
|
347
344
|
}
|
|
348
345
|
],
|
|
349
|
-
icon:
|
|
350
|
-
iconSymbol: "ph--cards-three--regular",
|
|
346
|
+
icon: "ph--cards-three--regular",
|
|
351
347
|
testId: "spacePlugin.createCollection"
|
|
352
348
|
}
|
|
353
349
|
}
|
|
@@ -381,8 +377,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
381
377
|
ns: SPACE_PLUGIN
|
|
382
378
|
}
|
|
383
379
|
],
|
|
384
|
-
icon:
|
|
385
|
-
iconSymbol: "ph--database--regular",
|
|
380
|
+
icon: "ph--database--regular",
|
|
386
381
|
disposition: "toolbar",
|
|
387
382
|
mainAreaDisposition: "in-flow",
|
|
388
383
|
disabled: migrating || Migrations.running(space)
|
|
@@ -413,8 +408,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
413
408
|
ns: SPACE_PLUGIN
|
|
414
409
|
}
|
|
415
410
|
],
|
|
416
|
-
icon:
|
|
417
|
-
iconSymbol: "ph--users--regular",
|
|
411
|
+
icon: "ph--users--regular",
|
|
418
412
|
disabled: locked,
|
|
419
413
|
keyBinding: {
|
|
420
414
|
macos: "meta+.",
|
|
@@ -441,8 +435,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
441
435
|
ns: SPACE_PLUGIN
|
|
442
436
|
}
|
|
443
437
|
],
|
|
444
|
-
icon: locked ?
|
|
445
|
-
iconSymbol: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
438
|
+
icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
446
439
|
}
|
|
447
440
|
}, {
|
|
448
441
|
id: getId(SpaceAction.RENAME),
|
|
@@ -464,8 +457,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
464
457
|
ns: SPACE_PLUGIN
|
|
465
458
|
}
|
|
466
459
|
],
|
|
467
|
-
icon:
|
|
468
|
-
iconSymbol: "ph--pencil-simple-line--regular",
|
|
460
|
+
icon: "ph--pencil-simple-line--regular",
|
|
469
461
|
keyBinding: {
|
|
470
462
|
macos: "shift+F6",
|
|
471
463
|
windows: "shift+F6"
|
|
@@ -494,8 +486,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
494
486
|
ns: SPACE_PLUGIN
|
|
495
487
|
}
|
|
496
488
|
],
|
|
497
|
-
icon:
|
|
498
|
-
iconSymbol: "ph--x--regular",
|
|
489
|
+
icon: "ph--x--regular",
|
|
499
490
|
mainAreaDisposition: "menu",
|
|
500
491
|
disabled: personal
|
|
501
492
|
}
|
|
@@ -521,8 +512,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
521
512
|
ns: SPACE_PLUGIN
|
|
522
513
|
}
|
|
523
514
|
],
|
|
524
|
-
icon:
|
|
525
|
-
iconSymbol: "ph--clock-counter-clockwise--regular",
|
|
515
|
+
icon: "ph--clock-counter-clockwise--regular",
|
|
526
516
|
disposition: "toolbar",
|
|
527
517
|
mainAreaDisposition: "in-flow"
|
|
528
518
|
}
|
|
@@ -556,8 +546,7 @@ var createObjectNode = ({ object, space, resolve }) => {
|
|
|
556
546
|
ns: SPACE_PLUGIN
|
|
557
547
|
}
|
|
558
548
|
],
|
|
559
|
-
icon: metadata.icon ??
|
|
560
|
-
iconSymbol: metadata.iconSymbol ?? "ph--placeholder--regular",
|
|
549
|
+
icon: metadata.icon ?? "ph--placeholder--regular",
|
|
561
550
|
testId: "spacePlugin.object",
|
|
562
551
|
persistenceClass: "echo",
|
|
563
552
|
persistenceKey: space?.id
|
|
@@ -582,8 +571,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
582
571
|
ns: SPACE_PLUGIN
|
|
583
572
|
}
|
|
584
573
|
],
|
|
585
|
-
icon:
|
|
586
|
-
iconSymbol: "ph--plus--regular",
|
|
574
|
+
icon: "ph--plus--regular",
|
|
587
575
|
disposition: "toolbar",
|
|
588
576
|
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
589
577
|
// mainAreaDisposition: 'in-flow',
|
|
@@ -617,8 +605,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
617
605
|
ns: SPACE_PLUGIN
|
|
618
606
|
}
|
|
619
607
|
],
|
|
620
|
-
icon:
|
|
621
|
-
iconSymbol: "ph--cards-three--regular",
|
|
608
|
+
icon: "ph--cards-three--regular",
|
|
622
609
|
testId: "spacePlugin.createCollection"
|
|
623
610
|
}
|
|
624
611
|
}
|
|
@@ -650,8 +637,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
650
637
|
ns: SPACE_PLUGIN
|
|
651
638
|
}
|
|
652
639
|
],
|
|
653
|
-
icon:
|
|
654
|
-
iconSymbol: "ph--pencil-simple-line--regular",
|
|
640
|
+
icon: "ph--pencil-simple-line--regular",
|
|
655
641
|
// TODO(wittjosiah): Doesn't work.
|
|
656
642
|
// keyBinding: 'shift+F6',
|
|
657
643
|
testId: "spacePlugin.renameObject"
|
|
@@ -682,8 +668,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
682
668
|
ns: SPACE_PLUGIN
|
|
683
669
|
}
|
|
684
670
|
],
|
|
685
|
-
icon:
|
|
686
|
-
iconSymbol: "ph--trash--regular",
|
|
671
|
+
icon: "ph--trash--regular",
|
|
687
672
|
keyBinding: object instanceof CollectionType ? void 0 : "shift+meta+Backspace",
|
|
688
673
|
testId: "spacePlugin.deleteObject"
|
|
689
674
|
}
|
|
@@ -702,8 +687,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
702
687
|
ns: SPACE_PLUGIN
|
|
703
688
|
}
|
|
704
689
|
],
|
|
705
|
-
icon:
|
|
706
|
-
iconSymbol: "ph--link--regular",
|
|
690
|
+
icon: "ph--link--regular",
|
|
707
691
|
testId: "spacePlugin.copyLink"
|
|
708
692
|
}
|
|
709
693
|
}
|
|
@@ -744,7 +728,7 @@ var cloneObject = async (object, resolve) => {
|
|
|
744
728
|
const serializer = metadata.serializer;
|
|
745
729
|
invariant(serializer, `No serializer for type: ${typename}`, {
|
|
746
730
|
F: __dxlog_file,
|
|
747
|
-
L:
|
|
731
|
+
L: 604,
|
|
748
732
|
S: void 0,
|
|
749
733
|
A: [
|
|
750
734
|
"serializer",
|
|
@@ -768,19 +752,19 @@ var MenuFooter = ({ object }) => {
|
|
|
768
752
|
const spaceName = space ? getSpaceDisplayName(space, {
|
|
769
753
|
personal: client.spaces.default === space
|
|
770
754
|
}) : "";
|
|
771
|
-
return space ? /* @__PURE__ */
|
|
755
|
+
return space ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React6.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React6.createElement("dl", {
|
|
772
756
|
className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
|
|
773
|
-
}, /* @__PURE__ */
|
|
757
|
+
}, /* @__PURE__ */ React6.createElement("dt", {
|
|
774
758
|
className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
|
|
775
|
-
}, t("location label")), /* @__PURE__ */
|
|
759
|
+
}, t("location label")), /* @__PURE__ */ React6.createElement("dd", {
|
|
776
760
|
className: "line-clamp-3"
|
|
777
|
-
}, /* @__PURE__ */
|
|
761
|
+
}, /* @__PURE__ */ React6.createElement(Planet, {
|
|
778
762
|
className: "inline-block mie-1"
|
|
779
763
|
}), toLocalizedString(spaceName, t)))) : null;
|
|
780
764
|
};
|
|
781
765
|
|
|
782
766
|
// packages/plugins/plugin-space/src/components/MissingObject.tsx
|
|
783
|
-
import
|
|
767
|
+
import React7, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
784
768
|
import { parseIntentPlugin as parseIntentPlugin2, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
|
|
785
769
|
import { Status, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
786
770
|
import { baseSurface as baseSurface2, descriptionText as descriptionText4, mx as mx5 } from "@dxos/react-ui-theme";
|
|
@@ -808,13 +792,13 @@ var MissingObject = ({ id }) => {
|
|
|
808
792
|
intentPlugin,
|
|
809
793
|
id
|
|
810
794
|
]);
|
|
811
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
812
796
|
role: "none",
|
|
813
797
|
className: mx5(baseSurface2, "min-bs-screen is-full flex items-center justify-center p-8")
|
|
814
|
-
}, waiting ? /* @__PURE__ */
|
|
798
|
+
}, waiting ? /* @__PURE__ */ React7.createElement("p", {
|
|
815
799
|
role: "alert",
|
|
816
800
|
className: mx5(descriptionText4, "border border-dashed border-neutral-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
|
|
817
|
-
}, t("missing object message")) : /* @__PURE__ */
|
|
801
|
+
}, t("missing object message")) : /* @__PURE__ */ React7.createElement(Status, {
|
|
818
802
|
indeterminate: true,
|
|
819
803
|
"aria-label": "Initializing"
|
|
820
804
|
}));
|
|
@@ -822,7 +806,7 @@ var MissingObject = ({ id }) => {
|
|
|
822
806
|
|
|
823
807
|
// packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
|
|
824
808
|
import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
|
|
825
|
-
import
|
|
809
|
+
import React8, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
826
810
|
import { debounce } from "@dxos/async";
|
|
827
811
|
import { Tooltip, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
828
812
|
import { getSize as getSize2, mx as mx6, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
|
|
@@ -850,40 +834,40 @@ var PersistenceStatus = ({ db }) => {
|
|
|
850
834
|
]);
|
|
851
835
|
switch (status) {
|
|
852
836
|
case 2:
|
|
853
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
854
838
|
className: "flex items-center"
|
|
855
|
-
}, /* @__PURE__ */
|
|
839
|
+
}, /* @__PURE__ */ React8.createElement(Warning, {
|
|
856
840
|
className: mx6(getSize2(4), "me-1")
|
|
857
|
-
}), /* @__PURE__ */
|
|
841
|
+
}), /* @__PURE__ */ React8.createElement("span", {
|
|
858
842
|
className: mx6("text-sm", warningText)
|
|
859
843
|
}, t("persistence error label")));
|
|
860
844
|
case 1:
|
|
861
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
862
846
|
className: "flex items-center"
|
|
863
|
-
}, /* @__PURE__ */
|
|
847
|
+
}, /* @__PURE__ */ React8.createElement(ArrowsCounterClockwise, {
|
|
864
848
|
className: mx6(getSize2(4), "me-1")
|
|
865
|
-
}), /* @__PURE__ */
|
|
849
|
+
}), /* @__PURE__ */ React8.createElement("span", {
|
|
866
850
|
className: mx6("text-sm", staticPlaceholderText)
|
|
867
851
|
}, t("persistence pending label")));
|
|
868
852
|
case 0:
|
|
869
853
|
default:
|
|
870
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React8.createElement(Tooltip.Root, {
|
|
871
855
|
delayDuration: 400
|
|
872
|
-
}, /* @__PURE__ */
|
|
856
|
+
}, /* @__PURE__ */ React8.createElement(Tooltip.Trigger, {
|
|
873
857
|
role: "status",
|
|
874
858
|
className: "flex items-center"
|
|
875
|
-
}, /* @__PURE__ */
|
|
859
|
+
}, /* @__PURE__ */ React8.createElement(CheckCircle2, {
|
|
876
860
|
className: mx6(getSize2(4), "me-1")
|
|
877
|
-
}), displayMessage && /* @__PURE__ */
|
|
861
|
+
}), displayMessage && /* @__PURE__ */ React8.createElement("span", {
|
|
878
862
|
className: mx6("text-sm", staticPlaceholderText)
|
|
879
|
-
}, t("persisted locally label"))), /* @__PURE__ */
|
|
863
|
+
}, t("persisted locally label"))), /* @__PURE__ */ React8.createElement(Tooltip.Portal, null, /* @__PURE__ */ React8.createElement(Tooltip.Content, {
|
|
880
864
|
classNames: "z-10"
|
|
881
|
-
}, t("persisted locally message"), /* @__PURE__ */
|
|
865
|
+
}, t("persisted locally message"), /* @__PURE__ */ React8.createElement(Tooltip.Arrow, null))));
|
|
882
866
|
}
|
|
883
867
|
};
|
|
884
868
|
|
|
885
869
|
// packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
|
|
886
|
-
import
|
|
870
|
+
import React9, { useCallback, useRef, useState as useState4 } from "react";
|
|
887
871
|
import { log } from "@dxos/log";
|
|
888
872
|
import { Button as Button2, Input, Popover, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
889
873
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
@@ -913,23 +897,23 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
913
897
|
object,
|
|
914
898
|
name
|
|
915
899
|
]);
|
|
916
|
-
return /* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
917
901
|
role: "none",
|
|
918
902
|
className: "p-1 flex gap-2"
|
|
919
|
-
}, /* @__PURE__ */
|
|
903
|
+
}, /* @__PURE__ */ React9.createElement("div", {
|
|
920
904
|
role: "none",
|
|
921
905
|
className: "flex-1"
|
|
922
|
-
}, /* @__PURE__ */
|
|
906
|
+
}, /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Label, {
|
|
923
907
|
srOnly: true
|
|
924
|
-
}, t("object name label")), /* @__PURE__ */
|
|
908
|
+
}, t("object name label")), /* @__PURE__ */ React9.createElement(Input.TextInput, {
|
|
925
909
|
placeholder: t("object title placeholder"),
|
|
926
910
|
value: name,
|
|
927
911
|
"data-testid": "spacePlugin.renameObject.input",
|
|
928
912
|
onChange: ({ target: { value } }) => setName(value),
|
|
929
913
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
930
|
-
}))), /* @__PURE__ */
|
|
914
|
+
}))), /* @__PURE__ */ React9.createElement(Popover.Close, {
|
|
931
915
|
asChild: true
|
|
932
|
-
}, /* @__PURE__ */
|
|
916
|
+
}, /* @__PURE__ */ React9.createElement(Button2, {
|
|
933
917
|
ref: doneButton,
|
|
934
918
|
classNames: "self-stretch",
|
|
935
919
|
onClick: handleDone
|
|
@@ -939,7 +923,7 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
939
923
|
};
|
|
940
924
|
|
|
941
925
|
// packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
|
|
942
|
-
import
|
|
926
|
+
import React10, { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
|
|
943
927
|
import { Button as Button3, Input as Input2, Popover as Popover2, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
944
928
|
var PopoverRenameSpace = ({ space }) => {
|
|
945
929
|
const { t } = useTranslation10(SPACE_PLUGIN);
|
|
@@ -951,24 +935,24 @@ var PopoverRenameSpace = ({ space }) => {
|
|
|
951
935
|
space,
|
|
952
936
|
name
|
|
953
937
|
]);
|
|
954
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
955
939
|
role: "none",
|
|
956
940
|
className: "p-1 flex gap-2"
|
|
957
|
-
}, /* @__PURE__ */
|
|
941
|
+
}, /* @__PURE__ */ React10.createElement("div", {
|
|
958
942
|
role: "none",
|
|
959
943
|
className: "flex-1"
|
|
960
|
-
}, /* @__PURE__ */
|
|
944
|
+
}, /* @__PURE__ */ React10.createElement(Input2.Root, null, /* @__PURE__ */ React10.createElement(Input2.Label, {
|
|
961
945
|
srOnly: true
|
|
962
|
-
}, t("space name label")), /* @__PURE__ */
|
|
946
|
+
}, t("space name label")), /* @__PURE__ */ React10.createElement(Input2.TextInput, {
|
|
963
947
|
defaultValue: space.properties.name ?? "",
|
|
964
948
|
placeholder: t("unnamed space label"),
|
|
965
949
|
onChange: ({ target: { value } }) => setName(value),
|
|
966
950
|
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
967
951
|
// Currently this is not possible because Radix does not expose the popover context.
|
|
968
952
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
969
|
-
}))), /* @__PURE__ */
|
|
953
|
+
}))), /* @__PURE__ */ React10.createElement(Popover2.Close, {
|
|
970
954
|
asChild: true
|
|
971
|
-
}, /* @__PURE__ */
|
|
955
|
+
}, /* @__PURE__ */ React10.createElement(Button3, {
|
|
972
956
|
ref: doneButton,
|
|
973
957
|
classNames: "self-stretch",
|
|
974
958
|
onClick: handleDone
|
|
@@ -978,12 +962,12 @@ var PopoverRenameSpace = ({ space }) => {
|
|
|
978
962
|
};
|
|
979
963
|
|
|
980
964
|
// packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
|
|
981
|
-
import
|
|
965
|
+
import React11 from "react";
|
|
982
966
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
983
967
|
import { Button as Button4, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
984
968
|
var ShareSpaceButton = ({ spaceId }) => {
|
|
985
969
|
const dispatch = useIntentDispatcher();
|
|
986
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ React11.createElement(ShareSpaceButtonImpl, {
|
|
987
971
|
onClick: () => dispatch({
|
|
988
972
|
action: SpaceAction.SHARE,
|
|
989
973
|
data: {
|
|
@@ -994,7 +978,7 @@ var ShareSpaceButton = ({ spaceId }) => {
|
|
|
994
978
|
};
|
|
995
979
|
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
996
980
|
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
997
|
-
return /* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ React11.createElement(Button4, {
|
|
998
982
|
"data-testid": "spacePlugin.shareSpaceButton",
|
|
999
983
|
onClick,
|
|
1000
984
|
classNames: "mli-1"
|
|
@@ -1003,16 +987,16 @@ var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
|
1003
987
|
|
|
1004
988
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
1005
989
|
import { Command } from "@phosphor-icons/react";
|
|
1006
|
-
import
|
|
990
|
+
import React13 from "react";
|
|
1007
991
|
import { Surface } from "@dxos/app-framework";
|
|
1008
992
|
import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
|
|
1009
|
-
import {
|
|
993
|
+
import { Main, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1010
994
|
import { getSize as getSize4, mx as mx8, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
|
|
1011
995
|
import { ClipboardProvider } from "@dxos/shell/react";
|
|
1012
996
|
|
|
1013
997
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMembersSection.tsx
|
|
1014
998
|
import { CaretDown, Check, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
1015
|
-
import
|
|
999
|
+
import React12, { useCallback as useCallback3, useState as useState6 } from "react";
|
|
1016
1000
|
import { LayoutAction, useIntent } from "@dxos/app-framework";
|
|
1017
1001
|
import { useMembers, SpaceMember, useSpaceInvitations } from "@dxos/react-client/echo";
|
|
1018
1002
|
import { InvitationEncoder } from "@dxos/react-client/invitations";
|
|
@@ -1024,9 +1008,9 @@ var activeActionKeyStorageKey = "dxos:react-shell/space-manager/active-action";
|
|
|
1024
1008
|
var Presence = SpaceMember.PresenceState;
|
|
1025
1009
|
var handleCreateInvitationUrl = (invitationCode) => `${origin}?spaceInvitationCode=${invitationCode}`;
|
|
1026
1010
|
var SpaceMemberList = ({ members }) => {
|
|
1027
|
-
return members.length > 0 ? /* @__PURE__ */
|
|
1011
|
+
return members.length > 0 ? /* @__PURE__ */ React12.createElement(List, {
|
|
1028
1012
|
classNames: "col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center"
|
|
1029
|
-
}, members.map((member) => /* @__PURE__ */
|
|
1013
|
+
}, members.map((member) => /* @__PURE__ */ React12.createElement(IdentityListItem, {
|
|
1030
1014
|
classNames: "contents",
|
|
1031
1015
|
key: member.identity.identityKey.toHex(),
|
|
1032
1016
|
identity: member.identity,
|
|
@@ -1112,83 +1096,83 @@ var SpaceMembersSection = ({ space }) => {
|
|
|
1112
1096
|
[Presence.ONLINE]: [],
|
|
1113
1097
|
[Presence.OFFLINE]: []
|
|
1114
1098
|
});
|
|
1115
|
-
return /* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ React12.createElement("section", {
|
|
1116
1100
|
className: "mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min"
|
|
1117
|
-
}, /* @__PURE__ */
|
|
1101
|
+
}, /* @__PURE__ */ React12.createElement("h2", {
|
|
1118
1102
|
className: "contents"
|
|
1119
|
-
}, /* @__PURE__ */
|
|
1103
|
+
}, /* @__PURE__ */ React12.createElement(UsersThree, {
|
|
1120
1104
|
weight: "duotone",
|
|
1121
1105
|
className: mx7(getSize3(5), "place-self-center")
|
|
1122
|
-
}), /* @__PURE__ */
|
|
1106
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1123
1107
|
className: "text-lg col-span-2"
|
|
1124
|
-
}, t("space members label"))), /* @__PURE__ */
|
|
1108
|
+
}, t("space members label"))), /* @__PURE__ */ React12.createElement("h3", {
|
|
1125
1109
|
className: "col-start-2 col-span-3 text-sm italic text-description"
|
|
1126
|
-
}, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */
|
|
1110
|
+
}, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React12.createElement(List, {
|
|
1127
1111
|
classNames: "col-start-2 col-span-2 gap-y-2 grid grid-cols-[var(--rail-size)_1fr_var(--rail-action)_var(--rail-action)]"
|
|
1128
|
-
}, invitations.map((invitation) => /* @__PURE__ */
|
|
1112
|
+
}, invitations.map((invitation) => /* @__PURE__ */ React12.createElement(InvitationListItem, {
|
|
1129
1113
|
reverseEffects: true,
|
|
1130
1114
|
classNames: "pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid",
|
|
1131
1115
|
key: invitation.get().invitationId,
|
|
1132
1116
|
invitation,
|
|
1133
1117
|
send: handleInvitationSelect,
|
|
1134
1118
|
createInvitationUrl: handleCreateInvitationUrl
|
|
1135
|
-
}))), /* @__PURE__ */
|
|
1119
|
+
}))), /* @__PURE__ */ React12.createElement(ButtonGroup, {
|
|
1136
1120
|
classNames: "col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px"
|
|
1137
|
-
}, /* @__PURE__ */
|
|
1121
|
+
}, /* @__PURE__ */ React12.createElement(Button5, {
|
|
1138
1122
|
classNames: "gap-2",
|
|
1139
1123
|
onClick: activeAction.onClick
|
|
1140
|
-
}, /* @__PURE__ */
|
|
1124
|
+
}, /* @__PURE__ */ React12.createElement(activeAction.icon, {
|
|
1141
1125
|
className: getSize3(5)
|
|
1142
|
-
}), /* @__PURE__ */
|
|
1126
|
+
}), /* @__PURE__ */ React12.createElement("span", null, t(activeAction.label, {
|
|
1143
1127
|
ns: "os"
|
|
1144
|
-
}))), /* @__PURE__ */
|
|
1128
|
+
}))), /* @__PURE__ */ React12.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React12.createElement(DropdownMenu2.Trigger, {
|
|
1145
1129
|
asChild: true
|
|
1146
|
-
}, /* @__PURE__ */
|
|
1130
|
+
}, /* @__PURE__ */ React12.createElement(Button5, {
|
|
1147
1131
|
classNames: "pli-0"
|
|
1148
|
-
}, /* @__PURE__ */
|
|
1132
|
+
}, /* @__PURE__ */ React12.createElement(CaretDown, {
|
|
1149
1133
|
className: getSize3(4)
|
|
1150
|
-
}))), /* @__PURE__ */
|
|
1151
|
-
return /* @__PURE__ */
|
|
1134
|
+
}))), /* @__PURE__ */ React12.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React12.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
|
|
1135
|
+
return /* @__PURE__ */ React12.createElement(DropdownMenu2.CheckboxItem, {
|
|
1152
1136
|
key: id,
|
|
1153
1137
|
"aria-labelledby": `${id}__label`,
|
|
1154
1138
|
"aria-describedby": `${id}__description`,
|
|
1155
1139
|
checked: activeActionKey === id,
|
|
1156
1140
|
onCheckedChange: (checked) => checked && setActiveActionKey(id),
|
|
1157
1141
|
classNames: "gap-2"
|
|
1158
|
-
}, action.icon && /* @__PURE__ */
|
|
1142
|
+
}, action.icon && /* @__PURE__ */ React12.createElement(action.icon, {
|
|
1159
1143
|
className: getSize3(5)
|
|
1160
|
-
}), /* @__PURE__ */
|
|
1144
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
1161
1145
|
role: "none",
|
|
1162
1146
|
className: "flex-1 min-is-0 space-b-1"
|
|
1163
|
-
}, /* @__PURE__ */
|
|
1147
|
+
}, /* @__PURE__ */ React12.createElement("p", {
|
|
1164
1148
|
id: `${id}__label`
|
|
1165
1149
|
}, t(action.label, {
|
|
1166
1150
|
ns: "os"
|
|
1167
|
-
})), action.description && /* @__PURE__ */
|
|
1151
|
+
})), action.description && /* @__PURE__ */ React12.createElement("p", {
|
|
1168
1152
|
id: `${id}__description`,
|
|
1169
1153
|
className: descriptionText5
|
|
1170
1154
|
}, t(action.description, {
|
|
1171
1155
|
ns: "os"
|
|
1172
|
-
}))), /* @__PURE__ */
|
|
1156
|
+
}))), /* @__PURE__ */ React12.createElement(DropdownMenu2.ItemIndicator, {
|
|
1173
1157
|
asChild: true
|
|
1174
|
-
}, /* @__PURE__ */
|
|
1158
|
+
}, /* @__PURE__ */ React12.createElement(Check, {
|
|
1175
1159
|
className: getSize3(4)
|
|
1176
1160
|
})));
|
|
1177
|
-
})), /* @__PURE__ */
|
|
1161
|
+
})), /* @__PURE__ */ React12.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React12.createElement("p", {
|
|
1178
1162
|
className: mx7(descriptionText5, "text-center is-full mlb-2")
|
|
1179
1163
|
}, t("empty space members message", {
|
|
1180
1164
|
ns: "os"
|
|
1181
|
-
})) : /* @__PURE__ */
|
|
1165
|
+
})) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("h3", {
|
|
1182
1166
|
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1183
1167
|
}, t("active space members heading", {
|
|
1184
1168
|
count: members[Presence.ONLINE].length
|
|
1185
|
-
})), /* @__PURE__ */
|
|
1169
|
+
})), /* @__PURE__ */ React12.createElement(SpaceMemberList, {
|
|
1186
1170
|
members: members[Presence.ONLINE]
|
|
1187
|
-
}), /* @__PURE__ */
|
|
1171
|
+
}), /* @__PURE__ */ React12.createElement("h3", {
|
|
1188
1172
|
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1189
1173
|
}, t("inactive space members heading", {
|
|
1190
1174
|
count: members[Presence.OFFLINE].length
|
|
1191
|
-
})), /* @__PURE__ */
|
|
1175
|
+
})), /* @__PURE__ */ React12.createElement(SpaceMemberList, {
|
|
1192
1176
|
members: members[Presence.OFFLINE]
|
|
1193
1177
|
})));
|
|
1194
1178
|
};
|
|
@@ -1196,19 +1180,19 @@ var SpaceMembersSection = ({ space }) => {
|
|
|
1196
1180
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
1197
1181
|
var KeyShortcuts = () => {
|
|
1198
1182
|
const { t } = useTranslation13(SPACE_PLUGIN);
|
|
1199
|
-
return /* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ React13.createElement("section", {
|
|
1200
1184
|
className: "mbe-4 col-span-4 md:col-start-5 md:col-end-7 grid grid-cols-subgrid gap-y-2 auto-rows-min"
|
|
1201
|
-
}, /* @__PURE__ */
|
|
1185
|
+
}, /* @__PURE__ */ React13.createElement("h2", {
|
|
1202
1186
|
className: "contents"
|
|
1203
|
-
}, /* @__PURE__ */
|
|
1187
|
+
}, /* @__PURE__ */ React13.createElement(Command, {
|
|
1204
1188
|
weight: "duotone",
|
|
1205
1189
|
className: mx8(getSize4(5), "place-self-center")
|
|
1206
|
-
}), /* @__PURE__ */
|
|
1190
|
+
}), /* @__PURE__ */ React13.createElement("span", {
|
|
1207
1191
|
className: "text-lg col-span-2 md:col-span-1"
|
|
1208
|
-
}, t("keyshortcuts label"))), /* @__PURE__ */
|
|
1192
|
+
}, t("keyshortcuts label"))), /* @__PURE__ */ React13.createElement("div", {
|
|
1209
1193
|
role: "none",
|
|
1210
1194
|
className: "col-start-2 col-end-4 md:col-end-5 pie-2"
|
|
1211
|
-
}, /* @__PURE__ */
|
|
1195
|
+
}, /* @__PURE__ */ React13.createElement(Surface, {
|
|
1212
1196
|
role: "keyshortcuts"
|
|
1213
1197
|
})));
|
|
1214
1198
|
};
|
|
@@ -1217,7 +1201,7 @@ var SpaceMain = ({ space, role }) => {
|
|
|
1217
1201
|
const state = space.state.get();
|
|
1218
1202
|
const ready = state === SpaceState2.SPACE_READY;
|
|
1219
1203
|
const Root = role === "main" ? Main.Content : "div";
|
|
1220
|
-
return /* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ React13.createElement(ClipboardProvider, null, /* @__PURE__ */ React13.createElement(Root, {
|
|
1221
1205
|
...role === "main" ? {
|
|
1222
1206
|
classNames: [
|
|
1223
1207
|
topbarBlockPaddingStart,
|
|
@@ -1230,13 +1214,13 @@ var SpaceMain = ({ space, role }) => {
|
|
|
1230
1214
|
},
|
|
1231
1215
|
"data-testid": `spacePlugin.${role}`,
|
|
1232
1216
|
"data-isready": ready ? "true" : "false"
|
|
1233
|
-
}, ready && /* @__PURE__ */
|
|
1217
|
+
}, ready && /* @__PURE__ */ React13.createElement(SpaceMembersSection, {
|
|
1234
1218
|
space
|
|
1235
|
-
}), /* @__PURE__ */
|
|
1219
|
+
}), /* @__PURE__ */ React13.createElement(KeyShortcuts, null)));
|
|
1236
1220
|
};
|
|
1237
1221
|
|
|
1238
1222
|
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1239
|
-
import
|
|
1223
|
+
import React14, { useCallback as useCallback4, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1240
1224
|
import { usePlugin } from "@dxos/app-framework";
|
|
1241
1225
|
import { generateName } from "@dxos/display-name";
|
|
1242
1226
|
import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
|
|
@@ -1280,50 +1264,50 @@ var SpacePresence = ({ object, spaceKey }) => {
|
|
|
1280
1264
|
lastSeen
|
|
1281
1265
|
};
|
|
1282
1266
|
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1283
|
-
return density === "fine" ? /* @__PURE__ */
|
|
1267
|
+
return density === "fine" ? /* @__PURE__ */ React14.createElement(SmallPresence, {
|
|
1284
1268
|
count: membersForObject.length
|
|
1285
|
-
}) : /* @__PURE__ */
|
|
1269
|
+
}) : /* @__PURE__ */ React14.createElement(FullPresence, {
|
|
1286
1270
|
members: membersForObject
|
|
1287
1271
|
});
|
|
1288
1272
|
};
|
|
1289
1273
|
var FullPresence = (props) => {
|
|
1290
1274
|
const { size = 9, onMemberClick } = props;
|
|
1291
|
-
const members = useDefaultValue(props.members, []);
|
|
1275
|
+
const members = useDefaultValue(props.members, () => []);
|
|
1292
1276
|
if (members.length === 0) {
|
|
1293
1277
|
return null;
|
|
1294
1278
|
}
|
|
1295
|
-
return /* @__PURE__ */
|
|
1279
|
+
return /* @__PURE__ */ React14.createElement(AvatarGroup.Root, {
|
|
1296
1280
|
size,
|
|
1297
1281
|
classNames: "mbs-2 mie-4",
|
|
1298
1282
|
"data-testid": "spacePlugin.presence"
|
|
1299
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */
|
|
1283
|
+
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React14.createElement(Tooltip2.Root, {
|
|
1300
1284
|
key: member.identity.identityKey.toHex()
|
|
1301
|
-
}, /* @__PURE__ */
|
|
1285
|
+
}, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React14.createElement(PrensenceAvatar, {
|
|
1302
1286
|
identity: member.identity,
|
|
1303
1287
|
group: true,
|
|
1304
1288
|
match: member.currentlyAttended,
|
|
1305
1289
|
index: members.length - i,
|
|
1306
1290
|
onClick: () => onMemberClick?.(member)
|
|
1307
|
-
})), /* @__PURE__ */
|
|
1291
|
+
})), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1308
1292
|
side: "bottom"
|
|
1309
|
-
}, /* @__PURE__ */
|
|
1293
|
+
}, /* @__PURE__ */ React14.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React14.createElement(Tooltip2.Root, null, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React14.createElement(AvatarGroupItem.Root, {
|
|
1310
1294
|
status: "inactive"
|
|
1311
|
-
}, /* @__PURE__ */
|
|
1295
|
+
}, /* @__PURE__ */ React14.createElement(Avatar.Frame, {
|
|
1312
1296
|
style: {
|
|
1313
1297
|
zIndex: members.length - 4
|
|
1314
1298
|
}
|
|
1315
|
-
}, /* @__PURE__ */
|
|
1299
|
+
}, /* @__PURE__ */ React14.createElement(Avatar.Fallback, {
|
|
1316
1300
|
text: `+${members.length - 3}`
|
|
1317
|
-
})))), /* @__PURE__ */
|
|
1301
|
+
})))), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1318
1302
|
side: "bottom"
|
|
1319
|
-
}, /* @__PURE__ */
|
|
1303
|
+
}, /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React14.createElement(List2, {
|
|
1320
1304
|
classNames: "max-h-56 overflow-y-auto"
|
|
1321
|
-
}, members.map((member) => /* @__PURE__ */
|
|
1305
|
+
}, members.map((member) => /* @__PURE__ */ React14.createElement(ListItem.Root, {
|
|
1322
1306
|
key: member.identity.identityKey.toHex(),
|
|
1323
1307
|
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1324
1308
|
onClick: () => onMemberClick?.(member),
|
|
1325
1309
|
"data-testid": "identity-list-item"
|
|
1326
|
-
}, /* @__PURE__ */
|
|
1310
|
+
}, /* @__PURE__ */ React14.createElement(PrensenceAvatar, {
|
|
1327
1311
|
identity: member.identity,
|
|
1328
1312
|
showName: true,
|
|
1329
1313
|
match: member.currentlyAttended
|
|
@@ -1333,10 +1317,10 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1333
1317
|
const Root = group ? AvatarGroupItem.Root : Avatar.Root;
|
|
1334
1318
|
const status = match ? "current" : "active";
|
|
1335
1319
|
const fallbackValue = keyToFallback(identity.identityKey);
|
|
1336
|
-
return /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ React14.createElement(Root, {
|
|
1337
1321
|
status,
|
|
1338
1322
|
hue: identity.profile?.data?.hue || fallbackValue.hue
|
|
1339
|
-
}, /* @__PURE__ */
|
|
1323
|
+
}, /* @__PURE__ */ React14.createElement(Avatar.Frame, {
|
|
1340
1324
|
"data-testid": "spacePlugin.presence.member",
|
|
1341
1325
|
"data-status": status,
|
|
1342
1326
|
...index ? {
|
|
@@ -1345,9 +1329,9 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1345
1329
|
}
|
|
1346
1330
|
} : {},
|
|
1347
1331
|
onClick: () => onClick?.()
|
|
1348
|
-
}, /* @__PURE__ */
|
|
1332
|
+
}, /* @__PURE__ */ React14.createElement(Avatar.Fallback, {
|
|
1349
1333
|
text: identity.profile?.data?.emoji || fallbackValue.emoji
|
|
1350
|
-
})), showName && /* @__PURE__ */
|
|
1334
|
+
})), showName && /* @__PURE__ */ React14.createElement(Avatar.Label, {
|
|
1351
1335
|
classNames: "text-sm truncate pli-2"
|
|
1352
1336
|
}, getName(identity)));
|
|
1353
1337
|
};
|
|
@@ -1358,36 +1342,37 @@ var SmallPresenceLive = ({ viewers }) => {
|
|
|
1358
1342
|
return () => clearInterval(interval);
|
|
1359
1343
|
}, []);
|
|
1360
1344
|
const activeViewers = viewers ? Array.from(viewers.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION) : [];
|
|
1361
|
-
return /* @__PURE__ */
|
|
1345
|
+
return /* @__PURE__ */ React14.createElement(SmallPresence, {
|
|
1362
1346
|
count: activeViewers.length
|
|
1363
1347
|
});
|
|
1364
1348
|
};
|
|
1365
1349
|
var SmallPresence = ({ count }) => {
|
|
1366
1350
|
const { t } = useTranslation14(SPACE_PLUGIN);
|
|
1367
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ React14.createElement(Tooltip2.Root, null, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, {
|
|
1368
1352
|
asChild: true
|
|
1369
|
-
}, /* @__PURE__ */
|
|
1353
|
+
}, /* @__PURE__ */ React14.createElement(AttentionGlyph, {
|
|
1370
1354
|
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1371
1355
|
classNames: "self-center mie-1"
|
|
1372
|
-
})), /* @__PURE__ */
|
|
1356
|
+
})), /* @__PURE__ */ React14.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React14.createElement(Tooltip2.Content, {
|
|
1373
1357
|
side: "bottom",
|
|
1374
1358
|
classNames: "z-[70]"
|
|
1375
|
-
}, /* @__PURE__ */
|
|
1359
|
+
}, /* @__PURE__ */ React14.createElement("span", null, t("presence label", {
|
|
1376
1360
|
count
|
|
1377
|
-
})), /* @__PURE__ */
|
|
1361
|
+
})), /* @__PURE__ */ React14.createElement(Tooltip2.Arrow, null))));
|
|
1378
1362
|
};
|
|
1379
1363
|
|
|
1380
1364
|
// packages/plugins/plugin-space/src/components/SpaceSettings.tsx
|
|
1381
|
-
import
|
|
1382
|
-
import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
1365
|
+
import React15 from "react";
|
|
1366
|
+
import { useIntentDispatcher as useIntentDispatcher2, useResolvePlugins } from "@dxos/app-framework";
|
|
1383
1367
|
import { SettingsValue } from "@dxos/plugin-settings";
|
|
1384
|
-
import { Input as Input3, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1368
|
+
import { Input as Input3, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1385
1369
|
var SpaceSettings = ({ settings }) => {
|
|
1386
1370
|
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1387
1371
|
const dispatch = useIntentDispatcher2();
|
|
1388
|
-
|
|
1372
|
+
const plugins = useResolvePlugins(parseSpaceInitPlugin);
|
|
1373
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(SettingsValue, {
|
|
1389
1374
|
label: t("show hidden spaces label")
|
|
1390
|
-
}, /* @__PURE__ */
|
|
1375
|
+
}, /* @__PURE__ */ React15.createElement(Input3.Switch, {
|
|
1391
1376
|
checked: settings.showHidden,
|
|
1392
1377
|
onCheckedChange: (checked) => dispatch({
|
|
1393
1378
|
plugin: SPACE_PLUGIN,
|
|
@@ -1396,7 +1381,307 @@ var SpaceSettings = ({ settings }) => {
|
|
|
1396
1381
|
state: !!checked
|
|
1397
1382
|
}
|
|
1398
1383
|
})
|
|
1399
|
-
}))
|
|
1384
|
+
})), /* @__PURE__ */ React15.createElement(SettingsValue, {
|
|
1385
|
+
label: t("default on space create label")
|
|
1386
|
+
}, /* @__PURE__ */ React15.createElement(Select.Root, {
|
|
1387
|
+
value: settings.onSpaceCreate,
|
|
1388
|
+
onValueChange: (value) => {
|
|
1389
|
+
settings.onSpaceCreate = value;
|
|
1390
|
+
}
|
|
1391
|
+
}, /* @__PURE__ */ React15.createElement(Select.TriggerButton, null), /* @__PURE__ */ React15.createElement(Select.Portal, null, /* @__PURE__ */ React15.createElement(Select.Content, null, /* @__PURE__ */ React15.createElement(Select.Viewport, null, plugins.map(({ provides: { space: { onSpaceCreate } } }) => /* @__PURE__ */ React15.createElement(Select.Option, {
|
|
1392
|
+
key: onSpaceCreate.action,
|
|
1393
|
+
value: onSpaceCreate.action
|
|
1394
|
+
}, toLocalizedString2(onSpaceCreate.label, t)))))))));
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
// packages/plugins/plugin-space/src/components/SaveStatus.tsx
|
|
1398
|
+
import React16, { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1399
|
+
import { Context } from "@dxos/context";
|
|
1400
|
+
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1401
|
+
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1402
|
+
import { Icon, useTranslation as useTranslation16 } from "@dxos/react-ui";
|
|
1403
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SaveStatus.tsx";
|
|
1404
|
+
var SaveStatus = () => {
|
|
1405
|
+
const { t } = useTranslation16(SPACE_PLUGIN);
|
|
1406
|
+
const client = useClient4();
|
|
1407
|
+
const [state, setState] = useState8("saved");
|
|
1408
|
+
useEffect5(() => {
|
|
1409
|
+
return createClientSaveTracker(client, (state2) => {
|
|
1410
|
+
setState(state2);
|
|
1411
|
+
});
|
|
1412
|
+
}, []);
|
|
1413
|
+
return /* @__PURE__ */ React16.createElement(StatusBar.Item, {
|
|
1414
|
+
title: state === "saving" ? t("saving label") : t("saved label")
|
|
1415
|
+
}, /* @__PURE__ */ React16.createElement(Icon, {
|
|
1416
|
+
icon: state === "saving" ? "ph--arrows-clockwise--regular" : "ph--check-circle--regular",
|
|
1417
|
+
size: 4
|
|
1418
|
+
}));
|
|
1419
|
+
};
|
|
1420
|
+
var createClientSaveTracker = (client, cb) => {
|
|
1421
|
+
const unsubscribeCallbacks = {};
|
|
1422
|
+
const state = {};
|
|
1423
|
+
const install = (spaces) => {
|
|
1424
|
+
for (const space of spaces) {
|
|
1425
|
+
if (state[space.id]) {
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
state[space.id] = "saved";
|
|
1429
|
+
unsubscribeCallbacks[space.id] = createSpaceSaveTracker(space, (s) => {
|
|
1430
|
+
state[space.id] = s;
|
|
1431
|
+
cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
client.spaces.subscribe((spaces) => {
|
|
1436
|
+
install(spaces);
|
|
1437
|
+
});
|
|
1438
|
+
install(client.spaces.get());
|
|
1439
|
+
return () => {
|
|
1440
|
+
for (const unsubscribe of Object.values(unsubscribeCallbacks)) {
|
|
1441
|
+
unsubscribe();
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
};
|
|
1445
|
+
var createSpaceSaveTracker = (space, cb) => {
|
|
1446
|
+
const ctx = new Context(void 0, {
|
|
1447
|
+
F: __dxlog_file3,
|
|
1448
|
+
L: 64
|
|
1449
|
+
});
|
|
1450
|
+
void space.waitUntilReady().then(() => {
|
|
1451
|
+
if (ctx.disposed) {
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
let hasUnsavedChanges = false;
|
|
1455
|
+
let lastFlushPromise;
|
|
1456
|
+
space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
|
|
1457
|
+
hasUnsavedChanges = unsavedDocuments.length > 0;
|
|
1458
|
+
});
|
|
1459
|
+
space.crud.saveStateChanged.debounce(500).on(ctx, () => {
|
|
1460
|
+
if (hasUnsavedChanges) {
|
|
1461
|
+
lastFlushPromise = void 0;
|
|
1462
|
+
cb("saving");
|
|
1463
|
+
} else {
|
|
1464
|
+
const flushPromise = space.crud.flush();
|
|
1465
|
+
lastFlushPromise = flushPromise;
|
|
1466
|
+
void flushPromise.then(() => {
|
|
1467
|
+
if (lastFlushPromise === flushPromise) {
|
|
1468
|
+
cb("saved");
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
});
|
|
1474
|
+
return () => {
|
|
1475
|
+
void ctx.dispose();
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1480
|
+
import React17, { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1481
|
+
import { StatusBar as StatusBar2 } from "@dxos/plugin-status-bar";
|
|
1482
|
+
import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation17 } from "@dxos/react-ui";
|
|
1483
|
+
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
1484
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
1485
|
+
|
|
1486
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/types.ts
|
|
1487
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1488
|
+
import { Context as Context2 } from "@dxos/context";
|
|
1489
|
+
import { EdgeService } from "@dxos/protocols";
|
|
1490
|
+
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1491
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/types.ts";
|
|
1492
|
+
var createEmptyEdgeSyncState = () => ({
|
|
1493
|
+
missingOnLocal: 0,
|
|
1494
|
+
missingOnRemote: 0,
|
|
1495
|
+
localDocumentCount: 0,
|
|
1496
|
+
remoteDocumentCount: 0,
|
|
1497
|
+
differentDocuments: 0
|
|
1498
|
+
});
|
|
1499
|
+
var getSyncSummary = (syncMap) => {
|
|
1500
|
+
return Object.entries(syncMap).reduce((summary, [_spaceId, peerState]) => {
|
|
1501
|
+
summary.missingOnLocal += peerState.missingOnLocal;
|
|
1502
|
+
summary.missingOnRemote += peerState.missingOnRemote;
|
|
1503
|
+
summary.localDocumentCount += peerState.localDocumentCount;
|
|
1504
|
+
summary.remoteDocumentCount += peerState.remoteDocumentCount;
|
|
1505
|
+
summary.differentDocuments += peerState.differentDocuments;
|
|
1506
|
+
return summary;
|
|
1507
|
+
}, createEmptyEdgeSyncState());
|
|
1508
|
+
};
|
|
1509
|
+
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1510
|
+
var useSyncState = () => {
|
|
1511
|
+
const client = useClient5();
|
|
1512
|
+
const [spaceState, setSpaceState] = useState9({});
|
|
1513
|
+
useEffect6(() => {
|
|
1514
|
+
const ctx = new Context2(void 0, {
|
|
1515
|
+
F: __dxlog_file4,
|
|
1516
|
+
L: 48
|
|
1517
|
+
});
|
|
1518
|
+
const createSubscriptions = (spaces) => {
|
|
1519
|
+
for (const space of spaces) {
|
|
1520
|
+
if (spaceState[space.id]) {
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1524
|
+
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1525
|
+
if (syncState) {
|
|
1526
|
+
setSpaceState((spaceState2) => ({
|
|
1527
|
+
...spaceState2,
|
|
1528
|
+
[space.id]: syncState
|
|
1529
|
+
}));
|
|
1530
|
+
}
|
|
1531
|
+
}));
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
createSubscriptions(client.spaces.get());
|
|
1535
|
+
client.spaces.subscribe((spaces) => {
|
|
1536
|
+
createSubscriptions(spaces);
|
|
1537
|
+
});
|
|
1538
|
+
return () => {
|
|
1539
|
+
void ctx.dispose();
|
|
1540
|
+
};
|
|
1541
|
+
}, [
|
|
1542
|
+
client
|
|
1543
|
+
]);
|
|
1544
|
+
return spaceState;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1548
|
+
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1549
|
+
var styles = {
|
|
1550
|
+
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
1551
|
+
barFg: "bg-neutral-100 bg-green-500",
|
|
1552
|
+
barHover: "dark:hover:bg-green-500"
|
|
1553
|
+
};
|
|
1554
|
+
var SyncStatus = () => {
|
|
1555
|
+
const state = useSyncState();
|
|
1556
|
+
return /* @__PURE__ */ React17.createElement(SyncStatusIndicator, {
|
|
1557
|
+
state
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
var SyncStatusIndicator = ({ state }) => {
|
|
1561
|
+
const summary = getSyncSummary(state);
|
|
1562
|
+
const offline = false;
|
|
1563
|
+
const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
|
|
1564
|
+
const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
|
|
1565
|
+
const [classNames, setClassNames] = useState10();
|
|
1566
|
+
useEffect7(() => {
|
|
1567
|
+
setClassNames(void 0);
|
|
1568
|
+
if (!needsToUpload && !needsToDownload) {
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
const t = setTimeout(() => {
|
|
1572
|
+
setClassNames("text-orange-500");
|
|
1573
|
+
}, SYNC_STALLED_TIMEOUT);
|
|
1574
|
+
return () => clearTimeout(t);
|
|
1575
|
+
}, [
|
|
1576
|
+
needsToUpload,
|
|
1577
|
+
needsToDownload
|
|
1578
|
+
]);
|
|
1579
|
+
return /* @__PURE__ */ React17.createElement(StatusBar2.Item, null, /* @__PURE__ */ React17.createElement(Popover3.Root, null, /* @__PURE__ */ React17.createElement(Popover3.Trigger, null, /* @__PURE__ */ React17.createElement(Icon2, {
|
|
1580
|
+
icon: offline ? "ph--cloud-x--regular" : needsToUpload ? "ph--cloud-arrow-up--regular" : needsToDownload ? "ph--cloud-arrow-down--regular" : "ph--cloud-check--regular",
|
|
1581
|
+
size: 4,
|
|
1582
|
+
classNames
|
|
1583
|
+
})), /* @__PURE__ */ React17.createElement(Popover3.Content, null, /* @__PURE__ */ React17.createElement(SyncStatusDetail, {
|
|
1584
|
+
state,
|
|
1585
|
+
summary,
|
|
1586
|
+
debug: false
|
|
1587
|
+
}))));
|
|
1588
|
+
};
|
|
1589
|
+
var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
1590
|
+
const { t } = useTranslation17(SPACE_PLUGIN);
|
|
1591
|
+
const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1592
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1593
|
+
className: mx9("flex flex-col text-xs min-w-[16rem]", classNames)
|
|
1594
|
+
}, /* @__PURE__ */ React17.createElement("h1", {
|
|
1595
|
+
className: "p-2"
|
|
1596
|
+
}, t("sync status title")), /* @__PURE__ */ React17.createElement("div", {
|
|
1597
|
+
className: "flex flex-col gap-[2px] my-[2px]"
|
|
1598
|
+
}, entries.map(([spaceId, state2]) => /* @__PURE__ */ React17.createElement(SpaceRow, {
|
|
1599
|
+
key: spaceId,
|
|
1600
|
+
spaceId,
|
|
1601
|
+
state: state2
|
|
1602
|
+
}))), debug && /* @__PURE__ */ React17.createElement(SyntaxHighlighter, {
|
|
1603
|
+
language: "json"
|
|
1604
|
+
}, JSON.stringify(summary, null, 2)));
|
|
1605
|
+
};
|
|
1606
|
+
var useActive = (count) => {
|
|
1607
|
+
const [current, setCurrent] = useState10(count);
|
|
1608
|
+
const [active, setActive] = useState10(false);
|
|
1609
|
+
useEffect7(() => {
|
|
1610
|
+
let t;
|
|
1611
|
+
if (count !== current) {
|
|
1612
|
+
setActive(true);
|
|
1613
|
+
setCurrent(count);
|
|
1614
|
+
t && clearTimeout(t);
|
|
1615
|
+
t = setTimeout(() => {
|
|
1616
|
+
setActive(false);
|
|
1617
|
+
}, SYNC_STALLED_TIMEOUT);
|
|
1618
|
+
}
|
|
1619
|
+
return () => {
|
|
1620
|
+
setActive(false);
|
|
1621
|
+
clearTimeout(t);
|
|
1622
|
+
};
|
|
1623
|
+
}, [
|
|
1624
|
+
count,
|
|
1625
|
+
current
|
|
1626
|
+
]);
|
|
1627
|
+
return active;
|
|
1628
|
+
};
|
|
1629
|
+
var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
|
|
1630
|
+
const downActive = useActive(localDocumentCount);
|
|
1631
|
+
const upActive = useActive(remoteDocumentCount);
|
|
1632
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1633
|
+
className: mx9("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
|
|
1634
|
+
title: spaceId,
|
|
1635
|
+
onClick: () => {
|
|
1636
|
+
void navigator.clipboard.writeText(spaceId);
|
|
1637
|
+
}
|
|
1638
|
+
}, /* @__PURE__ */ React17.createElement(Icon2, {
|
|
1639
|
+
icon: "ph--arrow-fat-line-left--regular",
|
|
1640
|
+
size: 3,
|
|
1641
|
+
classNames: mx9(downActive && "animate-[pulse_1s_infinite]")
|
|
1642
|
+
}), /* @__PURE__ */ React17.createElement(Candle, {
|
|
1643
|
+
up: {
|
|
1644
|
+
count: remoteDocumentCount,
|
|
1645
|
+
total: remoteDocumentCount + missingOnRemote
|
|
1646
|
+
},
|
|
1647
|
+
down: {
|
|
1648
|
+
count: localDocumentCount,
|
|
1649
|
+
total: localDocumentCount + missingOnLocal
|
|
1650
|
+
},
|
|
1651
|
+
title: spaceId
|
|
1652
|
+
}), /* @__PURE__ */ React17.createElement(Icon2, {
|
|
1653
|
+
icon: "ph--arrow-fat-line-right--regular",
|
|
1654
|
+
size: 3,
|
|
1655
|
+
classNames: mx9(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1656
|
+
}));
|
|
1657
|
+
};
|
|
1658
|
+
var Candle = ({ classNames, up, down }) => {
|
|
1659
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1660
|
+
className: mx9("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1661
|
+
}, /* @__PURE__ */ React17.createElement(Bar, {
|
|
1662
|
+
classNames: "justify-end",
|
|
1663
|
+
...up
|
|
1664
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
1665
|
+
className: "relative"
|
|
1666
|
+
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1667
|
+
className: mx9("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1668
|
+
}, up.total)), /* @__PURE__ */ React17.createElement(Bar, down));
|
|
1669
|
+
};
|
|
1670
|
+
var Bar = ({ classNames, count, total }) => {
|
|
1671
|
+
let p = count / total * 100;
|
|
1672
|
+
if (count < total) {
|
|
1673
|
+
p = Math.min(p, 95);
|
|
1674
|
+
}
|
|
1675
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1676
|
+
className: mx9("relative flex w-full", styles.barBg, classNames)
|
|
1677
|
+
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1678
|
+
className: mx9("shrink-0", styles.barFg),
|
|
1679
|
+
style: {
|
|
1680
|
+
width: `${p}%`
|
|
1681
|
+
}
|
|
1682
|
+
}), count !== total && /* @__PURE__ */ React17.createElement("div", {
|
|
1683
|
+
className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
|
|
1684
|
+
}, count));
|
|
1400
1685
|
};
|
|
1401
1686
|
|
|
1402
1687
|
// packages/plugins/plugin-space/src/translations.ts
|
|
@@ -1478,21 +1763,25 @@ var translations_default = [
|
|
|
1478
1763
|
"space limit close label": "Close",
|
|
1479
1764
|
"remove deleted objects label": "Cleanup",
|
|
1480
1765
|
"remove deleted objects alt": "Permanently remove deleted objects to free up space.",
|
|
1481
|
-
"copy link label": "Copy link"
|
|
1766
|
+
"copy link label": "Copy link",
|
|
1767
|
+
"default on space create label": "On space create",
|
|
1768
|
+
"sync status title": "Sync status"
|
|
1482
1769
|
}
|
|
1483
1770
|
}
|
|
1484
1771
|
}
|
|
1485
1772
|
];
|
|
1486
1773
|
|
|
1487
1774
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
1488
|
-
var
|
|
1775
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
|
|
1489
1776
|
var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
|
|
1490
1777
|
var OBJECT_ID_LENGTH = 60;
|
|
1491
1778
|
var SPACE_MAX_OBJECTS = 500;
|
|
1492
1779
|
var DIRECTORY_TYPE = "text/directory";
|
|
1493
1780
|
var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
|
|
1494
1781
|
var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
1495
|
-
const settings = new LocalStorageStore(SPACE_PLUGIN
|
|
1782
|
+
const settings = new LocalStorageStore(SPACE_PLUGIN, {
|
|
1783
|
+
onSpaceCreate: "dxos.org/plugin/markdown/action/create"
|
|
1784
|
+
});
|
|
1496
1785
|
const state = new LocalStorageStore(SPACE_PLUGIN, {
|
|
1497
1786
|
awaiting: void 0,
|
|
1498
1787
|
spaceNames: {},
|
|
@@ -1572,8 +1861,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1572
1861
|
log2.warn("Failed to broadcast active node for presence.", {
|
|
1573
1862
|
err: err.message
|
|
1574
1863
|
}, {
|
|
1575
|
-
F:
|
|
1576
|
-
L:
|
|
1864
|
+
F: __dxlog_file5,
|
|
1865
|
+
L: 225,
|
|
1577
1866
|
S: void 0,
|
|
1578
1867
|
C: (f, a) => f(...a)
|
|
1579
1868
|
});
|
|
@@ -1682,7 +1971,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1682
1971
|
...translations_default,
|
|
1683
1972
|
osTranslations
|
|
1684
1973
|
],
|
|
1685
|
-
root: () => state.values.awaiting ? /* @__PURE__ */
|
|
1974
|
+
root: () => state.values.awaiting ? /* @__PURE__ */ React18.createElement(AwaitingObject, {
|
|
1686
1975
|
id: state.values.awaiting
|
|
1687
1976
|
}) : null,
|
|
1688
1977
|
metadata: {
|
|
@@ -1694,8 +1983,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1694
1983
|
ns: SPACE_PLUGIN
|
|
1695
1984
|
}
|
|
1696
1985
|
],
|
|
1697
|
-
icon:
|
|
1698
|
-
iconSymbol: "ph--cards-three--regular",
|
|
1986
|
+
icon: "ph--cards-three--regular",
|
|
1699
1987
|
// TODO(wittjosiah): Move out of metadata.
|
|
1700
1988
|
loadReferences: (collection) => loadObjectReferences(collection, (collection2) => [
|
|
1701
1989
|
...collection2.objects,
|
|
@@ -1715,33 +2003,34 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1715
2003
|
switch (role) {
|
|
1716
2004
|
case "article":
|
|
1717
2005
|
case "main":
|
|
1718
|
-
return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */
|
|
2006
|
+
return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React18.createElement(Surface2, {
|
|
1719
2007
|
data: {
|
|
1720
|
-
active: primary.properties[CollectionType.typename]
|
|
2008
|
+
active: primary.properties[CollectionType.typename],
|
|
2009
|
+
id: primary.id
|
|
1721
2010
|
},
|
|
1722
2011
|
role,
|
|
1723
2012
|
...rest
|
|
1724
2013
|
}) : primary instanceof CollectionType ? {
|
|
1725
|
-
node: /* @__PURE__ */
|
|
2014
|
+
node: /* @__PURE__ */ React18.createElement(CollectionMain, {
|
|
1726
2015
|
collection: primary
|
|
1727
2016
|
}),
|
|
1728
2017
|
disposition: "fallback"
|
|
1729
|
-
} : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */
|
|
2018
|
+
} : typeof primary === "string" && primary.length === OBJECT_ID_LENGTH ? /* @__PURE__ */ React18.createElement(MissingObject, {
|
|
1730
2019
|
id: primary
|
|
1731
2020
|
}) : null;
|
|
1732
2021
|
// TODO(burdon): Add role name syntax to minimal plugin docs.
|
|
1733
2022
|
case "tree--empty":
|
|
1734
2023
|
switch (true) {
|
|
1735
2024
|
case data.plugin === SPACE_PLUGIN:
|
|
1736
|
-
return /* @__PURE__ */
|
|
2025
|
+
return /* @__PURE__ */ React18.createElement(EmptyTree, null);
|
|
1737
2026
|
case (isGraphNode(data.activeNode) && isSpace2(data.activeNode.data)):
|
|
1738
|
-
return /* @__PURE__ */
|
|
2027
|
+
return /* @__PURE__ */ React18.createElement(EmptySpace, null);
|
|
1739
2028
|
default:
|
|
1740
2029
|
return null;
|
|
1741
2030
|
}
|
|
1742
2031
|
case "dialog":
|
|
1743
2032
|
if (data.component === "dxos.org/plugin/space/InvitationManagerDialog") {
|
|
1744
|
-
return /* @__PURE__ */
|
|
2033
|
+
return /* @__PURE__ */ React18.createElement(Dialog.Content, null, /* @__PURE__ */ React18.createElement(ClipboardProvider2, null, /* @__PURE__ */ React18.createElement(InvitationManager, {
|
|
1745
2034
|
active: true,
|
|
1746
2035
|
...data.subject
|
|
1747
2036
|
})));
|
|
@@ -1750,20 +2039,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1750
2039
|
}
|
|
1751
2040
|
case "popover":
|
|
1752
2041
|
if (data.component === "dxos.org/plugin/space/RenameSpacePopover" && isSpace2(data.subject)) {
|
|
1753
|
-
return /* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ React18.createElement(PopoverRenameSpace, {
|
|
1754
2043
|
space: data.subject
|
|
1755
2044
|
});
|
|
1756
2045
|
}
|
|
1757
2046
|
if (data.component === "dxos.org/plugin/space/RenameObjectPopover" && isReactiveObject2(data.subject)) {
|
|
1758
|
-
return /* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ React18.createElement(PopoverRenameObject, {
|
|
1759
2048
|
object: data.subject
|
|
1760
2049
|
});
|
|
1761
2050
|
}
|
|
1762
2051
|
return null;
|
|
1763
2052
|
case "presence--glyph": {
|
|
1764
|
-
return isReactiveObject2(data.object) ? /* @__PURE__ */
|
|
2053
|
+
return isReactiveObject2(data.object) ? /* @__PURE__ */ React18.createElement(SmallPresenceLive, {
|
|
1765
2054
|
viewers: state.values.viewersByObject[fullyQualifiedId4(data.object)]
|
|
1766
|
-
}) : /* @__PURE__ */
|
|
2055
|
+
}) : /* @__PURE__ */ React18.createElement(SmallPresence, {
|
|
1767
2056
|
count: 0
|
|
1768
2057
|
});
|
|
1769
2058
|
}
|
|
@@ -1777,30 +2066,33 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1777
2066
|
const space = isSpace2(data.object) ? data.object : getSpace4(data.object);
|
|
1778
2067
|
const object = isSpace2(data.object) ? data.object.state.get() === SpaceState3.SPACE_READY ? space?.properties[CollectionType.typename] : void 0 : data.object;
|
|
1779
2068
|
return space && object ? {
|
|
1780
|
-
node: /* @__PURE__ */
|
|
2069
|
+
node: /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SpacePresence, {
|
|
1781
2070
|
object
|
|
1782
|
-
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */
|
|
2071
|
+
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ React18.createElement(ShareSpaceButton, {
|
|
1783
2072
|
spaceId: space.id
|
|
1784
2073
|
})),
|
|
1785
2074
|
disposition: "hoist"
|
|
1786
2075
|
} : null;
|
|
1787
2076
|
}
|
|
1788
2077
|
case "section":
|
|
1789
|
-
return data.object instanceof CollectionType ? /* @__PURE__ */
|
|
2078
|
+
return data.object instanceof CollectionType ? /* @__PURE__ */ React18.createElement(CollectionSection, {
|
|
1790
2079
|
collection: data.object
|
|
1791
2080
|
}) : null;
|
|
1792
2081
|
case "settings":
|
|
1793
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */
|
|
2082
|
+
return data.plugin === meta_default.id ? /* @__PURE__ */ React18.createElement(SpaceSettings, {
|
|
1794
2083
|
settings: settings.values
|
|
1795
2084
|
}) : null;
|
|
1796
2085
|
case "menu-footer":
|
|
1797
2086
|
if (!isEchoObject2(data.object)) {
|
|
1798
2087
|
return null;
|
|
1799
2088
|
} else {
|
|
1800
|
-
return /* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ React18.createElement(MenuFooter, {
|
|
1801
2090
|
object: data.object
|
|
1802
2091
|
});
|
|
1803
2092
|
}
|
|
2093
|
+
case "status": {
|
|
2094
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SyncStatus, null), /* @__PURE__ */ React18.createElement(SaveStatus, null));
|
|
2095
|
+
}
|
|
1804
2096
|
default:
|
|
1805
2097
|
return null;
|
|
1806
2098
|
}
|
|
@@ -1860,8 +2152,8 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1860
2152
|
spacesOrder.order = nextOrder.map(({ id }) => id);
|
|
1861
2153
|
} else {
|
|
1862
2154
|
log2.warn("spaces order object not found", void 0, {
|
|
1863
|
-
F:
|
|
1864
|
-
L:
|
|
2155
|
+
F: __dxlog_file5,
|
|
2156
|
+
L: 528,
|
|
1865
2157
|
S: void 0,
|
|
1866
2158
|
C: (f, a) => f(...a)
|
|
1867
2159
|
});
|
|
@@ -1897,8 +2189,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1897
2189
|
ns: SPACE_PLUGIN
|
|
1898
2190
|
}
|
|
1899
2191
|
],
|
|
1900
|
-
icon:
|
|
1901
|
-
iconSymbol: "ph--plus--regular",
|
|
2192
|
+
icon: "ph--plus--regular",
|
|
1902
2193
|
disposition: "toolbar",
|
|
1903
2194
|
testId: "spacePlugin.createSpace"
|
|
1904
2195
|
}
|
|
@@ -1923,8 +2214,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1923
2214
|
ns: SPACE_PLUGIN
|
|
1924
2215
|
}
|
|
1925
2216
|
],
|
|
1926
|
-
icon:
|
|
1927
|
-
iconSymbol: "ph--sign-in--regular",
|
|
2217
|
+
icon: "ph--sign-in--regular",
|
|
1928
2218
|
testId: "spacePlugin.joinSpace"
|
|
1929
2219
|
}
|
|
1930
2220
|
}
|
|
@@ -2159,6 +2449,25 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2159
2449
|
}
|
|
2160
2450
|
},
|
|
2161
2451
|
intents: [
|
|
2452
|
+
...settings.values.onSpaceCreate ? [
|
|
2453
|
+
[
|
|
2454
|
+
{
|
|
2455
|
+
action: settings.values.onSpaceCreate,
|
|
2456
|
+
data: {
|
|
2457
|
+
space
|
|
2458
|
+
}
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
action: SpaceAction.ADD_OBJECT,
|
|
2462
|
+
data: {
|
|
2463
|
+
target: space
|
|
2464
|
+
}
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
action: NavigationAction3.EXPOSE
|
|
2468
|
+
}
|
|
2469
|
+
]
|
|
2470
|
+
] : [],
|
|
2162
2471
|
[
|
|
2163
2472
|
{
|
|
2164
2473
|
action: ObservabilityAction.SEND_EVENT,
|
|
@@ -2379,8 +2688,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2379
2688
|
title: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit label"],
|
|
2380
2689
|
description: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit description"],
|
|
2381
2690
|
duration: 5e3,
|
|
2382
|
-
icon:
|
|
2383
|
-
iconSymbol: "ph--warning--regular",
|
|
2691
|
+
icon: "ph--warning--regular",
|
|
2384
2692
|
actionLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects label"],
|
|
2385
2693
|
actionAlt: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects alt"],
|
|
2386
2694
|
// TODO(wittjosiah): Use OS namespace.
|
|
@@ -2422,7 +2730,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2422
2730
|
}
|
|
2423
2731
|
return {
|
|
2424
2732
|
data: {
|
|
2425
|
-
id: object
|
|
2733
|
+
id: fullyQualifiedId4(object),
|
|
2426
2734
|
object,
|
|
2427
2735
|
activeParts: {
|
|
2428
2736
|
main: [
|
|
@@ -2475,8 +2783,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2475
2783
|
data: {
|
|
2476
2784
|
activeParts: {
|
|
2477
2785
|
main: deletionData.wasActive,
|
|
2478
|
-
sidebar: deletionData.wasActive
|
|
2479
|
-
complementary: deletionData.wasActive
|
|
2786
|
+
sidebar: deletionData.wasActive
|
|
2480
2787
|
}
|
|
2481
2788
|
}
|
|
2482
2789
|
});
|
|
@@ -2600,6 +2907,7 @@ export {
|
|
|
2600
2907
|
EmptyTree,
|
|
2601
2908
|
FullPresence,
|
|
2602
2909
|
MenuFooter,
|
|
2910
|
+
MessageState,
|
|
2603
2911
|
MessageType,
|
|
2604
2912
|
MissingObject,
|
|
2605
2913
|
PersistenceStatus,
|
|
@@ -2611,6 +2919,7 @@ export {
|
|
|
2611
2919
|
SPACE_PLUGIN,
|
|
2612
2920
|
SPACE_PLUGIN_SHORT_ID,
|
|
2613
2921
|
SPACE_TYPE,
|
|
2922
|
+
SaveStatus,
|
|
2614
2923
|
ShareSpaceButton,
|
|
2615
2924
|
ShareSpaceButtonImpl,
|
|
2616
2925
|
SmallPresence,
|
|
@@ -2620,6 +2929,9 @@ export {
|
|
|
2620
2929
|
SpacePlugin,
|
|
2621
2930
|
SpacePresence,
|
|
2622
2931
|
SpaceSettings,
|
|
2932
|
+
SyncStatus,
|
|
2933
|
+
SyncStatusDetail,
|
|
2934
|
+
SyncStatusIndicator,
|
|
2623
2935
|
ThreadStatus,
|
|
2624
2936
|
ThreadType,
|
|
2625
2937
|
cloneObject,
|
|
@@ -2634,6 +2946,7 @@ export {
|
|
|
2634
2946
|
getNestedObjects,
|
|
2635
2947
|
getSpaceDisplayName,
|
|
2636
2948
|
memoizeQuery,
|
|
2949
|
+
parseSpaceInitPlugin,
|
|
2637
2950
|
parseSpacePlugin,
|
|
2638
2951
|
translations_default as translations
|
|
2639
2952
|
};
|