@dxos/plugin-markdown 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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/MarkdownSettings-YZFNSJJY.mjs +121 -0
- package/dist/lib/browser/MarkdownSettings-YZFNSJJY.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +47 -4
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-46WIDM4R.mjs +98 -0
- package/dist/lib/browser/chunk-46WIDM4R.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-XKUKZNUS.mjs +158 -0
- package/dist/lib/browser/chunk-XKUKZNUS.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +26 -19
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/create-HSXPXCC5.mjs +30 -0
- package/dist/lib/browser/create-HSXPXCC5.mjs.map +7 -0
- package/dist/lib/browser/create-markdown-WB7DH3UF.mjs +22 -0
- package/dist/lib/browser/create-markdown-WB7DH3UF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +606 -85
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-N6PAX6DY.mjs +21 -0
- package/dist/lib/browser/open-N6PAX6DY.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-5M4F24AB.mjs +49 -0
- package/dist/lib/browser/scroll-to-anchor-5M4F24AB.mjs.map +7 -0
- package/dist/lib/browser/set-view-mode-NBNF2I5W.mjs +26 -0
- package/dist/lib/browser/set-view-mode-NBNF2I5W.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -7
- package/dist/lib/browser/update-5QIRVGTL.mjs +45 -0
- package/dist/lib/browser/update-5QIRVGTL.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-X6SDS35F.mjs +122 -0
- package/dist/lib/node-esm/MarkdownSettings-X6SDS35F.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +47 -4
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs +99 -0
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E4BQCEXF.mjs +159 -0
- package/dist/lib/node-esm/chunk-E4BQCEXF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/cli/index.mjs +26 -19
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/create-6Z2KYISY.mjs +31 -0
- package/dist/lib/node-esm/create-6Z2KYISY.mjs.map +7 -0
- package/dist/lib/node-esm/create-markdown-JWQZICKY.mjs +23 -0
- package/dist/lib/node-esm/create-markdown-JWQZICKY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +606 -85
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-DSNFRSNZ.mjs +22 -0
- package/dist/lib/node-esm/open-DSNFRSNZ.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-D6SHGU2R.mjs +50 -0
- package/dist/lib/node-esm/scroll-to-anchor-D6SHGU2R.mjs.map +7 -0
- package/dist/lib/node-esm/set-view-mode-REYB4L7J.mjs +27 -0
- package/dist/lib/node-esm/set-view-mode-REYB4L7J.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -7
- package/dist/lib/node-esm/update-YMQAIKOF.mjs +46 -0
- package/dist/lib/node-esm/update-YMQAIKOF.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +27 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +4 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +24 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.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 +25 -22
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +3 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +4 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +7 -6
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +138 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +1 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts +2 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +15 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +36 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +99 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +7 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-markdown.d.ts +5 -0
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/create.test.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +64 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/operations/set-view-mode.d.ts +5 -0
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -0
- package/dist/types/src/operations/update.d.ts +5 -0
- package/dist/types/src/operations/update.d.ts.map +1 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +75 -35
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +15 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +16 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +31 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +2 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +92 -60
- package/src/MarkdownPlugin.tsx +47 -42
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/markdown-blueprint.ts +14 -8
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +15 -9
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +13 -7
- package/src/capabilities/node.ts +11 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +120 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/state.ts +47 -0
- package/src/cli/plugin.ts +20 -10
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +38 -34
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +139 -102
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +25 -17
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +46 -54
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +39 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +114 -98
- package/src/components/MarkdownSettings/index.ts +1 -1
- package/src/components/index.ts +4 -12
- package/src/{components → containers}/MarkdownCard/MarkdownCard.stories.tsx +21 -12
- package/src/containers/MarkdownCard/MarkdownCard.tsx +62 -0
- package/src/containers/MarkdownCard/index.ts +5 -0
- package/src/containers/MarkdownCard/snippet.ts +78 -0
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.tsx +34 -23
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +145 -0
- package/src/containers/MarkdownContainer/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +3 -3
- package/src/hooks/useExtensions.tsx +81 -92
- package/src/hooks/useLinkQuery.ts +31 -6
- package/src/index.ts +3 -0
- package/src/meta.ts +1 -1
- package/src/operations/create-markdown.ts +20 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/operations/create.test.ts +98 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/definitions.ts +120 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +39 -0
- package/src/operations/set-view-mode.ts +24 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/operations/update.test.ts +215 -0
- package/src/operations/update.ts +51 -0
- package/src/testing.ts +2 -2
- package/src/translations.ts +49 -35
- package/src/types/Markdown.ts +18 -25
- package/src/types/Settings.ts +28 -0
- package/src/types/capabilities.ts +17 -5
- package/src/types/events.ts +5 -4
- package/src/types/index.ts +3 -4
- package/src/util.tsx +5 -5
- package/dist/lib/browser/MarkdownCard-HFNNE4B4.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +0 -12
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs +0 -32
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +0 -58
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +0 -19
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BX73DASG.mjs +0 -702
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +0 -7
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +0 -8
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWQQW6KU.mjs +0 -144
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXYQLKH.mjs +0 -55
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +0 -7
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +0 -104
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +0 -167
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +0 -7
- package/dist/lib/browser/chunk-S45ULIOG.mjs +0 -101
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs +0 -60
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +0 -53
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs +0 -213
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +0 -7
- package/dist/lib/browser/settings-JY5JE7MI.mjs +0 -35
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +0 -7
- package/dist/lib/browser/state-QE7VSJWJ.mjs +0 -29
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +0 -13
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +0 -59
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +0 -20
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +0 -105
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs +0 -56
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +0 -703
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs +0 -145
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs +0 -61
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +0 -168
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +0 -102
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +0 -10
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs +0 -54
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs +0 -214
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +0 -36
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +0 -7
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +0 -30
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +0 -7
- package/dist/types/src/blueprints/functions/create.d.ts +0 -8
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -4
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/open.d.ts +0 -7
- package/dist/types/src/blueprints/functions/open.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -6
- package/dist/types/src/blueprints/functions/update.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +0 -5
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -5
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -10
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -6
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -5
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +0 -28
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +0 -59
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +0 -6
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +0 -1
- package/dist/types/src/types/MarkdownAction.d.ts +0 -66
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/src/blueprints/functions/create.conversations.json +0 -1
- package/src/blueprints/functions/create.test.ts +0 -125
- package/src/blueprints/functions/create.ts +0 -34
- package/src/blueprints/functions/index.ts +0 -7
- package/src/blueprints/functions/open.ts +0 -33
- package/src/blueprints/functions/update.conversations.json +0 -1
- package/src/blueprints/functions/update.test.ts +0 -149
- package/src/blueprints/functions/update.ts +0 -38
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/app-graph-serializer/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -25
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -45
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -100
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/state/state.ts +0 -31
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -62
- package/src/components/MarkdownCard/index.ts +0 -9
- package/src/components/MarkdownContainer.tsx +0 -111
- package/src/components/Suggestions.stories.tsx +0 -215
- package/src/hooks/useSelectCurrentThread.tsx +0 -61
- package/src/types/MarkdownAction.ts +0 -59
- /package/dist/lib/browser/{MarkdownCard-HFNNE4B4.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/MarkdownContainer-V7EAADMF.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.stories.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/create.test.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/update.test.d.ts +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Layer from 'effect/Layer';
|
|
8
|
-
|
|
9
|
-
import { AiService, ConsolePrinter } from '@dxos/ai';
|
|
10
|
-
import { MemoizedAiService, TestAiService } from '@dxos/ai/testing';
|
|
11
|
-
import {
|
|
12
|
-
AiConversation,
|
|
13
|
-
type ContextBinding,
|
|
14
|
-
GenerationObserver,
|
|
15
|
-
makeToolExecutionServiceFromFunctions,
|
|
16
|
-
makeToolResolverFromFunctions,
|
|
17
|
-
} from '@dxos/assistant';
|
|
18
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
19
|
-
import { SpaceProperties } from '@dxos/client-protocol';
|
|
20
|
-
import { Obj, Query, Ref } from '@dxos/echo';
|
|
21
|
-
import { Database } from '@dxos/echo';
|
|
22
|
-
import { acquireReleaseResource } from '@dxos/effect';
|
|
23
|
-
import { TestHelpers } from '@dxos/effect/testing';
|
|
24
|
-
import { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';
|
|
25
|
-
import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
26
|
-
import { invariant } from '@dxos/invariant';
|
|
27
|
-
import { ObjectId } from '@dxos/keys';
|
|
28
|
-
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
29
|
-
import { Collection } from '@dxos/schema';
|
|
30
|
-
import { HasSubject, type Message } from '@dxos/types';
|
|
31
|
-
|
|
32
|
-
import { WithProperties, testToolkit } from '../../testing';
|
|
33
|
-
import * as MarkdownBlueprint from '../markdown-blueprint';
|
|
34
|
-
|
|
35
|
-
import update from './update';
|
|
36
|
-
|
|
37
|
-
ObjectId.dangerouslyDisableRandomness();
|
|
38
|
-
|
|
39
|
-
const TestLayer = Layer.mergeAll(
|
|
40
|
-
AiService.model('@anthropic/claude-opus-4-0'),
|
|
41
|
-
makeToolResolverFromFunctions(MarkdownBlueprint.functions, testToolkit),
|
|
42
|
-
makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
|
|
43
|
-
).pipe(
|
|
44
|
-
Layer.provideMerge(
|
|
45
|
-
FunctionInvocationServiceLayerTest({
|
|
46
|
-
functions: MarkdownBlueprint.functions,
|
|
47
|
-
}),
|
|
48
|
-
),
|
|
49
|
-
Layer.provideMerge(
|
|
50
|
-
Layer.mergeAll(
|
|
51
|
-
TestAiService(),
|
|
52
|
-
TestDatabaseLayer({
|
|
53
|
-
spaceKey: 'fixed',
|
|
54
|
-
indexing: { vector: true },
|
|
55
|
-
types: [SpaceProperties, Collection.Collection, Blueprint.Blueprint, Markdown.Document, HasSubject.HasSubject],
|
|
56
|
-
}),
|
|
57
|
-
CredentialsService.configuredLayer([]),
|
|
58
|
-
TracingService.layerNoop,
|
|
59
|
-
),
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
describe('update', () => {
|
|
64
|
-
it.effect(
|
|
65
|
-
'call a function to update a markdown document',
|
|
66
|
-
Effect.fnUntraced(
|
|
67
|
-
function* (_) {
|
|
68
|
-
const doc = Markdown.make({
|
|
69
|
-
name: 'BlueYard',
|
|
70
|
-
content: 'Founders and portfolio of BlueYard.',
|
|
71
|
-
});
|
|
72
|
-
yield* Database.Service.add(doc);
|
|
73
|
-
|
|
74
|
-
yield* FunctionInvocationService.invokeFunction(update, {
|
|
75
|
-
id: doc.id,
|
|
76
|
-
diffs: ['- Founders', '+ # Founders'],
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const updatedDoc = yield* Database.Service.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
80
|
-
expect(updatedDoc.name).toBe(doc.name);
|
|
81
|
-
const text = yield* Database.Service.load(updatedDoc.content);
|
|
82
|
-
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
83
|
-
},
|
|
84
|
-
WithProperties,
|
|
85
|
-
Effect.provide(TestLayer),
|
|
86
|
-
TestHelpers.provideTestContext,
|
|
87
|
-
),
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
it.scoped(
|
|
91
|
-
'create and update a markdown document',
|
|
92
|
-
Effect.fnUntraced(
|
|
93
|
-
function* (_) {
|
|
94
|
-
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
95
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
96
|
-
|
|
97
|
-
yield* Database.Service.flush({ indexes: true });
|
|
98
|
-
const markdownBlueprint = yield* Database.Service.add(Obj.clone(MarkdownBlueprint.make()));
|
|
99
|
-
yield* Effect.promise(() =>
|
|
100
|
-
conversation.context.bind({
|
|
101
|
-
blueprints: [Ref.make(markdownBlueprint)],
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const observer = GenerationObserver.fromPrinter(new ConsolePrinter());
|
|
106
|
-
|
|
107
|
-
yield* conversation.createRequest({
|
|
108
|
-
observer,
|
|
109
|
-
prompt: `Create a document with a cookie recipe.`,
|
|
110
|
-
});
|
|
111
|
-
{
|
|
112
|
-
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
113
|
-
if (docs.length !== 1) {
|
|
114
|
-
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const doc = docs[0];
|
|
118
|
-
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
119
|
-
console.log({
|
|
120
|
-
name: doc.name,
|
|
121
|
-
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
yield* conversation.createRequest({
|
|
126
|
-
observer,
|
|
127
|
-
prompt: 'Add a section with a holiday-themed variation.',
|
|
128
|
-
});
|
|
129
|
-
{
|
|
130
|
-
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
131
|
-
if (docs.length !== 1) {
|
|
132
|
-
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const doc = docs[0];
|
|
136
|
-
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
137
|
-
console.log({
|
|
138
|
-
name: doc.name,
|
|
139
|
-
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
WithProperties,
|
|
144
|
-
Effect.provide(TestLayer),
|
|
145
|
-
TestHelpers.provideTestContext,
|
|
146
|
-
),
|
|
147
|
-
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
148
|
-
);
|
|
149
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { ArtifactId, applyDiffs } from '@dxos/assistant';
|
|
9
|
-
import { Database } from '@dxos/echo';
|
|
10
|
-
import { createDocAccessor } from '@dxos/echo-db';
|
|
11
|
-
import { defineFunction } from '@dxos/functions';
|
|
12
|
-
import { trim } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { Markdown } from '../../types';
|
|
15
|
-
|
|
16
|
-
// TODO(wittjosiah): Reconcile with ThreadAction.AddProposal.
|
|
17
|
-
export default defineFunction({
|
|
18
|
-
key: 'dxos.org/function/markdown/update',
|
|
19
|
-
name: 'Update',
|
|
20
|
-
description: trim`
|
|
21
|
-
Applies a set of diffs to the markdown document.
|
|
22
|
-
`,
|
|
23
|
-
inputSchema: Schema.Struct({
|
|
24
|
-
id: ArtifactId.annotations({
|
|
25
|
-
description: 'The ID of the markdown document.',
|
|
26
|
-
}),
|
|
27
|
-
diffs: Schema.Array(Schema.String).annotations({
|
|
28
|
-
description: 'The diffs to apply to the document.',
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
outputSchema: Schema.Void,
|
|
32
|
-
handler: Effect.fn(function* ({ data: { id, diffs } }) {
|
|
33
|
-
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Markdown.Document);
|
|
34
|
-
const content = yield* Effect.promise(() => object.content.load());
|
|
35
|
-
const accessor = createDocAccessor(content, ['content']);
|
|
36
|
-
applyDiffs(accessor, diffs);
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { MarkdownBlueprint } from '../../blueprints';
|
|
10
|
-
|
|
11
|
-
export const functions = MarkdownBlueprint.functions;
|
|
12
|
-
|
|
13
|
-
export type BlueprintCapabilities = [
|
|
14
|
-
Capability.Capability<typeof Common.Capability.Functions>,
|
|
15
|
-
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
19
|
-
Effect.succeed([
|
|
20
|
-
Capability.contributes(Common.Capability.Functions, functions),
|
|
21
|
-
Capability.contributes(Common.Capability.BlueprintDefinition, MarkdownBlueprint.make()),
|
|
22
|
-
]),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export default blueprintDefinition;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { OperationResolver } from '@dxos/operation';
|
|
10
|
-
import { Collection } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { Markdown, MarkdownCapabilities, MarkdownOperation } from '../../types';
|
|
13
|
-
|
|
14
|
-
export default Capability.makeModule(
|
|
15
|
-
Effect.fnUntraced(function* () {
|
|
16
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
17
|
-
OperationResolver.make({
|
|
18
|
-
operation: MarkdownOperation.OnCreateSpace,
|
|
19
|
-
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
-
const collection = Collection.makeManaged({ key: Type.getTypename(Markdown.Document) });
|
|
21
|
-
Obj.change(rootCollection, (c) => {
|
|
22
|
-
c.objects.push(Ref.make(collection));
|
|
23
|
-
});
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
OperationResolver.make({
|
|
27
|
-
operation: MarkdownOperation.Create,
|
|
28
|
-
handler: ({ name, content }) =>
|
|
29
|
-
Effect.succeed({
|
|
30
|
-
object: Markdown.make({ name, content }),
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
// TODO(wittjosiah): This appears to be unused.
|
|
34
|
-
OperationResolver.make({
|
|
35
|
-
operation: MarkdownOperation.SetViewMode,
|
|
36
|
-
handler: Effect.fnUntraced(function* ({ id, viewMode }) {
|
|
37
|
-
yield* Common.Capability.updateAtomValue(MarkdownCapabilities.State, (current) => ({
|
|
38
|
-
...current,
|
|
39
|
-
viewMode: { ...current.viewMode, [id]: viewMode },
|
|
40
|
-
}));
|
|
41
|
-
}),
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
44
|
-
}),
|
|
45
|
-
);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
-
import {
|
|
10
|
-
type SurfaceComponentProps,
|
|
11
|
-
useAtomCapability,
|
|
12
|
-
useAtomCapabilityState,
|
|
13
|
-
useCapability,
|
|
14
|
-
useSettingsState,
|
|
15
|
-
} from '@dxos/app-framework/react';
|
|
16
|
-
import { Obj } from '@dxos/echo';
|
|
17
|
-
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
18
|
-
import { Text } from '@dxos/schema';
|
|
19
|
-
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
20
|
-
|
|
21
|
-
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../components';
|
|
22
|
-
import { meta } from '../../meta';
|
|
23
|
-
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
24
|
-
|
|
25
|
-
export default Capability.makeModule(() =>
|
|
26
|
-
Effect.succeed(
|
|
27
|
-
Capability.contributes(Common.Capability.ReactSurface, [
|
|
28
|
-
Common.createSurface({
|
|
29
|
-
id: `${meta.id}/surface/document`,
|
|
30
|
-
role: ['article', 'section', 'tabpanel'],
|
|
31
|
-
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
32
|
-
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
33
|
-
component: ({ data, role, ref }) => {
|
|
34
|
-
return <Container id={Obj.getDXN(data.subject).toString()} subject={data.subject} role={role} ref={ref} />;
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
Common.createSurface({
|
|
38
|
-
id: `${meta.id}/surface/text`,
|
|
39
|
-
role: ['article', 'section', 'tabpanel'],
|
|
40
|
-
filter: (data): data is { id: string; subject: Text.Text } =>
|
|
41
|
-
typeof data.id === 'string' && Obj.instanceOf(Text.Text, data.subject),
|
|
42
|
-
component: ({ data, role }) => {
|
|
43
|
-
return <Container id={data.id} subject={data.subject} role={role} />;
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
Common.createSurface({
|
|
47
|
-
id: `${meta.id}/surface/plugin-settings`,
|
|
48
|
-
role: 'article',
|
|
49
|
-
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
50
|
-
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
51
|
-
component: ({ data: { subject } }) => {
|
|
52
|
-
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
53
|
-
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
56
|
-
Common.createSurface({
|
|
57
|
-
id: `${meta.id}/surface/preview`,
|
|
58
|
-
role: 'card--content',
|
|
59
|
-
filter: (data): data is { subject: Markdown.Document | Text.Text } =>
|
|
60
|
-
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(Text.Text, data.subject),
|
|
61
|
-
component: ({ data }) => <MarkdownCard {...data} />,
|
|
62
|
-
}),
|
|
63
|
-
]),
|
|
64
|
-
),
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Common wrapper.
|
|
69
|
-
*/
|
|
70
|
-
const Container = forwardRef<HTMLDivElement, SurfaceComponentProps<Markdown.Document | Text.Text, { id: string }>>(
|
|
71
|
-
({ id, subject, role }, forwardedRef) => {
|
|
72
|
-
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
73
|
-
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
74
|
-
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
75
|
-
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
76
|
-
const extensions = useCapability(MarkdownCapabilities.Extensions);
|
|
77
|
-
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
78
|
-
|
|
79
|
-
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
80
|
-
const handleViewModeChange = useCallback<NonNullable<MarkdownContainerProps['onViewModeChange']>>(
|
|
81
|
-
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
82
|
-
[id, setState],
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<MarkdownContainer
|
|
87
|
-
role={role}
|
|
88
|
-
subject={subject}
|
|
89
|
-
id={id}
|
|
90
|
-
settings={settings}
|
|
91
|
-
selectionManager={selectionManager}
|
|
92
|
-
extensionProviders={extensionProviders}
|
|
93
|
-
editorStateStore={editorState}
|
|
94
|
-
viewMode={viewMode}
|
|
95
|
-
onViewModeChange={handleViewModeChange}
|
|
96
|
-
ref={forwardedRef}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { createKvsStore } from '@dxos/effect';
|
|
9
|
-
import { createEditorStateStore } from '@dxos/ui-editor';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../../meta';
|
|
12
|
-
import { MarkdownCapabilities, MarkdownStateSchema } from '../../types';
|
|
13
|
-
|
|
14
|
-
export default Capability.makeModule(
|
|
15
|
-
Effect.fnUntraced(function* () {
|
|
16
|
-
// Persisted state using KVS store.
|
|
17
|
-
const stateAtom = createKvsStore({
|
|
18
|
-
key: `${meta.id}/state`,
|
|
19
|
-
schema: MarkdownStateSchema,
|
|
20
|
-
defaultValue: () => ({ viewMode: {} }),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// TODO(wittjosiah): Fold into state.
|
|
24
|
-
const editorState = createEditorStateStore(`${meta.id}/editor`);
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
Capability.contributes(MarkdownCapabilities.State, stateAtom),
|
|
28
|
-
Capability.contributes(MarkdownCapabilities.EditorState, editorState),
|
|
29
|
-
];
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { Card } from '@dxos/react-ui-mosaic';
|
|
10
|
-
import { Text } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../../meta';
|
|
13
|
-
import { Markdown } from '../../types';
|
|
14
|
-
import { getContentSnippet, getFallbackName } from '../../util';
|
|
15
|
-
import { MarkdownEditor } from '../MarkdownEditor';
|
|
16
|
-
|
|
17
|
-
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
18
|
-
|
|
19
|
-
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
20
|
-
const { t } = useTranslation(meta.id);
|
|
21
|
-
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
22
|
-
const info = getInfo(subject);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Card.Content>
|
|
26
|
-
{snippet && (
|
|
27
|
-
<div className='max-h-[300px] overflow-hidden'>
|
|
28
|
-
<MarkdownEditor.Root id={subject.id} viewMode='readonly'>
|
|
29
|
-
<MarkdownEditor.Content initialValue={snippet} slots={{}} classNames='!bg-transparent' />
|
|
30
|
-
</MarkdownEditor.Root>
|
|
31
|
-
</div>
|
|
32
|
-
)}
|
|
33
|
-
<Card.Text classNames='text-xs text-description'>
|
|
34
|
-
{info.words} {t('words label', { count: info.words })}
|
|
35
|
-
</Card.Text>
|
|
36
|
-
</Card.Content>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
41
|
-
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
42
|
-
return { words: text.split(' ').length };
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// TODO(burdon): Factor out.
|
|
46
|
-
const getTitle = (subject: Markdown.Document | Text.Text, fallback: string) => {
|
|
47
|
-
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
48
|
-
const title = Obj.getLabel(subject);
|
|
49
|
-
return title ?? getFallbackName(subject.content?.target?.content ?? fallback);
|
|
50
|
-
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
51
|
-
return getFallbackName(subject.content);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// TODO(burdon): Factor out.
|
|
56
|
-
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
57
|
-
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
58
|
-
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback);
|
|
59
|
-
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
60
|
-
return getContentSnippet(subject.content ?? fallback);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Extension } from '@codemirror/state';
|
|
6
|
-
import { Atom } from '@effect-atom/atom-react';
|
|
7
|
-
import React, { forwardRef, useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
|
-
import { type SurfaceComponentProps, useAppGraph, useCapabilities } from '@dxos/app-framework/react';
|
|
11
|
-
import { Obj } from '@dxos/echo';
|
|
12
|
-
import { useActionRunner } from '@dxos/plugin-graph';
|
|
13
|
-
import { useObject } from '@dxos/react-client/echo';
|
|
14
|
-
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
15
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
16
|
-
import { Text } from '@dxos/schema';
|
|
17
|
-
|
|
18
|
-
import { useLinkQuery } from '../hooks';
|
|
19
|
-
import { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '../types';
|
|
20
|
-
|
|
21
|
-
import { MarkdownEditor, type MarkdownEditorContentProps, type MarkdownEditorRootProps } from './MarkdownEditor';
|
|
22
|
-
|
|
23
|
-
export type MarkdownContainerProps = SurfaceComponentProps<
|
|
24
|
-
Markdown.Document | Text.Text,
|
|
25
|
-
{
|
|
26
|
-
id: string;
|
|
27
|
-
settings: Markdown.Settings;
|
|
28
|
-
selectionManager?: SelectionManager;
|
|
29
|
-
} & Pick<MarkdownEditorRootProps, 'viewMode' | 'onViewModeChange'> &
|
|
30
|
-
Pick<MarkdownEditorContentProps, 'editorStateStore'> &
|
|
31
|
-
Pick<MarkdownPluginState, 'extensionProviders'>
|
|
32
|
-
>;
|
|
33
|
-
|
|
34
|
-
export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerProps>(
|
|
35
|
-
({ role, subject: object, id, settings, extensionProviders, ...props }, forwardedRef) => {
|
|
36
|
-
const db = Obj.isObject(object) ? Obj.getDatabase(object) : undefined;
|
|
37
|
-
const attendableId = Obj.instanceOf(Markdown.Document, object) ? Obj.getDXN(object).toString() : undefined;
|
|
38
|
-
const [docContent] = useObject(Obj.instanceOf(Markdown.Document, object) ? object.content : undefined, 'content');
|
|
39
|
-
const [textContent] = useObject(Obj.instanceOf(Text.Text, object) ? object : undefined, 'content');
|
|
40
|
-
const initialValue = docContent ?? textContent;
|
|
41
|
-
|
|
42
|
-
// Extensions from other plugins.
|
|
43
|
-
// TODO(burdon): Document MarkdownPluginState.extensionProviders
|
|
44
|
-
const otherExtensionProviders = useCapabilities(MarkdownCapabilities.Extensions);
|
|
45
|
-
const extensions = useMemo<Extension[]>(() => {
|
|
46
|
-
if (!Obj.instanceOf(Markdown.Document, object) && !Obj.instanceOf(Text.Text, object)) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]
|
|
51
|
-
.flat()
|
|
52
|
-
.reduce((acc: Extension[], provider) => {
|
|
53
|
-
const extension =
|
|
54
|
-
typeof provider === 'function' ? provider({ document: object as Markdown.Document }) : provider;
|
|
55
|
-
if (extension) {
|
|
56
|
-
acc.push(extension);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return acc;
|
|
60
|
-
}, []);
|
|
61
|
-
}, [extensionProviders, otherExtensionProviders, object]);
|
|
62
|
-
|
|
63
|
-
// Toolbar actions from app graph.
|
|
64
|
-
const { graph } = useAppGraph();
|
|
65
|
-
const runAction = useActionRunner();
|
|
66
|
-
const customActions = useMemo(() => {
|
|
67
|
-
return Atom.make((get) => {
|
|
68
|
-
const actions = get(graph.actions(id));
|
|
69
|
-
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
70
|
-
const edges = nodes.map((node) => ({ source: 'root', target: node.id }));
|
|
71
|
-
return { nodes, edges };
|
|
72
|
-
});
|
|
73
|
-
}, [graph]);
|
|
74
|
-
|
|
75
|
-
// File upload.
|
|
76
|
-
const [upload] = useCapabilities(Common.Capability.FileUploader);
|
|
77
|
-
const handleFileUpload = useMemo(() => {
|
|
78
|
-
if (!db || !upload) {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return async (file: File) => upload(db, file);
|
|
83
|
-
}, [db, upload]);
|
|
84
|
-
|
|
85
|
-
// Query for @ refs.
|
|
86
|
-
const handleLinkQuery = useLinkQuery(db);
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<Layout.Main toolbar={settings.toolbar} ref={forwardedRef}>
|
|
90
|
-
<MarkdownEditor.Root
|
|
91
|
-
id={attendableId ?? id}
|
|
92
|
-
object={object}
|
|
93
|
-
extensions={extensions}
|
|
94
|
-
settings={settings}
|
|
95
|
-
onAction={runAction}
|
|
96
|
-
onFileUpload={handleFileUpload}
|
|
97
|
-
onLinkQuery={handleLinkQuery}
|
|
98
|
-
{...props}
|
|
99
|
-
>
|
|
100
|
-
{settings.toolbar && (
|
|
101
|
-
<MarkdownEditor.Toolbar id={attendableId ?? id} role={role} customActions={customActions} />
|
|
102
|
-
)}
|
|
103
|
-
<MarkdownEditor.Content initialValue={initialValue} scrollPastEnd={role === 'article'} />
|
|
104
|
-
<MarkdownEditor.Blocks />
|
|
105
|
-
</MarkdownEditor.Root>
|
|
106
|
-
</Layout.Main>
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
export default MarkdownContainer;
|