@dxos/plugin-space 0.6.8-main.046e6cf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +15 -0
  3. package/dist/lib/browser/chunk-DTVUOG2C.mjs +95 -0
  4. package/dist/lib/browser/chunk-DTVUOG2C.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-LZEGRS7H.mjs +35 -0
  6. package/dist/lib/browser/chunk-LZEGRS7H.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +2660 -0
  8. package/dist/lib/browser/index.mjs.map +7 -0
  9. package/dist/lib/browser/meta.json +1 -0
  10. package/dist/lib/browser/meta.mjs +13 -0
  11. package/dist/lib/browser/meta.mjs.map +7 -0
  12. package/dist/lib/browser/types/index.mjs +21 -0
  13. package/dist/lib/browser/types/index.mjs.map +7 -0
  14. package/dist/lib/node/chunk-6CNYF6YU.cjs +60 -0
  15. package/dist/lib/node/chunk-6CNYF6YU.cjs.map +7 -0
  16. package/dist/lib/node/chunk-CVZPI2P3.cjs +120 -0
  17. package/dist/lib/node/chunk-CVZPI2P3.cjs.map +7 -0
  18. package/dist/lib/node/index.cjs +2682 -0
  19. package/dist/lib/node/index.cjs.map +7 -0
  20. package/dist/lib/node/meta.cjs +34 -0
  21. package/dist/lib/node/meta.cjs.map +7 -0
  22. package/dist/lib/node/meta.json +1 -0
  23. package/dist/lib/node/types/index.cjs +43 -0
  24. package/dist/lib/node/types/index.cjs.map +7 -0
  25. package/dist/types/src/SpacePlugin.d.ts +27 -0
  26. package/dist/types/src/SpacePlugin.d.ts.map +1 -0
  27. package/dist/types/src/components/AwaitingObject.d.ts +5 -0
  28. package/dist/types/src/components/AwaitingObject.d.ts.map +1 -0
  29. package/dist/types/src/components/CollectionMain.d.ts +6 -0
  30. package/dist/types/src/components/CollectionMain.d.ts.map +1 -0
  31. package/dist/types/src/components/CollectionSection.d.ts +6 -0
  32. package/dist/types/src/components/CollectionSection.d.ts.map +1 -0
  33. package/dist/types/src/components/EmptySpace.d.ts +3 -0
  34. package/dist/types/src/components/EmptySpace.d.ts.map +1 -0
  35. package/dist/types/src/components/EmptyTree.d.ts +3 -0
  36. package/dist/types/src/components/EmptyTree.d.ts.map +1 -0
  37. package/dist/types/src/components/MenuFooter.d.ts +6 -0
  38. package/dist/types/src/components/MenuFooter.d.ts.map +1 -0
  39. package/dist/types/src/components/MissingObject.d.ts +5 -0
  40. package/dist/types/src/components/MissingObject.d.ts.map +1 -0
  41. package/dist/types/src/components/PersistenceStatus.d.ts +6 -0
  42. package/dist/types/src/components/PersistenceStatus.d.ts.map +1 -0
  43. package/dist/types/src/components/PopoverRenameObject.d.ts +6 -0
  44. package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -0
  45. package/dist/types/src/components/PopoverRenameSpace.d.ts +6 -0
  46. package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -0
  47. package/dist/types/src/components/ShareSpaceButton.d.ts +8 -0
  48. package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -0
  49. package/dist/types/src/components/ShareSpaceButton.stories.d.ts +98 -0
  50. package/dist/types/src/components/ShareSpaceButton.stories.d.ts.map +1 -0
  51. package/dist/types/src/components/SpaceMain/SpaceMain.d.ts +10 -0
  52. package/dist/types/src/components/SpaceMain/SpaceMain.d.ts.map +1 -0
  53. package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts +6 -0
  54. package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts.map +1 -0
  55. package/dist/types/src/components/SpaceMain/index.d.ts +2 -0
  56. package/dist/types/src/components/SpaceMain/index.d.ts.map +1 -0
  57. package/dist/types/src/components/SpacePresence.d.ts +34 -0
  58. package/dist/types/src/components/SpacePresence.d.ts.map +1 -0
  59. package/dist/types/src/components/SpacePresence.stories.d.ts +97 -0
  60. package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -0
  61. package/dist/types/src/components/SpaceSettings.d.ts +6 -0
  62. package/dist/types/src/components/SpaceSettings.d.ts.map +1 -0
  63. package/dist/types/src/components/index.d.ts +15 -0
  64. package/dist/types/src/components/index.d.ts.map +1 -0
  65. package/dist/types/src/index.d.ts +9 -0
  66. package/dist/types/src/index.d.ts.map +1 -0
  67. package/dist/types/src/meta.d.ts +26 -0
  68. package/dist/types/src/meta.d.ts.map +1 -0
  69. package/dist/types/src/translations.d.ts +83 -0
  70. package/dist/types/src/translations.d.ts.map +1 -0
  71. package/dist/types/src/types/collection.d.ts +18 -0
  72. package/dist/types/src/types/collection.d.ts.map +1 -0
  73. package/dist/types/src/types/index.d.ts +4 -0
  74. package/dist/types/src/types/index.d.ts.map +1 -0
  75. package/dist/types/src/types/thread.d.ts +225 -0
  76. package/dist/types/src/types/thread.d.ts.map +1 -0
  77. package/dist/types/src/types/types.d.ts +54 -0
  78. package/dist/types/src/types/types.d.ts.map +1 -0
  79. package/dist/types/src/util.d.ts +85 -0
  80. package/dist/types/src/util.d.ts.map +1 -0
  81. package/package.json +101 -0
  82. package/src/SpacePlugin.tsx +1234 -0
  83. package/src/components/AwaitingObject.tsx +118 -0
  84. package/src/components/CollectionMain.tsx +33 -0
  85. package/src/components/CollectionSection.tsx +20 -0
  86. package/src/components/EmptySpace.tsx +25 -0
  87. package/src/components/EmptyTree.tsx +25 -0
  88. package/src/components/MenuFooter.tsx +33 -0
  89. package/src/components/MissingObject.tsx +54 -0
  90. package/src/components/PersistenceStatus.tsx +87 -0
  91. package/src/components/PopoverRenameObject.tsx +54 -0
  92. package/src/components/PopoverRenameSpace.tsx +44 -0
  93. package/src/components/ShareSpaceButton.stories.tsx +23 -0
  94. package/src/components/ShareSpaceButton.tsx +27 -0
  95. package/src/components/SpaceMain/SpaceMain.tsx +81 -0
  96. package/src/components/SpaceMain/SpaceMembersSection.tsx +205 -0
  97. package/src/components/SpaceMain/index.ts +5 -0
  98. package/src/components/SpacePresence.stories.tsx +102 -0
  99. package/src/components/SpacePresence.tsx +244 -0
  100. package/src/components/SpaceSettings.tsx +34 -0
  101. package/src/components/index.ts +18 -0
  102. package/src/index.ts +15 -0
  103. package/src/meta.ts +31 -0
  104. package/src/translations.ts +92 -0
  105. package/src/types/collection.ts +16 -0
  106. package/src/types/index.ts +7 -0
  107. package/src/types/thread.ts +68 -0
  108. package/src/types/types.ts +81 -0
  109. package/src/util.tsx +642 -0
