@dxos/plugin-space 0.8.3-main.672df60 → 0.8.3-staging.0fa589b
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-DCWUULKX.mjs → app-graph-builder-M2RH72VL.mjs} +49 -14
- package/dist/lib/browser/app-graph-builder-M2RH72VL.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-MLU7XI2P.mjs → app-graph-serializer-F7ISRRBV.mjs} +13 -13
- package/dist/lib/browser/app-graph-serializer-F7ISRRBV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VEBKN45O.mjs → chunk-4ZKSFDXM.mjs} +29 -17
- package/dist/lib/browser/chunk-4ZKSFDXM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3LN4LJN6.mjs → chunk-BXNL6SDI.mjs} +2 -1
- package/dist/lib/browser/chunk-BXNL6SDI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZQEIXWBK.mjs → chunk-NFUKCRGE.mjs} +157 -141
- package/dist/lib/browser/chunk-NFUKCRGE.mjs.map +7 -0
- package/dist/lib/browser/chunk-TW7O2EPP.mjs +284 -0
- package/dist/lib/browser/chunk-TW7O2EPP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N5QMRLKI.mjs → chunk-V24VASAJ.mjs} +112 -43
- package/dist/lib/browser/chunk-V24VASAJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-YMCZR6EZ.mjs +18 -0
- package/dist/lib/browser/chunk-YMCZR6EZ.mjs.map +7 -0
- package/dist/lib/browser/{identity-created-O63SIYOF.mjs → identity-created-PI7TKANR.mjs} +5 -10
- package/dist/lib/browser/identity-created-PI7TKANR.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +61 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-PG473BRV.mjs → intent-resolver-RWU6ZE4H.mjs} +66 -45
- package/dist/lib/browser/intent-resolver-RWU6ZE4H.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-FRDC4UXB.mjs → react-root-QIKHSNT2.mjs} +5 -5
- package/dist/lib/browser/{react-surface-QOP7T66K.mjs → react-surface-W56UD53I.mjs} +79 -19
- package/dist/lib/browser/react-surface-W56UD53I.mjs.map +7 -0
- package/dist/lib/browser/{schema-defs-JMN74RNK.mjs → schema-defs-WREJNMIC.mjs} +2 -2
- package/dist/lib/browser/{schema-tools-JIEMHUXV.mjs → schema-tools-ILTVSSS3.mjs} +7 -6
- package/dist/lib/browser/schema-tools-ILTVSSS3.mjs.map +7 -0
- package/dist/lib/browser/{settings-2IN2WLUK.mjs → settings-K54STC5A.mjs} +4 -4
- package/dist/lib/browser/settings-K54STC5A.mjs.map +7 -0
- package/dist/lib/browser/{spaces-ready-L4QAGTDE.mjs → spaces-ready-3PDRDHPC.mjs} +12 -13
- package/dist/lib/browser/spaces-ready-3PDRDHPC.mjs.map +7 -0
- package/dist/lib/browser/{state-6HOSHLIN.mjs → state-HRZ4VRXU.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +1 -3
- package/dist/lib/node/{app-graph-builder-WC445X77.cjs → app-graph-builder-6LK5HLLE.cjs} +79 -43
- package/dist/lib/node/app-graph-builder-6LK5HLLE.cjs.map +7 -0
- package/dist/lib/node/{app-graph-serializer-UPQOQVMJ.cjs → app-graph-serializer-HKHBNHA3.cjs} +24 -23
- package/dist/lib/node/app-graph-serializer-HKHBNHA3.cjs.map +7 -0
- package/dist/lib/node/chunk-3X4EA4XL.cjs +37 -0
- package/dist/lib/node/chunk-3X4EA4XL.cjs.map +7 -0
- package/dist/lib/node/{chunk-DXL5TDFP.cjs → chunk-DOC5XEZ4.cjs} +32 -18
- package/dist/lib/node/chunk-DOC5XEZ4.cjs.map +7 -0
- package/dist/lib/node/{chunk-USFHJG7C.cjs → chunk-NCHF433F.cjs} +207 -190
- package/dist/lib/node/chunk-NCHF433F.cjs.map +7 -0
- package/dist/lib/node/{chunk-7GQGM4ZF.cjs → chunk-NL5Y4EDX.cjs} +5 -4
- package/dist/lib/node/chunk-NL5Y4EDX.cjs.map +7 -0
- package/dist/lib/node/chunk-ULJZPATP.cjs +312 -0
- package/dist/lib/node/chunk-ULJZPATP.cjs.map +7 -0
- package/dist/lib/node/{chunk-COQYISES.cjs → chunk-XHWVT7LW.cjs} +137 -67
- package/dist/lib/node/chunk-XHWVT7LW.cjs.map +7 -0
- package/dist/lib/node/{identity-created-UXEAUGC7.cjs → identity-created-FF4WZ2WY.cjs} +8 -10
- package/dist/lib/node/identity-created-FF4WZ2WY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +130 -119
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-VPVZSSIL.cjs → intent-resolver-AV4CMM3Z.cjs} +99 -79
- package/dist/lib/node/intent-resolver-AV4CMM3Z.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-root-JXLRINF3.cjs → react-root-RQUU3A45.cjs} +10 -10
- package/dist/lib/node/{react-surface-ZIYDBL3C.cjs → react-surface-AZFJLE72.cjs} +119 -58
- package/dist/lib/node/react-surface-AZFJLE72.cjs.map +7 -0
- package/dist/lib/node/{schema-defs-XLFBG3XK.cjs → schema-defs-OB2X2HBH.cjs} +6 -6
- package/dist/lib/node/{schema-tools-ZG6Z2QRC.cjs → schema-tools-IYREN4IH.cjs} +9 -8
- package/dist/lib/node/schema-tools-IYREN4IH.cjs.map +7 -0
- package/dist/lib/node/{settings-FOH7EB5C.cjs → settings-P2EQ7VKQ.cjs} +7 -7
- package/dist/lib/node/settings-P2EQ7VKQ.cjs.map +7 -0
- package/dist/lib/node/{spaces-ready-VXQYCBII.cjs → spaces-ready-DXPOHYV7.cjs} +26 -27
- package/dist/lib/node/spaces-ready-DXPOHYV7.cjs.map +7 -0
- package/dist/lib/node/{state-ZT3MTZXB.cjs → state-M35DK75Z.cjs} +6 -6
- package/dist/lib/node/types/index.cjs +11 -13
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{app-graph-builder-E7CCGPQJ.mjs → app-graph-builder-BCHVZ4OM.mjs} +49 -14
- package/dist/lib/node-esm/app-graph-builder-BCHVZ4OM.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-UCMSLPIA.mjs → app-graph-serializer-TXRGGNP2.mjs} +13 -13
- package/dist/lib/node-esm/app-graph-serializer-TXRGGNP2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3CP67AYY.mjs +19 -0
- package/dist/lib/node-esm/chunk-3CP67AYY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4X4Y63ND.mjs → chunk-BSLREHIX.mjs} +2 -1
- package/dist/lib/node-esm/chunk-BSLREHIX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D4QMPPS7.mjs +285 -0
- package/dist/lib/node-esm/chunk-D4QMPPS7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XAZNQ3QN.mjs → chunk-HO7AIKQS.mjs} +112 -43
- package/dist/lib/node-esm/chunk-HO7AIKQS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OSPEGYX3.mjs → chunk-JBQKU4K5.mjs} +29 -17
- package/dist/lib/node-esm/chunk-JBQKU4K5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BE2BLE7K.mjs → chunk-LA6AVVH6.mjs} +157 -141
- package/dist/lib/node-esm/chunk-LA6AVVH6.mjs.map +7 -0
- package/dist/lib/node-esm/{identity-created-ZECO4NH3.mjs → identity-created-35CTAQWI.mjs} +5 -9
- package/dist/lib/node-esm/identity-created-35CTAQWI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +61 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-SK5LP5ZK.mjs → intent-resolver-JO6L2VXC.mjs} +66 -45
- package/dist/lib/node-esm/intent-resolver-JO6L2VXC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-K2KRGIT7.mjs → react-root-YFGL3B4J.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-XNUWZCSH.mjs → react-surface-CVAPDLEZ.mjs} +79 -19
- package/dist/lib/node-esm/react-surface-CVAPDLEZ.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-defs-QZJS6UXN.mjs → schema-defs-4MEJETVX.mjs} +2 -2
- package/dist/lib/node-esm/{schema-tools-2Y4D42PD.mjs → schema-tools-SRLCRZ3B.mjs} +7 -6
- package/dist/lib/node-esm/schema-tools-SRLCRZ3B.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-Q4XDFSYD.mjs → settings-TD76LTQS.mjs} +4 -4
- package/dist/lib/node-esm/settings-TD76LTQS.mjs.map +7 -0
- package/dist/lib/node-esm/{spaces-ready-JHKPD4PH.mjs → spaces-ready-FJMGPAVV.mjs} +12 -13
- package/dist/lib/node-esm/spaces-ready-FJMGPAVV.mjs.map +7 -0
- package/dist/lib/node-esm/{state-4ATRHSKA.mjs → state-XQNDCN37.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -3
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/identity-created.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema-tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -1
- package/dist/types/src/components/CollectionMain.d.ts +2 -2
- package/dist/types/src/components/CollectionMain.d.ts.map +1 -1
- package/dist/types/src/components/CollectionSection.d.ts +2 -2
- package/dist/types/src/components/CollectionSection.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +3 -3
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +8 -7
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts +2 -2
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts +2 -2
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts +2 -2
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts +2 -2
- package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/SchemaContainer.d.ts +2 -2
- package/dist/types/src/components/SchemaContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts +2 -2
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -3
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +275 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +81 -12
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +16 -11
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +45 -45
- package/src/{SpacePlugin.tsx → SpacePlugin.ts} +30 -10
- package/src/capabilities/app-graph-builder.ts +74 -20
- package/src/capabilities/app-graph-serializer.ts +11 -8
- package/src/capabilities/capabilities.ts +6 -1
- package/src/capabilities/identity-created.ts +5 -4
- package/src/capabilities/intent-resolver.ts +60 -36
- package/src/capabilities/react-surface.tsx +105 -29
- package/src/capabilities/schema-tools.ts +3 -2
- package/src/capabilities/settings.ts +6 -2
- package/src/capabilities/spaces-ready.ts +7 -8
- package/src/components/CollectionMain.tsx +3 -3
- package/src/components/CollectionSection.tsx +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +7 -6
- package/src/components/CreateDialog/CreateObjectDialog.tsx +31 -25
- package/src/components/CreateDialog/CreateObjectPanel.tsx +45 -52
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +6 -5
- package/src/components/MembersContainer.tsx +4 -2
- package/src/components/MenuFooter.tsx +3 -2
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +12 -4
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +7 -7
- package/src/components/ObjectSettings/ObjectSettingsContainer.tsx +4 -4
- package/src/components/SchemaContainer.tsx +3 -3
- package/src/components/SpacePluginSettings.tsx +24 -19
- package/src/components/SpacePresence.tsx +22 -15
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +2 -1
- package/src/events.ts +1 -5
- package/src/translations.ts +30 -14
- package/src/types/index.ts +0 -1
- package/src/types/types.ts +32 -11
- package/src/util.tsx +136 -57
- package/dist/lib/browser/app-graph-builder-DCWUULKX.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-MLU7XI2P.mjs.map +0 -7
- package/dist/lib/browser/chunk-3LN4LJN6.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5QMRLKI.mjs.map +0 -7
- package/dist/lib/browser/chunk-VEBKN45O.mjs.map +0 -7
- package/dist/lib/browser/chunk-W46VVHFM.mjs +0 -288
- package/dist/lib/browser/chunk-W46VVHFM.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZQEIXWBK.mjs.map +0 -7
- package/dist/lib/browser/identity-created-O63SIYOF.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-PG473BRV.mjs.map +0 -7
- package/dist/lib/browser/react-surface-QOP7T66K.mjs.map +0 -7
- package/dist/lib/browser/schema-tools-JIEMHUXV.mjs.map +0 -7
- package/dist/lib/browser/settings-2IN2WLUK.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-L4QAGTDE.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-WC445X77.cjs.map +0 -7
- package/dist/lib/node/app-graph-serializer-UPQOQVMJ.cjs.map +0 -7
- package/dist/lib/node/chunk-7GQGM4ZF.cjs.map +0 -7
- package/dist/lib/node/chunk-COQYISES.cjs.map +0 -7
- package/dist/lib/node/chunk-DXL5TDFP.cjs.map +0 -7
- package/dist/lib/node/chunk-FXHI7JNY.cjs +0 -315
- package/dist/lib/node/chunk-FXHI7JNY.cjs.map +0 -7
- package/dist/lib/node/chunk-USFHJG7C.cjs.map +0 -7
- package/dist/lib/node/identity-created-UXEAUGC7.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-VPVZSSIL.cjs.map +0 -7
- package/dist/lib/node/react-surface-ZIYDBL3C.cjs.map +0 -7
- package/dist/lib/node/schema-tools-ZG6Z2QRC.cjs.map +0 -7
- package/dist/lib/node/settings-FOH7EB5C.cjs.map +0 -7
- package/dist/lib/node/spaces-ready-VXQYCBII.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-E7CCGPQJ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-UCMSLPIA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4X4Y63ND.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BE2BLE7K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FTELJGEG.mjs +0 -289
- package/dist/lib/node-esm/chunk-FTELJGEG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OSPEGYX3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XAZNQ3QN.mjs.map +0 -7
- package/dist/lib/node-esm/identity-created-ZECO4NH3.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SK5LP5ZK.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-XNUWZCSH.mjs.map +0 -7
- package/dist/lib/node-esm/schema-tools-2Y4D42PD.mjs.map +0 -7
- package/dist/lib/node-esm/settings-Q4XDFSYD.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-JHKPD4PH.mjs.map +0 -7
- package/dist/types/src/types/collection.d.ts +0 -15
- package/dist/types/src/types/collection.d.ts.map +0 -1
- package/src/types/collection.ts +0 -18
- /package/dist/lib/browser/{react-root-FRDC4UXB.mjs.map → react-root-QIKHSNT2.mjs.map} +0 -0
- /package/dist/lib/browser/{schema-defs-JMN74RNK.mjs.map → schema-defs-WREJNMIC.mjs.map} +0 -0
- /package/dist/lib/browser/{state-6HOSHLIN.mjs.map → state-HRZ4VRXU.mjs.map} +0 -0
- /package/dist/lib/node/{react-root-JXLRINF3.cjs.map → react-root-RQUU3A45.cjs.map} +0 -0
- /package/dist/lib/node/{schema-defs-XLFBG3XK.cjs.map → schema-defs-OB2X2HBH.cjs.map} +0 -0
- /package/dist/lib/node/{state-ZT3MTZXB.cjs.map → state-M35DK75Z.cjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-K2KRGIT7.mjs.map → react-root-YFGL3B4J.mjs.map} +0 -0
- /package/dist/lib/node-esm/{schema-defs-QZJS6UXN.mjs.map → schema-defs-4MEJETVX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-4ATRHSKA.mjs.map → state-XQNDCN37.mjs.map} +0 -0
package/src/translations.ts
CHANGED
|
@@ -2,16 +2,28 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
6
|
+
import { DataType } from '@dxos/schema';
|
|
7
|
+
|
|
5
8
|
import { SPACE_PLUGIN } from './meta';
|
|
6
|
-
import { CollectionType } from './types';
|
|
7
9
|
|
|
8
10
|
export default [
|
|
9
11
|
{
|
|
10
12
|
'en-US': {
|
|
11
|
-
[
|
|
13
|
+
[Type.getTypename(DataType.Collection)]: {
|
|
12
14
|
'typename label': 'Collection',
|
|
15
|
+
'typename label_zero': 'Collections',
|
|
16
|
+
'typename label_one': 'Collection',
|
|
17
|
+
'typename label_other': 'Collections',
|
|
13
18
|
'object name placeholder': 'New collection',
|
|
14
19
|
},
|
|
20
|
+
[Type.getTypename(DataType.QueryCollection)]: {
|
|
21
|
+
'typename label': 'Smart Collection',
|
|
22
|
+
'typename label_zero': 'Smart Collections',
|
|
23
|
+
'typename label_one': 'Smart Collection',
|
|
24
|
+
'typename label_other': 'Smart Collections',
|
|
25
|
+
'object name placeholder': 'New smart collection',
|
|
26
|
+
},
|
|
15
27
|
[SPACE_PLUGIN]: {
|
|
16
28
|
'plugin name': 'Spaces',
|
|
17
29
|
'first run message': 'Nothing selected.',
|
|
@@ -27,7 +39,7 @@ export default [
|
|
|
27
39
|
'rename space label': 'Rename space',
|
|
28
40
|
'active space label': 'Active space:',
|
|
29
41
|
'space name label': 'Space name',
|
|
30
|
-
'object name label': '
|
|
42
|
+
'object name label': 'Item name',
|
|
31
43
|
'close space label': 'Close space',
|
|
32
44
|
'open space label': 'Open space',
|
|
33
45
|
'export data label': 'Export data',
|
|
@@ -42,6 +54,9 @@ export default [
|
|
|
42
54
|
'object placeholder': 'Type a title here…',
|
|
43
55
|
'personal space label': 'Personal Space',
|
|
44
56
|
'spaces label': 'Spaces',
|
|
57
|
+
'space settings label': 'Spaces',
|
|
58
|
+
'space settings description':
|
|
59
|
+
'Each space has its own settings you can configure, where you can adjust its properties, membership, integrations, and other items specific to that space.',
|
|
45
60
|
'show hidden spaces label': 'Show archived spaces',
|
|
46
61
|
'save files to directory label': 'Save files to disk',
|
|
47
62
|
'select path label': 'Select path',
|
|
@@ -55,17 +70,18 @@ export default [
|
|
|
55
70
|
'objects deleted label': 'Items deleted',
|
|
56
71
|
'go to object label': 'Open item',
|
|
57
72
|
'found object label': 'Ready.',
|
|
58
|
-
'found object description': 'The requested
|
|
73
|
+
'found object description': 'The requested item is now available.',
|
|
59
74
|
'waiting for object label': 'Loading…',
|
|
60
|
-
'waiting for object description': 'The requested
|
|
75
|
+
'waiting for object description': 'The requested item is still being synchronized.',
|
|
61
76
|
'object not found label': 'Nothing found.',
|
|
62
77
|
'object not found description':
|
|
63
|
-
'The requested
|
|
64
|
-
'missing object message': '
|
|
78
|
+
'The requested item has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
|
|
79
|
+
'missing object message': 'Item not available.',
|
|
65
80
|
'missing object description':
|
|
66
|
-
'The requested
|
|
81
|
+
'The requested item has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
|
|
67
82
|
'create object in space label': 'Add to space',
|
|
68
83
|
'create object in collection label': 'Add to collection',
|
|
84
|
+
'create object in smart collection label': 'Add to smart collection',
|
|
69
85
|
'space members label': 'Space members',
|
|
70
86
|
'active space members heading': 'Online ({{count}})',
|
|
71
87
|
'inactive space members heading': 'Offline ({{count}})',
|
|
@@ -83,10 +99,10 @@ export default [
|
|
|
83
99
|
'location label': 'Located in',
|
|
84
100
|
'space limit label': 'Space Limit Reached',
|
|
85
101
|
'space limit description':
|
|
86
|
-
'This space has reached the maximum number of
|
|
102
|
+
'This space has reached the maximum number of items for the beta. This limit includes deleted items currently, but those can be permanently removed with the cleanup action.',
|
|
87
103
|
'space limit close label': 'Close',
|
|
88
104
|
'remove deleted objects label': 'Cleanup',
|
|
89
|
-
'remove deleted objects alt': 'Permanently remove deleted
|
|
105
|
+
'remove deleted objects alt': 'Permanently remove deleted items to free up space.',
|
|
90
106
|
'copy link label': 'Copy link',
|
|
91
107
|
'default on space create label': 'On space create',
|
|
92
108
|
'sync status title': 'Sync status',
|
|
@@ -103,11 +119,11 @@ export default [
|
|
|
103
119
|
'remote synced label': 'Synced with peers',
|
|
104
120
|
'syncing label': 'Space syncing',
|
|
105
121
|
'show all label': 'Show all',
|
|
106
|
-
'no sync status label': 'No space with missing
|
|
122
|
+
'no sync status label': 'No space with missing items.',
|
|
107
123
|
'create space dialog title': 'Create Space',
|
|
108
|
-
'create object dialog title': 'Create
|
|
124
|
+
'create object dialog title': 'Create {{object}}',
|
|
109
125
|
'space input placeholder': 'Select space',
|
|
110
|
-
'schema input placeholder': 'Select
|
|
126
|
+
'schema input placeholder': 'Select item type',
|
|
111
127
|
'creating object type label': 'Type',
|
|
112
128
|
'creating in space label': 'Location',
|
|
113
129
|
'creating in collection label': 'In Collection',
|
|
@@ -116,7 +132,7 @@ export default [
|
|
|
116
132
|
'advanced settings label': 'Advanced',
|
|
117
133
|
'foreign keys': 'Foreign Keys',
|
|
118
134
|
'add key': 'Add Key',
|
|
119
|
-
'open space settings label': 'Open',
|
|
135
|
+
'open space settings label': 'Open settings',
|
|
120
136
|
|
|
121
137
|
'members panel label': 'Members',
|
|
122
138
|
'members verbose label': 'Manage space members',
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { type AnyIntentChain } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { Type, type Obj } from '@dxos/echo';
|
|
9
|
+
import { type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
9
10
|
import { type PublicKey } from '@dxos/react-client';
|
|
10
11
|
// TODO(wittjosiah): This pulls in full client.
|
|
11
12
|
import { EchoObjectSchema, ReactiveObjectSchema, type Space, SpaceSchema } from '@dxos/react-client/echo';
|
|
12
13
|
import { CancellableInvitationObservable, Invitation } from '@dxos/react-client/invitations';
|
|
14
|
+
import { DataType, TypenameAnnotationId } from '@dxos/schema';
|
|
13
15
|
import { type ComplexMap } from '@dxos/util';
|
|
14
16
|
|
|
15
|
-
import { CollectionType } from './collection';
|
|
16
17
|
import { SPACE_PLUGIN } from '../meta';
|
|
17
18
|
|
|
18
19
|
export const SPACE_DIRECTORY_HANDLE = 'dxos.org/plugin/space/directory';
|
|
@@ -80,7 +81,7 @@ export type SpaceSettingsProps = Schema.Schema.Type<typeof SpaceSettingsSchema>;
|
|
|
80
81
|
|
|
81
82
|
export type SerializerMap = Record<string, TypedObjectSerializer>;
|
|
82
83
|
|
|
83
|
-
export interface TypedObjectSerializer<T extends
|
|
84
|
+
export interface TypedObjectSerializer<T extends Obj.Any = Type.Expando> {
|
|
84
85
|
serialize(params: { object: T }): Promise<string>;
|
|
85
86
|
|
|
86
87
|
/**
|
|
@@ -218,7 +219,8 @@ export namespace SpaceAction {
|
|
|
218
219
|
|
|
219
220
|
export class OpenCreateObject extends Schema.TaggedClass<OpenCreateObject>()(`${SPACE_ACTION}/open-create-object`, {
|
|
220
221
|
input: Schema.Struct({
|
|
221
|
-
target: Schema.Union(SpaceSchema,
|
|
222
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
223
|
+
typename: Schema.optional(Schema.String),
|
|
222
224
|
navigable: Schema.optional(Schema.Boolean),
|
|
223
225
|
}),
|
|
224
226
|
output: Schema.Void,
|
|
@@ -227,7 +229,7 @@ export namespace SpaceAction {
|
|
|
227
229
|
export class AddObject extends Schema.TaggedClass<AddObject>()(`${SPACE_ACTION}/add-object`, {
|
|
228
230
|
input: Schema.Struct({
|
|
229
231
|
object: ReactiveObjectSchema,
|
|
230
|
-
target: Schema.Union(SpaceSchema,
|
|
232
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
231
233
|
hidden: Schema.optional(Schema.Boolean),
|
|
232
234
|
}),
|
|
233
235
|
output: Schema.Struct({
|
|
@@ -242,8 +244,8 @@ export namespace SpaceAction {
|
|
|
242
244
|
space: SpaceSchema,
|
|
243
245
|
// TODO(wittjosiah): Relation schema.
|
|
244
246
|
schema: Schema.Any,
|
|
245
|
-
source: Expando,
|
|
246
|
-
target: Expando,
|
|
247
|
+
source: Type.Expando,
|
|
248
|
+
target: Type.Expando,
|
|
247
249
|
// TODO(wittjosiah): Type based on relation schema.
|
|
248
250
|
fields: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
249
251
|
}),
|
|
@@ -254,7 +256,7 @@ export namespace SpaceAction {
|
|
|
254
256
|
|
|
255
257
|
export const DeletionData = Schema.Struct({
|
|
256
258
|
objects: Schema.Array(EchoObjectSchema),
|
|
257
|
-
parentCollection:
|
|
259
|
+
parentCollection: DataType.Collection,
|
|
258
260
|
indices: Schema.Array(Schema.Number),
|
|
259
261
|
nestedObjectsList: Schema.Array(Schema.Array(EchoObjectSchema)),
|
|
260
262
|
wasActive: Schema.Array(Schema.String),
|
|
@@ -265,7 +267,7 @@ export namespace SpaceAction {
|
|
|
265
267
|
export class RemoveObjects extends Schema.TaggedClass<RemoveObjects>()(`${SPACE_ACTION}/remove-objects`, {
|
|
266
268
|
input: Schema.Struct({
|
|
267
269
|
objects: Schema.Array(EchoObjectSchema),
|
|
268
|
-
target: Schema.optional(
|
|
270
|
+
target: Schema.optional(DataType.Collection),
|
|
269
271
|
deletionData: Schema.optional(DeletionData),
|
|
270
272
|
}),
|
|
271
273
|
output: Schema.Void,
|
|
@@ -282,7 +284,7 @@ export namespace SpaceAction {
|
|
|
282
284
|
export class DuplicateObject extends Schema.TaggedClass<DuplicateObject>()(`${SPACE_ACTION}/duplicate-object`, {
|
|
283
285
|
input: Schema.Struct({
|
|
284
286
|
object: EchoObjectSchema,
|
|
285
|
-
target: Schema.Union(SpaceSchema,
|
|
287
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
286
288
|
}),
|
|
287
289
|
output: Schema.Void,
|
|
288
290
|
}) {}
|
|
@@ -301,7 +303,26 @@ export namespace CollectionAction {
|
|
|
301
303
|
name: Schema.optional(Schema.String),
|
|
302
304
|
}),
|
|
303
305
|
output: Schema.Struct({
|
|
304
|
-
object:
|
|
306
|
+
object: DataType.Collection,
|
|
305
307
|
}),
|
|
306
308
|
}) {}
|
|
309
|
+
|
|
310
|
+
export const QueryCollectionForm = Schema.Struct({
|
|
311
|
+
name: Schema.optional(Schema.String),
|
|
312
|
+
typename: Schema.optional(
|
|
313
|
+
Schema.String.annotations({
|
|
314
|
+
[TypenameAnnotationId]: ['object-form'],
|
|
315
|
+
}),
|
|
316
|
+
),
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
export class CreateQueryCollection extends Schema.TaggedClass<CreateQueryCollection>()(
|
|
320
|
+
'dxos.org/plugin/collection/action/create-query-collection',
|
|
321
|
+
{
|
|
322
|
+
input: QueryCollectionForm,
|
|
323
|
+
output: Schema.Struct({
|
|
324
|
+
object: DataType.QueryCollection,
|
|
325
|
+
}),
|
|
326
|
+
},
|
|
327
|
+
) {}
|
|
307
328
|
}
|
package/src/util.tsx
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
+
import { pipe } from 'effect';
|
|
6
7
|
|
|
7
|
-
import { createIntent, LayoutAction, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { chain, createIntent, LayoutAction, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { EXPANDO_TYPENAME } from '@dxos/echo-schema';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { makeRef } from '@dxos/live-object';
|
|
12
12
|
import { Migrations } from '@dxos/migrations';
|
|
13
13
|
import {
|
|
14
14
|
ACTION_GROUP_TYPE,
|
|
@@ -18,20 +18,15 @@ import {
|
|
|
18
18
|
type InvokeParams,
|
|
19
19
|
type Node,
|
|
20
20
|
type NodeArg,
|
|
21
|
+
isGraphNode,
|
|
21
22
|
} from '@dxos/plugin-graph';
|
|
22
|
-
import {
|
|
23
|
-
fullyQualifiedId,
|
|
24
|
-
getSpace,
|
|
25
|
-
isEchoObject,
|
|
26
|
-
type QueryResult,
|
|
27
|
-
SpaceState,
|
|
28
|
-
type AnyLiveObject,
|
|
29
|
-
type Space,
|
|
30
|
-
} from '@dxos/react-client/echo';
|
|
23
|
+
import { fullyQualifiedId, getSpace, type QueryResult, SpaceState, type Space, isSpace } from '@dxos/react-client/echo';
|
|
31
24
|
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
25
|
+
import { type TreeData } from '@dxos/react-ui-list';
|
|
26
|
+
import { DataType } from '@dxos/schema';
|
|
32
27
|
|
|
33
28
|
import { SPACE_PLUGIN } from './meta';
|
|
34
|
-
import {
|
|
29
|
+
import { SpaceAction, SPACE_TYPE, type ObjectForm } from './types';
|
|
35
30
|
|
|
36
31
|
export const SPACES = `${SPACE_PLUGIN}-spaces`;
|
|
37
32
|
export const COMPOSER_SPACE_LOCK = 'dxos.org/plugin/space/lock';
|
|
@@ -41,14 +36,13 @@ export const SHARED = 'shared-spaces';
|
|
|
41
36
|
/**
|
|
42
37
|
* Convert a query result to an Rx value of the objects.
|
|
43
38
|
*/
|
|
44
|
-
export const rxFromQuery = <T extends
|
|
39
|
+
export const rxFromQuery = <T extends Obj.Any>(query: QueryResult<T>): Rx.Rx<T[]> => {
|
|
45
40
|
return Rx.make((get) => {
|
|
46
41
|
const unsubscribe = query.subscribe((result) => {
|
|
47
42
|
get.setSelf(result.objects);
|
|
48
43
|
});
|
|
49
44
|
|
|
50
45
|
get.addFinalizer(() => unsubscribe());
|
|
51
|
-
|
|
52
46
|
return query.objects;
|
|
53
47
|
});
|
|
54
48
|
};
|
|
@@ -68,13 +62,11 @@ export const getSpaceDisplayName = (
|
|
|
68
62
|
};
|
|
69
63
|
|
|
70
64
|
const getCollectionGraphNodePartials = ({
|
|
71
|
-
navigable,
|
|
72
65
|
collection,
|
|
73
66
|
space,
|
|
74
67
|
resolve,
|
|
75
68
|
}: {
|
|
76
|
-
|
|
77
|
-
collection: CollectionType;
|
|
69
|
+
collection: DataType.Collection;
|
|
78
70
|
space: Space;
|
|
79
71
|
resolve: (typename: string) => Record<string, any>;
|
|
80
72
|
}) => {
|
|
@@ -84,9 +76,9 @@ const getCollectionGraphNodePartials = ({
|
|
|
84
76
|
role: 'branch',
|
|
85
77
|
onRearrangeChildren: (nextOrder: unknown[]) => {
|
|
86
78
|
// Change on disk.
|
|
87
|
-
collection.objects = nextOrder.filter(
|
|
79
|
+
collection.objects = nextOrder.filter(Obj.isObject).map(Ref.make);
|
|
88
80
|
},
|
|
89
|
-
onTransferStart: (child: Node<
|
|
81
|
+
onTransferStart: (child: Node<Obj.Any>, index?: number) => {
|
|
90
82
|
// TODO(wittjosiah): Support transfer between spaces.
|
|
91
83
|
// const childSpace = getSpace(child.data);
|
|
92
84
|
// if (space && childSpace && !childSpace.key.equals(space.key)) {
|
|
@@ -107,15 +99,15 @@ const getCollectionGraphNodePartials = ({
|
|
|
107
99
|
// TODO(dmaretskyi): Compare by id.
|
|
108
100
|
if (!collection.objects.find((object) => object.target === child.data)) {
|
|
109
101
|
if (typeof index !== 'undefined') {
|
|
110
|
-
collection.objects.splice(index, 0,
|
|
102
|
+
collection.objects.splice(index, 0, Ref.make(child.data));
|
|
111
103
|
} else {
|
|
112
|
-
collection.objects.push(
|
|
104
|
+
collection.objects.push(Ref.make(child.data));
|
|
113
105
|
}
|
|
114
106
|
}
|
|
115
107
|
|
|
116
108
|
// }
|
|
117
109
|
},
|
|
118
|
-
onTransferEnd: (child: Node<
|
|
110
|
+
onTransferEnd: (child: Node<Obj.Any>, destination: Node) => {
|
|
119
111
|
// Remove child from origin collection.
|
|
120
112
|
const index = collection.objects.findIndex((object) => object.target === child.data);
|
|
121
113
|
if (index > -1) {
|
|
@@ -131,19 +123,49 @@ const getCollectionGraphNodePartials = ({
|
|
|
131
123
|
// childSpace.db.remove(child.data);
|
|
132
124
|
// }
|
|
133
125
|
},
|
|
134
|
-
onCopy: async (child: Node<
|
|
126
|
+
onCopy: async (child: Node<Obj.Any>, index?: number) => {
|
|
135
127
|
// Create clone of child and add to destination space.
|
|
136
128
|
const newObject = await cloneObject(child.data, resolve, space);
|
|
137
129
|
space.db.add(newObject);
|
|
138
130
|
if (typeof index !== 'undefined') {
|
|
139
|
-
collection.objects.splice(index, 0,
|
|
131
|
+
collection.objects.splice(index, 0, Ref.make(newObject));
|
|
140
132
|
} else {
|
|
141
|
-
collection.objects.push(
|
|
133
|
+
collection.objects.push(Ref.make(newObject));
|
|
142
134
|
}
|
|
143
135
|
},
|
|
144
136
|
};
|
|
145
137
|
};
|
|
146
138
|
|
|
139
|
+
const getQueryCollectionNodePartials = ({
|
|
140
|
+
collection,
|
|
141
|
+
space,
|
|
142
|
+
resolve,
|
|
143
|
+
}: {
|
|
144
|
+
collection: DataType.QueryCollection;
|
|
145
|
+
space: Space;
|
|
146
|
+
resolve: (typename: string) => Record<string, any>;
|
|
147
|
+
}) => {
|
|
148
|
+
return {
|
|
149
|
+
icon: collection.query.typename && resolve(collection.query.typename)?.icon,
|
|
150
|
+
acceptPersistenceClass: new Set(['echo']),
|
|
151
|
+
acceptPersistenceKey: new Set([space.id]),
|
|
152
|
+
role: 'branch',
|
|
153
|
+
canDrop: (source: TreeData) => {
|
|
154
|
+
return (
|
|
155
|
+
isGraphNode(source.item) &&
|
|
156
|
+
Obj.isObject(source.item.data) &&
|
|
157
|
+
Obj.getTypename(source.item.data) === collection.query.typename
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
onTransferStart: (child: Node<Obj.Any>, index?: number) => {
|
|
161
|
+
// No-op. Objects are moved into query collections by being removed from their original collection.
|
|
162
|
+
},
|
|
163
|
+
onTransferEnd: (child: Node<Obj.Any>, destination: Node) => {
|
|
164
|
+
// No-op. Objects are moved out of query collections by being added to another collection.
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
147
169
|
const checkPendingMigration = (space: Space) => {
|
|
148
170
|
return (
|
|
149
171
|
space.state.get() === SpaceState.SPACE_REQUIRES_MIGRATION ||
|
|
@@ -167,10 +189,11 @@ export const constructSpaceNode = ({
|
|
|
167
189
|
resolve: (typename: string) => Record<string, any>;
|
|
168
190
|
}) => {
|
|
169
191
|
const hasPendingMigration = checkPendingMigration(space);
|
|
170
|
-
const collection =
|
|
192
|
+
const collection =
|
|
193
|
+
space.state.get() === SpaceState.SPACE_READY && space.properties[Type.getTypename(DataType.Collection)]?.target;
|
|
171
194
|
const partials =
|
|
172
|
-
space.state.get() === SpaceState.SPACE_READY && collection
|
|
173
|
-
? getCollectionGraphNodePartials({ collection, space, resolve
|
|
195
|
+
space.state.get() === SpaceState.SPACE_READY && Obj.instanceOf(DataType.Collection, collection)
|
|
196
|
+
? getCollectionGraphNodePartials({ collection, space, resolve })
|
|
174
197
|
: {};
|
|
175
198
|
|
|
176
199
|
return {
|
|
@@ -189,6 +212,10 @@ export const constructSpaceNode = ({
|
|
|
189
212
|
: undefined,
|
|
190
213
|
disabled: !navigable || space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
191
214
|
testId: 'spacePlugin.space',
|
|
215
|
+
canDrop: (source: TreeData) => {
|
|
216
|
+
// TODO(wittjosiah): Find a way to only allow space as source for rearranging.
|
|
217
|
+
return Obj.isObject(source.item.data) || isSpace(source.item.data);
|
|
218
|
+
},
|
|
192
219
|
},
|
|
193
220
|
nodes: [
|
|
194
221
|
{
|
|
@@ -305,17 +332,19 @@ export const constructSpaceActions = ({
|
|
|
305
332
|
};
|
|
306
333
|
|
|
307
334
|
export const createObjectNode = ({
|
|
308
|
-
object,
|
|
309
335
|
space,
|
|
336
|
+
object,
|
|
337
|
+
droppable = true,
|
|
310
338
|
navigable = false,
|
|
311
339
|
resolve,
|
|
312
340
|
}: {
|
|
313
|
-
object: AnyLiveObject<any>;
|
|
314
341
|
space: Space;
|
|
342
|
+
object: Obj.Any;
|
|
343
|
+
droppable?: boolean;
|
|
315
344
|
navigable?: boolean;
|
|
316
345
|
resolve: (typename: string) => Record<string, any>;
|
|
317
346
|
}) => {
|
|
318
|
-
const type = getTypename(object);
|
|
347
|
+
const type = Obj.getTypename(object);
|
|
319
348
|
if (!type) {
|
|
320
349
|
return undefined;
|
|
321
350
|
}
|
|
@@ -325,9 +354,10 @@ export const createObjectNode = ({
|
|
|
325
354
|
return undefined;
|
|
326
355
|
}
|
|
327
356
|
|
|
328
|
-
const partials =
|
|
329
|
-
object
|
|
330
|
-
|
|
357
|
+
const partials = Obj.instanceOf(DataType.Collection, object)
|
|
358
|
+
? getCollectionGraphNodePartials({ collection: object, space, resolve })
|
|
359
|
+
: Obj.instanceOf(DataType.QueryCollection, object)
|
|
360
|
+
? getQueryCollectionNodePartials({ collection: object, space, resolve })
|
|
331
361
|
: metadata.graphProps;
|
|
332
362
|
|
|
333
363
|
return {
|
|
@@ -336,13 +366,17 @@ export const createObjectNode = ({
|
|
|
336
366
|
cacheable: ['label', 'icon', 'role'],
|
|
337
367
|
data: object,
|
|
338
368
|
properties: {
|
|
339
|
-
|
|
369
|
+
// TODO(burdon): Use annotation to get the name field.
|
|
340
370
|
label: metadata.label?.(object) ||
|
|
341
|
-
object.name || ['object name placeholder', { ns: type, default: 'New object' }],
|
|
371
|
+
(object as any).name || ['object name placeholder', { ns: type, default: 'New object' }],
|
|
342
372
|
icon: metadata.icon ?? 'ph--placeholder--regular',
|
|
343
373
|
testId: 'spacePlugin.object',
|
|
344
374
|
persistenceClass: 'echo',
|
|
345
375
|
persistenceKey: space?.id,
|
|
376
|
+
canDrop: (source: TreeData) => {
|
|
377
|
+
return droppable && isGraphNode(source.item) && Obj.isObject(source.item.data);
|
|
378
|
+
},
|
|
379
|
+
...partials,
|
|
346
380
|
},
|
|
347
381
|
};
|
|
348
382
|
};
|
|
@@ -351,18 +385,26 @@ export const constructObjectActions = ({
|
|
|
351
385
|
object,
|
|
352
386
|
graph,
|
|
353
387
|
dispatch,
|
|
388
|
+
objectForms,
|
|
354
389
|
navigable = false,
|
|
355
390
|
}: {
|
|
356
|
-
object:
|
|
391
|
+
object: Obj.Any;
|
|
357
392
|
graph: ReadableGraph;
|
|
358
393
|
dispatch: PromiseIntentDispatcher;
|
|
394
|
+
objectForms: ObjectForm<any>[];
|
|
359
395
|
navigable?: boolean;
|
|
360
396
|
}) => {
|
|
361
397
|
const space = getSpace(object);
|
|
362
398
|
invariant(space, 'Space not found');
|
|
363
399
|
const getId = (id: string) => `${id}/${fullyQualifiedId(object)}`;
|
|
400
|
+
|
|
401
|
+
const queryCollection = Obj.instanceOf(DataType.QueryCollection, object) ? object : undefined;
|
|
402
|
+
const matchingObjectForm = queryCollection
|
|
403
|
+
? objectForms.find((form) => Type.getTypename(form.objectSchema) === queryCollection.query.typename)
|
|
404
|
+
: undefined;
|
|
405
|
+
|
|
364
406
|
const actions: NodeArg<ActionData>[] = [
|
|
365
|
-
...(object
|
|
407
|
+
...(Obj.instanceOf(DataType.Collection, object)
|
|
366
408
|
? [
|
|
367
409
|
{
|
|
368
410
|
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
@@ -379,6 +421,38 @@ export const constructObjectActions = ({
|
|
|
379
421
|
},
|
|
380
422
|
]
|
|
381
423
|
: []),
|
|
424
|
+
...(matchingObjectForm
|
|
425
|
+
? [
|
|
426
|
+
{
|
|
427
|
+
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
428
|
+
type: ACTION_TYPE,
|
|
429
|
+
data: async () => {
|
|
430
|
+
if (matchingObjectForm.formSchema) {
|
|
431
|
+
await dispatch(
|
|
432
|
+
createIntent(SpaceAction.OpenCreateObject, {
|
|
433
|
+
target: space,
|
|
434
|
+
typename: queryCollection?.query.typename,
|
|
435
|
+
}),
|
|
436
|
+
);
|
|
437
|
+
} else {
|
|
438
|
+
await dispatch(
|
|
439
|
+
pipe(
|
|
440
|
+
matchingObjectForm.getIntent({}, { space }),
|
|
441
|
+
chain(SpaceAction.AddObject, { target: space, hidden: true }),
|
|
442
|
+
chain(LayoutAction.Open, { part: 'main' }),
|
|
443
|
+
),
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
properties: {
|
|
448
|
+
label: ['create object in smart collection label', { ns: SPACE_PLUGIN }],
|
|
449
|
+
icon: 'ph--plus--regular',
|
|
450
|
+
disposition: 'list-item-primary',
|
|
451
|
+
testId: 'spacePlugin.createObject',
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
]
|
|
455
|
+
: []),
|
|
382
456
|
{
|
|
383
457
|
id: getId(SpaceAction.RenameObject._tag),
|
|
384
458
|
type: ACTION_TYPE,
|
|
@@ -387,14 +461,15 @@ export const constructObjectActions = ({
|
|
|
387
461
|
},
|
|
388
462
|
properties: {
|
|
389
463
|
label: [
|
|
390
|
-
object
|
|
464
|
+
Obj.instanceOf(DataType.Collection, object) ? 'rename collection label' : 'rename object label',
|
|
391
465
|
{ ns: SPACE_PLUGIN },
|
|
392
466
|
],
|
|
393
467
|
icon: 'ph--pencil-simple-line--regular',
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
468
|
+
disposition: 'list-item',
|
|
469
|
+
// TODO(wittjosiah): Not working.
|
|
470
|
+
// keyBinding: {
|
|
471
|
+
// macos: 'shift+F6',
|
|
472
|
+
// },
|
|
398
473
|
testId: 'spacePlugin.renameObject',
|
|
399
474
|
},
|
|
400
475
|
},
|
|
@@ -404,20 +479,22 @@ export const constructObjectActions = ({
|
|
|
404
479
|
data: async () => {
|
|
405
480
|
const collection = graph
|
|
406
481
|
.getConnections(fullyQualifiedId(object), 'inbound')
|
|
407
|
-
.find(({ data }) => data
|
|
482
|
+
.find(({ data }) => Obj.instanceOf(DataType.Collection, data))?.data;
|
|
408
483
|
await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));
|
|
409
484
|
},
|
|
410
485
|
properties: {
|
|
411
486
|
label: [
|
|
412
|
-
object
|
|
487
|
+
Obj.instanceOf(DataType.Collection, object) ? 'delete collection label' : 'delete object label',
|
|
413
488
|
{ ns: SPACE_PLUGIN },
|
|
414
489
|
],
|
|
415
490
|
icon: 'ph--trash--regular',
|
|
416
|
-
|
|
491
|
+
disposition: 'list-item',
|
|
492
|
+
// TODO(wittjosiah): This is a browser shortcut.
|
|
493
|
+
// keyBinding: object instanceof CollectionType ? undefined : 'shift+meta+Backspace',
|
|
417
494
|
testId: 'spacePlugin.deleteObject',
|
|
418
495
|
},
|
|
419
496
|
},
|
|
420
|
-
...(navigable || !(object
|
|
497
|
+
...(navigable || (!Obj.instanceOf(DataType.Collection, object) && !Obj.instanceOf(DataType.QueryCollection, object))
|
|
421
498
|
? [
|
|
422
499
|
{
|
|
423
500
|
id: getId('copy-link'),
|
|
@@ -429,6 +506,7 @@ export const constructObjectActions = ({
|
|
|
429
506
|
properties: {
|
|
430
507
|
label: ['copy link label', { ns: SPACE_PLUGIN }],
|
|
431
508
|
icon: 'ph--link--regular',
|
|
509
|
+
disposition: 'list-item',
|
|
432
510
|
testId: 'spacePlugin.copyLink',
|
|
433
511
|
},
|
|
434
512
|
},
|
|
@@ -444,6 +522,7 @@ export const constructObjectActions = ({
|
|
|
444
522
|
properties: {
|
|
445
523
|
label: ['expose object label', { ns: SPACE_PLUGIN }],
|
|
446
524
|
icon: 'ph--eye--regular',
|
|
525
|
+
disposition: 'heading-list-item',
|
|
447
526
|
testId: 'spacePlugin.exposeObject',
|
|
448
527
|
},
|
|
449
528
|
},
|
|
@@ -456,10 +535,10 @@ export const constructObjectActions = ({
|
|
|
456
535
|
* @deprecated This is a temporary solution.
|
|
457
536
|
*/
|
|
458
537
|
export const getNestedObjects = async (
|
|
459
|
-
object:
|
|
538
|
+
object: Obj.Any,
|
|
460
539
|
resolve: (typename: string) => Record<string, any>,
|
|
461
|
-
): Promise<
|
|
462
|
-
const type = getTypename(object);
|
|
540
|
+
): Promise<Obj.Any[]> => {
|
|
541
|
+
const type = Obj.getTypename(object);
|
|
463
542
|
if (!type) {
|
|
464
543
|
return [];
|
|
465
544
|
}
|
|
@@ -470,7 +549,7 @@ export const getNestedObjects = async (
|
|
|
470
549
|
return [];
|
|
471
550
|
}
|
|
472
551
|
|
|
473
|
-
const objects:
|
|
552
|
+
const objects: Obj.Any[] = await loadReferences(object);
|
|
474
553
|
const nested = await Promise.all(objects.map((object) => getNestedObjects(object, resolve)));
|
|
475
554
|
return [...objects, ...nested.flat()];
|
|
476
555
|
};
|
|
@@ -480,12 +559,12 @@ export const getNestedObjects = async (
|
|
|
480
559
|
*/
|
|
481
560
|
// TODO(burdon): Remove.
|
|
482
561
|
export const cloneObject = async (
|
|
483
|
-
object: Expando,
|
|
562
|
+
object: Type.Expando,
|
|
484
563
|
resolve: (typename: string) => Record<string, any>,
|
|
485
564
|
newSpace: Space,
|
|
486
|
-
): Promise<Expando> => {
|
|
487
|
-
const schema = getSchema(object);
|
|
488
|
-
const typename = schema ?
|
|
565
|
+
): Promise<Type.Expando> => {
|
|
566
|
+
const schema = Obj.getSchema(object);
|
|
567
|
+
const typename = schema ? Type.getTypename(schema) ?? EXPANDO_TYPENAME : EXPANDO_TYPENAME;
|
|
489
568
|
const metadata = resolve(typename);
|
|
490
569
|
const serializer = metadata.serializer;
|
|
491
570
|
invariant(serializer, `No serializer for type: ${typename}`);
|