@dxos/plugin-space 0.8.4-main.66e292d → 0.8.4-main.69d29f4
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/CollectionArticle-XPNA6EHZ.mjs +129 -0
- package/dist/lib/browser/CollectionArticle-XPNA6EHZ.mjs.map +7 -0
- package/dist/lib/browser/ObjectCardStack-TWHN6C2Y.mjs +148 -0
- package/dist/lib/browser/ObjectCardStack-TWHN6C2Y.mjs.map +7 -0
- package/dist/lib/browser/ObjectDetails-GEDIISKK.mjs +142 -0
- package/dist/lib/browser/ObjectDetails-GEDIISKK.mjs.map +7 -0
- package/dist/lib/browser/RecordArticle-W57QE7QV.mjs +107 -0
- package/dist/lib/browser/RecordArticle-W57QE7QV.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-SJHTZXZF.mjs +523 -0
- package/dist/lib/browser/app-graph-builder-SJHTZXZF.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-7AT7QMSK.mjs +84 -0
- package/dist/lib/browser/app-graph-serializer-7AT7QMSK.mjs.map +7 -0
- package/dist/lib/browser/chunk-3X2EA2OA.mjs +1898 -0
- package/dist/lib/browser/chunk-3X2EA2OA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P25R3AOK.mjs → chunk-4WZUGLQQ.mjs} +49 -56
- package/dist/lib/browser/chunk-4WZUGLQQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-ASV6DYFH.mjs +19 -0
- package/dist/lib/browser/chunk-ASV6DYFH.mjs.map +7 -0
- package/dist/lib/browser/chunk-AWVAX26X.mjs +13 -0
- package/dist/lib/browser/chunk-AWVAX26X.mjs.map +7 -0
- package/dist/lib/browser/chunk-CCRSHECL.mjs +714 -0
- package/dist/lib/browser/chunk-CCRSHECL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VZBIIYFM.mjs → chunk-HSMQFM57.mjs} +1 -1
- package/dist/lib/browser/chunk-HSMQFM57.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GJOZILGC.mjs → chunk-SUI34XSA.mjs} +204 -200
- package/dist/lib/browser/chunk-SUI34XSA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-POFUXISV.mjs → chunk-ZT2VPYRM.mjs} +4 -3
- package/dist/lib/browser/{chunk-POFUXISV.mjs.map → chunk-ZT2VPYRM.mjs.map} +2 -2
- package/dist/lib/browser/cli/index.mjs +849 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/identity-created-VCFYLSBB.mjs +23 -0
- package/dist/lib/browser/identity-created-VCFYLSBB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +213 -192
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-SIRQT36Z.mjs +827 -0
- package/dist/lib/browser/operation-resolver-SIRQT36Z.mjs.map +7 -0
- package/dist/lib/browser/react-root-PI7VTZUZ.mjs +30 -0
- package/dist/lib/browser/react-root-PI7VTZUZ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-BPE7VWI7.mjs +382 -0
- package/dist/lib/browser/react-surface-BPE7VWI7.mjs.map +7 -0
- package/dist/lib/browser/{repair-CNLE35NF.mjs → repair-CJG26D52.mjs} +16 -10
- package/dist/lib/browser/repair-CJG26D52.mjs.map +7 -0
- package/dist/lib/browser/settings-ZS2AQ73E.mjs +33 -0
- package/dist/lib/browser/settings-ZS2AQ73E.mjs.map +7 -0
- package/dist/lib/browser/spaces-ready-OQDGWUOS.mjs +242 -0
- package/dist/lib/browser/spaces-ready-OQDGWUOS.mjs.map +7 -0
- package/dist/lib/browser/state-7YZQB2KY.mjs +58 -0
- package/dist/lib/browser/state-7YZQB2KY.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -8
- package/dist/lib/node-esm/CollectionArticle-WGHNZNO2.mjs +130 -0
- package/dist/lib/node-esm/CollectionArticle-WGHNZNO2.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectCardStack-C5ZXRKP7.mjs +149 -0
- package/dist/lib/node-esm/ObjectCardStack-C5ZXRKP7.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectDetails-6ZLDRKCO.mjs +143 -0
- package/dist/lib/node-esm/ObjectDetails-6ZLDRKCO.mjs.map +7 -0
- package/dist/lib/node-esm/RecordArticle-SSV74Z46.mjs +108 -0
- package/dist/lib/node-esm/RecordArticle-SSV74Z46.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-HZ3XXDFZ.mjs +524 -0
- package/dist/lib/node-esm/app-graph-builder-HZ3XXDFZ.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-WJ2TIQG6.mjs +85 -0
- package/dist/lib/node-esm/app-graph-serializer-WJ2TIQG6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AX3UGL5D.mjs → chunk-2SW6S2BB.mjs} +4 -3
- package/dist/lib/node-esm/{chunk-AX3UGL5D.mjs.map → chunk-2SW6S2BB.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-I6FZP42D.mjs → chunk-7KMYUWSR.mjs} +204 -200
- package/dist/lib/node-esm/chunk-7KMYUWSR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CVXULIYC.mjs +20 -0
- package/dist/lib/node-esm/chunk-CVXULIYC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EYS3L2NO.mjs +1899 -0
- package/dist/lib/node-esm/chunk-EYS3L2NO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HREWB23G.mjs +15 -0
- package/dist/lib/node-esm/chunk-HREWB23G.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7EV4SN47.mjs → chunk-JOBIWCBC.mjs} +49 -56
- package/dist/lib/node-esm/chunk-JOBIWCBC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MPL6NHQX.mjs +715 -0
- package/dist/lib/node-esm/chunk-MPL6NHQX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BDEFTL6K.mjs → chunk-SL4BJSUG.mjs} +1 -1
- package/dist/lib/node-esm/chunk-SL4BJSUG.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +850 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/identity-created-2SJABVJD.mjs +25 -0
- package/dist/lib/node-esm/identity-created-2SJABVJD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +213 -192
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-ZE3XJL5J.mjs +828 -0
- package/dist/lib/node-esm/operation-resolver-ZE3XJL5J.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-KUXM33JI.mjs +31 -0
- package/dist/lib/node-esm/react-root-KUXM33JI.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-STCQKUZ4.mjs +383 -0
- package/dist/lib/node-esm/react-surface-STCQKUZ4.mjs.map +7 -0
- package/dist/lib/node-esm/{repair-EHZS6MFY.mjs → repair-G3ZW3VG3.mjs} +16 -10
- package/dist/lib/node-esm/repair-G3ZW3VG3.mjs.map +7 -0
- package/dist/lib/node-esm/settings-PVI2VG56.mjs +34 -0
- package/dist/lib/node-esm/settings-PVI2VG56.mjs.map +7 -0
- package/dist/lib/node-esm/spaces-ready-R744OHQG.mjs +243 -0
- package/dist/lib/node-esm/spaces-ready-R744OHQG.mjs.map +7 -0
- package/dist/lib/node-esm/state-XE5YGPHM.mjs +59 -0
- package/dist/lib/node-esm/state-XE5YGPHM.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -8
- package/dist/types/src/SpacePlugin.d.ts +3 -15
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/identity-created/identity-created.d.ts +5 -0
- package/dist/types/src/capabilities/identity-created/identity-created.d.ts.map +1 -0
- package/dist/types/src/capabilities/identity-created/index.d.ts +3 -0
- package/dist/types/src/capabilities/identity-created/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +10 -20
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +6 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +9 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +8 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/spaces-ready/index.d.ts +3 -0
- package/dist/types/src/capabilities/spaces-ready/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/spaces-ready/spaces-ready.d.ts +5 -0
- package/dist/types/src/capabilities/spaces-ready/spaces-ready.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +13 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +17 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/add.d.ts +17 -0
- package/dist/types/src/cli/commands/database/add.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/index.d.ts +3 -0
- package/dist/types/src/cli/commands/database/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/query/index.d.ts +2 -0
- package/dist/types/src/cli/commands/database/query/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/query/query.d.ts +13 -0
- package/dist/types/src/cli/commands/database/query/query.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/query/query.test.d.ts +2 -0
- package/dist/types/src/cli/commands/database/query/query.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/remove.d.ts +9 -0
- package/dist/types/src/cli/commands/database/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/stats.d.ts +6 -0
- package/dist/types/src/cli/commands/database/stats.d.ts.map +1 -0
- package/dist/types/src/cli/commands/database/util.d.ts +14 -0
- package/dist/types/src/cli/commands/database/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +4 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/queue/index.d.ts +7 -0
- package/dist/types/src/cli/commands/queue/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/queue/query.d.ts +8 -0
- package/dist/types/src/cli/commands/queue/query.d.ts.map +1 -0
- package/dist/types/src/cli/commands/queue/util.d.ts +6 -0
- package/dist/types/src/cli/commands/queue/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/close/close.d.ts +12 -0
- package/dist/types/src/cli/commands/space/close/close.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/close/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/close/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/create/create.d.ts +12 -0
- package/dist/types/src/cli/commands/space/create/create.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/create/create.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/create/create.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/create/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/index.d.ts +31 -0
- package/dist/types/src/cli/commands/space/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/info/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/info/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/info/info.d.ts +13 -0
- package/dist/types/src/cli/commands/space/info/info.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/info/info.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/info/info.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/join/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/join/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/join/join.d.ts +14 -0
- package/dist/types/src/cli/commands/space/join/join.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/join/util.d.ts +17 -0
- package/dist/types/src/cli/commands/space/join/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/list/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/list/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/list/list.d.ts +7 -0
- package/dist/types/src/cli/commands/space/list/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/list/list.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/list/list.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/members/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/members/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/members/members.d.ts +13 -0
- package/dist/types/src/cli/commands/space/members/members.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/members/members.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/members/members.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/members/util.d.ts +9 -0
- package/dist/types/src/cli/commands/space/members/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/open/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/open/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/open/open.d.ts +12 -0
- package/dist/types/src/cli/commands/space/open/open.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/schema/index.d.ts +8 -0
- package/dist/types/src/cli/commands/space/schema/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/schema/list/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/schema/list/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/schema/list/list.d.ts +15 -0
- package/dist/types/src/cli/commands/space/schema/list/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/schema/list/list.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/schema/list/list.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/schema/list/util.d.ts +15 -0
- package/dist/types/src/cli/commands/space/schema/list/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/share/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/share/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/share/share.d.ts +19 -0
- package/dist/types/src/cli/commands/space/share/share.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/sync/index.d.ts +2 -0
- package/dist/types/src/cli/commands/space/sync/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/sync/sync.d.ts +6 -0
- package/dist/types/src/cli/commands/space/sync/sync.d.ts.map +1 -0
- package/dist/types/src/cli/commands/space/sync/sync.test.d.ts +2 -0
- package/dist/types/src/cli/commands/space/sync/sync.test.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +4 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/CollectionArticle.d.ts +5 -2
- package/dist/types/src/components/CollectionArticle.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +2 -2
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +16 -6
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +5 -4
- 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/JoinDialog/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer/MembersContainer.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts +10 -1
- package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts +1 -1
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/ObjectCardStack/ObjectCardStack.d.ts +8 -0
- package/dist/types/src/components/ObjectCardStack/ObjectCardStack.d.ts.map +1 -0
- package/dist/types/src/components/{ObjectDetailsPanel → ObjectCardStack}/ObjectForm.d.ts +2 -3
- package/dist/types/src/components/ObjectCardStack/ObjectForm.d.ts.map +1 -0
- package/dist/types/src/components/ObjectCardStack/index.d.ts +3 -0
- package/dist/types/src/components/ObjectCardStack/index.d.ts.map +1 -0
- package/dist/types/src/components/{ObjectSettings → ObjectDetails}/BaseObjectSettings.d.ts +1 -1
- package/dist/types/src/components/ObjectDetails/BaseObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/{ObjectSettings → ObjectDetails}/BaseObjectSettings.stories.d.ts +9 -0
- package/dist/types/src/components/{ObjectSettings → ObjectDetails}/BaseObjectSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectDetails/ForeignKeys.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetails/ObjectDetails.d.ts +9 -0
- package/dist/types/src/components/ObjectDetails/ObjectDetails.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetails/index.d.ts +3 -0
- package/dist/types/src/components/ObjectDetails/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectRenamePopover/ObjectRenamePopover.d.ts +1 -1
- package/dist/types/src/components/ObjectRenamePopover/ObjectRenamePopover.d.ts.map +1 -1
- package/dist/types/src/components/RecordArticle.d.ts +1 -1
- package/dist/types/src/components/RecordArticle.d.ts.map +1 -1
- package/dist/types/src/components/RecordArticle.stories.d.ts +10 -1
- package/dist/types/src/components/RecordArticle.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts +4 -2
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence/SpacePresence.d.ts +4 -4
- package/dist/types/src/components/SpacePresence/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts +9 -0
- package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceRenamePopover/SpaceRenamePopover.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +10 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +9 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +14 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +6 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/helpers/query.d.ts +3 -4
- package/dist/types/src/helpers/query.d.ts.map +1 -1
- package/dist/types/src/hooks/useActiveSpace.d.ts +2 -2
- package/dist/types/src/hooks/useActiveSpace.d.ts.map +1 -1
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts +2 -8
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts.map +1 -1
- package/dist/types/src/hooks/usePath.d.ts +2 -2
- package/dist/types/src/hooks/usePath.d.ts.map +1 -1
- package/dist/types/src/hooks/useTypeOptions.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +9 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +71 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +9 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/form.d.ts +1 -3
- package/dist/types/src/types/form.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +638 -355
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +35 -31
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +82 -69
- package/src/SpacePlugin.ts +153 -192
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +617 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +82 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/identity-created/identity-created.ts +29 -0
- package/src/capabilities/identity-created/index.ts +7 -0
- package/src/capabilities/index.ts +10 -14
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +760 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +25 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +375 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/{repair.ts → repair/repair.ts} +21 -11
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +32 -0
- package/src/capabilities/spaces-ready/index.ts +7 -0
- package/src/capabilities/spaces-ready/spaces-ready.ts +289 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +64 -0
- package/src/cli/commands/database/add.ts +116 -0
- package/src/cli/commands/database/index.ts +16 -0
- package/src/cli/commands/database/query/index.ts +5 -0
- package/src/cli/commands/database/query/query.test.ts +55 -0
- package/src/cli/commands/database/query/query.ts +44 -0
- package/src/cli/commands/database/remove.ts +51 -0
- package/src/cli/commands/database/stats.ts +44 -0
- package/src/cli/commands/database/util.ts +32 -0
- package/src/cli/commands/index.ts +7 -0
- package/src/cli/commands/queue/index.ts +12 -0
- package/src/cli/commands/queue/query.ts +45 -0
- package/src/cli/commands/queue/util.ts +19 -0
- package/src/cli/commands/space/close/close.ts +40 -0
- package/src/cli/commands/space/close/index.ts +5 -0
- package/src/cli/commands/space/create/create.test.ts +67 -0
- package/src/cli/commands/space/create/create.ts +61 -0
- package/src/cli/commands/space/create/index.ts +5 -0
- package/src/cli/commands/space/index.ts +21 -0
- package/src/cli/commands/space/info/index.ts +5 -0
- package/src/cli/commands/space/info/info.test.ts +47 -0
- package/src/cli/commands/space/info/info.ts +37 -0
- package/src/cli/commands/space/join/index.ts +5 -0
- package/src/cli/commands/space/join/join.ts +122 -0
- package/src/cli/commands/space/join/util.ts +82 -0
- package/src/cli/commands/space/list/index.ts +5 -0
- package/src/cli/commands/space/list/list.test.ts +36 -0
- package/src/cli/commands/space/list/list.ts +30 -0
- package/src/cli/commands/space/members/index.ts +5 -0
- package/src/cli/commands/space/members/members.test.ts +46 -0
- package/src/cli/commands/space/members/members.ts +40 -0
- package/src/cli/commands/space/members/util.ts +29 -0
- package/src/cli/commands/space/open/index.ts +5 -0
- package/src/cli/commands/space/open/open.ts +39 -0
- package/src/cli/commands/space/schema/index.ts +12 -0
- package/src/cli/commands/space/schema/list/index.ts +5 -0
- package/src/cli/commands/space/schema/list/list.test.ts +42 -0
- package/src/cli/commands/space/schema/list/list.ts +64 -0
- package/src/cli/commands/space/schema/list/util.ts +39 -0
- package/src/cli/commands/space/share/index.ts +5 -0
- package/src/cli/commands/space/share/share.ts +112 -0
- package/src/cli/commands/space/sync/index.ts +5 -0
- package/src/cli/commands/space/sync/sync.test.ts +12 -0
- package/src/cli/commands/space/sync/sync.ts +33 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +81 -0
- package/src/components/AwaitingObject.tsx +13 -10
- package/src/components/CollectionArticle.tsx +144 -19
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +27 -21
- package/src/components/CreateDialog/CreateObjectDialog.tsx +39 -47
- package/src/components/CreateDialog/CreateObjectPanel.tsx +125 -70
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +34 -47
- package/src/components/JoinDialog/JoinDialog.tsx +25 -52
- package/src/components/MembersContainer/MembersContainer.stories.tsx +2 -2
- package/src/components/MembersContainer/MembersContainer.tsx +35 -37
- package/src/components/MenuFooter.tsx +1 -1
- package/src/components/ObjectCardStack/ObjectCardStack.tsx +67 -0
- package/src/components/ObjectCardStack/ObjectForm.tsx +97 -0
- package/src/components/ObjectCardStack/index.ts +7 -0
- package/src/components/{ObjectSettings → ObjectDetails}/BaseObjectSettings.stories.tsx +4 -4
- package/src/components/ObjectDetails/BaseObjectSettings.tsx +122 -0
- package/src/components/ObjectDetails/ObjectDetails.tsx +32 -0
- package/src/components/ObjectDetails/index.ts +7 -0
- package/src/components/ObjectRenamePopover/ObjectRenamePopover.tsx +9 -13
- package/src/components/RecordArticle.stories.tsx +12 -12
- package/src/components/RecordArticle.tsx +26 -18
- package/src/components/SchemaContainer.tsx +3 -3
- package/src/components/SpacePluginSettings.tsx +11 -7
- package/src/components/SpacePresence/SpacePresence.tsx +14 -16
- package/src/components/SpaceRenamePopover/SpaceRenamePopover.tsx +11 -12
- package/src/components/SpaceSettings/SpaceSettingsContainer.stories.tsx +4 -4
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +180 -184
- package/src/components/SyncStatus/SyncStatus.tsx +1 -1
- package/src/components/SyncStatus/save-tracker.ts +2 -2
- package/src/components/ViewEditor.tsx +16 -13
- package/src/components/index.ts +5 -5
- package/src/constants.ts +11 -0
- package/src/helpers/query.ts +7 -12
- package/src/hooks/useActiveSpace.ts +6 -4
- package/src/hooks/useInputSurfaceLookup.tsx +8 -17
- package/src/hooks/usePath.ts +4 -4
- package/src/hooks/useTypeOptions.ts +1 -3
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +2 -0
- package/src/types/capabilities.ts +73 -0
- package/src/types/events.ts +15 -0
- package/src/types/form.ts +26 -32
- package/src/types/index.ts +2 -0
- package/src/types/types.ts +528 -247
- package/src/util.tsx +219 -231
- package/dist/lib/browser/CollectionArticle-WTHWY4YS.mjs +0 -31
- package/dist/lib/browser/CollectionArticle-WTHWY4YS.mjs.map +0 -7
- package/dist/lib/browser/ObjectDetailsPanel-ACGHWPDX.mjs +0 -141
- package/dist/lib/browser/ObjectDetailsPanel-ACGHWPDX.mjs.map +0 -7
- package/dist/lib/browser/ObjectSettings-U3IH7BMV.mjs +0 -144
- package/dist/lib/browser/ObjectSettings-U3IH7BMV.mjs.map +0 -7
- package/dist/lib/browser/RecordArticle-2PFEBPXY.mjs +0 -116
- package/dist/lib/browser/RecordArticle-2PFEBPXY.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HABMCWAI.mjs +0 -517
- package/dist/lib/browser/app-graph-builder-HABMCWAI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-G3VFEGTN.mjs +0 -80
- package/dist/lib/browser/app-graph-serializer-G3VFEGTN.mjs.map +0 -7
- package/dist/lib/browser/chunk-6A3NWBB6.mjs +0 -392
- package/dist/lib/browser/chunk-6A3NWBB6.mjs.map +0 -7
- package/dist/lib/browser/chunk-C6DAPIFF.mjs +0 -20
- package/dist/lib/browser/chunk-C6DAPIFF.mjs.map +0 -7
- package/dist/lib/browser/chunk-GJOZILGC.mjs.map +0 -7
- package/dist/lib/browser/chunk-KCZ527AM.mjs +0 -2126
- package/dist/lib/browser/chunk-KCZ527AM.mjs.map +0 -7
- package/dist/lib/browser/chunk-P25R3AOK.mjs.map +0 -7
- package/dist/lib/browser/chunk-VZBIIYFM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WJXU4GKV.mjs +0 -19
- package/dist/lib/browser/chunk-WJXU4GKV.mjs.map +0 -7
- package/dist/lib/browser/identity-created-NAXTPQXE.mjs +0 -23
- package/dist/lib/browser/identity-created-NAXTPQXE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-RZEWNJ2K.mjs +0 -773
- package/dist/lib/browser/intent-resolver-RZEWNJ2K.mjs.map +0 -7
- package/dist/lib/browser/react-root-JCRD74GI.mjs +0 -30
- package/dist/lib/browser/react-root-JCRD74GI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VOETEAG3.mjs +0 -365
- package/dist/lib/browser/react-surface-VOETEAG3.mjs.map +0 -7
- package/dist/lib/browser/repair-CNLE35NF.mjs.map +0 -7
- package/dist/lib/browser/settings-TRLI52I5.mjs +0 -24
- package/dist/lib/browser/settings-TRLI52I5.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-OHGCWZHQ.mjs +0 -208
- package/dist/lib/browser/spaces-ready-OHGCWZHQ.mjs.map +0 -7
- package/dist/lib/browser/state-C7N6EDDZ.mjs +0 -47
- package/dist/lib/browser/state-C7N6EDDZ.mjs.map +0 -7
- package/dist/lib/node-esm/CollectionArticle-KHXYT3SH.mjs +0 -32
- package/dist/lib/node-esm/CollectionArticle-KHXYT3SH.mjs.map +0 -7
- package/dist/lib/node-esm/ObjectDetailsPanel-6OFTT3GG.mjs +0 -142
- package/dist/lib/node-esm/ObjectDetailsPanel-6OFTT3GG.mjs.map +0 -7
- package/dist/lib/node-esm/ObjectSettings-YXPJQMJ5.mjs +0 -145
- package/dist/lib/node-esm/ObjectSettings-YXPJQMJ5.mjs.map +0 -7
- package/dist/lib/node-esm/RecordArticle-SSJ7PULS.mjs +0 -117
- package/dist/lib/node-esm/RecordArticle-SSJ7PULS.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-T6VJKIOA.mjs +0 -518
- package/dist/lib/node-esm/app-graph-builder-T6VJKIOA.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-2NLWWFUB.mjs +0 -81
- package/dist/lib/node-esm/app-graph-serializer-2NLWWFUB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7EV4SN47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BDEFTL6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H4JILUJK.mjs +0 -20
- package/dist/lib/node-esm/chunk-H4JILUJK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-I6FZP42D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JAMGJUFU.mjs +0 -2127
- package/dist/lib/node-esm/chunk-JAMGJUFU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WWGV5FJM.mjs +0 -21
- package/dist/lib/node-esm/chunk-WWGV5FJM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X34VDVMY.mjs +0 -393
- package/dist/lib/node-esm/chunk-X34VDVMY.mjs.map +0 -7
- package/dist/lib/node-esm/identity-created-OXLKCJE3.mjs +0 -25
- package/dist/lib/node-esm/identity-created-OXLKCJE3.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4PHJWDXW.mjs +0 -774
- package/dist/lib/node-esm/intent-resolver-4PHJWDXW.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-O5I5CDJ7.mjs +0 -31
- package/dist/lib/node-esm/react-root-O5I5CDJ7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-J3XDMU2D.mjs +0 -366
- package/dist/lib/node-esm/react-surface-J3XDMU2D.mjs.map +0 -7
- package/dist/lib/node-esm/repair-EHZS6MFY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-MNQTKHL7.mjs +0 -25
- package/dist/lib/node-esm/settings-MNQTKHL7.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-ZPU24DA2.mjs +0 -209
- package/dist/lib/node-esm/spaces-ready-ZPU24DA2.mjs.map +0 -7
- package/dist/lib/node-esm/state-45TXZQJ6.mjs +0 -48
- package/dist/lib/node-esm/state-45TXZQJ6.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -34
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/identity-created.d.ts +0 -4
- package/dist/types/src/capabilities/identity-created.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -9
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -7
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -7
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair.d.ts +0 -4
- package/dist/types/src/capabilities/repair.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/spaces-ready.d.ts +0 -4
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -5
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts +0 -9
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts.map +0 -1
- package/dist/types/src/components/ObjectDetailsPanel/ObjectForm.d.ts.map +0 -1
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts +0 -3
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts +0 -7
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts.map +0 -1
- package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts +0 -8
- package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts.map +0 -1
- package/dist/types/src/components/ObjectSettings/index.d.ts +0 -3
- package/dist/types/src/components/ObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -8
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -689
- package/src/capabilities/app-graph-serializer.ts +0 -76
- package/src/capabilities/capabilities.ts +0 -40
- package/src/capabilities/identity-created.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -706
- package/src/capabilities/react-root.tsx +0 -22
- package/src/capabilities/react-surface.tsx +0 -350
- package/src/capabilities/settings.ts +0 -21
- package/src/capabilities/spaces-ready.ts +0 -243
- package/src/capabilities/state.ts +0 -46
- package/src/components/ObjectDetailsPanel/ObjectDetailsPanel.tsx +0 -51
- package/src/components/ObjectDetailsPanel/ObjectForm.tsx +0 -72
- package/src/components/ObjectDetailsPanel/index.ts +0 -7
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +0 -80
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +0 -111
- package/src/components/ObjectSettings/ObjectSettingsContainer.tsx +0 -37
- package/src/components/ObjectSettings/index.ts +0 -7
- package/src/events.ts +0 -15
- /package/dist/types/src/components/{ObjectSettings → ObjectDetails}/ForeignKeys.d.ts +0 -0
- /package/src/components/{ObjectSettings → ObjectDetails}/ForeignKeys.tsx +0 -0
|
@@ -1,2127 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
useInputSurfaceLookup,
|
|
4
|
-
usePath,
|
|
5
|
-
useTypeOptions
|
|
6
|
-
} from "./chunk-7EV4SN47.mjs";
|
|
7
|
-
import {
|
|
8
|
-
SpaceCapabilities
|
|
9
|
-
} from "./chunk-WWGV5FJM.mjs";
|
|
10
|
-
import {
|
|
11
|
-
COMPOSER_SPACE_LOCK,
|
|
12
|
-
getSpaceDisplayName
|
|
13
|
-
} from "./chunk-I6FZP42D.mjs";
|
|
14
|
-
import {
|
|
15
|
-
SpaceAction,
|
|
16
|
-
SpaceForm
|
|
17
|
-
} from "./chunk-X34VDVMY.mjs";
|
|
18
|
-
import {
|
|
19
|
-
meta
|
|
20
|
-
} from "./chunk-BDEFTL6K.mjs";
|
|
21
|
-
|
|
22
|
-
// src/components/AwaitingObject.tsx
|
|
23
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
24
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
25
|
-
import { LayoutAction, createIntent } from "@dxos/app-framework";
|
|
26
|
-
import { useIntentDispatcher, useLayout } from "@dxos/app-framework/react";
|
|
27
|
-
import { Obj } from "@dxos/echo";
|
|
28
|
-
import { useClient } from "@dxos/react-client";
|
|
29
|
-
import { Filter, useQuery } from "@dxos/react-client/echo";
|
|
30
|
-
import { Button, Icon, Toast, useTranslation } from "@dxos/react-ui";
|
|
31
|
-
var WAIT_FOR_OBJECT_TIMEOUT = 3 * 60 * 1e3;
|
|
32
|
-
var TOAST_TIMEOUT = 4 * 60 * 1e3;
|
|
33
|
-
var AwaitingObject = ({ id }) => {
|
|
34
|
-
var _effect = _useSignals();
|
|
35
|
-
try {
|
|
36
|
-
const { t } = useTranslation(meta.id);
|
|
37
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
38
|
-
const [open, setOpen] = useState(true);
|
|
39
|
-
const [waiting, setWaiting] = useState(true);
|
|
40
|
-
const [found, setFound] = useState(false);
|
|
41
|
-
const layout = useLayout();
|
|
42
|
-
const client = useClient();
|
|
43
|
-
const objects = useQuery(client.spaces, Filter.everything());
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (!id) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const timeout = setTimeout(() => setWaiting(false), WAIT_FOR_OBJECT_TIMEOUT);
|
|
49
|
-
return () => clearTimeout(timeout);
|
|
50
|
-
}, [
|
|
51
|
-
id
|
|
52
|
-
]);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (objects.findIndex((object) => Obj.getDXN(object).toString() === id) > -1) {
|
|
55
|
-
setFound(true);
|
|
56
|
-
if (layout.active.includes(id)) {
|
|
57
|
-
setOpen(false);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, [
|
|
61
|
-
id,
|
|
62
|
-
objects,
|
|
63
|
-
layout
|
|
64
|
-
]);
|
|
65
|
-
const handleClose = useCallback(async () => dispatch(createIntent(SpaceAction.WaitForObject, {
|
|
66
|
-
id: void 0
|
|
67
|
-
})), [
|
|
68
|
-
dispatch
|
|
69
|
-
]);
|
|
70
|
-
const handleNavigate = useCallback(() => {
|
|
71
|
-
void dispatch(createIntent(LayoutAction.Open, {
|
|
72
|
-
part: "main",
|
|
73
|
-
subject: [
|
|
74
|
-
id
|
|
75
|
-
]
|
|
76
|
-
}));
|
|
77
|
-
void handleClose();
|
|
78
|
-
}, [
|
|
79
|
-
id,
|
|
80
|
-
handleClose,
|
|
81
|
-
dispatch
|
|
82
|
-
]);
|
|
83
|
-
return /* @__PURE__ */ React.createElement(Toast.Root, {
|
|
84
|
-
open,
|
|
85
|
-
duration: TOAST_TIMEOUT,
|
|
86
|
-
onOpenChange: setOpen
|
|
87
|
-
}, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
|
|
88
|
-
classNames: "flex items-center gap-2"
|
|
89
|
-
}, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
|
|
90
|
-
icon: "ph--check-circle--regular",
|
|
91
|
-
size: 5
|
|
92
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("found object label"))) : waiting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
|
|
93
|
-
icon: "ph--circle-notch--regular",
|
|
94
|
-
size: 5,
|
|
95
|
-
classNames: "animate-spin"
|
|
96
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("waiting for object label"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, {
|
|
97
|
-
icon: "ph--circle-dashed--regular",
|
|
98
|
-
size: 5
|
|
99
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("object not found label")))), /* @__PURE__ */ React.createElement(Toast.Description, null, t(found ? "found object description" : waiting ? "waiting for object description" : "object not found description"))), /* @__PURE__ */ React.createElement(Toast.Actions, null, found ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toast.Action, {
|
|
100
|
-
altText: t("go to object alt"),
|
|
101
|
-
asChild: true
|
|
102
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
103
|
-
variant: "primary",
|
|
104
|
-
onClick: handleNavigate
|
|
105
|
-
}, t("go to object label"))), /* @__PURE__ */ React.createElement(Toast.Close, {
|
|
106
|
-
asChild: true
|
|
107
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
108
|
-
onClick: handleClose
|
|
109
|
-
}, t("close label", {
|
|
110
|
-
ns: "appkit"
|
|
111
|
-
})))) : /* @__PURE__ */ React.createElement(Toast.Close, {
|
|
112
|
-
asChild: true
|
|
113
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
114
|
-
onClick: handleClose
|
|
115
|
-
}, t(waiting ? "close label" : "confirm label", {
|
|
116
|
-
ns: "appkit"
|
|
117
|
-
})))));
|
|
118
|
-
} finally {
|
|
119
|
-
_effect.f();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// src/components/CreateDialog/CreateObjectDialog.tsx
|
|
124
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
125
|
-
import * as Effect from "effect/Effect";
|
|
126
|
-
import * as Function2 from "effect/Function";
|
|
127
|
-
import * as Option2 from "effect/Option";
|
|
128
|
-
import React3, { useCallback as useCallback3, useMemo, useRef, useState as useState2 } from "react";
|
|
129
|
-
import { Capabilities, LayoutAction as LayoutAction2, chain, createIntent as createIntent2 } from "@dxos/app-framework";
|
|
130
|
-
import { useIntentDispatcher as useIntentDispatcher2, usePluginManager } from "@dxos/app-framework/react";
|
|
131
|
-
import { Obj as Obj2, Type } from "@dxos/echo";
|
|
132
|
-
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation as getTypeAnnotation2 } from "@dxos/echo/internal";
|
|
133
|
-
import { invariant } from "@dxos/invariant";
|
|
134
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
135
|
-
import { getSpace, isLiveObject, isSpace, useSpaces } from "@dxos/react-client/echo";
|
|
136
|
-
import { Dialog, IconButton, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
137
|
-
import { cardDialogContent, cardDialogHeader } from "@dxos/react-ui-stack";
|
|
138
|
-
|
|
139
|
-
// src/components/CreateDialog/CreateObjectPanel.tsx
|
|
140
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
141
|
-
import * as Option from "effect/Option";
|
|
142
|
-
import React2, { useCallback as useCallback2 } from "react";
|
|
143
|
-
import { getTypeAnnotation } from "@dxos/echo/internal";
|
|
144
|
-
import { Icon as Icon2, toLocalizedString, useDefaultValue, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
145
|
-
import { Form } from "@dxos/react-ui-form";
|
|
146
|
-
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
147
|
-
import { cardDialogOverflow, cardDialogPaddedOverflow, cardDialogSearchListRoot } from "@dxos/react-ui-stack";
|
|
148
|
-
import { ViewAnnotation } from "@dxos/schema";
|
|
149
|
-
import { isNonNullable } from "@dxos/util";
|
|
150
|
-
var CreateObjectPanel = ({ schemas, spaces, typename, target, views, initialFormValues: _initialFormValues, defaultSpaceId, resolve, onTargetChange, onTypenameChange, onCreateObject }) => {
|
|
151
|
-
var _effect = _useSignals2();
|
|
152
|
-
try {
|
|
153
|
-
const { t } = useTranslation2(meta.id);
|
|
154
|
-
const initialFormValues = useDefaultValue(_initialFormValues, () => ({}));
|
|
155
|
-
const metadata = typename && resolve?.(typename);
|
|
156
|
-
const options = schemas.filter((schema) => {
|
|
157
|
-
if (views == null) {
|
|
158
|
-
return true;
|
|
159
|
-
} else {
|
|
160
|
-
return views === ViewAnnotation.get(schema).pipe(Option.getOrElse(() => false));
|
|
161
|
-
}
|
|
162
|
-
}).map((schema) => getTypeAnnotation(schema)).filter(isNonNullable).sort((a, b) => {
|
|
163
|
-
const nameA = t("typename label", {
|
|
164
|
-
ns: a.typename,
|
|
165
|
-
defaultValue: a.typename
|
|
166
|
-
});
|
|
167
|
-
const nameB = t("typename label", {
|
|
168
|
-
ns: b.typename,
|
|
169
|
-
defaultValue: b.typename
|
|
170
|
-
});
|
|
171
|
-
return nameA.localeCompare(nameB);
|
|
172
|
-
});
|
|
173
|
-
const handleCreateObject = useCallback2(async (props) => {
|
|
174
|
-
if (!metadata) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
await onCreateObject?.({
|
|
178
|
-
metadata,
|
|
179
|
-
data: props
|
|
180
|
-
});
|
|
181
|
-
}, [
|
|
182
|
-
onCreateObject,
|
|
183
|
-
metadata
|
|
184
|
-
]);
|
|
185
|
-
const handleSetTypename = useCallback2(async (typename2) => {
|
|
186
|
-
const metadata2 = resolve?.(typename2);
|
|
187
|
-
if (metadata2 && !metadata2.inputSchema) {
|
|
188
|
-
await onCreateObject?.({
|
|
189
|
-
metadata: metadata2
|
|
190
|
-
});
|
|
191
|
-
} else {
|
|
192
|
-
onTypenameChange?.(typename2);
|
|
193
|
-
}
|
|
194
|
-
}, [
|
|
195
|
-
resolve,
|
|
196
|
-
onCreateObject
|
|
197
|
-
]);
|
|
198
|
-
const inputSurfaceLookup = useInputSurfaceLookup({
|
|
199
|
-
target
|
|
200
|
-
});
|
|
201
|
-
return !metadata ? /* @__PURE__ */ React2.createElement(SelectSchema, {
|
|
202
|
-
options,
|
|
203
|
-
resolve,
|
|
204
|
-
onChange: handleSetTypename
|
|
205
|
-
}) : !target ? /* @__PURE__ */ React2.createElement(SelectSpace, {
|
|
206
|
-
spaces,
|
|
207
|
-
defaultSpaceId,
|
|
208
|
-
onChange: onTargetChange
|
|
209
|
-
}) : metadata.inputSchema ? /* @__PURE__ */ React2.createElement("div", {
|
|
210
|
-
role: "none",
|
|
211
|
-
className: cardDialogOverflow
|
|
212
|
-
}, /* @__PURE__ */ React2.createElement(Form, {
|
|
213
|
-
autoFocus: true,
|
|
214
|
-
values: initialFormValues,
|
|
215
|
-
schema: metadata.inputSchema,
|
|
216
|
-
testId: "create-object-form",
|
|
217
|
-
onSave: handleCreateObject,
|
|
218
|
-
lookupComponent: inputSurfaceLookup,
|
|
219
|
-
outerSpacing: "blockStart-0"
|
|
220
|
-
})) : null;
|
|
221
|
-
} finally {
|
|
222
|
-
_effect.f();
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
var SelectSpace = ({ spaces, defaultSpaceId, onChange }) => {
|
|
226
|
-
var _effect = _useSignals2();
|
|
227
|
-
try {
|
|
228
|
-
const { t } = useTranslation2(meta.id);
|
|
229
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
230
|
-
label: t("space input label"),
|
|
231
|
-
classNames: cardDialogSearchListRoot
|
|
232
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
233
|
-
autoFocus: true,
|
|
234
|
-
"data-testid": "create-object-form.space-input",
|
|
235
|
-
placeholder: t("space input placeholder")
|
|
236
|
-
}), /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
237
|
-
classNames: [
|
|
238
|
-
cardDialogOverflow,
|
|
239
|
-
"plb-cardSpacingBlock"
|
|
240
|
-
]
|
|
241
|
-
}, spaces.sort((a, b) => {
|
|
242
|
-
const aName = toLocalizedString(getSpaceDisplayName(a, {
|
|
243
|
-
personal: a.id === defaultSpaceId
|
|
244
|
-
}), t);
|
|
245
|
-
const bName = toLocalizedString(getSpaceDisplayName(b, {
|
|
246
|
-
personal: b.id === defaultSpaceId
|
|
247
|
-
}), t);
|
|
248
|
-
return aName.localeCompare(bName);
|
|
249
|
-
}).map((space) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
250
|
-
key: space.id,
|
|
251
|
-
value: toLocalizedString(getSpaceDisplayName(space, {
|
|
252
|
-
personal: space.id === defaultSpaceId
|
|
253
|
-
}), t),
|
|
254
|
-
onSelect: () => onChange?.(space),
|
|
255
|
-
classNames: "flex items-center gap-2"
|
|
256
|
-
}, /* @__PURE__ */ React2.createElement("span", {
|
|
257
|
-
className: "grow truncate"
|
|
258
|
-
}, toLocalizedString(getSpaceDisplayName(space, {
|
|
259
|
-
personal: space.id === defaultSpaceId
|
|
260
|
-
}), t))))));
|
|
261
|
-
} finally {
|
|
262
|
-
_effect.f();
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
var SelectSchema = ({ options, resolve, onChange }) => {
|
|
266
|
-
var _effect = _useSignals2();
|
|
267
|
-
try {
|
|
268
|
-
const { t } = useTranslation2(meta.id);
|
|
269
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
270
|
-
label: t("schema input label"),
|
|
271
|
-
classNames: cardDialogSearchListRoot
|
|
272
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
273
|
-
autoFocus: true,
|
|
274
|
-
"data-testid": "create-object-form.schema-input",
|
|
275
|
-
placeholder: t("schema input placeholder")
|
|
276
|
-
}), /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
277
|
-
classNames: cardDialogPaddedOverflow
|
|
278
|
-
}, options.map((option) => /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
279
|
-
key: option.typename,
|
|
280
|
-
value: t("typename label", {
|
|
281
|
-
ns: option.typename,
|
|
282
|
-
defaultValue: option.typename
|
|
283
|
-
}),
|
|
284
|
-
onSelect: () => onChange(option.typename),
|
|
285
|
-
classNames: "flex items-center gap-2"
|
|
286
|
-
}, /* @__PURE__ */ React2.createElement("span", {
|
|
287
|
-
className: "flex gap-2 items-center grow truncate"
|
|
288
|
-
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
289
|
-
icon: resolve?.(option.typename)?.icon ?? "ph--placeholder--regular",
|
|
290
|
-
size: 5
|
|
291
|
-
}), t("typename label", {
|
|
292
|
-
ns: option.typename,
|
|
293
|
-
defaultValue: option.typename
|
|
294
|
-
}))))));
|
|
295
|
-
} finally {
|
|
296
|
-
_effect.f();
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
// src/components/CreateDialog/CreateObjectDialog.tsx
|
|
301
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/CreateDialog/CreateObjectDialog.tsx";
|
|
302
|
-
var CREATE_OBJECT_DIALOG = `${meta.id}/CreateObjectDialog`;
|
|
303
|
-
var CreateObjectDialog = ({ target: initialTarget, typename: initialTypename, views, initialFormValues, onCreateObject, shouldNavigate: _shouldNavigate }) => {
|
|
304
|
-
var _effect = _useSignals3();
|
|
305
|
-
try {
|
|
306
|
-
const manager = usePluginManager();
|
|
307
|
-
const { t } = useTranslation3(meta.id);
|
|
308
|
-
const { dispatch } = useIntentDispatcher2();
|
|
309
|
-
const [target, setTarget] = useState2(initialTarget);
|
|
310
|
-
const [typename, setTypename] = useState2(initialTypename);
|
|
311
|
-
const client = useClient2();
|
|
312
|
-
const spaces = useSpaces();
|
|
313
|
-
const closeRef = useRef(null);
|
|
314
|
-
const resolve = useCallback3((typename2) => {
|
|
315
|
-
const metadata = manager.context.getCapabilities(Capabilities.Metadata).find(({ id }) => id === typename2)?.metadata;
|
|
316
|
-
return metadata?.createObjectIntent ? metadata : void 0;
|
|
317
|
-
}, [
|
|
318
|
-
manager
|
|
319
|
-
]);
|
|
320
|
-
const space = isSpace(target) ? target : getSpace(target);
|
|
321
|
-
const schemas = space?.db.schemaRegistry.query({
|
|
322
|
-
location: [
|
|
323
|
-
"runtime"
|
|
324
|
-
]
|
|
325
|
-
}).runSync();
|
|
326
|
-
const userSchemas = useMemo(() => schemas?.filter((schema) => getTypeAnnotation2(schema)?.kind !== EntityKind.Relation).filter((schema) => !!resolve(Type.getTypename(schema))).filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option2.getOrElse(() => false))) ?? [], [
|
|
327
|
-
schemas
|
|
328
|
-
]);
|
|
329
|
-
const handleCreateObject = useCallback3(({ metadata, data = {} }) => Effect.gen(function* () {
|
|
330
|
-
if (!target) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
closeRef.current?.click();
|
|
334
|
-
const space2 = isSpace(target) ? target : getSpace(target);
|
|
335
|
-
invariant(space2, "Missing space", {
|
|
336
|
-
F: __dxlog_file,
|
|
337
|
-
L: 87,
|
|
338
|
-
S: this,
|
|
339
|
-
A: [
|
|
340
|
-
"space",
|
|
341
|
-
"'Missing space'"
|
|
342
|
-
]
|
|
343
|
-
});
|
|
344
|
-
const { object } = yield* dispatch(metadata.createObjectIntent(data, {
|
|
345
|
-
space: space2
|
|
346
|
-
}));
|
|
347
|
-
if (isLiveObject(object) && !Obj2.instanceOf(Type.PersistentType, object)) {
|
|
348
|
-
const hidden = !metadata.addToCollectionOnCreate;
|
|
349
|
-
const addObjectIntent = createIntent2(SpaceAction.AddObject, {
|
|
350
|
-
target,
|
|
351
|
-
object,
|
|
352
|
-
hidden
|
|
353
|
-
});
|
|
354
|
-
const shouldNavigate = _shouldNavigate ?? (() => true);
|
|
355
|
-
if (shouldNavigate(object)) {
|
|
356
|
-
yield* dispatch(Function2.pipe(addObjectIntent, chain(LayoutAction2.Open, {
|
|
357
|
-
part: "main"
|
|
358
|
-
})));
|
|
359
|
-
} else {
|
|
360
|
-
yield* dispatch(addObjectIntent);
|
|
361
|
-
}
|
|
362
|
-
onCreateObject?.(object);
|
|
363
|
-
}
|
|
364
|
-
}).pipe(Effect.runPromise), [
|
|
365
|
-
dispatch,
|
|
366
|
-
target,
|
|
367
|
-
resolve,
|
|
368
|
-
_shouldNavigate
|
|
369
|
-
]);
|
|
370
|
-
return (
|
|
371
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
372
|
-
// Consider factoring it out to the tabs package.
|
|
373
|
-
/* @__PURE__ */ React3.createElement(Dialog.Content, {
|
|
374
|
-
classNames: cardDialogContent
|
|
375
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
376
|
-
role: "none",
|
|
377
|
-
className: cardDialogHeader
|
|
378
|
-
}, /* @__PURE__ */ React3.createElement(Dialog.Title, null, t("create object dialog title", {
|
|
379
|
-
object: t("typename label", {
|
|
380
|
-
ns: typename,
|
|
381
|
-
defaultValue: views ? "View" : "Object"
|
|
382
|
-
})
|
|
383
|
-
})), /* @__PURE__ */ React3.createElement(Dialog.Close, {
|
|
384
|
-
asChild: true
|
|
385
|
-
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
386
|
-
ref: closeRef,
|
|
387
|
-
icon: "ph--x--regular",
|
|
388
|
-
size: 4,
|
|
389
|
-
label: "Close",
|
|
390
|
-
iconOnly: true,
|
|
391
|
-
density: "fine",
|
|
392
|
-
variant: "ghost",
|
|
393
|
-
autoFocus: true
|
|
394
|
-
}))), /* @__PURE__ */ React3.createElement(CreateObjectPanel, {
|
|
395
|
-
schemas: userSchemas,
|
|
396
|
-
spaces,
|
|
397
|
-
target,
|
|
398
|
-
views,
|
|
399
|
-
typename,
|
|
400
|
-
initialFormValues,
|
|
401
|
-
defaultSpaceId: client.spaces.default.id,
|
|
402
|
-
resolve,
|
|
403
|
-
onTargetChange: setTarget,
|
|
404
|
-
onTypenameChange: setTypename,
|
|
405
|
-
onCreateObject: handleCreateObject
|
|
406
|
-
}))
|
|
407
|
-
);
|
|
408
|
-
} finally {
|
|
409
|
-
_effect.f();
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
// src/components/CreateDialog/CreateSpaceDialog.tsx
|
|
414
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
415
|
-
import * as Effect2 from "effect/Effect";
|
|
416
|
-
import React4, { useCallback as useCallback4, useRef as useRef2 } from "react";
|
|
417
|
-
import { LayoutAction as LayoutAction3, createIntent as createIntent3 } from "@dxos/app-framework";
|
|
418
|
-
import { useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework/react";
|
|
419
|
-
import { Dialog as Dialog2, IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
420
|
-
import { Form as Form2 } from "@dxos/react-ui-form";
|
|
421
|
-
import { cardDialogContent as cardDialogContent2, cardDialogHeader as cardDialogHeader2 } from "@dxos/react-ui-stack";
|
|
422
|
-
var CREATE_SPACE_DIALOG = `${meta.id}/CreateSpaceDialog`;
|
|
423
|
-
var initialValues = {
|
|
424
|
-
edgeReplication: true
|
|
425
|
-
};
|
|
426
|
-
var CreateSpaceDialog = () => {
|
|
427
|
-
var _effect = _useSignals4();
|
|
428
|
-
try {
|
|
429
|
-
const closeRef = useRef2(null);
|
|
430
|
-
const { t } = useTranslation4(meta.id);
|
|
431
|
-
const { dispatch } = useIntentDispatcher3();
|
|
432
|
-
const inputSurfaceLookup = useInputSurfaceLookup();
|
|
433
|
-
const handleCreateSpace = useCallback4(async (data) => {
|
|
434
|
-
const program = Effect2.gen(function* () {
|
|
435
|
-
const { space } = yield* dispatch(createIntent3(SpaceAction.Create, data));
|
|
436
|
-
yield* dispatch(createIntent3(LayoutAction3.SwitchWorkspace, {
|
|
437
|
-
part: "workspace",
|
|
438
|
-
subject: space.id
|
|
439
|
-
}));
|
|
440
|
-
yield* dispatch(createIntent3(LayoutAction3.UpdateDialog, {
|
|
441
|
-
part: "dialog",
|
|
442
|
-
options: {
|
|
443
|
-
state: false
|
|
444
|
-
}
|
|
445
|
-
}));
|
|
446
|
-
});
|
|
447
|
-
await Effect2.runPromise(program);
|
|
448
|
-
}, [
|
|
449
|
-
dispatch
|
|
450
|
-
]);
|
|
451
|
-
return (
|
|
452
|
-
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
453
|
-
// Consider factoring it out to the tabs package.
|
|
454
|
-
/* @__PURE__ */ React4.createElement(Dialog2.Content, {
|
|
455
|
-
classNames: cardDialogContent2
|
|
456
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
457
|
-
role: "none",
|
|
458
|
-
className: cardDialogHeader2
|
|
459
|
-
}, /* @__PURE__ */ React4.createElement(Dialog2.Title, null, t("create space dialog title")), /* @__PURE__ */ React4.createElement(Dialog2.Close, {
|
|
460
|
-
asChild: true
|
|
461
|
-
}, /* @__PURE__ */ React4.createElement(IconButton2, {
|
|
462
|
-
ref: closeRef,
|
|
463
|
-
icon: "ph--x--regular",
|
|
464
|
-
size: 4,
|
|
465
|
-
label: "Close",
|
|
466
|
-
iconOnly: true,
|
|
467
|
-
density: "fine",
|
|
468
|
-
variant: "ghost",
|
|
469
|
-
autoFocus: true
|
|
470
|
-
}))), /* @__PURE__ */ React4.createElement("div", {
|
|
471
|
-
role: "none",
|
|
472
|
-
className: "contents"
|
|
473
|
-
}, /* @__PURE__ */ React4.createElement(Form2, {
|
|
474
|
-
testId: "create-space-form",
|
|
475
|
-
autoFocus: true,
|
|
476
|
-
values: initialValues,
|
|
477
|
-
schema: SpaceForm,
|
|
478
|
-
lookupComponent: inputSurfaceLookup,
|
|
479
|
-
onSave: handleCreateSpace,
|
|
480
|
-
outerSpacing: "scroll-fields"
|
|
481
|
-
})))
|
|
482
|
-
);
|
|
483
|
-
} finally {
|
|
484
|
-
_effect.f();
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
// src/components/CollectionSection.tsx
|
|
489
|
-
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
490
|
-
import React5 from "react";
|
|
491
|
-
import { useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
492
|
-
var CollectionSection = ({ role, subject }) => {
|
|
493
|
-
var _effect = _useSignals5();
|
|
494
|
-
try {
|
|
495
|
-
const { t } = useTranslation5(meta.id);
|
|
496
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
497
|
-
role,
|
|
498
|
-
className: "min-bs-[3.5rem] grid grid-rows-subgrid grid-cols-subgrid items-center"
|
|
499
|
-
}, /* @__PURE__ */ React5.createElement("span", {
|
|
500
|
-
className: "truncate"
|
|
501
|
-
}, subject.name ?? t("unnamed collection label")));
|
|
502
|
-
} finally {
|
|
503
|
-
_effect.f();
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
// src/components/JoinDialog/JoinDialog.tsx
|
|
508
|
-
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
509
|
-
import React6, { useCallback as useCallback5 } from "react";
|
|
510
|
-
import { LayoutAction as LayoutAction4, createIntent as createIntent4 } from "@dxos/app-framework";
|
|
511
|
-
import { useAppGraph, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework/react";
|
|
512
|
-
import { Trigger } from "@dxos/async";
|
|
513
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
514
|
-
import { useClient as useClient3 } from "@dxos/react-client";
|
|
515
|
-
import { Dialog as Dialog3, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
516
|
-
import { JoinPanel } from "@dxos/shell/react";
|
|
517
|
-
var JOIN_DIALOG = `${meta.id}/JoinDialog`;
|
|
518
|
-
var JoinDialog = ({ navigableCollections, onDone, ...props }) => {
|
|
519
|
-
var _effect = _useSignals6();
|
|
520
|
-
try {
|
|
521
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
522
|
-
const client = useClient3();
|
|
523
|
-
const { graph } = useAppGraph();
|
|
524
|
-
const { t } = useTranslation6(meta.id);
|
|
525
|
-
const handleDone = useCallback5(async (result) => {
|
|
526
|
-
const spaceKey = result?.spaceKey;
|
|
527
|
-
if (!spaceKey) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
await Promise.all([
|
|
531
|
-
dispatch(createIntent4(LayoutAction4.AddToast, {
|
|
532
|
-
part: "toast",
|
|
533
|
-
subject: {
|
|
534
|
-
id: `${meta.id}/join-success`,
|
|
535
|
-
duration: 5e3,
|
|
536
|
-
title: [
|
|
537
|
-
"join success label",
|
|
538
|
-
{
|
|
539
|
-
ns: meta.id
|
|
540
|
-
}
|
|
541
|
-
],
|
|
542
|
-
closeLabel: [
|
|
543
|
-
"dismiss label",
|
|
544
|
-
{
|
|
545
|
-
ns: meta.id
|
|
546
|
-
}
|
|
547
|
-
]
|
|
548
|
-
}
|
|
549
|
-
})),
|
|
550
|
-
dispatch(createIntent4(LayoutAction4.UpdateDialog, {
|
|
551
|
-
part: "dialog",
|
|
552
|
-
options: {
|
|
553
|
-
state: false
|
|
554
|
-
}
|
|
555
|
-
}))
|
|
556
|
-
]);
|
|
557
|
-
let space = client.spaces.get(spaceKey);
|
|
558
|
-
if (!space) {
|
|
559
|
-
const trigger = new Trigger();
|
|
560
|
-
client.spaces.subscribe(() => {
|
|
561
|
-
const space2 = client.spaces.get(spaceKey);
|
|
562
|
-
if (space2) {
|
|
563
|
-
trigger.wake(space2);
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
space = await trigger.wait();
|
|
567
|
-
}
|
|
568
|
-
await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
|
|
569
|
-
part: "workspace",
|
|
570
|
-
subject: space.id
|
|
571
|
-
}));
|
|
572
|
-
const target = result?.target || (navigableCollections ? space?.id : void 0);
|
|
573
|
-
if (target) {
|
|
574
|
-
await graph.waitForPath({
|
|
575
|
-
target
|
|
576
|
-
}).catch(() => {
|
|
577
|
-
});
|
|
578
|
-
await Promise.all([
|
|
579
|
-
dispatch(createIntent4(LayoutAction4.Open, {
|
|
580
|
-
part: "main",
|
|
581
|
-
subject: [
|
|
582
|
-
target
|
|
583
|
-
]
|
|
584
|
-
})),
|
|
585
|
-
dispatch(createIntent4(LayoutAction4.Expose, {
|
|
586
|
-
part: "navigation",
|
|
587
|
-
subject: target
|
|
588
|
-
}))
|
|
589
|
-
]);
|
|
590
|
-
}
|
|
591
|
-
await onDone?.(result);
|
|
592
|
-
if (space) {
|
|
593
|
-
await dispatch(createIntent4(ObservabilityAction.SendEvent, {
|
|
594
|
-
name: "space.join",
|
|
595
|
-
properties: {
|
|
596
|
-
spaceId: space.id
|
|
597
|
-
}
|
|
598
|
-
}));
|
|
599
|
-
}
|
|
600
|
-
}, [
|
|
601
|
-
dispatch,
|
|
602
|
-
client,
|
|
603
|
-
graph
|
|
604
|
-
]);
|
|
605
|
-
return /* @__PURE__ */ React6.createElement(Dialog3.Content, null, /* @__PURE__ */ React6.createElement(Dialog3.Title, {
|
|
606
|
-
classNames: "sr-only"
|
|
607
|
-
}, t("join space label", {
|
|
608
|
-
ns: "os"
|
|
609
|
-
})), /* @__PURE__ */ React6.createElement(JoinPanel, {
|
|
610
|
-
...props,
|
|
611
|
-
exitActionParent: /* @__PURE__ */ React6.createElement(Dialog3.Close, {
|
|
612
|
-
asChild: true
|
|
613
|
-
}),
|
|
614
|
-
doneActionParent: /* @__PURE__ */ React6.createElement(Dialog3.Close, {
|
|
615
|
-
asChild: true
|
|
616
|
-
}),
|
|
617
|
-
onDone: handleDone
|
|
618
|
-
}));
|
|
619
|
-
} finally {
|
|
620
|
-
_effect.f();
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
// src/components/MembersContainer/MembersContainer.tsx
|
|
625
|
-
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
626
|
-
import React7, { useCallback as useCallback6, useMemo as useMemo2, useState as useState3 } from "react";
|
|
627
|
-
import { QR } from "react-qr-rounded";
|
|
628
|
-
import { createIntent as createIntent5 } from "@dxos/app-framework";
|
|
629
|
-
import { useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework/react";
|
|
630
|
-
import { Obj as Obj3 } from "@dxos/echo";
|
|
631
|
-
import { log } from "@dxos/log";
|
|
632
|
-
import { useConfig } from "@dxos/react-client";
|
|
633
|
-
import { useSpaceInvitations } from "@dxos/react-client/echo";
|
|
634
|
-
import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
|
|
635
|
-
import { Button as Button2, Clipboard, Icon as Icon3, Input, useId, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
636
|
-
import { ControlFrame, ControlFrameItem, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
637
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
638
|
-
import { Collection } from "@dxos/schema";
|
|
639
|
-
import { AuthCode, BifurcatedAction, Centered, Emoji, InvitationList, SpaceMemberList, Viewport } from "@dxos/shell/react";
|
|
640
|
-
import { hexToEmoji } from "@dxos/util";
|
|
641
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/MembersContainer/MembersContainer.tsx";
|
|
642
|
-
var activeActionKey = "dxos:react-shell/space-manager/active-action";
|
|
643
|
-
var handleInvitationEvent = (invitation, subscription) => {
|
|
644
|
-
const invitationCode = InvitationEncoder.encode(invitation);
|
|
645
|
-
if (invitation.state === Invitation.State.CONNECTING) {
|
|
646
|
-
log.info(JSON.stringify({
|
|
647
|
-
invitationCode,
|
|
648
|
-
authCode: invitation.authCode
|
|
649
|
-
}), void 0, {
|
|
650
|
-
F: __dxlog_file2,
|
|
651
|
-
L: 41,
|
|
652
|
-
S: void 0,
|
|
653
|
-
C: (f, a) => f(...a)
|
|
654
|
-
});
|
|
655
|
-
subscription.unsubscribe();
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
var MembersContainer = ({ space, createInvitationUrl }) => {
|
|
659
|
-
var _effect = _useSignals7();
|
|
660
|
-
try {
|
|
661
|
-
const { t } = useTranslation7(meta.id);
|
|
662
|
-
const config = useConfig();
|
|
663
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
664
|
-
const invitations = useSpaceInvitations(space.key);
|
|
665
|
-
const visibleInvitations = invitations?.filter((invitation) => ![
|
|
666
|
-
Invitation.State.CANCELLED
|
|
667
|
-
].includes(invitation.get().state));
|
|
668
|
-
const [activeAction, setInternalActiveAction] = useState3(localStorage.getItem(activeActionKey) ?? "inviteMany");
|
|
669
|
-
const setActiveAction = (nextAction) => {
|
|
670
|
-
setInternalActiveAction(nextAction);
|
|
671
|
-
localStorage.setItem(activeActionKey, nextAction);
|
|
672
|
-
};
|
|
673
|
-
const target = space.properties[Collection.Collection.typename]?.target?.objects[0]?.target;
|
|
674
|
-
const locked = space.properties[COMPOSER_SPACE_LOCK];
|
|
675
|
-
const handleChangeLocked = useCallback6(() => {
|
|
676
|
-
space.properties[COMPOSER_SPACE_LOCK] = !locked;
|
|
677
|
-
}, [
|
|
678
|
-
locked,
|
|
679
|
-
space
|
|
680
|
-
]);
|
|
681
|
-
const inviteActions = useMemo2(() => ({
|
|
682
|
-
inviteOne: {
|
|
683
|
-
label: t("invite one label", {
|
|
684
|
-
ns: "os"
|
|
685
|
-
}),
|
|
686
|
-
description: t("invite one description", {
|
|
687
|
-
ns: "os"
|
|
688
|
-
}),
|
|
689
|
-
icon: "ph--user-plus--regular",
|
|
690
|
-
testId: "membersContainer.inviteOne",
|
|
691
|
-
onClick: async () => {
|
|
692
|
-
const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
|
|
693
|
-
space,
|
|
694
|
-
type: Invitation.Type.INTERACTIVE,
|
|
695
|
-
authMethod: Invitation.AuthMethod.SHARED_SECRET,
|
|
696
|
-
multiUse: false,
|
|
697
|
-
target: target && Obj3.getDXN(target).toString()
|
|
698
|
-
}));
|
|
699
|
-
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
|
|
700
|
-
const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
},
|
|
704
|
-
inviteMany: {
|
|
705
|
-
label: t("invite many label", {
|
|
706
|
-
ns: "os"
|
|
707
|
-
}),
|
|
708
|
-
description: t("invite many description", {
|
|
709
|
-
ns: "os"
|
|
710
|
-
}),
|
|
711
|
-
icon: "ph--users-three--regular",
|
|
712
|
-
testId: "membersContainer.inviteMany",
|
|
713
|
-
onClick: async () => {
|
|
714
|
-
const { data: invitation } = await dispatch(createIntent5(SpaceAction.Share, {
|
|
715
|
-
space,
|
|
716
|
-
type: Invitation.Type.DELEGATED,
|
|
717
|
-
authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
|
|
718
|
-
multiUse: true,
|
|
719
|
-
target: target && Obj3.getDXN(target).toString()
|
|
720
|
-
}));
|
|
721
|
-
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
|
|
722
|
-
const subscription = invitation.subscribe((invitation2) => handleInvitationEvent(invitation2, subscription));
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}), [
|
|
727
|
-
t,
|
|
728
|
-
space,
|
|
729
|
-
target
|
|
730
|
-
]);
|
|
731
|
-
const [selectedInvitation, setSelectedInvitation] = useState3(null);
|
|
732
|
-
const handleSend = (event) => {
|
|
733
|
-
setSelectedInvitation(event.invitation);
|
|
734
|
-
};
|
|
735
|
-
const handleBack = () => {
|
|
736
|
-
setSelectedInvitation(null);
|
|
737
|
-
};
|
|
738
|
-
return /* @__PURE__ */ React7.createElement(Clipboard.Provider, null, /* @__PURE__ */ React7.createElement(StackItem.Content, {
|
|
739
|
-
scrollable: true
|
|
740
|
-
}, /* @__PURE__ */ React7.createElement(ControlPage, null, /* @__PURE__ */ React7.createElement(ControlSection, {
|
|
741
|
-
title: t("members verbose label"),
|
|
742
|
-
description: t("members description")
|
|
743
|
-
}, /* @__PURE__ */ React7.createElement(ControlFrame, null, /* @__PURE__ */ React7.createElement(ControlFrameItem, {
|
|
744
|
-
title: t("members label")
|
|
745
|
-
}, /* @__PURE__ */ React7.createElement(SpaceMemberList, {
|
|
746
|
-
spaceKey: space.key,
|
|
747
|
-
includeSelf: true
|
|
748
|
-
})), locked && /* @__PURE__ */ React7.createElement(ControlFrameItem, {
|
|
749
|
-
title: t("invitations label")
|
|
750
|
-
}, /* @__PURE__ */ React7.createElement("p", {
|
|
751
|
-
className: "text-description mbe-2"
|
|
752
|
-
}, t("locked space description"))), !locked && /* @__PURE__ */ React7.createElement(ControlFrameItem, {
|
|
753
|
-
title: t("invitations label")
|
|
754
|
-
}, selectedInvitation && /* @__PURE__ */ React7.createElement(InvitationSection, {
|
|
755
|
-
...selectedInvitation,
|
|
756
|
-
onBack: handleBack
|
|
757
|
-
}), !selectedInvitation && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
|
|
758
|
-
className: "text-description mbe-2"
|
|
759
|
-
}, t("space invitation description")), /* @__PURE__ */ React7.createElement(InvitationList, {
|
|
760
|
-
className: "mb-2",
|
|
761
|
-
send: handleSend,
|
|
762
|
-
invitations: visibleInvitations ?? [],
|
|
763
|
-
onClickRemove: (invitation) => invitation.cancel(),
|
|
764
|
-
createInvitationUrl
|
|
765
|
-
}), /* @__PURE__ */ React7.createElement(BifurcatedAction, {
|
|
766
|
-
actions: inviteActions,
|
|
767
|
-
activeAction,
|
|
768
|
-
onChangeActiveAction: setActiveAction,
|
|
769
|
-
"data-testid": "membersContainer.createInvitation"
|
|
770
|
-
})))), /* @__PURE__ */ React7.createElement("div", {
|
|
771
|
-
className: "justify-center p-0 mbs-4 container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
772
|
-
}, /* @__PURE__ */ React7.createElement(ControlItemInput, {
|
|
773
|
-
title: t("space locked label"),
|
|
774
|
-
description: t("space locked description")
|
|
775
|
-
}, /* @__PURE__ */ React7.createElement(Input.Switch, {
|
|
776
|
-
checked: locked,
|
|
777
|
-
onCheckedChange: handleChangeLocked,
|
|
778
|
-
classNames: "justify-self-end"
|
|
779
|
-
})))))));
|
|
780
|
-
} finally {
|
|
781
|
-
_effect.f();
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
var InvitationSection = ({ state = Invitation.State.INIT, authCode, invitationId = "never", url = "never", onBack }) => {
|
|
785
|
-
var _effect = _useSignals7();
|
|
786
|
-
try {
|
|
787
|
-
const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
|
|
788
|
-
return /* @__PURE__ */ React7.createElement(Viewport.Root, {
|
|
789
|
-
activeView
|
|
790
|
-
}, /* @__PURE__ */ React7.createElement(Viewport.Views, null, /* @__PURE__ */ React7.createElement(Viewport.View, {
|
|
791
|
-
id: "init"
|
|
792
|
-
}), /* @__PURE__ */ React7.createElement(Viewport.View, {
|
|
793
|
-
id: "complete"
|
|
794
|
-
}, /* @__PURE__ */ React7.createElement(InvitationComplete, {
|
|
795
|
-
statusValue: state
|
|
796
|
-
})), /* @__PURE__ */ React7.createElement(Viewport.View, {
|
|
797
|
-
id: "auth-code"
|
|
798
|
-
}, /* @__PURE__ */ React7.createElement(InvitationAuthCode, {
|
|
799
|
-
id: invitationId,
|
|
800
|
-
code: authCode ?? "never",
|
|
801
|
-
onCancel: onBack
|
|
802
|
-
})), /* @__PURE__ */ React7.createElement(Viewport.View, {
|
|
803
|
-
id: "qr-code"
|
|
804
|
-
}, /* @__PURE__ */ React7.createElement(InvitationQR, {
|
|
805
|
-
id: invitationId,
|
|
806
|
-
url,
|
|
807
|
-
onCancel: onBack
|
|
808
|
-
}))));
|
|
809
|
-
} finally {
|
|
810
|
-
_effect.f();
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
var InvitationQR = ({ id, url, onCancel }) => {
|
|
814
|
-
var _effect = _useSignals7();
|
|
815
|
-
try {
|
|
816
|
-
const { t } = useTranslation7("os");
|
|
817
|
-
const qrLabel = useId("members-container__qr-code");
|
|
818
|
-
const emoji = hexToEmoji(id);
|
|
819
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
|
|
820
|
-
className: "text-description"
|
|
821
|
-
}, t("qr code description", {
|
|
822
|
-
ns: meta.id
|
|
823
|
-
})), /* @__PURE__ */ React7.createElement("div", {
|
|
824
|
-
role: "group",
|
|
825
|
-
className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
|
|
826
|
-
}, /* @__PURE__ */ React7.createElement("div", {
|
|
827
|
-
role: "none",
|
|
828
|
-
className: "is-full aspect-square relative text-description"
|
|
829
|
-
}, /* @__PURE__ */ React7.createElement(QR, {
|
|
830
|
-
rounding: 100,
|
|
831
|
-
backgroundColor: "transparent",
|
|
832
|
-
color: "currentColor",
|
|
833
|
-
"aria-labelledby": qrLabel,
|
|
834
|
-
errorCorrectionLevel: "Q",
|
|
835
|
-
cutout: true
|
|
836
|
-
}, url ?? "never"), /* @__PURE__ */ React7.createElement(Centered, null, /* @__PURE__ */ React7.createElement(Emoji, {
|
|
837
|
-
text: emoji
|
|
838
|
-
}))), /* @__PURE__ */ React7.createElement("span", {
|
|
839
|
-
id: qrLabel,
|
|
840
|
-
className: "sr-only"
|
|
841
|
-
}, t("qr label")), /* @__PURE__ */ React7.createElement(Clipboard.Button, {
|
|
842
|
-
value: url ?? "never"
|
|
843
|
-
})), /* @__PURE__ */ React7.createElement(Button2, {
|
|
844
|
-
variant: "ghost",
|
|
845
|
-
onClick: onCancel
|
|
846
|
-
}, t("cancel label")));
|
|
847
|
-
} finally {
|
|
848
|
-
_effect.f();
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
var InvitationAuthCode = ({ id, code, onCancel }) => {
|
|
852
|
-
var _effect = _useSignals7();
|
|
853
|
-
try {
|
|
854
|
-
const { t } = useTranslation7("os");
|
|
855
|
-
const emoji = hexToEmoji(id);
|
|
856
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("p", {
|
|
857
|
-
className: "text-description"
|
|
858
|
-
}, t("auth other device emoji message")), emoji && /* @__PURE__ */ React7.createElement(Emoji, {
|
|
859
|
-
text: emoji,
|
|
860
|
-
className: "mli-auto mlb-2 text-center"
|
|
861
|
-
}), /* @__PURE__ */ React7.createElement("p", {
|
|
862
|
-
className: "text-description"
|
|
863
|
-
}, t("auth code message")), /* @__PURE__ */ React7.createElement(AuthCode, {
|
|
864
|
-
code,
|
|
865
|
-
large: true,
|
|
866
|
-
classNames: "mli-auto mlb-2 text-center grow"
|
|
867
|
-
}), /* @__PURE__ */ React7.createElement(Button2, {
|
|
868
|
-
variant: "ghost",
|
|
869
|
-
onClick: onCancel
|
|
870
|
-
}, t("cancel label")));
|
|
871
|
-
} finally {
|
|
872
|
-
_effect.f();
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
var InvitationComplete = ({ statusValue }) => {
|
|
876
|
-
var _effect = _useSignals7();
|
|
877
|
-
try {
|
|
878
|
-
return statusValue > 0 ? /* @__PURE__ */ React7.createElement(Icon3, {
|
|
879
|
-
icon: "ph--check--regular",
|
|
880
|
-
size: 6,
|
|
881
|
-
classNames: "m-1.5"
|
|
882
|
-
}) : /* @__PURE__ */ React7.createElement(Icon3, {
|
|
883
|
-
icon: "ph--x--regular",
|
|
884
|
-
size: 6,
|
|
885
|
-
classNames: "m-1.5"
|
|
886
|
-
});
|
|
887
|
-
} finally {
|
|
888
|
-
_effect.f();
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
// src/components/MenuFooter.tsx
|
|
893
|
-
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
894
|
-
import React8 from "react";
|
|
895
|
-
import { getSpace as getSpace2 } from "@dxos/client/echo";
|
|
896
|
-
import { useClient as useClient4 } from "@dxos/react-client";
|
|
897
|
-
import { DropdownMenu, Icon as Icon4, toLocalizedString as toLocalizedString2, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
898
|
-
var MenuFooter = ({ object }) => {
|
|
899
|
-
var _effect = _useSignals8();
|
|
900
|
-
try {
|
|
901
|
-
const { t } = useTranslation8(meta.id);
|
|
902
|
-
const client = useClient4();
|
|
903
|
-
const space = getSpace2(object);
|
|
904
|
-
const spaceName = space ? getSpaceDisplayName(space, {
|
|
905
|
-
personal: client.spaces.default === space
|
|
906
|
-
}) : "";
|
|
907
|
-
return space ? /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React8.createElement(DropdownMenu.GroupLabel, null, t("menu footer label")), /* @__PURE__ */ React8.createElement("dl", {
|
|
908
|
-
className: "pis-2 mbe-2 text-xs grid grid-cols-[max-content_1fr] gap-2"
|
|
909
|
-
}, /* @__PURE__ */ React8.createElement("dt", {
|
|
910
|
-
className: "uppercase text-[.75em] tracking-wide font-medium mbs-px self-start"
|
|
911
|
-
}, t("location label")), /* @__PURE__ */ React8.createElement("dd", {
|
|
912
|
-
className: "line-clamp-3"
|
|
913
|
-
}, /* @__PURE__ */ React8.createElement(Icon4, {
|
|
914
|
-
icon: "ph--planet--regular",
|
|
915
|
-
classNames: "inline-block mie-1"
|
|
916
|
-
}), toLocalizedString2(spaceName, t)))) : null;
|
|
917
|
-
} finally {
|
|
918
|
-
_effect.f();
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
|
|
922
|
-
// src/components/ObjectRenamePopover/ObjectRenamePopover.tsx
|
|
923
|
-
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
924
|
-
import React9, { useCallback as useCallback7, useRef as useRef3, useState as useState4 } from "react";
|
|
925
|
-
import { LayoutAction as LayoutAction5, createIntent as createIntent6 } from "@dxos/app-framework";
|
|
926
|
-
import { useIntentDispatcher as useIntentDispatcher6 } from "@dxos/app-framework/react";
|
|
927
|
-
import { Obj as Obj4 } from "@dxos/echo";
|
|
928
|
-
import { log as log2 } from "@dxos/log";
|
|
929
|
-
import { Button as Button3, Input as Input2, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
930
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/ObjectRenamePopover/ObjectRenamePopover.tsx";
|
|
931
|
-
var OBJECT_RENAME_POPOVER = `${meta.id}/ObjectRenamePopover`;
|
|
932
|
-
var ObjectRenamePopover = ({ object }) => {
|
|
933
|
-
var _effect = _useSignals9();
|
|
934
|
-
try {
|
|
935
|
-
const { t } = useTranslation9(meta.id);
|
|
936
|
-
const doneButton = useRef3(null);
|
|
937
|
-
const [name, setName] = useState4(Obj4.getLabel(object));
|
|
938
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
939
|
-
const handleDone = useCallback7(() => {
|
|
940
|
-
try {
|
|
941
|
-
name && Obj4.setLabel(object, name);
|
|
942
|
-
} catch (err) {
|
|
943
|
-
log2.error("Failed to rename object", {
|
|
944
|
-
err
|
|
945
|
-
}, {
|
|
946
|
-
F: __dxlog_file3,
|
|
947
|
-
L: 27,
|
|
948
|
-
S: void 0,
|
|
949
|
-
C: (f, a) => f(...a)
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
void dispatch(createIntent6(LayoutAction5.UpdatePopover, {
|
|
953
|
-
part: "popover",
|
|
954
|
-
options: {
|
|
955
|
-
variant: "react",
|
|
956
|
-
anchorId: "",
|
|
957
|
-
state: false
|
|
958
|
-
}
|
|
959
|
-
}));
|
|
960
|
-
}, [
|
|
961
|
-
object,
|
|
962
|
-
name
|
|
963
|
-
]);
|
|
964
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
965
|
-
role: "none",
|
|
966
|
-
className: "p-2 flex gap-2"
|
|
967
|
-
}, /* @__PURE__ */ React9.createElement("div", {
|
|
968
|
-
role: "none",
|
|
969
|
-
className: "flex-1"
|
|
970
|
-
}, /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.Label, {
|
|
971
|
-
srOnly: true
|
|
972
|
-
}, t("object name label")), /* @__PURE__ */ React9.createElement(Input2.TextInput, {
|
|
973
|
-
placeholder: t("object placeholder"),
|
|
974
|
-
value: name,
|
|
975
|
-
"data-testid": "spacePlugin.renameObject.input",
|
|
976
|
-
onChange: ({ target: { value: value2 } }) => setName(value2),
|
|
977
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
978
|
-
}))), /* @__PURE__ */ React9.createElement(Button3, {
|
|
979
|
-
ref: doneButton,
|
|
980
|
-
classNames: "self-stretch",
|
|
981
|
-
onClick: handleDone
|
|
982
|
-
}, t("done label", {
|
|
983
|
-
ns: "os"
|
|
984
|
-
})));
|
|
985
|
-
} finally {
|
|
986
|
-
_effect.f();
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
// src/components/SpaceRenamePopover/SpaceRenamePopover.tsx
|
|
991
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
992
|
-
import React10, { useCallback as useCallback8, useRef as useRef4, useState as useState5 } from "react";
|
|
993
|
-
import { LayoutAction as LayoutAction6, createIntent as createIntent7 } from "@dxos/app-framework";
|
|
994
|
-
import { useIntentDispatcher as useIntentDispatcher7 } from "@dxos/app-framework/react";
|
|
995
|
-
import { Button as Button4, Input as Input3, Popover, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
996
|
-
var SPACE_RENAME_POPOVER = `${meta.id}/SpaceRenamePopover`;
|
|
997
|
-
var SpaceRenamePopover = ({ space }) => {
|
|
998
|
-
var _effect = _useSignals10();
|
|
999
|
-
try {
|
|
1000
|
-
const { t } = useTranslation10(meta.id);
|
|
1001
|
-
const doneButton = useRef4(null);
|
|
1002
|
-
const [name, setName] = useState5(space.properties.name ?? "");
|
|
1003
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher7();
|
|
1004
|
-
const handleDone = useCallback8(() => {
|
|
1005
|
-
space.properties.name = name;
|
|
1006
|
-
void dispatch(createIntent7(LayoutAction6.UpdatePopover, {
|
|
1007
|
-
part: "popover",
|
|
1008
|
-
options: {
|
|
1009
|
-
variant: "react",
|
|
1010
|
-
anchorId: "",
|
|
1011
|
-
state: false
|
|
1012
|
-
}
|
|
1013
|
-
}));
|
|
1014
|
-
}, [
|
|
1015
|
-
space,
|
|
1016
|
-
name
|
|
1017
|
-
]);
|
|
1018
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
1019
|
-
role: "none",
|
|
1020
|
-
className: "p-2 flex gap-2"
|
|
1021
|
-
}, /* @__PURE__ */ React10.createElement("div", {
|
|
1022
|
-
role: "none",
|
|
1023
|
-
className: "flex-1"
|
|
1024
|
-
}, /* @__PURE__ */ React10.createElement(Input3.Root, null, /* @__PURE__ */ React10.createElement(Input3.Label, {
|
|
1025
|
-
srOnly: true
|
|
1026
|
-
}, t("space name label")), /* @__PURE__ */ React10.createElement(Input3.TextInput, {
|
|
1027
|
-
defaultValue: space.properties.name ?? "",
|
|
1028
|
-
placeholder: t("unnamed space label"),
|
|
1029
|
-
onChange: ({ target: { value: value2 } }) => setName(value2),
|
|
1030
|
-
// TODO(wittjosiah): Ideally this should access the popover context to close the popover.
|
|
1031
|
-
// Currently this is not possible because Radix does not expose the popover context.
|
|
1032
|
-
onKeyDown: ({ key }) => key === "Enter" && doneButton.current?.click()
|
|
1033
|
-
}))), /* @__PURE__ */ React10.createElement(Popover.Close, {
|
|
1034
|
-
asChild: true
|
|
1035
|
-
}, /* @__PURE__ */ React10.createElement(Button4, {
|
|
1036
|
-
ref: doneButton,
|
|
1037
|
-
classNames: "self-stretch",
|
|
1038
|
-
onClick: handleDone
|
|
1039
|
-
}, t("done label", {
|
|
1040
|
-
ns: "os"
|
|
1041
|
-
}))));
|
|
1042
|
-
} finally {
|
|
1043
|
-
_effect.f();
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
// src/components/SchemaContainer.tsx
|
|
1048
|
-
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1049
|
-
import React11, { useEffect as useEffect2, useState as useState6 } from "react";
|
|
1050
|
-
import { useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
1051
|
-
import { ControlPage as ControlPage2, ControlSection as ControlSection2, controlItemClasses } from "@dxos/react-ui-form";
|
|
1052
|
-
import { StackItem as StackItem2 } from "@dxos/react-ui-stack";
|
|
1053
|
-
var SchemaContainer = ({ space }) => {
|
|
1054
|
-
var _effect = _useSignals11();
|
|
1055
|
-
try {
|
|
1056
|
-
const { t } = useTranslation11(meta.id);
|
|
1057
|
-
const schemas = useQuerySpaceSchemas(space);
|
|
1058
|
-
return /* @__PURE__ */ React11.createElement(StackItem2.Content, {
|
|
1059
|
-
scrollable: true
|
|
1060
|
-
}, /* @__PURE__ */ React11.createElement(ControlPage2, null, /* @__PURE__ */ React11.createElement(ControlSection2, {
|
|
1061
|
-
title: t("schema verbose label"),
|
|
1062
|
-
description: t("schema description")
|
|
1063
|
-
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1064
|
-
role: "none",
|
|
1065
|
-
className: controlItemClasses
|
|
1066
|
-
}, schemas.length === 0 && /* @__PURE__ */ React11.createElement("div", {
|
|
1067
|
-
className: "text-center plb-4"
|
|
1068
|
-
}, t("no schemas found message")), schemas.map((schema) => /* @__PURE__ */ React11.createElement("div", {
|
|
1069
|
-
role: "none",
|
|
1070
|
-
key: schema.id
|
|
1071
|
-
}, schema.typename))))));
|
|
1072
|
-
} finally {
|
|
1073
|
-
_effect.f();
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
var useQuerySpaceSchemas = (space) => {
|
|
1077
|
-
const [schemas, setSchemas] = useState6([]);
|
|
1078
|
-
useEffect2(() => {
|
|
1079
|
-
const query = space.db.schemaRegistry.query();
|
|
1080
|
-
const initialResults = query.runSync();
|
|
1081
|
-
setSchemas(initialResults);
|
|
1082
|
-
const unsubscribe = query.subscribe(() => setSchemas(query.results));
|
|
1083
|
-
return () => unsubscribe();
|
|
1084
|
-
}, [
|
|
1085
|
-
space
|
|
1086
|
-
]);
|
|
1087
|
-
return schemas;
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
|
-
// src/components/SpacePresence/SpacePresence.tsx
|
|
1091
|
-
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1092
|
-
import * as Option3 from "effect/Option";
|
|
1093
|
-
import React12, { forwardRef, useCallback as useCallback9, useEffect as useEffect3, useState as useState7 } from "react";
|
|
1094
|
-
import { useAppGraph as useAppGraph2, useCapability } from "@dxos/app-framework/react";
|
|
1095
|
-
import { generateName } from "@dxos/display-name";
|
|
1096
|
-
import { Obj as Obj5 } from "@dxos/echo";
|
|
1097
|
-
import { PublicKey, useClient as useClient5 } from "@dxos/react-client";
|
|
1098
|
-
import { getSpace as getSpace3, useMembers } from "@dxos/react-client/echo";
|
|
1099
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
1100
|
-
import { Avatar, List, ListItem, Popover as Popover2, Tooltip, useDefaultValue as useDefaultValue2, useTranslation as useTranslation12 } from "@dxos/react-ui";
|
|
1101
|
-
import { AttentionGlyph, useAttended, useAttention } from "@dxos/react-ui-attention";
|
|
1102
|
-
import { ComplexMap, keyToFallback } from "@dxos/util";
|
|
1103
|
-
|
|
1104
|
-
// src/capabilities/index.ts
|
|
1105
|
-
import { lazy } from "@dxos/app-framework";
|
|
1106
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-T6VJKIOA.mjs"));
|
|
1107
|
-
var AppGraphSerializer = lazy(() => import("./app-graph-serializer-2NLWWFUB.mjs"));
|
|
1108
|
-
var IdentityCreated = lazy(() => import("./identity-created-OXLKCJE3.mjs"));
|
|
1109
|
-
var IntentResolver = lazy(() => import("./intent-resolver-4PHJWDXW.mjs"));
|
|
1110
|
-
var ReactRoot = lazy(() => import("./react-root-O5I5CDJ7.mjs"));
|
|
1111
|
-
var ReactSurface = lazy(() => import("./react-surface-J3XDMU2D.mjs"));
|
|
1112
|
-
var Repair = lazy(() => import("./repair-EHZS6MFY.mjs"));
|
|
1113
|
-
var SpaceSettings = lazy(() => import("./settings-MNQTKHL7.mjs"));
|
|
1114
|
-
var SpaceState = lazy(() => import("./state-45TXZQJ6.mjs"));
|
|
1115
|
-
var SpacesReady = lazy(() => import("./spaces-ready-ZPU24DA2.mjs"));
|
|
1116
|
-
|
|
1117
|
-
// src/components/SpacePresence/SpacePresence.tsx
|
|
1118
|
-
var REFRESH_INTERVAL = 5e3;
|
|
1119
|
-
var ACTIVITY_DURATION = 3e4;
|
|
1120
|
-
var noViewers = new ComplexMap(PublicKey.hash);
|
|
1121
|
-
var getName = (identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
|
|
1122
|
-
var SpacePresence = ({ object, spaceKey }) => {
|
|
1123
|
-
var _effect = _useSignals12();
|
|
1124
|
-
try {
|
|
1125
|
-
const spaceState = useCapability(SpaceCapabilities.MutableState);
|
|
1126
|
-
const client = useClient5();
|
|
1127
|
-
const identity = useIdentity();
|
|
1128
|
-
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace3(object);
|
|
1129
|
-
const spaceMembers = useMembers(space?.key);
|
|
1130
|
-
const [_moment, setMoment] = useState7(Date.now());
|
|
1131
|
-
useEffect3(() => {
|
|
1132
|
-
const interval = setInterval(() => setMoment(Date.now()), REFRESH_INTERVAL);
|
|
1133
|
-
return () => clearInterval(interval);
|
|
1134
|
-
}, []);
|
|
1135
|
-
const memberOnline = useCallback9((member) => member.presence === 1, []);
|
|
1136
|
-
const memberIsNotSelf = useCallback9((member) => !identity?.identityKey.equals(member.identity.identityKey), [
|
|
1137
|
-
identity?.identityKey
|
|
1138
|
-
]);
|
|
1139
|
-
if (!identity || !spaceState || !space) {
|
|
1140
|
-
return null;
|
|
1141
|
-
}
|
|
1142
|
-
const currentObjectViewers = spaceState.viewersByObject[Obj5.getDXN(object).toString()] ?? noViewers;
|
|
1143
|
-
const membersForObject = spaceMembers.filter((member) => memberOnline(member) && memberIsNotSelf(member)).filter((member) => currentObjectViewers.has(member.identity.identityKey)).map((member) => {
|
|
1144
|
-
const objectView = currentObjectViewers.get(member.identity.identityKey);
|
|
1145
|
-
const lastSeen = objectView?.lastSeen ?? -Infinity;
|
|
1146
|
-
const currentlyAttended = objectView?.currentlyAttended ?? false;
|
|
1147
|
-
return {
|
|
1148
|
-
...member,
|
|
1149
|
-
currentlyAttended,
|
|
1150
|
-
lastSeen
|
|
1151
|
-
};
|
|
1152
|
-
}).toSorted((a, b) => a.lastSeen - b.lastSeen);
|
|
1153
|
-
return /* @__PURE__ */ React12.createElement(FullPresence, {
|
|
1154
|
-
members: membersForObject
|
|
1155
|
-
});
|
|
1156
|
-
} finally {
|
|
1157
|
-
_effect.f();
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
var FullPresence = (props) => {
|
|
1161
|
-
var _effect = _useSignals12();
|
|
1162
|
-
try {
|
|
1163
|
-
const { size = 9, onMemberClick } = props;
|
|
1164
|
-
const members = useDefaultValue2(props.members, () => []);
|
|
1165
|
-
if (members.length === 0) {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1169
|
-
className: "dx-avatar-group",
|
|
1170
|
-
"data-testid": "spacePlugin.presence"
|
|
1171
|
-
}, members.slice(0, 3).map((member, i) => /* @__PURE__ */ React12.createElement(Tooltip.Trigger, {
|
|
1172
|
-
key: member.identity.identityKey.toHex(),
|
|
1173
|
-
side: "bottom",
|
|
1174
|
-
content: getName(member.identity),
|
|
1175
|
-
className: "grid focus:outline-none"
|
|
1176
|
-
}, /* @__PURE__ */ React12.createElement(PresenceAvatar, {
|
|
1177
|
-
identity: member.identity,
|
|
1178
|
-
match: member.currentlyAttended,
|
|
1179
|
-
index: members.length - i,
|
|
1180
|
-
onClick: () => onMemberClick?.(member),
|
|
1181
|
-
size
|
|
1182
|
-
}))), members.length > 3 && /* @__PURE__ */ React12.createElement(Popover2.Root, null, /* @__PURE__ */ React12.createElement(Popover2.Trigger, {
|
|
1183
|
-
className: "grid focus:outline-none"
|
|
1184
|
-
}, /* @__PURE__ */ React12.createElement(Avatar.Root, null, /* @__PURE__ */ React12.createElement(Avatar.Content, {
|
|
1185
|
-
status: "inactive",
|
|
1186
|
-
style: {
|
|
1187
|
-
zIndex: members.length - 4
|
|
1188
|
-
},
|
|
1189
|
-
fallback: `+${members.length - 3}`,
|
|
1190
|
-
size
|
|
1191
|
-
}))), /* @__PURE__ */ React12.createElement(Popover2.Portal, null, /* @__PURE__ */ React12.createElement(Popover2.Content, {
|
|
1192
|
-
side: "bottom"
|
|
1193
|
-
}, /* @__PURE__ */ React12.createElement(Popover2.Arrow, null), /* @__PURE__ */ React12.createElement(Popover2.Viewport, {
|
|
1194
|
-
classNames: "max-bs-56"
|
|
1195
|
-
}, /* @__PURE__ */ React12.createElement(List, null, members.map((member) => /* @__PURE__ */ React12.createElement(ListItem.Root, {
|
|
1196
|
-
key: member.identity.identityKey.toHex(),
|
|
1197
|
-
classNames: "flex gap-2 items-center cursor-pointer mbe-2",
|
|
1198
|
-
onClick: () => onMemberClick?.(member),
|
|
1199
|
-
"data-testid": "identity-list-item"
|
|
1200
|
-
}, /* @__PURE__ */ React12.createElement(PresenceAvatar, {
|
|
1201
|
-
identity: member.identity,
|
|
1202
|
-
size,
|
|
1203
|
-
showName: true,
|
|
1204
|
-
match: member.currentlyAttended
|
|
1205
|
-
})))))))));
|
|
1206
|
-
} finally {
|
|
1207
|
-
_effect.f();
|
|
1208
|
-
}
|
|
1209
|
-
};
|
|
1210
|
-
var PresenceAvatar = /* @__PURE__ */ forwardRef(({ identity, showName, match: match2, index, onClick, size }, forwardedRef) => {
|
|
1211
|
-
var _effect = _useSignals12();
|
|
1212
|
-
try {
|
|
1213
|
-
const status = match2 ? "current" : "active";
|
|
1214
|
-
const fallbackValue = keyToFallback(identity.identityKey);
|
|
1215
|
-
return /* @__PURE__ */ React12.createElement(Avatar.Root, null, /* @__PURE__ */ React12.createElement(Avatar.Content, {
|
|
1216
|
-
status,
|
|
1217
|
-
hue: identity.profile?.data?.hue || fallbackValue.hue,
|
|
1218
|
-
"data-testid": "spacePlugin.presence.member",
|
|
1219
|
-
"data-status": status,
|
|
1220
|
-
size,
|
|
1221
|
-
...index ? {
|
|
1222
|
-
style: {
|
|
1223
|
-
zIndex: index
|
|
1224
|
-
}
|
|
1225
|
-
} : {},
|
|
1226
|
-
onClick,
|
|
1227
|
-
fallback: identity.profile?.data?.emoji || fallbackValue.emoji,
|
|
1228
|
-
ref: forwardedRef
|
|
1229
|
-
}), /* @__PURE__ */ React12.createElement(Avatar.Label, {
|
|
1230
|
-
classNames: showName ? "text-sm truncate pli-2" : "sr-only"
|
|
1231
|
-
}, getName(identity)));
|
|
1232
|
-
} finally {
|
|
1233
|
-
_effect.f();
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
var SmallPresenceLive = ({ id, open, viewers }) => {
|
|
1237
|
-
var _effect = _useSignals12();
|
|
1238
|
-
try {
|
|
1239
|
-
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
1240
|
-
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1241
|
-
const { graph } = useAppGraph2();
|
|
1242
|
-
const attended = useAttended();
|
|
1243
|
-
const startOfAttention = attended.at(-1);
|
|
1244
|
-
const path = usePath(graph, startOfAttention);
|
|
1245
|
-
const containsAttended = !open && !isAttended && id && Option3.isSome(path) ? path.value.includes(id) : false;
|
|
1246
|
-
const getActiveViewers = (viewers2) => {
|
|
1247
|
-
const moment = Date.now();
|
|
1248
|
-
return Array.from(viewers2.values()).filter((viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION);
|
|
1249
|
-
};
|
|
1250
|
-
const [activeViewers, setActiveViewers] = useState7(viewers ? getActiveViewers(viewers) : []);
|
|
1251
|
-
useEffect3(() => {
|
|
1252
|
-
if (viewers) {
|
|
1253
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1254
|
-
const interval = setInterval(() => {
|
|
1255
|
-
setActiveViewers(getActiveViewers(viewers));
|
|
1256
|
-
}, REFRESH_INTERVAL);
|
|
1257
|
-
return () => clearInterval(interval);
|
|
1258
|
-
}
|
|
1259
|
-
}, [
|
|
1260
|
-
viewers
|
|
1261
|
-
]);
|
|
1262
|
-
return /* @__PURE__ */ React12.createElement(SmallPresence, {
|
|
1263
|
-
count: activeViewers.length,
|
|
1264
|
-
attended: isAttended,
|
|
1265
|
-
containsAttended
|
|
1266
|
-
});
|
|
1267
|
-
} finally {
|
|
1268
|
-
_effect.f();
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
var SmallPresence = ({ count = 0, attended, containsAttended }) => {
|
|
1272
|
-
var _effect = _useSignals12();
|
|
1273
|
-
try {
|
|
1274
|
-
const { t } = useTranslation12(meta.id);
|
|
1275
|
-
return /* @__PURE__ */ React12.createElement(Tooltip.Trigger, {
|
|
1276
|
-
asChild: true,
|
|
1277
|
-
content: t("presence label", {
|
|
1278
|
-
count
|
|
1279
|
-
}),
|
|
1280
|
-
side: "bottom"
|
|
1281
|
-
}, /* @__PURE__ */ React12.createElement(AttentionGlyph, {
|
|
1282
|
-
attended,
|
|
1283
|
-
containsAttended,
|
|
1284
|
-
presence: count > 1 ? "many" : count === 1 ? "one" : "none",
|
|
1285
|
-
classNames: "self-center mie-1"
|
|
1286
|
-
}));
|
|
1287
|
-
} finally {
|
|
1288
|
-
_effect.f();
|
|
1289
|
-
}
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
// src/components/SpacePluginSettings.tsx
|
|
1293
|
-
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1294
|
-
import React13 from "react";
|
|
1295
|
-
import { createIntent as createIntent8 } from "@dxos/app-framework";
|
|
1296
|
-
import { useIntentDispatcher as useIntentDispatcher8 } from "@dxos/app-framework/react";
|
|
1297
|
-
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1298
|
-
import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
|
|
1299
|
-
import { IconButton as IconButton3, Input as Input4, List as List2, ListItem as ListItem2, toLocalizedString as toLocalizedString3, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1300
|
-
import { ControlGroup, ControlItemInput as ControlItemInput2, ControlPage as ControlPage3, ControlSection as ControlSection3, controlItemClasses as controlItemClasses2 } from "@dxos/react-ui-form";
|
|
1301
|
-
var SpacePluginSettings = ({ settings }) => {
|
|
1302
|
-
var _effect = _useSignals13();
|
|
1303
|
-
try {
|
|
1304
|
-
const { t } = useTranslation13(meta.id);
|
|
1305
|
-
const client = useClient6();
|
|
1306
|
-
const spaces = useSpaces2({
|
|
1307
|
-
all: settings.showHidden
|
|
1308
|
-
});
|
|
1309
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher8();
|
|
1310
|
-
return /* @__PURE__ */ React13.createElement(ControlPage3, null, /* @__PURE__ */ React13.createElement(ControlSection3, {
|
|
1311
|
-
title: t("space settings label"),
|
|
1312
|
-
description: t("space settings description")
|
|
1313
|
-
}, /* @__PURE__ */ React13.createElement(ControlGroup, null, /* @__PURE__ */ React13.createElement(ControlItemInput2, {
|
|
1314
|
-
title: t("show hidden spaces label")
|
|
1315
|
-
}, /* @__PURE__ */ React13.createElement(Input4.Switch, {
|
|
1316
|
-
checked: settings.showHidden,
|
|
1317
|
-
onCheckedChange: (checked) => settings.showHidden = !!checked
|
|
1318
|
-
}))), /* @__PURE__ */ React13.createElement(List2, {
|
|
1319
|
-
classNames: [
|
|
1320
|
-
controlItemClasses2,
|
|
1321
|
-
"flex flex-col gap-trimSm"
|
|
1322
|
-
]
|
|
1323
|
-
}, spaces.map((space) => /* @__PURE__ */ React13.createElement(ListItem2.Root, {
|
|
1324
|
-
key: space.id,
|
|
1325
|
-
classNames: "is-full items-center"
|
|
1326
|
-
}, /* @__PURE__ */ React13.createElement(ListItem2.Heading, {
|
|
1327
|
-
classNames: "grow truncate !min-bs-0"
|
|
1328
|
-
}, toLocalizedString3(getSpaceDisplayName(space, {
|
|
1329
|
-
personal: space === client.spaces.default
|
|
1330
|
-
}), t)), /* @__PURE__ */ React13.createElement(IconButton3, {
|
|
1331
|
-
icon: "ph--faders--regular",
|
|
1332
|
-
onClick: () => dispatch(createIntent8(SpaceAction.OpenSettings, {
|
|
1333
|
-
space
|
|
1334
|
-
})),
|
|
1335
|
-
label: t("open space settings label")
|
|
1336
|
-
}))))));
|
|
1337
|
-
} finally {
|
|
1338
|
-
_effect.f();
|
|
1339
|
-
}
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
|
-
// src/components/SpaceSettings/SpaceSettingsContainer.tsx
|
|
1343
|
-
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1344
|
-
import * as Function3 from "effect/Function";
|
|
1345
|
-
import * as Schema from "effect/Schema";
|
|
1346
|
-
import React14, { useCallback as useCallback10, useMemo as useMemo3, useState as useState8 } from "react";
|
|
1347
|
-
import { LayoutAction as LayoutAction7, chain as chain2, createIntent as createIntent9 } from "@dxos/app-framework";
|
|
1348
|
-
import { useCapabilities, useIntentDispatcher as useIntentDispatcher9 } from "@dxos/app-framework/react";
|
|
1349
|
-
import { log as log3 } from "@dxos/log";
|
|
1350
|
-
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1351
|
-
import { useClient as useClient7 } from "@dxos/react-client";
|
|
1352
|
-
import { SpaceState as SpaceState2 } from "@dxos/react-client/echo";
|
|
1353
|
-
import { Button as Button5, Input as Input5, useFileDownload, useMulticastObservable, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1354
|
-
import { ControlItem, ControlItemInput as ControlItemInput3, ControlPage as ControlPage4, ControlSection as ControlSection4, Form as Form3 } from "@dxos/react-ui-form";
|
|
1355
|
-
import { HuePicker, IconPicker } from "@dxos/react-ui-pickers";
|
|
1356
|
-
import { StackItem as StackItem3 } from "@dxos/react-ui-stack";
|
|
1357
|
-
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/SpaceSettings/SpaceSettingsContainer.tsx";
|
|
1358
|
-
var FormSchema = SpaceForm.pipe(Schema.extend(Schema.Struct({
|
|
1359
|
-
archived: Schema.Boolean.annotations({
|
|
1360
|
-
title: "Archive Space"
|
|
1361
|
-
})
|
|
1362
|
-
})));
|
|
1363
|
-
var SpaceSettingsContainer = ({ space }) => {
|
|
1364
|
-
var _effect = _useSignals14();
|
|
1365
|
-
try {
|
|
1366
|
-
const { t } = useTranslation14(meta.id);
|
|
1367
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher9();
|
|
1368
|
-
const client = useClient7();
|
|
1369
|
-
const archived = useMulticastObservable(space.state) === SpaceState2.SPACE_INACTIVE;
|
|
1370
|
-
const [edgeReplication, setEdgeReplication] = useState8(space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED);
|
|
1371
|
-
const toggleEdgeReplication = useCallback10(async (next) => {
|
|
1372
|
-
setEdgeReplication(next);
|
|
1373
|
-
await space?.internal.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED).catch((err) => {
|
|
1374
|
-
log3.catch(err, void 0, {
|
|
1375
|
-
F: __dxlog_file4,
|
|
1376
|
-
L: 58,
|
|
1377
|
-
S: void 0,
|
|
1378
|
-
C: (f, a) => f(...a)
|
|
1379
|
-
});
|
|
1380
|
-
setEdgeReplication(!next);
|
|
1381
|
-
});
|
|
1382
|
-
}, [
|
|
1383
|
-
space
|
|
1384
|
-
]);
|
|
1385
|
-
const handleSave = useCallback10((properties) => {
|
|
1386
|
-
void toggleEdgeReplication(properties.edgeReplication);
|
|
1387
|
-
if (properties.name !== space.properties.name) {
|
|
1388
|
-
space.properties.name = properties.name;
|
|
1389
|
-
}
|
|
1390
|
-
if (properties.icon !== space.properties.icon) {
|
|
1391
|
-
space.properties.icon = properties.icon;
|
|
1392
|
-
}
|
|
1393
|
-
if (properties.hue !== space.properties.hue) {
|
|
1394
|
-
space.properties.hue = properties.hue;
|
|
1395
|
-
}
|
|
1396
|
-
if (properties.archived && !archived) {
|
|
1397
|
-
void dispatch(Function3.pipe(createIntent9(SpaceAction.Close, {
|
|
1398
|
-
space
|
|
1399
|
-
}), chain2(LayoutAction7.SwitchWorkspace, {
|
|
1400
|
-
part: "workspace",
|
|
1401
|
-
subject: client.spaces.default.id
|
|
1402
|
-
})));
|
|
1403
|
-
} else if (!properties.archived && archived) {
|
|
1404
|
-
void dispatch(createIntent9(SpaceAction.Open, {
|
|
1405
|
-
space
|
|
1406
|
-
}));
|
|
1407
|
-
}
|
|
1408
|
-
}, [
|
|
1409
|
-
space,
|
|
1410
|
-
toggleEdgeReplication,
|
|
1411
|
-
archived
|
|
1412
|
-
]);
|
|
1413
|
-
const values = useMemo3(() => ({
|
|
1414
|
-
name: space.properties.name,
|
|
1415
|
-
icon: space.properties.icon,
|
|
1416
|
-
hue: space.properties.hue,
|
|
1417
|
-
edgeReplication,
|
|
1418
|
-
archived
|
|
1419
|
-
}), [
|
|
1420
|
-
space.properties.name,
|
|
1421
|
-
space.properties.icon,
|
|
1422
|
-
space.properties.hue,
|
|
1423
|
-
edgeReplication,
|
|
1424
|
-
archived
|
|
1425
|
-
]);
|
|
1426
|
-
const customElements = useMemo3(() => ({
|
|
1427
|
-
name: ({ type, label, getValue, onValueChange }) => {
|
|
1428
|
-
const handleChange = useCallback10(({ target: { value: value2 } }) => onValueChange(type, value2), [
|
|
1429
|
-
onValueChange,
|
|
1430
|
-
type
|
|
1431
|
-
]);
|
|
1432
|
-
return /* @__PURE__ */ React14.createElement(ControlItemInput3, {
|
|
1433
|
-
title: label,
|
|
1434
|
-
description: t("display name description")
|
|
1435
|
-
}, /* @__PURE__ */ React14.createElement(Input5.TextInput, {
|
|
1436
|
-
value: getValue(),
|
|
1437
|
-
onChange: handleChange,
|
|
1438
|
-
placeholder: t("display name input placeholder"),
|
|
1439
|
-
classNames: "min-is-64"
|
|
1440
|
-
}));
|
|
1441
|
-
},
|
|
1442
|
-
icon: ({ type, label, getValue, onValueChange }) => {
|
|
1443
|
-
const handleChange = useCallback10((icon) => onValueChange(type, icon), [
|
|
1444
|
-
onValueChange,
|
|
1445
|
-
type
|
|
1446
|
-
]);
|
|
1447
|
-
const handleReset = useCallback10(() => onValueChange(type, void 0), [
|
|
1448
|
-
onValueChange,
|
|
1449
|
-
type
|
|
1450
|
-
]);
|
|
1451
|
-
return /* @__PURE__ */ React14.createElement(ControlItem, {
|
|
1452
|
-
title: label,
|
|
1453
|
-
description: t("icon description")
|
|
1454
|
-
}, /* @__PURE__ */ React14.createElement(IconPicker, {
|
|
1455
|
-
value: getValue(),
|
|
1456
|
-
onChange: handleChange,
|
|
1457
|
-
onReset: handleReset,
|
|
1458
|
-
classNames: "justify-self-end"
|
|
1459
|
-
}));
|
|
1460
|
-
},
|
|
1461
|
-
hue: ({ type, label, getValue, onValueChange }) => {
|
|
1462
|
-
const handleChange = useCallback10((nextHue) => onValueChange(type, nextHue), [
|
|
1463
|
-
onValueChange,
|
|
1464
|
-
type
|
|
1465
|
-
]);
|
|
1466
|
-
const handleReset = useCallback10(() => onValueChange(type, void 0), [
|
|
1467
|
-
onValueChange,
|
|
1468
|
-
type
|
|
1469
|
-
]);
|
|
1470
|
-
return /* @__PURE__ */ React14.createElement(ControlItem, {
|
|
1471
|
-
title: label,
|
|
1472
|
-
description: t("hue description")
|
|
1473
|
-
}, /* @__PURE__ */ React14.createElement(HuePicker, {
|
|
1474
|
-
value: getValue(),
|
|
1475
|
-
onChange: handleChange,
|
|
1476
|
-
onReset: handleReset,
|
|
1477
|
-
classNames: "justify-self-end"
|
|
1478
|
-
}));
|
|
1479
|
-
},
|
|
1480
|
-
edgeReplication: ({ type, label, getValue, onValueChange }) => {
|
|
1481
|
-
const handleChange = useCallback10((checked) => onValueChange(type, checked), [
|
|
1482
|
-
onValueChange,
|
|
1483
|
-
type
|
|
1484
|
-
]);
|
|
1485
|
-
return /* @__PURE__ */ React14.createElement(ControlItemInput3, {
|
|
1486
|
-
title: label,
|
|
1487
|
-
description: t("edge replication description")
|
|
1488
|
-
}, /* @__PURE__ */ React14.createElement(Input5.Switch, {
|
|
1489
|
-
checked: getValue(),
|
|
1490
|
-
onCheckedChange: handleChange,
|
|
1491
|
-
classNames: "justify-self-end"
|
|
1492
|
-
}));
|
|
1493
|
-
},
|
|
1494
|
-
archived: ({ type, label, getValue, onValueChange }) => {
|
|
1495
|
-
const handleChange = useCallback10(() => onValueChange(type, !getValue()), [
|
|
1496
|
-
onValueChange,
|
|
1497
|
-
type,
|
|
1498
|
-
getValue
|
|
1499
|
-
]);
|
|
1500
|
-
return /* @__PURE__ */ React14.createElement(ControlItemInput3, {
|
|
1501
|
-
title: label,
|
|
1502
|
-
description: t("archive space description")
|
|
1503
|
-
}, /* @__PURE__ */ React14.createElement(Button5, {
|
|
1504
|
-
disabled: space === client.spaces.default,
|
|
1505
|
-
variant: getValue() ? "default" : "destructive",
|
|
1506
|
-
onClick: handleChange
|
|
1507
|
-
}, getValue() ? t("unarchive space label") : t("archive space label")));
|
|
1508
|
-
}
|
|
1509
|
-
}), [
|
|
1510
|
-
t,
|
|
1511
|
-
space
|
|
1512
|
-
]);
|
|
1513
|
-
const download = useFileDownload();
|
|
1514
|
-
const handleBackup = useCallback10(async () => {
|
|
1515
|
-
const archive = await space.internal.export();
|
|
1516
|
-
download(new Blob([
|
|
1517
|
-
archive.contents
|
|
1518
|
-
]), archive.filename);
|
|
1519
|
-
}, [
|
|
1520
|
-
space,
|
|
1521
|
-
download
|
|
1522
|
-
]);
|
|
1523
|
-
const repairs = useCapabilities(SpaceCapabilities.Repair);
|
|
1524
|
-
const handleRepair = useCallback10(async () => {
|
|
1525
|
-
await Promise.all(repairs.map((repair) => repair({
|
|
1526
|
-
space,
|
|
1527
|
-
isDefault: client.spaces.default === space
|
|
1528
|
-
})));
|
|
1529
|
-
}, [
|
|
1530
|
-
client,
|
|
1531
|
-
space,
|
|
1532
|
-
repairs
|
|
1533
|
-
]);
|
|
1534
|
-
return /* @__PURE__ */ React14.createElement(StackItem3.Content, {
|
|
1535
|
-
scrollable: true
|
|
1536
|
-
}, /* @__PURE__ */ React14.createElement(ControlPage4, null, /* @__PURE__ */ React14.createElement(ControlSection4, {
|
|
1537
|
-
title: t("space properties settings verbose label", {
|
|
1538
|
-
ns: meta.id
|
|
1539
|
-
}),
|
|
1540
|
-
description: t("space properties settings description", {
|
|
1541
|
-
ns: meta.id
|
|
1542
|
-
})
|
|
1543
|
-
}, /* @__PURE__ */ React14.createElement(Form3, {
|
|
1544
|
-
schema: FormSchema,
|
|
1545
|
-
values,
|
|
1546
|
-
autoSave: true,
|
|
1547
|
-
onSave: handleSave,
|
|
1548
|
-
Custom: customElements,
|
|
1549
|
-
outerSpacing: false,
|
|
1550
|
-
classNames: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
1551
|
-
})), /* @__PURE__ */ React14.createElement(ControlSection4, {
|
|
1552
|
-
title: t("space controls title", {
|
|
1553
|
-
ns: meta.id
|
|
1554
|
-
}),
|
|
1555
|
-
description: t("space controls description", {
|
|
1556
|
-
ns: meta.id
|
|
1557
|
-
})
|
|
1558
|
-
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1559
|
-
role: "none",
|
|
1560
|
-
className: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
1561
|
-
}, /* @__PURE__ */ React14.createElement(ControlItemInput3, {
|
|
1562
|
-
title: t("backup space title", {
|
|
1563
|
-
ns: meta.id
|
|
1564
|
-
}),
|
|
1565
|
-
description: t("backup space description", {
|
|
1566
|
-
ns: meta.id
|
|
1567
|
-
})
|
|
1568
|
-
}, /* @__PURE__ */ React14.createElement(Button5, {
|
|
1569
|
-
onClick: handleBackup
|
|
1570
|
-
}, t("download backup label"))), /* @__PURE__ */ React14.createElement(ControlItemInput3, {
|
|
1571
|
-
title: t("repair space title", {
|
|
1572
|
-
ns: meta.id
|
|
1573
|
-
}),
|
|
1574
|
-
description: t("repair space description", {
|
|
1575
|
-
ns: meta.id
|
|
1576
|
-
})
|
|
1577
|
-
}, /* @__PURE__ */ React14.createElement(Button5, {
|
|
1578
|
-
onClick: handleRepair
|
|
1579
|
-
}, t("repair space label")))))));
|
|
1580
|
-
} finally {
|
|
1581
|
-
_effect.f();
|
|
1582
|
-
}
|
|
1583
|
-
};
|
|
1584
|
-
|
|
1585
|
-
// src/components/SyncStatus/InlineSyncStatus.tsx
|
|
1586
|
-
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1587
|
-
import * as Option4 from "effect/Option";
|
|
1588
|
-
import React15, { useEffect as useEffect4, useState as useState9 } from "react";
|
|
1589
|
-
import { useAppGraph as useAppGraph3 } from "@dxos/app-framework/react";
|
|
1590
|
-
import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
1591
|
-
import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1592
|
-
import { useClient as useClient8 } from "@dxos/react-client";
|
|
1593
|
-
import { useSpaceSyncState } from "@dxos/react-client/echo";
|
|
1594
|
-
import { Tooltip as Tooltip2, useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
1595
|
-
import { AttentionGlyph as AttentionGlyph2, useAttended as useAttended2, useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
1596
|
-
var useEdgeStatus = () => {
|
|
1597
|
-
const [status, setStatus] = useState9(EdgeStatus.ConnectionState.NOT_CONNECTED);
|
|
1598
|
-
const client = useClient8();
|
|
1599
|
-
useEffect4(() => {
|
|
1600
|
-
client.services.services.EdgeAgentService?.queryEdgeStatus().subscribe(({ status: status2 }) => {
|
|
1601
|
-
setStatus(status2.state);
|
|
1602
|
-
});
|
|
1603
|
-
}, [
|
|
1604
|
-
client
|
|
1605
|
-
]);
|
|
1606
|
-
return status;
|
|
1607
|
-
};
|
|
1608
|
-
var InlineSyncStatus = ({ space, open }) => {
|
|
1609
|
-
var _effect = _useSignals15();
|
|
1610
|
-
try {
|
|
1611
|
-
const { t } = useTranslation15(meta.id);
|
|
1612
|
-
const id = space.id;
|
|
1613
|
-
const { hasAttention, isAncestor, isRelated } = useAttention2(id);
|
|
1614
|
-
const isAttended = hasAttention || isAncestor || isRelated;
|
|
1615
|
-
const { graph } = useAppGraph3();
|
|
1616
|
-
const attended = useAttended2();
|
|
1617
|
-
const startOfAttention = attended.at(-1);
|
|
1618
|
-
const path = usePath(graph, startOfAttention);
|
|
1619
|
-
const containsAttended = !open && !isAttended && id && Option4.isSome(path) ? path.value.includes(id) : false;
|
|
1620
|
-
const connectedToEdge = useEdgeStatus() === EdgeStatus.ConnectionState.CONNECTED;
|
|
1621
|
-
const edgeSyncEnabled = space.internal.data.edgeReplication === EdgeReplicationSetting2.ENABLED;
|
|
1622
|
-
const syncState = useSpaceSyncState(space);
|
|
1623
|
-
const syncing = connectedToEdge && edgeSyncEnabled && syncState && syncState.missingOnLocal > 0;
|
|
1624
|
-
return /* @__PURE__ */ React15.createElement(Tooltip2.Trigger, {
|
|
1625
|
-
asChild: true,
|
|
1626
|
-
content: t("syncing label"),
|
|
1627
|
-
side: "bottom"
|
|
1628
|
-
}, /* @__PURE__ */ React15.createElement(AttentionGlyph2, {
|
|
1629
|
-
syncing,
|
|
1630
|
-
attended: isAttended,
|
|
1631
|
-
containsAttended,
|
|
1632
|
-
classNames: "self-center mie-1"
|
|
1633
|
-
}));
|
|
1634
|
-
} finally {
|
|
1635
|
-
_effect.f();
|
|
1636
|
-
}
|
|
1637
|
-
};
|
|
1638
|
-
|
|
1639
|
-
// src/components/SyncStatus/SyncStatus.tsx
|
|
1640
|
-
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1641
|
-
import React16, { useEffect as useEffect5, useState as useState10 } from "react";
|
|
1642
|
-
import { StatusBar } from "@dxos/plugin-status-bar";
|
|
1643
|
-
import { EdgeStatus as EdgeStatus2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1644
|
-
import { useClient as useClient9 } from "@dxos/react-client";
|
|
1645
|
-
import { useStream } from "@dxos/react-client/devtools";
|
|
1646
|
-
import { getSyncSummary, useSyncState } from "@dxos/react-client/echo";
|
|
1647
|
-
import { Icon as Icon5, Popover as Popover3, useTranslation as useTranslation16 } from "@dxos/react-ui";
|
|
1648
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
1649
|
-
import { Unit } from "@dxos/util";
|
|
1650
|
-
|
|
1651
|
-
// src/components/SyncStatus/save-tracker.ts
|
|
1652
|
-
import { Context } from "@dxos/context";
|
|
1653
|
-
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/components/SyncStatus/save-tracker.ts";
|
|
1654
|
-
var createClientSaveTracker = (client, cb) => {
|
|
1655
|
-
const CleanupFns = {};
|
|
1656
|
-
const state = {};
|
|
1657
|
-
const install = (spaces) => {
|
|
1658
|
-
for (const space of spaces) {
|
|
1659
|
-
if (state[space.id]) {
|
|
1660
|
-
continue;
|
|
1661
|
-
}
|
|
1662
|
-
state[space.id] = "saved";
|
|
1663
|
-
CleanupFns[space.id] = createSpaceSaveTracker(space, (s) => {
|
|
1664
|
-
state[space.id] = s;
|
|
1665
|
-
cb(Object.values(state).some((s2) => s2 === "saving") ? "saving" : "saved");
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
client.spaces.subscribe((spaces) => {
|
|
1670
|
-
install(spaces);
|
|
1671
|
-
});
|
|
1672
|
-
install(client.spaces.get());
|
|
1673
|
-
return () => {
|
|
1674
|
-
for (const unsubscribe of Object.values(CleanupFns)) {
|
|
1675
|
-
unsubscribe();
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
};
|
|
1679
|
-
var createSpaceSaveTracker = (space, cb) => {
|
|
1680
|
-
const ctx = new Context(void 0, {
|
|
1681
|
-
F: __dxlog_file5,
|
|
1682
|
-
L: 40
|
|
1683
|
-
});
|
|
1684
|
-
void space.waitUntilReady().then(() => {
|
|
1685
|
-
if (ctx.disposed) {
|
|
1686
|
-
return;
|
|
1687
|
-
}
|
|
1688
|
-
let hasUnsavedChanges = false;
|
|
1689
|
-
let lastFlushPromise;
|
|
1690
|
-
space.db.saveStateChanged.on(ctx, ({ unsavedDocuments }) => {
|
|
1691
|
-
hasUnsavedChanges = unsavedDocuments.length > 0;
|
|
1692
|
-
});
|
|
1693
|
-
space.db.saveStateChanged.debounce(500).on(ctx, () => {
|
|
1694
|
-
if (hasUnsavedChanges) {
|
|
1695
|
-
lastFlushPromise = void 0;
|
|
1696
|
-
cb("saving");
|
|
1697
|
-
} else {
|
|
1698
|
-
const flushPromise = space.db.flush();
|
|
1699
|
-
lastFlushPromise = flushPromise;
|
|
1700
|
-
void flushPromise.then(() => {
|
|
1701
|
-
if (lastFlushPromise === flushPromise) {
|
|
1702
|
-
cb("saved");
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
});
|
|
1707
|
-
});
|
|
1708
|
-
return () => {
|
|
1709
|
-
void ctx.dispose();
|
|
1710
|
-
};
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
|
-
// src/components/SyncStatus/status.ts
|
|
1714
|
-
var getStatus = ({ offline, saved, needsToUpload, needsToDownload }) => {
|
|
1715
|
-
if (!saved) {
|
|
1716
|
-
return "saving locally";
|
|
1717
|
-
} else if (!offline && needsToDownload) {
|
|
1718
|
-
return "downloading";
|
|
1719
|
-
} else if (!offline && needsToUpload) {
|
|
1720
|
-
return "uploading";
|
|
1721
|
-
} else if (offline && !needsToUpload && !needsToDownload) {
|
|
1722
|
-
return "offline persisted";
|
|
1723
|
-
} else {
|
|
1724
|
-
return "remote synced";
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
var getIcon = (status) => {
|
|
1728
|
-
switch (status) {
|
|
1729
|
-
case "saving locally":
|
|
1730
|
-
return "ph--download--regular";
|
|
1731
|
-
case "downloading":
|
|
1732
|
-
return "ph--cloud-arrow-down--regular";
|
|
1733
|
-
case "uploading":
|
|
1734
|
-
return "ph--cloud-arrow-up--regular";
|
|
1735
|
-
case "offline persisted":
|
|
1736
|
-
return "ph--check-circle--regular";
|
|
1737
|
-
case "remote synced":
|
|
1738
|
-
return "ph--cloud-check--regular";
|
|
1739
|
-
}
|
|
1740
|
-
};
|
|
1741
|
-
|
|
1742
|
-
// src/components/SyncStatus/SyncStatus.tsx
|
|
1743
|
-
var SYNC_STALLED_TIMEOUT = 5e3;
|
|
1744
|
-
var SyncStatus = () => {
|
|
1745
|
-
var _effect = _useSignals16();
|
|
1746
|
-
try {
|
|
1747
|
-
const client = useClient9();
|
|
1748
|
-
const state = useSyncState();
|
|
1749
|
-
const [saved, setSaved] = useState10(true);
|
|
1750
|
-
useEffect5(() => createClientSaveTracker(client, (state2) => setSaved(state2 === "saved")), []);
|
|
1751
|
-
return /* @__PURE__ */ React16.createElement(SyncStatusIndicator, {
|
|
1752
|
-
state,
|
|
1753
|
-
saved
|
|
1754
|
-
});
|
|
1755
|
-
} finally {
|
|
1756
|
-
_effect.f();
|
|
1757
|
-
}
|
|
1758
|
-
};
|
|
1759
|
-
var SyncStatusIndicator = ({ state, saved }) => {
|
|
1760
|
-
var _effect = _useSignals16();
|
|
1761
|
-
try {
|
|
1762
|
-
const { t } = useTranslation16(meta.id);
|
|
1763
|
-
const summary = getSyncSummary(state);
|
|
1764
|
-
const offline = Object.values(state).length === 0;
|
|
1765
|
-
const needsToUpload = summary.differentDocuments > 0 || summary.missingOnRemote > 0;
|
|
1766
|
-
const needsToDownload = summary.differentDocuments > 0 || summary.missingOnLocal > 0;
|
|
1767
|
-
const status = getStatus({
|
|
1768
|
-
offline,
|
|
1769
|
-
saved,
|
|
1770
|
-
needsToUpload,
|
|
1771
|
-
needsToDownload
|
|
1772
|
-
});
|
|
1773
|
-
const [classNames, setClassNames] = useState10();
|
|
1774
|
-
useEffect5(() => {
|
|
1775
|
-
setClassNames(void 0);
|
|
1776
|
-
if (offline || !needsToUpload && !needsToDownload) {
|
|
1777
|
-
return;
|
|
1778
|
-
}
|
|
1779
|
-
const t2 = setTimeout(() => {
|
|
1780
|
-
setClassNames("text-orange-500");
|
|
1781
|
-
}, SYNC_STALLED_TIMEOUT);
|
|
1782
|
-
return () => clearTimeout(t2);
|
|
1783
|
-
}, [
|
|
1784
|
-
offline,
|
|
1785
|
-
needsToUpload,
|
|
1786
|
-
needsToDownload
|
|
1787
|
-
]);
|
|
1788
|
-
const title = t(`${status} label`);
|
|
1789
|
-
const icon = /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1790
|
-
icon: getIcon(status),
|
|
1791
|
-
classNames
|
|
1792
|
-
});
|
|
1793
|
-
return /* @__PURE__ */ React16.createElement(Popover3.Root, null, /* @__PURE__ */ React16.createElement(Popover3.Trigger, {
|
|
1794
|
-
asChild: true
|
|
1795
|
-
}, /* @__PURE__ */ React16.createElement(StatusBar.Item, {
|
|
1796
|
-
title
|
|
1797
|
-
}, icon)), /* @__PURE__ */ React16.createElement(Popover3.Portal, null, /* @__PURE__ */ React16.createElement(Popover3.Content, null, /* @__PURE__ */ React16.createElement(EdgeConnectionPopover, null), /* @__PURE__ */ React16.createElement(Popover3.Arrow, null))));
|
|
1798
|
-
} finally {
|
|
1799
|
-
_effect.f();
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
var useEdgeStatus2 = () => {
|
|
1803
|
-
const client = useClient9();
|
|
1804
|
-
const { status } = useStream(() => client.services.services.EdgeAgentService.queryEdgeStatus(), {});
|
|
1805
|
-
return status;
|
|
1806
|
-
};
|
|
1807
|
-
var EdgeConnectionPopover = () => {
|
|
1808
|
-
var _effect = _useSignals16();
|
|
1809
|
-
try {
|
|
1810
|
-
const status = useEdgeStatus2();
|
|
1811
|
-
const { t } = useTranslation16(meta.id);
|
|
1812
|
-
const isConnected = status?.state === EdgeStatus2.ConnectionState.CONNECTED;
|
|
1813
|
-
return /* @__PURE__ */ React16.createElement("div", {
|
|
1814
|
-
className: "min-is-[240px] p-2"
|
|
1815
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1816
|
-
className: "flex items-center gap-2 mbe-2"
|
|
1817
|
-
}, /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1818
|
-
icon: isConnected ? "ph--check-circle--regular" : "ph--warning-circle--regular",
|
|
1819
|
-
classNames: mx(isConnected ? "text-successText" : "text-errorText animate-pulse")
|
|
1820
|
-
}), /* @__PURE__ */ React16.createElement("span", {
|
|
1821
|
-
className: "font-medium text-sm"
|
|
1822
|
-
}, isConnected ? t("sync edge connected label") : t("sync edge disconnected label"))), status?.state === EdgeStatus2.ConnectionState.NOT_CONNECTED && /* @__PURE__ */ React16.createElement("div", {
|
|
1823
|
-
className: "flex items-center gap-2 text-sm text-description"
|
|
1824
|
-
}, /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1825
|
-
icon: "ph--cloud-x--regular"
|
|
1826
|
-
}), /* @__PURE__ */ React16.createElement("span", null, t("sync no connection label"))), status?.state === EdgeStatus2.ConnectionState.CONNECTED && /* @__PURE__ */ React16.createElement("div", {
|
|
1827
|
-
className: "space-y-2"
|
|
1828
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1829
|
-
className: "flex items-center justify-between text-sm"
|
|
1830
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1831
|
-
className: "flex items-center gap-2 text-description"
|
|
1832
|
-
}, /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1833
|
-
icon: "ph--timer--regular"
|
|
1834
|
-
}), /* @__PURE__ */ React16.createElement("span", null, t("sync latency label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
|
|
1835
|
-
value: status.rtt,
|
|
1836
|
-
format: Unit.Millisecond
|
|
1837
|
-
})), /* @__PURE__ */ React16.createElement("div", {
|
|
1838
|
-
className: "flex items-center justify-between text-sm"
|
|
1839
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1840
|
-
className: "flex items-center gap-2 text-description"
|
|
1841
|
-
}, /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1842
|
-
icon: "ph--arrow-up--regular"
|
|
1843
|
-
}), /* @__PURE__ */ React16.createElement("span", null, t("sync upload label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
|
|
1844
|
-
value: status.rateBytesUp,
|
|
1845
|
-
format: Unit.Kilobyte,
|
|
1846
|
-
suffix: "/s"
|
|
1847
|
-
})), /* @__PURE__ */ React16.createElement("div", {
|
|
1848
|
-
className: "flex items-center justify-between text-sm"
|
|
1849
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1850
|
-
className: "flex items-center gap-2 text-sm text-description"
|
|
1851
|
-
}, /* @__PURE__ */ React16.createElement(Icon5, {
|
|
1852
|
-
icon: "ph--arrow-down--regular"
|
|
1853
|
-
}), /* @__PURE__ */ React16.createElement("span", null, t("sync download label"))), /* @__PURE__ */ React16.createElement(UnitValue, {
|
|
1854
|
-
value: status.rateBytesDown,
|
|
1855
|
-
format: Unit.Kilobyte,
|
|
1856
|
-
suffix: "/s"
|
|
1857
|
-
}))));
|
|
1858
|
-
} finally {
|
|
1859
|
-
_effect.f();
|
|
1860
|
-
}
|
|
1861
|
-
};
|
|
1862
|
-
var UnitValue = ({ value: input, format, suffix }) => {
|
|
1863
|
-
var _effect = _useSignals16();
|
|
1864
|
-
try {
|
|
1865
|
-
const { formattedValue, unit } = format(input);
|
|
1866
|
-
return /* @__PURE__ */ React16.createElement("span", {
|
|
1867
|
-
className: "font-mono"
|
|
1868
|
-
}, formattedValue, /* @__PURE__ */ React16.createElement("span", {
|
|
1869
|
-
className: "mis-1 text-subdued"
|
|
1870
|
-
}, unit.symbol, suffix));
|
|
1871
|
-
} finally {
|
|
1872
|
-
_effect.f();
|
|
1873
|
-
}
|
|
1874
|
-
};
|
|
1875
|
-
|
|
1876
|
-
// src/helpers/query.ts
|
|
1877
|
-
import * as Array2 from "effect/Array";
|
|
1878
|
-
import * as Effect3 from "effect/Effect";
|
|
1879
|
-
import * as EffectFunction from "effect/Function";
|
|
1880
|
-
import * as Match from "effect/Match";
|
|
1881
|
-
import * as Option5 from "effect/Option";
|
|
1882
|
-
import * as SchemaAST from "effect/SchemaAST";
|
|
1883
|
-
import { DXN, Filter as Filter2, Query } from "@dxos/echo";
|
|
1884
|
-
import { ReferenceAnnotationId, getTypeAnnotation as getTypeAnnotation3, unwrapOptional } from "@dxos/echo/internal";
|
|
1885
|
-
import { log as log4 } from "@dxos/log";
|
|
1886
|
-
import { Person } from "@dxos/types";
|
|
1887
|
-
var __dxlog_file6 = "/__w/dxos/dxos/packages/plugins/plugin-space/src/helpers/query.ts";
|
|
1888
|
-
var evalQuery = (queryString) => {
|
|
1889
|
-
const globals = {
|
|
1890
|
-
Query,
|
|
1891
|
-
Filter: Filter2,
|
|
1892
|
-
Person
|
|
1893
|
-
};
|
|
1894
|
-
try {
|
|
1895
|
-
return new Function(...Object.keys(globals), `return ${queryString}`)(...Object.values(globals));
|
|
1896
|
-
} catch (err) {
|
|
1897
|
-
log4.catch(err, void 0, {
|
|
1898
|
-
F: __dxlog_file6,
|
|
1899
|
-
L: 33,
|
|
1900
|
-
S: void 0,
|
|
1901
|
-
C: (f, a) => f(...a)
|
|
1902
|
-
});
|
|
1903
|
-
return Query.select(Filter2.nothing());
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
var resolveSchemaWithClientAndSpace = (client, space, query) => {
|
|
1907
|
-
const resolve = Effect3.fn(function* (dxn) {
|
|
1908
|
-
const typename = DXN.parse(dxn).asTypeDXN()?.type;
|
|
1909
|
-
if (!typename) {
|
|
1910
|
-
return Option5.none();
|
|
1911
|
-
}
|
|
1912
|
-
const staticSchema = client.graph.schemaRegistry.getSchema(typename);
|
|
1913
|
-
if (staticSchema) {
|
|
1914
|
-
return Option5.some(staticSchema);
|
|
1915
|
-
}
|
|
1916
|
-
const query2 = space.db.schemaRegistry.query({
|
|
1917
|
-
typename
|
|
1918
|
-
});
|
|
1919
|
-
const schemas = yield* Effect3.promise(() => query2.run());
|
|
1920
|
-
return Array2.head(schemas);
|
|
1921
|
-
});
|
|
1922
|
-
return resolveSchema(query, resolve).pipe(Effect3.map((schema) => Option5.getOrUndefined(schema)), Effect3.runPromise);
|
|
1923
|
-
};
|
|
1924
|
-
var resolveSchema = (query, resolve) => {
|
|
1925
|
-
return Match.value(query).pipe(
|
|
1926
|
-
Match.withReturnType(),
|
|
1927
|
-
// TODO(wittjosiah): Reconcile with filter match?
|
|
1928
|
-
Match.when({
|
|
1929
|
-
type: "select"
|
|
1930
|
-
}, ({ filter }) => typenameFromFilter(filter).pipe(Option5.map((typename) => resolve(typename)), Option5.getOrElse(() => Effect3.succeed(Option5.none())))),
|
|
1931
|
-
Match.when({
|
|
1932
|
-
type: "filter"
|
|
1933
|
-
}, ({ filter }) => typenameFromFilter(filter).pipe(Option5.map((typename) => resolve(typename)), Option5.getOrElse(() => Effect3.succeed(Option5.none())))),
|
|
1934
|
-
Match.when({
|
|
1935
|
-
type: "reference-traversal"
|
|
1936
|
-
}, ({ anchor, property }) => resolveSchema(anchor, resolve).pipe(Effect3.map((base) => base.pipe(Option5.map((schema) => SchemaAST.getPropertySignatures(schema.ast)), Option5.flatMap((properties) => Array2.findFirst(properties, (p) => p.name === property)), Option5.flatMap((property2) => SchemaAST.getAnnotation(ReferenceAnnotationId)(unwrapOptional(property2))), Option5.map((annotation) => annotation.typename))), Effect3.flatMap(Option5.match({
|
|
1937
|
-
onNone: () => Effect3.succeed(Option5.none()),
|
|
1938
|
-
onSome: (typename) => resolve(DXN.fromTypename(typename).toString())
|
|
1939
|
-
})))),
|
|
1940
|
-
Match.when({
|
|
1941
|
-
type: "relation",
|
|
1942
|
-
filter: Match.defined
|
|
1943
|
-
}, ({ filter }) => typenameFromFilter(filter).pipe(Option5.map((typename) => resolve(typename)), Option5.getOrElse(() => Effect3.succeed(Option5.none())))),
|
|
1944
|
-
Match.when({
|
|
1945
|
-
type: "relation-traversal"
|
|
1946
|
-
}, ({ anchor, direction }) => resolveSchema(anchor, resolve).pipe(Effect3.map((base) => base.pipe(Option5.map((schema) => getTypeAnnotation3(schema)), Option5.flatMap((annotation) => Option5.fromNullable(direction === "source" ? annotation?.sourceSchema : annotation?.targetSchema)))), Effect3.flatMap(Option5.match({
|
|
1947
|
-
onNone: () => Effect3.succeed(Option5.none()),
|
|
1948
|
-
onSome: (typename) => resolve(typename)
|
|
1949
|
-
})))),
|
|
1950
|
-
Match.when({
|
|
1951
|
-
type: "options"
|
|
1952
|
-
}, ({ query: query2 }) => resolveSchema(query2, resolve)),
|
|
1953
|
-
Match.orElse((_q) => {
|
|
1954
|
-
return Effect3.succeed(Option5.none());
|
|
1955
|
-
})
|
|
1956
|
-
);
|
|
1957
|
-
};
|
|
1958
|
-
var typenameFromFilter = (filter) => Match.value(filter).pipe(Match.withReturnType(), Match.when({
|
|
1959
|
-
type: "object"
|
|
1960
|
-
}, ({ typename }) => Option5.fromNullable(typename)), Match.when({
|
|
1961
|
-
type: "and"
|
|
1962
|
-
}, ({ filters }) => EffectFunction.pipe(filters, Array2.map(typenameFromFilter), Array2.findFirst(Option5.isSome), Option5.flatten)), Match.when({
|
|
1963
|
-
type: "or"
|
|
1964
|
-
}, ({ filters }) => EffectFunction.pipe(filters, Array2.map(typenameFromFilter), Array2.findFirst(Option5.isSome), Option5.flatten)), Match.orElse(() => Option5.none()));
|
|
1965
|
-
var getQueryTarget = (query, space) => {
|
|
1966
|
-
return Match.value(query).pipe(Match.when({
|
|
1967
|
-
type: "options"
|
|
1968
|
-
}, ({ options }) => {
|
|
1969
|
-
return Option5.fromNullable(options.queues).pipe(Option5.flatMap((queues) => Array2.head(queues)), Option5.flatMap((queueDxn) => Option5.fromNullable(DXN.tryParse(queueDxn))), Option5.flatMap((queueDxn) => Option5.fromNullable(space?.queues.get(queueDxn))), Option5.getOrElse(() => space));
|
|
1970
|
-
}), Match.orElse(() => space));
|
|
1971
|
-
};
|
|
1972
|
-
|
|
1973
|
-
// src/components/ViewEditor.tsx
|
|
1974
|
-
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1975
|
-
import * as Schema2 from "effect/Schema";
|
|
1976
|
-
import React17, { useCallback as useCallback11, useState as useState11 } from "react";
|
|
1977
|
-
import { createIntent as createIntent10 } from "@dxos/app-framework";
|
|
1978
|
-
import { useIntentDispatcher as useIntentDispatcher10 } from "@dxos/app-framework/react";
|
|
1979
|
-
import { DXN as DXN2, Filter as Filter3, Obj as Obj6, Query as Query2, Tag, Type as Type2 } from "@dxos/echo";
|
|
1980
|
-
import { useClient as useClient10 } from "@dxos/react-client";
|
|
1981
|
-
import { getSpace as getSpace4, useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
1982
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
1983
|
-
import { ViewEditor as NaturalViewEditor } from "@dxos/react-ui-form";
|
|
1984
|
-
import { View } from "@dxos/schema";
|
|
1985
|
-
var ViewEditor = ({ view }) => {
|
|
1986
|
-
var _effect = _useSignals17();
|
|
1987
|
-
try {
|
|
1988
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher10();
|
|
1989
|
-
const client = useClient10();
|
|
1990
|
-
const space = getSpace4(view);
|
|
1991
|
-
const [schema, setSchema] = useState11(() => Schema2.Struct({}));
|
|
1992
|
-
const tags = useQuery2(space, Filter3.type(Tag.Tag));
|
|
1993
|
-
const types = useTypeOptions({
|
|
1994
|
-
space,
|
|
1995
|
-
annotation: {
|
|
1996
|
-
location: [
|
|
1997
|
-
"database",
|
|
1998
|
-
"runtime"
|
|
1999
|
-
],
|
|
2000
|
-
kind: [
|
|
2001
|
-
"user"
|
|
2002
|
-
],
|
|
2003
|
-
registered: [
|
|
2004
|
-
"registered"
|
|
2005
|
-
]
|
|
2006
|
-
}
|
|
2007
|
-
});
|
|
2008
|
-
useAsyncEffect(async () => {
|
|
2009
|
-
if (!view?.query || !space) {
|
|
2010
|
-
return;
|
|
2011
|
-
}
|
|
2012
|
-
const foundSchema = await resolveSchemaWithClientAndSpace(client, space, view.query.ast);
|
|
2013
|
-
if (foundSchema && foundSchema !== schema) {
|
|
2014
|
-
setSchema(() => foundSchema);
|
|
2015
|
-
}
|
|
2016
|
-
}, [
|
|
2017
|
-
client,
|
|
2018
|
-
space,
|
|
2019
|
-
view,
|
|
2020
|
-
schema
|
|
2021
|
-
]);
|
|
2022
|
-
const handleQueryChanged = useCallback11(async (newQuery, target) => {
|
|
2023
|
-
if (!view || !space) {
|
|
2024
|
-
return;
|
|
2025
|
-
}
|
|
2026
|
-
const queue = target && DXN2.tryParse(target) ? target : void 0;
|
|
2027
|
-
const query = queue ? Query2.fromAst(newQuery).options({
|
|
2028
|
-
queues: [
|
|
2029
|
-
queue
|
|
2030
|
-
]
|
|
2031
|
-
}) : Query2.fromAst(newQuery);
|
|
2032
|
-
view.query.ast = query.ast;
|
|
2033
|
-
const newSchema = await resolveSchemaWithClientAndSpace(client, space, query.ast);
|
|
2034
|
-
if (!newSchema) {
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
const newView = View.make({
|
|
2038
|
-
query,
|
|
2039
|
-
jsonSchema: Type2.toJsonSchema(newSchema)
|
|
2040
|
-
});
|
|
2041
|
-
view.projection = Obj6.getSnapshot(newView).projection;
|
|
2042
|
-
setSchema(() => newSchema);
|
|
2043
|
-
}, [
|
|
2044
|
-
view,
|
|
2045
|
-
schema
|
|
2046
|
-
]);
|
|
2047
|
-
const handleDelete = useCallback11((fieldId) => {
|
|
2048
|
-
void dispatch(createIntent10(SpaceAction.DeleteField, {
|
|
2049
|
-
view,
|
|
2050
|
-
fieldId
|
|
2051
|
-
}));
|
|
2052
|
-
}, [
|
|
2053
|
-
dispatch,
|
|
2054
|
-
view
|
|
2055
|
-
]);
|
|
2056
|
-
if (!space || !schema) {
|
|
2057
|
-
return null;
|
|
2058
|
-
}
|
|
2059
|
-
return /* @__PURE__ */ React17.createElement(NaturalViewEditor, {
|
|
2060
|
-
registry: space.db.schemaRegistry,
|
|
2061
|
-
schema,
|
|
2062
|
-
view,
|
|
2063
|
-
mode: "tag",
|
|
2064
|
-
outerSpacing: false,
|
|
2065
|
-
tags,
|
|
2066
|
-
types,
|
|
2067
|
-
onQueryChanged: handleQueryChanged,
|
|
2068
|
-
onDelete: Type2.isMutable(schema) ? handleDelete : void 0
|
|
2069
|
-
});
|
|
2070
|
-
} finally {
|
|
2071
|
-
_effect.f();
|
|
2072
|
-
}
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
|
-
// src/components/index.ts
|
|
2076
|
-
import { lazy as lazy2 } from "react";
|
|
2077
|
-
var CollectionArticle = lazy2(() => import("./CollectionArticle-KHXYT3SH.mjs"));
|
|
2078
|
-
var ObjectDetailsPanel = lazy2(() => import("./ObjectDetailsPanel-6OFTT3GG.mjs"));
|
|
2079
|
-
var ObjectSettingsContainer = lazy2(() => import("./ObjectSettings-YXPJQMJ5.mjs"));
|
|
2080
|
-
var RecordArticle = lazy2(() => import("./RecordArticle-SSJ7PULS.mjs"));
|
|
2081
|
-
|
|
2082
|
-
export {
|
|
2083
|
-
AwaitingObject,
|
|
2084
|
-
CREATE_OBJECT_DIALOG,
|
|
2085
|
-
CreateObjectDialog,
|
|
2086
|
-
CREATE_SPACE_DIALOG,
|
|
2087
|
-
CreateSpaceDialog,
|
|
2088
|
-
CollectionSection,
|
|
2089
|
-
JOIN_DIALOG,
|
|
2090
|
-
JoinDialog,
|
|
2091
|
-
MembersContainer,
|
|
2092
|
-
MenuFooter,
|
|
2093
|
-
OBJECT_RENAME_POPOVER,
|
|
2094
|
-
ObjectRenamePopover,
|
|
2095
|
-
SPACE_RENAME_POPOVER,
|
|
2096
|
-
SpaceRenamePopover,
|
|
2097
|
-
SchemaContainer,
|
|
2098
|
-
useQuerySpaceSchemas,
|
|
2099
|
-
SpacePresence,
|
|
2100
|
-
FullPresence,
|
|
2101
|
-
SmallPresenceLive,
|
|
2102
|
-
SmallPresence,
|
|
2103
|
-
SpacePluginSettings,
|
|
2104
|
-
SpaceSettingsContainer,
|
|
2105
|
-
InlineSyncStatus,
|
|
2106
|
-
SyncStatus,
|
|
2107
|
-
SyncStatusIndicator,
|
|
2108
|
-
evalQuery,
|
|
2109
|
-
resolveSchemaWithClientAndSpace,
|
|
2110
|
-
getQueryTarget,
|
|
2111
|
-
ViewEditor,
|
|
2112
|
-
CollectionArticle,
|
|
2113
|
-
ObjectDetailsPanel,
|
|
2114
|
-
ObjectSettingsContainer,
|
|
2115
|
-
RecordArticle,
|
|
2116
|
-
AppGraphBuilder,
|
|
2117
|
-
AppGraphSerializer,
|
|
2118
|
-
IdentityCreated,
|
|
2119
|
-
IntentResolver,
|
|
2120
|
-
ReactRoot,
|
|
2121
|
-
ReactSurface,
|
|
2122
|
-
Repair,
|
|
2123
|
-
SpaceSettings,
|
|
2124
|
-
SpaceState,
|
|
2125
|
-
SpacesReady
|
|
2126
|
-
};
|
|
2127
|
-
//# sourceMappingURL=chunk-JAMGJUFU.mjs.map
|