@dxos/plugin-space 0.8.4-main.3a94e84 → 0.8.4-main.406dc2a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{CollectionMain-D2B75XBS.mjs → CollectionMain-AX7KKXWP.mjs} +4 -4
- package/dist/lib/browser/CollectionMain-AX7KKXWP.mjs.map +7 -0
- package/dist/lib/browser/ObjectDetailsPanel-MQBHG666.mjs +145 -0
- package/dist/lib/browser/ObjectDetailsPanel-MQBHG666.mjs.map +7 -0
- package/dist/lib/browser/ObjectSettings-KNUZFCGS.mjs +151 -0
- package/dist/lib/browser/ObjectSettings-KNUZFCGS.mjs.map +7 -0
- package/dist/lib/browser/RecordMain-H4DVHICS.mjs +116 -0
- package/dist/lib/browser/RecordMain-H4DVHICS.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-7CZZJS3S.mjs → app-graph-builder-3R5GGT46.mjs} +102 -61
- package/dist/lib/browser/app-graph-builder-3R5GGT46.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-H6AW7KGS.mjs → app-graph-serializer-25Z5BG22.mjs} +14 -14
- package/dist/lib/browser/app-graph-serializer-25Z5BG22.mjs.map +7 -0
- package/dist/lib/browser/{chunk-V7MJSSBQ.mjs → chunk-522KZGQF.mjs} +310 -342
- package/dist/lib/browser/chunk-522KZGQF.mjs.map +7 -0
- package/dist/lib/browser/chunk-7XOTWRZ3.mjs +166 -0
- package/dist/lib/browser/chunk-7XOTWRZ3.mjs.map +7 -0
- package/dist/lib/browser/chunk-EIXZABXD.mjs +19 -0
- package/dist/lib/browser/chunk-EIXZABXD.mjs.map +7 -0
- package/dist/lib/browser/chunk-IRKDREHY.mjs +11 -0
- package/dist/lib/browser/chunk-IRKDREHY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XUYKJUU7.mjs → chunk-OV6D543A.mjs} +99 -44
- package/dist/lib/browser/chunk-OV6D543A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QACNNDOT.mjs → chunk-PTGRQQ6J.mjs} +13 -10
- package/dist/lib/browser/chunk-PTGRQQ6J.mjs.map +7 -0
- package/dist/lib/browser/chunk-RLI2IAHK.mjs +20 -0
- package/dist/lib/browser/chunk-RLI2IAHK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SGTQ52SU.mjs → chunk-WS2PJDES.mjs} +22 -12
- package/dist/lib/browser/chunk-WS2PJDES.mjs.map +7 -0
- package/dist/lib/browser/{identity-created-23XJJV2N.mjs → identity-created-PW2BA46S.mjs} +4 -4
- package/dist/lib/browser/{identity-created-23XJJV2N.mjs.map → identity-created-PW2BA46S.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +36 -53
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-TIXVDYN7.mjs → intent-resolver-ICGUSVH6.mjs} +52 -45
- package/dist/lib/browser/intent-resolver-ICGUSVH6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-N2J7TDRX.mjs → react-root-H56QN474.mjs} +11 -11
- package/dist/lib/browser/react-root-H56QN474.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-TPNLWJJH.mjs → react-surface-VOE2ILKO.mjs} +57 -77
- package/dist/lib/browser/react-surface-VOE2ILKO.mjs.map +7 -0
- package/dist/lib/browser/{schema-defs-Z6FC4AHC.mjs → schema-defs-7R7RKCAE.mjs} +5 -5
- package/dist/lib/browser/schema-defs-7R7RKCAE.mjs.map +7 -0
- package/dist/lib/browser/{settings-4IMP5RYT.mjs → settings-OBFJ67ZG.mjs} +5 -5
- package/dist/lib/browser/{settings-4IMP5RYT.mjs.map → settings-OBFJ67ZG.mjs.map} +1 -1
- package/dist/lib/browser/{spaces-ready-TOPG6IV4.mjs → spaces-ready-MFIVK6I6.mjs} +18 -16
- package/dist/lib/browser/spaces-ready-MFIVK6I6.mjs.map +7 -0
- package/dist/lib/browser/{state-QYZAB45H.mjs → state-LSPRFIRO.mjs} +7 -7
- package/dist/lib/browser/state-LSPRFIRO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{CollectionMain-ZJIFCWKZ.mjs → CollectionMain-EU57SRYK.mjs} +4 -4
- package/dist/lib/node-esm/CollectionMain-EU57SRYK.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-NABA2S56.mjs +146 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-NABA2S56.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectSettings-GXGTITF5.mjs +152 -0
- package/dist/lib/node-esm/ObjectSettings-GXGTITF5.mjs.map +7 -0
- package/dist/lib/node-esm/RecordMain-MYFTAQ2U.mjs +117 -0
- package/dist/lib/node-esm/RecordMain-MYFTAQ2U.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-KGIGWC72.mjs → app-graph-builder-VGRMD5TP.mjs} +102 -61
- package/dist/lib/node-esm/app-graph-builder-VGRMD5TP.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-2ICUGQQT.mjs → app-graph-serializer-U4GHXWRG.mjs} +14 -14
- package/dist/lib/node-esm/app-graph-serializer-U4GHXWRG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JH6F4C3I.mjs → chunk-4F25JKVT.mjs} +22 -12
- package/dist/lib/node-esm/chunk-4F25JKVT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6X5DLJM5.mjs → chunk-DG5YEEPZ.mjs} +310 -342
- package/dist/lib/node-esm/chunk-DG5YEEPZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H5UPFRRH.mjs +21 -0
- package/dist/lib/node-esm/chunk-H5UPFRRH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-P442DOQ3.mjs → chunk-HAKW2RFD.mjs} +13 -10
- package/dist/lib/node-esm/chunk-HAKW2RFD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HWNG4MEU.mjs → chunk-MWNATOXL.mjs} +2 -4
- package/dist/lib/node-esm/chunk-MWNATOXL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PAAWJ4RE.mjs +167 -0
- package/dist/lib/node-esm/chunk-PAAWJ4RE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SVFKU7EW.mjs +20 -0
- package/dist/lib/node-esm/chunk-SVFKU7EW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4AOMYKDE.mjs → chunk-TNUWML33.mjs} +99 -44
- package/dist/lib/node-esm/chunk-TNUWML33.mjs.map +7 -0
- package/dist/lib/node-esm/{identity-created-IJQO6GCR.mjs → identity-created-MWTLGQRU.mjs} +4 -4
- package/dist/lib/node-esm/{identity-created-IJQO6GCR.mjs.map → identity-created-MWTLGQRU.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +36 -53
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-MHGHRGDT.mjs → intent-resolver-KVB2A4YC.mjs} +52 -45
- package/dist/lib/node-esm/intent-resolver-KVB2A4YC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-KW3TGJGY.mjs → react-root-56PGW5PH.mjs} +11 -11
- package/dist/lib/node-esm/react-root-56PGW5PH.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-UUIUUD6P.mjs → react-surface-NYEQ23A4.mjs} +57 -77
- package/dist/lib/node-esm/react-surface-NYEQ23A4.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-defs-WHJM7UZE.mjs → schema-defs-RYG5DSUE.mjs} +5 -5
- package/dist/lib/node-esm/schema-defs-RYG5DSUE.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-SAOBPND3.mjs → settings-QGWWNMMZ.mjs} +5 -5
- package/dist/lib/node-esm/{settings-SAOBPND3.mjs.map → settings-QGWWNMMZ.mjs.map} +1 -1
- package/dist/lib/node-esm/{spaces-ready-HIUKNDZK.mjs → spaces-ready-TC27M7MP.mjs} +18 -16
- package/dist/lib/node-esm/spaces-ready-TC27M7MP.mjs.map +7 -0
- package/dist/lib/node-esm/{state-ZVEHQ4BJ.mjs → state-TCGOPLRO.mjs} +7 -7
- package/dist/lib/node-esm/state-TCGOPLRO.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/SpacePlugin.d.ts +1 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +5 -4
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/identity-created.d.ts +1 -1
- package/dist/types/src/capabilities/identity-created.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +11 -12
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts +2 -2
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/spaces-ready.d.ts +1 -1
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +3 -3
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +1604 -4
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +5 -3
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.d.ts +3 -2
- package/dist/types/src/components/MembersContainer.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.stories.d.ts +1604 -5
- package/dist/types/src/components/MembersContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts +9 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectForm.d.ts +10 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectForm.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts +3 -0
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts +1440 -0
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts +1 -1
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/ObjectSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/index.d.ts +2 -1
- package/dist/types/src/components/ObjectSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts +2 -2
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/RecordMain.d.ts +7 -0
- package/dist/types/src/components/RecordMain.d.ts.map +1 -0
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +1432 -4
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +1437 -4
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +1438 -5
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor.d.ts +1 -1
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +9 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useActiveSpace.d.ts.map +1 -1
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts +1 -1
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts.map +1 -1
- package/dist/types/src/hooks/usePath.d.ts +1 -1
- package/dist/types/src/hooks/usePath.d.ts.map +1 -1
- package/dist/types/src/hooks/useTypeOptions.d.ts +10 -0
- package/dist/types/src/hooks/useTypeOptions.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1236 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +78 -96
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +10 -7
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +63 -58
- package/src/SpacePlugin.ts +206 -220
- package/src/capabilities/app-graph-builder.ts +127 -69
- package/src/capabilities/app-graph-serializer.ts +7 -7
- package/src/capabilities/capabilities.ts +18 -12
- package/src/capabilities/identity-created.ts +1 -1
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +40 -28
- package/src/capabilities/react-root.tsx +4 -3
- package/src/capabilities/react-surface.tsx +50 -107
- package/src/capabilities/schema-defs.ts +3 -2
- package/src/capabilities/spaces-ready.ts +11 -8
- package/src/capabilities/state.ts +5 -4
- package/src/components/AwaitingObject.tsx +3 -3
- package/src/components/CollectionMain.tsx +2 -2
- package/src/components/CollectionSection.tsx +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +11 -10
- package/src/components/CreateDialog/CreateObjectDialog.tsx +24 -13
- package/src/components/CreateDialog/CreateObjectPanel.tsx +22 -11
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +6 -5
- package/src/components/JoinDialog.tsx +7 -7
- package/src/components/MembersContainer.stories.tsx +36 -10
- package/src/components/MembersContainer.tsx +13 -14
- package/src/components/MenuFooter.tsx +2 -2
- package/src/components/ObjectDetailsPanel/ObjectDetailsPanel.tsx +52 -0
- package/src/components/ObjectDetailsPanel/ObjectForm.tsx +75 -0
- package/src/components/ObjectDetailsPanel/index.ts +7 -0
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +4 -3
- package/src/components/ObjectSettings/BaseObjectSettings.stories.tsx +63 -0
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +96 -26
- package/src/components/ObjectSettings/ForeignKeys.tsx +3 -3
- package/src/components/ObjectSettings/ObjectSettingsContainer.tsx +3 -2
- package/src/components/ObjectSettings/index.ts +3 -1
- package/src/components/PersistenceStatus.tsx +2 -2
- package/src/components/PopoverRenameObject.tsx +9 -15
- package/src/components/PopoverRenameSpace.tsx +4 -4
- package/src/components/RecordMain.tsx +87 -0
- package/src/components/SchemaContainer.tsx +5 -5
- package/src/components/SpacePluginSettings.tsx +8 -9
- package/src/components/SpacePresence.stories.tsx +23 -22
- package/src/components/SpacePresence.tsx +10 -10
- package/src/components/SpaceSettings/SpaceSettingsContainer.stories.tsx +17 -9
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +19 -18
- package/src/components/SyncStatus/InlineSyncStatus.tsx +7 -7
- package/src/components/SyncStatus/SyncStatus.stories.tsx +6 -7
- package/src/components/SyncStatus/SyncStatus.tsx +93 -5
- package/src/components/ViewEditor.tsx +14 -20
- package/src/components/index.ts +2 -1
- package/src/events.ts +7 -7
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useActiveSpace.ts +2 -2
- package/src/hooks/useInputSurfaceLookup.tsx +2 -2
- package/src/hooks/usePath.ts +1 -1
- package/src/hooks/useTypeOptions.ts +59 -0
- package/src/meta.ts +1 -3
- package/src/translations.ts +11 -8
- package/src/types/types.ts +21 -13
- package/src/util.tsx +97 -40
- package/dist/lib/browser/CollectionMain-D2B75XBS.mjs.map +0 -7
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs +0 -88
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7CZZJS3S.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-H6AW7KGS.mjs.map +0 -7
- package/dist/lib/browser/chunk-CEFHNVU7.mjs +0 -20
- package/dist/lib/browser/chunk-CEFHNVU7.mjs.map +0 -7
- package/dist/lib/browser/chunk-FBCGT5YY.mjs +0 -13
- package/dist/lib/browser/chunk-FBCGT5YY.mjs.map +0 -7
- package/dist/lib/browser/chunk-JS3MMC42.mjs +0 -19
- package/dist/lib/browser/chunk-JS3MMC42.mjs.map +0 -7
- package/dist/lib/browser/chunk-QACNNDOT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SGTQ52SU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V7MJSSBQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-VLBRSGJ2.mjs +0 -94
- package/dist/lib/browser/chunk-VLBRSGJ2.mjs.map +0 -7
- package/dist/lib/browser/chunk-XUYKJUU7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TIXVDYN7.mjs.map +0 -7
- package/dist/lib/browser/react-root-N2J7TDRX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TPNLWJJH.mjs.map +0 -7
- package/dist/lib/browser/schema-defs-Z6FC4AHC.mjs.map +0 -7
- package/dist/lib/browser/schema-tools-BNP4JTD7.mjs +0 -124
- package/dist/lib/browser/schema-tools-BNP4JTD7.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-TOPG6IV4.mjs.map +0 -7
- package/dist/lib/browser/state-QYZAB45H.mjs.map +0 -7
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs.map +0 -7
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs +0 -89
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-KGIGWC72.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-2ICUGQQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4AOMYKDE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5HHYE264.mjs +0 -20
- package/dist/lib/node-esm/chunk-5HHYE264.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5T3ZH23B.mjs +0 -21
- package/dist/lib/node-esm/chunk-5T3ZH23B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6X5DLJM5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HWNG4MEU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JH6F4C3I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P442DOQ3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SSLBYZEY.mjs +0 -96
- package/dist/lib/node-esm/chunk-SSLBYZEY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-MHGHRGDT.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-KW3TGJGY.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UUIUUD6P.mjs.map +0 -7
- package/dist/lib/node-esm/schema-defs-WHJM7UZE.mjs.map +0 -7
- package/dist/lib/node-esm/schema-tools-KWW5PTML.mjs +0 -126
- package/dist/lib/node-esm/schema-tools-KWW5PTML.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-HIUKNDZK.mjs.map +0 -7
- package/dist/lib/node-esm/state-ZVEHQ4BJ.mjs.map +0 -7
- package/dist/types/src/capabilities/schema-tool.test.d.ts +0 -2
- package/dist/types/src/capabilities/schema-tool.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/schema-tools.d.ts +0 -13
- package/dist/types/src/capabilities/schema-tools.d.ts.map +0 -1
- package/dist/types/src/components/ObjectDetailsPanel.d.ts +0 -9
- package/dist/types/src/components/ObjectDetailsPanel.d.ts.map +0 -1
- package/src/capabilities/schema-tool.test.ts +0 -44
- package/src/capabilities/schema-tools.ts +0 -125
- package/src/components/ObjectDetailsPanel.tsx +0 -77
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import React, { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { DXN, Obj, Tag, Type } from '@dxos/echo';
|
|
9
|
+
import { type JsonPath, setValue } from '@dxos/echo/internal';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
14
|
+
import { meta as pluginMeta } from '../../meta';
|
|
15
|
+
|
|
16
|
+
const TagSchema = Tag.Tag.pipe(Schema.omit('id'));
|
|
17
|
+
|
|
18
|
+
type ObjectFormProps = { object: Obj.Any; schema: Schema.Schema.AnyNoContext };
|
|
19
|
+
|
|
20
|
+
export const ObjectForm = ({ object, schema }: ObjectFormProps) => {
|
|
21
|
+
const space = getSpace(object);
|
|
22
|
+
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
23
|
+
|
|
24
|
+
const formSchema = useMemo(
|
|
25
|
+
() => Schema.Struct({ tag: Type.Ref(Tag.Tag).pipe(Schema.optional) }).pipe(Schema.extend(schema)),
|
|
26
|
+
[schema],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const meta = Obj.getMeta(object);
|
|
30
|
+
const tag = meta.tags?.[0] ? space?.db.ref(DXN.parse(meta.tags?.[0])) : undefined;
|
|
31
|
+
const values = useMemo(() => ({ tag, ...object }), [object, tag]);
|
|
32
|
+
|
|
33
|
+
const handleCreateTag = useCallback((values: Schema.Schema.Type<typeof TagSchema>) => {
|
|
34
|
+
invariant(space);
|
|
35
|
+
const tag = space.db.add(Tag.make(values));
|
|
36
|
+
const meta = Obj.getMeta(object);
|
|
37
|
+
meta.tags = [Obj.getDXN(tag).toString()];
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
const handleSave = useCallback(
|
|
41
|
+
(values: any, { changed }: { changed: Record<JsonPath, boolean> }) => {
|
|
42
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as JsonPath]) as JsonPath[];
|
|
43
|
+
for (const path of changedPaths) {
|
|
44
|
+
if (path === 'tag') {
|
|
45
|
+
const tag = values[path];
|
|
46
|
+
const meta = Obj.getMeta(object);
|
|
47
|
+
const currentTag = meta.tags?.[0];
|
|
48
|
+
if (currentTag !== tag?.dxn.toString()) {
|
|
49
|
+
meta.tags = tag ? [tag.dxn.toString()] : [];
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const value = values[path];
|
|
55
|
+
setValue(object, path, value);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[object],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Form
|
|
63
|
+
autoSave
|
|
64
|
+
schema={formSchema}
|
|
65
|
+
values={values}
|
|
66
|
+
createSchema={TagSchema}
|
|
67
|
+
createOptionIcon='ph--plus--regular'
|
|
68
|
+
createOptionLabel={['add tag label', { ns: pluginMeta.id }]}
|
|
69
|
+
createInitialValuePath='label'
|
|
70
|
+
onCreate={handleCreateTag}
|
|
71
|
+
onSave={handleSave}
|
|
72
|
+
onQueryRefOptions={handleRefQueryLookup}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { ForeignKey } from '@dxos/echo
|
|
8
|
+
import { ForeignKey } from '@dxos/echo/internal';
|
|
9
9
|
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
|
|
12
14
|
import { ForeignKeys } from './ForeignKeys';
|
|
13
|
-
import { SPACE_PLUGIN } from '../../meta';
|
|
14
15
|
|
|
15
16
|
const initialValues = {
|
|
16
17
|
source: '',
|
|
@@ -22,7 +23,7 @@ export type AdvancedObjectSettingsProps = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export const AdvancedObjectSettings = ({ object }: AdvancedObjectSettingsProps) => {
|
|
25
|
-
const { t } = useTranslation(
|
|
26
|
+
const { t } = useTranslation(meta.id);
|
|
26
27
|
const [adding, setAdding] = useState(false);
|
|
27
28
|
const { keys } = Obj.getMeta(object);
|
|
28
29
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Obj, Tag } from '@dxos/echo';
|
|
9
|
+
import { Expando } from '@dxos/react-client/echo';
|
|
10
|
+
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { render } from '@dxos/storybook-utils';
|
|
13
|
+
|
|
14
|
+
import { translations } from '../../translations';
|
|
15
|
+
|
|
16
|
+
import { BaseObjectSettings } from './BaseObjectSettings';
|
|
17
|
+
|
|
18
|
+
const DefaultStory = () => {
|
|
19
|
+
const { space } = useClientProvider();
|
|
20
|
+
const [object, setObject] = useState<Obj.Any>();
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (space && !object) {
|
|
24
|
+
const object = space.db.add(Obj.make(Expando, {}));
|
|
25
|
+
setObject(object as Obj.Any);
|
|
26
|
+
}
|
|
27
|
+
}, [space, object]);
|
|
28
|
+
|
|
29
|
+
if (!object) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <BaseObjectSettings object={object} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const meta = {
|
|
37
|
+
title: 'plugins/plugin-space/BaseObjectSettings',
|
|
38
|
+
component: BaseObjectSettings as any,
|
|
39
|
+
render: render(DefaultStory),
|
|
40
|
+
decorators: [
|
|
41
|
+
withTheme,
|
|
42
|
+
withClientProvider({
|
|
43
|
+
createIdentity: true,
|
|
44
|
+
createSpace: true,
|
|
45
|
+
types: [Tag.Tag],
|
|
46
|
+
onCreateSpace: async ({ space }) => {
|
|
47
|
+
space.db.add(Tag.make({ label: 'Tag 1' }));
|
|
48
|
+
space.db.add(Tag.make({ label: 'Tag 2' }));
|
|
49
|
+
space.db.add(Tag.make({ label: 'Tag 3' }));
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
parameters: {
|
|
54
|
+
layout: 'fullscreen',
|
|
55
|
+
translations,
|
|
56
|
+
},
|
|
57
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<typeof meta>;
|
|
62
|
+
|
|
63
|
+
export const Default: Story = {};
|
|
@@ -2,12 +2,35 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
import React, { type PropsWithChildren, useCallback, useMemo } from 'react';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
10
|
+
import { DXN, Obj, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { DescriptionAnnotation } from '@dxos/echo/internal';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
14
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
15
|
+
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
9
16
|
|
|
10
|
-
import { meta } from '../../meta';
|
|
17
|
+
import { meta as pluginMeta } from '../../meta';
|
|
18
|
+
|
|
19
|
+
const BaseSchema = Schema.Struct({
|
|
20
|
+
label: Schema.String.pipe(Schema.optional),
|
|
21
|
+
// TODO(wittjosiah): Support multiple tags.
|
|
22
|
+
tag: Type.Ref(Tag.Tag).pipe(Schema.optional),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// TODO(wittjosiah): Use extend but need to be able to control order of fields.
|
|
26
|
+
const BaseSchemaWithDescription = Schema.Struct({
|
|
27
|
+
label: Schema.String.pipe(Schema.optional),
|
|
28
|
+
description: Schema.String.pipe(Schema.optional),
|
|
29
|
+
tag: Type.Ref(Tag.Tag).pipe(Schema.optional),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// TODO(wittjosiah): Better way to support validation of object schemas?
|
|
33
|
+
const TagSchema = Tag.Tag.pipe(Schema.omit('id'));
|
|
11
34
|
|
|
12
35
|
export type BaseObjectSettingsProps = ThemedClassName<
|
|
13
36
|
PropsWithChildren<{
|
|
@@ -15,32 +38,79 @@ export type BaseObjectSettingsProps = ThemedClassName<
|
|
|
15
38
|
}>
|
|
16
39
|
>;
|
|
17
40
|
|
|
41
|
+
// TODO(wittjosiah): Reconcile w/ ObjectDetailsPanel.
|
|
18
42
|
export const BaseObjectSettings = ({ classNames, children, object }: BaseObjectSettingsProps) => {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
43
|
+
const space = getSpace(object);
|
|
44
|
+
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
45
|
+
|
|
46
|
+
const formSchema = useMemo(() => {
|
|
47
|
+
const description = Function.pipe(
|
|
48
|
+
Obj.getSchema(object),
|
|
49
|
+
Option.fromNullable,
|
|
50
|
+
Option.flatMap((schema) => DescriptionAnnotation.get(schema)),
|
|
51
|
+
Option.getOrUndefined,
|
|
52
|
+
);
|
|
53
|
+
if (description) {
|
|
54
|
+
return BaseSchemaWithDescription;
|
|
55
|
+
} else {
|
|
56
|
+
return BaseSchema;
|
|
57
|
+
}
|
|
58
|
+
}, [object]);
|
|
59
|
+
|
|
60
|
+
const meta = Obj.getMeta(object);
|
|
61
|
+
const tag = meta.tags?.[0] ? space?.db.ref(DXN.parse(meta.tags?.[0])) : undefined;
|
|
62
|
+
const values = useMemo(
|
|
63
|
+
() => ({
|
|
64
|
+
label: Obj.getLabel(object),
|
|
65
|
+
description: Obj.getDescription(object),
|
|
66
|
+
tag,
|
|
67
|
+
}),
|
|
68
|
+
[object, tag],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const handleCreateTag = useCallback((values: Schema.Schema.Type<typeof TagSchema>) => {
|
|
72
|
+
invariant(space);
|
|
73
|
+
const tag = space.db.add(Tag.make(values));
|
|
74
|
+
const meta = Obj.getMeta(object);
|
|
75
|
+
meta.tags = [Obj.getDXN(tag).toString()];
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
const handleSave = useCallback(
|
|
79
|
+
(values: Schema.Schema.Type<typeof BaseSchemaWithDescription>) => {
|
|
80
|
+
if (values.label !== undefined && Obj.getLabel(object) !== values.label) {
|
|
81
|
+
Obj.setLabel(object, values.label);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (values.description !== undefined && Obj.getDescription(object) !== values.description) {
|
|
85
|
+
Obj.setDescription(object, values.description);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const meta = Obj.getMeta(object);
|
|
89
|
+
const currentTag = meta.tags?.[0];
|
|
90
|
+
if (values.tag !== undefined && currentTag !== values.tag?.dxn.toString()) {
|
|
91
|
+
meta.tags = [values.tag.dxn.toString()];
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[object],
|
|
95
|
+
);
|
|
21
96
|
|
|
22
|
-
// TODO(wittjosiah):
|
|
23
|
-
//
|
|
24
|
-
// Perhaps also including the field of the title annotation as well.
|
|
97
|
+
// TODO(wittjosiah): The schema for this form should be based on the schema of the object.
|
|
98
|
+
// Perhaps with fields filtered down to only those with a specific settings annotation.
|
|
25
99
|
return (
|
|
26
100
|
<>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
</Input.Root>
|
|
101
|
+
<Form
|
|
102
|
+
outerSpacing={false}
|
|
103
|
+
autoSave
|
|
104
|
+
schema={formSchema}
|
|
105
|
+
values={values}
|
|
106
|
+
createSchema={TagSchema}
|
|
107
|
+
createOptionIcon='ph--plus--regular'
|
|
108
|
+
createOptionLabel={['add tag label', { ns: pluginMeta.id }]}
|
|
109
|
+
createInitialValuePath='label'
|
|
110
|
+
onCreate={handleCreateTag}
|
|
111
|
+
onSave={handleSave}
|
|
112
|
+
onQueryRefOptions={handleRefQueryLookup}
|
|
113
|
+
/>
|
|
44
114
|
{children}
|
|
45
115
|
</>
|
|
46
116
|
);
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type ForeignKey } from '@dxos/echo
|
|
7
|
+
import { type ForeignKey } from '@dxos/echo/internal';
|
|
8
8
|
import { IconButton, List, ListItem, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
|
|
12
12
|
export type ForeignKeysProps = {
|
|
13
13
|
keys: ForeignKey[];
|
|
@@ -31,7 +31,7 @@ type KeyItemProps = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const KeyItem = ({ forignKey, onDelete }: KeyItemProps) => {
|
|
34
|
-
const { t } = useTranslation(
|
|
34
|
+
const { t } = useTranslation(meta.id);
|
|
35
35
|
|
|
36
36
|
const handleDelete = useCallback(() => {
|
|
37
37
|
onDelete?.(forignKey);
|
|
@@ -6,7 +6,7 @@ import React, { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework';
|
|
8
8
|
import { type Obj } from '@dxos/echo';
|
|
9
|
-
import { Clipboard } from '@dxos/react-ui';
|
|
9
|
+
import { Clipboard, Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
11
|
|
|
12
12
|
import { BaseObjectSettings } from './BaseObjectSettings';
|
|
@@ -21,7 +21,8 @@ export const ObjectSettingsContainer = ({ object, role }: ObjectSettingsContaine
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<Clipboard.Provider>
|
|
24
|
-
<StackItem.Content toolbar
|
|
24
|
+
<StackItem.Content toolbar>
|
|
25
|
+
<Toolbar.Root></Toolbar.Root>
|
|
25
26
|
<div role='none' className='overflow-y-auto pli-cardSpacingInline plb-cardSpacingBlock'>
|
|
26
27
|
<BaseObjectSettings object={object}>
|
|
27
28
|
<Surface role='base-object-settings' data={data} />
|
|
@@ -9,7 +9,7 @@ import { type EchoDatabase } from '@dxos/react-client/echo';
|
|
|
9
9
|
import { Icon, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { mx, staticPlaceholderText, warningText } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../meta';
|
|
13
13
|
|
|
14
14
|
enum Status {
|
|
15
15
|
PERSISTED_LOCALLY = 0,
|
|
@@ -19,7 +19,7 @@ enum Status {
|
|
|
19
19
|
|
|
20
20
|
// TODO(zan): This now has no usages. Remove it?
|
|
21
21
|
export const PersistenceStatus = ({ db }: { db: EchoDatabase }) => {
|
|
22
|
-
const { t } = useTranslation(
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
23
|
const [displayMessage, setDisplayMessage] = useState(false);
|
|
24
24
|
const [status, naturalSetStatus] = useState<Status>(Status.PERSISTED_LOCALLY);
|
|
25
25
|
const [prevStatus, setPrevStatus] = useState<Status>(Status.PERSISTED_LOCALLY);
|
|
@@ -4,33 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { type Live } from '@dxos/live-object';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { Button, Input, useTranslation } from '@dxos/react-ui';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
13
14
|
|
|
14
|
-
export const POPOVER_RENAME_OBJECT = `${
|
|
15
|
+
export const POPOVER_RENAME_OBJECT = `${meta.id}/PopoverRenameObject`;
|
|
15
16
|
|
|
16
|
-
export const PopoverRenameObject = ({ object
|
|
17
|
-
const { t } = useTranslation(
|
|
17
|
+
export const PopoverRenameObject = ({ object }: { object: Live<any> }) => {
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
18
19
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
19
|
-
|
|
20
|
-
const object = obj as any;
|
|
21
|
-
// TODO(burdon): Field should not be hardcoded field.
|
|
22
|
-
const [name, setName] = useState(object.name || object.title || '');
|
|
20
|
+
const [name, setName] = useState(Obj.getLabel(object));
|
|
23
21
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
24
22
|
|
|
25
23
|
const handleDone = useCallback(() => {
|
|
26
24
|
try {
|
|
27
|
-
|
|
25
|
+
name && Obj.setLabel(object, name);
|
|
28
26
|
} catch (err) {
|
|
29
|
-
|
|
30
|
-
object.title = name;
|
|
31
|
-
} catch {
|
|
32
|
-
log.error('Failed to rename object', { err });
|
|
33
|
-
}
|
|
27
|
+
log.error('Failed to rename object', { err });
|
|
34
28
|
}
|
|
35
29
|
void dispatch(
|
|
36
30
|
createIntent(LayoutAction.UpdatePopover, {
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
9
|
import { Button, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../meta';
|
|
12
12
|
|
|
13
|
-
export const POPOVER_RENAME_SPACE = `${
|
|
13
|
+
export const POPOVER_RENAME_SPACE = `${meta.id}/PopoverRenameSpace`;
|
|
14
14
|
|
|
15
15
|
export const PopoverRenameSpace = ({ space }: { space: Space }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
17
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
18
18
|
const [name, setName] = useState(space.properties.name ?? '');
|
|
19
19
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { Filter, Obj, Ref, Relation } from '@dxos/echo';
|
|
9
|
+
import { type JsonPath, setValue } from '@dxos/echo/internal';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { getSpace, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
14
|
+
import { Masonry } from '@dxos/react-ui-masonry';
|
|
15
|
+
import { isNonNullable } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
import { meta } from '../meta';
|
|
18
|
+
|
|
19
|
+
const getReferencesFromObject = (obj: Obj.Any): Ref.Any[] => {
|
|
20
|
+
return Object.getOwnPropertyNames(obj)
|
|
21
|
+
.map((name) => obj[name as keyof Obj.Any])
|
|
22
|
+
.filter((value) => Ref.isRef(value)) as Ref.Any[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Card = ({ data: subject }: { data: Obj.Any }) => {
|
|
26
|
+
const data = useMemo(() => ({ subject }), [subject]);
|
|
27
|
+
return <Surface role='card' data={data} limit={1} />;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const RecordMain = ({ record }: { record: Obj.Any }) => {
|
|
31
|
+
const { t } = useTranslation(meta.id);
|
|
32
|
+
const space = getSpace(record);
|
|
33
|
+
const schema = Obj.getSchema(record);
|
|
34
|
+
|
|
35
|
+
// TODO(wittjosiah): This is a hack. ECHO needs to have a back reference index to easily query for related objects.
|
|
36
|
+
const objects = useQuery(space, Filter.everything());
|
|
37
|
+
const related = useMemo(() => {
|
|
38
|
+
const relations = objects.filter((obj) => Relation.isRelation(obj));
|
|
39
|
+
const targetObjects = relations
|
|
40
|
+
.filter((relation) => Relation.getSource(relation) === record)
|
|
41
|
+
.map((relation) => Relation.getTarget(relation));
|
|
42
|
+
const sourceObjects = relations
|
|
43
|
+
.filter((relation) => Relation.getTarget(relation) === record)
|
|
44
|
+
.map((relation) => Relation.getSource(relation));
|
|
45
|
+
|
|
46
|
+
const references = getReferencesFromObject(record);
|
|
47
|
+
const referencedObjects = references.map((ref) => ref.target).filter(isNonNullable);
|
|
48
|
+
const referencingObjects = objects.filter((obj) => {
|
|
49
|
+
const refs = getReferencesFromObject(obj);
|
|
50
|
+
return refs.some((ref) => ref.target === record);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return [...referencedObjects, ...referencingObjects, ...targetObjects, ...sourceObjects];
|
|
54
|
+
}, [record, objects]);
|
|
55
|
+
|
|
56
|
+
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
57
|
+
|
|
58
|
+
const handleSave = useCallback(
|
|
59
|
+
(values: any, { changed }: { changed: Record<JsonPath, boolean> }) => {
|
|
60
|
+
const id = values.id;
|
|
61
|
+
invariant(typeof id === 'string');
|
|
62
|
+
|
|
63
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as JsonPath]) as JsonPath[];
|
|
64
|
+
for (const path of changedPaths) {
|
|
65
|
+
const value = values[path];
|
|
66
|
+
setValue(record, path, value);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[record],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (!schema) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div role='none' className='container-max-width flex flex-col p-2 gap-1 overflow-y-auto'>
|
|
78
|
+
<div key={record.id} className='border border-separator rounded'>
|
|
79
|
+
<Form autoSave schema={schema} values={record} onSave={handleSave} onQueryRefOptions={handleRefQueryLookup} />
|
|
80
|
+
</div>
|
|
81
|
+
<h2>{t('related objects label')}</h2>
|
|
82
|
+
<Masonry.Root<Obj.Any> items={related} render={Card} intrinsicHeight />
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default RecordMain;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Type } from '@dxos/echo';
|
|
8
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
10
|
+
import { ControlPage, ControlSection, controlItemClasses } from '@dxos/react-ui-form';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
|
|
15
15
|
type SchemaPanelProps = { space: Space };
|
|
16
16
|
|
|
@@ -37,11 +37,11 @@ export const useQuerySpaceSchemas = (space: Space): Type.Schema[] => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SchemaContainer = ({ space }: SchemaPanelProps) => {
|
|
40
|
-
const { t } = useTranslation(
|
|
40
|
+
const { t } = useTranslation(meta.id);
|
|
41
41
|
const schemas = useQuerySpaceSchemas(space);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<StackItem.Content
|
|
44
|
+
<StackItem.Content scrollable>
|
|
45
45
|
<ControlPage>
|
|
46
46
|
<ControlSection title={t('schema verbose label')} description={t('schema description')}>
|
|
47
47
|
<div role='none' className={controlItemClasses}>
|
|
@@ -7,31 +7,30 @@ import React from 'react';
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
9
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { IconButton, Input, List, ListItem, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection, controlItemClasses } from '@dxos/react-ui-form';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
import { SpaceAction, type SpaceSettingsProps } from '../types';
|
|
15
15
|
import { getSpaceDisplayName } from '../util';
|
|
16
16
|
|
|
17
17
|
export const SpacePluginSettings = ({ settings }: { settings: SpaceSettingsProps }) => {
|
|
18
|
-
const { t } = useTranslation(
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
19
|
const client = useClient();
|
|
20
20
|
const spaces = useSpaces({ all: settings.showHidden });
|
|
21
21
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
22
|
|
|
23
|
-
// TODO(wittjosiah): Migrate to new form container.
|
|
24
23
|
return (
|
|
25
24
|
<ControlPage>
|
|
26
25
|
<ControlSection title={t('space settings label')} description={t('space settings description')}>
|
|
27
|
-
<
|
|
28
|
-
<
|
|
26
|
+
<ControlGroup>
|
|
27
|
+
<ControlItemInput title={t('show hidden spaces label')}>
|
|
29
28
|
<Input.Switch
|
|
30
29
|
checked={settings.showHidden}
|
|
31
30
|
onCheckedChange={(checked) => (settings.showHidden = !!checked)}
|
|
32
31
|
/>
|
|
33
|
-
</
|
|
34
|
-
</
|
|
32
|
+
</ControlItemInput>
|
|
33
|
+
</ControlGroup>
|
|
35
34
|
<List classNames={[controlItemClasses, 'flex flex-col gap-trimSm']}>
|
|
36
35
|
{spaces.map((space) => (
|
|
37
36
|
<ListItem.Root key={space.id} classNames='is-full items-center'>
|