@dxos/plugin-space 0.6.13 → 0.6.14-main.1366248
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-LZEGRS7H.mjs → chunk-AVLRQF6L.mjs} +1 -1
- package/dist/lib/browser/chunk-AVLRQF6L.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DTVUOG2C.mjs → chunk-WZAM3FNP.mjs} +24 -5
- package/dist/lib/browser/chunk-WZAM3FNP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +852 -348
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +7 -3
- package/dist/lib/node/{chunk-CVZPI2P3.cjs → chunk-HTAM5LQD.cjs} +30 -9
- package/dist/lib/node/chunk-HTAM5LQD.cjs.map +7 -0
- package/dist/lib/node/{chunk-6CNYF6YU.cjs → chunk-P4XUXM7Y.cjs} +4 -4
- package/dist/lib/node/chunk-P4XUXM7Y.cjs.map +7 -0
- package/dist/lib/node/index.cjs +1046 -550
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +5 -5
- package/dist/lib/node/meta.cjs.map +1 -1
- 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-TRJKV4PK.mjs +116 -0
- package/dist/lib/node-esm/chunk-TRJKV4PK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YPQGKWHJ.mjs +37 -0
- package/dist/lib/node-esm/chunk-YPQGKWHJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3145 -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/DefaultObjectSettings.d.ts +7 -0
- package/dist/types/src/components/DefaultObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/MenuFooter.d.ts +1 -1
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/ShareSpaceButton.stories.d.ts +3 -91
- 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.d.ts +4 -2
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +4 -92
- 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/SpaceSettingsPanel.d.ts +7 -0
- package/dist/types/src/components/SpaceSettingsPanel.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/Space.d.ts +8 -0
- package/dist/types/src/components/SyncStatus/Space.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +14 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +9 -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/save-tracker.d.ts +3 -0
- package/dist/types/src/components/SyncStatus/save-tracker.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/status.d.ts +9 -0
- package/dist/types/src/components/SyncStatus/status.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/sync-state.d.ts +14 -0
- package/dist/types/src/components/SyncStatus/sync-state.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +14 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +15 -1
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +23 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +4 -7
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +46 -45
- package/src/SpacePlugin.tsx +275 -137
- package/src/components/DefaultObjectSettings.tsx +33 -0
- package/src/components/MenuFooter.tsx +2 -2
- package/src/components/ShareSpaceButton.stories.tsx +11 -7
- package/src/components/SpaceMain/SpaceMain.tsx +1 -22
- package/src/components/SpacePresence.stories.tsx +11 -9
- package/src/components/SpacePresence.tsx +34 -23
- package/src/components/SpaceSettings.tsx +35 -6
- package/src/components/SpaceSettingsPanel.tsx +69 -0
- package/src/components/SyncStatus/Space.tsx +109 -0
- package/src/components/SyncStatus/SyncStatus.stories.tsx +74 -0
- package/src/components/SyncStatus/SyncStatus.tsx +102 -0
- package/src/components/SyncStatus/index.ts +5 -0
- package/src/components/SyncStatus/save-tracker.ts +71 -0
- package/src/components/SyncStatus/status.ts +44 -0
- package/src/components/SyncStatus/sync-state.ts +77 -0
- package/src/components/index.ts +3 -3
- package/src/meta.ts +3 -1
- package/src/translations.ts +16 -2
- package/src/types/collection.ts +1 -1
- package/src/types/thread.ts +12 -2
- package/src/types/types.ts +31 -3
- package/src/util.tsx +23 -58
- package/dist/lib/browser/chunk-DTVUOG2C.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZEGRS7H.mjs.map +0 -7
- package/dist/lib/node/chunk-6CNYF6YU.cjs.map +0 -7
- package/dist/lib/node/chunk-CVZPI2P3.cjs.map +0 -7
- package/dist/types/src/components/EmptySpace.d.ts +0 -3
- package/dist/types/src/components/EmptySpace.d.ts.map +0 -1
- package/dist/types/src/components/EmptyTree.d.ts +0 -3
- package/dist/types/src/components/EmptyTree.d.ts.map +0 -1
- package/dist/types/src/components/MissingObject.d.ts +0 -5
- package/dist/types/src/components/MissingObject.d.ts.map +0 -1
- package/src/components/EmptySpace.tsx +0 -25
- package/src/components/EmptyTree.tsx +0 -25
- package/src/components/MissingObject.tsx +0 -54
|
@@ -3,36 +3,38 @@ import {
|
|
|
3
3
|
SPACE_PLUGIN_SHORT_ID,
|
|
4
4
|
SpaceAction,
|
|
5
5
|
meta_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AVLRQF6L.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ActorSchema,
|
|
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-WZAM3FNP.mjs";
|
|
17
19
|
|
|
18
20
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
19
|
-
import {
|
|
20
|
-
import { effect, signal } from "@preact/signals-core";
|
|
21
|
+
import { signal } from "@preact/signals-core";
|
|
21
22
|
import React17 from "react";
|
|
22
|
-
import { LayoutAction as LayoutAction2,
|
|
23
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface2, firstIdInPart, openIds, parseGraphPlugin, parseIntentPlugin as parseIntentPlugin2, parseLayoutPlugin, 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";
|
|
26
|
+
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
25
27
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
26
|
-
import { log as
|
|
28
|
+
import { log as log3 } from "@dxos/log";
|
|
27
29
|
import { Migrations as Migrations2 } from "@dxos/migrations";
|
|
28
30
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
29
31
|
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
30
|
-
import { createExtension,
|
|
32
|
+
import { createExtension, memoize as memoize2, toSignal } from "@dxos/plugin-graph";
|
|
31
33
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
32
34
|
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
33
|
-
import {
|
|
35
|
+
import { Expando, Filter, SpaceState as SpaceState3, create as create2, fullyQualifiedId as fullyQualifiedId4, getSpace as getSpace4, getTypename as getTypename2, isEchoObject as isEchoObject2, isSpace as isSpace2, loadObjectReferences, parseId, FQ_ID_LENGTH } from "@dxos/react-client/echo";
|
|
34
36
|
import { Dialog } from "@dxos/react-ui";
|
|
35
|
-
import {
|
|
37
|
+
import { ClipboardProvider as ClipboardProvider2, InvitationManager, osTranslations } from "@dxos/shell/react";
|
|
36
38
|
import { ComplexMap as ComplexMap2, nonNullable, reduceGroupBy } from "@dxos/util";
|
|
37
39
|
|
|
38
40
|
// packages/plugins/plugin-space/src/components/AwaitingObject.tsx
|
|
@@ -158,46 +160,37 @@ var CollectionSection = ({ collection }) => {
|
|
|
158
160
|
}, collection.name ?? t("unnamed collection label")));
|
|
159
161
|
};
|
|
160
162
|
|
|
161
|
-
// packages/plugins/plugin-space/src/components/
|
|
163
|
+
// packages/plugins/plugin-space/src/components/DefaultObjectSettings.tsx
|
|
162
164
|
import React4 from "react";
|
|
163
|
-
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
164
|
-
|
|
165
|
-
var EmptySpace = () => {
|
|
165
|
+
import { Input, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
166
|
+
var DefaultObjectSettings = ({ object }) => {
|
|
166
167
|
const { t } = useTranslation4(SPACE_PLUGIN);
|
|
167
168
|
return /* @__PURE__ */ React4.createElement("div", {
|
|
168
|
-
role: "
|
|
169
|
-
className:
|
|
170
|
-
}, t("
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var EmptyTree = () => {
|
|
178
|
-
const { t } = useTranslation5(SPACE_PLUGIN);
|
|
179
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
180
|
-
role: "none",
|
|
181
|
-
className: mx4("p-2 mli-2 mbe-2 text-center border border-dashed border-neutral-400/50 rounded-lg", descriptionText3)
|
|
182
|
-
}, t("empty tree message"));
|
|
169
|
+
role: "form",
|
|
170
|
+
className: "flex flex-col w-full p-2 gap-1"
|
|
171
|
+
}, /* @__PURE__ */ React4.createElement(Input.Root, null, /* @__PURE__ */ React4.createElement(Input.Label, null, t("name label")), /* @__PURE__ */ React4.createElement(Input.TextInput, {
|
|
172
|
+
placeholder: t("name placeholder"),
|
|
173
|
+
value: object.name ?? "",
|
|
174
|
+
onChange: (event) => {
|
|
175
|
+
object.name = event.target.value;
|
|
176
|
+
}
|
|
177
|
+
})));
|
|
183
178
|
};
|
|
184
179
|
|
|
185
180
|
// packages/plugins/plugin-space/src/components/MenuFooter.tsx
|
|
186
|
-
import { Planet
|
|
187
|
-
import
|
|
181
|
+
import { Planet } from "@phosphor-icons/react";
|
|
182
|
+
import React5 from "react";
|
|
188
183
|
import { getSpace as getSpace2 } from "@dxos/client/echo";
|
|
189
184
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
190
|
-
import { DropdownMenu, toLocalizedString, useTranslation as
|
|
185
|
+
import { DropdownMenu, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
191
186
|
|
|
192
187
|
// 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
188
|
import { NavigationAction as NavigationAction2 } from "@dxos/app-framework";
|
|
196
|
-
import { create, isReactiveObject, getTypename, getSchema,
|
|
189
|
+
import { create, isReactiveObject, getTypename, getSchema, getObjectAnnotation, EXPANDO_TYPENAME } from "@dxos/echo-schema";
|
|
197
190
|
import { invariant } from "@dxos/invariant";
|
|
198
191
|
import { Migrations } from "@dxos/migrations";
|
|
199
192
|
import { ACTION_TYPE, ACTION_GROUP_TYPE, actionGroupSymbol, getGraph, cleanup, memoize } from "@dxos/plugin-graph";
|
|
200
|
-
import {
|
|
193
|
+
import { fullyQualifiedId as fullyQualifiedId2, getSpace, isEchoObject, isSpace, SpaceState } from "@dxos/react-client/echo";
|
|
201
194
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/util.tsx";
|
|
202
195
|
var SPACES = `${SPACE_PLUGIN}-spaces`;
|
|
203
196
|
var SPACE_TYPE = "dxos.org/type/Space";
|
|
@@ -252,7 +245,7 @@ var getCollectionGraphNodePartials = ({ collection, space, resolve }) => {
|
|
|
252
245
|
}
|
|
253
246
|
},
|
|
254
247
|
onCopy: async (child, index) => {
|
|
255
|
-
const newObject = await cloneObject(child.data, resolve);
|
|
248
|
+
const newObject = await cloneObject(child.data, resolve, space);
|
|
256
249
|
space.db.add(newObject);
|
|
257
250
|
if (typeof index !== "undefined") {
|
|
258
251
|
collection.objects.splice(index, 0, newObject);
|
|
@@ -284,8 +277,7 @@ var constructSpaceNode = ({ space, personal, namesCache, resolve }) => {
|
|
|
284
277
|
namesCache
|
|
285
278
|
}),
|
|
286
279
|
description: space.state.get() === SpaceState.SPACE_READY && space.properties.description,
|
|
287
|
-
icon:
|
|
288
|
-
iconSymbol: "ph--planet--regular",
|
|
280
|
+
icon: "ph--planet--regular",
|
|
289
281
|
disabled: space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
290
282
|
testId: "spacePlugin.space"
|
|
291
283
|
}
|
|
@@ -311,8 +303,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
311
303
|
ns: SPACE_PLUGIN
|
|
312
304
|
}
|
|
313
305
|
],
|
|
314
|
-
icon:
|
|
315
|
-
iconSymbol: "ph--plus--regular",
|
|
306
|
+
icon: "ph--plus--regular",
|
|
316
307
|
disposition: "toolbar",
|
|
317
308
|
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
318
309
|
// mainAreaDisposition: 'in-flow',
|
|
@@ -346,8 +337,7 @@ var constructSpaceActionGroups = ({ space, dispatch }) => {
|
|
|
346
337
|
ns: SPACE_PLUGIN
|
|
347
338
|
}
|
|
348
339
|
],
|
|
349
|
-
icon:
|
|
350
|
-
iconSymbol: "ph--cards-three--regular",
|
|
340
|
+
icon: "ph--cards-three--regular",
|
|
351
341
|
testId: "spacePlugin.createCollection"
|
|
352
342
|
}
|
|
353
343
|
}
|
|
@@ -381,8 +371,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
381
371
|
ns: SPACE_PLUGIN
|
|
382
372
|
}
|
|
383
373
|
],
|
|
384
|
-
icon:
|
|
385
|
-
iconSymbol: "ph--database--regular",
|
|
374
|
+
icon: "ph--database--regular",
|
|
386
375
|
disposition: "toolbar",
|
|
387
376
|
mainAreaDisposition: "in-flow",
|
|
388
377
|
disabled: migrating || Migrations.running(space)
|
|
@@ -413,8 +402,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
413
402
|
ns: SPACE_PLUGIN
|
|
414
403
|
}
|
|
415
404
|
],
|
|
416
|
-
icon:
|
|
417
|
-
iconSymbol: "ph--users--regular",
|
|
405
|
+
icon: "ph--users--regular",
|
|
418
406
|
disabled: locked,
|
|
419
407
|
keyBinding: {
|
|
420
408
|
macos: "meta+.",
|
|
@@ -441,8 +429,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
441
429
|
ns: SPACE_PLUGIN
|
|
442
430
|
}
|
|
443
431
|
],
|
|
444
|
-
icon: locked ?
|
|
445
|
-
iconSymbol: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
432
|
+
icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
446
433
|
}
|
|
447
434
|
}, {
|
|
448
435
|
id: getId(SpaceAction.RENAME),
|
|
@@ -464,8 +451,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
464
451
|
ns: SPACE_PLUGIN
|
|
465
452
|
}
|
|
466
453
|
],
|
|
467
|
-
icon:
|
|
468
|
-
iconSymbol: "ph--pencil-simple-line--regular",
|
|
454
|
+
icon: "ph--pencil-simple-line--regular",
|
|
469
455
|
keyBinding: {
|
|
470
456
|
macos: "shift+F6",
|
|
471
457
|
windows: "shift+F6"
|
|
@@ -494,8 +480,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
494
480
|
ns: SPACE_PLUGIN
|
|
495
481
|
}
|
|
496
482
|
],
|
|
497
|
-
icon:
|
|
498
|
-
iconSymbol: "ph--x--regular",
|
|
483
|
+
icon: "ph--x--regular",
|
|
499
484
|
mainAreaDisposition: "menu",
|
|
500
485
|
disabled: personal
|
|
501
486
|
}
|
|
@@ -521,8 +506,7 @@ var constructSpaceActions = ({ space, dispatch, personal, migrating }) => {
|
|
|
521
506
|
ns: SPACE_PLUGIN
|
|
522
507
|
}
|
|
523
508
|
],
|
|
524
|
-
icon:
|
|
525
|
-
iconSymbol: "ph--clock-counter-clockwise--regular",
|
|
509
|
+
icon: "ph--clock-counter-clockwise--regular",
|
|
526
510
|
disposition: "toolbar",
|
|
527
511
|
mainAreaDisposition: "in-flow"
|
|
528
512
|
}
|
|
@@ -556,8 +540,7 @@ var createObjectNode = ({ object, space, resolve }) => {
|
|
|
556
540
|
ns: SPACE_PLUGIN
|
|
557
541
|
}
|
|
558
542
|
],
|
|
559
|
-
icon: metadata.icon ??
|
|
560
|
-
iconSymbol: metadata.iconSymbol ?? "ph--placeholder--regular",
|
|
543
|
+
icon: metadata.icon ?? "ph--placeholder--regular",
|
|
561
544
|
testId: "spacePlugin.object",
|
|
562
545
|
persistenceClass: "echo",
|
|
563
546
|
persistenceKey: space?.id
|
|
@@ -582,8 +565,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
582
565
|
ns: SPACE_PLUGIN
|
|
583
566
|
}
|
|
584
567
|
],
|
|
585
|
-
icon:
|
|
586
|
-
iconSymbol: "ph--plus--regular",
|
|
568
|
+
icon: "ph--plus--regular",
|
|
587
569
|
disposition: "toolbar",
|
|
588
570
|
// TODO(wittjosiah): This is currently a navtree feature. Address this with cmd+k integration.
|
|
589
571
|
// mainAreaDisposition: 'in-flow',
|
|
@@ -617,8 +599,7 @@ var constructObjectActionGroups = ({ object, dispatch }) => {
|
|
|
617
599
|
ns: SPACE_PLUGIN
|
|
618
600
|
}
|
|
619
601
|
],
|
|
620
|
-
icon:
|
|
621
|
-
iconSymbol: "ph--cards-three--regular",
|
|
602
|
+
icon: "ph--cards-three--regular",
|
|
622
603
|
testId: "spacePlugin.createCollection"
|
|
623
604
|
}
|
|
624
605
|
}
|
|
@@ -650,8 +631,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
650
631
|
ns: SPACE_PLUGIN
|
|
651
632
|
}
|
|
652
633
|
],
|
|
653
|
-
icon:
|
|
654
|
-
iconSymbol: "ph--pencil-simple-line--regular",
|
|
634
|
+
icon: "ph--pencil-simple-line--regular",
|
|
655
635
|
// TODO(wittjosiah): Doesn't work.
|
|
656
636
|
// keyBinding: 'shift+F6',
|
|
657
637
|
testId: "spacePlugin.renameObject"
|
|
@@ -682,8 +662,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
682
662
|
ns: SPACE_PLUGIN
|
|
683
663
|
}
|
|
684
664
|
],
|
|
685
|
-
icon:
|
|
686
|
-
iconSymbol: "ph--trash--regular",
|
|
665
|
+
icon: "ph--trash--regular",
|
|
687
666
|
keyBinding: object instanceof CollectionType ? void 0 : "shift+meta+Backspace",
|
|
688
667
|
testId: "spacePlugin.deleteObject"
|
|
689
668
|
}
|
|
@@ -702,8 +681,7 @@ var constructObjectActions = ({ node, dispatch }) => {
|
|
|
702
681
|
ns: SPACE_PLUGIN
|
|
703
682
|
}
|
|
704
683
|
],
|
|
705
|
-
icon:
|
|
706
|
-
iconSymbol: "ph--link--regular",
|
|
684
|
+
icon: "ph--link--regular",
|
|
707
685
|
testId: "spacePlugin.copyLink"
|
|
708
686
|
}
|
|
709
687
|
}
|
|
@@ -737,14 +715,14 @@ var getNestedObjects = async (object, resolve) => {
|
|
|
737
715
|
...nested.flat()
|
|
738
716
|
];
|
|
739
717
|
};
|
|
740
|
-
var cloneObject = async (object, resolve) => {
|
|
718
|
+
var cloneObject = async (object, resolve, newSpace) => {
|
|
741
719
|
const schema = getSchema(object);
|
|
742
|
-
const typename = schema ?
|
|
720
|
+
const typename = schema ? getObjectAnnotation(schema)?.typename ?? EXPANDO_TYPENAME : EXPANDO_TYPENAME;
|
|
743
721
|
const metadata = resolve(typename);
|
|
744
722
|
const serializer = metadata.serializer;
|
|
745
723
|
invariant(serializer, `No serializer for type: ${typename}`, {
|
|
746
724
|
F: __dxlog_file,
|
|
747
|
-
L:
|
|
725
|
+
L: 604,
|
|
748
726
|
S: void 0,
|
|
749
727
|
A: [
|
|
750
728
|
"serializer",
|
|
@@ -756,89 +734,49 @@ var cloneObject = async (object, resolve) => {
|
|
|
756
734
|
});
|
|
757
735
|
return serializer.deserialize({
|
|
758
736
|
content,
|
|
737
|
+
space: newSpace,
|
|
759
738
|
newId: true
|
|
760
739
|
});
|
|
761
740
|
};
|
|
762
741
|
|
|
763
742
|
// packages/plugins/plugin-space/src/components/MenuFooter.tsx
|
|
764
743
|
var MenuFooter = ({ object }) => {
|
|
765
|
-
const { t } =
|
|
744
|
+
const { t } = useTranslation5(SPACE_PLUGIN);
|
|
766
745
|
const client = useClient2();
|
|
767
746
|
const space = getSpace2(object);
|
|
768
747
|
const spaceName = space ? getSpaceDisplayName(space, {
|
|
769
748
|
personal: client.spaces.default === space
|
|
770
749
|
}) : "";
|
|
771
|
-
return space ? /* @__PURE__ */
|
|
750
|
+
return space ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React5.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React5.createElement("dl", {
|
|
772
751
|
className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
|
|
773
|
-
}, /* @__PURE__ */
|
|
752
|
+
}, /* @__PURE__ */ React5.createElement("dt", {
|
|
774
753
|
className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
|
|
775
|
-
}, t("location label")), /* @__PURE__ */
|
|
754
|
+
}, t("location label")), /* @__PURE__ */ React5.createElement("dd", {
|
|
776
755
|
className: "line-clamp-3"
|
|
777
|
-
}, /* @__PURE__ */
|
|
756
|
+
}, /* @__PURE__ */ React5.createElement(Planet, {
|
|
778
757
|
className: "inline-block mie-1"
|
|
779
758
|
}), toLocalizedString(spaceName, t)))) : null;
|
|
780
759
|
};
|
|
781
760
|
|
|
782
|
-
// packages/plugins/plugin-space/src/components/MissingObject.tsx
|
|
783
|
-
import React8, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
784
|
-
import { parseIntentPlugin as parseIntentPlugin2, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
|
|
785
|
-
import { Status, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
786
|
-
import { baseSurface as baseSurface2, descriptionText as descriptionText4, mx as mx5 } from "@dxos/react-ui-theme";
|
|
787
|
-
var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
|
|
788
|
-
var MissingObject = ({ id }) => {
|
|
789
|
-
const { t } = useTranslation7(SPACE_PLUGIN);
|
|
790
|
-
const [waiting, setWaiting] = useState2(false);
|
|
791
|
-
const intentPlugin = useResolvePlugin2(parseIntentPlugin2);
|
|
792
|
-
useEffect2(() => {
|
|
793
|
-
if (!intentPlugin) {
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
const timeout = setTimeout(async () => {
|
|
797
|
-
setWaiting(true);
|
|
798
|
-
await intentPlugin.provides.intent.dispatch({
|
|
799
|
-
plugin: SPACE_PLUGIN,
|
|
800
|
-
action: SpaceAction.WAIT_FOR_OBJECT,
|
|
801
|
-
data: {
|
|
802
|
-
id
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
}, WAIT_FOR_OBJECT_TIMEOUT2);
|
|
806
|
-
return () => clearTimeout(timeout);
|
|
807
|
-
}, [
|
|
808
|
-
intentPlugin,
|
|
809
|
-
id
|
|
810
|
-
]);
|
|
811
|
-
return /* @__PURE__ */ React8.createElement("div", {
|
|
812
|
-
role: "none",
|
|
813
|
-
className: mx5(baseSurface2, "min-bs-screen is-full flex items-center justify-center p-8")
|
|
814
|
-
}, waiting ? /* @__PURE__ */ React8.createElement("p", {
|
|
815
|
-
role: "alert",
|
|
816
|
-
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__ */ React8.createElement(Status, {
|
|
818
|
-
indeterminate: true,
|
|
819
|
-
"aria-label": "Initializing"
|
|
820
|
-
}));
|
|
821
|
-
};
|
|
822
|
-
|
|
823
761
|
// packages/plugins/plugin-space/src/components/PersistenceStatus.tsx
|
|
824
762
|
import { ArrowsCounterClockwise, CheckCircle as CheckCircle2, Warning } from "@phosphor-icons/react";
|
|
825
|
-
import
|
|
763
|
+
import React6, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
826
764
|
import { debounce } from "@dxos/async";
|
|
827
|
-
import { Tooltip, useTranslation as
|
|
828
|
-
import { getSize as getSize2, mx as
|
|
829
|
-
var
|
|
830
|
-
(function(
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
})(
|
|
765
|
+
import { Tooltip, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
766
|
+
import { getSize as getSize2, mx as mx3, staticPlaceholderText, warningText } from "@dxos/react-ui-theme";
|
|
767
|
+
var Status;
|
|
768
|
+
(function(Status2) {
|
|
769
|
+
Status2[Status2["PERSISTED_LOCALLY"] = 0] = "PERSISTED_LOCALLY";
|
|
770
|
+
Status2[Status2["PENDING"] = 1] = "PENDING";
|
|
771
|
+
Status2[Status2["ERROR"] = 2] = "ERROR";
|
|
772
|
+
})(Status || (Status = {}));
|
|
835
773
|
var PersistenceStatus = ({ db }) => {
|
|
836
|
-
const { t } =
|
|
837
|
-
const [displayMessage, setDisplayMessage] =
|
|
838
|
-
const [status, naturalSetStatus] =
|
|
839
|
-
const [prevStatus, setPrevStatus] =
|
|
774
|
+
const { t } = useTranslation6(SPACE_PLUGIN);
|
|
775
|
+
const [displayMessage, setDisplayMessage] = useState2(false);
|
|
776
|
+
const [status, naturalSetStatus] = useState2(0);
|
|
777
|
+
const [prevStatus, setPrevStatus] = useState2(0);
|
|
840
778
|
const _setStatus = debounce(naturalSetStatus, 500);
|
|
841
|
-
|
|
779
|
+
useEffect2(() => {
|
|
842
780
|
setPrevStatus(status);
|
|
843
781
|
if (prevStatus !== status && status === 0) {
|
|
844
782
|
setDisplayMessage(true);
|
|
@@ -850,48 +788,48 @@ var PersistenceStatus = ({ db }) => {
|
|
|
850
788
|
]);
|
|
851
789
|
switch (status) {
|
|
852
790
|
case 2:
|
|
853
|
-
return /* @__PURE__ */
|
|
791
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
854
792
|
className: "flex items-center"
|
|
855
|
-
}, /* @__PURE__ */
|
|
856
|
-
className:
|
|
857
|
-
}), /* @__PURE__ */
|
|
858
|
-
className:
|
|
793
|
+
}, /* @__PURE__ */ React6.createElement(Warning, {
|
|
794
|
+
className: mx3(getSize2(4), "me-1")
|
|
795
|
+
}), /* @__PURE__ */ React6.createElement("span", {
|
|
796
|
+
className: mx3("text-sm", warningText)
|
|
859
797
|
}, t("persistence error label")));
|
|
860
798
|
case 1:
|
|
861
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
862
800
|
className: "flex items-center"
|
|
863
|
-
}, /* @__PURE__ */
|
|
864
|
-
className:
|
|
865
|
-
}), /* @__PURE__ */
|
|
866
|
-
className:
|
|
801
|
+
}, /* @__PURE__ */ React6.createElement(ArrowsCounterClockwise, {
|
|
802
|
+
className: mx3(getSize2(4), "me-1")
|
|
803
|
+
}), /* @__PURE__ */ React6.createElement("span", {
|
|
804
|
+
className: mx3("text-sm", staticPlaceholderText)
|
|
867
805
|
}, t("persistence pending label")));
|
|
868
806
|
case 0:
|
|
869
807
|
default:
|
|
870
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ React6.createElement(Tooltip.Root, {
|
|
871
809
|
delayDuration: 400
|
|
872
|
-
}, /* @__PURE__ */
|
|
810
|
+
}, /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
|
|
873
811
|
role: "status",
|
|
874
812
|
className: "flex items-center"
|
|
875
|
-
}, /* @__PURE__ */
|
|
876
|
-
className:
|
|
877
|
-
}), displayMessage && /* @__PURE__ */
|
|
878
|
-
className:
|
|
879
|
-
}, t("persisted locally label"))), /* @__PURE__ */
|
|
813
|
+
}, /* @__PURE__ */ React6.createElement(CheckCircle2, {
|
|
814
|
+
className: mx3(getSize2(4), "me-1")
|
|
815
|
+
}), displayMessage && /* @__PURE__ */ React6.createElement("span", {
|
|
816
|
+
className: mx3("text-sm", staticPlaceholderText)
|
|
817
|
+
}, t("persisted locally label"))), /* @__PURE__ */ React6.createElement(Tooltip.Portal, null, /* @__PURE__ */ React6.createElement(Tooltip.Content, {
|
|
880
818
|
classNames: "z-10"
|
|
881
|
-
}, t("persisted locally message"), /* @__PURE__ */
|
|
819
|
+
}, t("persisted locally message"), /* @__PURE__ */ React6.createElement(Tooltip.Arrow, null))));
|
|
882
820
|
}
|
|
883
821
|
};
|
|
884
822
|
|
|
885
823
|
// packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx
|
|
886
|
-
import
|
|
824
|
+
import React7, { useCallback, useRef, useState as useState3 } from "react";
|
|
887
825
|
import { log } from "@dxos/log";
|
|
888
|
-
import { Button as Button2, Input, Popover, useTranslation as
|
|
826
|
+
import { Button as Button2, Input as Input2, Popover, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
889
827
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
890
828
|
var PopoverRenameObject = ({ object: obj }) => {
|
|
891
|
-
const { t } =
|
|
829
|
+
const { t } = useTranslation7(SPACE_PLUGIN);
|
|
892
830
|
const doneButton = useRef(null);
|
|
893
831
|
const object = obj;
|
|
894
|
-
const [name, setName] =
|
|
832
|
+
const [name, setName] = useState3(object.name || object.title || "");
|
|
895
833
|
const handleDone = useCallback(() => {
|
|
896
834
|
try {
|
|
897
835
|
object.name = name;
|
|
@@ -913,23 +851,23 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
913
851
|
object,
|
|
914
852
|
name
|
|
915
853
|
]);
|
|
916
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
917
855
|
role: "none",
|
|
918
856
|
className: "p-1 flex gap-2"
|
|
919
|
-
}, /* @__PURE__ */
|
|
857
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
920
858
|
role: "none",
|
|
921
859
|
className: "flex-1"
|
|
922
|
-
}, /* @__PURE__ */
|
|
860
|
+
}, /* @__PURE__ */ React7.createElement(Input2.Root, null, /* @__PURE__ */ React7.createElement(Input2.Label, {
|
|
923
861
|
srOnly: true
|
|
924
|
-
}, t("object name label")), /* @__PURE__ */
|
|
862
|
+
}, t("object name label")), /* @__PURE__ */ React7.createElement(Input2.TextInput, {
|
|
925
863
|
placeholder: t("object title placeholder"),
|
|
926
864
|
value: name,
|
|
927
865
|
"data-testid": "spacePlugin.renameObject.input",
|
|
928
866
|
onChange: ({ target: { value } }) => setName(value),
|
|
929
867
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
930
|
-
}))), /* @__PURE__ */
|
|
868
|
+
}))), /* @__PURE__ */ React7.createElement(Popover.Close, {
|
|
931
869
|
asChild: true
|
|
932
|
-
}, /* @__PURE__ */
|
|
870
|
+
}, /* @__PURE__ */ React7.createElement(Button2, {
|
|
933
871
|
ref: doneButton,
|
|
934
872
|
classNames: "self-stretch",
|
|
935
873
|
onClick: handleDone
|
|
@@ -939,36 +877,36 @@ var PopoverRenameObject = ({ object: obj }) => {
|
|
|
939
877
|
};
|
|
940
878
|
|
|
941
879
|
// packages/plugins/plugin-space/src/components/PopoverRenameSpace.tsx
|
|
942
|
-
import
|
|
943
|
-
import { Button as Button3, Input as
|
|
880
|
+
import React8, { useCallback as useCallback2, useRef as useRef2, useState as useState4 } from "react";
|
|
881
|
+
import { Button as Button3, Input as Input3, Popover as Popover2, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
944
882
|
var PopoverRenameSpace = ({ space }) => {
|
|
945
|
-
const { t } =
|
|
883
|
+
const { t } = useTranslation8(SPACE_PLUGIN);
|
|
946
884
|
const doneButton = useRef2(null);
|
|
947
|
-
const [name, setName] =
|
|
885
|
+
const [name, setName] = useState4(space.properties.name ?? "");
|
|
948
886
|
const handleDone = useCallback2(() => {
|
|
949
887
|
space.properties.name = name;
|
|
950
888
|
}, [
|
|
951
889
|
space,
|
|
952
890
|
name
|
|
953
891
|
]);
|
|
954
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
955
893
|
role: "none",
|
|
956
894
|
className: "p-1 flex gap-2"
|
|
957
|
-
}, /* @__PURE__ */
|
|
895
|
+
}, /* @__PURE__ */ React8.createElement("div", {
|
|
958
896
|
role: "none",
|
|
959
897
|
className: "flex-1"
|
|
960
|
-
}, /* @__PURE__ */
|
|
898
|
+
}, /* @__PURE__ */ React8.createElement(Input3.Root, null, /* @__PURE__ */ React8.createElement(Input3.Label, {
|
|
961
899
|
srOnly: true
|
|
962
|
-
}, t("space name label")), /* @__PURE__ */
|
|
900
|
+
}, t("space name label")), /* @__PURE__ */ React8.createElement(Input3.TextInput, {
|
|
963
901
|
defaultValue: space.properties.name ?? "",
|
|
964
902
|
placeholder: t("unnamed space label"),
|
|
965
903
|
onChange: ({ target: { value } }) => setName(value),
|
|
966
904
|
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
967
905
|
// Currently this is not possible because Radix does not expose the popover context.
|
|
968
906
|
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
969
|
-
}))), /* @__PURE__ */
|
|
907
|
+
}))), /* @__PURE__ */ React8.createElement(Popover2.Close, {
|
|
970
908
|
asChild: true
|
|
971
|
-
}, /* @__PURE__ */
|
|
909
|
+
}, /* @__PURE__ */ React8.createElement(Button3, {
|
|
972
910
|
ref: doneButton,
|
|
973
911
|
classNames: "self-stretch",
|
|
974
912
|
onClick: handleDone
|
|
@@ -978,12 +916,12 @@ var PopoverRenameSpace = ({ space }) => {
|
|
|
978
916
|
};
|
|
979
917
|
|
|
980
918
|
// packages/plugins/plugin-space/src/components/ShareSpaceButton.tsx
|
|
981
|
-
import
|
|
919
|
+
import React9 from "react";
|
|
982
920
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
983
|
-
import { Button as Button4, useTranslation as
|
|
921
|
+
import { Button as Button4, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
984
922
|
var ShareSpaceButton = ({ spaceId }) => {
|
|
985
923
|
const dispatch = useIntentDispatcher();
|
|
986
|
-
return /* @__PURE__ */
|
|
924
|
+
return /* @__PURE__ */ React9.createElement(ShareSpaceButtonImpl, {
|
|
987
925
|
onClick: () => dispatch({
|
|
988
926
|
action: SpaceAction.SHARE,
|
|
989
927
|
data: {
|
|
@@ -993,8 +931,8 @@ var ShareSpaceButton = ({ spaceId }) => {
|
|
|
993
931
|
});
|
|
994
932
|
};
|
|
995
933
|
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
996
|
-
const { t } =
|
|
997
|
-
return /* @__PURE__ */
|
|
934
|
+
const { t } = useTranslation9(SPACE_PLUGIN);
|
|
935
|
+
return /* @__PURE__ */ React9.createElement(Button4, {
|
|
998
936
|
"data-testid": "spacePlugin.shareSpaceButton",
|
|
999
937
|
onClick,
|
|
1000
938
|
classNames: "mli-1"
|
|
@@ -1003,30 +941,30 @@ var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
|
1003
941
|
|
|
1004
942
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
1005
943
|
import { Command } from "@phosphor-icons/react";
|
|
1006
|
-
import
|
|
944
|
+
import React11 from "react";
|
|
1007
945
|
import { Surface } from "@dxos/app-framework";
|
|
1008
946
|
import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
|
|
1009
|
-
import {
|
|
1010
|
-
import { getSize as getSize4, mx as
|
|
947
|
+
import { Main, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
948
|
+
import { getSize as getSize4, mx as mx5, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
|
|
1011
949
|
import { ClipboardProvider } from "@dxos/shell/react";
|
|
1012
950
|
|
|
1013
951
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMembersSection.tsx
|
|
1014
952
|
import { CaretDown, Check, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
1015
|
-
import
|
|
953
|
+
import React10, { useCallback as useCallback3, useState as useState5 } from "react";
|
|
1016
954
|
import { LayoutAction, useIntent } from "@dxos/app-framework";
|
|
1017
955
|
import { useMembers, SpaceMember, useSpaceInvitations } from "@dxos/react-client/echo";
|
|
1018
956
|
import { InvitationEncoder } from "@dxos/react-client/invitations";
|
|
1019
957
|
import { Invitation } from "@dxos/react-client/invitations";
|
|
1020
|
-
import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as
|
|
1021
|
-
import { descriptionText as
|
|
958
|
+
import { Button as Button5, ButtonGroup, DropdownMenu as DropdownMenu2, List, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
959
|
+
import { descriptionText as descriptionText2, getSize as getSize3, mx as mx4 } from "@dxos/react-ui-theme";
|
|
1022
960
|
import { InvitationListItem, IdentityListItem } from "@dxos/shell/react";
|
|
1023
961
|
var activeActionKeyStorageKey = "dxos:react-shell/space-manager/active-action";
|
|
1024
962
|
var Presence = SpaceMember.PresenceState;
|
|
1025
963
|
var handleCreateInvitationUrl = (invitationCode) => `${origin}?spaceInvitationCode=${invitationCode}`;
|
|
1026
964
|
var SpaceMemberList = ({ members }) => {
|
|
1027
|
-
return members.length > 0 ? /* @__PURE__ */
|
|
965
|
+
return members.length > 0 ? /* @__PURE__ */ React10.createElement(List, {
|
|
1028
966
|
classNames: "col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center"
|
|
1029
|
-
}, members.map((member) => /* @__PURE__ */
|
|
967
|
+
}, members.map((member) => /* @__PURE__ */ React10.createElement(IdentityListItem, {
|
|
1030
968
|
classNames: "contents",
|
|
1031
969
|
key: member.identity.identityKey.toHex(),
|
|
1032
970
|
identity: member.identity,
|
|
@@ -1034,7 +972,7 @@ var SpaceMemberList = ({ members }) => {
|
|
|
1034
972
|
}))) : null;
|
|
1035
973
|
};
|
|
1036
974
|
var SpaceMembersSection = ({ space }) => {
|
|
1037
|
-
const { t } =
|
|
975
|
+
const { t } = useTranslation10(SPACE_PLUGIN);
|
|
1038
976
|
const invitations = useSpaceInvitations(space.key);
|
|
1039
977
|
const { dispatch } = useIntent();
|
|
1040
978
|
const handleCloseDialog = () => dispatch({
|
|
@@ -1099,7 +1037,7 @@ var SpaceMembersSection = ({ space }) => {
|
|
|
1099
1037
|
])
|
|
1100
1038
|
}
|
|
1101
1039
|
};
|
|
1102
|
-
const [activeActionKey, setInternalActiveActionKey] =
|
|
1040
|
+
const [activeActionKey, setInternalActiveActionKey] = useState5(localStorage.getItem(activeActionKeyStorageKey) ?? "inviteOne");
|
|
1103
1041
|
const setActiveActionKey = (nextKey) => {
|
|
1104
1042
|
setInternalActiveActionKey(nextKey);
|
|
1105
1043
|
localStorage.setItem(activeActionKeyStorageKey, nextKey);
|
|
@@ -1112,103 +1050,103 @@ var SpaceMembersSection = ({ space }) => {
|
|
|
1112
1050
|
[Presence.ONLINE]: [],
|
|
1113
1051
|
[Presence.OFFLINE]: []
|
|
1114
1052
|
});
|
|
1115
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ React10.createElement("section", {
|
|
1116
1054
|
className: "mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min"
|
|
1117
|
-
}, /* @__PURE__ */
|
|
1055
|
+
}, /* @__PURE__ */ React10.createElement("h2", {
|
|
1118
1056
|
className: "contents"
|
|
1119
|
-
}, /* @__PURE__ */
|
|
1057
|
+
}, /* @__PURE__ */ React10.createElement(UsersThree, {
|
|
1120
1058
|
weight: "duotone",
|
|
1121
|
-
className:
|
|
1122
|
-
}), /* @__PURE__ */
|
|
1059
|
+
className: mx4(getSize3(5), "place-self-center")
|
|
1060
|
+
}), /* @__PURE__ */ React10.createElement("span", {
|
|
1123
1061
|
className: "text-lg col-span-2"
|
|
1124
|
-
}, t("space members label"))), /* @__PURE__ */
|
|
1062
|
+
}, t("space members label"))), /* @__PURE__ */ React10.createElement("h3", {
|
|
1125
1063
|
className: "col-start-2 col-span-3 text-sm italic text-description"
|
|
1126
|
-
}, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */
|
|
1064
|
+
}, t("invitations heading")), invitations.length > 0 && /* @__PURE__ */ React10.createElement(List, {
|
|
1127
1065
|
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__ */
|
|
1066
|
+
}, invitations.map((invitation) => /* @__PURE__ */ React10.createElement(InvitationListItem, {
|
|
1129
1067
|
reverseEffects: true,
|
|
1130
1068
|
classNames: "pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid",
|
|
1131
1069
|
key: invitation.get().invitationId,
|
|
1132
1070
|
invitation,
|
|
1133
1071
|
send: handleInvitationSelect,
|
|
1134
1072
|
createInvitationUrl: handleCreateInvitationUrl
|
|
1135
|
-
}))), /* @__PURE__ */
|
|
1073
|
+
}))), /* @__PURE__ */ React10.createElement(ButtonGroup, {
|
|
1136
1074
|
classNames: "col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px"
|
|
1137
|
-
}, /* @__PURE__ */
|
|
1075
|
+
}, /* @__PURE__ */ React10.createElement(Button5, {
|
|
1138
1076
|
classNames: "gap-2",
|
|
1139
1077
|
onClick: activeAction.onClick
|
|
1140
|
-
}, /* @__PURE__ */
|
|
1078
|
+
}, /* @__PURE__ */ React10.createElement(activeAction.icon, {
|
|
1141
1079
|
className: getSize3(5)
|
|
1142
|
-
}), /* @__PURE__ */
|
|
1080
|
+
}), /* @__PURE__ */ React10.createElement("span", null, t(activeAction.label, {
|
|
1143
1081
|
ns: "os"
|
|
1144
|
-
}))), /* @__PURE__ */
|
|
1082
|
+
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React10.createElement(DropdownMenu2.Trigger, {
|
|
1145
1083
|
asChild: true
|
|
1146
|
-
}, /* @__PURE__ */
|
|
1084
|
+
}, /* @__PURE__ */ React10.createElement(Button5, {
|
|
1147
1085
|
classNames: "pli-0"
|
|
1148
|
-
}, /* @__PURE__ */
|
|
1086
|
+
}, /* @__PURE__ */ React10.createElement(CaretDown, {
|
|
1149
1087
|
className: getSize3(4)
|
|
1150
|
-
}))), /* @__PURE__ */
|
|
1151
|
-
return /* @__PURE__ */
|
|
1088
|
+
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React10.createElement(DropdownMenu2.Viewport, null, Object.entries(inviteActions).map(([id, action]) => {
|
|
1089
|
+
return /* @__PURE__ */ React10.createElement(DropdownMenu2.CheckboxItem, {
|
|
1152
1090
|
key: id,
|
|
1153
1091
|
"aria-labelledby": `${id}__label`,
|
|
1154
1092
|
"aria-describedby": `${id}__description`,
|
|
1155
1093
|
checked: activeActionKey === id,
|
|
1156
1094
|
onCheckedChange: (checked) => checked && setActiveActionKey(id),
|
|
1157
1095
|
classNames: "gap-2"
|
|
1158
|
-
}, action.icon && /* @__PURE__ */
|
|
1096
|
+
}, action.icon && /* @__PURE__ */ React10.createElement(action.icon, {
|
|
1159
1097
|
className: getSize3(5)
|
|
1160
|
-
}), /* @__PURE__ */
|
|
1098
|
+
}), /* @__PURE__ */ React10.createElement("div", {
|
|
1161
1099
|
role: "none",
|
|
1162
1100
|
className: "flex-1 min-is-0 space-b-1"
|
|
1163
|
-
}, /* @__PURE__ */
|
|
1101
|
+
}, /* @__PURE__ */ React10.createElement("p", {
|
|
1164
1102
|
id: `${id}__label`
|
|
1165
1103
|
}, t(action.label, {
|
|
1166
1104
|
ns: "os"
|
|
1167
|
-
})), action.description && /* @__PURE__ */
|
|
1105
|
+
})), action.description && /* @__PURE__ */ React10.createElement("p", {
|
|
1168
1106
|
id: `${id}__description`,
|
|
1169
|
-
className:
|
|
1107
|
+
className: descriptionText2
|
|
1170
1108
|
}, t(action.description, {
|
|
1171
1109
|
ns: "os"
|
|
1172
|
-
}))), /* @__PURE__ */
|
|
1110
|
+
}))), /* @__PURE__ */ React10.createElement(DropdownMenu2.ItemIndicator, {
|
|
1173
1111
|
asChild: true
|
|
1174
|
-
}, /* @__PURE__ */
|
|
1112
|
+
}, /* @__PURE__ */ React10.createElement(Check, {
|
|
1175
1113
|
className: getSize3(4)
|
|
1176
1114
|
})));
|
|
1177
|
-
})), /* @__PURE__ */
|
|
1178
|
-
className:
|
|
1115
|
+
})), /* @__PURE__ */ React10.createElement(DropdownMenu2.Arrow, null)))), members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? /* @__PURE__ */ React10.createElement("p", {
|
|
1116
|
+
className: mx4(descriptionText2, "text-center is-full mlb-2")
|
|
1179
1117
|
}, t("empty space members message", {
|
|
1180
1118
|
ns: "os"
|
|
1181
|
-
})) : /* @__PURE__ */
|
|
1119
|
+
})) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("h3", {
|
|
1182
1120
|
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1183
1121
|
}, t("active space members heading", {
|
|
1184
1122
|
count: members[Presence.ONLINE].length
|
|
1185
|
-
})), /* @__PURE__ */
|
|
1123
|
+
})), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
|
|
1186
1124
|
members: members[Presence.ONLINE]
|
|
1187
|
-
}), /* @__PURE__ */
|
|
1125
|
+
}), /* @__PURE__ */ React10.createElement("h3", {
|
|
1188
1126
|
className: "col-start-2 col-end-5 text-sm italic text-description"
|
|
1189
1127
|
}, t("inactive space members heading", {
|
|
1190
1128
|
count: members[Presence.OFFLINE].length
|
|
1191
|
-
})), /* @__PURE__ */
|
|
1129
|
+
})), /* @__PURE__ */ React10.createElement(SpaceMemberList, {
|
|
1192
1130
|
members: members[Presence.OFFLINE]
|
|
1193
1131
|
})));
|
|
1194
1132
|
};
|
|
1195
1133
|
|
|
1196
1134
|
// packages/plugins/plugin-space/src/components/SpaceMain/SpaceMain.tsx
|
|
1197
1135
|
var KeyShortcuts = () => {
|
|
1198
|
-
const { t } =
|
|
1199
|
-
return /* @__PURE__ */
|
|
1136
|
+
const { t } = useTranslation11(SPACE_PLUGIN);
|
|
1137
|
+
return /* @__PURE__ */ React11.createElement("section", {
|
|
1200
1138
|
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__ */
|
|
1139
|
+
}, /* @__PURE__ */ React11.createElement("h2", {
|
|
1202
1140
|
className: "contents"
|
|
1203
|
-
}, /* @__PURE__ */
|
|
1141
|
+
}, /* @__PURE__ */ React11.createElement(Command, {
|
|
1204
1142
|
weight: "duotone",
|
|
1205
|
-
className:
|
|
1206
|
-
}), /* @__PURE__ */
|
|
1143
|
+
className: mx5(getSize4(5), "place-self-center")
|
|
1144
|
+
}), /* @__PURE__ */ React11.createElement("span", {
|
|
1207
1145
|
className: "text-lg col-span-2 md:col-span-1"
|
|
1208
|
-
}, t("keyshortcuts label"))), /* @__PURE__ */
|
|
1146
|
+
}, t("keyshortcuts label"))), /* @__PURE__ */ React11.createElement("div", {
|
|
1209
1147
|
role: "none",
|
|
1210
1148
|
className: "col-start-2 col-end-4 md:col-end-5 pie-2"
|
|
1211
|
-
}, /* @__PURE__ */
|
|
1149
|
+
}, /* @__PURE__ */ React11.createElement(Surface, {
|
|
1212
1150
|
role: "keyshortcuts"
|
|
1213
1151
|
})));
|
|
1214
1152
|
};
|
|
@@ -1217,7 +1155,7 @@ var SpaceMain = ({ space, role }) => {
|
|
|
1217
1155
|
const state = space.state.get();
|
|
1218
1156
|
const ready = state === SpaceState2.SPACE_READY;
|
|
1219
1157
|
const Root = role === "main" ? Main.Content : "div";
|
|
1220
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ React11.createElement(ClipboardProvider, null, /* @__PURE__ */ React11.createElement(Root, {
|
|
1221
1159
|
...role === "main" ? {
|
|
1222
1160
|
classNames: [
|
|
1223
1161
|
topbarBlockPaddingStart,
|
|
@@ -1226,38 +1164,37 @@ var SpaceMain = ({ space, role }) => {
|
|
|
1226
1164
|
]
|
|
1227
1165
|
} : {
|
|
1228
1166
|
role: "none",
|
|
1229
|
-
className:
|
|
1167
|
+
className: mx5(topbarBlockPaddingStart, "row-span-2", spaceMainLayout)
|
|
1230
1168
|
},
|
|
1231
1169
|
"data-testid": `spacePlugin.${role}`,
|
|
1232
1170
|
"data-isready": ready ? "true" : "false"
|
|
1233
|
-
}, ready && /* @__PURE__ */
|
|
1171
|
+
}, ready && /* @__PURE__ */ React11.createElement(SpaceMembersSection, {
|
|
1234
1172
|
space
|
|
1235
|
-
}), /* @__PURE__ */
|
|
1173
|
+
}), /* @__PURE__ */ React11.createElement(KeyShortcuts, null)));
|
|
1236
1174
|
};
|
|
1237
1175
|
|
|
1238
1176
|
// packages/plugins/plugin-space/src/components/SpacePresence.tsx
|
|
1239
|
-
import
|
|
1177
|
+
import React12, { useCallback as useCallback4, useEffect as useEffect3, useState as useState6 } from "react";
|
|
1240
1178
|
import { usePlugin } from "@dxos/app-framework";
|
|
1241
1179
|
import { generateName } from "@dxos/display-name";
|
|
1242
1180
|
import { PublicKey, useClient as useClient3 } from "@dxos/react-client";
|
|
1243
1181
|
import { getSpace as getSpace3, useMembers as useMembers2, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
|
|
1244
1182
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
1245
|
-
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2,
|
|
1246
|
-
import { AttentionGlyph } from "@dxos/react-ui-attention";
|
|
1183
|
+
import { Avatar, AvatarGroup, AvatarGroupItem, Tooltip as Tooltip2, useTranslation as useTranslation12, List as List2, ListItem, useDefaultValue } from "@dxos/react-ui";
|
|
1184
|
+
import { AttentionGlyph, useAttention } from "@dxos/react-ui-attention";
|
|
1247
1185
|
import { ComplexMap, keyToFallback } from "@dxos/util";
|
|
1248
1186
|
var REFRESH_INTERVAL = 5e3;
|
|
1249
1187
|
var ACTIVITY_DURATION = 3e4;
|
|
1250
1188
|
var noViewers = new ComplexMap(PublicKey.hash);
|
|
1251
1189
|
var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
|
|
1252
1190
|
var SpacePresence = ({ object, spaceKey }) => {
|
|
1253
|
-
const density = useDensityContext();
|
|
1254
1191
|
const spacePlugin = usePlugin(SPACE_PLUGIN);
|
|
1255
1192
|
const client = useClient3();
|
|
1256
1193
|
const identity = useIdentity();
|
|
1257
1194
|
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
|
|
1258
1195
|
const spaceMembers = useMembers2(space?.key);
|
|
1259
|
-
const [_moment, setMoment] =
|
|
1260
|
-
|
|
1196
|
+
const [_moment, setMoment] = useState6(Date.now());
|
|
1197
|
+
useEffect3(() => {
|
|
1261
1198
|
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1262
1199
|
return () => clearInterval(interval);
|
|
1263
1200
|
}, []);
|
|
@@ -1280,50 +1217,48 @@ var SpacePresence = ({ object, spaceKey }) => {
|
|
|
1280
1217
|
lastSeen
|
|
1281
1218
|
};
|
|
1282
1219
|
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1283
|
-
return
|
|
1284
|
-
count: membersForObject.length
|
|
1285
|
-
}) : /* @__PURE__ */ React15.createElement(FullPresence, {
|
|
1220
|
+
return /* @__PURE__ */ React12.createElement(FullPresence, {
|
|
1286
1221
|
members: membersForObject
|
|
1287
1222
|
});
|
|
1288
1223
|
};
|
|
1289
1224
|
var FullPresence = (props) => {
|
|
1290
1225
|
const { size = 9, onMemberClick } = props;
|
|
1291
|
-
const members = useDefaultValue(props.members, []);
|
|
1226
|
+
const members = useDefaultValue(props.members, () => []);
|
|
1292
1227
|
if (members.length === 0) {
|
|
1293
1228
|
return null;
|
|
1294
1229
|
}
|
|
1295
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ React12.createElement(AvatarGroup.Root, {
|
|
1296
1231
|
size,
|
|
1297
1232
|
classNames: "mbs-2 mie-4",
|
|
1298
1233
|
"data-testid": "spacePlugin.presence"
|
|
1299
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */
|
|
1234
|
+
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React12.createElement(Tooltip2.Root, {
|
|
1300
1235
|
key: member.identity.identityKey.toHex()
|
|
1301
|
-
}, /* @__PURE__ */
|
|
1236
|
+
}, /* @__PURE__ */ React12.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React12.createElement(PrensenceAvatar, {
|
|
1302
1237
|
identity: member.identity,
|
|
1303
1238
|
group: true,
|
|
1304
1239
|
match: member.currentlyAttended,
|
|
1305
1240
|
index: members.length - i,
|
|
1306
1241
|
onClick: () => onMemberClick?.(member)
|
|
1307
|
-
})), /* @__PURE__ */
|
|
1242
|
+
})), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
|
|
1308
1243
|
side: "bottom"
|
|
1309
|
-
}, /* @__PURE__ */
|
|
1244
|
+
}, /* @__PURE__ */ React12.createElement("span", null, getName(member.identity)), /* @__PURE__ */ React12.createElement(Tooltip2.Arrow, null))))), members.length > 3 && /* @__PURE__ */ React12.createElement(Tooltip2.Root, null, /* @__PURE__ */ React12.createElement(Tooltip2.Trigger, null, /* @__PURE__ */ React12.createElement(AvatarGroupItem.Root, {
|
|
1310
1245
|
status: "inactive"
|
|
1311
|
-
}, /* @__PURE__ */
|
|
1246
|
+
}, /* @__PURE__ */ React12.createElement(Avatar.Frame, {
|
|
1312
1247
|
style: {
|
|
1313
1248
|
zIndex: members.length - 4
|
|
1314
1249
|
}
|
|
1315
|
-
}, /* @__PURE__ */
|
|
1250
|
+
}, /* @__PURE__ */ React12.createElement(Avatar.Fallback, {
|
|
1316
1251
|
text: `+${members.length - 3}`
|
|
1317
|
-
})))), /* @__PURE__ */
|
|
1252
|
+
})))), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
|
|
1318
1253
|
side: "bottom"
|
|
1319
|
-
}, /* @__PURE__ */
|
|
1254
|
+
}, /* @__PURE__ */ React12.createElement(Tooltip2.Arrow, null), /* @__PURE__ */ React12.createElement(List2, {
|
|
1320
1255
|
classNames: "max-h-56 overflow-y-auto"
|
|
1321
|
-
}, members.map((member) => /* @__PURE__ */
|
|
1256
|
+
}, members.map((member) => /* @__PURE__ */ React12.createElement(ListItem.Root, {
|
|
1322
1257
|
key: member.identity.identityKey.toHex(),
|
|
1323
1258
|
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1324
1259
|
onClick: () => onMemberClick?.(member),
|
|
1325
1260
|
"data-testid": "identity-list-item"
|
|
1326
|
-
}, /* @__PURE__ */
|
|
1261
|
+
}, /* @__PURE__ */ React12.createElement(PrensenceAvatar, {
|
|
1327
1262
|
identity: member.identity,
|
|
1328
1263
|
showName: true,
|
|
1329
1264
|
match: member.currentlyAttended
|
|
@@ -1333,10 +1268,10 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1333
1268
|
const Root = group ? AvatarGroupItem.Root : Avatar.Root;
|
|
1334
1269
|
const status = match ? "current" : "active";
|
|
1335
1270
|
const fallbackValue = keyToFallback(identity.identityKey);
|
|
1336
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1337
1272
|
status,
|
|
1338
1273
|
hue: identity.profile?.data?.hue || fallbackValue.hue
|
|
1339
|
-
}, /* @__PURE__ */
|
|
1274
|
+
}, /* @__PURE__ */ React12.createElement(Avatar.Frame, {
|
|
1340
1275
|
"data-testid": "spacePlugin.presence.member",
|
|
1341
1276
|
"data-status": status,
|
|
1342
1277
|
...index ? {
|
|
@@ -1345,49 +1280,67 @@ var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) =>
|
|
|
1345
1280
|
}
|
|
1346
1281
|
} : {},
|
|
1347
1282
|
onClick: () => onClick?.()
|
|
1348
|
-
}, /* @__PURE__ */
|
|
1283
|
+
}, /* @__PURE__ */ React12.createElement(Avatar.Fallback, {
|
|
1349
1284
|
text: identity.profile?.data?.emoji || fallbackValue.emoji
|
|
1350
|
-
})), showName && /* @__PURE__ */
|
|
1285
|
+
})), showName && /* @__PURE__ */ React12.createElement(Avatar.Label, {
|
|
1351
1286
|
classNames: "text-sm truncate pli-2"
|
|
1352
1287
|
}, getName(identity)));
|
|
1353
1288
|
};
|
|
1354
|
-
var SmallPresenceLive = ({ viewers }) => {
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1289
|
+
var SmallPresenceLive = ({ id, viewers }) => {
|
|
1290
|
+
const getActiveViewers = (viewers2) => {
|
|
1291
|
+
const moment = Date.now();
|
|
1292
|
+
return Array.from(viewers2.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION);
|
|
1293
|
+
};
|
|
1294
|
+
const [activeViewers, setActiveViewers] = useState6(viewers ? getActiveViewers(viewers) : []);
|
|
1295
|
+
useEffect3(() => {
|
|
1296
|
+
if (viewers) {
|
|
1297
|
+
setActiveViewers(getActiveViewers(viewers));
|
|
1298
|
+
const interval = setInterval(() => {
|
|
1299
|
+
setActiveViewers(getActiveViewers(viewers));
|
|
1300
|
+
}, REFRESH_INTERVAL);
|
|
1301
|
+
return () => clearInterval(interval);
|
|
1302
|
+
}
|
|
1303
|
+
}, [
|
|
1304
|
+
viewers
|
|
1305
|
+
]);
|
|
1306
|
+
return /* @__PURE__ */ React12.createElement(SmallPresence, {
|
|
1307
|
+
id,
|
|
1362
1308
|
count: activeViewers.length
|
|
1363
1309
|
});
|
|
1364
1310
|
};
|
|
1365
|
-
var SmallPresence = ({ count }) => {
|
|
1366
|
-
const { t } =
|
|
1367
|
-
|
|
1311
|
+
var SmallPresence = ({ id, count }) => {
|
|
1312
|
+
const { t } = useTranslation12(SPACE_PLUGIN);
|
|
1313
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1314
|
+
const attention = hasAttention || isAncestor || isRelated;
|
|
1315
|
+
return /* @__PURE__ */ React12.createElement(Tooltip2.Root, null, /* @__PURE__ */ React12.createElement(Tooltip2.Trigger, {
|
|
1368
1316
|
asChild: true
|
|
1369
|
-
}, /* @__PURE__ */
|
|
1317
|
+
}, /* @__PURE__ */ React12.createElement("div", {
|
|
1318
|
+
role: "none",
|
|
1319
|
+
className: "flex",
|
|
1320
|
+
"data-attention": attention
|
|
1321
|
+
}, /* @__PURE__ */ React12.createElement(AttentionGlyph, {
|
|
1370
1322
|
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1371
1323
|
classNames: "self-center mie-1"
|
|
1372
|
-
})), /* @__PURE__ */
|
|
1324
|
+
}))), /* @__PURE__ */ React12.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip2.Content, {
|
|
1373
1325
|
side: "bottom",
|
|
1374
1326
|
classNames: "z-[70]"
|
|
1375
|
-
}, /* @__PURE__ */
|
|
1327
|
+
}, /* @__PURE__ */ React12.createElement("span", null, t("presence label", {
|
|
1376
1328
|
count
|
|
1377
|
-
})), /* @__PURE__ */
|
|
1329
|
+
})), /* @__PURE__ */ React12.createElement(Tooltip2.Arrow, null))));
|
|
1378
1330
|
};
|
|
1379
1331
|
|
|
1380
1332
|
// packages/plugins/plugin-space/src/components/SpaceSettings.tsx
|
|
1381
|
-
import
|
|
1382
|
-
import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
1383
|
-
import {
|
|
1384
|
-
import {
|
|
1333
|
+
import React13 from "react";
|
|
1334
|
+
import { useIntentDispatcher as useIntentDispatcher2, useResolvePlugins } from "@dxos/app-framework";
|
|
1335
|
+
import { Input as Input4, Select, toLocalizedString as toLocalizedString2, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1336
|
+
import { DeprecatedFormInput } from "@dxos/react-ui-data";
|
|
1385
1337
|
var SpaceSettings = ({ settings }) => {
|
|
1386
|
-
const { t } =
|
|
1338
|
+
const { t } = useTranslation13(SPACE_PLUGIN);
|
|
1387
1339
|
const dispatch = useIntentDispatcher2();
|
|
1388
|
-
|
|
1340
|
+
const plugins = useResolvePlugins(parseSpaceInitPlugin);
|
|
1341
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(DeprecatedFormInput, {
|
|
1389
1342
|
label: t("show hidden spaces label")
|
|
1390
|
-
}, /* @__PURE__ */
|
|
1343
|
+
}, /* @__PURE__ */ React13.createElement(Input4.Switch, {
|
|
1391
1344
|
checked: settings.showHidden,
|
|
1392
1345
|
onCheckedChange: (checked) => dispatch({
|
|
1393
1346
|
plugin: SPACE_PLUGIN,
|
|
@@ -1396,7 +1349,401 @@ var SpaceSettings = ({ settings }) => {
|
|
|
1396
1349
|
state: !!checked
|
|
1397
1350
|
}
|
|
1398
1351
|
})
|
|
1399
|
-
}))
|
|
1352
|
+
})), /* @__PURE__ */ React13.createElement(DeprecatedFormInput, {
|
|
1353
|
+
label: t("default on space create label")
|
|
1354
|
+
}, /* @__PURE__ */ React13.createElement(Select.Root, {
|
|
1355
|
+
value: settings.onSpaceCreate,
|
|
1356
|
+
onValueChange: (value) => {
|
|
1357
|
+
settings.onSpaceCreate = value;
|
|
1358
|
+
}
|
|
1359
|
+
}, /* @__PURE__ */ React13.createElement(Select.TriggerButton, null), /* @__PURE__ */ React13.createElement(Select.Portal, null, /* @__PURE__ */ React13.createElement(Select.Content, null, /* @__PURE__ */ React13.createElement(Select.Viewport, null, plugins.map(({ provides: { space: { onSpaceCreate } } }) => /* @__PURE__ */ React13.createElement(Select.Option, {
|
|
1360
|
+
key: onSpaceCreate.action,
|
|
1361
|
+
value: onSpaceCreate.action
|
|
1362
|
+
}, toLocalizedString2(onSpaceCreate.label, t)))))))));
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
// packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx
|
|
1366
|
+
import React14, { useCallback as useCallback5, useState as useState7 } from "react";
|
|
1367
|
+
import { log as log2 } from "@dxos/log";
|
|
1368
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1369
|
+
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1370
|
+
import { DeviceType, useDevices } from "@dxos/react-client/halo";
|
|
1371
|
+
import { Input as Input5, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1372
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettingsPanel.tsx";
|
|
1373
|
+
var SpaceSettingsPanel = ({ space }) => {
|
|
1374
|
+
const { t } = useTranslation14(SPACE_PLUGIN);
|
|
1375
|
+
const client = useClient4();
|
|
1376
|
+
const devices = useDevices();
|
|
1377
|
+
const managedDeviceAvailable = devices.find((device) => device.profile?.type === DeviceType.AGENT_MANAGED);
|
|
1378
|
+
const edgeAgents = Boolean(client.config.values.runtime?.client?.edgeFeatures?.agents);
|
|
1379
|
+
const edgeReplicationAvailable = edgeAgents && managedDeviceAvailable;
|
|
1380
|
+
const [edgeReplication, setEdgeReplication] = useState7(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
|
|
1381
|
+
const toggleEdgeReplication = useCallback5(async (next) => {
|
|
1382
|
+
setEdgeReplication(next);
|
|
1383
|
+
await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1384
|
+
log2.catch(err, void 0, {
|
|
1385
|
+
F: __dxlog_file3,
|
|
1386
|
+
L: 38,
|
|
1387
|
+
S: void 0,
|
|
1388
|
+
C: (f, a) => f(...a)
|
|
1389
|
+
});
|
|
1390
|
+
setEdgeReplication(!next);
|
|
1391
|
+
});
|
|
1392
|
+
}, [
|
|
1393
|
+
space
|
|
1394
|
+
]);
|
|
1395
|
+
return /* @__PURE__ */ React14.createElement("div", {
|
|
1396
|
+
role: "form",
|
|
1397
|
+
className: "flex flex-col w-full p-2 gap-4"
|
|
1398
|
+
}, /* @__PURE__ */ React14.createElement(Input5.Root, null, /* @__PURE__ */ React14.createElement("div", {
|
|
1399
|
+
role: "none",
|
|
1400
|
+
className: "flex flex-col gap-1"
|
|
1401
|
+
}, /* @__PURE__ */ React14.createElement(Input5.Label, null, t("name label")), /* @__PURE__ */ React14.createElement(Input5.TextInput, {
|
|
1402
|
+
placeholder: t("name placeholder"),
|
|
1403
|
+
value: space.properties.name ?? "",
|
|
1404
|
+
onChange: (event) => {
|
|
1405
|
+
space.properties.name = event.target.value;
|
|
1406
|
+
}
|
|
1407
|
+
}))), edgeReplicationAvailable && /* @__PURE__ */ React14.createElement(Input5.Root, null, /* @__PURE__ */ React14.createElement("div", {
|
|
1408
|
+
role: "none",
|
|
1409
|
+
className: "flex justify-between"
|
|
1410
|
+
}, /* @__PURE__ */ React14.createElement(Input5.Label, null, t("edge replication label")), /* @__PURE__ */ React14.createElement(Input5.Switch, {
|
|
1411
|
+
checked: edgeReplication,
|
|
1412
|
+
onCheckedChange: toggleEdgeReplication
|
|
1413
|
+
}))));
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1417
|
+
import React16, { useEffect as useEffect6, useState as useState10 } from "react";
|
|
1418
|
+
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1419
|
+
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1420
|
+
import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1421
|
+
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
1422
|
+
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
1423
|
+
|
|
1424
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/Space.tsx
|
|
1425
|
+
import React15, { useEffect as useEffect4, useState as useState8 } from "react";
|
|
1426
|
+
import { Icon } from "@dxos/react-ui";
|
|
1427
|
+
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
1428
|
+
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1429
|
+
var styles = {
|
|
1430
|
+
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
1431
|
+
barFg: "bg-neutral-100 bg-green-500",
|
|
1432
|
+
barHover: "dark:hover:bg-green-500"
|
|
1433
|
+
};
|
|
1434
|
+
var useActive = (count) => {
|
|
1435
|
+
const [current, setCurrent] = useState8(count);
|
|
1436
|
+
const [active, setActive] = useState8(false);
|
|
1437
|
+
useEffect4(() => {
|
|
1438
|
+
let t;
|
|
1439
|
+
if (count !== current) {
|
|
1440
|
+
setActive(true);
|
|
1441
|
+
setCurrent(count);
|
|
1442
|
+
t && clearTimeout(t);
|
|
1443
|
+
t = setTimeout(() => {
|
|
1444
|
+
setActive(false);
|
|
1445
|
+
}, SYNC_STALLED_TIMEOUT);
|
|
1446
|
+
}
|
|
1447
|
+
return () => {
|
|
1448
|
+
setActive(false);
|
|
1449
|
+
clearTimeout(t);
|
|
1450
|
+
};
|
|
1451
|
+
}, [
|
|
1452
|
+
count,
|
|
1453
|
+
current
|
|
1454
|
+
]);
|
|
1455
|
+
return active;
|
|
1456
|
+
};
|
|
1457
|
+
var SpaceRow = ({ spaceId, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
|
|
1458
|
+
const downActive = useActive(localDocumentCount);
|
|
1459
|
+
const upActive = useActive(remoteDocumentCount);
|
|
1460
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
|
1461
|
+
className: mx6("flex items-center mx-[2px] gap-[2px] cursor-pointer", styles.barHover),
|
|
1462
|
+
title: spaceId,
|
|
1463
|
+
onClick: () => {
|
|
1464
|
+
void navigator.clipboard.writeText(spaceId);
|
|
1465
|
+
}
|
|
1466
|
+
}, /* @__PURE__ */ React15.createElement(Icon, {
|
|
1467
|
+
icon: "ph--arrow-fat-line-left--regular",
|
|
1468
|
+
size: 3,
|
|
1469
|
+
classNames: mx6(downActive && "animate-[pulse_1s_infinite]")
|
|
1470
|
+
}), /* @__PURE__ */ React15.createElement(Candle, {
|
|
1471
|
+
up: {
|
|
1472
|
+
count: remoteDocumentCount,
|
|
1473
|
+
total: remoteDocumentCount + missingOnRemote
|
|
1474
|
+
},
|
|
1475
|
+
down: {
|
|
1476
|
+
count: localDocumentCount,
|
|
1477
|
+
total: localDocumentCount + missingOnLocal
|
|
1478
|
+
},
|
|
1479
|
+
title: spaceId
|
|
1480
|
+
}), /* @__PURE__ */ React15.createElement(Icon, {
|
|
1481
|
+
icon: "ph--arrow-fat-line-right--regular",
|
|
1482
|
+
size: 3,
|
|
1483
|
+
classNames: mx6(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1484
|
+
}));
|
|
1485
|
+
};
|
|
1486
|
+
var Candle = ({ classNames, up, down }) => {
|
|
1487
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
|
1488
|
+
className: mx6("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1489
|
+
}, /* @__PURE__ */ React15.createElement(Bar, {
|
|
1490
|
+
classNames: "justify-end",
|
|
1491
|
+
...up
|
|
1492
|
+
}), /* @__PURE__ */ React15.createElement("div", {
|
|
1493
|
+
className: "relative"
|
|
1494
|
+
}, /* @__PURE__ */ React15.createElement("div", {
|
|
1495
|
+
className: mx6("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1496
|
+
}, up.total)), /* @__PURE__ */ React15.createElement(Bar, down));
|
|
1497
|
+
};
|
|
1498
|
+
var Bar = ({ classNames, count, total }) => {
|
|
1499
|
+
let p = count / total * 100;
|
|
1500
|
+
if (count < total) {
|
|
1501
|
+
p = Math.min(p, 95);
|
|
1502
|
+
}
|
|
1503
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
|
1504
|
+
className: mx6("relative flex w-full", styles.barBg, classNames)
|
|
1505
|
+
}, /* @__PURE__ */ React15.createElement("div", {
|
|
1506
|
+
className: mx6("shrink-0", styles.barFg),
|
|
1507
|
+
style: {
|
|
1508
|
+
width: `${p}%`
|
|
1509
|
+
}
|
|
1510
|
+
}), count !== total && /* @__PURE__ */ React15.createElement("div", {
|
|
1511
|
+
className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
|
|
1512
|
+
}, count));
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts
|
|
1516
|
+
import { Context } from "@dxos/context";
|
|
1517
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
|
|
1518
|
+
var createClientSaveTracker = (client, cb) => {
|
|
1519
|
+
const unsubscribeCallbacks = {};
|
|
1520
|
+
const state = {};
|
|
1521
|
+
const install = (spaces) => {
|
|
1522
|
+
for (const space of spaces) {
|
|
1523
|
+
if (state[space.id]) {
|
|
1524
|
+
continue;
|
|
1525
|
+
}
|
|
1526
|
+
state[space.id] = "saved";
|
|
1527
|
+
unsubscribeCallbacks[space.id] = createSpaceSaveTracker(space, (s) => {
|
|
1528
|
+
state[space.id] = s;
|
|
1529
|
+
cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
client.spaces.subscribe((spaces) => {
|
|
1534
|
+
install(spaces);
|
|
1535
|
+
});
|
|
1536
|
+
install(client.spaces.get());
|
|
1537
|
+
return () => {
|
|
1538
|
+
for (const unsubscribe of Object.values(unsubscribeCallbacks)) {
|
|
1539
|
+
unsubscribe();
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
};
|
|
1543
|
+
var createSpaceSaveTracker = (space, cb) => {
|
|
1544
|
+
const ctx = new Context(void 0, {
|
|
1545
|
+
F: __dxlog_file4,
|
|
1546
|
+
L: 40
|
|
1547
|
+
});
|
|
1548
|
+
void space.waitUntilReady().then(() => {
|
|
1549
|
+
if (ctx.disposed) {
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
let hasUnsavedChanges = false;
|
|
1553
|
+
let lastFlushPromise;
|
|
1554
|
+
space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
|
|
1555
|
+
hasUnsavedChanges = unsavedDocuments.length > 0;
|
|
1556
|
+
});
|
|
1557
|
+
space.crud.saveStateChanged.debounce(500).on(ctx, () => {
|
|
1558
|
+
if (hasUnsavedChanges) {
|
|
1559
|
+
lastFlushPromise = void 0;
|
|
1560
|
+
cb("saving");
|
|
1561
|
+
} else {
|
|
1562
|
+
const flushPromise = space.crud.flush();
|
|
1563
|
+
lastFlushPromise = flushPromise;
|
|
1564
|
+
void flushPromise.then(() => {
|
|
1565
|
+
if (lastFlushPromise === flushPromise) {
|
|
1566
|
+
cb("saved");
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
});
|
|
1572
|
+
return () => {
|
|
1573
|
+
void ctx.dispose();
|
|
1574
|
+
};
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/status.ts
|
|
1578
|
+
var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
|
|
1579
|
+
if (!saved) {
|
|
1580
|
+
return "saving locally";
|
|
1581
|
+
} else if (!offline && needsToDownload) {
|
|
1582
|
+
return "downloading";
|
|
1583
|
+
} else if (!offline && needsToUpload) {
|
|
1584
|
+
return "uploading";
|
|
1585
|
+
} else if (offline && !needsToUpload && !needsToDownload) {
|
|
1586
|
+
return "offline persisted";
|
|
1587
|
+
} else {
|
|
1588
|
+
return "remote synced";
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
var getIcon = (status) => {
|
|
1592
|
+
switch (status) {
|
|
1593
|
+
case "saving locally":
|
|
1594
|
+
return "ph--download--regular";
|
|
1595
|
+
case "downloading":
|
|
1596
|
+
return "ph--cloud-arrow-down--regular";
|
|
1597
|
+
case "uploading":
|
|
1598
|
+
return "ph--cloud-arrow-up--regular";
|
|
1599
|
+
case "offline persisted":
|
|
1600
|
+
return "ph--check-circle--regular";
|
|
1601
|
+
case "remote synced":
|
|
1602
|
+
return "ph--cloud-check--regular";
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1606
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts
|
|
1607
|
+
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
1608
|
+
import { Context as Context2 } from "@dxos/context";
|
|
1609
|
+
import { EdgeService } from "@dxos/protocols";
|
|
1610
|
+
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1611
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts";
|
|
1612
|
+
var createEmptyEdgeSyncState = () => ({
|
|
1613
|
+
missingOnLocal: 0,
|
|
1614
|
+
missingOnRemote: 0,
|
|
1615
|
+
localDocumentCount: 0,
|
|
1616
|
+
remoteDocumentCount: 0,
|
|
1617
|
+
differentDocuments: 0
|
|
1618
|
+
});
|
|
1619
|
+
var getSyncSummary = (syncMap) => {
|
|
1620
|
+
return Object.entries(syncMap).reduce((summary, [_spaceId, peerState]) => {
|
|
1621
|
+
summary.missingOnLocal += peerState.missingOnLocal;
|
|
1622
|
+
summary.missingOnRemote += peerState.missingOnRemote;
|
|
1623
|
+
summary.localDocumentCount += peerState.localDocumentCount;
|
|
1624
|
+
summary.remoteDocumentCount += peerState.remoteDocumentCount;
|
|
1625
|
+
summary.differentDocuments += peerState.differentDocuments;
|
|
1626
|
+
return summary;
|
|
1627
|
+
}, createEmptyEdgeSyncState());
|
|
1628
|
+
};
|
|
1629
|
+
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1630
|
+
var useSyncState = () => {
|
|
1631
|
+
const client = useClient5();
|
|
1632
|
+
const [spaceState, setSpaceState] = useState9({});
|
|
1633
|
+
useEffect5(() => {
|
|
1634
|
+
const ctx = new Context2(void 0, {
|
|
1635
|
+
F: __dxlog_file5,
|
|
1636
|
+
L: 48
|
|
1637
|
+
});
|
|
1638
|
+
const createSubscriptions = (spaces) => {
|
|
1639
|
+
for (const space of spaces) {
|
|
1640
|
+
if (spaceState[space.id]) {
|
|
1641
|
+
continue;
|
|
1642
|
+
}
|
|
1643
|
+
ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1644
|
+
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1645
|
+
if (syncState) {
|
|
1646
|
+
setSpaceState((spaceState2) => ({
|
|
1647
|
+
...spaceState2,
|
|
1648
|
+
[space.id]: syncState
|
|
1649
|
+
}));
|
|
1650
|
+
}
|
|
1651
|
+
}));
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
createSubscriptions(client.spaces.get());
|
|
1655
|
+
client.spaces.subscribe((spaces) => {
|
|
1656
|
+
createSubscriptions(spaces);
|
|
1657
|
+
});
|
|
1658
|
+
return () => {
|
|
1659
|
+
void ctx.dispose();
|
|
1660
|
+
};
|
|
1661
|
+
}, [
|
|
1662
|
+
client
|
|
1663
|
+
]);
|
|
1664
|
+
return spaceState;
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
// packages/plugins/plugin-space/src/components/SyncStatus/SyncStatus.tsx
|
|
1668
|
+
var SyncStatus = () => {
|
|
1669
|
+
const client = useClient6();
|
|
1670
|
+
const state = useSyncState();
|
|
1671
|
+
const [saved, setSaved] = useState10(true);
|
|
1672
|
+
useEffect6(() => {
|
|
1673
|
+
return createClientSaveTracker(client, (state2) => {
|
|
1674
|
+
setSaved(state2 === "saved");
|
|
1675
|
+
});
|
|
1676
|
+
}, []);
|
|
1677
|
+
return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
|
|
1678
|
+
state,
|
|
1679
|
+
saved
|
|
1680
|
+
});
|
|
1681
|
+
};
|
|
1682
|
+
var SyncStatusIndicator = ({ state, saved }) => {
|
|
1683
|
+
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1684
|
+
const summary = getSyncSummary(state);
|
|
1685
|
+
const offline = Object.values(state).length === 0;
|
|
1686
|
+
const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
|
|
1687
|
+
const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
|
|
1688
|
+
const status = getStatus({
|
|
1689
|
+
offline,
|
|
1690
|
+
saved,
|
|
1691
|
+
needsToUpload,
|
|
1692
|
+
needsToDownload
|
|
1693
|
+
});
|
|
1694
|
+
const [classNames, setClassNames] = useState10();
|
|
1695
|
+
useEffect6(() => {
|
|
1696
|
+
setClassNames(void 0);
|
|
1697
|
+
if (offline || !needsToUpload && !needsToDownload) {
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
const t2 = setTimeout(() => {
|
|
1701
|
+
setClassNames("text-orange-500");
|
|
1702
|
+
}, SYNC_STALLED_TIMEOUT);
|
|
1703
|
+
return () => clearTimeout(t2);
|
|
1704
|
+
}, [
|
|
1705
|
+
offline,
|
|
1706
|
+
needsToUpload,
|
|
1707
|
+
needsToDownload
|
|
1708
|
+
]);
|
|
1709
|
+
const title = t(`${status} label`);
|
|
1710
|
+
const icon = /* @__PURE__ */ React16.createElement(Icon2, {
|
|
1711
|
+
icon: getIcon(status),
|
|
1712
|
+
size: 4,
|
|
1713
|
+
classNames
|
|
1714
|
+
});
|
|
1715
|
+
if (offline) {
|
|
1716
|
+
return /* @__PURE__ */ React16.createElement(StatusBar.Item, {
|
|
1717
|
+
title
|
|
1718
|
+
}, icon);
|
|
1719
|
+
} else {
|
|
1720
|
+
return /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, {
|
|
1721
|
+
asChild: true
|
|
1722
|
+
}, /* @__PURE__ */ React16.createElement(StatusBar.Button, {
|
|
1723
|
+
title
|
|
1724
|
+
}, icon)), /* @__PURE__ */ React16.createElement(Popover3.Portal, null, /* @__PURE__ */ React16.createElement(Popover3.Content, {
|
|
1725
|
+
sideOffset: 16
|
|
1726
|
+
}, /* @__PURE__ */ React16.createElement(SyncStatusDetail, {
|
|
1727
|
+
state,
|
|
1728
|
+
summary,
|
|
1729
|
+
debug: false
|
|
1730
|
+
}))));
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1733
|
+
var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
1734
|
+
const { t } = useTranslation15(SPACE_PLUGIN);
|
|
1735
|
+
const entries = Object.entries(state).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1736
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
|
1737
|
+
className: mx7("flex flex-col gap-3 p-2 text-xs min-w-[16rem]", classNames)
|
|
1738
|
+
}, /* @__PURE__ */ React16.createElement("h1", null, t("sync status title")), /* @__PURE__ */ React16.createElement("div", {
|
|
1739
|
+
className: "flex flex-col gap-2"
|
|
1740
|
+
}, entries.map(([spaceId, state2]) => /* @__PURE__ */ React16.createElement(SpaceRow, {
|
|
1741
|
+
key: spaceId,
|
|
1742
|
+
spaceId,
|
|
1743
|
+
state: state2
|
|
1744
|
+
}))), debug && /* @__PURE__ */ React16.createElement(SyntaxHighlighter, {
|
|
1745
|
+
language: "json"
|
|
1746
|
+
}, JSON.stringify(summary, null, 2)));
|
|
1400
1747
|
};
|
|
1401
1748
|
|
|
1402
1749
|
// packages/plugins/plugin-space/src/translations.ts
|
|
@@ -1406,8 +1753,8 @@ var translations_default = [
|
|
|
1406
1753
|
[SPACE_PLUGIN]: {
|
|
1407
1754
|
"plugin name": "Spaces",
|
|
1408
1755
|
"first run message": "Nothing selected.",
|
|
1409
|
-
"create space label": "Create
|
|
1410
|
-
"join space label": "Join
|
|
1756
|
+
"create space label": "Create space",
|
|
1757
|
+
"join space label": "Join space",
|
|
1411
1758
|
"empty space message": "No documents",
|
|
1412
1759
|
"empty tree message": "No spaces",
|
|
1413
1760
|
"unnamed space label": "New space",
|
|
@@ -1478,25 +1825,41 @@ var translations_default = [
|
|
|
1478
1825
|
"space limit close label": "Close",
|
|
1479
1826
|
"remove deleted objects label": "Cleanup",
|
|
1480
1827
|
"remove deleted objects alt": "Permanently remove deleted objects to free up space.",
|
|
1481
|
-
"copy link label": "Copy link"
|
|
1828
|
+
"copy link label": "Copy link",
|
|
1829
|
+
"default on space create label": "On space create",
|
|
1830
|
+
"sync status title": "Sync status",
|
|
1831
|
+
"dismiss label": "Dismiss",
|
|
1832
|
+
"join success label": "Successfully joined space",
|
|
1833
|
+
"name label": "Name",
|
|
1834
|
+
"name placeholder": "Name",
|
|
1835
|
+
"unnamed object settings label": "Settings",
|
|
1836
|
+
"edge replication label": "Enable EDGE Replication",
|
|
1837
|
+
"saving locally label": "Writing to disk",
|
|
1838
|
+
"downloading label": "Replicating from peers",
|
|
1839
|
+
"uploading label": "Replicating to peers",
|
|
1840
|
+
"offline persisted label": "Saved to disk (offline)",
|
|
1841
|
+
"remote synced label": "Synced with peers",
|
|
1842
|
+
"open settings panel label": "Show Settings"
|
|
1482
1843
|
}
|
|
1483
1844
|
}
|
|
1484
1845
|
}
|
|
1485
1846
|
];
|
|
1486
1847
|
|
|
1487
1848
|
// packages/plugins/plugin-space/src/SpacePlugin.tsx
|
|
1488
|
-
var
|
|
1849
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
|
|
1489
1850
|
var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
|
|
1490
|
-
var OBJECT_ID_LENGTH = 60;
|
|
1491
1851
|
var SPACE_MAX_OBJECTS = 500;
|
|
1492
1852
|
var DIRECTORY_TYPE = "text/directory";
|
|
1493
1853
|
var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
|
|
1494
1854
|
var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
1495
|
-
const settings = new LocalStorageStore(SPACE_PLUGIN
|
|
1855
|
+
const settings = new LocalStorageStore(SPACE_PLUGIN, {
|
|
1856
|
+
onSpaceCreate: "dxos.org/plugin/markdown/action/create"
|
|
1857
|
+
});
|
|
1496
1858
|
const state = new LocalStorageStore(SPACE_PLUGIN, {
|
|
1497
1859
|
awaiting: void 0,
|
|
1498
1860
|
spaceNames: {},
|
|
1499
1861
|
viewersByObject: {},
|
|
1862
|
+
// TODO(wittjosiah): Stop using (Complex)Map inside reactive object.
|
|
1500
1863
|
viewersByIdentity: new ComplexMap2(PublicKey2.hash),
|
|
1501
1864
|
sdkMigrationRunning: {}
|
|
1502
1865
|
});
|
|
@@ -1504,15 +1867,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1504
1867
|
const spaceSubscriptions = new EventSubscriptions();
|
|
1505
1868
|
const graphSubscriptions = /* @__PURE__ */ new Map();
|
|
1506
1869
|
let clientPlugin;
|
|
1870
|
+
let graphPlugin;
|
|
1507
1871
|
let intentPlugin;
|
|
1872
|
+
let layoutPlugin;
|
|
1508
1873
|
let navigationPlugin;
|
|
1509
1874
|
let attentionPlugin;
|
|
1510
1875
|
const onSpaceReady = async () => {
|
|
1511
|
-
if (!clientPlugin || !navigationPlugin || !attentionPlugin) {
|
|
1876
|
+
if (!clientPlugin || !intentPlugin || !graphPlugin || !navigationPlugin || !layoutPlugin || !attentionPlugin) {
|
|
1512
1877
|
return;
|
|
1513
1878
|
}
|
|
1514
1879
|
const client = clientPlugin.provides.client;
|
|
1880
|
+
const dispatch = intentPlugin.provides.intent.dispatch;
|
|
1881
|
+
const graph = graphPlugin.provides.graph;
|
|
1515
1882
|
const location = navigationPlugin.provides.location;
|
|
1883
|
+
const layout = layoutPlugin.provides.layout;
|
|
1516
1884
|
const attention = attentionPlugin.provides.attention;
|
|
1517
1885
|
const defaultSpace = client.spaces.default;
|
|
1518
1886
|
if (typeof defaultSpace.properties[COMPOSER_SPACE_LOCK] !== "boolean") {
|
|
@@ -1527,22 +1895,44 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1527
1895
|
order: []
|
|
1528
1896
|
}));
|
|
1529
1897
|
}
|
|
1898
|
+
subscriptions.add(scheduledEffect(() => ({
|
|
1899
|
+
layoutMode: layout.layoutMode,
|
|
1900
|
+
soloPart: location.active.solo?.[0]
|
|
1901
|
+
}), ({ layoutMode, soloPart }) => {
|
|
1902
|
+
if (layoutMode !== "solo" || !soloPart) {
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
const node = graph.findNode(soloPart.id);
|
|
1906
|
+
if (!node && soloPart.id.length === FQ_ID_LENGTH) {
|
|
1907
|
+
void dispatch({
|
|
1908
|
+
plugin: SPACE_PLUGIN,
|
|
1909
|
+
action: SpaceAction.WAIT_FOR_OBJECT,
|
|
1910
|
+
data: {
|
|
1911
|
+
id: soloPart.id
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
}));
|
|
1530
1916
|
subscriptions.add(client.spaces.subscribe(async (spaces) => {
|
|
1531
1917
|
if (defaultSpace.state.get() === SpaceState3.SPACE_REQUIRES_MIGRATION) {
|
|
1532
1918
|
await defaultSpace.internal.migrate();
|
|
1533
1919
|
}
|
|
1534
1920
|
spaces.filter((space) => space.state.get() === SpaceState3.SPACE_READY).forEach((space) => {
|
|
1535
|
-
subscriptions.add(
|
|
1536
|
-
|
|
1537
|
-
}));
|
|
1921
|
+
subscriptions.add(scheduledEffect(() => ({
|
|
1922
|
+
name: space.properties.name
|
|
1923
|
+
}), ({ name }) => state.values.spaceNames[space.id] = name));
|
|
1538
1924
|
});
|
|
1539
1925
|
}).unsubscribe);
|
|
1540
|
-
subscriptions.add(
|
|
1926
|
+
subscriptions.add(scheduledEffect(() => ({
|
|
1927
|
+
ids: openIds(location.active),
|
|
1928
|
+
removed: location.closed ? [
|
|
1929
|
+
location.closed
|
|
1930
|
+
].flat() : []
|
|
1931
|
+
}), ({ ids, removed }) => {
|
|
1541
1932
|
const send = () => {
|
|
1542
1933
|
const spaces = client.spaces.get();
|
|
1543
1934
|
const identity = client.halo.identity.get();
|
|
1544
1935
|
if (identity && location.active) {
|
|
1545
|
-
const ids = openIds(location.active);
|
|
1546
1936
|
const idsBySpace = reduceGroupBy(ids, (id) => {
|
|
1547
1937
|
const [spaceId] = id.split(":");
|
|
1548
1938
|
return spaceId;
|
|
@@ -1557,9 +1947,6 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1557
1947
|
if (!space) {
|
|
1558
1948
|
continue;
|
|
1559
1949
|
}
|
|
1560
|
-
const removed = location.closed ? [
|
|
1561
|
-
location.closed
|
|
1562
|
-
].flat() : [];
|
|
1563
1950
|
void space.postMessage("viewing", {
|
|
1564
1951
|
identityKey: identity.identityKey.toHex(),
|
|
1565
1952
|
attended: attention.attended ? [
|
|
@@ -1569,11 +1956,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1569
1956
|
// TODO(Zan): When we re-open a part, we should remove it from the removed list in the navigation plugin.
|
|
1570
1957
|
removed: removed.filter((id) => !ids2.includes(id))
|
|
1571
1958
|
}).catch((err) => {
|
|
1572
|
-
|
|
1959
|
+
log3.warn("Failed to broadcast active node for presence.", {
|
|
1573
1960
|
err: err.message
|
|
1574
1961
|
}, {
|
|
1575
|
-
F:
|
|
1576
|
-
L:
|
|
1962
|
+
F: __dxlog_file6,
|
|
1963
|
+
L: 257,
|
|
1577
1964
|
S: void 0,
|
|
1578
1965
|
C: (f, a) => f(...a)
|
|
1579
1966
|
});
|
|
@@ -1623,20 +2010,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1623
2010
|
ready: async (plugins) => {
|
|
1624
2011
|
settings.prop({
|
|
1625
2012
|
key: "showHidden",
|
|
1626
|
-
storageKey: "show-hidden",
|
|
1627
2013
|
type: LocalStorageStore.bool({
|
|
1628
2014
|
allowUndefined: true
|
|
1629
2015
|
})
|
|
1630
2016
|
});
|
|
1631
2017
|
state.prop({
|
|
1632
2018
|
key: "spaceNames",
|
|
1633
|
-
storageKey: "space-names",
|
|
1634
2019
|
type: LocalStorageStore.json()
|
|
1635
2020
|
});
|
|
2021
|
+
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
2022
|
+
layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
|
|
1636
2023
|
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin2);
|
|
1637
2024
|
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
1638
2025
|
clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
1639
|
-
intentPlugin = resolvePlugin(plugins,
|
|
2026
|
+
intentPlugin = resolvePlugin(plugins, parseIntentPlugin2);
|
|
1640
2027
|
if (!clientPlugin || !intentPlugin) {
|
|
1641
2028
|
return;
|
|
1642
2029
|
}
|
|
@@ -1656,7 +2043,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1656
2043
|
dispatch
|
|
1657
2044
|
});
|
|
1658
2045
|
};
|
|
1659
|
-
client.spaces.isReady.subscribe(async (ready) => {
|
|
2046
|
+
subscriptions.add(client.spaces.isReady.subscribe(async (ready) => {
|
|
1660
2047
|
if (ready) {
|
|
1661
2048
|
await clientPlugin?.provides.client.spaces.default.waitUntilReady();
|
|
1662
2049
|
if (firstRun) {
|
|
@@ -1666,7 +2053,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1666
2053
|
}
|
|
1667
2054
|
await onSpaceReady();
|
|
1668
2055
|
}
|
|
1669
|
-
});
|
|
2056
|
+
}).unsubscribe);
|
|
1670
2057
|
},
|
|
1671
2058
|
unload: async () => {
|
|
1672
2059
|
settings.close();
|
|
@@ -1682,6 +2069,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1682
2069
|
...translations_default,
|
|
1683
2070
|
osTranslations
|
|
1684
2071
|
],
|
|
2072
|
+
complementary: {
|
|
2073
|
+
panels: [
|
|
2074
|
+
{
|
|
2075
|
+
id: "settings",
|
|
2076
|
+
label: [
|
|
2077
|
+
"open settings panel label",
|
|
2078
|
+
{
|
|
2079
|
+
ns: SPACE_PLUGIN
|
|
2080
|
+
}
|
|
2081
|
+
],
|
|
2082
|
+
icon: "ph--gear--regular"
|
|
2083
|
+
}
|
|
2084
|
+
]
|
|
2085
|
+
},
|
|
1685
2086
|
root: () => state.values.awaiting ? /* @__PURE__ */ React17.createElement(AwaitingObject, {
|
|
1686
2087
|
id: state.values.awaiting
|
|
1687
2088
|
}) : null,
|
|
@@ -1694,8 +2095,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1694
2095
|
ns: SPACE_PLUGIN
|
|
1695
2096
|
}
|
|
1696
2097
|
],
|
|
1697
|
-
icon:
|
|
1698
|
-
iconSymbol: "ph--cards-three--regular",
|
|
2098
|
+
icon: "ph--cards-three--regular",
|
|
1699
2099
|
// TODO(wittjosiah): Move out of metadata.
|
|
1700
2100
|
loadReferences: (collection) => loadObjectReferences(collection, (collection2) => [
|
|
1701
2101
|
...collection2.objects,
|
|
@@ -1711,44 +2111,39 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1711
2111
|
},
|
|
1712
2112
|
surface: {
|
|
1713
2113
|
component: ({ data, role, ...rest }) => {
|
|
1714
|
-
const primary = data.active ?? data.object;
|
|
1715
2114
|
switch (role) {
|
|
1716
2115
|
case "article":
|
|
1717
|
-
|
|
1718
|
-
return isSpace2(primary) && primary.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface2, {
|
|
2116
|
+
return isSpace2(data.object) && data.object.state.get() === SpaceState3.SPACE_READY ? /* @__PURE__ */ React17.createElement(Surface2, {
|
|
1719
2117
|
data: {
|
|
1720
|
-
|
|
2118
|
+
object: data.object.properties[CollectionType.typename],
|
|
2119
|
+
id: data.object.id
|
|
1721
2120
|
},
|
|
1722
2121
|
role,
|
|
1723
2122
|
...rest
|
|
1724
|
-
}) :
|
|
2123
|
+
}) : data.object instanceof CollectionType ? {
|
|
1725
2124
|
node: /* @__PURE__ */ React17.createElement(CollectionMain, {
|
|
1726
|
-
collection:
|
|
2125
|
+
collection: data.object
|
|
1727
2126
|
}),
|
|
1728
2127
|
disposition: "fallback"
|
|
1729
|
-
} :
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
default:
|
|
1740
|
-
return null;
|
|
1741
|
-
}
|
|
2128
|
+
} : null;
|
|
2129
|
+
case "complementary--settings":
|
|
2130
|
+
return isSpace2(data.subject) ? /* @__PURE__ */ React17.createElement(SpaceSettingsPanel, {
|
|
2131
|
+
space: data.subject
|
|
2132
|
+
}) : isEchoObject2(data.subject) ? {
|
|
2133
|
+
node: /* @__PURE__ */ React17.createElement(DefaultObjectSettings, {
|
|
2134
|
+
object: data.subject
|
|
2135
|
+
}),
|
|
2136
|
+
disposition: "fallback"
|
|
2137
|
+
} : null;
|
|
1742
2138
|
case "dialog":
|
|
1743
2139
|
if (data.component === "dxos.org/plugin/space/InvitationManagerDialog") {
|
|
1744
2140
|
return /* @__PURE__ */ React17.createElement(Dialog.Content, null, /* @__PURE__ */ React17.createElement(ClipboardProvider2, null, /* @__PURE__ */ React17.createElement(InvitationManager, {
|
|
1745
2141
|
active: true,
|
|
1746
2142
|
...data.subject
|
|
1747
2143
|
})));
|
|
1748
|
-
} else {
|
|
1749
|
-
return null;
|
|
1750
2144
|
}
|
|
1751
|
-
|
|
2145
|
+
return null;
|
|
2146
|
+
case "popover": {
|
|
1752
2147
|
if (data.component === "dxos.org/plugin/space/RenameSpacePopover" && isSpace2(data.subject)) {
|
|
1753
2148
|
return /* @__PURE__ */ React17.createElement(PopoverRenameSpace, {
|
|
1754
2149
|
space: data.subject
|
|
@@ -1760,10 +2155,14 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1760
2155
|
});
|
|
1761
2156
|
}
|
|
1762
2157
|
return null;
|
|
2158
|
+
}
|
|
2159
|
+
// TODO(burdon): Add role name syntax to minimal plugin docs.
|
|
1763
2160
|
case "presence--glyph": {
|
|
1764
2161
|
return isReactiveObject2(data.object) ? /* @__PURE__ */ React17.createElement(SmallPresenceLive, {
|
|
2162
|
+
id: data.id,
|
|
1765
2163
|
viewers: state.values.viewersByObject[fullyQualifiedId4(data.object)]
|
|
1766
2164
|
}) : /* @__PURE__ */ React17.createElement(SmallPresence, {
|
|
2165
|
+
id: data.id,
|
|
1767
2166
|
count: 0
|
|
1768
2167
|
});
|
|
1769
2168
|
}
|
|
@@ -1794,13 +2193,16 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1794
2193
|
settings: settings.values
|
|
1795
2194
|
}) : null;
|
|
1796
2195
|
case "menu-footer":
|
|
1797
|
-
if (
|
|
1798
|
-
return null;
|
|
1799
|
-
} else {
|
|
2196
|
+
if (isEchoObject2(data.object)) {
|
|
1800
2197
|
return /* @__PURE__ */ React17.createElement(MenuFooter, {
|
|
1801
2198
|
object: data.object
|
|
1802
2199
|
});
|
|
2200
|
+
} else {
|
|
2201
|
+
return null;
|
|
1803
2202
|
}
|
|
2203
|
+
case "status": {
|
|
2204
|
+
return /* @__PURE__ */ React17.createElement(SyncStatus, null);
|
|
2205
|
+
}
|
|
1804
2206
|
default:
|
|
1805
2207
|
return null;
|
|
1806
2208
|
}
|
|
@@ -1810,12 +2212,12 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1810
2212
|
builder: (plugins) => {
|
|
1811
2213
|
const clientPlugin2 = resolvePlugin(plugins, parseClientPlugin);
|
|
1812
2214
|
const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);
|
|
1813
|
-
const
|
|
2215
|
+
const graphPlugin2 = resolvePlugin(plugins, parseGraphPlugin);
|
|
1814
2216
|
const client = clientPlugin2?.provides.client;
|
|
1815
2217
|
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
1816
2218
|
const resolve = metadataPlugin?.provides.metadata.resolver;
|
|
1817
|
-
const graph =
|
|
1818
|
-
if (!
|
|
2219
|
+
const graph = graphPlugin2?.provides.graph;
|
|
2220
|
+
if (!client || !dispatch || !resolve || !graph) {
|
|
1819
2221
|
return [];
|
|
1820
2222
|
}
|
|
1821
2223
|
return [
|
|
@@ -1847,7 +2249,6 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1847
2249
|
ns: SPACE_PLUGIN
|
|
1848
2250
|
}
|
|
1849
2251
|
],
|
|
1850
|
-
palette: "teal",
|
|
1851
2252
|
testId: "spacePlugin.spaces",
|
|
1852
2253
|
role: "branch",
|
|
1853
2254
|
childrenPersistenceClass: "echo",
|
|
@@ -1859,9 +2260,9 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1859
2260
|
if (spacesOrder) {
|
|
1860
2261
|
spacesOrder.order = nextOrder.map(({ id }) => id);
|
|
1861
2262
|
} else {
|
|
1862
|
-
|
|
1863
|
-
F:
|
|
1864
|
-
L:
|
|
2263
|
+
log3.warn("spaces order object not found", void 0, {
|
|
2264
|
+
F: __dxlog_file6,
|
|
2265
|
+
L: 553,
|
|
1865
2266
|
S: void 0,
|
|
1866
2267
|
C: (f, a) => f(...a)
|
|
1867
2268
|
});
|
|
@@ -1897,10 +2298,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1897
2298
|
ns: SPACE_PLUGIN
|
|
1898
2299
|
}
|
|
1899
2300
|
],
|
|
1900
|
-
icon:
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
2301
|
+
icon: "ph--plus--regular",
|
|
2302
|
+
disposition: "item",
|
|
2303
|
+
testId: "spacePlugin.createSpace",
|
|
2304
|
+
className: "pbs-4"
|
|
1904
2305
|
}
|
|
1905
2306
|
},
|
|
1906
2307
|
{
|
|
@@ -1923,9 +2324,10 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
1923
2324
|
ns: SPACE_PLUGIN
|
|
1924
2325
|
}
|
|
1925
2326
|
],
|
|
1926
|
-
icon:
|
|
1927
|
-
|
|
1928
|
-
testId: "spacePlugin.joinSpace"
|
|
2327
|
+
icon: "ph--sign-in--regular",
|
|
2328
|
+
disposition: "item",
|
|
2329
|
+
testId: "spacePlugin.joinSpace",
|
|
2330
|
+
className: "pbe-4"
|
|
1929
2331
|
}
|
|
1930
2332
|
}
|
|
1931
2333
|
],
|
|
@@ -2052,11 +2454,77 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2052
2454
|
resolve
|
|
2053
2455
|
})).filter(nonNullable);
|
|
2054
2456
|
}
|
|
2457
|
+
}),
|
|
2458
|
+
// Create nodes for object settings.
|
|
2459
|
+
createExtension({
|
|
2460
|
+
id: `${SPACE_PLUGIN}/settings-for-subject`,
|
|
2461
|
+
resolver: ({ id }) => {
|
|
2462
|
+
if (!id.endsWith("~settings")) {
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
const type = "orphan-settings-for-subject";
|
|
2466
|
+
const icon = "ph--gear--regular";
|
|
2467
|
+
const [subjectId] = id.split("~");
|
|
2468
|
+
const { spaceId, objectId } = parseId(subjectId);
|
|
2469
|
+
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
2470
|
+
if (!objectId) {
|
|
2471
|
+
const label2 = space ? space.properties.name || [
|
|
2472
|
+
"unnamed space label",
|
|
2473
|
+
{
|
|
2474
|
+
ns: SPACE_PLUGIN
|
|
2475
|
+
}
|
|
2476
|
+
] : [
|
|
2477
|
+
"unnamed object settings label",
|
|
2478
|
+
{
|
|
2479
|
+
ns: SPACE_PLUGIN
|
|
2480
|
+
}
|
|
2481
|
+
];
|
|
2482
|
+
return {
|
|
2483
|
+
id,
|
|
2484
|
+
type,
|
|
2485
|
+
data: null,
|
|
2486
|
+
properties: {
|
|
2487
|
+
icon,
|
|
2488
|
+
label: label2,
|
|
2489
|
+
showResolvedThreads: false,
|
|
2490
|
+
object: null,
|
|
2491
|
+
space
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
const object = toSignal((onChange) => {
|
|
2496
|
+
const timeout = setTimeout(async () => {
|
|
2497
|
+
await space?.db.loadObjectById(objectId);
|
|
2498
|
+
onChange();
|
|
2499
|
+
});
|
|
2500
|
+
return () => clearTimeout(timeout);
|
|
2501
|
+
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
2502
|
+
if (!object || !subjectId) {
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
const meta = resolve(getTypename2(object) ?? "");
|
|
2506
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
2507
|
+
"unnamed object settings label",
|
|
2508
|
+
{
|
|
2509
|
+
ns: SPACE_PLUGIN
|
|
2510
|
+
}
|
|
2511
|
+
];
|
|
2512
|
+
return {
|
|
2513
|
+
id,
|
|
2514
|
+
type,
|
|
2515
|
+
data: null,
|
|
2516
|
+
properties: {
|
|
2517
|
+
icon,
|
|
2518
|
+
label,
|
|
2519
|
+
object
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2055
2523
|
})
|
|
2056
2524
|
];
|
|
2057
2525
|
},
|
|
2058
2526
|
serializer: (plugins) => {
|
|
2059
|
-
const dispatch = resolvePlugin(plugins,
|
|
2527
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin2)?.provides.intent.dispatch;
|
|
2060
2528
|
if (!dispatch) {
|
|
2061
2529
|
return [];
|
|
2062
2530
|
}
|
|
@@ -2159,6 +2627,25 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2159
2627
|
}
|
|
2160
2628
|
},
|
|
2161
2629
|
intents: [
|
|
2630
|
+
...settings.values.onSpaceCreate ? [
|
|
2631
|
+
[
|
|
2632
|
+
{
|
|
2633
|
+
action: settings.values.onSpaceCreate,
|
|
2634
|
+
data: {
|
|
2635
|
+
space
|
|
2636
|
+
}
|
|
2637
|
+
},
|
|
2638
|
+
{
|
|
2639
|
+
action: SpaceAction.ADD_OBJECT,
|
|
2640
|
+
data: {
|
|
2641
|
+
target: space
|
|
2642
|
+
}
|
|
2643
|
+
},
|
|
2644
|
+
{
|
|
2645
|
+
action: NavigationAction3.EXPOSE
|
|
2646
|
+
}
|
|
2647
|
+
]
|
|
2648
|
+
] : [],
|
|
2162
2649
|
[
|
|
2163
2650
|
{
|
|
2164
2651
|
action: ObservabilityAction.SEND_EVENT,
|
|
@@ -2190,6 +2677,20 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2190
2677
|
}
|
|
2191
2678
|
},
|
|
2192
2679
|
intents: [
|
|
2680
|
+
[
|
|
2681
|
+
{
|
|
2682
|
+
action: LayoutAction2.SET_LAYOUT,
|
|
2683
|
+
data: {
|
|
2684
|
+
element: "toast",
|
|
2685
|
+
subject: {
|
|
2686
|
+
id: `${SPACE_PLUGIN}/join-success`,
|
|
2687
|
+
duration: 1e4,
|
|
2688
|
+
title: translations_default[0]["en-US"][SPACE_PLUGIN]["join success label"],
|
|
2689
|
+
closeLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["dismiss label"]
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
],
|
|
2193
2694
|
[
|
|
2194
2695
|
{
|
|
2195
2696
|
action: ObservabilityAction.SEND_EVENT,
|
|
@@ -2379,8 +2880,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2379
2880
|
title: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit label"],
|
|
2380
2881
|
description: translations_default[0]["en-US"][SPACE_PLUGIN]["space limit description"],
|
|
2381
2882
|
duration: 5e3,
|
|
2382
|
-
icon:
|
|
2383
|
-
iconSymbol: "ph--warning--regular",
|
|
2883
|
+
icon: "ph--warning--regular",
|
|
2384
2884
|
actionLabel: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects label"],
|
|
2385
2885
|
actionAlt: translations_default[0]["en-US"][SPACE_PLUGIN]["remove deleted objects alt"],
|
|
2386
2886
|
// TODO(wittjosiah): Use OS namespace.
|
|
@@ -2422,7 +2922,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2422
2922
|
}
|
|
2423
2923
|
return {
|
|
2424
2924
|
data: {
|
|
2425
|
-
id: object
|
|
2925
|
+
id: fullyQualifiedId4(object),
|
|
2426
2926
|
object,
|
|
2427
2927
|
activeParts: {
|
|
2428
2928
|
main: [
|
|
@@ -2475,8 +2975,7 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2475
2975
|
data: {
|
|
2476
2976
|
activeParts: {
|
|
2477
2977
|
main: deletionData.wasActive,
|
|
2478
|
-
sidebar: deletionData.wasActive
|
|
2479
|
-
complementary: deletionData.wasActive
|
|
2978
|
+
sidebar: deletionData.wasActive
|
|
2480
2979
|
}
|
|
2481
2980
|
}
|
|
2482
2981
|
});
|
|
@@ -2554,10 +3053,11 @@ var SpacePlugin = ({ firstRun, onFirstRun } = {}) => {
|
|
|
2554
3053
|
case SpaceAction.DUPLICATE_OBJECT: {
|
|
2555
3054
|
const originalObject = intent.data?.object ?? intent.data?.result;
|
|
2556
3055
|
const resolve = resolvePlugin(plugins, parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
2557
|
-
|
|
3056
|
+
const space = isSpace2(intent.data?.target) ? intent.data?.target : getSpace4(intent.data?.target);
|
|
3057
|
+
if (!isEchoObject2(originalObject) || !resolve || !space) {
|
|
2558
3058
|
return;
|
|
2559
3059
|
}
|
|
2560
|
-
const newObject = await cloneObject(originalObject, resolve);
|
|
3060
|
+
const newObject = await cloneObject(originalObject, resolve, space);
|
|
2561
3061
|
return {
|
|
2562
3062
|
intents: [
|
|
2563
3063
|
[
|
|
@@ -2596,12 +3096,11 @@ export {
|
|
|
2596
3096
|
CollectionSection,
|
|
2597
3097
|
CollectionType,
|
|
2598
3098
|
ContactType,
|
|
2599
|
-
|
|
2600
|
-
EmptyTree,
|
|
3099
|
+
DefaultObjectSettings,
|
|
2601
3100
|
FullPresence,
|
|
2602
3101
|
MenuFooter,
|
|
3102
|
+
MessageState,
|
|
2603
3103
|
MessageType,
|
|
2604
|
-
MissingObject,
|
|
2605
3104
|
PersistenceStatus,
|
|
2606
3105
|
PopoverRenameObject,
|
|
2607
3106
|
PopoverRenameSpace,
|
|
@@ -2620,6 +3119,10 @@ export {
|
|
|
2620
3119
|
SpacePlugin,
|
|
2621
3120
|
SpacePresence,
|
|
2622
3121
|
SpaceSettings,
|
|
3122
|
+
SpaceSettingsPanel,
|
|
3123
|
+
SyncStatus,
|
|
3124
|
+
SyncStatusDetail,
|
|
3125
|
+
SyncStatusIndicator,
|
|
2623
3126
|
ThreadStatus,
|
|
2624
3127
|
ThreadType,
|
|
2625
3128
|
cloneObject,
|
|
@@ -2634,6 +3137,7 @@ export {
|
|
|
2634
3137
|
getNestedObjects,
|
|
2635
3138
|
getSpaceDisplayName,
|
|
2636
3139
|
memoizeQuery,
|
|
3140
|
+
parseSpaceInitPlugin,
|
|
2637
3141
|
parseSpacePlugin,
|
|
2638
3142
|
translations_default as translations
|
|
2639
3143
|
};
|