@dxos/plugin-space 0.8.3 → 0.8.4-main.2e9d522
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/CollectionMain-D2B75XBS.mjs +31 -0
- package/dist/lib/browser/CollectionMain-D2B75XBS.mjs.map +7 -0
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs +88 -0
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-M2RH72VL.mjs → app-graph-builder-7CZZJS3S.mjs} +143 -27
- package/dist/lib/browser/app-graph-builder-7CZZJS3S.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-F7ISRRBV.mjs → app-graph-serializer-H6AW7KGS.mjs} +13 -13
- package/dist/lib/browser/app-graph-serializer-H6AW7KGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BXNL6SDI.mjs → chunk-CEFHNVU7.mjs} +4 -3
- package/dist/lib/browser/chunk-CEFHNVU7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PTKYMZWO.mjs → chunk-FBCGT5YY.mjs} +2 -2
- package/dist/lib/browser/{chunk-YMCZR6EZ.mjs → chunk-JS3MMC42.mjs} +4 -3
- package/dist/lib/browser/{chunk-YMCZR6EZ.mjs.map → chunk-JS3MMC42.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-4ZKSFDXM.mjs → chunk-QACNNDOT.mjs} +73 -12
- package/dist/lib/browser/chunk-QACNNDOT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TW7O2EPP.mjs → chunk-SGTQ52SU.mjs} +59 -5
- package/dist/lib/browser/chunk-SGTQ52SU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NFUKCRGE.mjs → chunk-V7MJSSBQ.mjs} +392 -324
- package/dist/lib/browser/chunk-V7MJSSBQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7Y4M7GXO.mjs → chunk-VLBRSGJ2.mjs} +4 -4
- package/dist/lib/browser/{chunk-V24VASAJ.mjs → chunk-XUYKJUU7.mjs} +128 -25
- package/dist/lib/browser/chunk-XUYKJUU7.mjs.map +7 -0
- package/dist/lib/browser/{identity-created-PI7TKANR.mjs → identity-created-23XJJV2N.mjs} +4 -4
- package/dist/lib/browser/identity-created-23XJJV2N.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +105 -16
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-RWU6ZE4H.mjs → intent-resolver-TIXVDYN7.mjs} +171 -21
- package/dist/lib/browser/intent-resolver-TIXVDYN7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-QIKHSNT2.mjs → react-root-N2J7TDRX.mjs} +8 -8
- package/dist/lib/browser/{react-surface-W56UD53I.mjs → react-surface-TPNLWJJH.mjs} +42 -21
- package/dist/lib/browser/react-surface-TPNLWJJH.mjs.map +7 -0
- package/dist/lib/browser/{schema-defs-WREJNMIC.mjs → schema-defs-Z6FC4AHC.mjs} +4 -4
- package/dist/lib/browser/{schema-tools-ILTVSSS3.mjs → schema-tools-BNP4JTD7.mjs} +3 -3
- package/dist/lib/browser/{settings-K54STC5A.mjs → settings-4IMP5RYT.mjs} +4 -4
- package/dist/lib/browser/{spaces-ready-3PDRDHPC.mjs → spaces-ready-TOPG6IV4.mjs} +7 -7
- package/dist/lib/browser/{state-HRZ4VRXU.mjs → state-QYZAB45H.mjs} +4 -4
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs +32 -0
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs +89 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-BCHVZ4OM.mjs → app-graph-builder-KGIGWC72.mjs} +143 -27
- package/dist/lib/node-esm/app-graph-builder-KGIGWC72.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-TXRGGNP2.mjs → app-graph-serializer-2ICUGQQT.mjs} +13 -13
- package/dist/lib/node-esm/app-graph-serializer-2ICUGQQT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HO7AIKQS.mjs → chunk-4AOMYKDE.mjs} +128 -25
- package/dist/lib/node-esm/chunk-4AOMYKDE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3CP67AYY.mjs → chunk-5HHYE264.mjs} +4 -3
- package/dist/lib/node-esm/{chunk-3CP67AYY.mjs.map → chunk-5HHYE264.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-BSLREHIX.mjs → chunk-5T3ZH23B.mjs} +4 -3
- package/dist/lib/node-esm/chunk-5T3ZH23B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LA6AVVH6.mjs → chunk-6X5DLJM5.mjs} +392 -324
- package/dist/lib/node-esm/chunk-6X5DLJM5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MSWEFAPD.mjs → chunk-HWNG4MEU.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-D4QMPPS7.mjs → chunk-JH6F4C3I.mjs} +59 -5
- package/dist/lib/node-esm/chunk-JH6F4C3I.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JBQKU4K5.mjs → chunk-P442DOQ3.mjs} +73 -12
- package/dist/lib/node-esm/chunk-P442DOQ3.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GH2FGJXH.mjs → chunk-SSLBYZEY.mjs} +4 -4
- package/dist/lib/node-esm/{identity-created-35CTAQWI.mjs → identity-created-IJQO6GCR.mjs} +4 -4
- package/dist/lib/node-esm/identity-created-IJQO6GCR.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +105 -16
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-JO6L2VXC.mjs → intent-resolver-MHGHRGDT.mjs} +171 -21
- package/dist/lib/node-esm/intent-resolver-MHGHRGDT.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-YFGL3B4J.mjs → react-root-KW3TGJGY.mjs} +8 -8
- package/dist/lib/node-esm/{react-surface-CVAPDLEZ.mjs → react-surface-UUIUUD6P.mjs} +42 -21
- package/dist/lib/node-esm/react-surface-UUIUUD6P.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-defs-4MEJETVX.mjs → schema-defs-WHJM7UZE.mjs} +4 -4
- package/dist/lib/node-esm/{schema-tools-SRLCRZ3B.mjs → schema-tools-KWW5PTML.mjs} +3 -3
- package/dist/lib/node-esm/{settings-TD76LTQS.mjs → settings-SAOBPND3.mjs} +4 -4
- package/dist/lib/node-esm/{spaces-ready-FJMGPAVV.mjs → spaces-ready-HIUKNDZK.mjs} +7 -7
- package/dist/lib/node-esm/{state-XQNDCN37.mjs → state-ZVEHQ4BJ.mjs} +4 -4
- package/dist/lib/node-esm/types/index.mjs +2 -2
- 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 +9 -3
- 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/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/CollectionMain.d.ts +1 -0
- package/dist/types/src/components/CollectionMain.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +3 -2
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.stories.d.ts +1 -1
- package/dist/types/src/components/MembersContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/ObjectDetailsPanel.d.ts +9 -0
- package/dist/types/src/components/ObjectDetailsPanel.d.ts.map +1 -0
- package/dist/types/src/components/PersistenceStatus.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/status.d.ts +5 -5
- package/dist/types/src/components/ViewEditor.d.ts +8 -0
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +8 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +212 -410
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +82 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +27 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -52
- package/src/SpacePlugin.ts +90 -7
- package/src/capabilities/app-graph-builder.ts +166 -7
- package/src/capabilities/app-graph-serializer.ts +6 -6
- package/src/capabilities/capabilities.ts +8 -3
- package/src/capabilities/identity-created.ts +2 -4
- package/src/capabilities/intent-resolver.ts +117 -8
- package/src/capabilities/react-surface.tsx +50 -13
- package/src/components/AwaitingObject.tsx +4 -6
- package/src/components/CollectionMain.tsx +2 -0
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +4 -4
- package/src/components/CreateDialog/CreateObjectDialog.tsx +29 -25
- package/src/components/MembersContainer.stories.tsx +4 -4
- package/src/components/MembersContainer.tsx +6 -5
- package/src/components/MenuFooter.tsx +2 -3
- package/src/components/ObjectDetailsPanel.tsx +77 -0
- package/src/components/PersistenceStatus.tsx +5 -6
- package/src/components/PopoverRenameObject.tsx +2 -2
- package/src/components/SpacePresence.stories.tsx +2 -2
- package/src/components/SpaceSettings/SpaceSettingsContainer.stories.tsx +2 -2
- package/src/components/SyncStatus/SyncStatus.stories.tsx +8 -15
- package/src/components/SyncStatus/SyncStatus.tsx +1 -1
- package/src/components/SyncStatus/save-tracker.ts +3 -3
- package/src/components/SyncStatus/status.ts +4 -4
- package/src/components/ViewEditor.tsx +64 -0
- package/src/components/index.ts +6 -1
- package/src/events.ts +1 -0
- package/src/translations.ts +71 -7
- package/src/types/types.ts +56 -3
- package/src/util.tsx +116 -21
- package/dist/lib/browser/app-graph-builder-M2RH72VL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-F7ISRRBV.mjs.map +0 -7
- package/dist/lib/browser/chunk-4ZKSFDXM.mjs.map +0 -7
- package/dist/lib/browser/chunk-BXNL6SDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-NFUKCRGE.mjs.map +0 -7
- package/dist/lib/browser/chunk-TW7O2EPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-V24VASAJ.mjs.map +0 -7
- package/dist/lib/browser/identity-created-PI7TKANR.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-RWU6ZE4H.mjs.map +0 -7
- package/dist/lib/browser/react-surface-W56UD53I.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-6LK5HLLE.cjs +0 -364
- package/dist/lib/node/app-graph-builder-6LK5HLLE.cjs.map +0 -7
- package/dist/lib/node/app-graph-serializer-HKHBNHA3.cjs +0 -89
- package/dist/lib/node/app-graph-serializer-HKHBNHA3.cjs.map +0 -7
- package/dist/lib/node/chunk-3X4EA4XL.cjs +0 -37
- package/dist/lib/node/chunk-3X4EA4XL.cjs.map +0 -7
- package/dist/lib/node/chunk-5WLAXYE3.cjs +0 -125
- package/dist/lib/node/chunk-5WLAXYE3.cjs.map +0 -7
- package/dist/lib/node/chunk-6P2DB4QQ.cjs +0 -36
- package/dist/lib/node/chunk-6P2DB4QQ.cjs.map +0 -7
- package/dist/lib/node/chunk-DOC5XEZ4.cjs +0 -184
- package/dist/lib/node/chunk-DOC5XEZ4.cjs.map +0 -7
- package/dist/lib/node/chunk-NCHF433F.cjs +0 -1921
- package/dist/lib/node/chunk-NCHF433F.cjs.map +0 -7
- package/dist/lib/node/chunk-NL5Y4EDX.cjs +0 -38
- package/dist/lib/node/chunk-NL5Y4EDX.cjs.map +0 -7
- package/dist/lib/node/chunk-ULJZPATP.cjs +0 -312
- package/dist/lib/node/chunk-ULJZPATP.cjs.map +0 -7
- package/dist/lib/node/chunk-XHWVT7LW.cjs +0 -572
- package/dist/lib/node/chunk-XHWVT7LW.cjs.map +0 -7
- package/dist/lib/node/identity-created-FF4WZ2WY.cjs +0 -42
- package/dist/lib/node/identity-created-FF4WZ2WY.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -278
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-AV4CMM3Z.cjs +0 -609
- package/dist/lib/node/intent-resolver-AV4CMM3Z.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-root-RQUU3A45.cjs +0 -51
- package/dist/lib/node/react-root-RQUU3A45.cjs.map +0 -7
- package/dist/lib/node/react-surface-AZFJLE72.cjs +0 -351
- package/dist/lib/node/react-surface-AZFJLE72.cjs.map +0 -7
- package/dist/lib/node/schema-defs-OB2X2HBH.cjs +0 -42
- package/dist/lib/node/schema-defs-OB2X2HBH.cjs.map +0 -7
- package/dist/lib/node/schema-tools-IYREN4IH.cjs +0 -147
- package/dist/lib/node/schema-tools-IYREN4IH.cjs.map +0 -7
- package/dist/lib/node/settings-P2EQ7VKQ.cjs +0 -38
- package/dist/lib/node/settings-P2EQ7VKQ.cjs.map +0 -7
- package/dist/lib/node/spaces-ready-DXPOHYV7.cjs +0 -210
- package/dist/lib/node/spaces-ready-DXPOHYV7.cjs.map +0 -7
- package/dist/lib/node/state-M35DK75Z.cjs +0 -61
- package/dist/lib/node/state-M35DK75Z.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -48
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-BCHVZ4OM.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-TXRGGNP2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BSLREHIX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4QMPPS7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HO7AIKQS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JBQKU4K5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LA6AVVH6.mjs.map +0 -7
- package/dist/lib/node-esm/identity-created-35CTAQWI.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-JO6L2VXC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CVAPDLEZ.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-PTKYMZWO.mjs.map → chunk-FBCGT5YY.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-7Y4M7GXO.mjs.map → chunk-VLBRSGJ2.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-QIKHSNT2.mjs.map → react-root-N2J7TDRX.mjs.map} +0 -0
- /package/dist/lib/browser/{schema-defs-WREJNMIC.mjs.map → schema-defs-Z6FC4AHC.mjs.map} +0 -0
- /package/dist/lib/browser/{schema-tools-ILTVSSS3.mjs.map → schema-tools-BNP4JTD7.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-K54STC5A.mjs.map → settings-4IMP5RYT.mjs.map} +0 -0
- /package/dist/lib/browser/{spaces-ready-3PDRDHPC.mjs.map → spaces-ready-TOPG6IV4.mjs.map} +0 -0
- /package/dist/lib/browser/{state-HRZ4VRXU.mjs.map → state-QYZAB45H.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-MSWEFAPD.mjs.map → chunk-HWNG4MEU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-GH2FGJXH.mjs.map → chunk-SSLBYZEY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-YFGL3B4J.mjs.map → react-root-KW3TGJGY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{schema-defs-4MEJETVX.mjs.map → schema-defs-WHJM7UZE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{schema-tools-SRLCRZ3B.mjs.map → schema-tools-KWW5PTML.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-TD76LTQS.mjs.map → settings-SAOBPND3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{spaces-ready-FJMGPAVV.mjs.map → spaces-ready-HIUKNDZK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-XQNDCN37.mjs.map → state-ZVEHQ4BJ.mjs.map} +0 -0
|
@@ -21,7 +21,7 @@ import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata
|
|
|
21
21
|
import { isSpace, getSpace, SpaceState, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
22
22
|
import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
23
23
|
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
24
|
-
import { DataType } from '@dxos/schema';
|
|
24
|
+
import { DataType, ProjectionModel } from '@dxos/schema';
|
|
25
25
|
|
|
26
26
|
import { SpaceCapabilities } from './capabilities';
|
|
27
27
|
import {
|
|
@@ -75,17 +75,27 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
75
75
|
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
|
|
76
76
|
}
|
|
77
77
|
await space.waitUntilReady();
|
|
78
|
+
|
|
79
|
+
// Create root collection.
|
|
78
80
|
const collection = Obj.make(DataType.Collection, { objects: [] });
|
|
79
|
-
space.properties[
|
|
81
|
+
space.properties[DataType.Collection.typename] = Ref.make(collection);
|
|
80
82
|
|
|
83
|
+
// Set current migration version.
|
|
81
84
|
if (Migrations.versionProperty) {
|
|
82
85
|
space.properties[Migrations.versionProperty] = Migrations.targetVersion;
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
// Create records smart collection.
|
|
89
|
+
const records = Obj.make(DataType.QueryCollection, {
|
|
90
|
+
query: { typename: DataType.StoredSchema.typename },
|
|
91
|
+
});
|
|
92
|
+
collection.objects.push(Ref.make(records));
|
|
93
|
+
|
|
94
|
+
// Allow other plugins to add default content.
|
|
85
95
|
await context.activatePromise(SpaceEvents.SpaceCreated);
|
|
86
96
|
const onSpaceCreatedCallbacks = context.getCapabilities(SpaceCapabilities.OnSpaceCreated);
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
const spaceCreatedIntents = onSpaceCreatedCallbacks.map((onSpaceCreated) =>
|
|
98
|
+
onSpaceCreated({ space, rootCollection: collection }),
|
|
89
99
|
);
|
|
90
100
|
|
|
91
101
|
return {
|
|
@@ -95,6 +105,7 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
95
105
|
space,
|
|
96
106
|
},
|
|
97
107
|
intents: [
|
|
108
|
+
...spaceCreatedIntents,
|
|
98
109
|
...(observability
|
|
99
110
|
? [
|
|
100
111
|
createIntent(ObservabilityAction.SendEvent, {
|
|
@@ -309,9 +320,106 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
309
320
|
};
|
|
310
321
|
},
|
|
311
322
|
}),
|
|
323
|
+
createResolver({
|
|
324
|
+
intent: SpaceAction.UseStaticSchema,
|
|
325
|
+
resolve: async ({ space, typename }) => {
|
|
326
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
327
|
+
const schema = client.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
328
|
+
invariant(schema, `Schema not found: ${typename}`);
|
|
329
|
+
|
|
330
|
+
if (!space.properties.staticRecords) {
|
|
331
|
+
space.properties.staticRecords = [];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (!space.properties.staticRecords.includes(typename)) {
|
|
335
|
+
space.properties.staticRecords.push(typename);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
await context.activatePromise(SpaceEvents.SchemaAdded);
|
|
339
|
+
const onSchemaAdded = context.getCapabilities(SpaceCapabilities.OnSchemaAdded);
|
|
340
|
+
const schemaAddedIntents = onSchemaAdded.map((onSchemaAdded) => onSchemaAdded({ space, schema }));
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
data: {},
|
|
344
|
+
intents: [
|
|
345
|
+
...schemaAddedIntents,
|
|
346
|
+
...(observability
|
|
347
|
+
? [
|
|
348
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
349
|
+
name: 'space.schema.use',
|
|
350
|
+
properties: {
|
|
351
|
+
spaceId: space.id,
|
|
352
|
+
typename: Type.getTypename(schema),
|
|
353
|
+
},
|
|
354
|
+
}),
|
|
355
|
+
]
|
|
356
|
+
: []),
|
|
357
|
+
],
|
|
358
|
+
};
|
|
359
|
+
},
|
|
360
|
+
}),
|
|
361
|
+
createResolver({
|
|
362
|
+
intent: SpaceAction.AddSchema,
|
|
363
|
+
resolve: async ({ space, name, schema: schemaInput }) => {
|
|
364
|
+
const [schema] = await space.db.schemaRegistry.register([schemaInput]);
|
|
365
|
+
if (name) {
|
|
366
|
+
schema.storedSchema.name = name;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
await context.activatePromise(SpaceEvents.SchemaAdded);
|
|
370
|
+
const onSchemaAdded = context.getCapabilities(SpaceCapabilities.OnSchemaAdded);
|
|
371
|
+
const schemaAddedIntents = onSchemaAdded.map((onSchemaAdded) => onSchemaAdded({ space, schema }));
|
|
372
|
+
|
|
373
|
+
return {
|
|
374
|
+
data: {
|
|
375
|
+
id: schema.id,
|
|
376
|
+
object: schema.storedSchema,
|
|
377
|
+
schema,
|
|
378
|
+
},
|
|
379
|
+
intents: [
|
|
380
|
+
...schemaAddedIntents,
|
|
381
|
+
...(observability
|
|
382
|
+
? [
|
|
383
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
384
|
+
name: 'space.schema.add',
|
|
385
|
+
properties: {
|
|
386
|
+
spaceId: space.id,
|
|
387
|
+
objectId: schema.id,
|
|
388
|
+
typename: schema.typename,
|
|
389
|
+
},
|
|
390
|
+
}),
|
|
391
|
+
]
|
|
392
|
+
: []),
|
|
393
|
+
],
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
}),
|
|
397
|
+
createResolver({
|
|
398
|
+
intent: SpaceAction.DeleteField,
|
|
399
|
+
resolve: async ({ view, fieldId, deletionData }, undo) => {
|
|
400
|
+
const space = getSpace(view);
|
|
401
|
+
invariant(space);
|
|
402
|
+
invariant(view.query.typename);
|
|
403
|
+
const schema = await space.db.schemaRegistry.query({ typename: view.query.typename }).firstOrUndefined();
|
|
404
|
+
invariant(schema);
|
|
405
|
+
const projection = new ProjectionModel(schema.jsonSchema, view.projection);
|
|
406
|
+
if (!undo) {
|
|
407
|
+
const { deleted, index } = projection.deleteFieldProjection(fieldId);
|
|
408
|
+
return {
|
|
409
|
+
undoable: {
|
|
410
|
+
message: ['field deleted label', { ns: SPACE_PLUGIN }],
|
|
411
|
+
data: { deletionData: { ...deleted, index } },
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
} else if (undo && deletionData) {
|
|
415
|
+
const { field, props, index } = deletionData;
|
|
416
|
+
projection.setFieldProjection({ field, props }, index);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
}),
|
|
312
420
|
createResolver({
|
|
313
421
|
intent: SpaceAction.OpenCreateObject,
|
|
314
|
-
resolve: ({ target, typename, navigable = true }) => {
|
|
422
|
+
resolve: ({ target, typename, navigable = true, onCreateObject }) => {
|
|
315
423
|
const state = context.getCapability(SpaceCapabilities.State);
|
|
316
424
|
|
|
317
425
|
return {
|
|
@@ -324,6 +432,7 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
324
432
|
props: {
|
|
325
433
|
target,
|
|
326
434
|
typename,
|
|
435
|
+
onCreateObject,
|
|
327
436
|
shouldNavigate: navigable
|
|
328
437
|
? (object: Obj.Any) => {
|
|
329
438
|
const isCollection = Obj.instanceOf(DataType.Collection, object);
|
|
@@ -381,13 +490,13 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
381
490
|
} else if (isSpace(target) && hidden) {
|
|
382
491
|
space.db.add(object);
|
|
383
492
|
} else if (isSpace(target)) {
|
|
384
|
-
const collection = space.properties[
|
|
493
|
+
const collection = space.properties[DataType.Collection.typename]?.target;
|
|
385
494
|
if (Obj.instanceOf(DataType.Collection, collection)) {
|
|
386
495
|
collection.objects.push(Ref.make(object));
|
|
387
496
|
} else {
|
|
388
497
|
// TODO(wittjosiah): Can't add non-echo objects by including in a collection because of types.
|
|
389
498
|
const collection = Obj.make(DataType.Collection, { objects: [Ref.make(object)] });
|
|
390
|
-
space.properties[
|
|
499
|
+
space.properties[DataType.Collection.typename] = Ref.make(collection);
|
|
391
500
|
}
|
|
392
501
|
}
|
|
393
502
|
|
|
@@ -444,7 +553,7 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
444
553
|
|
|
445
554
|
if (!undo) {
|
|
446
555
|
const parentCollection: DataType.Collection =
|
|
447
|
-
target ?? space.properties[
|
|
556
|
+
target ?? space.properties[DataType.Collection.typename]?.target;
|
|
448
557
|
const nestedObjectsList = await Promise.all(objects.map((obj) => getNestedObjects(obj, resolve)));
|
|
449
558
|
|
|
450
559
|
const deletionData = {
|
|
@@ -19,7 +19,16 @@ import { findAnnotation } from '@dxos/effect';
|
|
|
19
19
|
import { SettingsStore } from '@dxos/local-storage';
|
|
20
20
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
21
21
|
import { useClient } from '@dxos/react-client';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
fullyQualifiedId,
|
|
24
|
+
getSpace,
|
|
25
|
+
isLiveObject,
|
|
26
|
+
isSpace,
|
|
27
|
+
parseId,
|
|
28
|
+
SpaceState,
|
|
29
|
+
useSpace,
|
|
30
|
+
type Space,
|
|
31
|
+
} from '@dxos/react-client/echo';
|
|
23
32
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
24
33
|
import { type InputProps, SelectInput } from '@dxos/react-ui-form';
|
|
25
34
|
import { HuePicker, IconPicker } from '@dxos/react-ui-pickers';
|
|
@@ -39,6 +48,7 @@ import {
|
|
|
39
48
|
JoinDialog,
|
|
40
49
|
MembersContainer,
|
|
41
50
|
MenuFooter,
|
|
51
|
+
ObjectDetailsPanel,
|
|
42
52
|
ObjectSettingsContainer,
|
|
43
53
|
POPOVER_RENAME_OBJECT,
|
|
44
54
|
POPOVER_RENAME_SPACE,
|
|
@@ -50,6 +60,7 @@ import {
|
|
|
50
60
|
SpacePresence,
|
|
51
61
|
SpaceSettingsContainer,
|
|
52
62
|
SyncStatus,
|
|
63
|
+
ViewEditor,
|
|
53
64
|
type CreateObjectDialogProps,
|
|
54
65
|
} from '../components';
|
|
55
66
|
import { SPACE_PLUGIN } from '../meta';
|
|
@@ -59,7 +70,7 @@ type ReactSurfaceOptions = {
|
|
|
59
70
|
createInvitationUrl: (invitationCode: string) => string;
|
|
60
71
|
};
|
|
61
72
|
|
|
62
|
-
const OMIT = [
|
|
73
|
+
const OMIT = [DataType.Collection.typename, DataType.QueryCollection.typename];
|
|
63
74
|
|
|
64
75
|
export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
65
76
|
contributes(Capabilities.ReactSurface, [
|
|
@@ -73,7 +84,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
73
84
|
<Surface
|
|
74
85
|
data={{
|
|
75
86
|
id: data.subject.id,
|
|
76
|
-
subject: data.subject.properties[
|
|
87
|
+
subject: data.subject.properties[DataType.Collection.typename]?.target,
|
|
77
88
|
}}
|
|
78
89
|
role={role}
|
|
79
90
|
{...rest}
|
|
@@ -146,6 +157,19 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
146
157
|
return <SchemaContainer space={space} />;
|
|
147
158
|
},
|
|
148
159
|
}),
|
|
160
|
+
createSurface({
|
|
161
|
+
id: `${SPACE_PLUGIN}/selected-objects`,
|
|
162
|
+
role: 'article',
|
|
163
|
+
filter: (data): data is { companionTo: DataType.View; subject: 'selected-objects' } =>
|
|
164
|
+
Obj.instanceOf(DataType.View, data.companionTo) && data.subject === 'selected-objects',
|
|
165
|
+
component: ({ data }) => (
|
|
166
|
+
<ObjectDetailsPanel
|
|
167
|
+
key={fullyQualifiedId(data.companionTo)}
|
|
168
|
+
objectId={fullyQualifiedId(data.companionTo)}
|
|
169
|
+
view={data.companionTo}
|
|
170
|
+
/>
|
|
171
|
+
),
|
|
172
|
+
}),
|
|
149
173
|
createSurface({
|
|
150
174
|
id: JOIN_DIALOG,
|
|
151
175
|
role: 'dialog',
|
|
@@ -228,7 +252,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
228
252
|
|
|
229
253
|
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
230
254
|
const whitelistedTypenames = useMemo(
|
|
231
|
-
() => new Set(schemaWhitelists.flatMap((typeArray) => typeArray.map((type) => type
|
|
255
|
+
() => new Set(schemaWhitelists.flatMap((typeArray) => typeArray.map((type) => Type.getTypename(type)))),
|
|
232
256
|
[schemaWhitelists],
|
|
233
257
|
);
|
|
234
258
|
|
|
@@ -239,7 +263,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
239
263
|
objectForms
|
|
240
264
|
.map((form) => Type.getTypename(form.objectSchema))
|
|
241
265
|
// TODO(wittjosiah): Remove.
|
|
242
|
-
.filter((typename) => !OMIT.includes(typename)),
|
|
266
|
+
.filter((typename) => !OMIT.includes(typename) && !typename.endsWith('View')),
|
|
243
267
|
),
|
|
244
268
|
[objectForms],
|
|
245
269
|
);
|
|
@@ -247,13 +271,18 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
247
271
|
const fixed = client.graph.schemaRegistry.schemas.filter((schema) => {
|
|
248
272
|
const limitedStatic =
|
|
249
273
|
annotation.includes('limited-static') && whitelistedTypenames.has(Type.getTypename(schema));
|
|
274
|
+
const unusedStatic =
|
|
275
|
+
annotation.includes('unused-static') &&
|
|
276
|
+
whitelistedTypenames.has(Type.getTypename(schema)) &&
|
|
277
|
+
!space.properties.staticRecords?.includes(Type.getTypename(schema));
|
|
250
278
|
const objectForm = annotation.includes('object-form') && objectFormTypenames.has(Type.getTypename(schema));
|
|
251
|
-
return annotation.includes('static') || limitedStatic || objectForm;
|
|
279
|
+
return annotation.includes('static') || limitedStatic || unusedStatic || objectForm;
|
|
252
280
|
});
|
|
253
281
|
const dynamic = space?.db.schemaRegistry.query().runSync();
|
|
254
282
|
const typenames = Array.from(
|
|
255
283
|
new Set<string>([
|
|
256
284
|
...(annotation.includes('limited-static') ||
|
|
285
|
+
annotation.includes('unused-static') ||
|
|
257
286
|
annotation.includes('static') ||
|
|
258
287
|
annotation.includes('object-form')
|
|
259
288
|
? fixed.map((schema) => Type.getTypename(schema))
|
|
@@ -264,25 +293,33 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
264
293
|
|
|
265
294
|
const options = useMemo(
|
|
266
295
|
() =>
|
|
267
|
-
typenames
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
296
|
+
typenames
|
|
297
|
+
.map((typename) => ({
|
|
298
|
+
value: typename,
|
|
299
|
+
label: t('typename label', { ns: typename, defaultValue: typename }),
|
|
300
|
+
}))
|
|
301
|
+
.toSorted((a, b) => a.label.localeCompare(b.label)),
|
|
271
302
|
[t, typenames],
|
|
272
303
|
);
|
|
273
304
|
|
|
274
305
|
return <SelectInput {...props} options={options} />;
|
|
275
306
|
},
|
|
276
307
|
}),
|
|
308
|
+
createSurface({
|
|
309
|
+
id: `${SPACE_PLUGIN}/object-settings`,
|
|
310
|
+
role: 'object-settings',
|
|
311
|
+
filter: (data): data is { subject: DataType.View } => Obj.instanceOf(DataType.View, data.subject),
|
|
312
|
+
component: ({ data }) => <ViewEditor view={data.subject} />,
|
|
313
|
+
}),
|
|
277
314
|
createSurface({
|
|
278
315
|
id: POPOVER_RENAME_SPACE,
|
|
279
|
-
role: 'popover',
|
|
316
|
+
role: 'card--popover',
|
|
280
317
|
filter: (data): data is { props: Space } => data.component === POPOVER_RENAME_SPACE && isSpace(data.props),
|
|
281
318
|
component: ({ data }) => <PopoverRenameSpace space={data.props} />,
|
|
282
319
|
}),
|
|
283
320
|
createSurface({
|
|
284
321
|
id: POPOVER_RENAME_OBJECT,
|
|
285
|
-
role: 'popover',
|
|
322
|
+
role: 'card--popover',
|
|
286
323
|
filter: (data): data is { props: Obj.Any } =>
|
|
287
324
|
data.component === POPOVER_RENAME_OBJECT && isLiveObject(data.props),
|
|
288
325
|
component: ({ data }) => <PopoverRenameObject object={data.props} />,
|
|
@@ -328,7 +365,7 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
328
365
|
const space = isSpace(data.subject) ? data.subject : getSpace(data.subject);
|
|
329
366
|
const object = isSpace(data.subject)
|
|
330
367
|
? data.subject.state.get() === SpaceState.SPACE_READY
|
|
331
|
-
? (space?.properties[
|
|
368
|
+
? (space?.properties[DataType.Collection.typename]?.target as DataType.Collection)
|
|
332
369
|
: undefined
|
|
333
370
|
: data.subject;
|
|
334
371
|
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { CheckCircle, CircleDashed, CircleNotch } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { createIntent, LayoutAction, useIntentDispatcher, useLayout } from '@dxos/app-framework';
|
|
9
8
|
import { useClient } from '@dxos/react-client';
|
|
10
9
|
import { Filter, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';
|
|
11
|
-
import { Button, Toast, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
10
|
+
import { Button, Icon, Toast, useTranslation } from '@dxos/react-ui';
|
|
13
11
|
|
|
14
12
|
import { SPACE_PLUGIN } from '../meta';
|
|
15
13
|
import { SpaceAction } from '../types';
|
|
@@ -66,17 +64,17 @@ export const AwaitingObject = ({ id }: { id: string }) => {
|
|
|
66
64
|
<Toast.Title classNames='flex items-center gap-2'>
|
|
67
65
|
{found ? (
|
|
68
66
|
<>
|
|
69
|
-
<
|
|
67
|
+
<Icon icon='ph--check-circle--regular' size={5} />
|
|
70
68
|
<span>{t('found object label')}</span>
|
|
71
69
|
</>
|
|
72
70
|
) : waiting ? (
|
|
73
71
|
<>
|
|
74
|
-
<
|
|
72
|
+
<Icon icon='ph--circle-notch--regular' size={5} classNames='animate-spin' />
|
|
75
73
|
<span>{t('waiting for object label')}</span>
|
|
76
74
|
</>
|
|
77
75
|
) : (
|
|
78
76
|
<>
|
|
79
|
-
<
|
|
77
|
+
<Icon icon='ph--circle-dashed--regular' size={5} />
|
|
80
78
|
<span>{t('object not found label')}</span>
|
|
81
79
|
</>
|
|
82
80
|
)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useEffect } from 'react';
|
|
9
9
|
|
|
10
10
|
import { Filter, Obj, Type } from '@dxos/echo';
|
|
@@ -12,11 +12,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
14
|
import { DataType } from '@dxos/schema';
|
|
15
|
-
import {
|
|
15
|
+
import { translations as shellTranslations } from '@dxos/shell/react';
|
|
16
16
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
17
17
|
|
|
18
18
|
import { CreateObjectDialog, type CreateObjectDialogProps } from './CreateObjectDialog';
|
|
19
|
-
import translations from '../../translations';
|
|
19
|
+
import { translations } from '../../translations';
|
|
20
20
|
|
|
21
21
|
const Story = (args: CreateObjectDialogProps) => {
|
|
22
22
|
return (
|
|
@@ -39,7 +39,7 @@ const meta: Meta<typeof CreateObjectDialog> = {
|
|
|
39
39
|
withLayout(),
|
|
40
40
|
],
|
|
41
41
|
parameters: {
|
|
42
|
-
translations: [...translations,
|
|
42
|
+
translations: [...translations, ...shellTranslations],
|
|
43
43
|
},
|
|
44
44
|
args: {},
|
|
45
45
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { pipe } from 'effect';
|
|
5
|
+
import { Effect, pipe } from 'effect';
|
|
6
6
|
import React, { useCallback, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useIntentDispatcher,
|
|
15
15
|
usePluginManager,
|
|
16
16
|
} from '@dxos/app-framework';
|
|
17
|
-
import { Query, Type
|
|
17
|
+
import { Obj, Query, Type } from '@dxos/echo';
|
|
18
18
|
import { invariant } from '@dxos/invariant';
|
|
19
19
|
import { useClient } from '@dxos/react-client';
|
|
20
20
|
import { getSpace, isLiveObject, isSpace, type Space, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
@@ -31,6 +31,7 @@ import { SpaceAction } from '../../types';
|
|
|
31
31
|
export const CREATE_OBJECT_DIALOG = `${SPACE_PLUGIN}/CreateObjectDialog`;
|
|
32
32
|
|
|
33
33
|
export type CreateObjectDialogProps = Pick<CreateObjectPanelProps, 'target' | 'typename' | 'name'> & {
|
|
34
|
+
onCreateObject?: (object: Obj.Any) => void;
|
|
34
35
|
shouldNavigate?: (object: Obj.Any) => boolean;
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -38,6 +39,7 @@ export const CreateObjectDialog = ({
|
|
|
38
39
|
target: initialTarget,
|
|
39
40
|
typename: initialTypename,
|
|
40
41
|
name,
|
|
42
|
+
onCreateObject,
|
|
41
43
|
shouldNavigate: _shouldNavigate,
|
|
42
44
|
}: CreateObjectDialogProps) => {
|
|
43
45
|
const closeRef = useRef<HTMLButtonElement | null>(null);
|
|
@@ -45,7 +47,7 @@ export const CreateObjectDialog = ({
|
|
|
45
47
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
46
48
|
const client = useClient();
|
|
47
49
|
const spaces = useSpaces();
|
|
48
|
-
const {
|
|
50
|
+
const { dispatch } = useIntentDispatcher();
|
|
49
51
|
const forms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
50
52
|
const [target, setTarget] = useState<Space | DataType.Collection | undefined>(initialTarget);
|
|
51
53
|
const [typename, setTypename] = useState<string | undefined>(initialTypename);
|
|
@@ -60,31 +62,33 @@ export const CreateObjectDialog = ({
|
|
|
60
62
|
);
|
|
61
63
|
|
|
62
64
|
const handleCreateObject = useCallback<NonNullable<CreateObjectPanelProps['onCreateObject']>>(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
({ form, data = {} }) =>
|
|
66
|
+
Effect.gen(function* () {
|
|
67
|
+
if (!target) {
|
|
68
|
+
// TODO(wittjosiah): UI feedback.
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// NOTE: Must close before navigating or attention won't follow object.
|
|
73
|
+
closeRef.current?.click();
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
const space = isSpace(target) ? target : getSpace(target);
|
|
76
|
+
invariant(space, 'Missing space');
|
|
77
|
+
const { object } = yield* dispatch(form.getIntent(data, { space }));
|
|
78
|
+
if (isLiveObject(object) && !Obj.instanceOf(DataType.StoredSchema, object)) {
|
|
79
|
+
// TODO(wittjosiah): Selection in navtree isn't working as expected when hidden typenames evals to true.
|
|
80
|
+
const hidden = form.hidden || hiddenTypenames.includes(Type.getTypename(form.objectSchema));
|
|
81
|
+
const addObjectIntent = createIntent(SpaceAction.AddObject, { target, object, hidden });
|
|
82
|
+
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
83
|
+
if (shouldNavigate(object)) {
|
|
84
|
+
yield* dispatch(pipe(addObjectIntent, chain(LayoutAction.Open, { part: 'main' })));
|
|
85
|
+
} else {
|
|
86
|
+
yield* dispatch(addObjectIntent);
|
|
87
|
+
}
|
|
71
88
|
|
|
72
|
-
|
|
73
|
-
invariant(space, 'Missing space');
|
|
74
|
-
const result = await dispatch(form.getIntent(data, { space }));
|
|
75
|
-
const object = result.data?.object;
|
|
76
|
-
if (isLiveObject(object)) {
|
|
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 });
|
|
80
|
-
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
81
|
-
if (shouldNavigate(object)) {
|
|
82
|
-
await dispatch(pipe(addObjectIntent, chain(LayoutAction.Open, { part: 'main' })));
|
|
83
|
-
} else {
|
|
84
|
-
await dispatch(addObjectIntent);
|
|
89
|
+
onCreateObject?.(object);
|
|
85
90
|
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
91
|
+
}).pipe(Effect.runPromise),
|
|
88
92
|
[dispatch, target, resolve, hiddenTypenames, _shouldNavigate],
|
|
89
93
|
);
|
|
90
94
|
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
9
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { translations as shellTranslations } from '@dxos/shell/react';
|
|
11
11
|
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
13
|
import { MembersContainer } from './MembersContainer';
|
|
14
|
-
import translations from '../translations';
|
|
14
|
+
import { translations } from '../translations';
|
|
15
15
|
|
|
16
16
|
const meta: Meta = {
|
|
17
17
|
title: 'plugins/plugin-space/MembersContainer',
|
|
@@ -19,7 +19,7 @@ const meta: Meta = {
|
|
|
19
19
|
decorators: [withClientProvider({ createIdentity: true, createSpace: true }), withTheme, withLayout()],
|
|
20
20
|
parameters: {
|
|
21
21
|
layout: 'fullscreen',
|
|
22
|
-
translations: [...translations,
|
|
22
|
+
translations: [...translations, ...shellTranslations],
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Check, X } from '@phosphor-icons/react';
|
|
6
5
|
import React, { type Dispatch, type SetStateAction, useCallback, useMemo, useState } from 'react';
|
|
7
6
|
import { QR } from 'react-qr-rounded';
|
|
8
7
|
|
|
9
8
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
-
import { Type } from '@dxos/echo';
|
|
11
9
|
import { log } from '@dxos/log';
|
|
12
10
|
import { useConfig } from '@dxos/react-client';
|
|
13
11
|
import { fullyQualifiedId, useSpaceInvitations, type Space } from '@dxos/react-client/echo';
|
|
@@ -15,7 +13,6 @@ import { type CancellableInvitationObservable, Invitation, InvitationEncoder } f
|
|
|
15
13
|
import { Button, Clipboard, Icon, Input, useId, useTranslation } from '@dxos/react-ui';
|
|
16
14
|
import { ControlPage, ControlSection, ControlFrame, ControlFrameItem, ControlItemInput } from '@dxos/react-ui-form';
|
|
17
15
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
18
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
19
16
|
import { DataType } from '@dxos/schema';
|
|
20
17
|
import {
|
|
21
18
|
type ActionMenuItem,
|
|
@@ -67,7 +64,7 @@ export const MembersContainer = ({
|
|
|
67
64
|
};
|
|
68
65
|
|
|
69
66
|
// TODO(wittjosiah): Track which was the most recently viewed object.
|
|
70
|
-
const target = space.properties[
|
|
67
|
+
const target = space.properties[DataType.Collection.typename]?.target?.objects[0]?.target;
|
|
71
68
|
|
|
72
69
|
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
73
70
|
const handleChangeLocked = useCallback(() => {
|
|
@@ -281,5 +278,9 @@ const InvitationAuthCode = ({ id, code, onCancel }: { id: string; code: string;
|
|
|
281
278
|
};
|
|
282
279
|
|
|
283
280
|
const InvitationComplete = ({ statusValue }: { statusValue: number }) => {
|
|
284
|
-
return statusValue > 0 ?
|
|
281
|
+
return statusValue > 0 ? (
|
|
282
|
+
<Icon icon='ph--check--regular' size={6} classNames='m-1.5' />
|
|
283
|
+
) : (
|
|
284
|
+
<Icon icon='ph--x--regular' size={6} classNames='m-1.5' />
|
|
285
|
+
);
|
|
285
286
|
};
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Planet } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { getSpace } from '@dxos/client/echo';
|
|
9
8
|
import { type Obj } from '@dxos/echo';
|
|
10
9
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import { DropdownMenu, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { DropdownMenu, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
11
|
|
|
13
12
|
import { SPACE_PLUGIN } from '../meta';
|
|
14
13
|
import { getSpaceDisplayName } from '../util';
|
|
@@ -25,7 +24,7 @@ export const MenuFooter = ({ object }: { object: Obj.Any }) => {
|
|
|
25
24
|
<dl className='pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2'>
|
|
26
25
|
<dt className='uppercase text-[.75em] tracking-wide font-medium mbs-px self-start'>{t('location label')}</dt>
|
|
27
26
|
<dd className='line-clamp-3'>
|
|
28
|
-
<
|
|
27
|
+
<Icon icon='ph--planet--regular' classNames='inline-block mie-1' />
|
|
29
28
|
{toLocalizedString(spaceName, t)}
|
|
30
29
|
</dd>
|
|
31
30
|
</dl>
|