@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
|
@@ -3,16 +3,27 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Schema } from 'effect';
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
6
|
+
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
Capabilities,
|
|
10
|
+
contributes,
|
|
11
|
+
createSurface,
|
|
12
|
+
Surface,
|
|
13
|
+
useCapabilities,
|
|
14
|
+
useCapability,
|
|
15
|
+
useLayout,
|
|
16
|
+
} from '@dxos/app-framework';
|
|
17
|
+
import { Obj, Type } from '@dxos/echo';
|
|
10
18
|
import { findAnnotation } from '@dxos/effect';
|
|
11
19
|
import { SettingsStore } from '@dxos/local-storage';
|
|
20
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
21
|
+
import { useClient } from '@dxos/react-client';
|
|
12
22
|
import { getSpace, isLiveObject, isSpace, parseId, SpaceState, useSpace, type Space } from '@dxos/react-client/echo';
|
|
13
|
-
import { Input } from '@dxos/react-ui';
|
|
14
|
-
import { type InputProps } from '@dxos/react-ui-form';
|
|
23
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
24
|
+
import { type InputProps, SelectInput } from '@dxos/react-ui-form';
|
|
15
25
|
import { HuePicker, IconPicker } from '@dxos/react-ui-pickers';
|
|
26
|
+
import { DataType, type TypenameAnnotation, TypenameAnnotationId } from '@dxos/schema';
|
|
16
27
|
import { type JoinPanelProps } from '@dxos/shell/react';
|
|
17
28
|
|
|
18
29
|
import { SpaceCapabilities } from './capabilities';
|
|
@@ -42,12 +53,14 @@ import {
|
|
|
42
53
|
type CreateObjectDialogProps,
|
|
43
54
|
} from '../components';
|
|
44
55
|
import { SPACE_PLUGIN } from '../meta';
|
|
45
|
-
import {
|
|
56
|
+
import { HueAnnotationId, IconAnnotationId, type SpaceSettingsProps } from '../types';
|
|
46
57
|
|
|
47
58
|
type ReactSurfaceOptions = {
|
|
48
59
|
createInvitationUrl: (invitationCode: string) => string;
|
|
49
60
|
};
|
|
50
61
|
|
|
62
|
+
const OMIT = [Type.getTypename(DataType.Collection), Type.getTypename(DataType.QueryCollection)];
|
|
63
|
+
|
|
51
64
|
export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
52
65
|
contributes(Capabilities.ReactSurface, [
|
|
53
66
|
createSurface({
|
|
@@ -58,7 +71,10 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
58
71
|
isSpace(data.subject) && data.subject.state.get() === SpaceState.SPACE_READY,
|
|
59
72
|
component: ({ data, role, ...rest }) => (
|
|
60
73
|
<Surface
|
|
61
|
-
data={{
|
|
74
|
+
data={{
|
|
75
|
+
id: data.subject.id,
|
|
76
|
+
subject: data.subject.properties[Type.getTypename(DataType.Collection)]?.target,
|
|
77
|
+
}}
|
|
62
78
|
role={role}
|
|
63
79
|
{...rest}
|
|
64
80
|
/>
|
|
@@ -68,7 +84,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
68
84
|
id: `${SPACE_PLUGIN}/collection-fallback`,
|
|
69
85
|
role: 'article',
|
|
70
86
|
position: 'fallback',
|
|
71
|
-
filter: (data): data is { subject:
|
|
87
|
+
filter: (data): data is { subject: DataType.Collection } => Obj.instanceOf(DataType.Collection, data.subject),
|
|
72
88
|
component: ({ data }) => <CollectionMain collection={data.subject} />,
|
|
73
89
|
}),
|
|
74
90
|
createSurface({
|
|
@@ -186,6 +202,78 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
186
202
|
);
|
|
187
203
|
},
|
|
188
204
|
}),
|
|
205
|
+
createSurface({
|
|
206
|
+
id: `${SPACE_PLUGIN}/typename-form-input`,
|
|
207
|
+
role: 'form-input',
|
|
208
|
+
filter: (
|
|
209
|
+
data,
|
|
210
|
+
): data is { prop: string; schema: Schema.Schema<any>; target: Space | DataType.Collection | undefined } => {
|
|
211
|
+
if (data.prop !== 'typename') {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const annotation = findAnnotation((data.schema as Schema.Schema.All).ast, TypenameAnnotationId);
|
|
216
|
+
return !!annotation;
|
|
217
|
+
},
|
|
218
|
+
component: ({ data: { schema, target }, ...inputProps }) => {
|
|
219
|
+
const { t } = useTranslation();
|
|
220
|
+
const client = useClient();
|
|
221
|
+
const props = inputProps as any as InputProps;
|
|
222
|
+
const space = isSpace(target) ? target : getSpace(target);
|
|
223
|
+
if (!space) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const annotation = findAnnotation<TypenameAnnotation[]>(schema.ast, TypenameAnnotationId)!;
|
|
228
|
+
|
|
229
|
+
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
230
|
+
const whitelistedTypenames = useMemo(
|
|
231
|
+
() => new Set(schemaWhitelists.flatMap((typeArray) => typeArray.map((type) => type.typename))),
|
|
232
|
+
[schemaWhitelists],
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
const objectForms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
236
|
+
const objectFormTypenames = useMemo(
|
|
237
|
+
() =>
|
|
238
|
+
new Set(
|
|
239
|
+
objectForms
|
|
240
|
+
.map((form) => Type.getTypename(form.objectSchema))
|
|
241
|
+
// TODO(wittjosiah): Remove.
|
|
242
|
+
.filter((typename) => !OMIT.includes(typename)),
|
|
243
|
+
),
|
|
244
|
+
[objectForms],
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const fixed = client.graph.schemaRegistry.schemas.filter((schema) => {
|
|
248
|
+
const limitedStatic =
|
|
249
|
+
annotation.includes('limited-static') && whitelistedTypenames.has(Type.getTypename(schema));
|
|
250
|
+
const objectForm = annotation.includes('object-form') && objectFormTypenames.has(Type.getTypename(schema));
|
|
251
|
+
return annotation.includes('static') || limitedStatic || objectForm;
|
|
252
|
+
});
|
|
253
|
+
const dynamic = space?.db.schemaRegistry.query().runSync();
|
|
254
|
+
const typenames = Array.from(
|
|
255
|
+
new Set<string>([
|
|
256
|
+
...(annotation.includes('limited-static') ||
|
|
257
|
+
annotation.includes('static') ||
|
|
258
|
+
annotation.includes('object-form')
|
|
259
|
+
? fixed.map((schema) => Type.getTypename(schema))
|
|
260
|
+
: []),
|
|
261
|
+
...(annotation.includes('dynamic') ? dynamic.map((schema) => schema.typename) : []),
|
|
262
|
+
]),
|
|
263
|
+
).sort();
|
|
264
|
+
|
|
265
|
+
const options = useMemo(
|
|
266
|
+
() =>
|
|
267
|
+
typenames.map((typename) => ({
|
|
268
|
+
value: typename,
|
|
269
|
+
label: t('typename label', { ns: typename, defaultValue: typename }),
|
|
270
|
+
})),
|
|
271
|
+
[t, typenames],
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
return <SelectInput {...props} options={options} />;
|
|
275
|
+
},
|
|
276
|
+
}),
|
|
189
277
|
createSurface({
|
|
190
278
|
id: POPOVER_RENAME_SPACE,
|
|
191
279
|
role: 'popover',
|
|
@@ -240,7 +328,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
240
328
|
const space = isSpace(data.subject) ? data.subject : getSpace(data.subject);
|
|
241
329
|
const object = isSpace(data.subject)
|
|
242
330
|
? data.subject.state.get() === SpaceState.SPACE_READY
|
|
243
|
-
? (space?.properties[
|
|
331
|
+
? (space?.properties[Type.getTypename(DataType.Collection)]?.target as DataType.Collection)
|
|
244
332
|
: undefined
|
|
245
333
|
: data.subject;
|
|
246
334
|
|
|
@@ -250,7 +338,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
250
338
|
createSurface({
|
|
251
339
|
id: `${SPACE_PLUGIN}/collection-section`,
|
|
252
340
|
role: 'section',
|
|
253
|
-
filter: (data): data is { subject:
|
|
341
|
+
filter: (data): data is { subject: DataType.Collection } => Obj.instanceOf(DataType.Collection, data.subject),
|
|
254
342
|
component: ({ data }) => <CollectionSection collection={data.subject} />,
|
|
255
343
|
}),
|
|
256
344
|
createSurface({
|
|
@@ -31,7 +31,7 @@ export default async (context: PluginContext) => {
|
|
|
31
31
|
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
32
32
|
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
33
33
|
const layout = context.getCapability(Capabilities.Layout);
|
|
34
|
-
const deck = context.
|
|
34
|
+
const deck = context.getCapabilities(DeckCapabilities.DeckState)[0];
|
|
35
35
|
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
36
36
|
const state = context.getCapability(SpaceCapabilities.MutableState);
|
|
37
37
|
const client = context.getCapability(ClientCapabilities.Client);
|
|
@@ -39,7 +39,7 @@ export default async (context: PluginContext) => {
|
|
|
39
39
|
const defaultSpace = client.spaces.default;
|
|
40
40
|
await defaultSpace.waitUntilReady();
|
|
41
41
|
|
|
42
|
-
if (deck
|
|
42
|
+
if (deck?.activeDeck === 'default') {
|
|
43
43
|
await dispatch(createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: defaultSpace.id }));
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -54,7 +54,7 @@ export default async (context: PluginContext) => {
|
|
|
54
54
|
if (!spacesOrder) {
|
|
55
55
|
// TODO(wittjosiah): Cannot be a Folder because Spaces are not TypedObjects so can't be saved in the database.
|
|
56
56
|
// Instead, we store order as an array of space ids.
|
|
57
|
-
defaultSpace.db.add(Obj.make({ key: SHARED, order: [] }));
|
|
57
|
+
defaultSpace.db.add(Obj.make(Type.Expando, { key: SHARED, order: [] }));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// Await missing objects.
|
|
@@ -6,11 +6,11 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useTranslation } from '@dxos/react-ui';
|
|
8
8
|
import { baseSurface, descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
9
|
+
import { type DataType } from '@dxos/schema';
|
|
9
10
|
|
|
10
11
|
import { SPACE_PLUGIN } from '../meta';
|
|
11
|
-
import type { CollectionType } from '../types';
|
|
12
12
|
|
|
13
|
-
export const CollectionMain = ({ collection }: { collection:
|
|
13
|
+
export const CollectionMain = ({ collection }: { collection: DataType.Collection }) => {
|
|
14
14
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -21,7 +21,7 @@ export const CollectionMain = ({ collection }: { collection: CollectionType }) =
|
|
|
21
21
|
>
|
|
22
22
|
<p
|
|
23
23
|
role='alert'
|
|
24
|
-
className={mx(descriptionMessage, 'rounded-
|
|
24
|
+
className={mx(descriptionMessage, 'rounded-md p-8 font-normal text-lg max-is-[24rem] break-words')}
|
|
25
25
|
>
|
|
26
26
|
{collection.name ?? t('unnamed collection label')}
|
|
27
27
|
</p>
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { type DataType } from '@dxos/schema';
|
|
8
9
|
|
|
9
10
|
import { SPACE_PLUGIN } from '../meta';
|
|
10
|
-
import type { CollectionType } from '../types';
|
|
11
11
|
|
|
12
|
-
export const CollectionSection = ({ collection }: { collection:
|
|
12
|
+
export const CollectionSection = ({ collection }: { collection: DataType.Collection }) => {
|
|
13
13
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
14
14
|
// TODO(wittjosiah): Better placeholder.
|
|
15
15
|
return (
|
|
@@ -7,16 +7,16 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
8
|
import React, { useEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
import { Filter, Obj } from '@dxos/echo';
|
|
10
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
11
11
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { Dialog } from '@dxos/react-ui';
|
|
14
|
+
import { DataType } from '@dxos/schema';
|
|
14
15
|
import { osTranslations } from '@dxos/shell/react';
|
|
15
16
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
16
17
|
|
|
17
18
|
import { CreateObjectDialog, type CreateObjectDialogProps } from './CreateObjectDialog';
|
|
18
19
|
import translations from '../../translations';
|
|
19
|
-
import { CollectionType } from '../../types';
|
|
20
20
|
|
|
21
21
|
const Story = (args: CreateObjectDialogProps) => {
|
|
22
22
|
return (
|
|
@@ -34,7 +34,7 @@ const meta: Meta<typeof CreateObjectDialog> = {
|
|
|
34
34
|
component: CreateObjectDialog,
|
|
35
35
|
render: Story,
|
|
36
36
|
decorators: [
|
|
37
|
-
withClientProvider({ createIdentity: true, createSpace: true, types: [
|
|
37
|
+
withClientProvider({ createIdentity: true, createSpace: true, types: [DataType.Collection] }),
|
|
38
38
|
withTheme,
|
|
39
39
|
withLayout(),
|
|
40
40
|
],
|
|
@@ -49,7 +49,7 @@ export default meta;
|
|
|
49
49
|
export const Default: StoryObj<typeof CreateObjectDialog> = {};
|
|
50
50
|
|
|
51
51
|
export const Typename: StoryObj<typeof CreateObjectDialog> = {
|
|
52
|
-
args: { typename:
|
|
52
|
+
args: { typename: Type.getTypename(DataType.Collection) },
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const TargetSpace: StoryObj<typeof CreateObjectDialog> = {
|
|
@@ -67,11 +67,11 @@ export const TargetSpace: StoryObj<typeof CreateObjectDialog> = {
|
|
|
67
67
|
export const TargetCollection: StoryObj<typeof CreateObjectDialog> = {
|
|
68
68
|
render: (args) => {
|
|
69
69
|
const space = useSpace();
|
|
70
|
-
const [collection] = useQuery(space, Filter.type(
|
|
70
|
+
const [collection] = useQuery(space, Filter.type(DataType.Collection));
|
|
71
71
|
|
|
72
72
|
useEffect(() => {
|
|
73
73
|
if (space) {
|
|
74
|
-
space.db.add(Obj.make(
|
|
74
|
+
space.db.add(Obj.make(DataType.Collection, { name: 'My Collection', objects: [] }));
|
|
75
75
|
}
|
|
76
76
|
}, [space]);
|
|
77
77
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { pipe } from 'effect';
|
|
6
|
-
import React, { useCallback, useRef } from 'react';
|
|
6
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
@@ -14,11 +14,14 @@ import {
|
|
|
14
14
|
useIntentDispatcher,
|
|
15
15
|
usePluginManager,
|
|
16
16
|
} from '@dxos/app-framework';
|
|
17
|
-
import { type Obj } from '@dxos/echo';
|
|
17
|
+
import { Query, Type, type Obj } from '@dxos/echo';
|
|
18
18
|
import { invariant } from '@dxos/invariant';
|
|
19
19
|
import { useClient } from '@dxos/react-client';
|
|
20
|
-
import { getSpace, isLiveObject, isSpace, useSpaces } from '@dxos/react-client/echo';
|
|
20
|
+
import { getSpace, isLiveObject, isSpace, type Space, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
21
21
|
import { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';
|
|
22
|
+
import { cardDialogContent, cardDialogHeader } from '@dxos/react-ui-stack';
|
|
23
|
+
import { DataType } from '@dxos/schema';
|
|
24
|
+
import { isNonNullable } from '@dxos/util';
|
|
22
25
|
|
|
23
26
|
import { CreateObjectPanel, type CreateObjectPanelProps } from './CreateObjectPanel';
|
|
24
27
|
import { SpaceCapabilities } from '../../capabilities';
|
|
@@ -32,8 +35,8 @@ export type CreateObjectDialogProps = Pick<CreateObjectPanelProps, 'target' | 't
|
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
export const CreateObjectDialog = ({
|
|
35
|
-
target,
|
|
36
|
-
typename,
|
|
38
|
+
target: initialTarget,
|
|
39
|
+
typename: initialTypename,
|
|
37
40
|
name,
|
|
38
41
|
shouldNavigate: _shouldNavigate,
|
|
39
42
|
}: CreateObjectDialogProps) => {
|
|
@@ -44,6 +47,11 @@ export const CreateObjectDialog = ({
|
|
|
44
47
|
const spaces = useSpaces();
|
|
45
48
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
46
49
|
const forms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
50
|
+
const [target, setTarget] = useState<Space | DataType.Collection | undefined>(initialTarget);
|
|
51
|
+
const [typename, setTypename] = useState<string | undefined>(initialTypename);
|
|
52
|
+
const space = isSpace(target) ? target : getSpace(target);
|
|
53
|
+
const queryCollections = useQuery(space, Query.type(DataType.QueryCollection));
|
|
54
|
+
const hiddenTypenames = queryCollections.map((collection) => collection.query.typename).filter(isNonNullable);
|
|
47
55
|
|
|
48
56
|
const resolve = useCallback<NonNullable<CreateObjectPanelProps['resolve']>>(
|
|
49
57
|
(typename) =>
|
|
@@ -52,7 +60,7 @@ export const CreateObjectDialog = ({
|
|
|
52
60
|
);
|
|
53
61
|
|
|
54
62
|
const handleCreateObject = useCallback<NonNullable<CreateObjectPanelProps['onCreateObject']>>(
|
|
55
|
-
async ({ form,
|
|
63
|
+
async ({ form, data = {} }) => {
|
|
56
64
|
if (!target) {
|
|
57
65
|
// TODO(wittjosiah): UI feedback.
|
|
58
66
|
return;
|
|
@@ -66,7 +74,9 @@ export const CreateObjectDialog = ({
|
|
|
66
74
|
const result = await dispatch(form.getIntent(data, { space }));
|
|
67
75
|
const object = result.data?.object;
|
|
68
76
|
if (isLiveObject(object)) {
|
|
69
|
-
|
|
77
|
+
// TODO(wittjosiah): Selection in navtree isn't working as expected when hidden typenames evals to true.
|
|
78
|
+
const hidden = form.hidden || hiddenTypenames.includes(Type.getTypename(form.objectSchema));
|
|
79
|
+
const addObjectIntent = createIntent(SpaceAction.AddObject, { target, object, hidden });
|
|
70
80
|
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
71
81
|
if (shouldNavigate(object)) {
|
|
72
82
|
await dispatch(pipe(addObjectIntent, chain(LayoutAction.Open, { part: 'main' })));
|
|
@@ -75,15 +85,17 @@ export const CreateObjectDialog = ({
|
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
87
|
},
|
|
78
|
-
[dispatch, resolve],
|
|
88
|
+
[dispatch, target, resolve, hiddenTypenames, _shouldNavigate],
|
|
79
89
|
);
|
|
80
90
|
|
|
81
91
|
return (
|
|
82
92
|
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
83
93
|
// Consider factoring it out to the tabs package.
|
|
84
|
-
<Dialog.Content classNames=
|
|
85
|
-
<div role='none' className=
|
|
86
|
-
<Dialog.Title>
|
|
94
|
+
<Dialog.Content classNames={cardDialogContent}>
|
|
95
|
+
<div role='none' className={cardDialogHeader}>
|
|
96
|
+
<Dialog.Title>
|
|
97
|
+
{t('create object dialog title', { object: t('typename label', { ns: typename, defaultValue: 'Item' }) })}
|
|
98
|
+
</Dialog.Title>
|
|
87
99
|
<Dialog.Close asChild>
|
|
88
100
|
<Button ref={closeRef} density='fine' variant='ghost' autoFocus>
|
|
89
101
|
<Icon icon='ph--x--regular' size={4} />
|
|
@@ -92,7 +104,6 @@ export const CreateObjectDialog = ({
|
|
|
92
104
|
</div>
|
|
93
105
|
|
|
94
106
|
<CreateObjectPanel
|
|
95
|
-
classNames='p-4'
|
|
96
107
|
forms={forms}
|
|
97
108
|
spaces={spaces}
|
|
98
109
|
target={target}
|
|
@@ -100,6 +111,8 @@ export const CreateObjectDialog = ({
|
|
|
100
111
|
name={name}
|
|
101
112
|
defaultSpaceId={client.spaces.default.id}
|
|
102
113
|
resolve={resolve}
|
|
114
|
+
onTargetChange={setTarget}
|
|
115
|
+
onTypenameChange={setTypename}
|
|
103
116
|
onCreateObject={handleCreateObject}
|
|
104
117
|
/>
|
|
105
118
|
</Dialog.Content>
|
|
@@ -2,52 +2,49 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Type } from '@dxos/echo';
|
|
8
8
|
import { getTypeAnnotation, type TypeAnnotation } from '@dxos/echo-schema';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
9
|
import { type SpaceId, type Space } from '@dxos/react-client/echo';
|
|
11
|
-
import { Icon,
|
|
10
|
+
import { Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
11
|
import { Form } from '@dxos/react-ui-form';
|
|
13
12
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
14
|
-
import {
|
|
13
|
+
import { cardDialogOverflow, cardDialogPaddedOverflow, cardDialogSearchListRoot } from '@dxos/react-ui-stack';
|
|
14
|
+
import { type DataType } from '@dxos/schema';
|
|
15
15
|
import { isNonNullable, type MaybePromise } from '@dxos/util';
|
|
16
16
|
|
|
17
17
|
import { useInputSurfaceLookup } from '../../hooks';
|
|
18
18
|
import { SPACE_PLUGIN } from '../../meta';
|
|
19
|
-
import { type ObjectForm
|
|
19
|
+
import { type ObjectForm } from '../../types';
|
|
20
20
|
import { getSpaceDisplayName } from '../../util';
|
|
21
21
|
|
|
22
|
-
export type CreateObjectPanelProps =
|
|
22
|
+
export type CreateObjectPanelProps = {
|
|
23
23
|
forms: ObjectForm[];
|
|
24
24
|
spaces: Space[];
|
|
25
25
|
typename?: string;
|
|
26
|
-
target?: Space |
|
|
26
|
+
target?: Space | DataType.Collection;
|
|
27
27
|
name?: string;
|
|
28
28
|
defaultSpaceId?: SpaceId;
|
|
29
29
|
resolve?: (typename: string) => Record<string, any>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}) => MaybePromise<void>;
|
|
35
|
-
}>;
|
|
30
|
+
onTargetChange?: (target: Space) => void;
|
|
31
|
+
onTypenameChange?: (typename: string) => void;
|
|
32
|
+
onCreateObject?: (params: { form: ObjectForm; data?: Record<string, any> }) => MaybePromise<void>;
|
|
33
|
+
};
|
|
36
34
|
|
|
37
35
|
export const CreateObjectPanel = ({
|
|
38
|
-
classNames,
|
|
39
36
|
forms,
|
|
40
37
|
spaces,
|
|
41
|
-
typename
|
|
42
|
-
target
|
|
38
|
+
typename,
|
|
39
|
+
target,
|
|
43
40
|
name: initialName,
|
|
44
41
|
defaultSpaceId,
|
|
45
42
|
resolve,
|
|
43
|
+
onTargetChange,
|
|
44
|
+
onTypenameChange,
|
|
46
45
|
onCreateObject,
|
|
47
46
|
}: CreateObjectPanelProps) => {
|
|
48
47
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
49
|
-
const [typename, setTypename] = useState<string | undefined>(initialTypename);
|
|
50
|
-
const [target, setTarget] = useState<Space | CollectionType | undefined>(initialTarget);
|
|
51
48
|
const form = forms.find((form) => Type.getTypename(form.objectSchema) === typename);
|
|
52
49
|
const options: TypeAnnotation[] = forms
|
|
53
50
|
.map((form) => getTypeAnnotation(form.objectSchema))
|
|
@@ -60,67 +57,63 @@ export const CreateObjectPanel = ({
|
|
|
60
57
|
|
|
61
58
|
const handleCreateObject = useCallback(
|
|
62
59
|
async (props: Record<string, any>) => {
|
|
63
|
-
if (!form
|
|
60
|
+
if (!form) {
|
|
64
61
|
return;
|
|
65
62
|
}
|
|
66
|
-
await onCreateObject?.({ form,
|
|
63
|
+
await onCreateObject?.({ form, data: props });
|
|
67
64
|
},
|
|
68
|
-
[onCreateObject, form
|
|
65
|
+
[onCreateObject, form],
|
|
69
66
|
);
|
|
70
67
|
|
|
71
68
|
const handleSetTypename = useCallback(
|
|
72
69
|
async (typename: string) => {
|
|
73
|
-
invariant(target, 'target is required');
|
|
74
70
|
const form = forms.find((form) => getTypeAnnotation(form.objectSchema)?.typename === typename);
|
|
75
71
|
if (form && !form.formSchema) {
|
|
76
|
-
await onCreateObject?.({ form
|
|
72
|
+
await onCreateObject?.({ form });
|
|
77
73
|
} else {
|
|
78
|
-
|
|
74
|
+
onTypenameChange?.(typename);
|
|
79
75
|
}
|
|
80
76
|
},
|
|
81
|
-
[forms, onCreateObject
|
|
77
|
+
[forms, onCreateObject],
|
|
82
78
|
);
|
|
83
79
|
|
|
84
80
|
const inputSurfaceLookup = useInputSurfaceLookup({ target });
|
|
85
81
|
|
|
86
82
|
// TODO(wittjosiah): These inputs should be rolled into a `Form` once it supports the necessary variants.
|
|
87
|
-
return (
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/>
|
|
103
|
-
) : undefined}
|
|
83
|
+
return !form ? (
|
|
84
|
+
<SelectSchema options={options} resolve={resolve} onChange={handleSetTypename} />
|
|
85
|
+
) : !target ? (
|
|
86
|
+
<SelectSpace spaces={spaces} defaultSpaceId={defaultSpaceId} onChange={onTargetChange} />
|
|
87
|
+
) : form.formSchema ? (
|
|
88
|
+
<div role='none' className={cardDialogOverflow}>
|
|
89
|
+
<Form
|
|
90
|
+
autoFocus
|
|
91
|
+
values={{ name: initialName }}
|
|
92
|
+
schema={form.formSchema}
|
|
93
|
+
testId='create-object-form'
|
|
94
|
+
onSave={handleCreateObject}
|
|
95
|
+
lookupComponent={inputSurfaceLookup}
|
|
96
|
+
outerSpacing='blockStart-0'
|
|
97
|
+
/>
|
|
104
98
|
</div>
|
|
105
|
-
);
|
|
99
|
+
) : null;
|
|
106
100
|
};
|
|
107
101
|
|
|
108
102
|
const SelectSpace = ({
|
|
109
103
|
spaces,
|
|
110
104
|
defaultSpaceId,
|
|
111
105
|
onChange,
|
|
112
|
-
}: { onChange
|
|
106
|
+
}: { onChange?: (space: Space) => void } & Pick<CreateObjectPanelProps, 'spaces' | 'defaultSpaceId'>) => {
|
|
113
107
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
114
108
|
|
|
115
109
|
return (
|
|
116
|
-
<SearchList.Root label={t('space input label')} classNames=
|
|
110
|
+
<SearchList.Root label={t('space input label')} classNames={cardDialogSearchListRoot}>
|
|
117
111
|
<SearchList.Input
|
|
118
112
|
autoFocus
|
|
119
113
|
data-testid='create-object-form.space-input'
|
|
120
114
|
placeholder={t('space input placeholder')}
|
|
121
|
-
classNames='px-1 my-2'
|
|
122
115
|
/>
|
|
123
|
-
<SearchList.Content classNames=
|
|
116
|
+
<SearchList.Content classNames={[cardDialogOverflow, 'plb-cardSpacingBlock']}>
|
|
124
117
|
{spaces
|
|
125
118
|
.sort((a, b) => {
|
|
126
119
|
const aName = toLocalizedString(getSpaceDisplayName(a, { personal: a.id === defaultSpaceId }), t);
|
|
@@ -131,7 +124,7 @@ const SelectSpace = ({
|
|
|
131
124
|
<SearchList.Item
|
|
132
125
|
key={space.id}
|
|
133
126
|
value={toLocalizedString(getSpaceDisplayName(space, { personal: space.id === defaultSpaceId }), t)}
|
|
134
|
-
onSelect={() => onChange(space)}
|
|
127
|
+
onSelect={() => onChange?.(space)}
|
|
135
128
|
classNames='flex items-center gap-2'
|
|
136
129
|
>
|
|
137
130
|
<span className='grow truncate'>
|
|
@@ -155,14 +148,13 @@ const SelectSchema = ({
|
|
|
155
148
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
156
149
|
|
|
157
150
|
return (
|
|
158
|
-
<SearchList.Root label={t('schema input label')} classNames=
|
|
151
|
+
<SearchList.Root label={t('schema input label')} classNames={cardDialogSearchListRoot}>
|
|
159
152
|
<SearchList.Input
|
|
160
153
|
autoFocus
|
|
161
154
|
data-testid='create-object-form.schema-input'
|
|
162
155
|
placeholder={t('schema input placeholder')}
|
|
163
|
-
classNames='px-1 my-2'
|
|
164
156
|
/>
|
|
165
|
-
<SearchList.Content classNames=
|
|
157
|
+
<SearchList.Content classNames={cardDialogPaddedOverflow}>
|
|
166
158
|
{options.map((option) => (
|
|
167
159
|
<SearchList.Item
|
|
168
160
|
key={option.typename}
|
|
@@ -8,6 +8,7 @@ import React, { useCallback, useRef } from 'react';
|
|
|
8
8
|
import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
9
|
import { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
|
+
import { cardDialogContent, cardDialogHeader } from '@dxos/react-ui-stack';
|
|
11
12
|
|
|
12
13
|
import { useInputSurfaceLookup } from '../../hooks';
|
|
13
14
|
import { SPACE_PLUGIN } from '../../meta';
|
|
@@ -30,7 +31,7 @@ export const CreateSpaceDialog = () => {
|
|
|
30
31
|
const program = Effect.gen(function* () {
|
|
31
32
|
const { space } = yield* dispatch(createIntent(SpaceAction.Create, data));
|
|
32
33
|
yield* dispatch(createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: space.id }));
|
|
33
|
-
yield* dispatch(createIntent(
|
|
34
|
+
yield* dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
34
35
|
});
|
|
35
36
|
await Effect.runPromise(program);
|
|
36
37
|
},
|
|
@@ -40,8 +41,8 @@ export const CreateSpaceDialog = () => {
|
|
|
40
41
|
return (
|
|
41
42
|
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
42
43
|
// Consider factoring it out to the tabs package.
|
|
43
|
-
<Dialog.Content classNames=
|
|
44
|
-
<div role='none' className=
|
|
44
|
+
<Dialog.Content classNames={cardDialogContent}>
|
|
45
|
+
<div role='none' className={cardDialogHeader}>
|
|
45
46
|
<Dialog.Title>{t('create space dialog title')}</Dialog.Title>
|
|
46
47
|
<Dialog.Close asChild>
|
|
47
48
|
<Button ref={closeRef} density='fine' variant='ghost' autoFocus>
|
|
@@ -49,15 +50,15 @@ export const CreateSpaceDialog = () => {
|
|
|
49
50
|
</Button>
|
|
50
51
|
</Dialog.Close>
|
|
51
52
|
</div>
|
|
52
|
-
<div className='
|
|
53
|
+
<div role='none' className='contents'>
|
|
53
54
|
<Form
|
|
54
55
|
testId='create-space-form'
|
|
55
|
-
flush
|
|
56
56
|
autoFocus
|
|
57
57
|
values={initialValues}
|
|
58
58
|
schema={SpaceForm}
|
|
59
59
|
lookupComponent={inputSurfaceLookup}
|
|
60
60
|
onSave={handleCreateSpace}
|
|
61
|
+
outerSpacing='scroll-fields'
|
|
61
62
|
/>
|
|
62
63
|
</div>
|
|
63
64
|
</Dialog.Content>
|
|
@@ -7,6 +7,7 @@ import React, { type Dispatch, type SetStateAction, useCallback, useMemo, useSta
|
|
|
7
7
|
import { QR } from 'react-qr-rounded';
|
|
8
8
|
|
|
9
9
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
+
import { Type } from '@dxos/echo';
|
|
10
11
|
import { log } from '@dxos/log';
|
|
11
12
|
import { useConfig } from '@dxos/react-client';
|
|
12
13
|
import { fullyQualifiedId, useSpaceInvitations, type Space } from '@dxos/react-client/echo';
|
|
@@ -15,6 +16,7 @@ import { Button, Clipboard, Icon, Input, useId, useTranslation } from '@dxos/rea
|
|
|
15
16
|
import { ControlPage, ControlSection, ControlFrame, ControlFrameItem, ControlItemInput } from '@dxos/react-ui-form';
|
|
16
17
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
17
18
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
19
|
+
import { DataType } from '@dxos/schema';
|
|
18
20
|
import {
|
|
19
21
|
type ActionMenuItem,
|
|
20
22
|
AuthCode,
|
|
@@ -28,7 +30,7 @@ import {
|
|
|
28
30
|
import { hexToEmoji } from '@dxos/util';
|
|
29
31
|
|
|
30
32
|
import { SPACE_PLUGIN } from '../meta';
|
|
31
|
-
import {
|
|
33
|
+
import { SpaceAction } from '../types';
|
|
32
34
|
import { COMPOSER_SPACE_LOCK } from '../util';
|
|
33
35
|
|
|
34
36
|
// TODO(wittjosiah): Copied from Shell.
|
|
@@ -65,7 +67,7 @@ export const MembersContainer = ({
|
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
// TODO(wittjosiah): Track which was the most recently viewed object.
|
|
68
|
-
const target = space.properties[
|
|
70
|
+
const target = space.properties[Type.getTypename(DataType.Collection)]?.target?.objects[0]?.target;
|
|
69
71
|
|
|
70
72
|
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
71
73
|
const handleChangeLocked = useCallback(() => {
|