@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
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { MemoizedAiService } from '@dxos/ai/testing';
|
|
9
|
+
import { AgentService } from '@dxos/assistant';
|
|
10
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
11
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
12
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
13
|
+
import { Database, Feed, Obj, Query, Ref } from '@dxos/echo';
|
|
14
|
+
import { Collection } from '@dxos/echo';
|
|
15
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
16
|
+
import { FunctionInvocationService } from '@dxos/functions';
|
|
17
|
+
import { invariant } from '@dxos/invariant';
|
|
18
|
+
import { ObjectId } from '@dxos/keys';
|
|
19
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
20
|
+
import { HasSubject } from '@dxos/types';
|
|
21
|
+
import { trim } from '@dxos/util';
|
|
22
|
+
|
|
23
|
+
import { WithProperties } from '#testing';
|
|
24
|
+
|
|
25
|
+
import MarkdownBlueprint from '../blueprints/markdown-blueprint';
|
|
26
|
+
import { Update } from './definitions';
|
|
27
|
+
import { MarkdownOperationHandlerSet } from './index';
|
|
28
|
+
|
|
29
|
+
ObjectId.dangerouslyDisableRandomness();
|
|
30
|
+
|
|
31
|
+
const TestLayer = AssistantTestLayer({
|
|
32
|
+
aiServicePreset: 'edge-remote',
|
|
33
|
+
operationHandlers: MarkdownOperationHandlerSet,
|
|
34
|
+
types: [
|
|
35
|
+
SpaceProperties,
|
|
36
|
+
Collection.Collection,
|
|
37
|
+
Blueprint.Blueprint,
|
|
38
|
+
Markdown.Document,
|
|
39
|
+
HasSubject.HasSubject,
|
|
40
|
+
Feed.Feed,
|
|
41
|
+
],
|
|
42
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
43
|
+
tracing: 'pretty',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('update', () => {
|
|
47
|
+
it.effect(
|
|
48
|
+
'call a function to update a markdown document',
|
|
49
|
+
Effect.fnUntraced(
|
|
50
|
+
function* (_) {
|
|
51
|
+
const doc = Markdown.make({
|
|
52
|
+
name: 'BlueYard',
|
|
53
|
+
content: 'Founders and portfolio of BlueYard.',
|
|
54
|
+
});
|
|
55
|
+
yield* Database.add(doc);
|
|
56
|
+
|
|
57
|
+
yield* FunctionInvocationService.invokeFunction(Update, {
|
|
58
|
+
doc: Ref.make(doc),
|
|
59
|
+
edits: [{ oldString: 'Founders', newString: '# Founders' }],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const updatedDoc = yield* Database.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
63
|
+
expect(updatedDoc.name).toBe(doc.name);
|
|
64
|
+
const text = yield* Database.load(updatedDoc.content);
|
|
65
|
+
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
66
|
+
},
|
|
67
|
+
WithProperties,
|
|
68
|
+
Effect.provide(TestLayer),
|
|
69
|
+
TestHelpers.provideTestContext,
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
it.effect(
|
|
74
|
+
'create and update a markdown document',
|
|
75
|
+
Effect.fnUntraced(
|
|
76
|
+
function* (_) {
|
|
77
|
+
const agent = yield* AgentService.createSession({
|
|
78
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
yield* agent.submitPrompt('Create a document with a cookie recipe.');
|
|
82
|
+
yield* agent.waitForCompletion();
|
|
83
|
+
{
|
|
84
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
85
|
+
if (docs.length !== 1) {
|
|
86
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const doc = docs[0];
|
|
90
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
91
|
+
console.log({
|
|
92
|
+
name: doc.name,
|
|
93
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
yield* agent.submitPrompt('Add a section with a holiday-themed variation.');
|
|
98
|
+
yield* agent.waitForCompletion();
|
|
99
|
+
{
|
|
100
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
101
|
+
if (docs.length !== 1) {
|
|
102
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const doc = docs[0];
|
|
106
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
107
|
+
console.log({
|
|
108
|
+
name: doc.name,
|
|
109
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
WithProperties,
|
|
114
|
+
Effect.provide(TestLayer),
|
|
115
|
+
TestHelpers.provideTestContext,
|
|
116
|
+
),
|
|
117
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
it.effect(
|
|
121
|
+
'update existing document',
|
|
122
|
+
Effect.fnUntraced(
|
|
123
|
+
function* (_) {
|
|
124
|
+
const document = yield* Database.add(
|
|
125
|
+
Markdown.make({
|
|
126
|
+
name: 'Cookie Recipe',
|
|
127
|
+
content: trim`
|
|
128
|
+
Ingredients:
|
|
129
|
+
- 2 cups of ???
|
|
130
|
+
- 1 cup of sugar
|
|
131
|
+
- 1 cup of butter
|
|
132
|
+
- 1 cup of eggs
|
|
133
|
+
`,
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
136
|
+
const agent = yield* AgentService.createSession({
|
|
137
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
138
|
+
context: [Ref.make(document)],
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
yield* agent.submitPrompt('Add the missing ingredient (its flour).');
|
|
142
|
+
yield* agent.waitForCompletion();
|
|
143
|
+
|
|
144
|
+
{
|
|
145
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
146
|
+
if (docs.length !== 1) {
|
|
147
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const doc = docs[0];
|
|
151
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
152
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
153
|
+
console.log({
|
|
154
|
+
name: doc.name,
|
|
155
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
156
|
+
});
|
|
157
|
+
expect(content.toLowerCase()).toContain('flour');
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
WithProperties,
|
|
161
|
+
Effect.provide(TestLayer),
|
|
162
|
+
TestHelpers.provideTestContext,
|
|
163
|
+
),
|
|
164
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
it.effect(
|
|
168
|
+
'add lines to document one by one',
|
|
169
|
+
Effect.fnUntraced(
|
|
170
|
+
function* (_) {
|
|
171
|
+
const document = yield* Database.add(
|
|
172
|
+
Markdown.make({
|
|
173
|
+
name: 'Shopping list',
|
|
174
|
+
content: trim`
|
|
175
|
+
# Shopping list
|
|
176
|
+
`,
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
const agent = yield* AgentService.createSession({
|
|
180
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
181
|
+
context: [Ref.make(document)],
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
yield* agent.submitPrompt('Add milk to the shopping list.');
|
|
185
|
+
yield* agent.waitForCompletion();
|
|
186
|
+
yield* agent.submitPrompt('Add bread to the shopping list.');
|
|
187
|
+
yield* agent.waitForCompletion();
|
|
188
|
+
yield* agent.submitPrompt('Add eggs to the shopping list.');
|
|
189
|
+
yield* agent.waitForCompletion();
|
|
190
|
+
|
|
191
|
+
{
|
|
192
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
193
|
+
if (docs.length !== 1) {
|
|
194
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const doc = docs[0];
|
|
198
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
199
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
200
|
+
console.log({
|
|
201
|
+
name: doc.name,
|
|
202
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
203
|
+
});
|
|
204
|
+
expect(content.toLowerCase()).toContain('milk');
|
|
205
|
+
expect(content.toLowerCase()).toContain('bread');
|
|
206
|
+
expect(content.toLowerCase()).toContain('eggs');
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
WithProperties,
|
|
210
|
+
Effect.provide(TestLayer),
|
|
211
|
+
TestHelpers.provideTestContext,
|
|
212
|
+
),
|
|
213
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
214
|
+
);
|
|
215
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { next as A, type Doc } from '@automerge/automerge';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
11
|
+
|
|
12
|
+
import { Update } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof Update> = Update.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fn(function* ({ doc, edits }) {
|
|
17
|
+
const content = yield* doc.pipe(
|
|
18
|
+
Database.load,
|
|
19
|
+
Effect.map((_) => _.content),
|
|
20
|
+
Effect.flatMap(Database.load),
|
|
21
|
+
);
|
|
22
|
+
const accessor = createDocAccessor(content, ['content']);
|
|
23
|
+
|
|
24
|
+
for (const edit of edits) {
|
|
25
|
+
accessor.handle.change((doc: Doc<typeof content>) => {
|
|
26
|
+
const text = DocAccessor.getValue<string>(accessor);
|
|
27
|
+
if (edit.replaceAll) {
|
|
28
|
+
let idx = text.indexOf(edit.oldString);
|
|
29
|
+
while (idx !== -1) {
|
|
30
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
31
|
+
const updated = DocAccessor.getValue<string>(accessor);
|
|
32
|
+
idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
const idx = text.indexOf(edit.oldString);
|
|
36
|
+
if (idx === -1) {
|
|
37
|
+
throw new Error(`Edit not found: ${JSON.stringify(edit.oldString)}`);
|
|
38
|
+
}
|
|
39
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
newContent: DocAccessor.getValue<string>(accessor),
|
|
46
|
+
};
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default handler;
|
package/src/testing.ts
CHANGED
|
@@ -8,14 +8,14 @@ import * as Effect from 'effect/Effect';
|
|
|
8
8
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
9
|
import { Obj, Ref } from '@dxos/echo';
|
|
10
10
|
import { Database } from '@dxos/echo';
|
|
11
|
-
import { Collection } from '@dxos/
|
|
11
|
+
import { Collection } from '@dxos/echo';
|
|
12
12
|
|
|
13
13
|
// TODO(wittjosiah): Factor out.
|
|
14
14
|
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield* 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,51 +3,65 @@
|
|
|
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
|
-
import { meta } from '
|
|
8
|
-
import { Markdown } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
|
+
import { Markdown } from '#types';
|
|
9
10
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
14
|
[Markdown.Document.typename]: {
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'object
|
|
15
|
+
'typename.label': 'Document',
|
|
16
|
+
'typename.label_zero': 'Documents',
|
|
17
|
+
'typename.label_one': 'Document',
|
|
18
|
+
'typename.label_other': 'Documents',
|
|
19
|
+
'object-name.placeholder': 'New document',
|
|
20
|
+
'add-object.label': 'Add document',
|
|
21
|
+
'rename-object.label': 'Rename document',
|
|
22
|
+
'delete-object.label': 'Delete document',
|
|
23
|
+
'object-deleted.label': 'Document deleted',
|
|
22
24
|
},
|
|
23
25
|
[meta.id]: {
|
|
24
|
-
'plugin
|
|
25
|
-
'settings
|
|
26
|
-
'choose
|
|
26
|
+
'plugin.name': 'Editor',
|
|
27
|
+
'settings.title': 'Editor settings',
|
|
28
|
+
'choose-markdown-from-space-dialog.title': 'Choose one or more documents to add',
|
|
27
29
|
// TODO(burdon): Style-guide for user-facing text (e.g., hints, questions, capitalization, etc.)
|
|
28
|
-
'empty
|
|
29
|
-
'chooser
|
|
30
|
-
'editor
|
|
31
|
-
'editor
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'settings
|
|
35
|
-
'settings
|
|
36
|
-
'settings
|
|
37
|
-
'settings
|
|
38
|
-
'settings
|
|
39
|
-
'settings
|
|
40
|
-
'settings
|
|
41
|
-
'settings
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
30
|
+
'empty-choose-markdown-from-space.message': 'None available; try creating a new one instead?',
|
|
31
|
+
'chooser-done.label': 'Add selected',
|
|
32
|
+
'editor.placeholder': 'Start typing…',
|
|
33
|
+
'editor-input-mode.label': 'Editor input mode',
|
|
34
|
+
'editor-input-mode.description': 'Choose keyboard bindings for the editor.',
|
|
35
|
+
'select-editor-input-mode.placeholder': 'Select editor input mode…',
|
|
36
|
+
'settings.editor-input-mode.default.label': 'Default',
|
|
37
|
+
'settings.editor-input-mode.vim.label': 'Vim',
|
|
38
|
+
'settings.editor-input-mode.vscode.label': 'VS Code',
|
|
39
|
+
'settings.toolbar.label': 'Show toolbar',
|
|
40
|
+
'settings.toolbar.description': 'Display a formatting toolbar above the editor.',
|
|
41
|
+
'settings.numbered-headings.label': 'Numbered headings',
|
|
42
|
+
'settings.numbered-headings.description': 'Automatically number heading levels in the document.',
|
|
43
|
+
'settings.folding.label': 'Folding',
|
|
44
|
+
'settings.folding.description': 'Allow collapsing and expanding sections by heading.',
|
|
45
|
+
'settings.experimental.label': 'Enable experimental features',
|
|
46
|
+
'settings.experimental.description': 'Turn on features that are still in development.',
|
|
47
|
+
'settings.debug.label': 'Enable debugging features',
|
|
48
|
+
'settings.debug.description': 'Show developer tools and diagnostics for the editor.',
|
|
49
|
+
'settings.debug-typewriter.label': 'Typewriter script',
|
|
50
|
+
'settings.debug-typewriter.description': 'Script to replay typed input for testing purposes.',
|
|
51
|
+
'settings.debug-typewriter.placeholder': 'Typewriter script...',
|
|
52
|
+
'toggle-view-mode.label': 'Toggle read-only',
|
|
53
|
+
'default-view-mode.label': 'Default view mode',
|
|
54
|
+
'default-view-mode.description': 'Set whether documents open in editing or read-only mode.',
|
|
55
|
+
'upload-image.label': 'Upload image',
|
|
56
|
+
'fallback.title': 'Untitled',
|
|
57
|
+
'navigate-to-document.label': 'Open document',
|
|
58
|
+
|
|
59
|
+
'words.label': 'words',
|
|
60
|
+
'words.label_zero': 'words',
|
|
61
|
+
'words.label_one': 'word',
|
|
62
|
+
'words.label_other': 'words',
|
|
50
63
|
},
|
|
51
64
|
},
|
|
52
65
|
},
|
|
66
|
+
...editorTranslations,
|
|
53
67
|
] as const satisfies Resource[];
|
package/src/types/Markdown.ts
CHANGED
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
7
|
+
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
9
|
import { Text } from '@dxos/schema';
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
// Re-export Settings as merged const/type (not as namespace).
|
|
12
|
+
import * as SettingsModule from './Settings';
|
|
13
|
+
export const Settings = SettingsModule.Settings;
|
|
14
|
+
export type Settings = SettingsModule.Settings;
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* Document Item type.
|
|
@@ -16,14 +20,18 @@ export const Document = Schema.Struct({
|
|
|
16
20
|
name: Schema.optional(Schema.String),
|
|
17
21
|
description: Schema.optional(Schema.String),
|
|
18
22
|
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
|
-
content:
|
|
23
|
+
content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
24
|
}).pipe(
|
|
21
25
|
Type.object({
|
|
22
|
-
typename: 'dxos.
|
|
26
|
+
typename: 'org.dxos.type.document',
|
|
23
27
|
version: '0.1.0',
|
|
24
28
|
}),
|
|
25
29
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
30
|
DescriptionAnnotation.set('description'),
|
|
31
|
+
Annotation.IconAnnotation.set({
|
|
32
|
+
icon: 'ph--text-aa--regular',
|
|
33
|
+
hue: 'indigo',
|
|
34
|
+
}),
|
|
27
35
|
);
|
|
28
36
|
|
|
29
37
|
export type Document = Schema.Schema.Type<typeof Document>;
|
|
@@ -34,24 +42,9 @@ export type Document = Schema.Schema.Type<typeof Document>;
|
|
|
34
42
|
export const make = ({
|
|
35
43
|
content = '',
|
|
36
44
|
...props
|
|
37
|
-
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) =>
|
|
38
|
-
Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export const Settings = Schema.mutable(
|
|
44
|
-
Schema.Struct({
|
|
45
|
-
defaultViewMode: EditorViewMode,
|
|
46
|
-
editorInputMode: Schema.optional(EditorInputMode),
|
|
47
|
-
experimental: Schema.optional(Schema.Boolean),
|
|
48
|
-
debug: Schema.optional(Schema.Boolean),
|
|
49
|
-
toolbar: Schema.optional(Schema.Boolean),
|
|
50
|
-
typewriter: Schema.optional(Schema.String),
|
|
51
|
-
// TODO(burdon): Per document settings.
|
|
52
|
-
numberedHeadings: Schema.optional(Schema.Boolean),
|
|
53
|
-
folding: Schema.optional(Schema.Boolean),
|
|
54
|
-
}),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
|
45
|
+
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {
|
|
46
|
+
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make({ content })) });
|
|
47
|
+
// TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.
|
|
48
|
+
Obj.setParent(doc.content.target!, doc);
|
|
49
|
+
return doc;
|
|
50
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Plugin settings.
|
|
13
|
+
*/
|
|
14
|
+
export const Settings = Schema.mutable(
|
|
15
|
+
Schema.Struct({
|
|
16
|
+
defaultViewMode: EditorViewMode,
|
|
17
|
+
editorInputMode: Schema.optional(EditorInputMode),
|
|
18
|
+
experimental: Schema.optional(Schema.Boolean),
|
|
19
|
+
debug: Schema.optional(Schema.Boolean),
|
|
20
|
+
toolbar: Schema.optional(Schema.Boolean),
|
|
21
|
+
typewriter: Schema.optional(Schema.String),
|
|
22
|
+
// TODO(burdon): Per document settings.
|
|
23
|
+
numberedHeadings: Schema.optional(Schema.Boolean),
|
|
24
|
+
folding: Schema.optional(Schema.Boolean),
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export type Settings = Schema.Schema.Type<typeof Settings>;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
5
6
|
import { type Atom } from '@effect-atom/atom-react';
|
|
6
7
|
import * as Schema from 'effect/Schema';
|
|
7
8
|
|
|
8
9
|
import { Capability } from '@dxos/app-framework';
|
|
9
10
|
import { type EditorStateStore, type EditorViewMode } from '@dxos/ui-editor';
|
|
10
11
|
|
|
11
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
12
13
|
|
|
13
14
|
import type * as Markdown from './Markdown';
|
|
14
15
|
import { type MarkdownExtensionProvider } from './types';
|
|
@@ -24,15 +25,26 @@ export type MarkdownState = {
|
|
|
24
25
|
viewMode: Record<string, EditorViewMode>;
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
export type EditorViewEntry = { view: EditorView; documentId: string };
|
|
29
|
+
|
|
30
|
+
export type EditorViewRegistry = {
|
|
31
|
+
register: (attendableId: string, view: EditorView, documentId: string) => void;
|
|
32
|
+
unregister: (attendableId: string) => void;
|
|
33
|
+
get: (attendableId: string) => EditorViewEntry | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
27
36
|
export namespace MarkdownCapabilities {
|
|
28
|
-
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}
|
|
37
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}.capability.settings`);
|
|
29
38
|
|
|
30
39
|
/** Persisted state atom for view mode per document. */
|
|
31
|
-
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}
|
|
40
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}.capability.state`);
|
|
32
41
|
|
|
33
42
|
/** Editor state store for cursor positions, scroll state, etc. */
|
|
34
|
-
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}
|
|
43
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}.capability.editor-state`);
|
|
44
|
+
|
|
45
|
+
/** Registry of active EditorView instances keyed by attendable ID. */
|
|
46
|
+
export const EditorViews = Capability.make<EditorViewRegistry>(`${meta.id}.capability.editor-views`);
|
|
35
47
|
|
|
36
48
|
// TODO(burdon): Move to ./types (external API)?
|
|
37
|
-
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}
|
|
49
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}.capability.extensions`);
|
|
38
50
|
}
|
package/src/types/events.ts
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ActivationEvent
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
8
9
|
|
|
9
10
|
export namespace MarkdownEvents {
|
|
10
|
-
export const SetupExtensions: ActivationEvent.ActivationEvent =
|
|
11
|
-
`${meta.id}
|
|
11
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
12
|
+
`${meta.id}.event.setup-extensions`,
|
|
12
13
|
);
|
|
13
14
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * as MarkdownAction from './MarkdownAction';
|
|
6
|
-
export { MarkdownOperation } from './MarkdownAction';
|
|
7
|
-
export * as Markdown from './Markdown';
|
|
8
|
-
|
|
9
5
|
export * from './capabilities';
|
|
10
6
|
export * from './events';
|
|
11
7
|
export * from './types';
|
|
8
|
+
|
|
9
|
+
export * as Markdown from './Markdown';
|
|
10
|
+
export * as Settings from './Settings';
|
package/src/util.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { debounce } from '@dxos/async';
|
|
|
6
6
|
import { Obj } from '@dxos/echo';
|
|
7
7
|
import { type TypedObjectSerializer } from '@dxos/plugin-space/types';
|
|
8
8
|
|
|
9
|
-
import { Markdown } from '
|
|
9
|
+
import { Markdown } from '#types';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Checks if an object conforms to the interface needed to render an editor.
|
|
@@ -104,20 +104,20 @@ export const getFallbackName = (content = ''): string => {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
// TODO(burdon): Option to strip Markdown.
|
|
107
|
-
export const getContentSnippet = (content = '') => {
|
|
107
|
+
export const getContentSnippet = (content = '', maxLines = 3) => {
|
|
108
108
|
const abstract = content
|
|
109
109
|
.split('\n')
|
|
110
110
|
.filter((line) => !line.startsWith('!'))
|
|
111
111
|
.filter((line) => line.trim() !== '');
|
|
112
112
|
|
|
113
|
-
return abstract.slice(0,
|
|
113
|
+
return abstract.slice(0, maxLines).join('\n') ?? '';
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
117
117
|
const name = getFallbackName(content);
|
|
118
118
|
if (doc.fallbackName !== name) {
|
|
119
|
-
Obj.change(doc, (
|
|
120
|
-
|
|
119
|
+
Obj.change(doc, (doc) => {
|
|
120
|
+
doc.fallbackName = name;
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
}, 200);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownCard,
|
|
3
|
-
MarkdownCard_default
|
|
4
|
-
} from "./chunk-VQ3WOAB6.mjs";
|
|
5
|
-
import "./chunk-BX73DASG.mjs";
|
|
6
|
-
import "./chunk-S45ULIOG.mjs";
|
|
7
|
-
import "./chunk-LMO5UVKL.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownCard,
|
|
10
|
-
MarkdownCard_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownCard-HFNNE4B4.mjs.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownContainer,
|
|
3
|
-
MarkdownContainer_default
|
|
4
|
-
} from "./chunk-KDKXFKDN.mjs";
|
|
5
|
-
import "./chunk-BX73DASG.mjs";
|
|
6
|
-
import "./chunk-S45ULIOG.mjs";
|
|
7
|
-
import "./chunk-LMO5UVKL.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownContainer,
|
|
10
|
-
MarkdownContainer_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownContainer-V7EAADMF.mjs.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Markdown_exports
|
|
3
|
-
} from "./chunk-LMO5UVKL.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/anchor-sort/anchor-sort.ts
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
8
|
-
import { Relation } from "@dxos/echo";
|
|
9
|
-
import { createDocAccessor, getRangeFromCursor } from "@dxos/echo-db";
|
|
10
|
-
var anchor_sort_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.AnchorSort, {
|
|
11
|
-
key: Markdown_exports.Document.typename,
|
|
12
|
-
sort: (anchorA, anchorB) => {
|
|
13
|
-
const doc = Relation.getTarget(anchorA);
|
|
14
|
-
const accessor = doc.content.target ? createDocAccessor(doc.content.target, [
|
|
15
|
-
"content"
|
|
16
|
-
]) : void 0;
|
|
17
|
-
if (doc !== Relation.getTarget(anchorB) || !accessor) {
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
const getStartPosition = (cursor) => {
|
|
21
|
-
const range = cursor ? getRangeFromCursor(accessor, cursor) : void 0;
|
|
22
|
-
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
23
|
-
};
|
|
24
|
-
const posA = getStartPosition(anchorA.anchor);
|
|
25
|
-
const posB = getStartPosition(anchorB.anchor);
|
|
26
|
-
return posA - posB;
|
|
27
|
-
}
|
|
28
|
-
})));
|
|
29
|
-
export {
|
|
30
|
-
anchor_sort_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=anchor-sort-WQ3TL7ZI.mjs.map
|