@dxos/plugin-space 0.8.3-main.7f5a14c → 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-UNXUTH53.mjs → app-graph-builder-M2RH72VL.mjs} +43 -9
- package/dist/lib/browser/app-graph-builder-M2RH72VL.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-KPKPMC4M.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-TQPBDRXV.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-CF4FBDGP.mjs → chunk-NFUKCRGE.mjs} +148 -134
- 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-RRJIDXPY.mjs → chunk-V24VASAJ.mjs} +100 -31
- 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-EM6GZDNF.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-K3ULKQ6V.mjs → intent-resolver-RWU6ZE4H.mjs} +56 -32
- 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-ECO7G77L.mjs → react-root-QIKHSNT2.mjs} +5 -5
- package/dist/lib/browser/{react-surface-Y5AZBYA7.mjs → react-surface-W56UD53I.mjs} +74 -14
- 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/{settings-MU7O6JDD.mjs → settings-K54STC5A.mjs} +2 -2
- package/dist/lib/browser/{spaces-ready-NXZAWHGI.mjs → spaces-ready-3PDRDHPC.mjs} +7 -7
- 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-6QDQEYHS.cjs → app-graph-builder-6LK5HLLE.cjs} +73 -38
- package/dist/lib/node/app-graph-builder-6LK5HLLE.cjs.map +7 -0
- package/dist/lib/node/{app-graph-serializer-6SWKHDE2.cjs → app-graph-serializer-HKHBNHA3.cjs} +23 -22
- 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-SF3NU7EW.cjs → chunk-DOC5XEZ4.cjs} +32 -18
- package/dist/lib/node/chunk-DOC5XEZ4.cjs.map +7 -0
- package/dist/lib/node/{chunk-QCANR24R.cjs → chunk-NCHF433F.cjs} +201 -186
- 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-KDBPQ6L3.cjs → chunk-XHWVT7LW.cjs} +113 -43
- package/dist/lib/node/chunk-XHWVT7LW.cjs.map +7 -0
- package/dist/lib/node/{identity-created-KCJAOFZC.cjs → identity-created-FF4WZ2WY.cjs} +7 -9
- package/dist/lib/node/identity-created-FF4WZ2WY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +129 -118
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-XR4S7LME.cjs → intent-resolver-AV4CMM3Z.cjs} +91 -68
- 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-Z2YM6JYC.cjs → react-root-RQUU3A45.cjs} +10 -10
- package/dist/lib/node/{react-surface-H6XNU6DS.cjs → react-surface-AZFJLE72.cjs} +104 -43
- 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/{settings-XRAT3YMN.cjs → settings-P2EQ7VKQ.cjs} +6 -6
- package/dist/lib/node/{spaces-ready-KKFEN2MM.cjs → spaces-ready-DXPOHYV7.cjs} +16 -16
- 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-5EAV4CDH.mjs → app-graph-builder-BCHVZ4OM.mjs} +43 -9
- package/dist/lib/node-esm/app-graph-builder-BCHVZ4OM.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-BRLVJW6I.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-FTL5AMXF.mjs → chunk-HO7AIKQS.mjs} +100 -31
- package/dist/lib/node-esm/chunk-HO7AIKQS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-55OOAFBS.mjs → chunk-JBQKU4K5.mjs} +29 -17
- package/dist/lib/node-esm/chunk-JBQKU4K5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AVONUBZO.mjs → chunk-LA6AVVH6.mjs} +148 -134
- package/dist/lib/node-esm/chunk-LA6AVVH6.mjs.map +7 -0
- package/dist/lib/node-esm/{identity-created-FOFH2WPI.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-72KTB4S2.mjs → intent-resolver-JO6L2VXC.mjs} +56 -32
- 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-FU2I5U2M.mjs → react-root-YFGL3B4J.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-L4SMKRYF.mjs → react-surface-CVAPDLEZ.mjs} +74 -14
- 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/{settings-C7GQAEDU.mjs → settings-TD76LTQS.mjs} +2 -2
- package/dist/lib/node-esm/{spaces-ready-WTISHKEH.mjs → spaces-ready-FJMGPAVV.mjs} +7 -7
- 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/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 +1 -1
- 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/ObjectSettings/AdvancedObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.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 +80 -12
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +8 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +45 -45
- package/src/{SpacePlugin.tsx → SpacePlugin.ts} +28 -8
- package/src/capabilities/app-graph-builder.ts +67 -4
- 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 +38 -18
- package/src/capabilities/react-surface.tsx +98 -10
- package/src/capabilities/spaces-ready.ts +3 -3
- package/src/components/CollectionMain.tsx +3 -3
- package/src/components/CollectionSection.tsx +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +6 -6
- package/src/components/CreateDialog/CreateObjectDialog.tsx +25 -12
- package/src/components/CreateDialog/CreateObjectPanel.tsx +43 -51
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +6 -5
- package/src/components/MembersContainer.tsx +4 -2
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +9 -1
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +2 -3
- package/src/components/ObjectSettings/ObjectSettingsContainer.tsx +2 -2
- package/src/components/SpacePluginSettings.tsx +24 -19
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +2 -2
- package/src/events.ts +1 -5
- package/src/translations.ts +30 -14
- package/src/types/index.ts +0 -1
- package/src/types/types.ts +29 -9
- package/src/util.tsx +111 -23
- package/dist/lib/browser/app-graph-builder-UNXUTH53.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-KPKPMC4M.mjs.map +0 -7
- package/dist/lib/browser/chunk-3LN4LJN6.mjs.map +0 -7
- package/dist/lib/browser/chunk-CF4FBDGP.mjs.map +0 -7
- package/dist/lib/browser/chunk-LGEIVEYC.mjs +0 -289
- package/dist/lib/browser/chunk-LGEIVEYC.mjs.map +0 -7
- package/dist/lib/browser/chunk-RRJIDXPY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TQPBDRXV.mjs.map +0 -7
- package/dist/lib/browser/identity-created-EM6GZDNF.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-K3ULKQ6V.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Y5AZBYA7.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-NXZAWHGI.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-6QDQEYHS.cjs.map +0 -7
- package/dist/lib/node/app-graph-serializer-6SWKHDE2.cjs.map +0 -7
- package/dist/lib/node/chunk-7GQGM4ZF.cjs.map +0 -7
- package/dist/lib/node/chunk-KDBPQ6L3.cjs.map +0 -7
- package/dist/lib/node/chunk-QCANR24R.cjs.map +0 -7
- package/dist/lib/node/chunk-SF3NU7EW.cjs.map +0 -7
- package/dist/lib/node/chunk-UUBPYP7E.cjs +0 -316
- package/dist/lib/node/chunk-UUBPYP7E.cjs.map +0 -7
- package/dist/lib/node/identity-created-KCJAOFZC.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-XR4S7LME.cjs.map +0 -7
- package/dist/lib/node/react-surface-H6XNU6DS.cjs.map +0 -7
- package/dist/lib/node/spaces-ready-KKFEN2MM.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-5EAV4CDH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-BRLVJW6I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-226REPOB.mjs +0 -290
- package/dist/lib/node-esm/chunk-226REPOB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4X4Y63ND.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55OOAFBS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AVONUBZO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FTL5AMXF.mjs.map +0 -7
- package/dist/lib/node-esm/identity-created-FOFH2WPI.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-72KTB4S2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-L4SMKRYF.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-WTISHKEH.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 -27
- /package/dist/lib/browser/{react-root-ECO7G77L.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/{settings-MU7O6JDD.mjs.map → settings-K54STC5A.mjs.map} +0 -0
- /package/dist/lib/browser/{state-6HOSHLIN.mjs.map → state-HRZ4VRXU.mjs.map} +0 -0
- /package/dist/lib/node/{react-root-Z2YM6JYC.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/{settings-XRAT3YMN.cjs.map → settings-P2EQ7VKQ.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-FU2I5U2M.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/{settings-C7GQAEDU.mjs.map → settings-TD76LTQS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-4ATRHSKA.mjs.map → state-XQNDCN37.mjs.map} +0 -0
|
@@ -66,7 +66,15 @@ export const AdvancedObjectSettings = ({ object }: AdvancedObjectSettingsProps)
|
|
|
66
66
|
{!adding && <ForeignKeys keys={keys} onDelete={handleDelete} />}
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
|
-
{adding &&
|
|
69
|
+
{adding && (
|
|
70
|
+
<Form
|
|
71
|
+
outerSpacing={false}
|
|
72
|
+
schema={ForeignKey}
|
|
73
|
+
values={initialValues}
|
|
74
|
+
onSave={handleSave}
|
|
75
|
+
onCancel={handleCancel}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
70
78
|
</>
|
|
71
79
|
);
|
|
72
80
|
};
|
|
@@ -6,7 +6,6 @@ import React, { type PropsWithChildren, useRef } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { Input, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
9
|
|
|
11
10
|
import { meta } from '../../meta';
|
|
12
11
|
|
|
@@ -24,7 +23,7 @@ export const BaseObjectSettings = ({ classNames, children, object }: BaseObjectS
|
|
|
24
23
|
// The form should only include fields with a specific settings annotation.
|
|
25
24
|
// Perhaps also including the field of the title annotation as well.
|
|
26
25
|
return (
|
|
27
|
-
|
|
26
|
+
<>
|
|
28
27
|
<Input.Root>
|
|
29
28
|
<Input.Label>{t('name label')}</Input.Label>
|
|
30
29
|
<Input.TextInput
|
|
@@ -43,6 +42,6 @@ export const BaseObjectSettings = ({ classNames, children, object }: BaseObjectS
|
|
|
43
42
|
/>
|
|
44
43
|
</Input.Root>
|
|
45
44
|
{children}
|
|
46
|
-
|
|
45
|
+
</>
|
|
47
46
|
);
|
|
48
47
|
};
|
|
@@ -21,8 +21,8 @@ export const ObjectSettingsContainer = ({ object, role }: ObjectSettingsContaine
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<Clipboard.Provider>
|
|
24
|
-
<StackItem.Content
|
|
25
|
-
<div className='
|
|
24
|
+
<StackItem.Content toolbar={false}>
|
|
25
|
+
<div role='none' className='overflow-y-auto pli-cardSpacingInline plb-cardSpacingBlock'>
|
|
26
26
|
<BaseObjectSettings object={object}>
|
|
27
27
|
<Surface role='base-object-settings' data={data} />
|
|
28
28
|
</BaseObjectSettings>
|
|
@@ -7,8 +7,8 @@ import React from 'react';
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
9
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
10
|
-
import { Input, toLocalizedString, useTranslation, List, ListItem,
|
|
11
|
-
import {
|
|
10
|
+
import { Input, toLocalizedString, useTranslation, List, ListItem, IconButton } from '@dxos/react-ui';
|
|
11
|
+
import { controlItemClasses, ControlPage, ControlSection, DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
12
12
|
|
|
13
13
|
import { SPACE_PLUGIN } from '../meta';
|
|
14
14
|
import { SpaceAction, type SpaceSettingsProps } from '../types';
|
|
@@ -16,33 +16,38 @@ import { getSpaceDisplayName } from '../util';
|
|
|
16
16
|
|
|
17
17
|
export const SpacePluginSettings = ({ settings }: { settings: SpaceSettingsProps }) => {
|
|
18
18
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
19
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
20
19
|
const client = useClient();
|
|
21
20
|
const spaces = useSpaces({ all: settings.showHidden });
|
|
21
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
22
|
|
|
23
23
|
// TODO(wittjosiah): Migrate to new form container.
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
<ControlPage>
|
|
26
|
+
<ControlSection title={t('space settings label')} description={t('space settings description')}>
|
|
27
|
+
<div className='pli-trimMd container-max-width'>
|
|
28
|
+
<DeprecatedFormInput label={t('show hidden spaces label')}>
|
|
29
|
+
<Input.Switch
|
|
30
|
+
checked={settings.showHidden}
|
|
31
|
+
onCheckedChange={(checked) => (settings.showHidden = !!checked)}
|
|
32
|
+
/>
|
|
33
|
+
</DeprecatedFormInput>
|
|
34
|
+
</div>
|
|
35
|
+
<List classNames={[controlItemClasses, 'flex flex-col gap-trimSm']}>
|
|
32
36
|
{spaces.map((space) => (
|
|
33
|
-
<ListItem.Root key={space.id}>
|
|
34
|
-
|
|
37
|
+
<ListItem.Root key={space.id} classNames='is-full items-center'>
|
|
38
|
+
{/* TODO(burdon): Should auto center and truncate; NOTE truncate doesn't work with flex grow. */}
|
|
39
|
+
<ListItem.Heading classNames='grow truncate !min-bs-0'>
|
|
35
40
|
{toLocalizedString(getSpaceDisplayName(space, { personal: space === client.spaces.default }), t)}
|
|
36
41
|
</ListItem.Heading>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
<IconButton
|
|
43
|
+
icon='ph--faders--regular'
|
|
44
|
+
onClick={() => dispatch(createIntent(SpaceAction.OpenSettings, { space }))}
|
|
45
|
+
label={t('open space settings label')}
|
|
46
|
+
/>
|
|
42
47
|
</ListItem.Root>
|
|
43
48
|
))}
|
|
44
49
|
</List>
|
|
45
|
-
</
|
|
46
|
-
</
|
|
50
|
+
</ControlSection>
|
|
51
|
+
</ControlPage>
|
|
47
52
|
);
|
|
48
53
|
};
|
|
@@ -174,8 +174,8 @@ export const SpaceSettingsContainer = ({ space }: SpaceSettingsContainerProps) =
|
|
|
174
174
|
autoSave
|
|
175
175
|
onSave={handleSave}
|
|
176
176
|
Custom={customElements}
|
|
177
|
-
|
|
178
|
-
classNames='container-max-width
|
|
177
|
+
outerSpacing={false}
|
|
178
|
+
classNames='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4'
|
|
179
179
|
/>
|
|
180
180
|
</ControlSection>
|
|
181
181
|
</ControlPage>
|
package/src/events.ts
CHANGED
|
@@ -10,9 +10,5 @@ export namespace SpaceEvents {
|
|
|
10
10
|
export const StateReady = Events.createStateEvent(`${SPACE_PLUGIN}/event/state-ready`);
|
|
11
11
|
export const SetupSettingsPanel = defineEvent(`${SPACE_PLUGIN}/event/setup-settings-panel`);
|
|
12
12
|
export const DefaultSpaceReady = defineEvent(`${SPACE_PLUGIN}/event/default-space-ready`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// TODO(wittjosiah): Factor out.
|
|
16
|
-
export namespace ThreadEvents {
|
|
17
|
-
export const SetupThread = defineEvent(`${SPACE_PLUGIN}/event/setup-thread`);
|
|
13
|
+
export const SpaceCreated = defineEvent(`${SPACE_PLUGIN}/event/space-created`);
|
|
18
14
|
}
|
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,15 +5,15 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { type AnyIntentChain } from '@dxos/app-framework';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
8
|
+
import { Type, type Obj } from '@dxos/echo';
|
|
9
9
|
import { type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
10
10
|
import { type PublicKey } from '@dxos/react-client';
|
|
11
11
|
// TODO(wittjosiah): This pulls in full client.
|
|
12
12
|
import { EchoObjectSchema, ReactiveObjectSchema, type Space, SpaceSchema } from '@dxos/react-client/echo';
|
|
13
13
|
import { CancellableInvitationObservable, Invitation } from '@dxos/react-client/invitations';
|
|
14
|
+
import { DataType, TypenameAnnotationId } from '@dxos/schema';
|
|
14
15
|
import { type ComplexMap } from '@dxos/util';
|
|
15
16
|
|
|
16
|
-
import { CollectionType } from './collection';
|
|
17
17
|
import { SPACE_PLUGIN } from '../meta';
|
|
18
18
|
|
|
19
19
|
export const SPACE_DIRECTORY_HANDLE = 'dxos.org/plugin/space/directory';
|
|
@@ -81,7 +81,7 @@ export type SpaceSettingsProps = Schema.Schema.Type<typeof SpaceSettingsSchema>;
|
|
|
81
81
|
|
|
82
82
|
export type SerializerMap = Record<string, TypedObjectSerializer>;
|
|
83
83
|
|
|
84
|
-
export interface TypedObjectSerializer<T extends
|
|
84
|
+
export interface TypedObjectSerializer<T extends Obj.Any = Type.Expando> {
|
|
85
85
|
serialize(params: { object: T }): Promise<string>;
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -219,7 +219,8 @@ export namespace SpaceAction {
|
|
|
219
219
|
|
|
220
220
|
export class OpenCreateObject extends Schema.TaggedClass<OpenCreateObject>()(`${SPACE_ACTION}/open-create-object`, {
|
|
221
221
|
input: Schema.Struct({
|
|
222
|
-
target: Schema.Union(SpaceSchema,
|
|
222
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
223
|
+
typename: Schema.optional(Schema.String),
|
|
223
224
|
navigable: Schema.optional(Schema.Boolean),
|
|
224
225
|
}),
|
|
225
226
|
output: Schema.Void,
|
|
@@ -228,7 +229,7 @@ export namespace SpaceAction {
|
|
|
228
229
|
export class AddObject extends Schema.TaggedClass<AddObject>()(`${SPACE_ACTION}/add-object`, {
|
|
229
230
|
input: Schema.Struct({
|
|
230
231
|
object: ReactiveObjectSchema,
|
|
231
|
-
target: Schema.Union(SpaceSchema,
|
|
232
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
232
233
|
hidden: Schema.optional(Schema.Boolean),
|
|
233
234
|
}),
|
|
234
235
|
output: Schema.Struct({
|
|
@@ -255,7 +256,7 @@ export namespace SpaceAction {
|
|
|
255
256
|
|
|
256
257
|
export const DeletionData = Schema.Struct({
|
|
257
258
|
objects: Schema.Array(EchoObjectSchema),
|
|
258
|
-
parentCollection:
|
|
259
|
+
parentCollection: DataType.Collection,
|
|
259
260
|
indices: Schema.Array(Schema.Number),
|
|
260
261
|
nestedObjectsList: Schema.Array(Schema.Array(EchoObjectSchema)),
|
|
261
262
|
wasActive: Schema.Array(Schema.String),
|
|
@@ -266,7 +267,7 @@ export namespace SpaceAction {
|
|
|
266
267
|
export class RemoveObjects extends Schema.TaggedClass<RemoveObjects>()(`${SPACE_ACTION}/remove-objects`, {
|
|
267
268
|
input: Schema.Struct({
|
|
268
269
|
objects: Schema.Array(EchoObjectSchema),
|
|
269
|
-
target: Schema.optional(
|
|
270
|
+
target: Schema.optional(DataType.Collection),
|
|
270
271
|
deletionData: Schema.optional(DeletionData),
|
|
271
272
|
}),
|
|
272
273
|
output: Schema.Void,
|
|
@@ -283,7 +284,7 @@ export namespace SpaceAction {
|
|
|
283
284
|
export class DuplicateObject extends Schema.TaggedClass<DuplicateObject>()(`${SPACE_ACTION}/duplicate-object`, {
|
|
284
285
|
input: Schema.Struct({
|
|
285
286
|
object: EchoObjectSchema,
|
|
286
|
-
target: Schema.Union(SpaceSchema,
|
|
287
|
+
target: Schema.Union(SpaceSchema, DataType.Collection),
|
|
287
288
|
}),
|
|
288
289
|
output: Schema.Void,
|
|
289
290
|
}) {}
|
|
@@ -302,7 +303,26 @@ export namespace CollectionAction {
|
|
|
302
303
|
name: Schema.optional(Schema.String),
|
|
303
304
|
}),
|
|
304
305
|
output: Schema.Struct({
|
|
305
|
-
object:
|
|
306
|
+
object: DataType.Collection,
|
|
306
307
|
}),
|
|
307
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
|
+
) {}
|
|
308
328
|
}
|
package/src/util.tsx
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
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 { chain, createIntent, LayoutAction, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
8
9
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
10
|
import { EXPANDO_TYPENAME } from '@dxos/echo-schema';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
@@ -17,12 +18,15 @@ import {
|
|
|
17
18
|
type InvokeParams,
|
|
18
19
|
type Node,
|
|
19
20
|
type NodeArg,
|
|
21
|
+
isGraphNode,
|
|
20
22
|
} from '@dxos/plugin-graph';
|
|
21
|
-
import { fullyQualifiedId, getSpace, type QueryResult, SpaceState, type Space } from '@dxos/react-client/echo';
|
|
23
|
+
import { fullyQualifiedId, getSpace, type QueryResult, SpaceState, type Space, isSpace } from '@dxos/react-client/echo';
|
|
22
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';
|
|
23
27
|
|
|
24
28
|
import { SPACE_PLUGIN } from './meta';
|
|
25
|
-
import {
|
|
29
|
+
import { SpaceAction, SPACE_TYPE, type ObjectForm } from './types';
|
|
26
30
|
|
|
27
31
|
export const SPACES = `${SPACE_PLUGIN}-spaces`;
|
|
28
32
|
export const COMPOSER_SPACE_LOCK = 'dxos.org/plugin/space/lock';
|
|
@@ -58,13 +62,11 @@ export const getSpaceDisplayName = (
|
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
const getCollectionGraphNodePartials = ({
|
|
61
|
-
navigable,
|
|
62
65
|
collection,
|
|
63
66
|
space,
|
|
64
67
|
resolve,
|
|
65
68
|
}: {
|
|
66
|
-
|
|
67
|
-
collection: CollectionType;
|
|
69
|
+
collection: DataType.Collection;
|
|
68
70
|
space: Space;
|
|
69
71
|
resolve: (typename: string) => Record<string, any>;
|
|
70
72
|
}) => {
|
|
@@ -134,6 +136,36 @@ const getCollectionGraphNodePartials = ({
|
|
|
134
136
|
};
|
|
135
137
|
};
|
|
136
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
|
+
|
|
137
169
|
const checkPendingMigration = (space: Space) => {
|
|
138
170
|
return (
|
|
139
171
|
space.state.get() === SpaceState.SPACE_REQUIRES_MIGRATION ||
|
|
@@ -157,10 +189,11 @@ export const constructSpaceNode = ({
|
|
|
157
189
|
resolve: (typename: string) => Record<string, any>;
|
|
158
190
|
}) => {
|
|
159
191
|
const hasPendingMigration = checkPendingMigration(space);
|
|
160
|
-
const collection =
|
|
192
|
+
const collection =
|
|
193
|
+
space.state.get() === SpaceState.SPACE_READY && space.properties[Type.getTypename(DataType.Collection)]?.target;
|
|
161
194
|
const partials =
|
|
162
|
-
space.state.get() === SpaceState.SPACE_READY && collection
|
|
163
|
-
? getCollectionGraphNodePartials({ collection, space, resolve
|
|
195
|
+
space.state.get() === SpaceState.SPACE_READY && Obj.instanceOf(DataType.Collection, collection)
|
|
196
|
+
? getCollectionGraphNodePartials({ collection, space, resolve })
|
|
164
197
|
: {};
|
|
165
198
|
|
|
166
199
|
return {
|
|
@@ -179,6 +212,10 @@ export const constructSpaceNode = ({
|
|
|
179
212
|
: undefined,
|
|
180
213
|
disabled: !navigable || space.state.get() !== SpaceState.SPACE_READY || hasPendingMigration,
|
|
181
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
|
+
},
|
|
182
219
|
},
|
|
183
220
|
nodes: [
|
|
184
221
|
{
|
|
@@ -297,11 +334,13 @@ export const constructSpaceActions = ({
|
|
|
297
334
|
export const createObjectNode = ({
|
|
298
335
|
space,
|
|
299
336
|
object,
|
|
337
|
+
droppable = true,
|
|
300
338
|
navigable = false,
|
|
301
339
|
resolve,
|
|
302
340
|
}: {
|
|
303
341
|
space: Space;
|
|
304
342
|
object: Obj.Any;
|
|
343
|
+
droppable?: boolean;
|
|
305
344
|
navigable?: boolean;
|
|
306
345
|
resolve: (typename: string) => Record<string, any>;
|
|
307
346
|
}) => {
|
|
@@ -315,9 +354,10 @@ export const createObjectNode = ({
|
|
|
315
354
|
return undefined;
|
|
316
355
|
}
|
|
317
356
|
|
|
318
|
-
const partials =
|
|
319
|
-
object
|
|
320
|
-
|
|
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 })
|
|
321
361
|
: metadata.graphProps;
|
|
322
362
|
|
|
323
363
|
return {
|
|
@@ -326,7 +366,6 @@ export const createObjectNode = ({
|
|
|
326
366
|
cacheable: ['label', 'icon', 'role'],
|
|
327
367
|
data: object,
|
|
328
368
|
properties: {
|
|
329
|
-
...partials,
|
|
330
369
|
// TODO(burdon): Use annotation to get the name field.
|
|
331
370
|
label: metadata.label?.(object) ||
|
|
332
371
|
(object as any).name || ['object name placeholder', { ns: type, default: 'New object' }],
|
|
@@ -334,6 +373,10 @@ export const createObjectNode = ({
|
|
|
334
373
|
testId: 'spacePlugin.object',
|
|
335
374
|
persistenceClass: 'echo',
|
|
336
375
|
persistenceKey: space?.id,
|
|
376
|
+
canDrop: (source: TreeData) => {
|
|
377
|
+
return droppable && isGraphNode(source.item) && Obj.isObject(source.item.data);
|
|
378
|
+
},
|
|
379
|
+
...partials,
|
|
337
380
|
},
|
|
338
381
|
};
|
|
339
382
|
};
|
|
@@ -342,18 +385,26 @@ export const constructObjectActions = ({
|
|
|
342
385
|
object,
|
|
343
386
|
graph,
|
|
344
387
|
dispatch,
|
|
388
|
+
objectForms,
|
|
345
389
|
navigable = false,
|
|
346
390
|
}: {
|
|
347
391
|
object: Obj.Any;
|
|
348
392
|
graph: ReadableGraph;
|
|
349
393
|
dispatch: PromiseIntentDispatcher;
|
|
394
|
+
objectForms: ObjectForm<any>[];
|
|
350
395
|
navigable?: boolean;
|
|
351
396
|
}) => {
|
|
352
397
|
const space = getSpace(object);
|
|
353
398
|
invariant(space, 'Space not found');
|
|
354
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
|
+
|
|
355
406
|
const actions: NodeArg<ActionData>[] = [
|
|
356
|
-
...(object
|
|
407
|
+
...(Obj.instanceOf(DataType.Collection, object)
|
|
357
408
|
? [
|
|
358
409
|
{
|
|
359
410
|
id: getId(SpaceAction.OpenCreateObject._tag),
|
|
@@ -370,6 +421,38 @@ export const constructObjectActions = ({
|
|
|
370
421
|
},
|
|
371
422
|
]
|
|
372
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
|
+
: []),
|
|
373
456
|
{
|
|
374
457
|
id: getId(SpaceAction.RenameObject._tag),
|
|
375
458
|
type: ACTION_TYPE,
|
|
@@ -378,14 +461,15 @@ export const constructObjectActions = ({
|
|
|
378
461
|
},
|
|
379
462
|
properties: {
|
|
380
463
|
label: [
|
|
381
|
-
object
|
|
464
|
+
Obj.instanceOf(DataType.Collection, object) ? 'rename collection label' : 'rename object label',
|
|
382
465
|
{ ns: SPACE_PLUGIN },
|
|
383
466
|
],
|
|
384
467
|
icon: 'ph--pencil-simple-line--regular',
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
468
|
+
disposition: 'list-item',
|
|
469
|
+
// TODO(wittjosiah): Not working.
|
|
470
|
+
// keyBinding: {
|
|
471
|
+
// macos: 'shift+F6',
|
|
472
|
+
// },
|
|
389
473
|
testId: 'spacePlugin.renameObject',
|
|
390
474
|
},
|
|
391
475
|
},
|
|
@@ -395,20 +479,22 @@ export const constructObjectActions = ({
|
|
|
395
479
|
data: async () => {
|
|
396
480
|
const collection = graph
|
|
397
481
|
.getConnections(fullyQualifiedId(object), 'inbound')
|
|
398
|
-
.find(({ data }) => data
|
|
482
|
+
.find(({ data }) => Obj.instanceOf(DataType.Collection, data))?.data;
|
|
399
483
|
await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));
|
|
400
484
|
},
|
|
401
485
|
properties: {
|
|
402
486
|
label: [
|
|
403
|
-
object
|
|
487
|
+
Obj.instanceOf(DataType.Collection, object) ? 'delete collection label' : 'delete object label',
|
|
404
488
|
{ ns: SPACE_PLUGIN },
|
|
405
489
|
],
|
|
406
490
|
icon: 'ph--trash--regular',
|
|
407
|
-
|
|
491
|
+
disposition: 'list-item',
|
|
492
|
+
// TODO(wittjosiah): This is a browser shortcut.
|
|
493
|
+
// keyBinding: object instanceof CollectionType ? undefined : 'shift+meta+Backspace',
|
|
408
494
|
testId: 'spacePlugin.deleteObject',
|
|
409
495
|
},
|
|
410
496
|
},
|
|
411
|
-
...(navigable || !(object
|
|
497
|
+
...(navigable || (!Obj.instanceOf(DataType.Collection, object) && !Obj.instanceOf(DataType.QueryCollection, object))
|
|
412
498
|
? [
|
|
413
499
|
{
|
|
414
500
|
id: getId('copy-link'),
|
|
@@ -420,6 +506,7 @@ export const constructObjectActions = ({
|
|
|
420
506
|
properties: {
|
|
421
507
|
label: ['copy link label', { ns: SPACE_PLUGIN }],
|
|
422
508
|
icon: 'ph--link--regular',
|
|
509
|
+
disposition: 'list-item',
|
|
423
510
|
testId: 'spacePlugin.copyLink',
|
|
424
511
|
},
|
|
425
512
|
},
|
|
@@ -435,6 +522,7 @@ export const constructObjectActions = ({
|
|
|
435
522
|
properties: {
|
|
436
523
|
label: ['expose object label', { ns: SPACE_PLUGIN }],
|
|
437
524
|
icon: 'ph--eye--regular',
|
|
525
|
+
disposition: 'heading-list-item',
|
|
438
526
|
testId: 'spacePlugin.exposeObject',
|
|
439
527
|
},
|
|
440
528
|
},
|