@dxos/plugin-markdown 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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-7VIO7R66.mjs +11 -0
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs +11 -0
- package/dist/lib/browser/{anchor-sort-3MYLO74J.mjs → anchor-sort-JBAZRPE7.mjs} +8 -7
- package/dist/lib/browser/anchor-sort-JBAZRPE7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs +59 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs +20 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/{chunk-NXT2E2BG.mjs → chunk-2AAD3W6X.mjs} +6 -6
- package/dist/lib/browser/chunk-2AAD3W6X.mjs.map +7 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs +167 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs +8 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs +105 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs +58 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs.map +7 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs +796 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs.map +7 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs +176 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +33 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +124 -129
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs +53 -0
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs.map +7 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs +213 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs.map +7 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs +36 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs.map +7 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs +29 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs +12 -0
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs +12 -0
- package/dist/lib/node-esm/{anchor-sort-W4HCTYUQ.mjs → anchor-sort-IQMDZRA3.mjs} +8 -7
- package/dist/lib/node-esm/anchor-sort-IQMDZRA3.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs +60 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs +21 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/chunk-AGZOFIK2.mjs +10 -0
- package/dist/lib/node-esm/chunk-AGZOFIK2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs +797 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs +59 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs +106 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs +177 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-I5JSQBPI.mjs → chunk-MLZQCT2N.mjs} +6 -6
- package/dist/lib/node-esm/chunk-MLZQCT2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs +168 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +34 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +124 -129
- 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-QAGXDA5E.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-QAGXDA5E.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs +214 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs.map +7 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs +37 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs.map +7 -0
- package/dist/lib/node-esm/state-TVF2XT2T.mjs +30 -0
- package/dist/lib/node-esm/state-TVF2XT2T.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 +14 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +19 -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 +6 -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 +11 -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 +7 -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 -16
- 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 +16 -7
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +29 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +1 -1
- 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 +6 -5
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +3 -3
- 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/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 +2 -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 +29 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +12 -12
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +62 -30
- 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.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +88 -66
- package/src/MarkdownPlugin.tsx +64 -76
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +92 -0
- package/src/{functions → blueprints/functions}/create.ts +4 -3
- package/src/blueprints/functions/index.ts +7 -0
- package/src/{functions → blueprints/functions}/open.ts +10 -10
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/blueprints/functions/update.test.ts +215 -0
- package/src/blueprints/functions/update.ts +79 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +37 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +60 -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 +26 -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 +102 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +37 -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 +30 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +26 -44
- package/src/components/MarkdownCard/MarkdownCard.tsx +23 -55
- package/src/components/MarkdownContainer.stories.tsx +49 -62
- package/src/components/MarkdownContainer.tsx +37 -32
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +17 -18
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +26 -21
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +22 -12
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +6 -3
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +48 -34
- package/src/components/Suggestions.stories.tsx +22 -33
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +24 -28
- package/src/hooks/useLinkQuery.ts +12 -12
- package/src/hooks/useSelectCurrentThread.tsx +37 -42
- package/src/index.ts +3 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +1 -1
- package/src/translations.ts +2 -0
- package/src/types/Markdown.ts +2 -2
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.ts +3 -2
- package/src/util.tsx +3 -1
- package/dist/lib/browser/MarkdownCard-THZFDOOV.mjs +0 -13
- package/dist/lib/browser/MarkdownContainer-VKPSVI5F.mjs +0 -16
- package/dist/lib/browser/anchor-sort-3MYLO74J.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-R5T6LTPN.mjs +0 -13
- package/dist/lib/browser/chunk-56SUMOIZ.mjs +0 -734
- package/dist/lib/browser/chunk-56SUMOIZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6OMOMVO7.mjs +0 -107
- package/dist/lib/browser/chunk-6OMOMVO7.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-CN35HEBX.mjs +0 -79
- package/dist/lib/browser/chunk-CN35HEBX.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-KCOBZZIL.mjs +0 -111
- package/dist/lib/browser/chunk-KCOBZZIL.mjs.map +0 -7
- package/dist/lib/browser/chunk-KPH4ZPQN.mjs +0 -99
- package/dist/lib/browser/chunk-KPH4ZPQN.mjs.map +0 -7
- package/dist/lib/browser/chunk-NXT2E2BG.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJPOHSYN.mjs +0 -152
- package/dist/lib/browser/chunk-RJPOHSYN.mjs.map +0 -7
- package/dist/lib/browser/chunk-U6Y53XZK.mjs +0 -20
- package/dist/lib/browser/chunk-U6Y53XZK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs +0 -62
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Q3C5H2KT.mjs +0 -215
- package/dist/lib/browser/react-surface-Q3C5H2KT.mjs.map +0 -7
- package/dist/lib/browser/settings-G3ZOXJQY.mjs +0 -28
- package/dist/lib/browser/settings-G3ZOXJQY.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/MarkdownCard-QHSSZGIY.mjs +0 -14
- package/dist/lib/node-esm/MarkdownContainer-G3ZQJS7A.mjs +0 -17
- package/dist/lib/node-esm/anchor-sort-W4HCTYUQ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-2JV3WV22.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-2JV3WV22.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6F6FCTIA.mjs +0 -100
- package/dist/lib/node-esm/chunk-6F6FCTIA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C5KXP2ZE.mjs +0 -153
- package/dist/lib/node-esm/chunk-C5KXP2ZE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FR6RW6DH.mjs +0 -735
- package/dist/lib/node-esm/chunk-FR6RW6DH.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-I5JSQBPI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KM7KYV6W.mjs +0 -22
- package/dist/lib/node-esm/chunk-KM7KYV6W.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KYWXTMKI.mjs +0 -108
- package/dist/lib/node-esm/chunk-KYWXTMKI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R3SGV4ES.mjs +0 -112
- package/dist/lib/node-esm/chunk-R3SGV4ES.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/chunk-YFRTKXTB.mjs +0 -80
- package/dist/lib/node-esm/chunk-YFRTKXTB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QWRT4SD6.mjs +0 -216
- package/dist/lib/node-esm/react-surface-QWRT4SD6.mjs.map +0 -7
- package/dist/lib/node-esm/settings-IBFFCGNL.mjs +0 -29
- package/dist/lib/node-esm/settings-IBFFCGNL.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 +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/update.d.ts +0 -6
- 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 -31
- 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 -97
- 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/create.test.ts +0 -124
- package/src/functions/index.ts +0 -13
- package/src/functions/update.conversations.json +0 -1
- package/src/functions/update.test.ts +0 -147
- package/src/functions/update.ts +0 -38
- package/src/toolkit.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-THZFDOOV.mjs.map → MarkdownCard-7VIO7R66.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-VKPSVI5F.mjs.map → MarkdownContainer-6E43EDAU.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-R5T6LTPN.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/MarkdownCard-YC3R2TQW.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-QHSSZGIY.mjs.map → MarkdownContainer-TTRUOXU6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-G3ZQJS7A.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}/update.test.d.ts +0 -0
|
@@ -3,39 +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 { Capabilities, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
13
|
-
import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
14
13
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
14
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/ui';
|
|
15
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
16
|
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
17
17
|
import { invariant } from '@dxos/invariant';
|
|
18
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
20
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
21
|
-
import {
|
|
22
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
23
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
24
21
|
import { faker } from '@dxos/random';
|
|
25
22
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
26
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
24
|
+
import { Layout } from '@dxos/react-ui';
|
|
27
25
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
28
|
-
import {
|
|
29
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
30
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
26
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
31
27
|
import { render } from '@dxos/storybook-utils';
|
|
32
28
|
import { Message } from '@dxos/types';
|
|
29
|
+
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
33
30
|
|
|
34
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
35
31
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
36
|
-
import { meta } from '../meta';
|
|
37
32
|
import { translations } from '../translations';
|
|
38
|
-
import { Markdown } from '../types';
|
|
33
|
+
import { Markdown, MarkdownCapabilities } from '../types';
|
|
39
34
|
|
|
40
35
|
import { MarkdownContainer } from './MarkdownContainer';
|
|
41
36
|
|
|
@@ -51,16 +46,15 @@ const TestItem = Schema.Struct({
|
|
|
51
46
|
description: 'Product description',
|
|
52
47
|
}),
|
|
53
48
|
}).pipe(
|
|
54
|
-
Type.
|
|
49
|
+
Type.object({
|
|
55
50
|
typename: 'dxos.org/type/Test',
|
|
56
51
|
version: '0.1.0',
|
|
57
52
|
}),
|
|
58
53
|
);
|
|
59
54
|
|
|
60
55
|
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
61
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
62
56
|
const { parentRef } = useTextEditor({ initialValue: content });
|
|
63
|
-
const
|
|
57
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
64
58
|
|
|
65
59
|
const space = useSpace();
|
|
66
60
|
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
@@ -96,7 +90,7 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
96
90
|
|
|
97
91
|
// void dispatch(
|
|
98
92
|
// createIntent(CollaborationActions.InsertContent, {
|
|
99
|
-
// target: doc as any as
|
|
93
|
+
// target: doc as any as TestSchema.Expando,
|
|
100
94
|
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
101
95
|
// at: cursor,
|
|
102
96
|
// label: 'Proposal',
|
|
@@ -105,20 +99,20 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
105
99
|
};
|
|
106
100
|
|
|
107
101
|
return (
|
|
108
|
-
<
|
|
102
|
+
<Layout.Main toolbar>
|
|
109
103
|
<Toolbar.Root>
|
|
110
104
|
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
111
105
|
</Toolbar.Root>
|
|
112
106
|
<div ref={parentRef} className='p-4' />
|
|
113
|
-
</
|
|
107
|
+
</Layout.Main>
|
|
114
108
|
);
|
|
115
109
|
};
|
|
116
110
|
|
|
117
111
|
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
118
112
|
const space = useSpace();
|
|
119
113
|
const [doc, setDoc] = useState<Markdown.Document>();
|
|
120
|
-
const settings =
|
|
121
|
-
const
|
|
114
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
122
116
|
|
|
123
117
|
useEffect(() => {
|
|
124
118
|
if (!space) {
|
|
@@ -148,10 +142,9 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
148
142
|
return null;
|
|
149
143
|
}
|
|
150
144
|
|
|
151
|
-
// TODO(burdon): Layout issue.
|
|
152
145
|
return (
|
|
153
146
|
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
154
|
-
<MarkdownContainer id={doc.id}
|
|
147
|
+
<MarkdownContainer id={doc.id} subject={doc} settings={settings} editorStateStore={editorState} />
|
|
155
148
|
<TestChat doc={doc} content={chat} />
|
|
156
149
|
</div>
|
|
157
150
|
);
|
|
@@ -161,25 +154,21 @@ const storybook: Meta<typeof DefaultStory> = {
|
|
|
161
154
|
title: 'plugins/plugin-markdown/Suggestions',
|
|
162
155
|
render: render(DefaultStory),
|
|
163
156
|
decorators: [
|
|
164
|
-
withTheme,
|
|
157
|
+
withTheme(),
|
|
165
158
|
withPluginManager({
|
|
166
159
|
plugins: [
|
|
160
|
+
...corePlugins(),
|
|
161
|
+
StorybookPlugin({}),
|
|
167
162
|
ClientPlugin({
|
|
168
163
|
types: [Markdown.Document, TestItem],
|
|
169
|
-
onClientInitialized:
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
onClientInitialized: ({ client }) =>
|
|
165
|
+
Effect.gen(function* () {
|
|
166
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
+
}),
|
|
172
168
|
}),
|
|
173
|
-
SpacePlugin({}),
|
|
174
|
-
GraphPlugin(),
|
|
175
|
-
IntentPlugin(),
|
|
176
|
-
SettingsPlugin(),
|
|
177
169
|
|
|
178
|
-
// UI
|
|
179
|
-
ThemePlugin({ tx: defaultTx }),
|
|
180
170
|
MarkdownPlugin(),
|
|
181
171
|
PreviewPlugin(),
|
|
182
|
-
StorybookLayoutPlugin({}),
|
|
183
172
|
],
|
|
184
173
|
}),
|
|
185
174
|
],
|
|
@@ -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,18 @@ 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 { type Capabilities } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
12
|
import { debounceAndThrottle } from '@dxos/async';
|
|
12
13
|
import { Obj } from '@dxos/echo';
|
|
13
14
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
14
15
|
import { invariant } from '@dxos/invariant';
|
|
15
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
16
|
+
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
16
17
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
17
18
|
import { Icon, ThemeProvider } from '@dxos/react-ui';
|
|
18
19
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
19
21
|
import {
|
|
20
22
|
Cursor,
|
|
21
23
|
type EditorStateStore,
|
|
@@ -36,9 +38,8 @@ import {
|
|
|
36
38
|
replacer,
|
|
37
39
|
selectionState,
|
|
38
40
|
typewriter,
|
|
39
|
-
} from '@dxos/
|
|
40
|
-
import { defaultTx } from '@dxos/
|
|
41
|
-
import { Text } from '@dxos/schema';
|
|
41
|
+
} from '@dxos/ui-editor';
|
|
42
|
+
import { defaultTx } from '@dxos/ui-theme';
|
|
42
43
|
import { isTruthy } from '@dxos/util';
|
|
43
44
|
|
|
44
45
|
import { Markdown } from '../types';
|
|
@@ -49,7 +50,7 @@ export type DocumentType = Markdown.Document | Text.Text | { id: string; text: s
|
|
|
49
50
|
export type ExtensionsOptions = {
|
|
50
51
|
id: string;
|
|
51
52
|
object?: DocumentType;
|
|
52
|
-
|
|
53
|
+
invokePromise?: Capabilities.OperationInvoker['invokePromise'];
|
|
53
54
|
settings?: Markdown.Settings;
|
|
54
55
|
selectionManager?: SelectionManager;
|
|
55
56
|
viewMode?: EditorViewMode;
|
|
@@ -67,16 +68,16 @@ export const useExtensions = ({
|
|
|
67
68
|
editorStateStore,
|
|
68
69
|
previewOptions,
|
|
69
70
|
}: ExtensionsOptions): Extension[] => {
|
|
70
|
-
const {
|
|
71
|
+
const { invokePromise } = useOperationInvoker();
|
|
71
72
|
const identity = useIdentity();
|
|
72
73
|
const space = getSpace(object);
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
// Get the content reference from Document objects.
|
|
76
|
+
const contentRef = Obj.instanceOf(Markdown.Document, object) ? (object as Markdown.Document).content : undefined;
|
|
77
|
+
// Use useObject to trigger re-render when the reference loads (returns snapshot for reactivity).
|
|
78
|
+
useObject(contentRef);
|
|
79
|
+
// Get the actual live object target via .target (needed for createDocAccessor).
|
|
80
|
+
const target = contentRef?.target ?? (Obj.instanceOf(Text.Text, object) ? object : undefined);
|
|
80
81
|
|
|
81
82
|
// TODO(wittjosiah): Autocomplete is not working and this query is causing performance issues.
|
|
82
83
|
// TODO(burdon): Unsubscribe.
|
|
@@ -92,13 +93,13 @@ export const useExtensions = ({
|
|
|
92
93
|
selectionManager,
|
|
93
94
|
viewMode,
|
|
94
95
|
previewOptions,
|
|
95
|
-
|
|
96
|
+
invokePromise,
|
|
96
97
|
}),
|
|
97
98
|
[
|
|
98
99
|
id,
|
|
99
100
|
object,
|
|
100
101
|
viewMode,
|
|
101
|
-
|
|
102
|
+
invokePromise,
|
|
102
103
|
previewOptions,
|
|
103
104
|
settings,
|
|
104
105
|
settings?.debug,
|
|
@@ -144,7 +145,7 @@ export const useExtensions = ({
|
|
|
144
145
|
const createBaseExtensions = ({
|
|
145
146
|
id,
|
|
146
147
|
object,
|
|
147
|
-
|
|
148
|
+
invokePromise,
|
|
148
149
|
settings,
|
|
149
150
|
selectionManager,
|
|
150
151
|
viewMode,
|
|
@@ -169,17 +170,12 @@ const createBaseExtensions = ({
|
|
|
169
170
|
// TODO(wittjosiah): For internal links, consider ignoring the link text and rendering the label of the object being linked to.
|
|
170
171
|
// TODO(burdon): Create dx-tag.
|
|
171
172
|
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
|
-
);
|
|
173
|
+
invokePromise && (object || id)
|
|
174
|
+
? createLinkRenderer((targetId: string) => {
|
|
175
|
+
void invokePromise(LayoutOperation.Open, {
|
|
176
|
+
subject: [targetId],
|
|
177
|
+
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
178
|
+
});
|
|
183
179
|
})
|
|
184
180
|
: undefined,
|
|
185
181
|
}),
|
|
@@ -5,41 +5,41 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Filter, Obj, Query, Type } from '@dxos/echo';
|
|
8
|
+
import { usePluginManager } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
|
+
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
11
|
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
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(AppCapabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
23
23
|
[manager],
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
const filter = useMemo(
|
|
27
27
|
() =>
|
|
28
28
|
Filter.or(
|
|
29
|
-
...(
|
|
29
|
+
...(db?.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync() ?? [])
|
|
30
30
|
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
31
31
|
.filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))
|
|
32
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) {
|
|
@@ -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 { useOperationResolver } from '@dxos/app-framework/ui';
|
|
10
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
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: 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
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { MarkdownCapabilities } from './
|
|
6
|
-
export { MarkdownEvents } from './events';
|
|
5
|
+
export { MarkdownCapabilities, MarkdownEvents } from './types';
|
|
7
6
|
|
|
8
7
|
export * from './meta';
|
|
9
8
|
export * from './types';
|
|
10
9
|
export * from './util';
|
|
11
10
|
|
|
12
11
|
export * from './MarkdownPlugin';
|
|
12
|
+
|
|
13
|
+
export { MarkdownEditor } from './components/MarkdownEditor';
|
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
|
@@ -15,7 +15,7 @@ export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.
|
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield* Database.
|
|
18
|
+
yield* Database.add(
|
|
19
19
|
Obj.make(SpaceProperties, {
|
|
20
20
|
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
21
|
}) as any,
|
package/src/translations.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
9
|
import { Markdown } from './types';
|
|
@@ -50,4 +51,5 @@ export const translations = [
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
},
|
|
54
|
+
...editorTranslations,
|
|
53
55
|
] as const satisfies Resource[];
|
package/src/types/Markdown.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
-
import { EditorInputMode, EditorViewMode } from '@dxos/react-ui-editor/types';
|
|
10
9
|
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Document Item type.
|
|
@@ -18,7 +18,7 @@ export const Document = Schema.Struct({
|
|
|
18
18
|
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
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
|
}),
|
|
@@ -4,26 +4,56 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
10
|
+
import { Collection } from '@dxos/schema';
|
|
11
|
+
import { EditorViewMode } from '@dxos/ui-editor/types';
|
|
8
12
|
|
|
9
13
|
import { meta } from '../meta';
|
|
10
14
|
|
|
11
15
|
import { Document } from './Markdown';
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const MARKDOWN_OPERATION = `${meta.id}/operation`;
|
|
18
|
+
|
|
19
|
+
export namespace MarkdownOperation {
|
|
20
|
+
export const OnCreateSpace = Operation.make({
|
|
21
|
+
meta: { key: `${MARKDOWN_OPERATION}/on-create-space`, name: 'On Create Space' },
|
|
22
|
+
services: [Capability.Service],
|
|
23
|
+
schema: {
|
|
24
|
+
input: Schema.Struct({
|
|
25
|
+
space: SpaceSchema,
|
|
26
|
+
rootCollection: Collection.Collection,
|
|
27
|
+
isDefault: Schema.optional(Schema.Boolean),
|
|
28
|
+
}),
|
|
29
|
+
output: Schema.Void,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Create = Operation.make({
|
|
34
|
+
meta: { key: `${MARKDOWN_OPERATION}/create`, name: 'Create Markdown Document' },
|
|
35
|
+
services: [Capability.Service],
|
|
36
|
+
schema: {
|
|
37
|
+
input: Schema.Struct({
|
|
38
|
+
name: Schema.optional(Schema.String),
|
|
39
|
+
content: Schema.optional(Schema.String),
|
|
40
|
+
}),
|
|
41
|
+
output: Schema.Struct({
|
|
42
|
+
object: Document,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
48
|
+
export const SetViewMode = Operation.make({
|
|
49
|
+
meta: { key: `${MARKDOWN_OPERATION}/set-view-mode`, name: 'Set View Mode' },
|
|
50
|
+
services: [Capability.Service],
|
|
51
|
+
schema: {
|
|
52
|
+
input: Schema.Struct({
|
|
53
|
+
id: Schema.String,
|
|
54
|
+
viewMode: EditorViewMode,
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Void,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type EditorStateStore, type EditorViewMode } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
|
|
13
|
+
import type * as Markdown from './Markdown';
|
|
14
|
+
import { type MarkdownExtensionProvider } from './types';
|
|
15
|
+
|
|
16
|
+
/** Schema for persisted markdown state. */
|
|
17
|
+
export const MarkdownStateSchema = Schema.mutable(
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export type MarkdownState = {
|
|
24
|
+
viewMode: Record<string, EditorViewMode>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export namespace MarkdownCapabilities {
|
|
28
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}/capability/settings`);
|
|
29
|
+
|
|
30
|
+
/** Persisted state atom for view mode per document. */
|
|
31
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}/capability/state`);
|
|
32
|
+
|
|
33
|
+
/** Editor state store for cursor positions, scroll state, etc. */
|
|
34
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}/capability/editor-state`);
|
|
35
|
+
|
|
36
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
37
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}/capability/extensions`);
|
|
38
|
+
}
|