@@ -0,0 +1,92 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { SPACE_PLUGIN } from './meta';
6
+
7
+ export default [
8
+ {
9
+ 'en-US': {
10
+ [SPACE_PLUGIN]: {
11
+ 'plugin name': 'Spaces',
12
+ 'first run message': 'Nothing selected.',
13
+ 'create space label': 'Create a new space',
14
+ 'join space label': 'Join a space',
15
+ 'empty space message': 'No documents',
16
+ 'empty tree message': 'No spaces',
17
+ 'unnamed space label': 'New space',
18
+ 'closed space label': 'Closed',
19
+ 'loading space label': 'Loading space…',
20
+ 'lock space label': 'Lock space',
21
+ 'unlock space label': 'Unlock space',
22
+ 'rename space label': 'Rename space',
23
+ 'active space label': 'Active space:',
24
+ 'space name label': 'Space name',
25
+ 'object name label': 'Object name',
26
+ 'close space label': 'Close space',
27
+ 'open space label': 'Open space',
28
+ 'export data label': 'Export data',
29
+ 'import data label': 'Import data',
30
+ 'migrate space label': 'Migrate space',
31
+ 'share space': 'Share space',
32
+ 'save space to disk label': 'Save to disk',
33
+ 'load space from disk label': 'Load from disk',
34
+ 'confirm restore title': 'Overwrite files in this space?',
35
+ 'confirm restore body': 'Restoring from a backup will overwrite the contents of any documents that match.',
36
+ 'upload file message': 'Drag file here or click to browse',
37
+ 'object title placeholder': 'Type a title here…',
38
+ 'personal space label': 'Personal Space',
39
+ 'spaces label': 'Spaces',
40
+ 'show hidden spaces label': 'Show closed spaces',
41
+ 'save files to directory label': 'Save files to disk',
42
+ 'select path label': 'Select path',
43
+ 'rename collection label': 'Rename collection',
44
+ 'rename object label': 'Rename item',
45
+ 'duplicate object label': 'Duplicate item',
46
+ 'delete collection label': 'Delete collection',
47
+ 'delete object label': 'Delete item',
48
+ 'collection deleted label': 'Collection deleted',
49
+ 'object deleted label': 'Item deleted',
50
+ 'go to object label': 'Open item',
51
+ 'found object label': 'Ready.',
52
+ 'found object description': 'The requested object is now available.',
53
+ 'waiting for object label': 'Loading…',
54
+ 'waiting for object description': 'The requested object is still being synchronized.',
55
+ 'object not found label': 'Nothing found.',
56
+ 'object not found description':
57
+ 'The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
58
+ 'missing object message': 'Object not available.',
59
+ 'missing object description':
60
+ 'The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
61
+ 'create collection label': 'Create collection',
62
+ 'unnamed object label': 'New object',
63
+ 'unnamed collection label': 'New collection',
64
+ 'create object in space label': 'Add to space',
65
+ 'create object in collection label': 'Add to collection',
66
+ 'share space label': 'Share',
67
+ 'space members label': 'Space members',
68
+ 'active space members heading': 'Online ({{count}})',
69
+ 'inactive space members heading': 'Offline ({{count}})',
70
+ 'presence label_zero': 'No other viewers',
71
+ 'presence label_one': '1 other viewer',
72
+ 'presence label_other': '{{count}} other viewers',
73
+ 'persisted locally label': 'Changes saved locally.',
74
+ 'persisted locally message': 'All changes have been saved to disk on this device.',
75
+ 'persistence pending label': 'Saving…',
76
+ 'persistence error label': 'Error saving changes.',
77
+ 'more actions label': 'More actions',
78
+ 'invitations heading': 'Invitations',
79
+ 'keyshortcuts label': 'Keyboard shortcuts',
80
+ 'menu footer label': 'Details',
81
+ 'location label': 'Located in',
82
+ 'space limit label': 'Space Limit Reached',
83
+ 'space limit description':
84
+ 'This space has reached the maximum number of objects for the beta. This limit includes deleted objects currently, but those can be permanently removed with the cleanup action.',
85
+ 'space limit close label': 'Close',
86
+ 'remove deleted objects label': 'Cleanup',
87
+ 'remove deleted objects alt': 'Permanently remove deleted objects to free up space.',
88
+ 'copy link label': 'Copy link',
89
+ },
90
+ },
91
+ },
92
+ ];
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { Expando, ref, S, TypedObject } from '@dxos/echo-schema';
6
+
7
+ export class CollectionType extends TypedObject({ typename: 'dxos.org/type/Collection', version: '0.1.0' })({
8
+ name: S.optional(S.String),
9
+ objects: S.mutable(S.Array(ref(Expando))),
10
+ // Key is schema typename and value is reference to a view object of the associated schema.
11
+ // Having collection reference the views rather than vice versa ensures that the state converges to a single view per key (i.e. type).
12
+ // This also leaves open a future where this key could be changed to allow for multiple stack views per section.
13
+ // TODO(wittjosiah): Any way to make this more type safe?
14
+ // TODO(wittjosiah): Should the views be separate objects or just be schemas for view data in this record?
15
+ views: S.mutable(S.Record(S.String, ref(Expando))),
16
+ }) {}
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './collection';
6
+ export * from './thread';
7
+ export * from './types';
@@ -0,0 +1,68 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { Expando, ref, S, TypedObject } from '@dxos/echo-schema';
6
+
7
+ // TODO(wittjosiah): These types were placed here rather than in @dxos/plugin-thread
8
+ // in order to avoid a circular dependency between threads and other objects that use threads.
9
+
10
+ // TODO(wittjosiah): Factor out to halo?
11
+ export class ContactType extends TypedObject({ typename: 'dxos.org/type/Contact', version: '0.1.0' })({
12
+ name: S.optional(S.String),
13
+ identifiers: S.mutable(
14
+ S.Array(
15
+ S.Struct({
16
+ type: S.String,
17
+ value: S.String,
18
+ }),
19
+ ),
20
+ ),
21
+ }) {}
22
+
23
+ export const ActorSchema = S.mutable(
24
+ S.Struct({
25
+ contact: S.optional(ref(ContactType)),
26
+ // TODO(wittjosiah): Should the below fields just be the contact schema?
27
+ // i.e. it should either be a reference to an existing contact or an inline contact schema.
28
+ identityKey: S.optional(S.String),
29
+ // TODO(burdon): Generalize to handle/identifier?
30
+ email: S.optional(S.String),
31
+ name: S.optional(S.String),
32
+ }),
33
+ );
34
+
35
+ export type ActorType = S.Schema.Type<typeof ActorSchema>;
36
+
37
+ export class MessageType extends TypedObject({ typename: 'dxos.org/type/Message', version: '0.1.0' })({
38
+ /** ISO date string when the message was sent. */
39
+ timestamp: S.String,
40
+ /** Identity of the message sender. */
41
+ sender: ActorSchema,
42
+ /** Text content of the message. */
43
+ text: S.String,
44
+ /** Non-text content sent with a message (e.g. files, polls, etc.) */
45
+ parts: S.optional(S.mutable(S.Array(ref(Expando)))),
46
+ /** Custom properties for specific message types (e.g. email subject or cc fields). */
47
+ properties: S.optional(S.mutable(S.Record(S.String, S.Any))),
48
+ // TODO(wittjosiah): Add read status:
49
+ // - Read receipts need to be per space member.
50
+ // - Read receipts don't need to be added to schema until they being implemented.
51
+ /** Context of the application when message was created. */
52
+ // TODO(burdon): Evolve "attention object" to be current UX state? E.g., of Deck?
53
+ context: S.optional(ref(Expando)),
54
+ }) {}
55
+
56
+ export const ThreadStatus = S.Union(S.Literal('staged'), S.Literal('active'), S.Literal('resolved'));
57
+
58
+ export class ThreadType extends TypedObject({ typename: 'dxos.org/type/Thread', version: '0.1.0' })({
59
+ name: S.optional(S.String),
60
+ anchor: S.optional(S.String),
61
+ status: S.optional(ThreadStatus),
62
+ messages: S.mutable(S.Array(ref(MessageType))),
63
+ }) {}
64
+
65
+ export class ChannelType extends TypedObject({ typename: 'dxos.org/type/Channel', version: '0.1.0' })({
66
+ name: S.optional(S.String),
67
+ threads: S.mutable(S.Array(ref(ThreadType))),
68
+ }) {}
@@ -0,0 +1,81 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import type {
6
+ GraphBuilderProvides,
7
+ GraphSerializerProvides,
8
+ IntentResolverProvides,
9
+ MetadataRecordsProvides,
10
+ SettingsProvides,
11
+ SurfaceProvides,
12
+ TranslationsProvides,
13
+ } from '@dxos/app-framework';
14
+ import { type Expando } from '@dxos/echo-schema';
15
+ import { type SchemaProvides } from '@dxos/plugin-client';
16
+ import { type PublicKey } from '@dxos/react-client';
17
+ import { type ComplexMap } from '@dxos/util';
18
+
19
+ export const SPACE_DIRECTORY_HANDLE = 'dxos.org/plugin/space/directory';
20
+
21
+ export type ObjectViewerProps = {
22
+ lastSeen: number;
23
+ currentlyAttended: boolean;
24
+ };
25
+
26
+ export type ObjectId = string;
27
+
28
+ export type PluginState = {
29
+ /**
30
+ * Which objects are currently being viewed by which peers.
31
+ */
32
+ viewersByObject: Record<ObjectId, ComplexMap<PublicKey, ObjectViewerProps>>;
33
+
34
+ /**
35
+ * Which peers are currently viewing which objects.
36
+ */
37
+ viewersByIdentity: ComplexMap<PublicKey, Set<ObjectId>>;
38
+
39
+ /**
40
+ * Object that was linked to directly but not found and is being awaited.
41
+ */
42
+ awaiting: string | undefined;
43
+
44
+ /**
45
+ * Cached space names, used when spaces are closed or loading.
46
+ */
47
+ spaceNames: Record<string, string>;
48
+
49
+ /**
50
+ * Which spaces have an SDK migration running currently.
51
+ */
52
+ // TODO(wittjosiah): Factor out to sdk. Migration running should probably be a space state.
53
+ sdkMigrationRunning: Record<string, boolean>;
54
+ };
55
+
56
+ export type SpaceSettingsProps = { showHidden?: boolean };
57
+
58
+ export type SpacePluginProvides = SurfaceProvides &
59
+ IntentResolverProvides &
60
+ GraphBuilderProvides &
61
+ GraphSerializerProvides &
62
+ MetadataRecordsProvides &
63
+ SettingsProvides<SpaceSettingsProps> &
64
+ TranslationsProvides &
65
+ SchemaProvides & {
66
+ space: Readonly<PluginState>;
67
+ };
68
+
69
+ // TODO(wittjosiah): Reconcile with graph export serializers.
70
+
71
+ export type SerializerMap = Record<string, TypedObjectSerializer>;
72
+
73
+ export interface TypedObjectSerializer<T extends Expando = Expando> {
74
+ serialize(params: { object: T }): Promise<string>;
75
+
76
+ /**
77
+ * @param params.content
78
+ * @param params.newId Generate new ID for deserialized object.
79
+ */
80
+ deserialize(params: { content: string; newId?: boolean }): Promise<T>;
81
+ }