@dxos/plugin-space 0.7.4 → 0.7.5-feature-compute.4d9d99a
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/app-graph-builder-5D2QB43K.mjs +365 -0
- package/dist/lib/browser/app-graph-builder-5D2QB43K.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-VNWPLPDF.mjs +80 -0
- package/dist/lib/browser/app-graph-serializer-VNWPLPDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-5TBRONF6.mjs +133 -0
- package/dist/lib/browser/chunk-5TBRONF6.mjs.map +7 -0
- package/dist/lib/browser/chunk-6SWQRWOD.mjs +1672 -0
- package/dist/lib/browser/chunk-6SWQRWOD.mjs.map +7 -0
- package/dist/lib/browser/chunk-HCXWKGTE.mjs +316 -0
- package/dist/lib/browser/chunk-HCXWKGTE.mjs.map +7 -0
- package/dist/lib/browser/chunk-SOXNANA6.mjs +12 -0
- package/dist/lib/browser/chunk-SOXNANA6.mjs.map +7 -0
- package/dist/lib/browser/chunk-UH5P4UL3.mjs +21 -0
- package/dist/lib/browser/chunk-UH5P4UL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZBKFJNHH.mjs +523 -0
- package/dist/lib/browser/chunk-ZBKFJNHH.mjs.map +7 -0
- package/dist/lib/browser/identity-created-EC5FOCX2.mjs +28 -0
- package/dist/lib/browser/identity-created-EC5FOCX2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +192 -3521
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-VBL572N7.mjs +459 -0
- package/dist/lib/browser/intent-resolver-VBL572N7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-root-AZJFNTKK.mjs +28 -0
- package/dist/lib/browser/react-root-AZJFNTKK.mjs.map +7 -0
- package/dist/lib/browser/react-surface-E2VSYVNZ.mjs +238 -0
- package/dist/lib/browser/react-surface-E2VSYVNZ.mjs.map +7 -0
- package/dist/lib/browser/settings-ASFF5BZL.mjs +24 -0
- package/dist/lib/browser/settings-ASFF5BZL.mjs.map +7 -0
- package/dist/lib/browser/spaces-ready-4SFNS5JQ.mjs +200 -0
- package/dist/lib/browser/spaces-ready-4SFNS5JQ.mjs.map +7 -0
- package/dist/lib/browser/state-MS4KYJWI.mjs +47 -0
- package/dist/lib/browser/state-MS4KYJWI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -5
- package/dist/lib/node/app-graph-builder-ZQ5S62YR.cjs +368 -0
- package/dist/lib/node/app-graph-builder-ZQ5S62YR.cjs.map +7 -0
- package/dist/lib/node/app-graph-serializer-72S7P33H.cjs +88 -0
- package/dist/lib/node/app-graph-serializer-72S7P33H.cjs.map +7 -0
- package/dist/lib/node/chunk-56NGXG2A.cjs +41 -0
- package/dist/lib/node/chunk-56NGXG2A.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-AO4EW2RX.cjs} +12 -13
- package/dist/lib/node/chunk-AO4EW2RX.cjs.map +7 -0
- package/dist/lib/node/chunk-BQRNTKSQ.cjs +150 -0
- package/dist/lib/node/chunk-BQRNTKSQ.cjs.map +7 -0
- package/dist/lib/node/chunk-DDZYVNVP.cjs +345 -0
- package/dist/lib/node/chunk-DDZYVNVP.cjs.map +7 -0
- package/dist/lib/node/chunk-M64YG2FY.cjs +1669 -0
- package/dist/lib/node/chunk-M64YG2FY.cjs.map +7 -0
- package/dist/lib/node/chunk-Z34MTEU7.cjs +551 -0
- package/dist/lib/node/chunk-Z34MTEU7.cjs.map +7 -0
- package/dist/lib/node/identity-created-IMDS4A6A.cjs +44 -0
- package/dist/lib/node/identity-created-IMDS4A6A.cjs.map +7 -0
- package/dist/lib/node/index.cjs +175 -3506
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-S4HZABYI.cjs +458 -0
- package/dist/lib/node/intent-resolver-S4HZABYI.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-root-RB3OM3QG.cjs +50 -0
- package/dist/lib/node/react-root-RB3OM3QG.cjs.map +7 -0
- package/dist/lib/node/react-surface-TLKQEHHT.cjs +233 -0
- package/dist/lib/node/react-surface-TLKQEHHT.cjs.map +7 -0
- package/dist/lib/node/settings-QLCKAUHK.cjs +38 -0
- package/dist/lib/node/settings-QLCKAUHK.cjs.map +7 -0
- package/dist/lib/node/spaces-ready-RZTKEXOL.cjs +211 -0
- package/dist/lib/node/spaces-ready-RZTKEXOL.cjs.map +7 -0
- package/dist/lib/node/state-4UIOUKLJ.cjs +61 -0
- package/dist/lib/node/state-4UIOUKLJ.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +23 -14
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/app-graph-builder-CD6IYPSS.mjs +366 -0
- package/dist/lib/node-esm/app-graph-builder-CD6IYPSS.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-CFXS6ZE2.mjs +81 -0
- package/dist/lib/node-esm/app-graph-serializer-CFXS6ZE2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-375RB3CZ.mjs +22 -0
- package/dist/lib/node-esm/chunk-375RB3CZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7FUVU45N.mjs +14 -0
- package/dist/lib/node-esm/chunk-7FUVU45N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CLGCKZ2D.mjs +317 -0
- package/dist/lib/node-esm/chunk-CLGCKZ2D.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CMKML5IN.mjs +1673 -0
- package/dist/lib/node-esm/chunk-CMKML5IN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FUMGYUD3.mjs +524 -0
- package/dist/lib/node-esm/chunk-FUMGYUD3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M4XTHK35.mjs +134 -0
- package/dist/lib/node-esm/chunk-M4XTHK35.mjs.map +7 -0
- package/dist/lib/node-esm/identity-created-SJYZZ7Q3.mjs +29 -0
- package/dist/lib/node-esm/identity-created-SJYZZ7Q3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +192 -3521
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-OIQH7HN7.mjs +460 -0
- package/dist/lib/node-esm/intent-resolver-OIQH7HN7.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-root-WKJWCHXR.mjs +29 -0
- package/dist/lib/node-esm/react-root-WKJWCHXR.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-RVEHOSAD.mjs +239 -0
- package/dist/lib/node-esm/react-surface-RVEHOSAD.mjs.map +7 -0
- package/dist/lib/node-esm/settings-WLVEO4JM.mjs +25 -0
- package/dist/lib/node-esm/settings-WLVEO4JM.mjs.map +7 -0
- package/dist/lib/node-esm/spaces-ready-ITGYYT5A.mjs +201 -0
- package/dist/lib/node-esm/spaces-ready-ITGYYT5A.mjs.map +7 -0
- package/dist/lib/node-esm/state-BMISGQ2O.mjs +48 -0
- package/dist/lib/node-esm/state-BMISGQ2O.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +14 -5
- package/dist/types/src/SpacePlugin.d.ts +1 -24
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +4 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +15 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/identity-created.d.ts +4 -0
- package/dist/types/src/capabilities/identity-created.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +195 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +7 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts +4 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +5 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts +7 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts +8 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts +2 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/BaseObjectSettings.d.ts +7 -0
- package/dist/types/src/components/BaseObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +5 -4
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +5 -6
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -0
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts +9 -6
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts +4 -3
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts +3 -3
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts +2 -2
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +5 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/usePath.d.ts +11 -0
- package/dist/types/src/hooks/usePath.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -27
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +18 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/collection.d.ts +8 -12
- package/dist/types/src/types/collection.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +180 -186
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +228 -16
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +9 -8
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +38 -46
- package/src/SpacePlugin.tsx +119 -1541
- package/src/capabilities/app-graph-builder.ts +392 -0
- package/src/capabilities/app-graph-serializer.ts +73 -0
- package/src/capabilities/capabilities.ts +23 -0
- package/src/capabilities/identity-created.ts +26 -0
- package/src/capabilities/index.ts +17 -0
- package/src/capabilities/intent-resolver.ts +420 -0
- package/src/capabilities/react-root.tsx +20 -0
- package/src/capabilities/react-surface.tsx +234 -0
- package/src/capabilities/settings.ts +17 -0
- package/src/capabilities/spaces-ready.ts +231 -0
- package/src/capabilities/state.ts +45 -0
- package/src/components/AdvancedObjectSettings/AdvancedObjectSettings.tsx +72 -0
- package/src/components/AdvancedObjectSettings/ForeignKeys.tsx +51 -0
- package/src/components/AdvancedObjectSettings/index.ts +5 -0
- package/src/components/AwaitingObject.tsx +15 -19
- package/src/components/{DefaultObjectSettings.tsx → BaseObjectSettings.tsx} +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.tsx +36 -25
- package/src/components/CreateDialog/CreateObjectPanel.tsx +61 -24
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +10 -14
- package/src/components/JoinDialog.tsx +18 -34
- package/src/components/PersistenceStatus.tsx +1 -1
- package/src/components/PopoverRenameObject.tsx +2 -0
- package/src/components/PopoverRenameSpace.tsx +2 -0
- package/src/components/ShareSpaceButton.tsx +5 -4
- package/src/components/SpacePluginSettings.tsx +2 -13
- package/src/components/SpacePresence.stories.tsx +25 -17
- package/src/components/SpacePresence.tsx +42 -21
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +2 -3
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +3 -1
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +7 -5
- package/src/components/SpaceSettings/SpaceSettingsPanel.tsx +6 -5
- package/src/components/SyncStatus/InlineSyncStatus.tsx +37 -27
- package/src/components/SyncStatus/SyncStatusDetail.stories.tsx +55 -51
- package/src/components/index.ts +2 -1
- package/src/events.ts +12 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/usePath.ts +44 -0
- package/src/index.ts +3 -7
- package/src/meta.ts +1 -29
- package/src/translations.ts +7 -2
- package/src/types/collection.ts +3 -3
- package/src/types/thread.ts +6 -6
- package/src/types/types.ts +177 -42
- package/src/util.tsx +77 -64
- package/dist/lib/browser/chunk-FTKV32QZ.mjs +0 -43
- package/dist/lib/browser/chunk-FTKV32QZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-MWKXNS5S.mjs +0 -124
- package/dist/lib/browser/chunk-MWKXNS5S.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -15
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/chunk-6SNOZF7Y.cjs +0 -152
- package/dist/lib/node/chunk-6SNOZF7Y.cjs.map +0 -7
- package/dist/lib/node/chunk-QNVEU2UD.cjs +0 -69
- package/dist/lib/node/chunk-QNVEU2UD.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs +0 -126
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs +0 -45
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -16
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts +0 -6
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts.map +0 -1
- package/src/components/SyncStatus/InlineSyncStatus.stories.tsx +0 -57
package/dist/lib/node/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,3555 +15,229 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var node_exports = {};
|
|
30
20
|
__export(node_exports, {
|
|
31
|
-
|
|
32
|
-
AwaitingObject: () => AwaitingObject,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
SmallPresenceLive: () => SmallPresenceLive,
|
|
63
|
-
SpaceAction: () => import_chunk_QNVEU2UD.SpaceAction,
|
|
64
|
-
SpaceForm: () => import_chunk_6SNOZF7Y.SpaceForm,
|
|
21
|
+
AdvancedObjectSettings: () => import_chunk_M64YG2FY.AdvancedObjectSettings,
|
|
22
|
+
AwaitingObject: () => import_chunk_M64YG2FY.AwaitingObject,
|
|
23
|
+
BaseObjectSettings: () => import_chunk_M64YG2FY.BaseObjectSettings,
|
|
24
|
+
COMPOSER_SPACE_LOCK: () => import_chunk_Z34MTEU7.COMPOSER_SPACE_LOCK,
|
|
25
|
+
CREATE_OBJECT_DIALOG: () => import_chunk_M64YG2FY.CREATE_OBJECT_DIALOG,
|
|
26
|
+
CREATE_SPACE_DIALOG: () => import_chunk_M64YG2FY.CREATE_SPACE_DIALOG,
|
|
27
|
+
CollectionMain: () => import_chunk_M64YG2FY.CollectionMain,
|
|
28
|
+
CollectionSection: () => import_chunk_M64YG2FY.CollectionSection,
|
|
29
|
+
CreateObjectDialog: () => import_chunk_M64YG2FY.CreateObjectDialog,
|
|
30
|
+
CreateSpaceDialog: () => import_chunk_M64YG2FY.CreateSpaceDialog,
|
|
31
|
+
FullPresence: () => import_chunk_M64YG2FY.FullPresence,
|
|
32
|
+
InlineSyncStatus: () => import_chunk_M64YG2FY.InlineSyncStatus,
|
|
33
|
+
JOIN_DIALOG: () => import_chunk_M64YG2FY.JOIN_DIALOG,
|
|
34
|
+
JoinDialog: () => import_chunk_M64YG2FY.JoinDialog,
|
|
35
|
+
MenuFooter: () => import_chunk_M64YG2FY.MenuFooter,
|
|
36
|
+
POPOVER_RENAME_OBJECT: () => import_chunk_M64YG2FY.POPOVER_RENAME_OBJECT,
|
|
37
|
+
POPOVER_RENAME_SPACE: () => import_chunk_M64YG2FY.POPOVER_RENAME_SPACE,
|
|
38
|
+
PersistenceStatus: () => import_chunk_M64YG2FY.PersistenceStatus,
|
|
39
|
+
PopoverRenameObject: () => import_chunk_M64YG2FY.PopoverRenameObject,
|
|
40
|
+
PopoverRenameSpace: () => import_chunk_M64YG2FY.PopoverRenameSpace,
|
|
41
|
+
SHARED: () => import_chunk_Z34MTEU7.SHARED,
|
|
42
|
+
SPACES: () => import_chunk_Z34MTEU7.SPACES,
|
|
43
|
+
SPACE_PLUGIN: () => import_chunk_AO4EW2RX.SPACE_PLUGIN,
|
|
44
|
+
SPACE_SETTINGS_DIALOG: () => import_chunk_M64YG2FY.SPACE_SETTINGS_DIALOG,
|
|
45
|
+
SPACE_TYPE: () => import_chunk_Z34MTEU7.SPACE_TYPE,
|
|
46
|
+
ShareSpaceButton: () => import_chunk_M64YG2FY.ShareSpaceButton,
|
|
47
|
+
ShareSpaceButtonImpl: () => import_chunk_M64YG2FY.ShareSpaceButtonImpl,
|
|
48
|
+
SmallPresence: () => import_chunk_M64YG2FY.SmallPresence,
|
|
49
|
+
SmallPresenceLive: () => import_chunk_M64YG2FY.SmallPresenceLive,
|
|
50
|
+
SpaceCapabilities: () => import_chunk_56NGXG2A.SpaceCapabilities,
|
|
51
|
+
SpaceEvents: () => SpaceEvents,
|
|
65
52
|
SpacePlugin: () => SpacePlugin,
|
|
66
|
-
SpacePluginSettings: () => SpacePluginSettings,
|
|
67
|
-
SpacePresence: () => SpacePresence,
|
|
68
|
-
SpaceSettingsDialog: () => SpaceSettingsDialog,
|
|
69
|
-
SpaceSettingsPanel: () => SpaceSettingsPanel,
|
|
70
|
-
SyncStatus: () => SyncStatus,
|
|
71
|
-
SyncStatusDetail: () => SyncStatusDetail,
|
|
72
|
-
SyncStatusIndicator: () => SyncStatusIndicator,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
memoizeQuery: () => memoizeQuery,
|
|
85
|
-
parseSchemaPlugin: () => import_chunk_6SNOZF7Y.parseSchemaPlugin,
|
|
86
|
-
parseSpacePlugin: () => parseSpacePlugin,
|
|
87
|
-
translations: () => translations_default
|
|
53
|
+
SpacePluginSettings: () => import_chunk_M64YG2FY.SpacePluginSettings,
|
|
54
|
+
SpacePresence: () => import_chunk_M64YG2FY.SpacePresence,
|
|
55
|
+
SpaceSettingsDialog: () => import_chunk_M64YG2FY.SpaceSettingsDialog,
|
|
56
|
+
SpaceSettingsPanel: () => import_chunk_M64YG2FY.SpaceSettingsPanel,
|
|
57
|
+
SyncStatus: () => import_chunk_M64YG2FY.SyncStatus,
|
|
58
|
+
SyncStatusDetail: () => import_chunk_M64YG2FY.SyncStatusDetail,
|
|
59
|
+
SyncStatusIndicator: () => import_chunk_M64YG2FY.SyncStatusIndicator,
|
|
60
|
+
ThreadCapabilities: () => import_chunk_56NGXG2A.ThreadCapabilities,
|
|
61
|
+
cloneObject: () => import_chunk_Z34MTEU7.cloneObject,
|
|
62
|
+
constructObjectActions: () => import_chunk_Z34MTEU7.constructObjectActions,
|
|
63
|
+
constructSpaceActions: () => import_chunk_Z34MTEU7.constructSpaceActions,
|
|
64
|
+
constructSpaceNode: () => import_chunk_Z34MTEU7.constructSpaceNode,
|
|
65
|
+
createObjectNode: () => import_chunk_Z34MTEU7.createObjectNode,
|
|
66
|
+
getActiveSpace: () => import_chunk_Z34MTEU7.getActiveSpace,
|
|
67
|
+
getNestedObjects: () => import_chunk_Z34MTEU7.getNestedObjects,
|
|
68
|
+
getSpaceDisplayName: () => import_chunk_Z34MTEU7.getSpaceDisplayName,
|
|
69
|
+
memoizeQuery: () => import_chunk_Z34MTEU7.memoizeQuery,
|
|
70
|
+
meta: () => import_chunk_AO4EW2RX.meta
|
|
88
71
|
});
|
|
89
72
|
module.exports = __toCommonJS(node_exports);
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
73
|
+
var import_chunk_BQRNTKSQ = require("./chunk-BQRNTKSQ.cjs");
|
|
74
|
+
var import_chunk_M64YG2FY = require("./chunk-M64YG2FY.cjs");
|
|
75
|
+
var import_chunk_56NGXG2A = require("./chunk-56NGXG2A.cjs");
|
|
76
|
+
var import_chunk_Z34MTEU7 = require("./chunk-Z34MTEU7.cjs");
|
|
77
|
+
var import_chunk_DDZYVNVP = require("./chunk-DDZYVNVP.cjs");
|
|
78
|
+
var import_chunk_AO4EW2RX = require("./chunk-AO4EW2RX.cjs");
|
|
94
79
|
var import_app_framework = require("@dxos/app-framework");
|
|
95
|
-
var
|
|
96
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
97
|
-
var import_core = require("@dxos/echo-signals/core");
|
|
98
|
-
var import_invariant = require("@dxos/invariant");
|
|
80
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
99
81
|
var import_live_object = require("@dxos/live-object");
|
|
100
|
-
var import_local_storage = require("@dxos/local-storage");
|
|
101
|
-
var import_log = require("@dxos/log");
|
|
102
|
-
var import_migrations = require("@dxos/migrations");
|
|
103
82
|
var import_plugin_attention = require("@dxos/plugin-attention");
|
|
104
83
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
118
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
119
|
-
var import_react5 = __toESM(require("react"));
|
|
120
|
-
var import_app_framework3 = require("@dxos/app-framework");
|
|
121
|
-
var import_react_client3 = require("@dxos/react-client");
|
|
122
|
-
var import_echo3 = require("@dxos/react-client/echo");
|
|
123
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
124
|
-
var import_react6 = __toESM(require("react"));
|
|
125
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
126
|
-
var import_echo4 = require("@dxos/react-client/echo");
|
|
127
|
-
var import_react_ui3 = require("@dxos/react-ui");
|
|
128
|
-
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
129
|
-
var import_react_ui_searchlist = require("@dxos/react-ui-searchlist");
|
|
130
|
-
var import_util2 = require("@dxos/util");
|
|
131
|
-
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
132
|
-
var import_invariant2 = require("@dxos/invariant");
|
|
133
|
-
var import_live_object2 = require("@dxos/live-object");
|
|
134
|
-
var import_migrations2 = require("@dxos/migrations");
|
|
135
|
-
var import_plugin_graph2 = require("@dxos/plugin-graph");
|
|
136
|
-
var import_echo5 = require("@dxos/react-client/echo");
|
|
137
|
-
var import_react7 = __toESM(require("react"));
|
|
138
|
-
var import_app_framework4 = require("@dxos/app-framework");
|
|
139
|
-
var import_react_ui4 = require("@dxos/react-ui");
|
|
140
|
-
var import_react_ui_form2 = require("@dxos/react-ui-form");
|
|
141
|
-
var import_react8 = __toESM(require("react"));
|
|
142
|
-
var import_react_ui5 = require("@dxos/react-ui");
|
|
143
|
-
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
144
|
-
var import_react9 = __toESM(require("react"));
|
|
145
|
-
var import_react_ui6 = require("@dxos/react-ui");
|
|
146
|
-
var import_react10 = __toESM(require("react"));
|
|
147
|
-
var import_react_ui7 = require("@dxos/react-ui");
|
|
148
|
-
var import_react11 = __toESM(require("react"));
|
|
149
|
-
var import_app_framework5 = require("@dxos/app-framework");
|
|
150
|
-
var import_plugin_graph3 = require("@dxos/plugin-graph");
|
|
151
|
-
var import_meta2 = require("@dxos/plugin-observability/meta");
|
|
152
|
-
var import_echo6 = require("@dxos/react-client/echo");
|
|
153
|
-
var import_react_ui8 = require("@dxos/react-ui");
|
|
154
|
-
var import_react12 = require("@dxos/shell/react");
|
|
155
|
-
var import_react13 = require("@phosphor-icons/react");
|
|
156
|
-
var import_react14 = __toESM(require("react"));
|
|
157
|
-
var import_echo7 = require("@dxos/client/echo");
|
|
158
|
-
var import_react_client4 = require("@dxos/react-client");
|
|
159
|
-
var import_react_ui9 = require("@dxos/react-ui");
|
|
160
|
-
var import_react15 = require("@phosphor-icons/react");
|
|
161
|
-
var import_react16 = __toESM(require("react"));
|
|
162
|
-
var import_async2 = require("@dxos/async");
|
|
163
|
-
var import_react_ui10 = require("@dxos/react-ui");
|
|
164
|
-
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
165
|
-
var import_react17 = __toESM(require("react"));
|
|
166
|
-
var import_log2 = require("@dxos/log");
|
|
167
|
-
var import_react_ui11 = require("@dxos/react-ui");
|
|
168
|
-
var import_react18 = __toESM(require("react"));
|
|
169
|
-
var import_react_ui12 = require("@dxos/react-ui");
|
|
170
|
-
var import_react19 = __toESM(require("react"));
|
|
171
|
-
var import_app_framework6 = require("@dxos/app-framework");
|
|
172
|
-
var import_react_ui13 = require("@dxos/react-ui");
|
|
173
|
-
var import_react20 = __toESM(require("react"));
|
|
174
|
-
var import_app_framework7 = require("@dxos/app-framework");
|
|
175
|
-
var import_display_name = require("@dxos/display-name");
|
|
176
|
-
var import_react_client5 = require("@dxos/react-client");
|
|
177
|
-
var import_echo8 = require("@dxos/react-client/echo");
|
|
178
|
-
var import_halo = require("@dxos/react-client/halo");
|
|
179
|
-
var import_react_ui14 = require("@dxos/react-ui");
|
|
180
|
-
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
181
|
-
var import_util3 = require("@dxos/util");
|
|
182
|
-
var import_react21 = __toESM(require("react"));
|
|
183
|
-
var import_app_framework8 = require("@dxos/app-framework");
|
|
184
|
-
var import_react_ui15 = require("@dxos/react-ui");
|
|
185
|
-
var import_react_ui_form3 = require("@dxos/react-ui-form");
|
|
186
|
-
var import_react22 = __toESM(require("react"));
|
|
187
|
-
var import_react_client6 = require("@dxos/react-client");
|
|
188
|
-
var import_react_ui16 = require("@dxos/react-ui");
|
|
189
|
-
var import_react_ui_tabs = require("@dxos/react-ui-tabs");
|
|
190
|
-
var import_react23 = require("@dxos/shell/react");
|
|
191
|
-
var import_react24 = __toESM(require("react"));
|
|
192
|
-
var import_log3 = require("@dxos/log");
|
|
193
|
-
var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
194
|
-
var import_react_client7 = require("@dxos/react-client");
|
|
195
|
-
var import_react_ui17 = require("@dxos/react-ui");
|
|
196
|
-
var import_react_ui_form4 = require("@dxos/react-ui-form");
|
|
197
|
-
var import_react25 = __toESM(require("react"));
|
|
198
|
-
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
199
|
-
var import_metadata3 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
200
|
-
var import_react_client8 = require("@dxos/react-client");
|
|
201
|
-
var import_react_ui18 = require("@dxos/react-ui");
|
|
202
|
-
var import_react26 = require("react");
|
|
203
|
-
var import_context = require("@dxos/context");
|
|
204
|
-
var import_protocols = require("@dxos/protocols");
|
|
205
|
-
var import_react_client9 = require("@dxos/react-client");
|
|
206
|
-
var import_react27 = __toESM(require("react"));
|
|
207
|
-
var import_plugin_status_bar = require("@dxos/plugin-status-bar");
|
|
208
|
-
var import_react_client10 = require("@dxos/react-client");
|
|
209
|
-
var import_react_ui19 = require("@dxos/react-ui");
|
|
210
|
-
var import_react_ui_syntax_highlighter = require("@dxos/react-ui-syntax-highlighter");
|
|
211
|
-
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
212
|
-
var import_react28 = __toESM(require("react"));
|
|
213
|
-
var import_react_client11 = require("@dxos/react-client");
|
|
214
|
-
var import_echo9 = require("@dxos/react-client/echo");
|
|
215
|
-
var import_react_ui20 = require("@dxos/react-ui");
|
|
216
|
-
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
217
|
-
var import_context2 = require("@dxos/context");
|
|
218
|
-
var WAIT_FOR_OBJECT_TIMEOUT = 18e4;
|
|
219
|
-
var TOAST_TIMEOUT = 24e4;
|
|
220
|
-
var AwaitingObject = ({ id }) => {
|
|
221
|
-
const [open, setOpen] = (0, import_react4.useState)(true);
|
|
222
|
-
const [waiting, setWaiting] = (0, import_react4.useState)(true);
|
|
223
|
-
const [found, setFound] = (0, import_react4.useState)(false);
|
|
224
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
225
|
-
const intentPlugin = (0, import_app_framework2.useResolvePlugin)(import_app_framework2.parseIntentPlugin);
|
|
226
|
-
const navigationPlugin = (0, import_app_framework2.useResolvePlugin)(import_app_framework2.parseNavigationPlugin);
|
|
227
|
-
const client = (0, import_react_client2.useClient)();
|
|
228
|
-
const objects = (0, import_echo2.useQuery)(client.spaces, import_echo2.Filter.all());
|
|
229
|
-
(0, import_react4.useEffect)(() => {
|
|
230
|
-
if (!id) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const timeout = setTimeout(() => {
|
|
234
|
-
setWaiting(false);
|
|
235
|
-
}, WAIT_FOR_OBJECT_TIMEOUT);
|
|
236
|
-
() => clearTimeout(timeout);
|
|
237
|
-
}, [
|
|
238
|
-
id
|
|
239
|
-
]);
|
|
240
|
-
(0, import_react4.useEffect)(() => {
|
|
241
|
-
if (objects.findIndex((object) => (0, import_echo2.fullyQualifiedId)(object) === id) > -1) {
|
|
242
|
-
setFound(true);
|
|
243
|
-
if (navigationPlugin?.provides.location.active.solo?.[0].id === id) {
|
|
244
|
-
setOpen(false);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}, [
|
|
248
|
-
id,
|
|
249
|
-
objects,
|
|
250
|
-
intentPlugin
|
|
251
|
-
]);
|
|
252
|
-
const handleClose = async () => intentPlugin?.provides.intent.dispatch({
|
|
253
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
254
|
-
action: import_chunk_QNVEU2UD.SpaceAction.WAIT_FOR_OBJECT,
|
|
255
|
-
data: {
|
|
256
|
-
id: void 0
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
const handleNavigate = () => {
|
|
260
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
261
|
-
action: import_app_framework2.NavigationAction.OPEN,
|
|
262
|
-
data: {
|
|
263
|
-
activeParts: {
|
|
264
|
-
main: [
|
|
265
|
-
id
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
void handleClose();
|
|
271
|
-
};
|
|
272
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Root, {
|
|
273
|
-
open,
|
|
274
|
-
duration: TOAST_TIMEOUT,
|
|
275
|
-
onOpenChange: setOpen
|
|
276
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Body, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Title, {
|
|
277
|
-
classNames: "flex items-center gap-2"
|
|
278
|
-
}, found ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react3.CheckCircle, {
|
|
279
|
-
className: (0, import_react_ui_theme.getSize)(5)
|
|
280
|
-
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react3.CircleNotch, {
|
|
281
|
-
className: (0, import_react_ui_theme.mx)((0, import_react_ui_theme.getSize)(5), "animate-spin")
|
|
282
|
-
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react3.CircleDashed, {
|
|
283
|
-
className: (0, import_react_ui_theme.getSize)(5)
|
|
284
|
-
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t("object not found label")))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Description, null, t(found ? "found object description" : waiting ? "waiting for object description" : "object not found description"))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Actions, null, found ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Action, {
|
|
285
|
-
altText: t("go to object alt"),
|
|
286
|
-
asChild: true
|
|
287
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Button, {
|
|
288
|
-
variant: "primary",
|
|
289
|
-
onClick: handleNavigate
|
|
290
|
-
}, t("go to object label"))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Close, {
|
|
291
|
-
asChild: true
|
|
292
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Button, {
|
|
293
|
-
onClick: handleClose
|
|
294
|
-
}, t("close label", {
|
|
295
|
-
ns: "appkit"
|
|
296
|
-
})))) : /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Toast.Close, {
|
|
297
|
-
asChild: true
|
|
298
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Button, {
|
|
299
|
-
onClick: handleClose
|
|
300
|
-
}, t(waiting ? "close label" : "confirm label", {
|
|
301
|
-
ns: "appkit"
|
|
302
|
-
})))));
|
|
303
|
-
};
|
|
304
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/util.tsx";
|
|
305
|
-
var SPACES = `${import_chunk_QNVEU2UD.SPACE_PLUGIN}-spaces`;
|
|
306
|
-
var SPACE_TYPE = "dxos.org/type/Space";
|
|
307
|
-
var COMPOSER_SPACE_LOCK = "dxos.org/plugin/space/lock";
|
|
308
|
-
var SHARED = "shared-spaces";
|
|
309
|
-
var EMPTY_ARRAY = [];
|
|
310
|
-
var memoizeQuery = (spaceOrEcho, filter, options) => {
|
|
311
|
-
const key = JSON.stringify({
|
|
312
|
-
space: (0, import_echo5.isSpace)(spaceOrEcho) ? spaceOrEcho.id : void 0,
|
|
313
|
-
filter: import_echo5.Filter.from(filter).toProto()
|
|
314
|
-
});
|
|
315
|
-
const query = (0, import_plugin_graph2.memoize)(() => (0, import_echo5.isSpace)(spaceOrEcho) ? spaceOrEcho.db.query(filter, options) : spaceOrEcho?.query(filter, options), key);
|
|
316
|
-
const unsubscribe = (0, import_plugin_graph2.memoize)(() => query?.subscribe(), key);
|
|
317
|
-
(0, import_plugin_graph2.cleanup)(() => unsubscribe?.());
|
|
318
|
-
return query?.objects ?? EMPTY_ARRAY;
|
|
319
|
-
};
|
|
320
|
-
var getSpaceDisplayName = (space, { personal, namesCache = {} } = {}) => {
|
|
321
|
-
return space.state.get() === import_echo5.SpaceState.SPACE_READY && (space.properties.name?.length ?? 0) > 0 ? space.properties.name : namesCache[space.id] ? namesCache[space.id] : personal ? [
|
|
322
|
-
"personal space label",
|
|
323
|
-
{
|
|
324
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
325
|
-
}
|
|
326
|
-
] : [
|
|
327
|
-
"unnamed space label",
|
|
328
|
-
{
|
|
329
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
330
|
-
}
|
|
331
|
-
];
|
|
332
|
-
};
|
|
333
|
-
var getCollectionGraphNodePartials = ({ navigable, collection, space, resolve }) => {
|
|
334
|
-
return {
|
|
335
|
-
disabled: !navigable,
|
|
336
|
-
acceptPersistenceClass: /* @__PURE__ */ new Set([
|
|
337
|
-
"echo"
|
|
338
|
-
]),
|
|
339
|
-
acceptPersistenceKey: /* @__PURE__ */ new Set([
|
|
340
|
-
space.id
|
|
341
|
-
]),
|
|
342
|
-
role: "branch",
|
|
343
|
-
onRearrangeChildren: (nextOrder) => {
|
|
344
|
-
collection.objects = nextOrder.filter(import_echo5.isEchoObject);
|
|
345
|
-
},
|
|
346
|
-
onTransferStart: (child, index) => {
|
|
347
|
-
if (!collection.objects.includes(child.data)) {
|
|
348
|
-
if (typeof index !== "undefined") {
|
|
349
|
-
collection.objects.splice(index, 0, child.data);
|
|
350
|
-
} else {
|
|
351
|
-
collection.objects.push(child.data);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
onTransferEnd: (child, destination) => {
|
|
356
|
-
const index = collection.objects.indexOf(child.data);
|
|
357
|
-
if (index > -1) {
|
|
358
|
-
collection.objects.splice(index, 1);
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
onCopy: async (child, index) => {
|
|
362
|
-
const newObject = await cloneObject(child.data, resolve, space);
|
|
363
|
-
space.db.add(newObject);
|
|
364
|
-
if (typeof index !== "undefined") {
|
|
365
|
-
collection.objects.splice(index, 0, newObject);
|
|
366
|
-
} else {
|
|
367
|
-
collection.objects.push(newObject);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
};
|
|
372
|
-
var checkPendingMigration = (space) => {
|
|
373
|
-
return space.state.get() === import_echo5.SpaceState.SPACE_REQUIRES_MIGRATION || space.state.get() === import_echo5.SpaceState.SPACE_READY && !!import_migrations2.Migrations.versionProperty && space.properties[import_migrations2.Migrations.versionProperty] !== import_migrations2.Migrations.targetVersion;
|
|
374
|
-
};
|
|
375
|
-
var constructSpaceNode = ({ space, navigable = false, personal, namesCache, resolve }) => {
|
|
376
|
-
const hasPendingMigration = checkPendingMigration(space);
|
|
377
|
-
const collection = space.state.get() === import_echo5.SpaceState.SPACE_READY && space.properties[import_chunk_6SNOZF7Y.CollectionType.typename];
|
|
378
|
-
const partials = space.state.get() === import_echo5.SpaceState.SPACE_READY && collection instanceof import_chunk_6SNOZF7Y.CollectionType ? getCollectionGraphNodePartials({
|
|
379
|
-
collection,
|
|
380
|
-
space,
|
|
381
|
-
resolve,
|
|
382
|
-
navigable
|
|
383
|
-
}) : {};
|
|
384
|
-
return {
|
|
385
|
-
id: space.id,
|
|
386
|
-
type: SPACE_TYPE,
|
|
387
|
-
cacheable: [
|
|
388
|
-
"label",
|
|
389
|
-
"icon",
|
|
390
|
-
"role"
|
|
391
|
-
],
|
|
392
|
-
data: space,
|
|
393
|
-
properties: {
|
|
394
|
-
...partials,
|
|
395
|
-
label: getSpaceDisplayName(space, {
|
|
396
|
-
personal,
|
|
397
|
-
namesCache
|
|
398
|
-
}),
|
|
399
|
-
description: space.state.get() === import_echo5.SpaceState.SPACE_READY && space.properties.description,
|
|
400
|
-
icon: "ph--planet--regular",
|
|
401
|
-
disabled: !navigable || space.state.get() !== import_echo5.SpaceState.SPACE_READY || hasPendingMigration,
|
|
402
|
-
testId: "spacePlugin.space"
|
|
403
|
-
}
|
|
84
|
+
var import_plugin_deck = require("@dxos/plugin-deck");
|
|
85
|
+
var import_react = require("@dxos/shell/react");
|
|
86
|
+
var SpaceEvents;
|
|
87
|
+
(function(SpaceEvents2) {
|
|
88
|
+
SpaceEvents2.StateReady = (0, import_app_framework.defineEvent)(`${import_chunk_AO4EW2RX.SPACE_PLUGIN}/event/state-ready`);
|
|
89
|
+
SpaceEvents2.DefaultSpaceReady = (0, import_app_framework.defineEvent)(`${import_chunk_AO4EW2RX.SPACE_PLUGIN}/event/default-space-ready`);
|
|
90
|
+
})(SpaceEvents || (SpaceEvents = {}));
|
|
91
|
+
var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "spaceInvitationCode" } = {}) => {
|
|
92
|
+
const createInvitationUrl = (invitationCode) => {
|
|
93
|
+
const baseUrl = new URL(invitationUrl);
|
|
94
|
+
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
95
|
+
return baseUrl.toString();
|
|
404
96
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (hasPendingMigration) {
|
|
412
|
-
actions.push({
|
|
413
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.MIGRATE),
|
|
414
|
-
type: import_plugin_graph2.ACTION_GROUP_TYPE,
|
|
415
|
-
data: async () => {
|
|
416
|
-
await dispatch({
|
|
417
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
418
|
-
action: import_chunk_QNVEU2UD.SpaceAction.MIGRATE,
|
|
419
|
-
data: {
|
|
420
|
-
space
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
},
|
|
424
|
-
properties: {
|
|
425
|
-
label: [
|
|
426
|
-
"migrate space label",
|
|
427
|
-
{
|
|
428
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
429
|
-
}
|
|
430
|
-
],
|
|
431
|
-
icon: "ph--database--regular",
|
|
432
|
-
disposition: "toolbar",
|
|
433
|
-
disabled: migrating || import_migrations2.Migrations.running(space)
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
if (state === import_echo5.SpaceState.SPACE_READY && !hasPendingMigration) {
|
|
438
|
-
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
439
|
-
actions.push({
|
|
440
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_OBJECT),
|
|
441
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
442
|
-
data: async () => {
|
|
443
|
-
await dispatch({
|
|
444
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
445
|
-
action: import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_OBJECT,
|
|
446
|
-
data: {
|
|
447
|
-
target: space
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
},
|
|
451
|
-
properties: {
|
|
452
|
-
label: [
|
|
453
|
-
"create object in space label",
|
|
454
|
-
{
|
|
455
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
456
|
-
}
|
|
457
|
-
],
|
|
458
|
-
icon: "ph--plus--regular",
|
|
459
|
-
disposition: "toolbar",
|
|
460
|
-
testId: "spacePlugin.createObject"
|
|
461
|
-
}
|
|
462
|
-
}, {
|
|
463
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.SHARE),
|
|
464
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
465
|
-
data: async () => {
|
|
466
|
-
if (locked) {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
await dispatch({
|
|
470
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
471
|
-
action: import_chunk_QNVEU2UD.SpaceAction.SHARE,
|
|
472
|
-
data: {
|
|
473
|
-
space
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
},
|
|
477
|
-
properties: {
|
|
478
|
-
label: [
|
|
479
|
-
"share space label",
|
|
480
|
-
{
|
|
481
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
482
|
-
}
|
|
483
|
-
],
|
|
484
|
-
icon: "ph--users--regular",
|
|
485
|
-
disabled: locked,
|
|
486
|
-
keyBinding: {
|
|
487
|
-
macos: "meta+.",
|
|
488
|
-
windows: "alt+."
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}, {
|
|
492
|
-
id: locked ? getId(import_chunk_QNVEU2UD.SpaceAction.UNLOCK) : getId(import_chunk_QNVEU2UD.SpaceAction.LOCK),
|
|
493
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
494
|
-
data: async () => {
|
|
495
|
-
await dispatch({
|
|
496
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
497
|
-
action: locked ? import_chunk_QNVEU2UD.SpaceAction.UNLOCK : import_chunk_QNVEU2UD.SpaceAction.LOCK,
|
|
498
|
-
data: {
|
|
499
|
-
space
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
properties: {
|
|
504
|
-
label: [
|
|
505
|
-
locked ? "unlock space label" : "lock space label",
|
|
506
|
-
{
|
|
507
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
508
|
-
}
|
|
509
|
-
],
|
|
510
|
-
icon: locked ? "ph--lock-simple-open--regular" : "ph--lock-simple--regular"
|
|
511
|
-
}
|
|
512
|
-
}, {
|
|
513
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.RENAME),
|
|
514
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
515
|
-
data: async (params) => {
|
|
516
|
-
await dispatch({
|
|
517
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
518
|
-
action: import_chunk_QNVEU2UD.SpaceAction.RENAME,
|
|
519
|
-
data: {
|
|
520
|
-
space,
|
|
521
|
-
...params
|
|
522
|
-
}
|
|
523
|
-
});
|
|
524
|
-
},
|
|
525
|
-
properties: {
|
|
526
|
-
label: [
|
|
527
|
-
"rename space label",
|
|
528
|
-
{
|
|
529
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
530
|
-
}
|
|
531
|
-
],
|
|
532
|
-
icon: "ph--pencil-simple-line--regular",
|
|
533
|
-
keyBinding: {
|
|
534
|
-
macos: "shift+F6",
|
|
535
|
-
windows: "shift+F6"
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}, {
|
|
539
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.OPEN_SETTINGS),
|
|
540
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
541
|
-
data: async () => {
|
|
542
|
-
await dispatch({
|
|
543
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
544
|
-
action: import_chunk_QNVEU2UD.SpaceAction.OPEN_SETTINGS,
|
|
545
|
-
data: {
|
|
546
|
-
space
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
},
|
|
550
|
-
properties: {
|
|
551
|
-
label: [
|
|
552
|
-
"open space settings label",
|
|
553
|
-
{
|
|
554
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
555
|
-
}
|
|
556
|
-
],
|
|
557
|
-
icon: "ph--gear--regular"
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
if (state !== import_echo5.SpaceState.SPACE_INACTIVE && !hasPendingMigration) {
|
|
562
|
-
actions.push({
|
|
563
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.CLOSE),
|
|
564
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
565
|
-
data: async () => {
|
|
566
|
-
await dispatch({
|
|
567
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
568
|
-
action: import_chunk_QNVEU2UD.SpaceAction.CLOSE,
|
|
569
|
-
data: {
|
|
570
|
-
space
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
},
|
|
574
|
-
properties: {
|
|
575
|
-
label: [
|
|
576
|
-
"close space label",
|
|
577
|
-
{
|
|
578
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
579
|
-
}
|
|
580
|
-
],
|
|
581
|
-
icon: "ph--x--regular",
|
|
582
|
-
disabled: personal
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
if (state === import_echo5.SpaceState.SPACE_INACTIVE) {
|
|
587
|
-
actions.push({
|
|
588
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.OPEN),
|
|
589
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
590
|
-
data: async () => {
|
|
591
|
-
await dispatch({
|
|
592
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
593
|
-
action: import_chunk_QNVEU2UD.SpaceAction.OPEN,
|
|
594
|
-
data: {
|
|
595
|
-
space
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
},
|
|
599
|
-
properties: {
|
|
600
|
-
label: [
|
|
601
|
-
"open space label",
|
|
602
|
-
{
|
|
603
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
604
|
-
}
|
|
605
|
-
],
|
|
606
|
-
icon: "ph--clock-counter-clockwise--regular",
|
|
607
|
-
disposition: "toolbar"
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
return actions;
|
|
612
|
-
};
|
|
613
|
-
var createObjectNode = ({ object, space, navigable = false, resolve }) => {
|
|
614
|
-
const type = (0, import_echo_schema3.getTypename)(object);
|
|
615
|
-
if (!type) {
|
|
616
|
-
return void 0;
|
|
617
|
-
}
|
|
618
|
-
const metadata = resolve(type);
|
|
619
|
-
if (Object.keys(metadata).length === 0) {
|
|
620
|
-
return void 0;
|
|
621
|
-
}
|
|
622
|
-
const partials = object instanceof import_chunk_6SNOZF7Y.CollectionType ? getCollectionGraphNodePartials({
|
|
623
|
-
collection: object,
|
|
624
|
-
space,
|
|
625
|
-
resolve,
|
|
626
|
-
navigable
|
|
627
|
-
}) : metadata.graphProps;
|
|
628
|
-
return {
|
|
629
|
-
id: (0, import_echo5.fullyQualifiedId)(object),
|
|
630
|
-
type,
|
|
631
|
-
cacheable: [
|
|
632
|
-
"label",
|
|
633
|
-
"icon",
|
|
634
|
-
"role"
|
|
635
|
-
],
|
|
636
|
-
data: object,
|
|
637
|
-
properties: {
|
|
638
|
-
...partials,
|
|
639
|
-
label: metadata.label?.(object) || object.name || metadata.placeholder || [
|
|
640
|
-
"unnamed object label",
|
|
641
|
-
{
|
|
642
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
643
|
-
}
|
|
97
|
+
return (0, import_app_framework2.definePlugin)(import_chunk_AO4EW2RX.meta, [
|
|
98
|
+
(0, import_app_framework2.defineModule)({
|
|
99
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/state`,
|
|
100
|
+
activatesOn: (0, import_app_framework2.oneOf)(import_app_framework2.Events.Startup, import_app_framework2.Events.SetupAppGraph),
|
|
101
|
+
activatesAfter: [
|
|
102
|
+
SpaceEvents.StateReady
|
|
644
103
|
],
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
properties: {
|
|
670
|
-
label: [
|
|
671
|
-
"create object in collection label",
|
|
104
|
+
activate: import_chunk_M64YG2FY.SpaceState
|
|
105
|
+
}),
|
|
106
|
+
(0, import_app_framework2.defineModule)({
|
|
107
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/settings`,
|
|
108
|
+
activatesOn: import_app_framework2.Events.SetupSettings,
|
|
109
|
+
activate: import_chunk_M64YG2FY.SpaceSettings
|
|
110
|
+
}),
|
|
111
|
+
(0, import_app_framework2.defineModule)({
|
|
112
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/translations`,
|
|
113
|
+
activatesOn: import_app_framework2.Events.SetupTranslations,
|
|
114
|
+
activate: () => (0, import_app_framework2.contributes)(import_app_framework2.Capabilities.Translations, [
|
|
115
|
+
...import_chunk_BQRNTKSQ.translations_default,
|
|
116
|
+
import_react.osTranslations
|
|
117
|
+
])
|
|
118
|
+
}),
|
|
119
|
+
(0, import_app_framework2.defineModule)({
|
|
120
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/metadata`,
|
|
121
|
+
activatesOn: (0, import_app_framework2.oneOf)(import_app_framework2.Events.Startup, import_app_framework2.Events.SetupAppGraph),
|
|
122
|
+
activate: () => (0, import_app_framework2.contributes)(import_app_framework2.Capabilities.Metadata, {
|
|
123
|
+
id: import_chunk_DDZYVNVP.CollectionType.typename,
|
|
124
|
+
metadata: {
|
|
125
|
+
createObject: (props) => (0, import_app_framework2.createIntent)(import_chunk_DDZYVNVP.CollectionAction.Create, props),
|
|
126
|
+
placeholder: [
|
|
127
|
+
"unnamed collection label",
|
|
672
128
|
{
|
|
673
|
-
ns:
|
|
129
|
+
ns: import_chunk_AO4EW2RX.SPACE_PLUGIN
|
|
674
130
|
}
|
|
675
131
|
],
|
|
676
|
-
icon: "ph--
|
|
677
|
-
|
|
678
|
-
|
|
132
|
+
icon: "ph--cards-three--regular",
|
|
133
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
134
|
+
loadReferences: async (collection) => await import_live_object.RefArray.loadAll([
|
|
135
|
+
...collection.objects,
|
|
136
|
+
...Object.values(collection.views)
|
|
137
|
+
])
|
|
679
138
|
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
{
|
|
683
|
-
id:
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
action: import_chunk_QNVEU2UD.SpaceAction.RENAME_OBJECT,
|
|
688
|
-
data: {
|
|
689
|
-
object,
|
|
690
|
-
...params
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
},
|
|
694
|
-
properties: {
|
|
695
|
-
label: [
|
|
696
|
-
object instanceof import_chunk_6SNOZF7Y.CollectionType ? "rename collection label" : "rename object label",
|
|
697
|
-
{
|
|
698
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
699
|
-
}
|
|
700
|
-
],
|
|
701
|
-
icon: "ph--pencil-simple-line--regular",
|
|
702
|
-
// TODO(wittjosiah): Doesn't work.
|
|
703
|
-
// keyBinding: 'shift+F6',
|
|
704
|
-
testId: "spacePlugin.renameObject"
|
|
705
|
-
}
|
|
706
|
-
},
|
|
707
|
-
{
|
|
708
|
-
id: getId(import_chunk_QNVEU2UD.SpaceAction.REMOVE_OBJECTS),
|
|
709
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
710
|
-
data: async () => {
|
|
711
|
-
const graph = (0, import_plugin_graph2.getGraph)(node);
|
|
712
|
-
const collection = graph.nodes(node, {
|
|
713
|
-
relation: "inbound"
|
|
714
|
-
}).find(({ data }) => data instanceof import_chunk_6SNOZF7Y.CollectionType)?.data;
|
|
715
|
-
await dispatch([
|
|
716
|
-
{
|
|
717
|
-
action: import_chunk_QNVEU2UD.SpaceAction.REMOVE_OBJECTS,
|
|
718
|
-
data: {
|
|
719
|
-
objects: [
|
|
720
|
-
object
|
|
721
|
-
],
|
|
722
|
-
collection
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
]);
|
|
726
|
-
},
|
|
727
|
-
properties: {
|
|
728
|
-
label: [
|
|
729
|
-
object instanceof import_chunk_6SNOZF7Y.CollectionType ? "delete collection label" : "delete object label",
|
|
730
|
-
{
|
|
731
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
732
|
-
}
|
|
733
|
-
],
|
|
734
|
-
icon: "ph--trash--regular",
|
|
735
|
-
keyBinding: object instanceof import_chunk_6SNOZF7Y.CollectionType ? void 0 : "shift+meta+Backspace",
|
|
736
|
-
testId: "spacePlugin.deleteObject"
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
id: getId("copy-link"),
|
|
741
|
-
type: import_plugin_graph2.ACTION_TYPE,
|
|
742
|
-
data: async () => {
|
|
743
|
-
const url = `${window.location.origin}/${(0, import_echo5.fullyQualifiedId)(object)}`;
|
|
744
|
-
await navigator.clipboard.writeText(url);
|
|
745
|
-
},
|
|
746
|
-
properties: {
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
(0, import_app_framework2.defineModule)({
|
|
142
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/complementary-panel`,
|
|
143
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
144
|
+
activate: () => (0, import_app_framework2.contributes)(import_plugin_deck.DeckCapabilities.ComplementaryPanel, {
|
|
145
|
+
id: "settings",
|
|
747
146
|
label: [
|
|
748
|
-
"
|
|
147
|
+
"settings panel label",
|
|
749
148
|
{
|
|
750
|
-
ns:
|
|
149
|
+
ns: import_chunk_AO4EW2RX.SPACE_PLUGIN
|
|
751
150
|
}
|
|
752
151
|
],
|
|
753
|
-
icon: "ph--
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
];
|
|
758
|
-
return actions;
|
|
759
|
-
};
|
|
760
|
-
var getActiveSpace = (graph, active) => {
|
|
761
|
-
if (!active) {
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
const node = graph.findNode(active);
|
|
765
|
-
if (!node || !(0, import_live_object2.isReactiveObject)(node.data)) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
return (0, import_echo5.getSpace)(node.data);
|
|
769
|
-
};
|
|
770
|
-
var getNestedObjects = async (object, resolve) => {
|
|
771
|
-
const type = (0, import_echo_schema3.getTypename)(object);
|
|
772
|
-
if (!type) {
|
|
773
|
-
return [];
|
|
774
|
-
}
|
|
775
|
-
const metadata = resolve(type);
|
|
776
|
-
const loadReferences = metadata.loadReferences;
|
|
777
|
-
if (typeof loadReferences !== "function") {
|
|
778
|
-
return [];
|
|
779
|
-
}
|
|
780
|
-
const objects = await loadReferences(object);
|
|
781
|
-
const nested = await Promise.all(objects.map((object2) => getNestedObjects(object2, resolve)));
|
|
782
|
-
return [
|
|
783
|
-
...objects,
|
|
784
|
-
...nested.flat()
|
|
785
|
-
];
|
|
786
|
-
};
|
|
787
|
-
var cloneObject = async (object, resolve, newSpace) => {
|
|
788
|
-
const schema = (0, import_live_object2.getSchema)(object);
|
|
789
|
-
const typename = schema ? (0, import_echo_schema3.getObjectAnnotation)(schema)?.typename ?? import_echo_schema3.EXPANDO_TYPENAME : import_echo_schema3.EXPANDO_TYPENAME;
|
|
790
|
-
const metadata = resolve(typename);
|
|
791
|
-
const serializer = metadata.serializer;
|
|
792
|
-
(0, import_invariant2.invariant)(serializer, `No serializer for type: ${typename}`, {
|
|
793
|
-
F: __dxlog_file,
|
|
794
|
-
L: 544,
|
|
795
|
-
S: void 0,
|
|
796
|
-
A: [
|
|
797
|
-
"serializer",
|
|
798
|
-
"`No serializer for type: ${typename}`"
|
|
799
|
-
]
|
|
800
|
-
});
|
|
801
|
-
const content = await serializer.serialize({
|
|
802
|
-
object
|
|
803
|
-
});
|
|
804
|
-
return serializer.deserialize({
|
|
805
|
-
content,
|
|
806
|
-
space: newSpace,
|
|
807
|
-
newId: true
|
|
808
|
-
});
|
|
809
|
-
};
|
|
810
|
-
var CreateObjectPanel = ({ schemas, spaces, typename: initialTypename, target: initialTarget, name: initialName, defaultSpaceId, resolve, onCreateObject }) => {
|
|
811
|
-
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
812
|
-
const [typename, setTypename] = (0, import_react6.useState)(initialTypename);
|
|
813
|
-
const [target, setTarget] = (0, import_react6.useState)(initialTarget);
|
|
814
|
-
const schema = schemas.find((schema2) => (0, import_echo_schema2.getObjectAnnotation)(schema2)?.typename === typename);
|
|
815
|
-
const options = schemas.map(import_echo_schema2.getObjectAnnotation).filter(import_util2.nonNullable);
|
|
816
|
-
const handleClearSchema = (0, import_react6.useCallback)(() => setTypename(void 0), []);
|
|
817
|
-
const handleClearTarget = (0, import_react6.useCallback)(() => setTarget(void 0), []);
|
|
818
|
-
const handleCreateObject = (0, import_react6.useCallback)(async ({ name }) => {
|
|
819
|
-
if (!schema || !target) {
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
|
-
await onCreateObject?.({
|
|
823
|
-
schema,
|
|
824
|
-
target,
|
|
825
|
-
name
|
|
826
|
-
});
|
|
827
|
-
}, [
|
|
828
|
-
onCreateObject,
|
|
829
|
-
schema,
|
|
830
|
-
target
|
|
831
|
-
]);
|
|
832
|
-
const schemaInput = /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Root, {
|
|
833
|
-
label: t("schema input label"),
|
|
834
|
-
classNames: "flex flex-col grow overflow-hidden my-2 px-2"
|
|
835
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Input, {
|
|
836
|
-
autoFocus: true,
|
|
837
|
-
"data-testid": "create-object-form.schema-input",
|
|
838
|
-
placeholder: t("schema input placeholder"),
|
|
839
|
-
classNames: "px-1 my-2"
|
|
840
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Content, {
|
|
841
|
-
classNames: "max-bs-[24rem] overflow-auto"
|
|
842
|
-
}, options.map((option) => /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Item, {
|
|
843
|
-
key: option.typename,
|
|
844
|
-
value: t("typename label", {
|
|
845
|
-
ns: option.typename,
|
|
846
|
-
defaultValue: option.typename
|
|
152
|
+
icon: "ph--gear--regular"
|
|
153
|
+
})
|
|
847
154
|
}),
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
size: 5
|
|
855
|
-
}), t("typename label", {
|
|
856
|
-
ns: option.typename,
|
|
857
|
-
defaultValue: option.typename
|
|
858
|
-
}))))));
|
|
859
|
-
const spaceInput = /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Root, {
|
|
860
|
-
label: t("space input label"),
|
|
861
|
-
classNames: "flex flex-col grow overflow-hidden my-2 px-2"
|
|
862
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Input, {
|
|
863
|
-
autoFocus: true,
|
|
864
|
-
"data-testid": "create-object-form.space-input",
|
|
865
|
-
placeholder: t("space input placeholder"),
|
|
866
|
-
classNames: "px-1 my-2"
|
|
867
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Content, {
|
|
868
|
-
classNames: "max-bs-[24rem] overflow-auto"
|
|
869
|
-
}, spaces.map((space) => /* @__PURE__ */ import_react6.default.createElement(import_react_ui_searchlist.SearchList.Item, {
|
|
870
|
-
key: space.id,
|
|
871
|
-
value: (0, import_react_ui3.toLocalizedString)(getSpaceDisplayName(space, {
|
|
872
|
-
personal: space.id === defaultSpaceId
|
|
873
|
-
}), t),
|
|
874
|
-
onSelect: () => setTarget(space),
|
|
875
|
-
classNames: "flex items-center gap-2"
|
|
876
|
-
}, /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
877
|
-
className: "grow truncate"
|
|
878
|
-
}, (0, import_react_ui3.toLocalizedString)(getSpaceDisplayName(space, {
|
|
879
|
-
personal: space.id === defaultSpaceId
|
|
880
|
-
}), t))))));
|
|
881
|
-
const form = /* @__PURE__ */ import_react6.default.createElement(import_react_ui_form.Form, {
|
|
882
|
-
autoFocus: true,
|
|
883
|
-
values: {
|
|
884
|
-
name: initialName
|
|
885
|
-
},
|
|
886
|
-
schema: import_echo_schema2.S.Struct({
|
|
887
|
-
name: import_echo_schema2.S.optional(import_echo_schema2.S.String)
|
|
155
|
+
(0, import_app_framework2.defineModule)({
|
|
156
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/schema`,
|
|
157
|
+
activatesOn: import_plugin_client.ClientEvents.SetupClient,
|
|
158
|
+
activate: () => (0, import_app_framework2.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
159
|
+
import_chunk_DDZYVNVP.CollectionType
|
|
160
|
+
])
|
|
888
161
|
}),
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
role: "form",
|
|
894
|
-
className: "flex flex-col gap-2"
|
|
895
|
-
}, target && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
896
|
-
role: "none",
|
|
897
|
-
className: "px-2"
|
|
898
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_form.InputHeader, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Label, null, t((0, import_echo4.isSpace)(target) ? "creating in space label" : "creating in collection label"))), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
899
|
-
role: "none",
|
|
900
|
-
className: "flex gap-2"
|
|
901
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.TextInput, {
|
|
902
|
-
disabled: true,
|
|
903
|
-
value: (0, import_echo4.isSpace)(target) ? (0, import_react_ui3.toLocalizedString)(getSpaceDisplayName(target, {
|
|
904
|
-
personal: target.id === defaultSpaceId
|
|
905
|
-
}), t) : target.name || t("unnamed collection label")
|
|
906
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.IconButton, {
|
|
907
|
-
iconOnly: true,
|
|
908
|
-
icon: "ph--x--regular",
|
|
909
|
-
label: t("clear input label"),
|
|
910
|
-
onClick: handleClearTarget
|
|
911
|
-
})))), schema && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
912
|
-
role: "none",
|
|
913
|
-
className: "px-2"
|
|
914
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_form.InputHeader, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Label, null, t("creating object type label"))), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
915
|
-
role: "none",
|
|
916
|
-
className: "flex gap-2"
|
|
917
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.TextInput, {
|
|
918
|
-
disabled: true,
|
|
919
|
-
value: t("typename label", {
|
|
920
|
-
ns: schema.typename,
|
|
921
|
-
defaultValue: schema.typename
|
|
922
|
-
})
|
|
923
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.IconButton, {
|
|
924
|
-
iconOnly: true,
|
|
925
|
-
icon: "ph--x--regular",
|
|
926
|
-
label: t("clear input label"),
|
|
927
|
-
onClick: handleClearSchema
|
|
928
|
-
})))), !schema ? schemaInput : !target ? spaceInput : form);
|
|
929
|
-
};
|
|
930
|
-
var CreateObjectDialog = ({ schemas, target, typename, name, navigableCollections, resolve }) => {
|
|
931
|
-
const closeRef = (0, import_react5.useRef)(null);
|
|
932
|
-
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
933
|
-
const client = (0, import_react_client3.useClient)();
|
|
934
|
-
const spaces = (0, import_echo3.useSpaces)();
|
|
935
|
-
const dispatch = (0, import_app_framework3.useIntentDispatcher)();
|
|
936
|
-
const handleCreateObject = (0, import_react5.useCallback)(async ({ schema, target: _target, name: name2 }) => {
|
|
937
|
-
const target2 = (0, import_echo3.isSpace)(_target) ? _target.properties[import_chunk_6SNOZF7Y.CollectionType.typename] : _target;
|
|
938
|
-
const createObjectAction = resolve?.(schema.typename)?.createObject;
|
|
939
|
-
if (!createObjectAction || !target2) {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
closeRef.current?.click();
|
|
943
|
-
const space = (0, import_echo3.isSpace)(target2) ? target2 : (0, import_echo3.getSpace)(target2);
|
|
944
|
-
const result = await dispatch({
|
|
945
|
-
action: createObjectAction,
|
|
946
|
-
data: {
|
|
947
|
-
name: name2,
|
|
948
|
-
space
|
|
949
|
-
}
|
|
950
|
-
});
|
|
951
|
-
const object = result?.data;
|
|
952
|
-
if ((0, import_echo3.isReactiveObject)(object)) {
|
|
953
|
-
await dispatch([
|
|
954
|
-
{
|
|
955
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
956
|
-
action: import_chunk_QNVEU2UD.SpaceAction.ADD_OBJECT,
|
|
957
|
-
data: {
|
|
958
|
-
target: target2,
|
|
959
|
-
object
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
...!(object instanceof import_chunk_6SNOZF7Y.CollectionType) || navigableCollections ? [
|
|
963
|
-
{
|
|
964
|
-
action: import_app_framework3.NavigationAction.OPEN
|
|
965
|
-
}
|
|
966
|
-
] : []
|
|
967
|
-
]);
|
|
968
|
-
}
|
|
969
|
-
}, [
|
|
970
|
-
dispatch,
|
|
971
|
-
resolve
|
|
972
|
-
]);
|
|
973
|
-
return (
|
|
974
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
975
|
-
// Consider factoring it out to the tabs package.
|
|
976
|
-
/* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Content, {
|
|
977
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
978
|
-
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
979
|
-
role: "none",
|
|
980
|
-
className: "flex justify-between pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
981
|
-
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Title, null, t("create object dialog title")), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Close, {
|
|
982
|
-
asChild: true
|
|
983
|
-
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Button, {
|
|
984
|
-
ref: closeRef,
|
|
985
|
-
density: "fine",
|
|
986
|
-
variant: "ghost",
|
|
987
|
-
autoFocus: true
|
|
988
|
-
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Icon, {
|
|
989
|
-
icon: "ph--x--regular",
|
|
990
|
-
size: 4
|
|
991
|
-
})))), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
992
|
-
className: "p-4"
|
|
993
|
-
}, /* @__PURE__ */ import_react5.default.createElement(CreateObjectPanel, {
|
|
994
|
-
schemas,
|
|
995
|
-
spaces,
|
|
996
|
-
target,
|
|
997
|
-
typename,
|
|
998
|
-
name,
|
|
999
|
-
defaultSpaceId: client.spaces.default.id,
|
|
1000
|
-
resolve,
|
|
1001
|
-
onCreateObject: handleCreateObject
|
|
1002
|
-
})))
|
|
1003
|
-
);
|
|
1004
|
-
};
|
|
1005
|
-
var initialValues = {
|
|
1006
|
-
edgeReplication: true
|
|
1007
|
-
};
|
|
1008
|
-
var CreateSpaceDialog = () => {
|
|
1009
|
-
const closeRef = (0, import_react7.useRef)(null);
|
|
1010
|
-
const { t } = (0, import_react_ui4.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1011
|
-
const dispatch = (0, import_app_framework4.useIntentDispatcher)();
|
|
1012
|
-
const handleCreateSpace = (0, import_react7.useCallback)(async (data) => {
|
|
1013
|
-
const result = await dispatch({
|
|
1014
|
-
action: import_chunk_QNVEU2UD.SpaceAction.CREATE,
|
|
1015
|
-
data
|
|
1016
|
-
});
|
|
1017
|
-
const target = result?.data.space;
|
|
1018
|
-
if (target) {
|
|
1019
|
-
await dispatch({
|
|
1020
|
-
action: import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_OBJECT,
|
|
1021
|
-
data: {
|
|
1022
|
-
target
|
|
1023
|
-
}
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
}, [
|
|
1027
|
-
dispatch
|
|
1028
|
-
]);
|
|
1029
|
-
return (
|
|
1030
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
1031
|
-
// Consider factoring it out to the tabs package.
|
|
1032
|
-
/* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Dialog.Content, {
|
|
1033
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
1034
|
-
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1035
|
-
role: "none",
|
|
1036
|
-
className: "flex justify-between pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
1037
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Dialog.Title, null, t("create space dialog title")), /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Dialog.Close, {
|
|
1038
|
-
asChild: true
|
|
1039
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Button, {
|
|
1040
|
-
ref: closeRef,
|
|
1041
|
-
density: "fine",
|
|
1042
|
-
variant: "ghost",
|
|
1043
|
-
autoFocus: true
|
|
1044
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Icon, {
|
|
1045
|
-
icon: "ph--x--regular",
|
|
1046
|
-
size: 4
|
|
1047
|
-
})))), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1048
|
-
className: "p-4"
|
|
1049
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui_form2.Form, {
|
|
1050
|
-
testId: "create-space-form",
|
|
1051
|
-
values: initialValues,
|
|
1052
|
-
schema: import_chunk_6SNOZF7Y.SpaceForm,
|
|
1053
|
-
onSave: handleCreateSpace
|
|
1054
|
-
})))
|
|
1055
|
-
);
|
|
1056
|
-
};
|
|
1057
|
-
var CollectionMain = ({ collection }) => {
|
|
1058
|
-
const { t } = (0, import_react_ui5.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1059
|
-
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
1060
|
-
role: "none",
|
|
1061
|
-
className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.baseSurface, "min-bs-screen is-full flex items-center justify-center p-8"),
|
|
1062
|
-
"data-testid": "composer.firstRunMessage"
|
|
1063
|
-
}, /* @__PURE__ */ import_react8.default.createElement("p", {
|
|
1064
|
-
role: "alert",
|
|
1065
|
-
className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.descriptionText, "border border-dashed border-neutral-400/50 rounded-lg p-8 font-normal text-lg max-is-[24rem] break-words")
|
|
1066
|
-
}, collection.name ?? t("unnamed collection label")));
|
|
1067
|
-
};
|
|
1068
|
-
var CollectionSection = ({ collection }) => {
|
|
1069
|
-
const { t } = (0, import_react_ui6.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1070
|
-
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1071
|
-
className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
|
|
1072
|
-
}, /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
1073
|
-
className: "truncate"
|
|
1074
|
-
}, collection.name ?? t("unnamed collection label")));
|
|
1075
|
-
};
|
|
1076
|
-
var DefaultObjectSettings = ({ object }) => {
|
|
1077
|
-
const { t } = (0, import_react_ui7.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1078
|
-
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1079
|
-
role: "form",
|
|
1080
|
-
className: "flex flex-col w-full p-2 gap-1"
|
|
1081
|
-
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui7.Input.Root, null, /* @__PURE__ */ import_react10.default.createElement(import_react_ui7.Input.Label, null, t("name label")), /* @__PURE__ */ import_react10.default.createElement(import_react_ui7.Input.TextInput, {
|
|
1082
|
-
placeholder: t("name placeholder"),
|
|
1083
|
-
value: object.name ?? "",
|
|
1084
|
-
onChange: (event) => {
|
|
1085
|
-
object.name = event.target.value;
|
|
1086
|
-
}
|
|
1087
|
-
})));
|
|
1088
|
-
};
|
|
1089
|
-
var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
|
|
1090
|
-
const { t } = (0, import_react_ui8.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1091
|
-
const dispatch = (0, import_app_framework5.useIntentDispatcher)();
|
|
1092
|
-
const spaces = (0, import_echo6.useSpaces)();
|
|
1093
|
-
const { graph } = (0, import_plugin_graph3.useGraph)();
|
|
1094
|
-
const handleDone = (0, import_react11.useCallback)(async (result) => {
|
|
1095
|
-
if (result?.spaceKey) {
|
|
1096
|
-
await Promise.all([
|
|
1097
|
-
dispatch({
|
|
1098
|
-
action: import_app_framework5.LayoutAction.SET_LAYOUT,
|
|
1099
|
-
data: {
|
|
1100
|
-
element: "toast",
|
|
1101
|
-
subject: {
|
|
1102
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/join-success`,
|
|
1103
|
-
duration: 5e3,
|
|
1104
|
-
title: t("join success label"),
|
|
1105
|
-
closeLabel: t("dismiss label")
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
}),
|
|
1109
|
-
dispatch({
|
|
1110
|
-
action: import_app_framework5.LayoutAction.SET_LAYOUT,
|
|
1111
|
-
data: {
|
|
1112
|
-
element: "dialog",
|
|
1113
|
-
state: false
|
|
1114
|
-
}
|
|
1115
|
-
})
|
|
1116
|
-
]);
|
|
1117
|
-
}
|
|
1118
|
-
const space = spaces.find(({ key }) => result?.spaceKey?.equals(key));
|
|
1119
|
-
const target = result?.target || (navigableCollections ? space?.id : void 0);
|
|
1120
|
-
if (target) {
|
|
1121
|
-
await graph.waitForPath({
|
|
1122
|
-
target
|
|
1123
|
-
}).catch(() => {
|
|
1124
|
-
});
|
|
1125
|
-
await Promise.all([
|
|
1126
|
-
dispatch({
|
|
1127
|
-
action: import_app_framework5.NavigationAction.OPEN,
|
|
1128
|
-
data: {
|
|
1129
|
-
activeParts: {
|
|
1130
|
-
main: [
|
|
1131
|
-
target
|
|
1132
|
-
]
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}),
|
|
1136
|
-
dispatch({
|
|
1137
|
-
action: import_app_framework5.NavigationAction.EXPOSE,
|
|
1138
|
-
data: {
|
|
1139
|
-
id: target
|
|
1140
|
-
}
|
|
1141
|
-
})
|
|
1142
|
-
]);
|
|
1143
|
-
}
|
|
1144
|
-
await onDone?.(result);
|
|
1145
|
-
if (space) {
|
|
1146
|
-
await dispatch({
|
|
1147
|
-
action: import_meta2.ObservabilityAction.SEND_EVENT,
|
|
1148
|
-
data: {
|
|
1149
|
-
name: "space.join",
|
|
1150
|
-
properties: {
|
|
1151
|
-
spaceId: space.id
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
});
|
|
1155
|
-
}
|
|
1156
|
-
}, [
|
|
1157
|
-
dispatch,
|
|
1158
|
-
spaces
|
|
1159
|
-
]);
|
|
1160
|
-
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui8.Dialog.Content, null, /* @__PURE__ */ import_react11.default.createElement(import_react12.JoinPanel, {
|
|
1161
|
-
...props,
|
|
1162
|
-
exitActionParent: /* @__PURE__ */ import_react11.default.createElement(import_react_ui8.Dialog.Close, {
|
|
1163
|
-
asChild: true
|
|
162
|
+
(0, import_app_framework2.defineModule)({
|
|
163
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/react-root`,
|
|
164
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
165
|
+
activate: import_chunk_M64YG2FY.ReactRoot
|
|
1164
166
|
}),
|
|
1165
|
-
|
|
1166
|
-
|
|
167
|
+
(0, import_app_framework2.defineModule)({
|
|
168
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/react-surface`,
|
|
169
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
170
|
+
activate: () => (0, import_chunk_M64YG2FY.ReactSurface)({
|
|
171
|
+
createInvitationUrl
|
|
172
|
+
})
|
|
1167
173
|
}),
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
const _setStatus = (0, import_async2.debounce)(naturalSetStatus, 500);
|
|
1200
|
-
(0, import_react16.useEffect)(() => {
|
|
1201
|
-
setPrevStatus(status);
|
|
1202
|
-
if (prevStatus !== status && status === 0) {
|
|
1203
|
-
setDisplayMessage(true);
|
|
1204
|
-
const timeout = setTimeout(() => setDisplayMessage(false), 5e3);
|
|
1205
|
-
return () => clearTimeout(timeout);
|
|
1206
|
-
}
|
|
1207
|
-
}, [
|
|
1208
|
-
status
|
|
1209
|
-
]);
|
|
1210
|
-
switch (status) {
|
|
1211
|
-
case 2:
|
|
1212
|
-
return /* @__PURE__ */ import_react16.default.createElement("div", {
|
|
1213
|
-
className: "flex items-center"
|
|
1214
|
-
}, /* @__PURE__ */ import_react16.default.createElement(import_react15.Warning, {
|
|
1215
|
-
className: (0, import_react_ui_theme3.mx)((0, import_react_ui_theme3.getSize)(4), "me-1")
|
|
1216
|
-
}), /* @__PURE__ */ import_react16.default.createElement("span", {
|
|
1217
|
-
className: (0, import_react_ui_theme3.mx)("text-sm", import_react_ui_theme3.warningText)
|
|
1218
|
-
}, t("persistence error label")));
|
|
1219
|
-
case 1:
|
|
1220
|
-
return /* @__PURE__ */ import_react16.default.createElement("div", {
|
|
1221
|
-
className: "flex items-center"
|
|
1222
|
-
}, /* @__PURE__ */ import_react16.default.createElement(import_react15.ArrowsCounterClockwise, {
|
|
1223
|
-
className: (0, import_react_ui_theme3.mx)((0, import_react_ui_theme3.getSize)(4), "me-1")
|
|
1224
|
-
}), /* @__PURE__ */ import_react16.default.createElement("span", {
|
|
1225
|
-
className: (0, import_react_ui_theme3.mx)("text-sm", import_react_ui_theme3.staticPlaceholderText)
|
|
1226
|
-
}, t("persistence pending label")));
|
|
1227
|
-
case 0:
|
|
1228
|
-
default:
|
|
1229
|
-
return /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.Tooltip.Root, {
|
|
1230
|
-
delayDuration: 400
|
|
1231
|
-
}, /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.Tooltip.Trigger, {
|
|
1232
|
-
role: "status",
|
|
1233
|
-
className: "flex items-center"
|
|
1234
|
-
}, /* @__PURE__ */ import_react16.default.createElement(import_react15.CheckCircle, {
|
|
1235
|
-
className: (0, import_react_ui_theme3.mx)((0, import_react_ui_theme3.getSize)(4), "me-1")
|
|
1236
|
-
}), displayMessage && /* @__PURE__ */ import_react16.default.createElement("span", {
|
|
1237
|
-
className: (0, import_react_ui_theme3.mx)("text-sm", import_react_ui_theme3.staticPlaceholderText)
|
|
1238
|
-
}, t("persisted locally label"))), /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.Tooltip.Portal, null, /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.Tooltip.Content, {
|
|
1239
|
-
classNames: "z-10"
|
|
1240
|
-
}, t("persisted locally message"), /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.Tooltip.Arrow, null))));
|
|
1241
|
-
}
|
|
1242
|
-
};
|
|
1243
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/PopoverRenameObject.tsx";
|
|
1244
|
-
var PopoverRenameObject = ({ object: obj }) => {
|
|
1245
|
-
const { t } = (0, import_react_ui11.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1246
|
-
const doneButton = (0, import_react17.useRef)(null);
|
|
1247
|
-
const object = obj;
|
|
1248
|
-
const [name, setName] = (0, import_react17.useState)(object.name || object.title || "");
|
|
1249
|
-
const handleDone = (0, import_react17.useCallback)(() => {
|
|
1250
|
-
try {
|
|
1251
|
-
object.name = name;
|
|
1252
|
-
} catch {
|
|
1253
|
-
try {
|
|
1254
|
-
object.title = name;
|
|
1255
|
-
} catch (err) {
|
|
1256
|
-
import_log2.log.error("Failed to rename object", {
|
|
1257
|
-
err
|
|
1258
|
-
}, {
|
|
1259
|
-
F: __dxlog_file2,
|
|
1260
|
-
L: 28,
|
|
1261
|
-
S: void 0,
|
|
1262
|
-
C: (f, a) => f(...a)
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
}, [
|
|
1267
|
-
object,
|
|
1268
|
-
name
|
|
1269
|
-
]);
|
|
1270
|
-
return /* @__PURE__ */ import_react17.default.createElement("div", {
|
|
1271
|
-
role: "none",
|
|
1272
|
-
className: "p-1 flex gap-2"
|
|
1273
|
-
}, /* @__PURE__ */ import_react17.default.createElement("div", {
|
|
1274
|
-
role: "none",
|
|
1275
|
-
className: "flex-1"
|
|
1276
|
-
}, /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Input.Root, null, /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Input.Label, {
|
|
1277
|
-
srOnly: true
|
|
1278
|
-
}, t("object name label")), /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Input.TextInput, {
|
|
1279
|
-
placeholder: t("object title placeholder"),
|
|
1280
|
-
value: name,
|
|
1281
|
-
"data-testid": "spacePlugin.renameObject.input",
|
|
1282
|
-
onChange: ({ target: { value } }) => setName(value),
|
|
1283
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
1284
|
-
}))), /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Popover.Close, {
|
|
1285
|
-
asChild: true
|
|
1286
|
-
}, /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Button, {
|
|
1287
|
-
ref: doneButton,
|
|
1288
|
-
classNames: "self-stretch",
|
|
1289
|
-
onClick: handleDone
|
|
1290
|
-
}, t("done label", {
|
|
1291
|
-
ns: "os"
|
|
1292
|
-
}))));
|
|
1293
|
-
};
|
|
1294
|
-
var PopoverRenameSpace = ({ space }) => {
|
|
1295
|
-
const { t } = (0, import_react_ui12.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1296
|
-
const doneButton = (0, import_react18.useRef)(null);
|
|
1297
|
-
const [name, setName] = (0, import_react18.useState)(space.properties.name ?? "");
|
|
1298
|
-
const handleDone = (0, import_react18.useCallback)(() => {
|
|
1299
|
-
space.properties.name = name;
|
|
1300
|
-
}, [
|
|
1301
|
-
space,
|
|
1302
|
-
name
|
|
1303
|
-
]);
|
|
1304
|
-
return /* @__PURE__ */ import_react18.default.createElement("div", {
|
|
1305
|
-
role: "none",
|
|
1306
|
-
className: "p-1 flex gap-2"
|
|
1307
|
-
}, /* @__PURE__ */ import_react18.default.createElement("div", {
|
|
1308
|
-
role: "none",
|
|
1309
|
-
className: "flex-1"
|
|
1310
|
-
}, /* @__PURE__ */ import_react18.default.createElement(import_react_ui12.Input.Root, null, /* @__PURE__ */ import_react18.default.createElement(import_react_ui12.Input.Label, {
|
|
1311
|
-
srOnly: true
|
|
1312
|
-
}, t("space name label")), /* @__PURE__ */ import_react18.default.createElement(import_react_ui12.Input.TextInput, {
|
|
1313
|
-
defaultValue: space.properties.name ?? "",
|
|
1314
|
-
placeholder: t("unnamed space label"),
|
|
1315
|
-
onChange: ({ target: { value } }) => setName(value),
|
|
1316
|
-
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
1317
|
-
// Currently this is not possible because Radix does not expose the popover context.
|
|
1318
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
1319
|
-
}))), /* @__PURE__ */ import_react18.default.createElement(import_react_ui12.Popover.Close, {
|
|
1320
|
-
asChild: true
|
|
1321
|
-
}, /* @__PURE__ */ import_react18.default.createElement(import_react_ui12.Button, {
|
|
1322
|
-
ref: doneButton,
|
|
1323
|
-
classNames: "self-stretch",
|
|
1324
|
-
onClick: handleDone
|
|
1325
|
-
}, t("done label", {
|
|
1326
|
-
ns: "os"
|
|
1327
|
-
}))));
|
|
1328
|
-
};
|
|
1329
|
-
var ShareSpaceButton = ({ space }) => {
|
|
1330
|
-
const dispatch = (0, import_app_framework6.useIntentDispatcher)();
|
|
1331
|
-
return /* @__PURE__ */ import_react19.default.createElement(ShareSpaceButtonImpl, {
|
|
1332
|
-
onClick: () => dispatch({
|
|
1333
|
-
action: import_chunk_QNVEU2UD.SpaceAction.SHARE,
|
|
1334
|
-
data: {
|
|
1335
|
-
space
|
|
1336
|
-
}
|
|
1337
|
-
})
|
|
1338
|
-
});
|
|
1339
|
-
};
|
|
1340
|
-
var ShareSpaceButtonImpl = ({ onClick }) => {
|
|
1341
|
-
const { t } = (0, import_react_ui13.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1342
|
-
return /* @__PURE__ */ import_react19.default.createElement(import_react_ui13.IconButton, {
|
|
1343
|
-
"data-testid": "spacePlugin.shareSpaceButton",
|
|
1344
|
-
icon: "ph--users--regular",
|
|
1345
|
-
label: t("share space label"),
|
|
1346
|
-
onClick
|
|
1347
|
-
});
|
|
1348
|
-
};
|
|
1349
|
-
var REFRESH_INTERVAL = 5e3;
|
|
1350
|
-
var ACTIVITY_DURATION = 3e4;
|
|
1351
|
-
var noViewers = new import_util3.ComplexMap(import_react_client5.PublicKey.hash);
|
|
1352
|
-
var getName = (identity) => identity.profile?.displayName ?? (0, import_display_name.generateName)(identity.identityKey.toHex());
|
|
1353
|
-
var SpacePresence = ({ object, spaceKey }) => {
|
|
1354
|
-
const spacePlugin = (0, import_app_framework7.usePlugin)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1355
|
-
const client = (0, import_react_client5.useClient)();
|
|
1356
|
-
const identity = (0, import_halo.useIdentity)();
|
|
1357
|
-
const space = spaceKey ? client.spaces.get(spaceKey) : (0, import_echo8.getSpace)(object);
|
|
1358
|
-
const spaceMembers = (0, import_echo8.useMembers)(space?.key);
|
|
1359
|
-
const [_moment, setMoment] = (0, import_react20.useState)(Date.now());
|
|
1360
|
-
(0, import_react20.useEffect)(() => {
|
|
1361
|
-
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1362
|
-
return () => clearInterval(interval);
|
|
1363
|
-
}, []);
|
|
1364
|
-
const memberOnline = (0, import_react20.useCallback)((member) => member.presence === 1, []);
|
|
1365
|
-
const memberIsNotSelf = (0, import_react20.useCallback)((member) => !identity?.identityKey.equals(member.identity.identityKey), [
|
|
1366
|
-
identity?.identityKey
|
|
1367
|
-
]);
|
|
1368
|
-
if (!identity || !spacePlugin || !space) {
|
|
1369
|
-
return null;
|
|
1370
|
-
}
|
|
1371
|
-
const spaceState = spacePlugin.provides.space;
|
|
1372
|
-
const currentObjectViewers = spaceState.viewersByObject[(0, import_echo8.fullyQualifiedId)(object)] ?? noViewers;
|
|
1373
|
-
const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
|
|
1374
|
-
const objectView = currentObjectViewers.get(member.identity.identityKey);
|
|
1375
|
-
const lastSeen = objectView?.lastSeen ?? -Infinity;
|
|
1376
|
-
const currentlyAttended = objectView?.currentlyAttended ?? false;
|
|
1377
|
-
return {
|
|
1378
|
-
...member,
|
|
1379
|
-
currentlyAttended,
|
|
1380
|
-
lastSeen
|
|
1381
|
-
};
|
|
1382
|
-
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1383
|
-
return /* @__PURE__ */ import_react20.default.createElement(FullPresence, {
|
|
1384
|
-
members: membersForObject
|
|
1385
|
-
});
|
|
1386
|
-
};
|
|
1387
|
-
var FullPresence = (props) => {
|
|
1388
|
-
const { size = 9, onMemberClick } = props;
|
|
1389
|
-
const members = (0, import_react_ui14.useDefaultValue)(props.members, () => []);
|
|
1390
|
-
if (members.length === 0) {
|
|
1391
|
-
return null;
|
|
1392
|
-
}
|
|
1393
|
-
return /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.AvatarGroup.Root, {
|
|
1394
|
-
size,
|
|
1395
|
-
classNames: "mbs-2 mie-4",
|
|
1396
|
-
"data-testid": "spacePlugin.presence"
|
|
1397
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Root, {
|
|
1398
|
-
key: member.identity.identityKey.toHex()
|
|
1399
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Trigger, null, /* @__PURE__ */ import_react20.default.createElement(PrensenceAvatar, {
|
|
1400
|
-
identity: member.identity,
|
|
1401
|
-
group: true,
|
|
1402
|
-
match: member.currentlyAttended,
|
|
1403
|
-
index: members.length - i,
|
|
1404
|
-
onClick: () => onMemberClick?.(member)
|
|
1405
|
-
})), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Portal, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Content, {
|
|
1406
|
-
side: "bottom"
|
|
1407
|
-
}, /* @__PURE__ */ import_react20.default.createElement("span", null, getName(member.identity)), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Arrow, null))))), members.length > 3 && /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Root, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Trigger, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.AvatarGroupItem.Root, {
|
|
1408
|
-
status: "inactive"
|
|
1409
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Avatar.Frame, {
|
|
1410
|
-
style: {
|
|
1411
|
-
zIndex: members.length - 4
|
|
1412
|
-
}
|
|
1413
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Avatar.Fallback, {
|
|
1414
|
-
text: `+${members.length - 3}`
|
|
1415
|
-
})))), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Portal, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Content, {
|
|
1416
|
-
side: "bottom"
|
|
1417
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Arrow, null), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.List, {
|
|
1418
|
-
classNames: "max-h-56 overflow-y-auto"
|
|
1419
|
-
}, members.map((member) => /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.ListItem.Root, {
|
|
1420
|
-
key: member.identity.identityKey.toHex(),
|
|
1421
|
-
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1422
|
-
onClick: () => onMemberClick?.(member),
|
|
1423
|
-
"data-testid": "identity-list-item"
|
|
1424
|
-
}, /* @__PURE__ */ import_react20.default.createElement(PrensenceAvatar, {
|
|
1425
|
-
identity: member.identity,
|
|
1426
|
-
showName: true,
|
|
1427
|
-
match: member.currentlyAttended
|
|
1428
|
-
}))))))));
|
|
1429
|
-
};
|
|
1430
|
-
var PrensenceAvatar = ({ identity, showName, match, group, index, onClick }) => {
|
|
1431
|
-
const Root = group ? import_react_ui14.AvatarGroupItem.Root : import_react_ui14.Avatar.Root;
|
|
1432
|
-
const status = match ? "current" : "active";
|
|
1433
|
-
const fallbackValue = (0, import_util3.keyToFallback)(identity.identityKey);
|
|
1434
|
-
return /* @__PURE__ */ import_react20.default.createElement(Root, {
|
|
1435
|
-
status,
|
|
1436
|
-
hue: identity.profile?.data?.hue || fallbackValue.hue
|
|
1437
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Avatar.Frame, {
|
|
1438
|
-
"data-testid": "spacePlugin.presence.member",
|
|
1439
|
-
"data-status": status,
|
|
1440
|
-
...index ? {
|
|
1441
|
-
style: {
|
|
1442
|
-
zIndex: index
|
|
1443
|
-
}
|
|
1444
|
-
} : {},
|
|
1445
|
-
onClick: () => onClick?.()
|
|
1446
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Avatar.Fallback, {
|
|
1447
|
-
text: identity.profile?.data?.emoji || fallbackValue.emoji
|
|
1448
|
-
})), showName && /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Avatar.Label, {
|
|
1449
|
-
classNames: "text-sm truncate pli-2"
|
|
1450
|
-
}, getName(identity)));
|
|
1451
|
-
};
|
|
1452
|
-
var SmallPresenceLive = ({ id, viewers }) => {
|
|
1453
|
-
const getActiveViewers = (viewers2) => {
|
|
1454
|
-
const moment = Date.now();
|
|
1455
|
-
return Array.from(viewers2.values()).filter(({ lastSeen }) => moment - lastSeen < ACTIVITY_DURATION);
|
|
1456
|
-
};
|
|
1457
|
-
const [activeViewers, setActiveViewers] = (0, import_react20.useState)(viewers ? getActiveViewers(viewers) : []);
|
|
1458
|
-
(0, import_react20.useEffect)(() => {
|
|
1459
|
-
if (viewers) {
|
|
1460
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1461
|
-
const interval = setInterval(() => {
|
|
1462
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1463
|
-
}, REFRESH_INTERVAL);
|
|
1464
|
-
return () => clearInterval(interval);
|
|
1465
|
-
}
|
|
1466
|
-
}, [
|
|
1467
|
-
viewers
|
|
1468
|
-
]);
|
|
1469
|
-
return /* @__PURE__ */ import_react20.default.createElement(SmallPresence, {
|
|
1470
|
-
id,
|
|
1471
|
-
count: activeViewers.length
|
|
1472
|
-
});
|
|
1473
|
-
};
|
|
1474
|
-
var SmallPresence = ({ id, count }) => {
|
|
1475
|
-
const { t } = (0, import_react_ui14.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1476
|
-
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention.useAttention)(id);
|
|
1477
|
-
const attention = hasAttention || isAncestor || isRelated;
|
|
1478
|
-
return /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Root, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Trigger, {
|
|
1479
|
-
asChild: true
|
|
1480
|
-
}, /* @__PURE__ */ import_react20.default.createElement("div", {
|
|
1481
|
-
role: "none",
|
|
1482
|
-
className: "flex",
|
|
1483
|
-
"data-attention": attention
|
|
1484
|
-
}, /* @__PURE__ */ import_react20.default.createElement(import_react_ui_attention.AttentionGlyph, {
|
|
1485
|
-
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1486
|
-
classNames: "self-center mie-1"
|
|
1487
|
-
}))), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Portal, null, /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Content, {
|
|
1488
|
-
side: "bottom",
|
|
1489
|
-
classNames: "z-[70]"
|
|
1490
|
-
}, /* @__PURE__ */ import_react20.default.createElement("span", null, t("presence label", {
|
|
1491
|
-
count
|
|
1492
|
-
})), /* @__PURE__ */ import_react20.default.createElement(import_react_ui14.Tooltip.Arrow, null))));
|
|
1493
|
-
};
|
|
1494
|
-
var SpacePluginSettings = ({ settings }) => {
|
|
1495
|
-
const { t } = (0, import_react_ui15.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1496
|
-
const dispatch = (0, import_app_framework8.useIntentDispatcher)();
|
|
1497
|
-
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(import_react_ui_form3.DeprecatedFormInput, {
|
|
1498
|
-
label: t("show hidden spaces label")
|
|
1499
|
-
}, /* @__PURE__ */ import_react21.default.createElement(import_react_ui15.Input.Switch, {
|
|
1500
|
-
checked: settings.showHidden,
|
|
1501
|
-
onCheckedChange: (checked) => dispatch({
|
|
1502
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
1503
|
-
action: import_chunk_QNVEU2UD.SpaceAction.TOGGLE_HIDDEN,
|
|
1504
|
-
data: {
|
|
1505
|
-
state: !!checked
|
|
1506
|
-
}
|
|
174
|
+
(0, import_app_framework2.defineModule)({
|
|
175
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/intent-resolver`,
|
|
176
|
+
activatesOn: import_app_framework2.Events.SetupIntents,
|
|
177
|
+
activate: (context) => (0, import_chunk_M64YG2FY.IntentResolver)({
|
|
178
|
+
createInvitationUrl,
|
|
179
|
+
context
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
(0, import_app_framework2.defineModule)({
|
|
183
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/app-graph-builder`,
|
|
184
|
+
activatesOn: import_app_framework2.Events.SetupAppGraph,
|
|
185
|
+
activate: import_chunk_M64YG2FY.AppGraphBuilder
|
|
186
|
+
}),
|
|
187
|
+
// TODO(wittjosiah): This could probably be deferred.
|
|
188
|
+
(0, import_app_framework2.defineModule)({
|
|
189
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/app-graph-serializer`,
|
|
190
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
191
|
+
activate: import_chunk_M64YG2FY.AppGraphSerializer
|
|
192
|
+
}),
|
|
193
|
+
(0, import_app_framework2.defineModule)({
|
|
194
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/identity-created`,
|
|
195
|
+
activatesOn: import_plugin_client.ClientEvents.IdentityCreated,
|
|
196
|
+
activatesAfter: [
|
|
197
|
+
SpaceEvents.DefaultSpaceReady
|
|
198
|
+
],
|
|
199
|
+
activate: import_chunk_M64YG2FY.IdentityCreated
|
|
200
|
+
}),
|
|
201
|
+
(0, import_app_framework2.defineModule)({
|
|
202
|
+
id: `${import_chunk_AO4EW2RX.meta.id}/module/spaces-ready`,
|
|
203
|
+
activatesOn: (0, import_app_framework2.allOf)(import_app_framework2.Events.DispatcherReady, import_app_framework2.Events.LayoutReady, import_app_framework2.Events.LocationReady, import_app_framework2.Events.AppGraphReady, import_plugin_attention.AttentionEvents.AttentionReady, SpaceEvents.StateReady, import_plugin_client.ClientEvents.SpacesReady),
|
|
204
|
+
activate: import_chunk_M64YG2FY.SpacesReady
|
|
1507
205
|
})
|
|
1508
|
-
})));
|
|
1509
|
-
};
|
|
1510
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsPanel.tsx";
|
|
1511
|
-
var SpaceSettingsPanel = ({ space }) => {
|
|
1512
|
-
const { t } = (0, import_react_ui17.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1513
|
-
const client = (0, import_react_client7.useClient)();
|
|
1514
|
-
const edgeEnabled = Boolean(client.config.values.runtime?.client?.edgeFeatures?.echoReplicator);
|
|
1515
|
-
const [edgeReplication, setEdgeReplication] = (0, import_react24.useState)(space.internal.data.edgeReplication === import_metadata2.EdgeReplicationSetting.ENABLED);
|
|
1516
|
-
const toggleEdgeReplication = (0, import_react24.useCallback)(async (next) => {
|
|
1517
|
-
setEdgeReplication(next);
|
|
1518
|
-
await space?.internal.setEdgeReplicationPreference(next ? import_metadata2.EdgeReplicationSetting.ENABLED : import_metadata2.EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1519
|
-
import_log3.log.catch(err, void 0, {
|
|
1520
|
-
F: __dxlog_file3,
|
|
1521
|
-
L: 35,
|
|
1522
|
-
S: void 0,
|
|
1523
|
-
C: (f, a) => f(...a)
|
|
1524
|
-
});
|
|
1525
|
-
setEdgeReplication(!next);
|
|
1526
|
-
});
|
|
1527
|
-
}, [
|
|
1528
|
-
space
|
|
1529
|
-
]);
|
|
1530
|
-
return /* @__PURE__ */ import_react24.default.createElement("div", {
|
|
1531
|
-
role: "form",
|
|
1532
|
-
className: "flex flex-col"
|
|
1533
|
-
}, /* @__PURE__ */ import_react24.default.createElement(import_react_ui_form4.DeprecatedFormInput, {
|
|
1534
|
-
label: t("name label")
|
|
1535
|
-
}, /* @__PURE__ */ import_react24.default.createElement(import_react_ui17.Input.TextInput, {
|
|
1536
|
-
placeholder: t("unnamed space label"),
|
|
1537
|
-
value: space.properties.name ?? "",
|
|
1538
|
-
onChange: (event) => {
|
|
1539
|
-
space.properties.name = event.target.value;
|
|
1540
|
-
}
|
|
1541
|
-
})), edgeEnabled && /* @__PURE__ */ import_react24.default.createElement(import_react_ui_form4.DeprecatedFormInput, {
|
|
1542
|
-
label: t("edge replication label")
|
|
1543
|
-
}, /* @__PURE__ */ import_react24.default.createElement(import_react_ui17.Input.Switch, {
|
|
1544
|
-
checked: edgeReplication,
|
|
1545
|
-
onCheckedChange: toggleEdgeReplication
|
|
1546
|
-
})));
|
|
1547
|
-
};
|
|
1548
|
-
var SpaceSettingsDialog = ({ space, target, createInvitationUrl, initialTab = "members", namesCache }) => {
|
|
1549
|
-
const { t } = (0, import_react_ui16.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1550
|
-
const client = (0, import_react_client6.useClient)();
|
|
1551
|
-
const [tabsActivePart, setTabsActivePart] = (0, import_react22.useState)("list");
|
|
1552
|
-
const [selected, setSelected] = (0, import_react22.useState)(initialTab);
|
|
1553
|
-
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
1554
|
-
const name = getSpaceDisplayName(space, {
|
|
1555
|
-
personal: client.spaces.default === space,
|
|
1556
|
-
namesCache
|
|
1557
|
-
});
|
|
1558
|
-
return (
|
|
1559
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
1560
|
-
// Consider factoring it out to the tabs package.
|
|
1561
|
-
/* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Dialog.Content, {
|
|
1562
|
-
classNames: "p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
1563
|
-
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
1564
|
-
role: "none",
|
|
1565
|
-
className: "flex justify-between pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
1566
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Dialog.Title, {
|
|
1567
|
-
onClick: () => setTabsActivePart("list"),
|
|
1568
|
-
"aria-description": t("click to return to tablist description"),
|
|
1569
|
-
classNames: "flex cursor-pointer items-center group/title"
|
|
1570
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Icon, {
|
|
1571
|
-
icon: "ph--caret-left--regular",
|
|
1572
|
-
size: 4,
|
|
1573
|
-
classNames: [
|
|
1574
|
-
"@md:hidden",
|
|
1575
|
-
tabsActivePart === "list" && "invisible"
|
|
1576
|
-
]
|
|
1577
|
-
}), /* @__PURE__ */ import_react22.default.createElement("span", {
|
|
1578
|
-
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
1579
|
-
}, (0, import_react_ui16.toLocalizedString)(name, t))), /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Dialog.Close, {
|
|
1580
|
-
asChild: true
|
|
1581
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Button, {
|
|
1582
|
-
density: "fine",
|
|
1583
|
-
variant: "ghost",
|
|
1584
|
-
autoFocus: true
|
|
1585
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Icon, {
|
|
1586
|
-
icon: "ph--x--regular",
|
|
1587
|
-
size: 4
|
|
1588
|
-
})))), /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Root, {
|
|
1589
|
-
orientation: "vertical",
|
|
1590
|
-
value: selected,
|
|
1591
|
-
onValueChange: setSelected,
|
|
1592
|
-
activePart: tabsActivePart,
|
|
1593
|
-
onActivePartChange: setTabsActivePart,
|
|
1594
|
-
classNames: "flex flex-col flex-1 mbs-2"
|
|
1595
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Viewport, {
|
|
1596
|
-
classNames: "flex-1 min-bs-0"
|
|
1597
|
-
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
1598
|
-
role: "none",
|
|
1599
|
-
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
1600
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Tablist, {
|
|
1601
|
-
classNames: "flex flex-col max-bs-none min-is-[200px] gap-4 overflow-y-auto"
|
|
1602
|
-
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
1603
|
-
role: "none",
|
|
1604
|
-
className: "flex flex-col ml-1"
|
|
1605
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Tab, {
|
|
1606
|
-
value: "settings"
|
|
1607
|
-
}, t("settings tab label")), /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Tab, {
|
|
1608
|
-
value: "members",
|
|
1609
|
-
disabled: locked
|
|
1610
|
-
}, t("members tab label"))))), /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
1611
|
-
value: "settings",
|
|
1612
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1613
|
-
}, /* @__PURE__ */ import_react22.default.createElement(SpaceSettingsPanel, {
|
|
1614
|
-
space
|
|
1615
|
-
})), /* @__PURE__ */ import_react22.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
1616
|
-
value: "members",
|
|
1617
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
1618
|
-
}, /* @__PURE__ */ import_react22.default.createElement(import_react_ui16.Clipboard.Provider, null, /* @__PURE__ */ import_react22.default.createElement(import_react23.SpacePanel, {
|
|
1619
|
-
space,
|
|
1620
|
-
hideHeading: true,
|
|
1621
|
-
target,
|
|
1622
|
-
createInvitationUrl
|
|
1623
|
-
}))))))
|
|
1624
|
-
);
|
|
1625
|
-
};
|
|
1626
|
-
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/sync-state.ts";
|
|
1627
|
-
var createEmptyEdgeSyncState = () => ({
|
|
1628
|
-
missingOnLocal: 0,
|
|
1629
|
-
missingOnRemote: 0,
|
|
1630
|
-
localDocumentCount: 0,
|
|
1631
|
-
remoteDocumentCount: 0,
|
|
1632
|
-
differentDocuments: 0
|
|
1633
|
-
});
|
|
1634
|
-
var getSyncSummary = (syncMap) => {
|
|
1635
|
-
return Object.entries(syncMap).reduce((summary, [_spaceId, peerState]) => {
|
|
1636
|
-
summary.missingOnLocal += peerState.missingOnLocal;
|
|
1637
|
-
summary.missingOnRemote += peerState.missingOnRemote;
|
|
1638
|
-
summary.localDocumentCount += peerState.localDocumentCount;
|
|
1639
|
-
summary.remoteDocumentCount += peerState.remoteDocumentCount;
|
|
1640
|
-
summary.differentDocuments += peerState.differentDocuments;
|
|
1641
|
-
return summary;
|
|
1642
|
-
}, createEmptyEdgeSyncState());
|
|
1643
|
-
};
|
|
1644
|
-
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${import_protocols.EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
1645
|
-
var useSyncState = () => {
|
|
1646
|
-
const client = (0, import_react_client9.useClient)();
|
|
1647
|
-
const [spaceState, setSpaceState] = (0, import_react26.useState)({});
|
|
1648
|
-
(0, import_react26.useEffect)(() => {
|
|
1649
|
-
const ctx = new import_context.Context(void 0, {
|
|
1650
|
-
F: __dxlog_file4,
|
|
1651
|
-
L: 48
|
|
1652
|
-
});
|
|
1653
|
-
const createSubscriptions = (spaces) => {
|
|
1654
|
-
for (const space of spaces) {
|
|
1655
|
-
if (spaceState[space.id]) {
|
|
1656
|
-
continue;
|
|
1657
|
-
}
|
|
1658
|
-
ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1659
|
-
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1660
|
-
if (syncState) {
|
|
1661
|
-
setSpaceState((spaceState2) => ({
|
|
1662
|
-
...spaceState2,
|
|
1663
|
-
[space.id]: syncState
|
|
1664
|
-
}));
|
|
1665
|
-
}
|
|
1666
|
-
}));
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
createSubscriptions(client.spaces.get());
|
|
1670
|
-
client.spaces.subscribe((spaces) => {
|
|
1671
|
-
createSubscriptions(spaces);
|
|
1672
|
-
});
|
|
1673
|
-
return () => {
|
|
1674
|
-
void ctx.dispose();
|
|
1675
|
-
};
|
|
1676
|
-
}, [
|
|
1677
|
-
client
|
|
1678
|
-
]);
|
|
1679
|
-
return spaceState;
|
|
1680
|
-
};
|
|
1681
|
-
var useSpaceSyncState = (space) => {
|
|
1682
|
-
const [spaceState, setSpaceState] = (0, import_react26.useState)();
|
|
1683
|
-
(0, import_react26.useEffect)(() => {
|
|
1684
|
-
const ctx = new import_context.Context(void 0, {
|
|
1685
|
-
F: __dxlog_file4,
|
|
1686
|
-
L: 87
|
|
1687
|
-
});
|
|
1688
|
-
space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
1689
|
-
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
1690
|
-
if (syncState) {
|
|
1691
|
-
setSpaceState(syncState);
|
|
1692
|
-
}
|
|
1693
|
-
});
|
|
1694
|
-
return () => {
|
|
1695
|
-
void ctx.dispose();
|
|
1696
|
-
};
|
|
1697
|
-
}, [
|
|
1698
|
-
space
|
|
1699
|
-
]);
|
|
1700
|
-
return spaceState;
|
|
1701
|
-
};
|
|
1702
|
-
var useEdgeStatus = () => {
|
|
1703
|
-
const [status, setStatus] = (0, import_react25.useState)(import_services.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED);
|
|
1704
|
-
const client = (0, import_react_client8.useClient)();
|
|
1705
|
-
(0, import_react25.useEffect)(() => {
|
|
1706
|
-
client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
|
|
1707
|
-
setStatus(status2);
|
|
1708
|
-
});
|
|
1709
|
-
}, [
|
|
1710
|
-
client
|
|
1711
|
-
]);
|
|
1712
|
-
return status;
|
|
1713
|
-
};
|
|
1714
|
-
var InlineSyncStatus = ({ space }) => {
|
|
1715
|
-
const connectedToEdge = useEdgeStatus() === import_services.QueryEdgeStatusResponse.EdgeStatus.CONNECTED;
|
|
1716
|
-
const edgeSyncEnabled = space.internal.data.edgeReplication === import_metadata3.EdgeReplicationSetting.ENABLED;
|
|
1717
|
-
const syncState = useSpaceSyncState(space);
|
|
1718
|
-
if (!connectedToEdge || !edgeSyncEnabled || !syncState || syncState.missingOnLocal === 0) {
|
|
1719
|
-
return null;
|
|
1720
|
-
}
|
|
1721
|
-
return /* @__PURE__ */ import_react25.default.createElement(InlineSyncStatusIndicator, null);
|
|
1722
|
-
};
|
|
1723
|
-
var InlineSyncStatusIndicator = () => {
|
|
1724
|
-
const { t } = (0, import_react_ui18.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1725
|
-
const animationProps = (0, import_react25.useMemo)(() => ({
|
|
1726
|
-
// Synchronize animations.
|
|
1727
|
-
animationDelay: `-${Date.now() % 2e3}ms`
|
|
1728
|
-
}), []);
|
|
1729
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
1730
|
-
role: "status",
|
|
1731
|
-
"aria-label": t("syncing message"),
|
|
1732
|
-
className: "flex items-center"
|
|
1733
|
-
}, /* @__PURE__ */ import_react25.default.createElement(import_react_ui18.Icon, {
|
|
1734
|
-
icon: "ph--circle-notch--regular",
|
|
1735
|
-
size: 3,
|
|
1736
|
-
style: animationProps,
|
|
1737
|
-
classNames: "text-subdued animate-[spin_2s_linear_infinite]"
|
|
1738
|
-
}));
|
|
1739
|
-
};
|
|
1740
|
-
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1741
|
-
var styles = {
|
|
1742
|
-
barBg: "bg-neutral-50 dark:bg-green-900 text-black",
|
|
1743
|
-
barFg: "bg-neutral-100 bg-green-500",
|
|
1744
|
-
barHover: "dark:hover:bg-green-500"
|
|
1745
|
-
};
|
|
1746
|
-
var useActive = (count) => {
|
|
1747
|
-
const [current, setCurrent] = (0, import_react28.useState)(count);
|
|
1748
|
-
const [active, setActive] = (0, import_react28.useState)(false);
|
|
1749
|
-
(0, import_react28.useEffect)(() => {
|
|
1750
|
-
let t;
|
|
1751
|
-
if (count !== current) {
|
|
1752
|
-
setActive(true);
|
|
1753
|
-
setCurrent(count);
|
|
1754
|
-
t && clearTimeout(t);
|
|
1755
|
-
t = setTimeout(() => {
|
|
1756
|
-
setActive(false);
|
|
1757
|
-
}, SYNC_STALLED_TIMEOUT);
|
|
1758
|
-
}
|
|
1759
|
-
return () => {
|
|
1760
|
-
setActive(false);
|
|
1761
|
-
clearTimeout(t);
|
|
1762
|
-
};
|
|
1763
|
-
}, [
|
|
1764
|
-
count,
|
|
1765
|
-
current
|
|
1766
|
-
]);
|
|
1767
|
-
return active;
|
|
1768
|
-
};
|
|
1769
|
-
var SpaceRowContainer = ({ spaceId, state }) => {
|
|
1770
|
-
const { t } = (0, import_react_ui20.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1771
|
-
const client = (0, import_react_client11.useClient)();
|
|
1772
|
-
const space = (0, import_echo9.useSpace)(spaceId);
|
|
1773
|
-
if (!space) {
|
|
1774
|
-
return null;
|
|
1775
|
-
}
|
|
1776
|
-
const spaceName = (0, import_react_ui20.toLocalizedString)(getSpaceDisplayName(space, {
|
|
1777
|
-
personal: space === client.spaces.default
|
|
1778
|
-
}), t);
|
|
1779
|
-
return /* @__PURE__ */ import_react28.default.createElement(SpaceRow, {
|
|
1780
|
-
spaceId,
|
|
1781
|
-
spaceName,
|
|
1782
|
-
state
|
|
1783
|
-
});
|
|
1784
|
-
};
|
|
1785
|
-
var SpaceRow = ({ spaceId, spaceName, state: { localDocumentCount, remoteDocumentCount, missingOnLocal, missingOnRemote } }) => {
|
|
1786
|
-
const downActive = useActive(localDocumentCount);
|
|
1787
|
-
const upActive = useActive(remoteDocumentCount);
|
|
1788
|
-
return /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1789
|
-
className: "flex items-center mx-0.5 gap-0.5 cursor-pointer",
|
|
1790
|
-
title: spaceId,
|
|
1791
|
-
onClick: () => {
|
|
1792
|
-
void navigator.clipboard.writeText(spaceId);
|
|
1793
|
-
}
|
|
1794
|
-
}, /* @__PURE__ */ import_react28.default.createElement("span", {
|
|
1795
|
-
className: "is-1/2 truncate"
|
|
1796
|
-
}, spaceName), /* @__PURE__ */ import_react28.default.createElement(import_react_ui20.Icon, {
|
|
1797
|
-
icon: "ph--arrow-fat-line-left--regular",
|
|
1798
|
-
size: 3,
|
|
1799
|
-
classNames: (0, import_react_ui_theme5.mx)(downActive && "animate-[pulse_1s_infinite]")
|
|
1800
|
-
}), /* @__PURE__ */ import_react28.default.createElement(Candle, {
|
|
1801
|
-
up: {
|
|
1802
|
-
count: remoteDocumentCount,
|
|
1803
|
-
total: remoteDocumentCount + missingOnRemote
|
|
1804
|
-
},
|
|
1805
|
-
down: {
|
|
1806
|
-
count: localDocumentCount,
|
|
1807
|
-
total: localDocumentCount + missingOnLocal
|
|
1808
|
-
},
|
|
1809
|
-
title: spaceId
|
|
1810
|
-
}), /* @__PURE__ */ import_react28.default.createElement(import_react_ui20.Icon, {
|
|
1811
|
-
icon: "ph--arrow-fat-line-right--regular",
|
|
1812
|
-
size: 3,
|
|
1813
|
-
classNames: (0, import_react_ui_theme5.mx)(upActive && "animate-[pulse_1s_step-start_infinite]")
|
|
1814
|
-
}));
|
|
1815
|
-
};
|
|
1816
|
-
var Candle = ({ classNames, up, down }) => {
|
|
1817
|
-
return /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1818
|
-
className: (0, import_react_ui_theme5.mx)("grid grid-cols-[1fr_2rem_1fr] w-full h-3", classNames)
|
|
1819
|
-
}, /* @__PURE__ */ import_react28.default.createElement(Bar, {
|
|
1820
|
-
classNames: "justify-end",
|
|
1821
|
-
...up
|
|
1822
|
-
}), /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1823
|
-
className: "relative"
|
|
1824
|
-
}, /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1825
|
-
className: (0, import_react_ui_theme5.mx)("absolute inset-0 flex items-center justify-center text-xs", styles.barBg)
|
|
1826
|
-
}, up.total)), /* @__PURE__ */ import_react28.default.createElement(Bar, down));
|
|
1827
|
-
};
|
|
1828
|
-
var Bar = ({ classNames, count, total }) => {
|
|
1829
|
-
let p = count / total * 100;
|
|
1830
|
-
if (count < total) {
|
|
1831
|
-
p = Math.min(p, 95);
|
|
1832
|
-
}
|
|
1833
|
-
return /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1834
|
-
className: (0, import_react_ui_theme5.mx)("relative flex w-full", styles.barBg, classNames)
|
|
1835
|
-
}, /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1836
|
-
className: (0, import_react_ui_theme5.mx)("shrink-0", styles.barFg),
|
|
1837
|
-
style: {
|
|
1838
|
-
width: `${p}%`
|
|
1839
|
-
}
|
|
1840
|
-
}), count !== total && /* @__PURE__ */ import_react28.default.createElement("div", {
|
|
1841
|
-
className: "absolute top-0 bottom-0 flex items-center mx-0.5 text-black text-xs"
|
|
1842
|
-
}, count));
|
|
1843
|
-
};
|
|
1844
|
-
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
|
|
1845
|
-
var createClientSaveTracker = (client, cb) => {
|
|
1846
|
-
const unsubscribeCallbacks = {};
|
|
1847
|
-
const state = {};
|
|
1848
|
-
const install = (spaces) => {
|
|
1849
|
-
for (const space of spaces) {
|
|
1850
|
-
if (state[space.id]) {
|
|
1851
|
-
continue;
|
|
1852
|
-
}
|
|
1853
|
-
state[space.id] = "saved";
|
|
1854
|
-
unsubscribeCallbacks[space.id] = createSpaceSaveTracker(space, (s) => {
|
|
1855
|
-
state[space.id] = s;
|
|
1856
|
-
cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
|
|
1857
|
-
});
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
client.spaces.subscribe((spaces) => {
|
|
1861
|
-
install(spaces);
|
|
1862
|
-
});
|
|
1863
|
-
install(client.spaces.get());
|
|
1864
|
-
return () => {
|
|
1865
|
-
for (const unsubscribe of Object.values(unsubscribeCallbacks)) {
|
|
1866
|
-
unsubscribe();
|
|
1867
|
-
}
|
|
1868
|
-
};
|
|
1869
|
-
};
|
|
1870
|
-
var createSpaceSaveTracker = (space, cb) => {
|
|
1871
|
-
const ctx = new import_context2.Context(void 0, {
|
|
1872
|
-
F: __dxlog_file5,
|
|
1873
|
-
L: 40
|
|
1874
|
-
});
|
|
1875
|
-
void space.waitUntilReady().then(() => {
|
|
1876
|
-
if (ctx.disposed) {
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
|
-
let hasUnsavedChanges = false;
|
|
1880
|
-
let lastFlushPromise;
|
|
1881
|
-
space.crud.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
|
|
1882
|
-
hasUnsavedChanges = unsavedDocuments.length > 0;
|
|
1883
|
-
});
|
|
1884
|
-
space.crud.saveStateChanged.debounce(500).on(ctx, () => {
|
|
1885
|
-
if (hasUnsavedChanges) {
|
|
1886
|
-
lastFlushPromise = void 0;
|
|
1887
|
-
cb("saving");
|
|
1888
|
-
} else {
|
|
1889
|
-
const flushPromise = space.crud.flush();
|
|
1890
|
-
lastFlushPromise = flushPromise;
|
|
1891
|
-
void flushPromise.then(() => {
|
|
1892
|
-
if (lastFlushPromise === flushPromise) {
|
|
1893
|
-
cb("saved");
|
|
1894
|
-
}
|
|
1895
|
-
});
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1898
|
-
});
|
|
1899
|
-
return () => {
|
|
1900
|
-
void ctx.dispose();
|
|
1901
|
-
};
|
|
1902
|
-
};
|
|
1903
|
-
var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
|
|
1904
|
-
if (!saved) {
|
|
1905
|
-
return "saving locally";
|
|
1906
|
-
} else if (!offline && needsToDownload) {
|
|
1907
|
-
return "downloading";
|
|
1908
|
-
} else if (!offline && needsToUpload) {
|
|
1909
|
-
return "uploading";
|
|
1910
|
-
} else if (offline && !needsToUpload && !needsToDownload) {
|
|
1911
|
-
return "offline persisted";
|
|
1912
|
-
} else {
|
|
1913
|
-
return "remote synced";
|
|
1914
|
-
}
|
|
1915
|
-
};
|
|
1916
|
-
var getIcon = (status) => {
|
|
1917
|
-
switch (status) {
|
|
1918
|
-
case "saving locally":
|
|
1919
|
-
return "ph--download--regular";
|
|
1920
|
-
case "downloading":
|
|
1921
|
-
return "ph--cloud-arrow-down--regular";
|
|
1922
|
-
case "uploading":
|
|
1923
|
-
return "ph--cloud-arrow-up--regular";
|
|
1924
|
-
case "offline persisted":
|
|
1925
|
-
return "ph--check-circle--regular";
|
|
1926
|
-
case "remote synced":
|
|
1927
|
-
return "ph--cloud-check--regular";
|
|
1928
|
-
}
|
|
1929
|
-
};
|
|
1930
|
-
var SyncStatus = () => {
|
|
1931
|
-
const client = (0, import_react_client10.useClient)();
|
|
1932
|
-
const state = useSyncState();
|
|
1933
|
-
const [saved, setSaved] = (0, import_react27.useState)(true);
|
|
1934
|
-
(0, import_react27.useEffect)(() => {
|
|
1935
|
-
return createClientSaveTracker(client, (state2) => {
|
|
1936
|
-
setSaved(state2 === "saved");
|
|
1937
|
-
});
|
|
1938
|
-
}, []);
|
|
1939
|
-
return /* @__PURE__ */ import_react27.default.createElement(SyncStatusIndicator, {
|
|
1940
|
-
state,
|
|
1941
|
-
saved
|
|
1942
|
-
});
|
|
1943
|
-
};
|
|
1944
|
-
var SyncStatusIndicator = ({ state, saved }) => {
|
|
1945
|
-
const { t } = (0, import_react_ui19.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1946
|
-
const summary = getSyncSummary(state);
|
|
1947
|
-
const offline = Object.values(state).length === 0;
|
|
1948
|
-
const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
|
|
1949
|
-
const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
|
|
1950
|
-
const status = getStatus({
|
|
1951
|
-
offline,
|
|
1952
|
-
saved,
|
|
1953
|
-
needsToUpload,
|
|
1954
|
-
needsToDownload
|
|
1955
|
-
});
|
|
1956
|
-
const [classNames, setClassNames] = (0, import_react27.useState)();
|
|
1957
|
-
(0, import_react27.useEffect)(() => {
|
|
1958
|
-
setClassNames(void 0);
|
|
1959
|
-
if (offline || !needsToUpload && !needsToDownload) {
|
|
1960
|
-
return;
|
|
1961
|
-
}
|
|
1962
|
-
const t2 = setTimeout(() => {
|
|
1963
|
-
setClassNames("text-orange-500");
|
|
1964
|
-
}, SYNC_STALLED_TIMEOUT);
|
|
1965
|
-
return () => clearTimeout(t2);
|
|
1966
|
-
}, [
|
|
1967
|
-
offline,
|
|
1968
|
-
needsToUpload,
|
|
1969
|
-
needsToDownload
|
|
1970
|
-
]);
|
|
1971
|
-
const title = t(`${status} label`);
|
|
1972
|
-
const icon = /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Icon, {
|
|
1973
|
-
icon: getIcon(status),
|
|
1974
|
-
size: 4,
|
|
1975
|
-
classNames
|
|
1976
|
-
});
|
|
1977
|
-
if (offline) {
|
|
1978
|
-
return /* @__PURE__ */ import_react27.default.createElement(import_plugin_status_bar.StatusBar.Item, {
|
|
1979
|
-
title
|
|
1980
|
-
}, icon);
|
|
1981
|
-
} else {
|
|
1982
|
-
return /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Popover.Root, null, /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Popover.Trigger, {
|
|
1983
|
-
asChild: true
|
|
1984
|
-
}, /* @__PURE__ */ import_react27.default.createElement(import_plugin_status_bar.StatusBar.Button, {
|
|
1985
|
-
title
|
|
1986
|
-
}, icon)), /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Popover.Portal, null, /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Popover.Content, {
|
|
1987
|
-
sideOffset: 16
|
|
1988
|
-
}, /* @__PURE__ */ import_react27.default.createElement(SyncStatusDetail, {
|
|
1989
|
-
state,
|
|
1990
|
-
summary,
|
|
1991
|
-
debug: false
|
|
1992
|
-
}))));
|
|
1993
|
-
}
|
|
1994
|
-
};
|
|
1995
|
-
var SyncStatusDetail = ({ classNames, state, summary, debug }) => {
|
|
1996
|
-
const [showAll, setShowAll] = (0, import_react27.useState)(false);
|
|
1997
|
-
const { t } = (0, import_react_ui19.useTranslation)(import_chunk_QNVEU2UD.SPACE_PLUGIN);
|
|
1998
|
-
const entries = Object.entries(state).filter(([_, value]) => showAll || value.missingOnLocal + value.missingOnRemote > 0).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1999
|
-
const handleCheckedChange = (0, import_react27.useCallback)((state2) => setShowAll(state2), [
|
|
2000
|
-
setShowAll
|
|
2001
206
|
]);
|
|
2002
|
-
return /* @__PURE__ */ import_react27.default.createElement("div", {
|
|
2003
|
-
className: (0, import_react_ui_theme4.mx)("flex flex-col gap-3 p-2 text-xs min-w-96", classNames)
|
|
2004
|
-
}, /* @__PURE__ */ import_react27.default.createElement("div", {
|
|
2005
|
-
role: "none",
|
|
2006
|
-
className: "flex items-center"
|
|
2007
|
-
}, /* @__PURE__ */ import_react27.default.createElement("h1", {
|
|
2008
|
-
className: "flex-1"
|
|
2009
|
-
}, t("sync status title")), /* @__PURE__ */ import_react27.default.createElement("div", {
|
|
2010
|
-
className: "flex items-center gap-2"
|
|
2011
|
-
}, /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Input.Root, null, /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Input.Label, {
|
|
2012
|
-
classNames: "text-xs"
|
|
2013
|
-
}, t("show all label")), /* @__PURE__ */ import_react27.default.createElement(import_react_ui19.Input.Checkbox, {
|
|
2014
|
-
checked: showAll,
|
|
2015
|
-
onCheckedChange: handleCheckedChange
|
|
2016
|
-
})))), /* @__PURE__ */ import_react27.default.createElement("div", {
|
|
2017
|
-
className: "flex flex-col gap-2"
|
|
2018
|
-
}, entries.length === 0 && /* @__PURE__ */ import_react27.default.createElement("div", {
|
|
2019
|
-
role: "none",
|
|
2020
|
-
className: "flex justify-center"
|
|
2021
|
-
}, t("no sync status label")), entries.map(([spaceId, state2]) => /* @__PURE__ */ import_react27.default.createElement(SpaceRowContainer, {
|
|
2022
|
-
key: spaceId,
|
|
2023
|
-
spaceId,
|
|
2024
|
-
state: state2
|
|
2025
|
-
}))), debug && /* @__PURE__ */ import_react27.default.createElement(import_react_ui_syntax_highlighter.SyntaxHighlighter, {
|
|
2026
|
-
language: "json"
|
|
2027
|
-
}, JSON.stringify(summary, null, 2)));
|
|
2028
|
-
};
|
|
2029
|
-
var translations_default = [
|
|
2030
|
-
{
|
|
2031
|
-
"en-US": {
|
|
2032
|
-
[import_chunk_6SNOZF7Y.CollectionType.typename]: {
|
|
2033
|
-
"typename label": "Collection"
|
|
2034
|
-
},
|
|
2035
|
-
[import_chunk_QNVEU2UD.SPACE_PLUGIN]: {
|
|
2036
|
-
"plugin name": "Spaces",
|
|
2037
|
-
"first run message": "Nothing selected.",
|
|
2038
|
-
"create space label": "Create space",
|
|
2039
|
-
"join space label": "Join space",
|
|
2040
|
-
"empty space message": "No documents",
|
|
2041
|
-
"empty tree message": "No spaces",
|
|
2042
|
-
"unnamed space label": "New space",
|
|
2043
|
-
"closed space label": "Closed",
|
|
2044
|
-
"loading space label": "Loading space\u2026",
|
|
2045
|
-
"lock space label": "Lock space",
|
|
2046
|
-
"unlock space label": "Unlock space",
|
|
2047
|
-
"rename space label": "Rename space",
|
|
2048
|
-
"active space label": "Active space:",
|
|
2049
|
-
"space name label": "Space name",
|
|
2050
|
-
"object name label": "Object name",
|
|
2051
|
-
"close space label": "Close space",
|
|
2052
|
-
"open space label": "Open space",
|
|
2053
|
-
"export data label": "Export data",
|
|
2054
|
-
"import data label": "Import data",
|
|
2055
|
-
"migrate space label": "Migrate space",
|
|
2056
|
-
"share space": "Share space",
|
|
2057
|
-
"save space to disk label": "Save to disk",
|
|
2058
|
-
"load space from disk label": "Load from disk",
|
|
2059
|
-
"confirm restore title": "Overwrite files in this space?",
|
|
2060
|
-
"confirm restore body": "Restoring from a backup will overwrite the contents of any documents that match.",
|
|
2061
|
-
"upload file message": "Drag file here or click to browse",
|
|
2062
|
-
"object title placeholder": "Type a title here\u2026",
|
|
2063
|
-
"personal space label": "Personal Space",
|
|
2064
|
-
"spaces label": "Spaces",
|
|
2065
|
-
"show hidden spaces label": "Show closed spaces",
|
|
2066
|
-
"save files to directory label": "Save files to disk",
|
|
2067
|
-
"select path label": "Select path",
|
|
2068
|
-
"rename collection label": "Rename collection",
|
|
2069
|
-
"rename object label": "Rename item",
|
|
2070
|
-
"duplicate object label": "Duplicate item",
|
|
2071
|
-
"delete collection label": "Delete collection",
|
|
2072
|
-
"delete object label": "Delete item",
|
|
2073
|
-
"collection deleted label": "Collection deleted",
|
|
2074
|
-
"object deleted label": "Item deleted",
|
|
2075
|
-
"objects deleted label": "Items deleted",
|
|
2076
|
-
"go to object label": "Open item",
|
|
2077
|
-
"found object label": "Ready.",
|
|
2078
|
-
"found object description": "The requested object is now available.",
|
|
2079
|
-
"waiting for object label": "Loading\u2026",
|
|
2080
|
-
"waiting for object description": "The requested object is still being synchronized.",
|
|
2081
|
-
"object not found label": "Nothing found.",
|
|
2082
|
-
"object not found description": "The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.",
|
|
2083
|
-
"missing object message": "Object not available.",
|
|
2084
|
-
"missing object description": "The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.",
|
|
2085
|
-
"create collection label": "Create collection",
|
|
2086
|
-
"unnamed object label": "New object",
|
|
2087
|
-
"unnamed collection label": "New collection",
|
|
2088
|
-
"create object in space label": "Add to space",
|
|
2089
|
-
"create object in collection label": "Add to collection",
|
|
2090
|
-
"share space label": "Share",
|
|
2091
|
-
"space members label": "Space members",
|
|
2092
|
-
"active space members heading": "Online ({{count}})",
|
|
2093
|
-
"inactive space members heading": "Offline ({{count}})",
|
|
2094
|
-
"presence label_zero": "No other viewers",
|
|
2095
|
-
"presence label_one": "1 other viewer",
|
|
2096
|
-
"presence label_other": "{{count}} other viewers",
|
|
2097
|
-
"persisted locally label": "Changes saved locally.",
|
|
2098
|
-
"persisted locally message": "All changes have been saved to disk on this device.",
|
|
2099
|
-
"persistence pending label": "Saving\u2026",
|
|
2100
|
-
"persistence error label": "Error saving changes.",
|
|
2101
|
-
"more actions label": "More actions",
|
|
2102
|
-
"invitations heading": "Invitations",
|
|
2103
|
-
"keyshortcuts label": "Keyboard shortcuts",
|
|
2104
|
-
"menu footer label": "Details",
|
|
2105
|
-
"location label": "Located in",
|
|
2106
|
-
"space limit label": "Space Limit Reached",
|
|
2107
|
-
"space limit description": "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.",
|
|
2108
|
-
"space limit close label": "Close",
|
|
2109
|
-
"remove deleted objects label": "Cleanup",
|
|
2110
|
-
"remove deleted objects alt": "Permanently remove deleted objects to free up space.",
|
|
2111
|
-
"copy link label": "Copy link",
|
|
2112
|
-
"default on space create label": "On space create",
|
|
2113
|
-
"sync status title": "Sync status",
|
|
2114
|
-
"dismiss label": "Dismiss",
|
|
2115
|
-
"join success label": "Successfully joined space",
|
|
2116
|
-
"name label": "Name",
|
|
2117
|
-
"name placeholder": "Name",
|
|
2118
|
-
"unnamed object settings label": "Settings",
|
|
2119
|
-
"edge replication label": "Enable EDGE Replication",
|
|
2120
|
-
"saving locally label": "Writing to disk",
|
|
2121
|
-
"downloading label": "Replicating from peers",
|
|
2122
|
-
"uploading label": "Replicating to peers",
|
|
2123
|
-
"offline persisted label": "Saved to disk (offline)",
|
|
2124
|
-
"remote synced label": "Synced with peers",
|
|
2125
|
-
"open settings panel label": "Show Settings",
|
|
2126
|
-
"open space settings label": "Space Settings",
|
|
2127
|
-
"members tab label": "Members",
|
|
2128
|
-
"settings tab label": "Settings",
|
|
2129
|
-
"syncing message": "Space syncing",
|
|
2130
|
-
"show all label": "Show all",
|
|
2131
|
-
"no sync status label": "No space with missing objects.",
|
|
2132
|
-
"create space dialog title": "Create Space",
|
|
2133
|
-
"create object dialog title": "Create Object",
|
|
2134
|
-
"space input placeholder": "Select space",
|
|
2135
|
-
"schema input placeholder": "Select object type",
|
|
2136
|
-
"creating object type label": "Type",
|
|
2137
|
-
"creating in space label": "In Space",
|
|
2138
|
-
"creating in collection label": "In Collection",
|
|
2139
|
-
"clear input label": "Clear"
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
];
|
|
2144
|
-
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-space/src/SpacePlugin.tsx";
|
|
2145
|
-
var ACTIVE_NODE_BROADCAST_INTERVAL = 3e4;
|
|
2146
|
-
var WAIT_FOR_OBJECT_TIMEOUT2 = 1e3;
|
|
2147
|
-
var SPACE_MAX_OBJECTS = 500;
|
|
2148
|
-
var DIRECTORY_TYPE = "text/directory";
|
|
2149
|
-
var parseSpacePlugin = (plugin) => Array.isArray(plugin?.provides.space?.enabled) ? plugin : void 0;
|
|
2150
|
-
var SpacePlugin = ({ invitationUrl = window.location.origin, invitationParam = "spaceInvitationCode", firstRun, onFirstRun } = {}) => {
|
|
2151
|
-
const settings = new import_local_storage.LocalStorageStore(import_chunk_QNVEU2UD.SPACE_PLUGIN, {});
|
|
2152
|
-
const state = new import_local_storage.LocalStorageStore(import_chunk_QNVEU2UD.SPACE_PLUGIN, {
|
|
2153
|
-
awaiting: void 0,
|
|
2154
|
-
spaceNames: {},
|
|
2155
|
-
viewersByObject: {},
|
|
2156
|
-
// TODO(wittjosiah): Stop using (Complex)Map inside reactive object.
|
|
2157
|
-
viewersByIdentity: new import_util.ComplexMap(import_react_client.PublicKey.hash),
|
|
2158
|
-
sdkMigrationRunning: {},
|
|
2159
|
-
navigableCollections: false,
|
|
2160
|
-
enabledEdgeReplication: false
|
|
2161
|
-
});
|
|
2162
|
-
const subscriptions = new import_async.EventSubscriptions();
|
|
2163
|
-
const spaceSubscriptions = new import_async.EventSubscriptions();
|
|
2164
|
-
const graphSubscriptions = /* @__PURE__ */ new Map();
|
|
2165
|
-
const schemas = [];
|
|
2166
|
-
let clientPlugin;
|
|
2167
|
-
let graphPlugin;
|
|
2168
|
-
let intentPlugin;
|
|
2169
|
-
let layoutPlugin;
|
|
2170
|
-
let navigationPlugin;
|
|
2171
|
-
let attentionPlugin;
|
|
2172
|
-
let metadataPlugin;
|
|
2173
|
-
const createSpaceInvitationUrl = (invitationCode) => {
|
|
2174
|
-
const baseUrl = new URL(invitationUrl);
|
|
2175
|
-
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
2176
|
-
return baseUrl.toString();
|
|
2177
|
-
};
|
|
2178
|
-
const onSpaceReady = async () => {
|
|
2179
|
-
if (!clientPlugin || !intentPlugin || !graphPlugin || !navigationPlugin || !layoutPlugin || !attentionPlugin) {
|
|
2180
|
-
return;
|
|
2181
|
-
}
|
|
2182
|
-
const client = clientPlugin.provides.client;
|
|
2183
|
-
const dispatch = intentPlugin.provides.intent.dispatch;
|
|
2184
|
-
const graph = graphPlugin.provides.graph;
|
|
2185
|
-
const location = navigationPlugin.provides.location;
|
|
2186
|
-
const layout = layoutPlugin.provides.layout;
|
|
2187
|
-
const attention = attentionPlugin.provides.attention;
|
|
2188
|
-
const defaultSpace = client.spaces.default;
|
|
2189
|
-
if (typeof defaultSpace.properties[COMPOSER_SPACE_LOCK] !== "boolean") {
|
|
2190
|
-
defaultSpace.properties[COMPOSER_SPACE_LOCK] = true;
|
|
2191
|
-
}
|
|
2192
|
-
const { objects: [spacesOrder] } = await defaultSpace.db.query(import_echo.Filter.schema(import_echo.Expando, {
|
|
2193
|
-
key: SHARED
|
|
2194
|
-
})).run();
|
|
2195
|
-
if (!spacesOrder) {
|
|
2196
|
-
defaultSpace.db.add((0, import_live_object.create)({
|
|
2197
|
-
key: SHARED,
|
|
2198
|
-
order: []
|
|
2199
|
-
}));
|
|
2200
|
-
}
|
|
2201
|
-
subscriptions.add((0, import_core.scheduledEffect)(() => ({
|
|
2202
|
-
layoutMode: layout.layoutMode,
|
|
2203
|
-
soloPart: location.active.solo?.[0]
|
|
2204
|
-
}), ({ layoutMode, soloPart }) => {
|
|
2205
|
-
if (layoutMode !== "solo" || !soloPart) {
|
|
2206
|
-
return;
|
|
2207
|
-
}
|
|
2208
|
-
const node = graph.findNode(soloPart.id);
|
|
2209
|
-
if (!node && soloPart.id.length === import_echo.FQ_ID_LENGTH) {
|
|
2210
|
-
const timeout = setTimeout(async () => {
|
|
2211
|
-
const node2 = graph.findNode(soloPart.id);
|
|
2212
|
-
if (!node2) {
|
|
2213
|
-
await dispatch({
|
|
2214
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
2215
|
-
action: import_chunk_QNVEU2UD.SpaceAction.WAIT_FOR_OBJECT,
|
|
2216
|
-
data: {
|
|
2217
|
-
id: soloPart.id
|
|
2218
|
-
}
|
|
2219
|
-
});
|
|
2220
|
-
}
|
|
2221
|
-
}, WAIT_FOR_OBJECT_TIMEOUT2);
|
|
2222
|
-
return () => clearTimeout(timeout);
|
|
2223
|
-
}
|
|
2224
|
-
}));
|
|
2225
|
-
subscriptions.add(client.spaces.subscribe(async (spaces) => {
|
|
2226
|
-
if (defaultSpace.state.get() === import_echo.SpaceState.SPACE_REQUIRES_MIGRATION) {
|
|
2227
|
-
await defaultSpace.internal.migrate();
|
|
2228
|
-
}
|
|
2229
|
-
spaces.filter((space) => space.state.get() === import_echo.SpaceState.SPACE_READY).forEach((space) => {
|
|
2230
|
-
subscriptions.add((0, import_core.scheduledEffect)(() => ({
|
|
2231
|
-
name: space.properties.name
|
|
2232
|
-
}), ({ name }) => state.values.spaceNames[space.id] = name));
|
|
2233
|
-
});
|
|
2234
|
-
}).unsubscribe);
|
|
2235
|
-
subscriptions.add((0, import_core.scheduledEffect)(() => ({
|
|
2236
|
-
open: (0, import_app_framework.openIds)(location.active, layout.layoutMode === "solo" ? [
|
|
2237
|
-
"solo"
|
|
2238
|
-
] : [
|
|
2239
|
-
"main"
|
|
2240
|
-
]),
|
|
2241
|
-
closed: [
|
|
2242
|
-
...location.closed
|
|
2243
|
-
]
|
|
2244
|
-
}), ({ open, closed }) => {
|
|
2245
|
-
const send = () => {
|
|
2246
|
-
const spaces = client.spaces.get();
|
|
2247
|
-
const identity = client.halo.identity.get();
|
|
2248
|
-
if (identity && location.active) {
|
|
2249
|
-
const idsBySpace = (0, import_util.reduceGroupBy)(open, (id) => {
|
|
2250
|
-
try {
|
|
2251
|
-
const [spaceId] = (0, import_echo.parseFullyQualifiedId)(id);
|
|
2252
|
-
return spaceId;
|
|
2253
|
-
} catch {
|
|
2254
|
-
return null;
|
|
2255
|
-
}
|
|
2256
|
-
});
|
|
2257
|
-
const removedBySpace = (0, import_util.reduceGroupBy)(closed, (id) => {
|
|
2258
|
-
try {
|
|
2259
|
-
const [spaceId] = (0, import_echo.parseFullyQualifiedId)(id);
|
|
2260
|
-
return spaceId;
|
|
2261
|
-
} catch {
|
|
2262
|
-
return null;
|
|
2263
|
-
}
|
|
2264
|
-
});
|
|
2265
|
-
for (const space of spaces) {
|
|
2266
|
-
if (!idsBySpace.has(space.id)) {
|
|
2267
|
-
idsBySpace.set(space.id, []);
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
for (const [spaceId, added] of idsBySpace) {
|
|
2271
|
-
const removed = removedBySpace.get(spaceId) ?? [];
|
|
2272
|
-
const space = spaces.find((space2) => space2.id === spaceId);
|
|
2273
|
-
if (!space) {
|
|
2274
|
-
continue;
|
|
2275
|
-
}
|
|
2276
|
-
void space.postMessage("viewing", {
|
|
2277
|
-
identityKey: identity.identityKey.toHex(),
|
|
2278
|
-
attended: attention.attended ? [
|
|
2279
|
-
...attention.attended
|
|
2280
|
-
] : [],
|
|
2281
|
-
added,
|
|
2282
|
-
removed
|
|
2283
|
-
}).catch((err) => {
|
|
2284
|
-
import_log.log.warn("Failed to broadcast active node for presence.", {
|
|
2285
|
-
err: err.message
|
|
2286
|
-
}, {
|
|
2287
|
-
F: __dxlog_file6,
|
|
2288
|
-
L: 320,
|
|
2289
|
-
S: void 0,
|
|
2290
|
-
C: (f, a) => f(...a)
|
|
2291
|
-
});
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
};
|
|
2296
|
-
send();
|
|
2297
|
-
const interval = setInterval(() => send(), ACTIVE_NODE_BROADCAST_INTERVAL);
|
|
2298
|
-
return () => clearInterval(interval);
|
|
2299
|
-
}));
|
|
2300
|
-
subscriptions.add(client.spaces.subscribe((spaces) => {
|
|
2301
|
-
spaceSubscriptions.clear();
|
|
2302
|
-
spaces.forEach((space) => {
|
|
2303
|
-
spaceSubscriptions.add(space.listen("viewing", (message) => {
|
|
2304
|
-
const { added, removed, attended } = message.payload;
|
|
2305
|
-
const identityKey = import_react_client.PublicKey.safeFrom(message.payload.identityKey);
|
|
2306
|
-
const currentIdentity = client.halo.identity.get();
|
|
2307
|
-
if (identityKey && !currentIdentity?.identityKey.equals(identityKey) && Array.isArray(added) && Array.isArray(removed)) {
|
|
2308
|
-
added.forEach((id) => {
|
|
2309
|
-
if (typeof id === "string") {
|
|
2310
|
-
if (!(id in state.values.viewersByObject)) {
|
|
2311
|
-
state.values.viewersByObject[id] = new import_util.ComplexMap(import_react_client.PublicKey.hash);
|
|
2312
|
-
}
|
|
2313
|
-
state.values.viewersByObject[id].set(identityKey, {
|
|
2314
|
-
lastSeen: Date.now(),
|
|
2315
|
-
currentlyAttended: new Set(attended).has(id)
|
|
2316
|
-
});
|
|
2317
|
-
if (!state.values.viewersByIdentity.has(identityKey)) {
|
|
2318
|
-
state.values.viewersByIdentity.set(identityKey, /* @__PURE__ */ new Set());
|
|
2319
|
-
}
|
|
2320
|
-
state.values.viewersByIdentity.get(identityKey).add(id);
|
|
2321
|
-
}
|
|
2322
|
-
});
|
|
2323
|
-
removed.forEach((id) => {
|
|
2324
|
-
if (typeof id === "string") {
|
|
2325
|
-
state.values.viewersByObject[id]?.delete(identityKey);
|
|
2326
|
-
state.values.viewersByIdentity.get(identityKey)?.delete(id);
|
|
2327
|
-
}
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
2330
|
-
}));
|
|
2331
|
-
});
|
|
2332
|
-
}).unsubscribe);
|
|
2333
|
-
};
|
|
2334
|
-
const setEdgeReplicationDefault = async (client) => {
|
|
2335
|
-
try {
|
|
2336
|
-
await Promise.all(client.spaces.get().map((space) => space.internal.setEdgeReplicationPreference(import_metadata.EdgeReplicationSetting.ENABLED)));
|
|
2337
|
-
state.values.enabledEdgeReplication = true;
|
|
2338
|
-
} catch (err) {
|
|
2339
|
-
import_log.log.catch(err, void 0, {
|
|
2340
|
-
F: __dxlog_file6,
|
|
2341
|
-
L: 389,
|
|
2342
|
-
S: void 0,
|
|
2343
|
-
C: (f, a) => f(...a)
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
};
|
|
2347
|
-
return {
|
|
2348
|
-
meta: import_chunk_QNVEU2UD.meta_default,
|
|
2349
|
-
ready: async (plugins) => {
|
|
2350
|
-
settings.prop({
|
|
2351
|
-
key: "showHidden",
|
|
2352
|
-
type: import_local_storage.LocalStorageStore.bool({
|
|
2353
|
-
allowUndefined: true
|
|
2354
|
-
})
|
|
2355
|
-
});
|
|
2356
|
-
state.prop({
|
|
2357
|
-
key: "spaceNames",
|
|
2358
|
-
type: import_local_storage.LocalStorageStore.json()
|
|
2359
|
-
}).prop({
|
|
2360
|
-
key: "enabledEdgeReplication",
|
|
2361
|
-
type: import_local_storage.LocalStorageStore.bool()
|
|
2362
|
-
});
|
|
2363
|
-
if ((0, import_app_framework.findPlugin)(plugins, "dxos.org/plugin/stack")) {
|
|
2364
|
-
state.values.navigableCollections = true;
|
|
2365
|
-
}
|
|
2366
|
-
graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
2367
|
-
layoutPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseLayoutPlugin);
|
|
2368
|
-
metadataPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin);
|
|
2369
|
-
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
2370
|
-
attentionPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_attention.parseAttentionPlugin);
|
|
2371
|
-
clientPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin);
|
|
2372
|
-
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
2373
|
-
if (!clientPlugin || !intentPlugin) {
|
|
2374
|
-
return;
|
|
2375
|
-
}
|
|
2376
|
-
const client = clientPlugin.provides.client;
|
|
2377
|
-
const dispatch = intentPlugin.provides.intent.dispatch;
|
|
2378
|
-
schemas.push(...(0, import_app_framework.filterPlugins)(plugins, import_chunk_6SNOZF7Y.parseSchemaPlugin).map((plugin) => plugin.provides.echo.schema).filter(import_util.nonNullable).reduce((acc, schema) => {
|
|
2379
|
-
return [
|
|
2380
|
-
...acc,
|
|
2381
|
-
...schema
|
|
2382
|
-
];
|
|
2383
|
-
}));
|
|
2384
|
-
client.addTypes(schemas);
|
|
2385
|
-
(0, import_app_framework.filterPlugins)(plugins, import_chunk_6SNOZF7Y.parseSchemaPlugin).forEach((plugin) => {
|
|
2386
|
-
if (plugin.provides.echo.system) {
|
|
2387
|
-
client.addTypes(plugin.provides.echo.system);
|
|
2388
|
-
}
|
|
2389
|
-
});
|
|
2390
|
-
const handleFirstRun = async () => {
|
|
2391
|
-
const defaultSpace = client.spaces.default;
|
|
2392
|
-
defaultSpace.properties[import_chunk_6SNOZF7Y.CollectionType.typename] = (0, import_live_object.create)(import_chunk_6SNOZF7Y.CollectionType, {
|
|
2393
|
-
objects: [],
|
|
2394
|
-
views: {}
|
|
2395
|
-
});
|
|
2396
|
-
if (import_migrations.Migrations.versionProperty) {
|
|
2397
|
-
defaultSpace.properties[import_migrations.Migrations.versionProperty] = import_migrations.Migrations.targetVersion;
|
|
2398
|
-
}
|
|
2399
|
-
await onFirstRun?.({
|
|
2400
|
-
client,
|
|
2401
|
-
dispatch
|
|
2402
|
-
});
|
|
2403
|
-
};
|
|
2404
|
-
subscriptions.add(client.spaces.isReady.subscribe(async (ready) => {
|
|
2405
|
-
if (ready) {
|
|
2406
|
-
await clientPlugin?.provides.client.spaces.default.waitUntilReady();
|
|
2407
|
-
if (firstRun) {
|
|
2408
|
-
void firstRun?.wait().then(handleFirstRun);
|
|
2409
|
-
} else {
|
|
2410
|
-
await handleFirstRun();
|
|
2411
|
-
}
|
|
2412
|
-
await onSpaceReady();
|
|
2413
|
-
await setEdgeReplicationDefault(client);
|
|
2414
|
-
}
|
|
2415
|
-
}).unsubscribe);
|
|
2416
|
-
},
|
|
2417
|
-
unload: async () => {
|
|
2418
|
-
settings.close();
|
|
2419
|
-
spaceSubscriptions.clear();
|
|
2420
|
-
subscriptions.clear();
|
|
2421
|
-
graphSubscriptions.forEach((cb) => cb());
|
|
2422
|
-
graphSubscriptions.clear();
|
|
2423
|
-
},
|
|
2424
|
-
provides: {
|
|
2425
|
-
space: state.values,
|
|
2426
|
-
settings: settings.values,
|
|
2427
|
-
translations: [
|
|
2428
|
-
...translations_default,
|
|
2429
|
-
import_react2.osTranslations
|
|
2430
|
-
],
|
|
2431
|
-
complementary: {
|
|
2432
|
-
panels: [
|
|
2433
|
-
{
|
|
2434
|
-
id: "settings",
|
|
2435
|
-
label: [
|
|
2436
|
-
"open settings panel label",
|
|
2437
|
-
{
|
|
2438
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2439
|
-
}
|
|
2440
|
-
],
|
|
2441
|
-
icon: "ph--gear--regular"
|
|
2442
|
-
}
|
|
2443
|
-
]
|
|
2444
|
-
},
|
|
2445
|
-
root: () => state.values.awaiting ? /* @__PURE__ */ import_react.default.createElement(AwaitingObject, {
|
|
2446
|
-
id: state.values.awaiting
|
|
2447
|
-
}) : null,
|
|
2448
|
-
metadata: {
|
|
2449
|
-
records: {
|
|
2450
|
-
[import_chunk_6SNOZF7Y.CollectionType.typename]: {
|
|
2451
|
-
createObject: import_chunk_QNVEU2UD.CollectionAction.CREATE,
|
|
2452
|
-
placeholder: [
|
|
2453
|
-
"unnamed collection label",
|
|
2454
|
-
{
|
|
2455
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2456
|
-
}
|
|
2457
|
-
],
|
|
2458
|
-
icon: "ph--cards-three--regular",
|
|
2459
|
-
// TODO(wittjosiah): Move out of metadata.
|
|
2460
|
-
loadReferences: (collection) => (0, import_echo.loadObjectReferences)(collection, (collection2) => [
|
|
2461
|
-
...collection2.objects,
|
|
2462
|
-
...Object.values(collection2.views)
|
|
2463
|
-
])
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
},
|
|
2467
|
-
echo: {
|
|
2468
|
-
schema: [
|
|
2469
|
-
import_chunk_6SNOZF7Y.CollectionType
|
|
2470
|
-
]
|
|
2471
|
-
},
|
|
2472
|
-
surface: {
|
|
2473
|
-
component: ({ data, role, ...rest }) => {
|
|
2474
|
-
switch (role) {
|
|
2475
|
-
case "article":
|
|
2476
|
-
return (0, import_echo.isSpace)(data.object) && data.object.state.get() === import_echo.SpaceState.SPACE_READY ? /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
2477
|
-
data: {
|
|
2478
|
-
object: data.object.properties[import_chunk_6SNOZF7Y.CollectionType.typename],
|
|
2479
|
-
id: data.object.id
|
|
2480
|
-
},
|
|
2481
|
-
role,
|
|
2482
|
-
...rest
|
|
2483
|
-
}) : data.object instanceof import_chunk_6SNOZF7Y.CollectionType ? {
|
|
2484
|
-
node: /* @__PURE__ */ import_react.default.createElement(CollectionMain, {
|
|
2485
|
-
collection: data.object
|
|
2486
|
-
}),
|
|
2487
|
-
disposition: "fallback"
|
|
2488
|
-
} : null;
|
|
2489
|
-
// TODO(burdon): Add role name syntax to minimal plugin docs.
|
|
2490
|
-
case "complementary--settings":
|
|
2491
|
-
return (0, import_echo.isSpace)(data.subject) ? /* @__PURE__ */ import_react.default.createElement(SpaceSettingsPanel, {
|
|
2492
|
-
space: data.subject
|
|
2493
|
-
}) : (0, import_echo.isEchoObject)(data.subject) ? {
|
|
2494
|
-
node: /* @__PURE__ */ import_react.default.createElement(DefaultObjectSettings, {
|
|
2495
|
-
object: data.subject
|
|
2496
|
-
}),
|
|
2497
|
-
disposition: "fallback"
|
|
2498
|
-
} : null;
|
|
2499
|
-
case "dialog":
|
|
2500
|
-
if (data.component === "dxos.org/plugin/space/SpaceSettingsDialog") {
|
|
2501
|
-
return /* @__PURE__ */ import_react.default.createElement(SpaceSettingsDialog, {
|
|
2502
|
-
...data.subject,
|
|
2503
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
2504
|
-
});
|
|
2505
|
-
} else if (data.component === "dxos.org/plugin/space/JoinDialog") {
|
|
2506
|
-
return /* @__PURE__ */ import_react.default.createElement(JoinDialog, data.subject);
|
|
2507
|
-
} else if (data.component === "dxos.org/plugin/space/CreateSpaceDialog") {
|
|
2508
|
-
return /* @__PURE__ */ import_react.default.createElement(CreateSpaceDialog, null);
|
|
2509
|
-
} else if (data.component === "dxos.org/plugin/space/CreateObjectDialog") {
|
|
2510
|
-
return /* @__PURE__ */ import_react.default.createElement(CreateObjectDialog, {
|
|
2511
|
-
...data.subject,
|
|
2512
|
-
schemas,
|
|
2513
|
-
navigableCollections: state.values.navigableCollections,
|
|
2514
|
-
resolve: metadataPlugin?.provides.metadata.resolver
|
|
2515
|
-
});
|
|
2516
|
-
}
|
|
2517
|
-
return null;
|
|
2518
|
-
case "popover": {
|
|
2519
|
-
if (data.component === "dxos.org/plugin/space/RenameSpacePopover" && (0, import_echo.isSpace)(data.subject)) {
|
|
2520
|
-
return /* @__PURE__ */ import_react.default.createElement(PopoverRenameSpace, {
|
|
2521
|
-
space: data.subject
|
|
2522
|
-
});
|
|
2523
|
-
}
|
|
2524
|
-
if (data.component === "dxos.org/plugin/space/RenameObjectPopover" && (0, import_live_object.isReactiveObject)(data.subject)) {
|
|
2525
|
-
return /* @__PURE__ */ import_react.default.createElement(PopoverRenameObject, {
|
|
2526
|
-
object: data.subject
|
|
2527
|
-
});
|
|
2528
|
-
}
|
|
2529
|
-
return null;
|
|
2530
|
-
}
|
|
2531
|
-
case "navtree-item-end": {
|
|
2532
|
-
return (0, import_live_object.isReactiveObject)(data.object) ? /* @__PURE__ */ import_react.default.createElement(SmallPresenceLive, {
|
|
2533
|
-
id: data.id,
|
|
2534
|
-
viewers: state.values.viewersByObject[(0, import_echo.fullyQualifiedId)(data.object)]
|
|
2535
|
-
}) : (0, import_echo.isSpace)(data.object) ? /* @__PURE__ */ import_react.default.createElement(InlineSyncStatus, {
|
|
2536
|
-
space: data.object
|
|
2537
|
-
}) : (
|
|
2538
|
-
// TODO(wittjosiah): Attention glyph for non-echo items should be handled elsewhere.
|
|
2539
|
-
/* @__PURE__ */ import_react.default.createElement(SmallPresence, {
|
|
2540
|
-
id: data.id,
|
|
2541
|
-
count: 0
|
|
2542
|
-
})
|
|
2543
|
-
);
|
|
2544
|
-
}
|
|
2545
|
-
case "navbar-end": {
|
|
2546
|
-
if (!(0, import_echo.isEchoObject)(data.object) && !(0, import_echo.isSpace)(data.object)) {
|
|
2547
|
-
return null;
|
|
2548
|
-
}
|
|
2549
|
-
const space = (0, import_echo.isSpace)(data.object) ? data.object : (0, import_echo.getSpace)(data.object);
|
|
2550
|
-
const object = (0, import_echo.isSpace)(data.object) ? data.object.state.get() === import_echo.SpaceState.SPACE_READY ? space?.properties[import_chunk_6SNOZF7Y.CollectionType.typename] : void 0 : data.object;
|
|
2551
|
-
return space && object ? {
|
|
2552
|
-
node: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(SpacePresence, {
|
|
2553
|
-
object
|
|
2554
|
-
}), space.properties[COMPOSER_SPACE_LOCK] ? null : /* @__PURE__ */ import_react.default.createElement(ShareSpaceButton, {
|
|
2555
|
-
space
|
|
2556
|
-
})),
|
|
2557
|
-
disposition: "hoist"
|
|
2558
|
-
} : null;
|
|
2559
|
-
}
|
|
2560
|
-
case "section":
|
|
2561
|
-
return data.object instanceof import_chunk_6SNOZF7Y.CollectionType ? /* @__PURE__ */ import_react.default.createElement(CollectionSection, {
|
|
2562
|
-
collection: data.object
|
|
2563
|
-
}) : null;
|
|
2564
|
-
case "settings":
|
|
2565
|
-
return data.plugin === import_chunk_QNVEU2UD.meta_default.id ? /* @__PURE__ */ import_react.default.createElement(SpacePluginSettings, {
|
|
2566
|
-
settings: settings.values
|
|
2567
|
-
}) : null;
|
|
2568
|
-
case "menu-footer":
|
|
2569
|
-
if ((0, import_echo.isEchoObject)(data.object)) {
|
|
2570
|
-
return /* @__PURE__ */ import_react.default.createElement(MenuFooter, {
|
|
2571
|
-
object: data.object
|
|
2572
|
-
});
|
|
2573
|
-
} else {
|
|
2574
|
-
return null;
|
|
2575
|
-
}
|
|
2576
|
-
case "status": {
|
|
2577
|
-
return /* @__PURE__ */ import_react.default.createElement(SyncStatus, null);
|
|
2578
|
-
}
|
|
2579
|
-
default:
|
|
2580
|
-
return null;
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
},
|
|
2584
|
-
graph: {
|
|
2585
|
-
builder: (plugins) => {
|
|
2586
|
-
const clientPlugin2 = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin);
|
|
2587
|
-
const metadataPlugin2 = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin);
|
|
2588
|
-
const graphPlugin2 = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
2589
|
-
const client = clientPlugin2?.provides.client;
|
|
2590
|
-
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
2591
|
-
const resolve = metadataPlugin2?.provides.metadata.resolver;
|
|
2592
|
-
const graph = graphPlugin2?.provides.graph;
|
|
2593
|
-
if (!client || !dispatch || !resolve || !graph) {
|
|
2594
|
-
return [];
|
|
2595
|
-
}
|
|
2596
|
-
const spacesNode = {
|
|
2597
|
-
id: SPACES,
|
|
2598
|
-
type: SPACES,
|
|
2599
|
-
cacheable: [
|
|
2600
|
-
"label",
|
|
2601
|
-
"role"
|
|
2602
|
-
],
|
|
2603
|
-
properties: {
|
|
2604
|
-
label: [
|
|
2605
|
-
"spaces label",
|
|
2606
|
-
{
|
|
2607
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2608
|
-
}
|
|
2609
|
-
],
|
|
2610
|
-
testId: "spacePlugin.spaces",
|
|
2611
|
-
role: "branch",
|
|
2612
|
-
disabled: true,
|
|
2613
|
-
childrenPersistenceClass: "echo",
|
|
2614
|
-
onRearrangeChildren: async (nextOrder) => {
|
|
2615
|
-
graph._sortEdges(SPACES, "outbound", nextOrder.map(({ id }) => id));
|
|
2616
|
-
const { objects: [spacesOrder] } = await client.spaces.default.db.query(import_echo.Filter.schema(import_echo.Expando, {
|
|
2617
|
-
key: SHARED
|
|
2618
|
-
})).run();
|
|
2619
|
-
if (spacesOrder) {
|
|
2620
|
-
spacesOrder.order = nextOrder.map(({ id }) => id);
|
|
2621
|
-
} else {
|
|
2622
|
-
import_log.log.warn("spaces order object not found", void 0, {
|
|
2623
|
-
F: __dxlog_file6,
|
|
2624
|
-
L: 649,
|
|
2625
|
-
S: void 0,
|
|
2626
|
-
C: (f, a) => f(...a)
|
|
2627
|
-
});
|
|
2628
|
-
}
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
};
|
|
2632
|
-
return [
|
|
2633
|
-
// Create spaces group node.
|
|
2634
|
-
(0, import_plugin_graph.createExtension)({
|
|
2635
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/root`,
|
|
2636
|
-
filter: (node) => node.id === "root",
|
|
2637
|
-
connector: () => [
|
|
2638
|
-
spacesNode
|
|
2639
|
-
],
|
|
2640
|
-
resolver: ({ id }) => id === SPACES ? spacesNode : void 0
|
|
2641
|
-
}),
|
|
2642
|
-
// Create space nodes.
|
|
2643
|
-
(0, import_plugin_graph.createExtension)({
|
|
2644
|
-
id: SPACES,
|
|
2645
|
-
filter: (node) => node.id === SPACES,
|
|
2646
|
-
actions: () => [
|
|
2647
|
-
{
|
|
2648
|
-
id: import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_SPACE,
|
|
2649
|
-
data: async () => {
|
|
2650
|
-
await dispatch({
|
|
2651
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
2652
|
-
action: import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_SPACE
|
|
2653
|
-
});
|
|
2654
|
-
},
|
|
2655
|
-
properties: {
|
|
2656
|
-
label: [
|
|
2657
|
-
"create space label",
|
|
2658
|
-
{
|
|
2659
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2660
|
-
}
|
|
2661
|
-
],
|
|
2662
|
-
icon: "ph--plus--regular",
|
|
2663
|
-
testId: "spacePlugin.createSpace",
|
|
2664
|
-
disposition: "item",
|
|
2665
|
-
className: "border-t border-separator"
|
|
2666
|
-
}
|
|
2667
|
-
},
|
|
2668
|
-
{
|
|
2669
|
-
id: import_chunk_QNVEU2UD.SpaceAction.JOIN,
|
|
2670
|
-
data: async () => {
|
|
2671
|
-
await dispatch({
|
|
2672
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
2673
|
-
action: import_chunk_QNVEU2UD.SpaceAction.JOIN
|
|
2674
|
-
});
|
|
2675
|
-
},
|
|
2676
|
-
properties: {
|
|
2677
|
-
label: [
|
|
2678
|
-
"join space label",
|
|
2679
|
-
{
|
|
2680
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2681
|
-
}
|
|
2682
|
-
],
|
|
2683
|
-
icon: "ph--sign-in--regular",
|
|
2684
|
-
testId: "spacePlugin.joinSpace",
|
|
2685
|
-
disposition: "item"
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
],
|
|
2689
|
-
connector: () => {
|
|
2690
|
-
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2691
|
-
const isReady = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.isReady.subscribe(() => onChange()).unsubscribe, () => client.spaces.isReady.get());
|
|
2692
|
-
if (!spaces || !isReady) {
|
|
2693
|
-
return;
|
|
2694
|
-
}
|
|
2695
|
-
try {
|
|
2696
|
-
const [spacesOrder] = memoizeQuery(client.spaces.default, import_echo.Filter.schema(import_echo.Expando, {
|
|
2697
|
-
key: SHARED
|
|
2698
|
-
}));
|
|
2699
|
-
const order = spacesOrder?.order ?? [];
|
|
2700
|
-
const orderMap = new Map(order.map((id, index) => [
|
|
2701
|
-
id,
|
|
2702
|
-
index
|
|
2703
|
-
]));
|
|
2704
|
-
return [
|
|
2705
|
-
...spaces.filter((space) => orderMap.has(space.id)).sort((a, b) => orderMap.get(a.id) - orderMap.get(b.id)),
|
|
2706
|
-
...spaces.filter((space) => !orderMap.has(space.id))
|
|
2707
|
-
].filter((space) => settings.values.showHidden ? true : space.state.get() !== import_echo.SpaceState.SPACE_INACTIVE).map((space) => constructSpaceNode({
|
|
2708
|
-
space,
|
|
2709
|
-
navigable: state.values.navigableCollections,
|
|
2710
|
-
personal: space === client.spaces.default,
|
|
2711
|
-
namesCache: state.values.spaceNames,
|
|
2712
|
-
resolve
|
|
2713
|
-
}));
|
|
2714
|
-
} catch {
|
|
2715
|
-
}
|
|
2716
|
-
},
|
|
2717
|
-
resolver: ({ id }) => {
|
|
2718
|
-
if (id.length !== import_echo.SPACE_ID_LENGTH) {
|
|
2719
|
-
return;
|
|
2720
|
-
}
|
|
2721
|
-
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2722
|
-
const isReady = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.isReady.subscribe(() => onChange()).unsubscribe, () => client.spaces.isReady.get());
|
|
2723
|
-
if (!spaces || !isReady) {
|
|
2724
|
-
return;
|
|
2725
|
-
}
|
|
2726
|
-
const space = spaces.find((space2) => space2.id === id);
|
|
2727
|
-
if (!space) {
|
|
2728
|
-
return;
|
|
2729
|
-
}
|
|
2730
|
-
if (space.state.get() === import_echo.SpaceState.SPACE_INACTIVE) {
|
|
2731
|
-
return false;
|
|
2732
|
-
} else {
|
|
2733
|
-
return constructSpaceNode({
|
|
2734
|
-
space,
|
|
2735
|
-
navigable: state.values.navigableCollections,
|
|
2736
|
-
personal: space === client.spaces.default,
|
|
2737
|
-
namesCache: state.values.spaceNames,
|
|
2738
|
-
resolve
|
|
2739
|
-
});
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
}),
|
|
2743
|
-
// Create space actions.
|
|
2744
|
-
(0, import_plugin_graph.createExtension)({
|
|
2745
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/actions`,
|
|
2746
|
-
filter: (node) => (0, import_echo.isSpace)(node.data),
|
|
2747
|
-
actions: ({ node }) => {
|
|
2748
|
-
const space = node.data;
|
|
2749
|
-
return constructSpaceActions({
|
|
2750
|
-
space,
|
|
2751
|
-
dispatch,
|
|
2752
|
-
personal: space === client.spaces.default,
|
|
2753
|
-
migrating: state.values.sdkMigrationRunning[space.id]
|
|
2754
|
-
});
|
|
2755
|
-
}
|
|
2756
|
-
}),
|
|
2757
|
-
// Create nodes for objects in the root collection of a space.
|
|
2758
|
-
(0, import_plugin_graph.createExtension)({
|
|
2759
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/root-collection`,
|
|
2760
|
-
filter: (node) => (0, import_echo.isSpace)(node.data),
|
|
2761
|
-
connector: ({ node }) => {
|
|
2762
|
-
const space = node.data;
|
|
2763
|
-
const spaceState = (0, import_plugin_graph.toSignal)((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2764
|
-
if (spaceState !== import_echo.SpaceState.SPACE_READY) {
|
|
2765
|
-
return;
|
|
2766
|
-
}
|
|
2767
|
-
const collection = space.properties[import_chunk_6SNOZF7Y.CollectionType.typename];
|
|
2768
|
-
if (!collection) {
|
|
2769
|
-
return;
|
|
2770
|
-
}
|
|
2771
|
-
return collection.objects.filter(import_util.nonNullable).map((object) => createObjectNode({
|
|
2772
|
-
object,
|
|
2773
|
-
space,
|
|
2774
|
-
resolve,
|
|
2775
|
-
navigable: state.values.navigableCollections
|
|
2776
|
-
})).filter(import_util.nonNullable);
|
|
2777
|
-
}
|
|
2778
|
-
}),
|
|
2779
|
-
// Create nodes for objects in a collection or by its fully qualified id.
|
|
2780
|
-
(0, import_plugin_graph.createExtension)({
|
|
2781
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/objects`,
|
|
2782
|
-
filter: (node) => node.data instanceof import_chunk_6SNOZF7Y.CollectionType,
|
|
2783
|
-
connector: ({ node }) => {
|
|
2784
|
-
const collection = node.data;
|
|
2785
|
-
const space = (0, import_echo.getSpace)(collection);
|
|
2786
|
-
if (!space) {
|
|
2787
|
-
return;
|
|
2788
|
-
}
|
|
2789
|
-
return collection.objects.filter(import_util.nonNullable).map((object) => createObjectNode({
|
|
2790
|
-
object,
|
|
2791
|
-
space,
|
|
2792
|
-
resolve,
|
|
2793
|
-
navigable: state.values.navigableCollections
|
|
2794
|
-
})).filter(import_util.nonNullable);
|
|
2795
|
-
},
|
|
2796
|
-
resolver: ({ id }) => {
|
|
2797
|
-
if (id.length !== import_echo.FQ_ID_LENGTH) {
|
|
2798
|
-
return;
|
|
2799
|
-
}
|
|
2800
|
-
const [spaceId, objectId] = id.split(":");
|
|
2801
|
-
if (spaceId.length !== import_echo.SPACE_ID_LENGTH && objectId.length !== import_echo.OBJECT_ID_LENGTH) {
|
|
2802
|
-
return;
|
|
2803
|
-
}
|
|
2804
|
-
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
2805
|
-
if (!space) {
|
|
2806
|
-
return;
|
|
2807
|
-
}
|
|
2808
|
-
const spaceState = (0, import_plugin_graph.toSignal)((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
2809
|
-
if (spaceState !== import_echo.SpaceState.SPACE_READY) {
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2812
|
-
const store = (0, import_plugin_graph.memoize)(() => (0, import_signals_core.signal)(space.db.getObjectById(objectId)), id);
|
|
2813
|
-
(0, import_plugin_graph.memoize)(() => {
|
|
2814
|
-
if (!store.value) {
|
|
2815
|
-
void space.db.query({
|
|
2816
|
-
id: objectId
|
|
2817
|
-
}).first().then((o) => store.value = o).catch((err) => import_log.log.catch(err, {
|
|
2818
|
-
objectId
|
|
2819
|
-
}, {
|
|
2820
|
-
F: __dxlog_file6,
|
|
2821
|
-
L: 872,
|
|
2822
|
-
S: void 0,
|
|
2823
|
-
C: (f, a) => f(...a)
|
|
2824
|
-
}));
|
|
2825
|
-
}
|
|
2826
|
-
}, id);
|
|
2827
|
-
const object = store.value;
|
|
2828
|
-
if (!object) {
|
|
2829
|
-
return;
|
|
2830
|
-
}
|
|
2831
|
-
if ((0, import_live_object.isDeleted)(object)) {
|
|
2832
|
-
return false;
|
|
2833
|
-
} else {
|
|
2834
|
-
return createObjectNode({
|
|
2835
|
-
object,
|
|
2836
|
-
space,
|
|
2837
|
-
resolve,
|
|
2838
|
-
navigable: state.values.navigableCollections
|
|
2839
|
-
});
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
}),
|
|
2843
|
-
// Create collection actions and action groups.
|
|
2844
|
-
(0, import_plugin_graph.createExtension)({
|
|
2845
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/object-actions`,
|
|
2846
|
-
filter: (node) => (0, import_echo.isEchoObject)(node.data),
|
|
2847
|
-
actions: ({ node }) => constructObjectActions({
|
|
2848
|
-
node,
|
|
2849
|
-
dispatch
|
|
2850
|
-
})
|
|
2851
|
-
}),
|
|
2852
|
-
// Create nodes for object settings.
|
|
2853
|
-
(0, import_plugin_graph.createExtension)({
|
|
2854
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/settings-for-subject`,
|
|
2855
|
-
resolver: ({ id }) => {
|
|
2856
|
-
if (!id.endsWith("~settings")) {
|
|
2857
|
-
return;
|
|
2858
|
-
}
|
|
2859
|
-
const type = "orphan-settings-for-subject";
|
|
2860
|
-
const icon = "ph--gear--regular";
|
|
2861
|
-
const [subjectId] = id.split("~");
|
|
2862
|
-
const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
|
|
2863
|
-
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
2864
|
-
const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === import_echo.SpaceState.SPACE_READY);
|
|
2865
|
-
if (!objectId) {
|
|
2866
|
-
const label2 = space ? space.properties.name || [
|
|
2867
|
-
"unnamed space label",
|
|
2868
|
-
{
|
|
2869
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2870
|
-
}
|
|
2871
|
-
] : [
|
|
2872
|
-
"unnamed object settings label",
|
|
2873
|
-
{
|
|
2874
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2875
|
-
}
|
|
2876
|
-
];
|
|
2877
|
-
return {
|
|
2878
|
-
id,
|
|
2879
|
-
type,
|
|
2880
|
-
data: null,
|
|
2881
|
-
properties: {
|
|
2882
|
-
icon,
|
|
2883
|
-
label: label2,
|
|
2884
|
-
showResolvedThreads: false,
|
|
2885
|
-
object: null,
|
|
2886
|
-
space
|
|
2887
|
-
}
|
|
2888
|
-
};
|
|
2889
|
-
}
|
|
2890
|
-
const [object] = memoizeQuery(space, {
|
|
2891
|
-
id: objectId
|
|
2892
|
-
});
|
|
2893
|
-
if (!object || !subjectId) {
|
|
2894
|
-
return;
|
|
2895
|
-
}
|
|
2896
|
-
const meta = resolve((0, import_echo.getTypename)(object) ?? "");
|
|
2897
|
-
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
2898
|
-
"unnamed object settings label",
|
|
2899
|
-
{
|
|
2900
|
-
ns: import_chunk_QNVEU2UD.SPACE_PLUGIN
|
|
2901
|
-
}
|
|
2902
|
-
];
|
|
2903
|
-
return {
|
|
2904
|
-
id,
|
|
2905
|
-
type,
|
|
2906
|
-
data: null,
|
|
2907
|
-
properties: {
|
|
2908
|
-
icon,
|
|
2909
|
-
label,
|
|
2910
|
-
object
|
|
2911
|
-
}
|
|
2912
|
-
};
|
|
2913
|
-
}
|
|
2914
|
-
})
|
|
2915
|
-
];
|
|
2916
|
-
},
|
|
2917
|
-
serializer: (plugins) => {
|
|
2918
|
-
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
2919
|
-
if (!dispatch) {
|
|
2920
|
-
return [];
|
|
2921
|
-
}
|
|
2922
|
-
return [
|
|
2923
|
-
{
|
|
2924
|
-
inputType: SPACES,
|
|
2925
|
-
outputType: DIRECTORY_TYPE,
|
|
2926
|
-
serialize: (node) => ({
|
|
2927
|
-
name: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["spaces label"],
|
|
2928
|
-
data: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["spaces label"],
|
|
2929
|
-
type: DIRECTORY_TYPE
|
|
2930
|
-
}),
|
|
2931
|
-
deserialize: () => {
|
|
2932
|
-
}
|
|
2933
|
-
},
|
|
2934
|
-
{
|
|
2935
|
-
inputType: SPACE_TYPE,
|
|
2936
|
-
outputType: DIRECTORY_TYPE,
|
|
2937
|
-
serialize: (node) => ({
|
|
2938
|
-
name: node.data.properties.name ?? translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["unnamed space label"],
|
|
2939
|
-
data: node.data.properties.name ?? translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["unnamed space label"],
|
|
2940
|
-
type: DIRECTORY_TYPE
|
|
2941
|
-
}),
|
|
2942
|
-
deserialize: async (data) => {
|
|
2943
|
-
const result = await dispatch({
|
|
2944
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
2945
|
-
action: import_chunk_QNVEU2UD.SpaceAction.CREATE,
|
|
2946
|
-
data: {
|
|
2947
|
-
name: data.name
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
return result?.data.space;
|
|
2951
|
-
}
|
|
2952
|
-
},
|
|
2953
|
-
{
|
|
2954
|
-
inputType: import_chunk_6SNOZF7Y.CollectionType.typename,
|
|
2955
|
-
outputType: DIRECTORY_TYPE,
|
|
2956
|
-
serialize: (node) => ({
|
|
2957
|
-
name: node.data.name ?? translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["unnamed collection label"],
|
|
2958
|
-
data: node.data.name ?? translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["unnamed collection label"],
|
|
2959
|
-
type: DIRECTORY_TYPE
|
|
2960
|
-
}),
|
|
2961
|
-
deserialize: async (data, ancestors) => {
|
|
2962
|
-
const space = ancestors.find(import_echo.isSpace);
|
|
2963
|
-
const collection = ancestors.findLast((ancestor) => ancestor instanceof import_chunk_6SNOZF7Y.CollectionType) ?? space?.properties[import_chunk_6SNOZF7Y.CollectionType.typename];
|
|
2964
|
-
if (!space || !collection) {
|
|
2965
|
-
return;
|
|
2966
|
-
}
|
|
2967
|
-
const result = await dispatch({
|
|
2968
|
-
plugin: import_chunk_QNVEU2UD.SPACE_PLUGIN,
|
|
2969
|
-
action: import_chunk_QNVEU2UD.SpaceAction.ADD_OBJECT,
|
|
2970
|
-
data: {
|
|
2971
|
-
target: collection,
|
|
2972
|
-
object: (0, import_live_object.create)(import_chunk_6SNOZF7Y.CollectionType, {
|
|
2973
|
-
name: data.name,
|
|
2974
|
-
objects: [],
|
|
2975
|
-
views: {}
|
|
2976
|
-
})
|
|
2977
|
-
}
|
|
2978
|
-
});
|
|
2979
|
-
return result?.data.object;
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
];
|
|
2983
|
-
}
|
|
2984
|
-
},
|
|
2985
|
-
intent: {
|
|
2986
|
-
resolver: async (intent, plugins) => {
|
|
2987
|
-
const clientPlugin2 = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin);
|
|
2988
|
-
const client = clientPlugin2?.provides.client;
|
|
2989
|
-
switch (intent.action) {
|
|
2990
|
-
case import_chunk_QNVEU2UD.SpaceAction.WAIT_FOR_OBJECT: {
|
|
2991
|
-
state.values.awaiting = intent.data?.id;
|
|
2992
|
-
return {
|
|
2993
|
-
data: true
|
|
2994
|
-
};
|
|
2995
|
-
}
|
|
2996
|
-
case import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_SPACE: {
|
|
2997
|
-
return {
|
|
2998
|
-
data: true,
|
|
2999
|
-
intents: [
|
|
3000
|
-
[
|
|
3001
|
-
{
|
|
3002
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3003
|
-
data: {
|
|
3004
|
-
element: "dialog",
|
|
3005
|
-
component: "dxos.org/plugin/space/CreateSpaceDialog",
|
|
3006
|
-
dialogBlockAlign: "start",
|
|
3007
|
-
subject: intent.data
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
]
|
|
3011
|
-
]
|
|
3012
|
-
};
|
|
3013
|
-
}
|
|
3014
|
-
case import_chunk_QNVEU2UD.SpaceAction.CREATE: {
|
|
3015
|
-
if (!client || !import_echo_schema.S.is(import_chunk_6SNOZF7Y.SpaceForm)(intent.data)) {
|
|
3016
|
-
return;
|
|
3017
|
-
}
|
|
3018
|
-
const space = await client.spaces.create({
|
|
3019
|
-
name: intent.data.name
|
|
3020
|
-
});
|
|
3021
|
-
if (intent.data.edgeReplication) {
|
|
3022
|
-
await space.internal.setEdgeReplicationPreference(import_metadata.EdgeReplicationSetting.ENABLED);
|
|
3023
|
-
}
|
|
3024
|
-
await space.waitUntilReady();
|
|
3025
|
-
const collection = (0, import_live_object.create)(import_chunk_6SNOZF7Y.CollectionType, {
|
|
3026
|
-
objects: [],
|
|
3027
|
-
views: {}
|
|
3028
|
-
});
|
|
3029
|
-
space.properties[import_chunk_6SNOZF7Y.CollectionType.typename] = collection;
|
|
3030
|
-
if (import_migrations.Migrations.versionProperty) {
|
|
3031
|
-
space.properties[import_migrations.Migrations.versionProperty] = import_migrations.Migrations.targetVersion;
|
|
3032
|
-
}
|
|
3033
|
-
return {
|
|
3034
|
-
data: {
|
|
3035
|
-
space,
|
|
3036
|
-
id: space.id,
|
|
3037
|
-
activeParts: {
|
|
3038
|
-
main: [
|
|
3039
|
-
space.id
|
|
3040
|
-
]
|
|
3041
|
-
}
|
|
3042
|
-
},
|
|
3043
|
-
intents: [
|
|
3044
|
-
[
|
|
3045
|
-
{
|
|
3046
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3047
|
-
data: {
|
|
3048
|
-
name: "space.create",
|
|
3049
|
-
properties: {
|
|
3050
|
-
spaceId: space.id
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
]
|
|
3055
|
-
]
|
|
3056
|
-
};
|
|
3057
|
-
}
|
|
3058
|
-
case import_chunk_QNVEU2UD.SpaceAction.JOIN: {
|
|
3059
|
-
return {
|
|
3060
|
-
data: true,
|
|
3061
|
-
intents: [
|
|
3062
|
-
[
|
|
3063
|
-
{
|
|
3064
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3065
|
-
data: {
|
|
3066
|
-
element: "dialog",
|
|
3067
|
-
component: "dxos.org/plugin/space/JoinDialog",
|
|
3068
|
-
dialogBlockAlign: "start",
|
|
3069
|
-
subject: {
|
|
3070
|
-
initialInvitationCode: intent.data?.invitationCode,
|
|
3071
|
-
onDone: intent.data?.onDone
|
|
3072
|
-
}
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
]
|
|
3076
|
-
]
|
|
3077
|
-
};
|
|
3078
|
-
}
|
|
3079
|
-
case import_chunk_QNVEU2UD.SpaceAction.SHARE: {
|
|
3080
|
-
const space = intent.data?.space;
|
|
3081
|
-
if ((0, import_echo.isSpace)(space) && !space.properties[COMPOSER_SPACE_LOCK]) {
|
|
3082
|
-
const active = navigationPlugin?.provides.location.active;
|
|
3083
|
-
const mode = layoutPlugin?.provides.layout.layoutMode;
|
|
3084
|
-
const current = active ? (0, import_app_framework.firstIdInPart)(active, mode === "solo" ? "solo" : "main") : void 0;
|
|
3085
|
-
const target = current?.startsWith(space.id) ? current : void 0;
|
|
3086
|
-
return {
|
|
3087
|
-
data: true,
|
|
3088
|
-
intents: [
|
|
3089
|
-
[
|
|
3090
|
-
{
|
|
3091
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3092
|
-
data: {
|
|
3093
|
-
element: "dialog",
|
|
3094
|
-
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
3095
|
-
dialogBlockAlign: "start",
|
|
3096
|
-
subject: {
|
|
3097
|
-
space,
|
|
3098
|
-
target,
|
|
3099
|
-
initialTab: "members",
|
|
3100
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
}
|
|
3104
|
-
],
|
|
3105
|
-
[
|
|
3106
|
-
{
|
|
3107
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3108
|
-
data: {
|
|
3109
|
-
name: "space.share",
|
|
3110
|
-
properties: {
|
|
3111
|
-
space: space.id
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
]
|
|
3116
|
-
]
|
|
3117
|
-
};
|
|
3118
|
-
}
|
|
3119
|
-
break;
|
|
3120
|
-
}
|
|
3121
|
-
case import_chunk_QNVEU2UD.SpaceAction.LOCK: {
|
|
3122
|
-
const space = intent.data?.space;
|
|
3123
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3124
|
-
space.properties[COMPOSER_SPACE_LOCK] = true;
|
|
3125
|
-
return {
|
|
3126
|
-
data: true,
|
|
3127
|
-
intents: [
|
|
3128
|
-
[
|
|
3129
|
-
{
|
|
3130
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3131
|
-
data: {
|
|
3132
|
-
name: "space.lock",
|
|
3133
|
-
properties: {
|
|
3134
|
-
spaceId: space.id
|
|
3135
|
-
}
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
]
|
|
3139
|
-
]
|
|
3140
|
-
};
|
|
3141
|
-
}
|
|
3142
|
-
break;
|
|
3143
|
-
}
|
|
3144
|
-
case import_chunk_QNVEU2UD.SpaceAction.UNLOCK: {
|
|
3145
|
-
const space = intent.data?.space;
|
|
3146
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3147
|
-
space.properties[COMPOSER_SPACE_LOCK] = false;
|
|
3148
|
-
return {
|
|
3149
|
-
data: true,
|
|
3150
|
-
intents: [
|
|
3151
|
-
[
|
|
3152
|
-
{
|
|
3153
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3154
|
-
data: {
|
|
3155
|
-
name: "space.unlock",
|
|
3156
|
-
properties: {
|
|
3157
|
-
spaceId: space.id
|
|
3158
|
-
}
|
|
3159
|
-
}
|
|
3160
|
-
}
|
|
3161
|
-
]
|
|
3162
|
-
]
|
|
3163
|
-
};
|
|
3164
|
-
}
|
|
3165
|
-
break;
|
|
3166
|
-
}
|
|
3167
|
-
case import_chunk_QNVEU2UD.SpaceAction.RENAME: {
|
|
3168
|
-
const { caller, space } = intent.data ?? {};
|
|
3169
|
-
if (typeof caller === "string" && (0, import_echo.isSpace)(space)) {
|
|
3170
|
-
return {
|
|
3171
|
-
intents: [
|
|
3172
|
-
[
|
|
3173
|
-
{
|
|
3174
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3175
|
-
data: {
|
|
3176
|
-
element: "popover",
|
|
3177
|
-
anchorId: `dxos.org/ui/${caller}/${space.id}`,
|
|
3178
|
-
component: "dxos.org/plugin/space/RenameSpacePopover",
|
|
3179
|
-
subject: space
|
|
3180
|
-
}
|
|
3181
|
-
}
|
|
3182
|
-
]
|
|
3183
|
-
]
|
|
3184
|
-
};
|
|
3185
|
-
}
|
|
3186
|
-
break;
|
|
3187
|
-
}
|
|
3188
|
-
case import_chunk_QNVEU2UD.SpaceAction.OPEN_SETTINGS: {
|
|
3189
|
-
const space = intent.data?.space;
|
|
3190
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3191
|
-
return {
|
|
3192
|
-
data: true,
|
|
3193
|
-
intents: [
|
|
3194
|
-
[
|
|
3195
|
-
{
|
|
3196
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3197
|
-
data: {
|
|
3198
|
-
element: "dialog",
|
|
3199
|
-
component: "dxos.org/plugin/space/SpaceSettingsDialog",
|
|
3200
|
-
dialogBlockAlign: "start",
|
|
3201
|
-
subject: {
|
|
3202
|
-
space,
|
|
3203
|
-
initialTab: "settings",
|
|
3204
|
-
createInvitationUrl: createSpaceInvitationUrl
|
|
3205
|
-
}
|
|
3206
|
-
}
|
|
3207
|
-
}
|
|
3208
|
-
]
|
|
3209
|
-
]
|
|
3210
|
-
};
|
|
3211
|
-
}
|
|
3212
|
-
break;
|
|
3213
|
-
}
|
|
3214
|
-
case import_chunk_QNVEU2UD.SpaceAction.OPEN: {
|
|
3215
|
-
const space = intent.data?.space;
|
|
3216
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3217
|
-
await space.open();
|
|
3218
|
-
return {
|
|
3219
|
-
data: true
|
|
3220
|
-
};
|
|
3221
|
-
}
|
|
3222
|
-
break;
|
|
3223
|
-
}
|
|
3224
|
-
case import_chunk_QNVEU2UD.SpaceAction.CLOSE: {
|
|
3225
|
-
const space = intent.data?.space;
|
|
3226
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3227
|
-
await space.close();
|
|
3228
|
-
return {
|
|
3229
|
-
data: true
|
|
3230
|
-
};
|
|
3231
|
-
}
|
|
3232
|
-
break;
|
|
3233
|
-
}
|
|
3234
|
-
case import_chunk_QNVEU2UD.SpaceAction.MIGRATE: {
|
|
3235
|
-
const space = intent.data?.space;
|
|
3236
|
-
if ((0, import_echo.isSpace)(space)) {
|
|
3237
|
-
if (space.state.get() === import_echo.SpaceState.SPACE_REQUIRES_MIGRATION) {
|
|
3238
|
-
state.values.sdkMigrationRunning[space.id] = true;
|
|
3239
|
-
await space.internal.migrate();
|
|
3240
|
-
state.values.sdkMigrationRunning[space.id] = false;
|
|
3241
|
-
}
|
|
3242
|
-
const result = await import_migrations.Migrations.migrate(space, intent.data?.version);
|
|
3243
|
-
return {
|
|
3244
|
-
data: result,
|
|
3245
|
-
intents: [
|
|
3246
|
-
[
|
|
3247
|
-
{
|
|
3248
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3249
|
-
data: {
|
|
3250
|
-
name: "space.migrate",
|
|
3251
|
-
properties: {
|
|
3252
|
-
spaceId: space.id,
|
|
3253
|
-
version: intent.data?.version
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
]
|
|
3258
|
-
]
|
|
3259
|
-
};
|
|
3260
|
-
}
|
|
3261
|
-
break;
|
|
3262
|
-
}
|
|
3263
|
-
case import_chunk_QNVEU2UD.SpaceAction.OPEN_CREATE_OBJECT: {
|
|
3264
|
-
return {
|
|
3265
|
-
data: true,
|
|
3266
|
-
intents: [
|
|
3267
|
-
[
|
|
3268
|
-
{
|
|
3269
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3270
|
-
data: {
|
|
3271
|
-
element: "dialog",
|
|
3272
|
-
component: "dxos.org/plugin/space/CreateObjectDialog",
|
|
3273
|
-
dialogBlockAlign: "start",
|
|
3274
|
-
subject: intent.data
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
]
|
|
3278
|
-
]
|
|
3279
|
-
};
|
|
3280
|
-
}
|
|
3281
|
-
case import_chunk_QNVEU2UD.SpaceAction.ADD_OBJECT: {
|
|
3282
|
-
const object = intent.data?.object ?? intent.data?.result;
|
|
3283
|
-
if (!(0, import_live_object.isReactiveObject)(object)) {
|
|
3284
|
-
return;
|
|
3285
|
-
}
|
|
3286
|
-
const space = (0, import_echo.isSpace)(intent.data?.target) ? intent.data?.target : (0, import_echo.getSpace)(intent.data?.target);
|
|
3287
|
-
if (!space) {
|
|
3288
|
-
return;
|
|
3289
|
-
}
|
|
3290
|
-
if (space.db.coreDatabase.getAllObjectIds().length >= SPACE_MAX_OBJECTS) {
|
|
3291
|
-
return {
|
|
3292
|
-
data: false,
|
|
3293
|
-
intents: [
|
|
3294
|
-
[
|
|
3295
|
-
{
|
|
3296
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3297
|
-
data: {
|
|
3298
|
-
element: "toast",
|
|
3299
|
-
subject: {
|
|
3300
|
-
id: `${import_chunk_QNVEU2UD.SPACE_PLUGIN}/space-limit`,
|
|
3301
|
-
title: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["space limit label"],
|
|
3302
|
-
description: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["space limit description"],
|
|
3303
|
-
duration: 5e3,
|
|
3304
|
-
icon: "ph--warning--regular",
|
|
3305
|
-
actionLabel: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["remove deleted objects label"],
|
|
3306
|
-
actionAlt: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["remove deleted objects alt"],
|
|
3307
|
-
// TODO(wittjosiah): Use OS namespace.
|
|
3308
|
-
closeLabel: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN]["space limit close label"],
|
|
3309
|
-
onAction: () => space.db.coreDatabase.unlinkDeletedObjects()
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
],
|
|
3314
|
-
[
|
|
3315
|
-
{
|
|
3316
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3317
|
-
data: {
|
|
3318
|
-
name: "space.limit",
|
|
3319
|
-
properties: {
|
|
3320
|
-
spaceId: space.id
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
]
|
|
3325
|
-
]
|
|
3326
|
-
};
|
|
3327
|
-
}
|
|
3328
|
-
if (intent.data?.target instanceof import_chunk_6SNOZF7Y.CollectionType) {
|
|
3329
|
-
intent.data?.target.objects.push(object);
|
|
3330
|
-
} else if ((0, import_echo.isSpace)(intent.data?.target)) {
|
|
3331
|
-
const collection = space.properties[import_chunk_6SNOZF7Y.CollectionType.typename];
|
|
3332
|
-
if (collection instanceof import_chunk_6SNOZF7Y.CollectionType) {
|
|
3333
|
-
collection.objects.push(object);
|
|
3334
|
-
} else {
|
|
3335
|
-
const collection2 = (0, import_live_object.create)(import_chunk_6SNOZF7Y.CollectionType, {
|
|
3336
|
-
objects: [
|
|
3337
|
-
object
|
|
3338
|
-
],
|
|
3339
|
-
views: {}
|
|
3340
|
-
});
|
|
3341
|
-
space.properties[import_chunk_6SNOZF7Y.CollectionType.typename] = collection2;
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
|
-
return {
|
|
3345
|
-
data: {
|
|
3346
|
-
id: (0, import_echo.fullyQualifiedId)(object),
|
|
3347
|
-
object,
|
|
3348
|
-
activeParts: {
|
|
3349
|
-
main: [
|
|
3350
|
-
(0, import_echo.fullyQualifiedId)(object)
|
|
3351
|
-
]
|
|
3352
|
-
}
|
|
3353
|
-
},
|
|
3354
|
-
intents: [
|
|
3355
|
-
[
|
|
3356
|
-
{
|
|
3357
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
3358
|
-
data: {
|
|
3359
|
-
name: "space.object.add",
|
|
3360
|
-
properties: {
|
|
3361
|
-
spaceId: space.id,
|
|
3362
|
-
objectId: object.id,
|
|
3363
|
-
typename: (0, import_echo.getTypename)(object)
|
|
3364
|
-
}
|
|
3365
|
-
}
|
|
3366
|
-
}
|
|
3367
|
-
]
|
|
3368
|
-
]
|
|
3369
|
-
};
|
|
3370
|
-
}
|
|
3371
|
-
case import_chunk_QNVEU2UD.SpaceAction.REMOVE_OBJECTS: {
|
|
3372
|
-
const objects = intent.data?.objects ?? intent.data?.result;
|
|
3373
|
-
(0, import_invariant.invariant)(Array.isArray(objects), void 0, {
|
|
3374
|
-
F: __dxlog_file6,
|
|
3375
|
-
L: 1412,
|
|
3376
|
-
S: void 0,
|
|
3377
|
-
A: [
|
|
3378
|
-
"Array.isArray(objects)",
|
|
3379
|
-
""
|
|
3380
|
-
]
|
|
3381
|
-
});
|
|
3382
|
-
const space = (0, import_echo.getSpace)(objects[0]);
|
|
3383
|
-
if (!space || !objects.every((obj) => (0, import_echo.isEchoObject)(obj) && (0, import_echo.getSpace)(obj) === space)) {
|
|
3384
|
-
return;
|
|
3385
|
-
}
|
|
3386
|
-
const resolve = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
3387
|
-
const activeParts = navigationPlugin?.provides.location.active;
|
|
3388
|
-
const openObjectIds = new Set((0, import_app_framework.openIds)(activeParts ?? {}));
|
|
3389
|
-
if (!intent.undo && resolve) {
|
|
3390
|
-
const parentCollection = intent.data?.collection ?? space.properties[import_chunk_6SNOZF7Y.CollectionType.typename];
|
|
3391
|
-
const nestedObjectsList = await Promise.all(objects.map((obj) => getNestedObjects(obj, resolve)));
|
|
3392
|
-
const deletionData = {
|
|
3393
|
-
objects,
|
|
3394
|
-
parentCollection,
|
|
3395
|
-
indices: objects.map((obj) => parentCollection instanceof import_chunk_6SNOZF7Y.CollectionType ? parentCollection.objects.indexOf(obj) : -1),
|
|
3396
|
-
nestedObjectsList,
|
|
3397
|
-
wasActive: objects.flatMap((obj, i) => [
|
|
3398
|
-
obj,
|
|
3399
|
-
...nestedObjectsList[i]
|
|
3400
|
-
]).map((obj) => (0, import_echo.fullyQualifiedId)(obj)).filter((id) => openObjectIds.has(id))
|
|
3401
|
-
};
|
|
3402
|
-
if (deletionData.wasActive.length > 0) {
|
|
3403
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
3404
|
-
action: import_app_framework.NavigationAction.CLOSE,
|
|
3405
|
-
data: {
|
|
3406
|
-
activeParts: {
|
|
3407
|
-
main: deletionData.wasActive,
|
|
3408
|
-
sidebar: deletionData.wasActive
|
|
3409
|
-
}
|
|
3410
|
-
}
|
|
3411
|
-
});
|
|
3412
|
-
}
|
|
3413
|
-
if (deletionData.parentCollection instanceof import_chunk_6SNOZF7Y.CollectionType) {
|
|
3414
|
-
[
|
|
3415
|
-
...deletionData.indices
|
|
3416
|
-
].sort((a, b) => b - a).forEach((index) => {
|
|
3417
|
-
if (index !== -1) {
|
|
3418
|
-
deletionData.parentCollection.objects.splice(index, 1);
|
|
3419
|
-
}
|
|
3420
|
-
});
|
|
3421
|
-
}
|
|
3422
|
-
deletionData.nestedObjectsList.flat().forEach((obj) => {
|
|
3423
|
-
space.db.remove(obj);
|
|
3424
|
-
});
|
|
3425
|
-
objects.forEach((obj) => space.db.remove(obj));
|
|
3426
|
-
const undoMessageKey = objects.some((obj) => obj instanceof import_chunk_6SNOZF7Y.CollectionType) ? "collection deleted label" : objects.length > 1 ? "objects deleted label" : "object deleted label";
|
|
3427
|
-
return {
|
|
3428
|
-
data: true,
|
|
3429
|
-
undoable: {
|
|
3430
|
-
// TODO(ZaymonFC): Pluralize if more than one object.
|
|
3431
|
-
message: translations_default[0]["en-US"][import_chunk_QNVEU2UD.SPACE_PLUGIN][undoMessageKey],
|
|
3432
|
-
data: deletionData
|
|
3433
|
-
}
|
|
3434
|
-
};
|
|
3435
|
-
} else {
|
|
3436
|
-
const undoData = intent.data;
|
|
3437
|
-
if (undoData?.objects?.length && undoData.objects.every(import_echo.isEchoObject) && undoData.parentCollection instanceof import_chunk_6SNOZF7Y.CollectionType) {
|
|
3438
|
-
const restoredObjects = undoData.objects.map((obj) => space.db.add(obj));
|
|
3439
|
-
undoData.nestedObjectsList.flat().forEach((obj) => {
|
|
3440
|
-
space.db.add(obj);
|
|
3441
|
-
});
|
|
3442
|
-
undoData.indices.forEach((index, i) => {
|
|
3443
|
-
if (index !== -1) {
|
|
3444
|
-
undoData.parentCollection.objects.splice(index, 0, restoredObjects[i]);
|
|
3445
|
-
}
|
|
3446
|
-
});
|
|
3447
|
-
if (undoData.wasActive.length > 0) {
|
|
3448
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
3449
|
-
action: import_app_framework.NavigationAction.OPEN,
|
|
3450
|
-
data: {
|
|
3451
|
-
activeParts: {
|
|
3452
|
-
main: undoData.wasActive
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
});
|
|
3456
|
-
}
|
|
3457
|
-
return {
|
|
3458
|
-
data: true
|
|
3459
|
-
};
|
|
3460
|
-
}
|
|
3461
|
-
return {
|
|
3462
|
-
data: false
|
|
3463
|
-
};
|
|
3464
|
-
}
|
|
3465
|
-
}
|
|
3466
|
-
case import_chunk_QNVEU2UD.SpaceAction.RENAME_OBJECT: {
|
|
3467
|
-
const object = intent.data?.object ?? intent.data?.result;
|
|
3468
|
-
const caller = intent.data?.caller;
|
|
3469
|
-
if ((0, import_live_object.isReactiveObject)(object) && caller) {
|
|
3470
|
-
return {
|
|
3471
|
-
intents: [
|
|
3472
|
-
[
|
|
3473
|
-
{
|
|
3474
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
3475
|
-
data: {
|
|
3476
|
-
element: "popover",
|
|
3477
|
-
anchorId: `dxos.org/ui/${caller}/${(0, import_echo.fullyQualifiedId)(object)}`,
|
|
3478
|
-
component: "dxos.org/plugin/space/RenameObjectPopover",
|
|
3479
|
-
subject: object
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
]
|
|
3483
|
-
]
|
|
3484
|
-
};
|
|
3485
|
-
}
|
|
3486
|
-
break;
|
|
3487
|
-
}
|
|
3488
|
-
case import_chunk_QNVEU2UD.SpaceAction.DUPLICATE_OBJECT: {
|
|
3489
|
-
const originalObject = intent.data?.object ?? intent.data?.result;
|
|
3490
|
-
const resolve = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
3491
|
-
const space = (0, import_echo.isSpace)(intent.data?.target) ? intent.data?.target : (0, import_echo.getSpace)(intent.data?.target);
|
|
3492
|
-
if (!(0, import_echo.isEchoObject)(originalObject) || !resolve || !space) {
|
|
3493
|
-
return;
|
|
3494
|
-
}
|
|
3495
|
-
const newObject = await cloneObject(originalObject, resolve, space);
|
|
3496
|
-
return {
|
|
3497
|
-
intents: [
|
|
3498
|
-
[
|
|
3499
|
-
{
|
|
3500
|
-
action: import_chunk_QNVEU2UD.SpaceAction.ADD_OBJECT,
|
|
3501
|
-
data: {
|
|
3502
|
-
object: newObject,
|
|
3503
|
-
target: intent.data?.target
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
]
|
|
3507
|
-
]
|
|
3508
|
-
};
|
|
3509
|
-
}
|
|
3510
|
-
case import_chunk_QNVEU2UD.SpaceAction.TOGGLE_HIDDEN: {
|
|
3511
|
-
settings.values.showHidden = intent.data?.state ?? !settings.values.showHidden;
|
|
3512
|
-
return {
|
|
3513
|
-
data: true
|
|
3514
|
-
};
|
|
3515
|
-
}
|
|
3516
|
-
case import_chunk_QNVEU2UD.CollectionAction.CREATE: {
|
|
3517
|
-
const collection = (0, import_live_object.create)(import_chunk_6SNOZF7Y.CollectionType, {
|
|
3518
|
-
name: intent.data?.name,
|
|
3519
|
-
objects: [],
|
|
3520
|
-
views: {}
|
|
3521
|
-
});
|
|
3522
|
-
return {
|
|
3523
|
-
data: collection
|
|
3524
|
-
};
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
};
|
|
3531
207
|
};
|
|
3532
|
-
var src_default = SpacePlugin;
|
|
3533
208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3534
209
|
0 && (module.exports = {
|
|
3535
|
-
|
|
210
|
+
AdvancedObjectSettings,
|
|
3536
211
|
AwaitingObject,
|
|
212
|
+
BaseObjectSettings,
|
|
3537
213
|
COMPOSER_SPACE_LOCK,
|
|
3538
|
-
|
|
3539
|
-
|
|
214
|
+
CREATE_OBJECT_DIALOG,
|
|
215
|
+
CREATE_SPACE_DIALOG,
|
|
3540
216
|
CollectionMain,
|
|
3541
217
|
CollectionSection,
|
|
3542
|
-
CollectionType,
|
|
3543
|
-
ContactType,
|
|
3544
218
|
CreateObjectDialog,
|
|
3545
219
|
CreateSpaceDialog,
|
|
3546
|
-
DefaultObjectSettings,
|
|
3547
220
|
FullPresence,
|
|
3548
221
|
InlineSyncStatus,
|
|
3549
|
-
|
|
222
|
+
JOIN_DIALOG,
|
|
3550
223
|
JoinDialog,
|
|
3551
224
|
MenuFooter,
|
|
3552
|
-
|
|
3553
|
-
|
|
225
|
+
POPOVER_RENAME_OBJECT,
|
|
226
|
+
POPOVER_RENAME_SPACE,
|
|
3554
227
|
PersistenceStatus,
|
|
3555
228
|
PopoverRenameObject,
|
|
3556
229
|
PopoverRenameSpace,
|
|
3557
230
|
SHARED,
|
|
3558
231
|
SPACES,
|
|
3559
|
-
SPACE_DIRECTORY_HANDLE,
|
|
3560
232
|
SPACE_PLUGIN,
|
|
3561
|
-
|
|
233
|
+
SPACE_SETTINGS_DIALOG,
|
|
3562
234
|
SPACE_TYPE,
|
|
3563
235
|
ShareSpaceButton,
|
|
3564
236
|
ShareSpaceButtonImpl,
|
|
3565
237
|
SmallPresence,
|
|
3566
238
|
SmallPresenceLive,
|
|
3567
|
-
|
|
3568
|
-
|
|
239
|
+
SpaceCapabilities,
|
|
240
|
+
SpaceEvents,
|
|
3569
241
|
SpacePlugin,
|
|
3570
242
|
SpacePluginSettings,
|
|
3571
243
|
SpacePresence,
|
|
@@ -3574,8 +246,7 @@ var src_default = SpacePlugin;
|
|
|
3574
246
|
SyncStatus,
|
|
3575
247
|
SyncStatusDetail,
|
|
3576
248
|
SyncStatusIndicator,
|
|
3577
|
-
|
|
3578
|
-
ThreadType,
|
|
249
|
+
ThreadCapabilities,
|
|
3579
250
|
cloneObject,
|
|
3580
251
|
constructObjectActions,
|
|
3581
252
|
constructSpaceActions,
|
|
@@ -3585,8 +256,6 @@ var src_default = SpacePlugin;
|
|
|
3585
256
|
getNestedObjects,
|
|
3586
257
|
getSpaceDisplayName,
|
|
3587
258
|
memoizeQuery,
|
|
3588
|
-
|
|
3589
|
-
parseSpacePlugin,
|
|
3590
|
-
translations
|
|
259
|
+
meta
|
|
3591
260
|
});
|
|
3592
261
|
//# sourceMappingURL=index.cjs.map
|