@dxos/plugin-markdown 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca
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/MarkdownCard-HFNNE4B4.mjs +12 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +12 -0
- package/dist/lib/browser/{anchor-sort-3HGPGCOO.mjs → anchor-sort-WQ3TL7ZI.mjs} +11 -10
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +58 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs +702 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +7 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +8 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-Y53FQREH.mjs → chunk-FWQQW6KU.mjs} +41 -47
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-22XSSNBS.mjs → chunk-JOXYQLKH.mjs} +5 -6
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +7 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +104 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +7 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +167 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +7 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs +101 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +7 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs +60 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +32 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +121 -143
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +53 -0
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs +213 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +7 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs +35 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +7 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs +29 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/{MarkdownCard-ZXPJLUYO.mjs → MarkdownCard-GMNXUWWR.mjs} +5 -5
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/{anchor-sort-PCDXEBJ2.mjs → anchor-sort-G7D5TAI6.mjs} +11 -10
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +59 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +105 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AMHACOXW.mjs → chunk-44VJC3QF.mjs} +5 -6
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +703 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HAIEWPU7.mjs → chunk-EYAFC4N7.mjs} +41 -47
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs +61 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +168 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PLZ7EVCT.mjs → chunk-SDTYEGGL.mjs} +56 -6
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +10 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +33 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +121 -143
- 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-2HIS2AQZ.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs +214 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +7 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +36 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +7 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +30 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -3
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +5 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/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/artifact-definition/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -13
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -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 +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -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 +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +5 -0
- package/dist/types/src/capabilities/state/state.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 +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +4 -3
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +5 -5
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +19 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +1 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +8 -7
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +12 -8
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +4 -4
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +3 -3
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +2 -2
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/hooks/useSelectCurrentThread.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/testing.d.ts +2 -2
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +15 -15
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -31
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +3 -0
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/src/util.test.d.ts +2 -0
- package/dist/types/src/util.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +82 -67
- package/src/MarkdownPlugin.tsx +60 -89
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/create.test.ts +22 -25
- package/src/{functions → blueprints/functions}/create.ts +1 -1
- package/src/blueprints/functions/index.ts +7 -0
- package/src/{functions → blueprints/functions}/open.ts +4 -3
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/update.test.ts +25 -27
- package/src/{functions → blueprints/functions}/update.ts +4 -3
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +36 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +59 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +110 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +25 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +6 -11
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +100 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +36 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +31 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +29 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +25 -43
- package/src/components/MarkdownCard/MarkdownCard.tsx +17 -44
- package/src/components/MarkdownContainer.stories.tsx +47 -60
- package/src/components/MarkdownContainer.tsx +86 -88
- package/src/components/MarkdownEditor/FileUpload.tsx +3 -3
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +16 -17
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +14 -15
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +44 -18
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +7 -4
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +23 -33
- package/src/components/index.ts +8 -3
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +25 -30
- package/src/hooks/useLinkQuery.ts +19 -19
- package/src/hooks/useSelectCurrentThread.tsx +37 -42
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +5 -5
- package/src/translations.ts +1 -0
- package/src/types/Markdown.ts +6 -7
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +13 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +75 -5
- package/dist/lib/browser/MarkdownCard-JYMDPKV5.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-Y75XSVBX.mjs +0 -15
- package/dist/lib/browser/anchor-sort-3HGPGCOO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-POZN234F.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-POZN234F.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-GIPKFDY5.mjs +0 -13
- package/dist/lib/browser/chunk-22XSSNBS.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MLGSYRN.mjs +0 -20
- package/dist/lib/browser/chunk-2MLGSYRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQTYJOFB.mjs +0 -28
- package/dist/lib/browser/chunk-BQTYJOFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-GH6GQSBL.mjs +0 -51
- package/dist/lib/browser/chunk-GH6GQSBL.mjs.map +0 -7
- package/dist/lib/browser/chunk-IBCHVMZW.mjs +0 -16
- package/dist/lib/browser/chunk-IBCHVMZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-K3LXOU3E.mjs +0 -827
- package/dist/lib/browser/chunk-K3LXOU3E.mjs.map +0 -7
- package/dist/lib/browser/chunk-PBJLFIOX.mjs +0 -96
- package/dist/lib/browser/chunk-PBJLFIOX.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYSEJ5GP.mjs +0 -79
- package/dist/lib/browser/chunk-QYSEJ5GP.mjs.map +0 -7
- package/dist/lib/browser/chunk-Y53FQREH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-Z5L7TXUK.mjs +0 -62
- package/dist/lib/browser/intent-resolver-Z5L7TXUK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GO5ZOKNN.mjs +0 -211
- package/dist/lib/browser/react-surface-GO5ZOKNN.mjs.map +0 -7
- package/dist/lib/browser/settings-TZUDB5EW.mjs +0 -28
- package/dist/lib/browser/settings-TZUDB5EW.mjs.map +0 -7
- package/dist/lib/browser/state-BTUKVZHY.mjs +0 -37
- package/dist/lib/browser/state-BTUKVZHY.mjs.map +0 -7
- package/dist/lib/browser/toolkit.mjs +0 -13
- package/dist/lib/node-esm/MarkdownContainer-YRDSRDCS.mjs +0 -16
- package/dist/lib/node-esm/anchor-sort-PCDXEBJ2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-NF65JYAS.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-NF65JYAS.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-ENKJZYQS.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-ENKJZYQS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AMHACOXW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CT7CFX5G.mjs +0 -828
- package/dist/lib/node-esm/chunk-CT7CFX5G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs +0 -17
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HAIEWPU7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KCHUTL3Q.mjs +0 -22
- package/dist/lib/node-esm/chunk-KCHUTL3Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NGYJNQ6A.mjs +0 -80
- package/dist/lib/node-esm/chunk-NGYJNQ6A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PIOOG7A5.mjs +0 -97
- package/dist/lib/node-esm/chunk-PIOOG7A5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PLZ7EVCT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs +0 -29
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-6B3PFQ5F.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-6B3PFQ5F.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-I46BPCWT.mjs +0 -212
- package/dist/lib/node-esm/react-surface-I46BPCWT.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CJ3T5EX4.mjs +0 -29
- package/dist/lib/node-esm/settings-CJ3T5EX4.mjs.map +0 -7
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs +0 -38
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit.mjs +0 -14
- package/dist/lib/node-esm/toolkit.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -4
- package/dist/types/src/capabilities/anchor-sort.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/artifact-definition.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.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/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/update.d.ts.map +0 -1
- package/dist/types/src/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/toolkit.d.ts +0 -3
- package/dist/types/src/toolkit.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -43
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -93
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/events.ts +0 -11
- package/src/functions/create.conversations.json +0 -1
- package/src/functions/index.ts +0 -13
- package/src/functions/update.conversations.json +0 -1
- package/src/toolkit.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-JYMDPKV5.mjs.map → MarkdownCard-HFNNE4B4.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-Y75XSVBX.mjs.map → MarkdownContainer-V7EAADMF.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-GIPKFDY5.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/MarkdownCard-GMNXUWWR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-ZXPJLUYO.mjs.map → MarkdownContainer-LUSMORP2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-YRDSRDCS.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.test.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/open.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.test.d.ts +0 -0
|
@@ -3,38 +3,34 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import * as Function from 'effect/Function';
|
|
7
8
|
import * as Match from 'effect/Match';
|
|
8
9
|
import * as Option from 'effect/Option';
|
|
9
10
|
import * as Schema from 'effect/Schema';
|
|
10
11
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
-
import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
13
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
14
14
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
15
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
|
+
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
16
17
|
import { invariant } from '@dxos/invariant';
|
|
17
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
18
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
19
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
20
|
-
import {
|
|
21
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
22
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
23
21
|
import { faker } from '@dxos/random';
|
|
24
|
-
import {
|
|
22
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
25
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
26
24
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
25
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
26
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
30
27
|
import { render } from '@dxos/storybook-utils';
|
|
31
28
|
import { Message } from '@dxos/types';
|
|
29
|
+
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
32
30
|
|
|
33
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
34
31
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
35
|
-
import { meta } from '../meta';
|
|
36
32
|
import { translations } from '../translations';
|
|
37
|
-
import { Markdown } from '../types';
|
|
33
|
+
import { Markdown, MarkdownCapabilities } from '../types';
|
|
38
34
|
|
|
39
35
|
import { MarkdownContainer } from './MarkdownContainer';
|
|
40
36
|
|
|
@@ -50,16 +46,15 @@ const TestItem = Schema.Struct({
|
|
|
50
46
|
description: 'Product description',
|
|
51
47
|
}),
|
|
52
48
|
}).pipe(
|
|
53
|
-
Type.
|
|
49
|
+
Type.object({
|
|
54
50
|
typename: 'dxos.org/type/Test',
|
|
55
51
|
version: '0.1.0',
|
|
56
52
|
}),
|
|
57
53
|
);
|
|
58
54
|
|
|
59
55
|
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
60
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
61
56
|
const { parentRef } = useTextEditor({ initialValue: content });
|
|
62
|
-
const
|
|
57
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
63
58
|
|
|
64
59
|
const space = useSpace();
|
|
65
60
|
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
@@ -95,7 +90,7 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
95
90
|
|
|
96
91
|
// void dispatch(
|
|
97
92
|
// createIntent(CollaborationActions.InsertContent, {
|
|
98
|
-
// target: doc as any as
|
|
93
|
+
// target: doc as any as TestSchema.Expando,
|
|
99
94
|
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
100
95
|
// at: cursor,
|
|
101
96
|
// label: 'Proposal',
|
|
@@ -104,20 +99,20 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
104
99
|
};
|
|
105
100
|
|
|
106
101
|
return (
|
|
107
|
-
<
|
|
102
|
+
<Layout.Main toolbar>
|
|
108
103
|
<Toolbar.Root>
|
|
109
104
|
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
110
105
|
</Toolbar.Root>
|
|
111
106
|
<div ref={parentRef} className='p-4' />
|
|
112
|
-
</
|
|
107
|
+
</Layout.Main>
|
|
113
108
|
);
|
|
114
109
|
};
|
|
115
110
|
|
|
116
111
|
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
117
112
|
const space = useSpace();
|
|
118
113
|
const [doc, setDoc] = useState<Markdown.Document>();
|
|
119
|
-
const settings =
|
|
120
|
-
const
|
|
114
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
121
116
|
|
|
122
117
|
useEffect(() => {
|
|
123
118
|
if (!space) {
|
|
@@ -147,10 +142,9 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
147
142
|
return null;
|
|
148
143
|
}
|
|
149
144
|
|
|
150
|
-
// TODO(burdon): Layout issue.
|
|
151
145
|
return (
|
|
152
146
|
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
153
|
-
<MarkdownContainer id={doc.id}
|
|
147
|
+
<MarkdownContainer id={doc.id} subject={doc} settings={settings} editorStateStore={editorState} />
|
|
154
148
|
<TestChat doc={doc} content={chat} />
|
|
155
149
|
</div>
|
|
156
150
|
);
|
|
@@ -163,22 +157,18 @@ const storybook: Meta<typeof DefaultStory> = {
|
|
|
163
157
|
withTheme,
|
|
164
158
|
withPluginManager({
|
|
165
159
|
plugins: [
|
|
160
|
+
...corePlugins(),
|
|
161
|
+
StorybookPlugin({}),
|
|
166
162
|
ClientPlugin({
|
|
167
163
|
types: [Markdown.Document, TestItem],
|
|
168
|
-
onClientInitialized:
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
onClientInitialized: ({ client }) =>
|
|
165
|
+
Effect.gen(function* () {
|
|
166
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
+
}),
|
|
171
168
|
}),
|
|
172
|
-
SpacePlugin({}),
|
|
173
|
-
GraphPlugin(),
|
|
174
|
-
IntentPlugin(),
|
|
175
|
-
SettingsPlugin(),
|
|
176
169
|
|
|
177
|
-
// UI
|
|
178
|
-
ThemePlugin({ tx: defaultTx }),
|
|
179
170
|
MarkdownPlugin(),
|
|
180
171
|
PreviewPlugin(),
|
|
181
|
-
StorybookLayoutPlugin({}),
|
|
182
172
|
],
|
|
183
173
|
}),
|
|
184
174
|
],
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type LazyExoticComponent, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type MarkdownCard as MarkdownCardType } from './MarkdownCard';
|
|
8
|
+
import { type MarkdownContainer as MarkdownContainerType } from './MarkdownContainer';
|
|
6
9
|
|
|
7
10
|
export * from './MarkdownCard';
|
|
8
11
|
export * from './MarkdownContainer';
|
|
9
12
|
export * from './MarkdownSettings';
|
|
10
13
|
|
|
11
|
-
export const MarkdownCard = lazy(() => import('./MarkdownCard'));
|
|
12
|
-
export const MarkdownContainer = lazy(
|
|
14
|
+
export const MarkdownCard: LazyExoticComponent<typeof MarkdownCardType> = lazy(() => import('./MarkdownCard'));
|
|
15
|
+
export const MarkdownContainer: LazyExoticComponent<typeof MarkdownContainerType> = lazy(
|
|
16
|
+
() => import('./MarkdownContainer'),
|
|
17
|
+
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import { useCallback, useMemo, useRef } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import {
|
|
10
10
|
type EditorMenuGroup,
|
|
11
11
|
type UseEditorMenuProps,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
formattingCommands,
|
|
14
14
|
linkSlashCommands,
|
|
15
15
|
} from '@dxos/react-ui-editor';
|
|
16
|
+
import { Domino } from '@dxos/ui';
|
|
16
17
|
|
|
17
18
|
import { meta } from '../meta';
|
|
18
19
|
|
|
@@ -52,18 +53,14 @@ export const useEditorMenuOptions = ({
|
|
|
52
53
|
const trigger = onLinkQuery ? ['/', '@'] : ['/'];
|
|
53
54
|
const placeholder = {
|
|
54
55
|
delay: 3_000,
|
|
55
|
-
content: () =>
|
|
56
|
-
Domino.of('
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
Domino.of('span').text('for commands.'),
|
|
65
|
-
)
|
|
66
|
-
.build(),
|
|
56
|
+
content: () => {
|
|
57
|
+
const pressEl = Domino.of('span').text('Press');
|
|
58
|
+
const triggerEls = trigger.map((text) =>
|
|
59
|
+
Domino.of('span').classNames('mx-1 pli-1.5 pt-[1px] pb-[2px] border border-separator rounded-sm').text(text),
|
|
60
|
+
);
|
|
61
|
+
const forCommandsEl = Domino.of('span').text('for commands.');
|
|
62
|
+
return Domino.of('div').children(pressEl, ...triggerEls, forCommandsEl).root;
|
|
63
|
+
},
|
|
67
64
|
};
|
|
68
65
|
|
|
69
66
|
return { viewRef, getMenu, trigger, placeholder };
|
|
@@ -6,16 +6,17 @@ import { type ViewUpdate } from '@codemirror/view';
|
|
|
6
6
|
import React, { type AnchorHTMLAttributes, type ReactNode, useMemo } from 'react';
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
11
11
|
import { debounceAndThrottle } from '@dxos/async';
|
|
12
12
|
import { Obj } from '@dxos/echo';
|
|
13
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
13
14
|
import { invariant } from '@dxos/invariant';
|
|
14
|
-
import {
|
|
15
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
16
16
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
17
17
|
import { Icon, ThemeProvider } from '@dxos/react-ui';
|
|
18
18
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
19
20
|
import {
|
|
20
21
|
Cursor,
|
|
21
22
|
type EditorStateStore,
|
|
@@ -36,9 +37,8 @@ import {
|
|
|
36
37
|
replacer,
|
|
37
38
|
selectionState,
|
|
38
39
|
typewriter,
|
|
39
|
-
} from '@dxos/
|
|
40
|
-
import { defaultTx } from '@dxos/
|
|
41
|
-
import { Text } from '@dxos/schema';
|
|
40
|
+
} from '@dxos/ui-editor';
|
|
41
|
+
import { defaultTx } from '@dxos/ui-theme';
|
|
42
42
|
import { isTruthy } from '@dxos/util';
|
|
43
43
|
|
|
44
44
|
import { Markdown } from '../types';
|
|
@@ -49,7 +49,7 @@ export type DocumentType = Markdown.Document | Text.Text | { id: string; text: s
|
|
|
49
49
|
export type ExtensionsOptions = {
|
|
50
50
|
id: string;
|
|
51
51
|
object?: DocumentType;
|
|
52
|
-
|
|
52
|
+
invokePromise?: Common.Capability.OperationInvoker['invokePromise'];
|
|
53
53
|
settings?: Markdown.Settings;
|
|
54
54
|
selectionManager?: SelectionManager;
|
|
55
55
|
viewMode?: EditorViewMode;
|
|
@@ -67,16 +67,16 @@ export const useExtensions = ({
|
|
|
67
67
|
editorStateStore,
|
|
68
68
|
previewOptions,
|
|
69
69
|
}: ExtensionsOptions): Extension[] => {
|
|
70
|
-
const {
|
|
70
|
+
const { invokePromise } = useOperationInvoker();
|
|
71
71
|
const identity = useIdentity();
|
|
72
72
|
const space = getSpace(object);
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
// Get the content reference from Document objects.
|
|
75
|
+
const contentRef = Obj.instanceOf(Markdown.Document, object) ? (object as Markdown.Document).content : undefined;
|
|
76
|
+
// Use useObject to trigger re-render when the reference loads (returns snapshot for reactivity).
|
|
77
|
+
useObject(contentRef);
|
|
78
|
+
// Get the actual live object target via .target (needed for createDocAccessor).
|
|
79
|
+
const target = contentRef?.target ?? (Obj.instanceOf(Text.Text, object) ? object : undefined);
|
|
80
80
|
|
|
81
81
|
// TODO(wittjosiah): Autocomplete is not working and this query is causing performance issues.
|
|
82
82
|
// TODO(burdon): Unsubscribe.
|
|
@@ -92,13 +92,13 @@ export const useExtensions = ({
|
|
|
92
92
|
selectionManager,
|
|
93
93
|
viewMode,
|
|
94
94
|
previewOptions,
|
|
95
|
-
|
|
95
|
+
invokePromise,
|
|
96
96
|
}),
|
|
97
97
|
[
|
|
98
98
|
id,
|
|
99
99
|
object,
|
|
100
100
|
viewMode,
|
|
101
|
-
|
|
101
|
+
invokePromise,
|
|
102
102
|
previewOptions,
|
|
103
103
|
settings,
|
|
104
104
|
settings?.debug,
|
|
@@ -119,7 +119,7 @@ export const useExtensions = ({
|
|
|
119
119
|
createDataExtensions({
|
|
120
120
|
id,
|
|
121
121
|
text: createDocAccessor(target, ['content']),
|
|
122
|
-
space,
|
|
122
|
+
messenger: space,
|
|
123
123
|
identity,
|
|
124
124
|
}),
|
|
125
125
|
|
|
@@ -144,7 +144,7 @@ export const useExtensions = ({
|
|
|
144
144
|
const createBaseExtensions = ({
|
|
145
145
|
id,
|
|
146
146
|
object,
|
|
147
|
-
|
|
147
|
+
invokePromise,
|
|
148
148
|
settings,
|
|
149
149
|
selectionManager,
|
|
150
150
|
viewMode,
|
|
@@ -169,17 +169,12 @@ const createBaseExtensions = ({
|
|
|
169
169
|
// TODO(wittjosiah): For internal links, consider ignoring the link text and rendering the label of the object being linked to.
|
|
170
170
|
// TODO(burdon): Create dx-tag.
|
|
171
171
|
renderLinkButton:
|
|
172
|
-
|
|
173
|
-
? createLinkRenderer((
|
|
174
|
-
void
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
options: {
|
|
179
|
-
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
180
|
-
},
|
|
181
|
-
}),
|
|
182
|
-
);
|
|
172
|
+
invokePromise && (object || id)
|
|
173
|
+
? createLinkRenderer((targetId: string) => {
|
|
174
|
+
void invokePromise(Common.LayoutOperation.Open, {
|
|
175
|
+
subject: [targetId],
|
|
176
|
+
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
177
|
+
});
|
|
183
178
|
})
|
|
184
179
|
: undefined,
|
|
185
180
|
}),
|
|
@@ -2,44 +2,44 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
5
6
|
import { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Filter, Obj, Query, Type } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
12
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
+
import { Common } from '@dxos/app-framework';
|
|
9
|
+
import { usePluginManager } from '@dxos/app-framework/react';
|
|
10
|
+
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
|
+
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
13
12
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
14
|
-
import { type EditorMenuGroup, type EditorMenuItem
|
|
13
|
+
import { type EditorMenuGroup, type EditorMenuItem } from '@dxos/react-ui-editor';
|
|
14
|
+
import { insertAtCursor, insertAtLineStart } from '@dxos/ui-editor';
|
|
15
15
|
|
|
16
|
-
export const useLinkQuery = (
|
|
16
|
+
export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
18
|
|
|
19
19
|
const manager = usePluginManager();
|
|
20
20
|
const resolve = useCallback(
|
|
21
21
|
(typename: string) =>
|
|
22
|
-
manager.
|
|
22
|
+
manager.capabilities.getAll(Common.Capability.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
23
23
|
[manager],
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
const objectForms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
27
|
-
const schemaWhiteList = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
28
26
|
const filter = useMemo(
|
|
29
27
|
() =>
|
|
30
28
|
Filter.or(
|
|
31
|
-
...
|
|
32
|
-
|
|
29
|
+
...(db?.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync() ?? [])
|
|
30
|
+
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
31
|
+
.filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))
|
|
32
|
+
.map((schema) => Filter.typename(Type.getTypename(schema))),
|
|
33
33
|
),
|
|
34
|
-
[
|
|
34
|
+
[db],
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const handleLinkQuery = useCallback(
|
|
38
38
|
async (query?: string): Promise<EditorMenuGroup[]> => {
|
|
39
39
|
const name = query?.startsWith('@') ? query.slice(1).toLowerCase() : (query?.toLowerCase() ?? '');
|
|
40
|
-
const results = await
|
|
40
|
+
const results = await db?.query(Query.select(filter)).run();
|
|
41
41
|
|
|
42
|
-
// TODO(wittjosiah): Use `Obj.
|
|
42
|
+
// TODO(wittjosiah): Use `Obj.Unknown` type.
|
|
43
43
|
const getLabel = (object: any) => {
|
|
44
44
|
const label = Obj.getLabel(object);
|
|
45
45
|
if (label) {
|
|
@@ -53,8 +53,8 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const items =
|
|
56
|
-
results
|
|
57
|
-
|
|
56
|
+
results
|
|
57
|
+
?.filter((object) => toLocalizedString(getLabel(object), t).toLowerCase().includes(name))
|
|
58
58
|
// TODO(wittjosiah): Remove `any` type.
|
|
59
59
|
.map((object: any): EditorMenuItem => {
|
|
60
60
|
const metadata = resolve(Obj.getTypename(object)!);
|
|
@@ -76,7 +76,7 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
76
76
|
|
|
77
77
|
return [{ id: 'echo', items }];
|
|
78
78
|
},
|
|
79
|
-
[
|
|
79
|
+
[db, filter, resolve],
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
return handleLinkQuery;
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { EditorView } from '@codemirror/view';
|
|
6
|
-
import * as
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationResolver } from '@dxos/app-framework/react';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
12
|
+
import { OperationResolver } from '@dxos/operation';
|
|
13
|
+
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
13
14
|
|
|
14
15
|
import { meta } from '../meta';
|
|
15
16
|
|
|
@@ -17,50 +18,44 @@ import { meta } from '../meta';
|
|
|
17
18
|
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
18
19
|
*/
|
|
19
20
|
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
20
|
-
const
|
|
21
|
+
const scrollIntoViewHandler = useMemo(
|
|
21
22
|
() =>
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
OperationResolver.make({
|
|
24
|
+
operation: Common.LayoutOperation.ScrollIntoView,
|
|
24
25
|
position: 'hoist',
|
|
25
|
-
filter: (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return !!editorView && data.subject === documentId && !!data.options?.cursor;
|
|
37
|
-
},
|
|
38
|
-
resolve: ({ options: { cursor } }) => {
|
|
39
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
40
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor!);
|
|
41
|
-
if (range) {
|
|
42
|
-
const selection = editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
43
|
-
const effects = [
|
|
44
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
45
|
-
EditorView.scrollIntoView(range.from, {
|
|
46
|
-
y: 'start',
|
|
47
|
-
yMargin: 96,
|
|
48
|
-
}),
|
|
49
|
-
];
|
|
50
|
-
if (selection) {
|
|
51
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
52
|
-
effects.push(setSelection.of({ current: documentId }));
|
|
26
|
+
filter: (input) => !!editorView && input.subject === documentId && !!input.cursor,
|
|
27
|
+
handler: (input) =>
|
|
28
|
+
Effect.sync(() => {
|
|
29
|
+
invariant(editorView, 'Editor view is not defined.');
|
|
30
|
+
const cursor = input.cursor;
|
|
31
|
+
if (!cursor) {
|
|
32
|
+
return;
|
|
53
33
|
}
|
|
34
|
+
const range = Cursor.getRangeFromCursor(editorView.state, cursor);
|
|
35
|
+
if (range) {
|
|
36
|
+
const selection =
|
|
37
|
+
editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
38
|
+
const effects = [
|
|
39
|
+
// NOTE: This does not use the DOM scrollIntoView function.
|
|
40
|
+
EditorView.scrollIntoView(range.from, {
|
|
41
|
+
y: 'start',
|
|
42
|
+
yMargin: 96,
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
if (selection) {
|
|
46
|
+
// Update the editor selection to get bi-directional highlighting.
|
|
47
|
+
effects.push(setSelection.of({ current: documentId }));
|
|
48
|
+
}
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
editorView.dispatch({
|
|
51
|
+
effects,
|
|
52
|
+
selection: selection ? { anchor: range.from } : undefined,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
61
56
|
}),
|
|
62
57
|
[documentId, editorView],
|
|
63
58
|
);
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
66
61
|
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/markdown',
|
|
10
10
|
name: 'Markdown',
|
|
11
11
|
description: trim`
|
package/src/testing.ts
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
9
|
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
11
|
import { Collection } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
// TODO(wittjosiah): Factor out.
|
|
14
|
-
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R |
|
|
14
|
+
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield*
|
|
19
|
-
Obj.make(
|
|
18
|
+
yield* Database.Service.add(
|
|
19
|
+
Obj.make(SpaceProperties, {
|
|
20
20
|
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
21
|
}) as any,
|
|
22
22
|
);
|
package/src/translations.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const translations = [
|
|
|
18
18
|
'object name placeholder': 'New document',
|
|
19
19
|
'rename object label': 'Rename document',
|
|
20
20
|
'delete object label': 'Delete document',
|
|
21
|
+
'object deleted label': 'Document deleted',
|
|
21
22
|
},
|
|
22
23
|
[meta.id]: {
|
|
23
24
|
'plugin name': 'Editor',
|
package/src/types/Markdown.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { DescriptionAnnotation,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Document Item type.
|
|
@@ -15,16 +15,15 @@ import { ItemAnnotation, Text } from '@dxos/schema';
|
|
|
15
15
|
export const Document = Schema.Struct({
|
|
16
16
|
name: Schema.optional(Schema.String),
|
|
17
17
|
description: Schema.optional(Schema.String),
|
|
18
|
-
fallbackName: Schema.String.pipe(
|
|
19
|
-
content: Type.Ref(Text.Text).pipe(
|
|
18
|
+
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
|
+
content: Type.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
20
|
}).pipe(
|
|
21
|
-
Type.
|
|
21
|
+
Type.object({
|
|
22
22
|
typename: 'dxos.org/type/Document',
|
|
23
23
|
version: '0.1.0',
|
|
24
24
|
}),
|
|
25
25
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
26
|
DescriptionAnnotation.set('description'),
|
|
27
|
-
ItemAnnotation.set(true),
|
|
28
27
|
);
|
|
29
28
|
|
|
30
29
|
export type Document = Schema.Schema.Type<typeof Document>;
|