@dxos/plugin-markdown 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/EditableMarkdownCard-AW7MD35U.mjs +34 -0
- package/dist/lib/neutral/EditableMarkdownCard-AW7MD35U.mjs.map +7 -0
- package/dist/lib/{browser/MarkdownContainer-KER2N5M2.mjs → neutral/MarkdownArticle-Z4QRU3WD.mjs} +52 -34
- package/dist/lib/neutral/MarkdownArticle-Z4QRU3WD.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownCard-36P4AHYL.mjs +107 -0
- package/dist/lib/neutral/MarkdownCard-36P4AHYL.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs +58 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.node.mjs +25 -0
- package/dist/lib/neutral/MarkdownPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs +23 -0
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs +32 -0
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs.map +7 -0
- package/dist/lib/{browser/anchor-sort-EHJGOCYW.mjs → neutral/anchor-sort-37GOHBLW.mjs} +6 -8
- package/dist/lib/neutral/anchor-sort-37GOHBLW.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-serializer-QBZDVASK.mjs → neutral/app-graph-serializer-EN5E3BMG.mjs} +14 -18
- package/dist/lib/neutral/app-graph-serializer-EN5E3BMG.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-33OK2KUL.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-33OK2KUL.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +2 -3
- package/dist/lib/neutral/capabilities/index.mjs +25 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +11 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs +30 -0
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A45UVZEH.mjs +285 -0
- package/dist/lib/neutral/chunk-A45UVZEH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-E5NVTEKQ.mjs +8 -0
- package/dist/lib/neutral/chunk-E5NVTEKQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs +98 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LXNSKCPD.mjs +44 -0
- package/dist/lib/neutral/chunk-LXNSKCPD.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-ZEA66BUR.mjs +31 -0
- package/dist/lib/neutral/comment-config-ZEA66BUR.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +371 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-HONLDBVT.mjs +28 -0
- package/dist/lib/neutral/create-HONLDBVT.mjs.map +7 -0
- package/dist/lib/neutral/create-markdown-UCPD2Z3V.mjs +20 -0
- package/dist/lib/neutral/create-markdown-UCPD2Z3V.mjs.map +7 -0
- package/dist/lib/neutral/create-object-VU3KX663.mjs +28 -0
- package/dist/lib/neutral/create-object-VU3KX663.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +316 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +42 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/open-VVDMNJ7J.mjs +20 -0
- package/dist/lib/neutral/open-VVDMNJ7J.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-2ARMPBGZ.mjs +13 -0
- package/dist/lib/neutral/operation-handler-2ARMPBGZ.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{node-esm/react-surface-LC5CI6VP.mjs → neutral/react-surface-EMYFM37T.mjs} +45 -42
- package/dist/lib/neutral/react-surface-EMYFM37T.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-Y3P676QG.mjs +47 -0
- package/dist/lib/neutral/scroll-to-anchor-Y3P676QG.mjs.map +7 -0
- package/dist/lib/neutral/set-view-mode-JZB7UXIF.mjs +24 -0
- package/dist/lib/neutral/set-view-mode-JZB7UXIF.mjs.map +7 -0
- package/dist/lib/{browser/settings-7FMWKB7N.mjs → neutral/settings-TDGDLCUR.mjs} +7 -11
- package/dist/lib/neutral/settings-TDGDLCUR.mjs.map +7 -0
- package/dist/lib/neutral/state-5COCF5PN.mjs +44 -0
- package/dist/lib/neutral/state-5COCF5PN.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +30 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +44 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/update-markdown-F25F4EPF.mjs +44 -0
- package/dist/lib/neutral/update-markdown-F25F4EPF.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts +1 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → MarkdownPlugin.node.d.ts} +2 -1
- package/dist/types/src/MarkdownPlugin.node.d.ts.map +1 -0
- package/dist/types/src/MarkdownPlugin.test.d.ts +2 -0
- package/dist/types/src/MarkdownPlugin.test.d.ts.map +1 -0
- package/dist/types/src/MarkdownPlugin.workerd.d.ts +4 -0
- package/dist/types/src/MarkdownPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.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/comment-config.d.ts +12 -0
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +22 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +10 -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.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +1 -2
- 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/components/MarkdownEditor/MarkdownEditor.d.ts +33 -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 +6 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +6 -5
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +6 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +94 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +2 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.d.ts +15 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/EditableMarkdownCard/index.d.ts +3 -0
- package/dist/types/src/containers/EditableMarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts +40 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.stories.d.ts +97 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/index.d.ts +1 -2
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +17 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -3
- package/dist/types/src/containers/index.d.ts.map +1 -1
- 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/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +10 -6
- 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 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.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/index.d.ts +3 -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-markdown.d.ts +5 -0
- package/dist/types/src/operations/update-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +1 -0
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +70 -62
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +23 -22
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownCapabilities.d.ts +32 -0
- package/dist/types/src/types/MarkdownCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownEvents.d.ts +3 -0
- package/dist/types/src/types/MarkdownEvents.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownOperation.d.ts +64 -0
- package/dist/types/src/types/MarkdownOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +30 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -5
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -0
- package/dist/types/src/types/types.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 +133 -90
- package/src/MarkdownPlugin.node.ts +20 -0
- package/src/MarkdownPlugin.test.ts +26 -0
- package/src/MarkdownPlugin.tsx +15 -55
- package/src/MarkdownPlugin.workerd.ts +19 -0
- package/src/blueprints/markdown-blueprint.ts +9 -12
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +3 -3
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +14 -10
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/comment-config.ts +33 -0
- package/src/capabilities/create-object.ts +31 -0
- package/src/capabilities/index.ts +16 -7
- package/src/capabilities/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +128 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +2 -2
- package/src/capabilities/state.ts +47 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +39 -36
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +122 -94
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +27 -17
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +37 -57
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +40 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +35 -0
- package/src/components/MarkdownSettings/index.ts +5 -0
- package/src/components/index.ts +4 -0
- package/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.tsx +86 -0
- package/src/containers/EditableMarkdownCard/EditableMarkdownCard.tsx +44 -0
- package/src/containers/EditableMarkdownCard/index.ts +6 -0
- package/src/containers/{MarkdownContainer/MarkdownContainer.stories.tsx → MarkdownArticle/MarkdownArticle.stories.tsx} +31 -26
- package/src/containers/MarkdownArticle/MarkdownArticle.tsx +146 -0
- package/src/containers/MarkdownArticle/index.ts +6 -0
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +12 -12
- package/src/containers/MarkdownCard/MarkdownCard.tsx +38 -24
- package/src/containers/MarkdownCard/index.ts +1 -3
- package/src/containers/MarkdownCard/snippet.ts +54 -0
- package/src/containers/index.ts +3 -3
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +65 -42
- package/src/hooks/useLinkQuery.ts +42 -32
- package/src/index.ts +2 -6
- package/src/meta.ts +17 -7
- package/src/operations/create-markdown.ts +19 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/{blueprints/functions → operations}/create.test.ts +30 -26
- package/src/operations/create.ts +26 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +38 -0
- package/src/operations/set-view-mode.ts +23 -0
- package/src/operations/update-markdown.ts +51 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/{blueprints/functions → operations}/update.test.ts +50 -52
- package/src/plugin.ts +11 -0
- package/src/testing.ts +22 -9
- package/src/translations.ts +27 -38
- package/src/types/Markdown.ts +15 -31
- package/src/types/MarkdownCapabilities.ts +51 -0
- package/src/types/MarkdownEvents.ts +14 -0
- package/src/types/MarkdownOperation.ts +133 -0
- package/src/types/Settings.ts +85 -0
- package/src/types/index.ts +6 -6
- package/src/types/types.ts +4 -1
- package/src/util.tsx +4 -4
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs +0 -61
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs +0 -106
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs +0 -18
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +0 -7
- package/dist/lib/browser/chunk-7JEOX3X6.mjs +0 -783
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +0 -7
- package/dist/lib/browser/chunk-HK6EGNP5.mjs +0 -8
- package/dist/lib/browser/chunk-HK6EGNP5.mjs.map +0 -7
- package/dist/lib/browser/chunk-P3TN2W6M.mjs +0 -154
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJO5W5YX.mjs +0 -59
- package/dist/lib/browser/chunk-RJO5W5YX.mjs.map +0 -7
- package/dist/lib/browser/chunk-W24NJ6WB.mjs +0 -178
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBMRREXE.mjs +0 -28
- package/dist/lib/browser/chunk-YBMRREXE.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -35
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -157
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs +0 -54
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +0 -115
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +0 -7
- package/dist/lib/browser/settings-7FMWKB7N.mjs.map +0 -7
- package/dist/lib/browser/state-7UJKJDGE.mjs +0 -31
- package/dist/lib/browser/state-7UJKJDGE.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs +0 -62
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs +0 -109
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs +0 -107
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs +0 -35
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs +0 -61
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -10
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs +0 -60
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs +0 -10
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs +0 -784
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs +0 -179
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs +0 -29
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs +0 -155
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -36
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -158
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs +0 -55
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs +0 -39
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs.map +0 -7
- package/dist/lib/node-esm/state-EEPLRAOT.mjs +0 -32
- package/dist/lib/node-esm/state-EEPLRAOT.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -19
- 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 -42
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/open.d.ts +0 -14
- package/dist/types/src/blueprints/functions/open.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -19
- 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.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.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 -6
- 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.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.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/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +0 -27
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +0 -88
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +0 -3
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts +0 -8
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +0 -3
- package/dist/types/src/containers/MarkdownSettings/index.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/dist/types/src/types/capabilities.d.ts +0 -22
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/blueprints/functions/create.conversations.json +0 -1
- package/src/blueprints/functions/create.ts +0 -35
- package/src/blueprints/functions/index.ts +0 -15
- package/src/blueprints/functions/open.ts +0 -33
- package/src/blueprints/functions/update.conversations.json +0 -1
- package/src/blueprints/functions/update.ts +0 -79
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/app-graph-serializer/index.ts +0 -7
- package/src/capabilities/artifact-definition/artifact-definition.ts +0 -110
- package/src/capabilities/artifact-definition/index.ts +0 -7
- 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 -102
- 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/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -30
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +0 -114
- package/src/containers/MarkdownContainer/index.ts +0 -7
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +0 -122
- package/src/containers/MarkdownSettings/index.ts +0 -7
- package/src/hooks/useSelectCurrentThread.tsx +0 -61
- package/src/types/MarkdownAction.ts +0 -59
- package/src/types/capabilities.ts +0 -38
- package/src/types/events.ts +0 -14
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/types/src/capabilities/{anchor-sort/anchor-sort.d.ts → anchor-sort.d.ts} +0 -0
- /package/dist/types/src/capabilities/{app-graph-serializer/app-graph-serializer.d.ts → app-graph-serializer.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.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
|
@@ -4,33 +4,40 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Layer from 'effect/Layer';
|
|
8
7
|
|
|
9
8
|
import { MemoizedAiService } from '@dxos/ai/testing';
|
|
10
|
-
import { AiContextService, AiConversationService } from '@dxos/assistant';
|
|
11
|
-
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
12
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
13
9
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
14
|
-
import {
|
|
15
|
-
import { Collection } from '@dxos/echo';
|
|
10
|
+
import { Blueprint, Operation } from '@dxos/compute';
|
|
11
|
+
import { Collection, Database, Feed, Obj, Query, Ref } from '@dxos/echo';
|
|
16
12
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
|
-
import {
|
|
13
|
+
import { AgentService } from '@dxos/functions-runtime';
|
|
14
|
+
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
18
15
|
import { invariant } from '@dxos/invariant';
|
|
19
|
-
import {
|
|
20
|
-
import { Markdown } from '@dxos/plugin-markdown
|
|
16
|
+
import { EntityId } from '@dxos/keys';
|
|
17
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
21
18
|
import { HasSubject } from '@dxos/types';
|
|
22
19
|
import { trim } from '@dxos/util';
|
|
23
20
|
|
|
24
|
-
import { WithProperties } from '
|
|
25
|
-
import MarkdownBlueprint from '../markdown-blueprint';
|
|
21
|
+
import { WithProperties } from '#testing';
|
|
26
22
|
|
|
27
|
-
import
|
|
23
|
+
import MarkdownBlueprint from '../blueprints/markdown-blueprint';
|
|
24
|
+
import { MarkdownOperation } from '../types';
|
|
25
|
+
import { MarkdownOperationHandlerSet } from './index';
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
EntityId.dangerouslyDisableRandomness();
|
|
30
28
|
|
|
31
29
|
const TestLayer = AssistantTestLayer({
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
aiServicePreset: 'edge-remote',
|
|
31
|
+
operationHandlers: MarkdownOperationHandlerSet,
|
|
32
|
+
types: [
|
|
33
|
+
SpaceProperties,
|
|
34
|
+
Collection.Collection,
|
|
35
|
+
Blueprint.Blueprint,
|
|
36
|
+
Markdown.Document,
|
|
37
|
+
HasSubject.HasSubject,
|
|
38
|
+
Feed.Feed,
|
|
39
|
+
],
|
|
40
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
34
41
|
tracing: 'pretty',
|
|
35
42
|
});
|
|
36
43
|
|
|
@@ -45,12 +52,12 @@ describe('update', () => {
|
|
|
45
52
|
});
|
|
46
53
|
yield* Database.add(doc);
|
|
47
54
|
|
|
48
|
-
yield*
|
|
55
|
+
yield* Operation.invoke(MarkdownOperation.Update, {
|
|
49
56
|
doc: Ref.make(doc),
|
|
50
57
|
edits: [{ oldString: 'Founders', newString: '# Founders' }],
|
|
51
58
|
});
|
|
52
59
|
|
|
53
|
-
const updatedDoc = yield* Database.resolve(Obj.
|
|
60
|
+
const updatedDoc = yield* Database.resolve(Obj.getURI(doc), Markdown.Document);
|
|
54
61
|
expect(updatedDoc.name).toBe(doc.name);
|
|
55
62
|
const text = yield* Database.load(updatedDoc.content);
|
|
56
63
|
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
@@ -61,18 +68,16 @@ describe('update', () => {
|
|
|
61
68
|
),
|
|
62
69
|
);
|
|
63
70
|
|
|
64
|
-
it.
|
|
71
|
+
it.effect(
|
|
65
72
|
'create and update a markdown document',
|
|
66
73
|
Effect.fnUntraced(
|
|
67
74
|
function* (_) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
blueprints: [Ref.make(markdownBlueprint)],
|
|
75
|
+
const agent = yield* AgentService.createSession({
|
|
76
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
71
77
|
});
|
|
72
78
|
|
|
73
|
-
yield*
|
|
74
|
-
|
|
75
|
-
});
|
|
79
|
+
yield* agent.submitPrompt('Create a document with a cookie recipe.');
|
|
80
|
+
yield* agent.waitForCompletion();
|
|
76
81
|
{
|
|
77
82
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
78
83
|
if (docs.length !== 1) {
|
|
@@ -87,9 +92,8 @@ describe('update', () => {
|
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
yield*
|
|
91
|
-
|
|
92
|
-
});
|
|
95
|
+
yield* agent.submitPrompt('Add a section with a holiday-themed variation.');
|
|
96
|
+
yield* agent.waitForCompletion();
|
|
93
97
|
{
|
|
94
98
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
95
99
|
if (docs.length !== 1) {
|
|
@@ -105,13 +109,13 @@ describe('update', () => {
|
|
|
105
109
|
}
|
|
106
110
|
},
|
|
107
111
|
WithProperties,
|
|
108
|
-
Effect.provide(
|
|
112
|
+
Effect.provide(TestLayer),
|
|
109
113
|
TestHelpers.provideTestContext,
|
|
110
114
|
),
|
|
111
115
|
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
112
116
|
);
|
|
113
117
|
|
|
114
|
-
it.
|
|
118
|
+
it.effect(
|
|
115
119
|
'update existing document',
|
|
116
120
|
Effect.fnUntraced(
|
|
117
121
|
function* (_) {
|
|
@@ -127,15 +131,13 @@ describe('update', () => {
|
|
|
127
131
|
`,
|
|
128
132
|
}),
|
|
129
133
|
);
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
objects: [Ref.make(document)],
|
|
134
|
+
const agent = yield* AgentService.createSession({
|
|
135
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
136
|
+
context: [Ref.make(document)],
|
|
134
137
|
});
|
|
135
138
|
|
|
136
|
-
yield*
|
|
137
|
-
|
|
138
|
-
});
|
|
139
|
+
yield* agent.submitPrompt('Add the missing ingredient (its flour).');
|
|
140
|
+
yield* agent.waitForCompletion();
|
|
139
141
|
|
|
140
142
|
{
|
|
141
143
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
@@ -154,13 +156,13 @@ describe('update', () => {
|
|
|
154
156
|
}
|
|
155
157
|
},
|
|
156
158
|
WithProperties,
|
|
157
|
-
Effect.provide(
|
|
159
|
+
Effect.provide(TestLayer),
|
|
158
160
|
TestHelpers.provideTestContext,
|
|
159
161
|
),
|
|
160
162
|
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
161
163
|
);
|
|
162
164
|
|
|
163
|
-
it.
|
|
165
|
+
it.effect(
|
|
164
166
|
'add lines to document one by one',
|
|
165
167
|
Effect.fnUntraced(
|
|
166
168
|
function* (_) {
|
|
@@ -172,21 +174,17 @@ describe('update', () => {
|
|
|
172
174
|
`,
|
|
173
175
|
}),
|
|
174
176
|
);
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
objects: [Ref.make(document)],
|
|
177
|
+
const agent = yield* AgentService.createSession({
|
|
178
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
179
|
+
context: [Ref.make(document)],
|
|
179
180
|
});
|
|
180
181
|
|
|
181
|
-
yield*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
yield*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
yield* AiConversationService.run({
|
|
188
|
-
prompt: 'Add eggs to the shopping list.',
|
|
189
|
-
});
|
|
182
|
+
yield* agent.submitPrompt('Add milk to the shopping list.');
|
|
183
|
+
yield* agent.waitForCompletion();
|
|
184
|
+
yield* agent.submitPrompt('Add bread to the shopping list.');
|
|
185
|
+
yield* agent.waitForCompletion();
|
|
186
|
+
yield* agent.submitPrompt('Add eggs to the shopping list.');
|
|
187
|
+
yield* agent.waitForCompletion();
|
|
190
188
|
|
|
191
189
|
{
|
|
192
190
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
@@ -207,7 +205,7 @@ describe('update', () => {
|
|
|
207
205
|
}
|
|
208
206
|
},
|
|
209
207
|
WithProperties,
|
|
210
|
-
Effect.provide(
|
|
208
|
+
Effect.provide(TestLayer),
|
|
211
209
|
TestHelpers.provideTestContext,
|
|
212
210
|
),
|
|
213
211
|
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const MarkdownPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { MarkdownOperationHandlerSet } from './operations';
|
package/src/testing.ts
CHANGED
|
@@ -5,21 +5,34 @@
|
|
|
5
5
|
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
+
import { RootCollectionAnnotation } from '@dxos/app-toolkit';
|
|
8
9
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { Annotation, Collection, Database, Obj, Ref } from '@dxos/echo';
|
|
11
|
+
|
|
12
|
+
// Eager re-export of `MarkdownPlugin`. See `@dxos/plugin-testing/src/core.ts`
|
|
13
|
+
// for the rationale. Uses the `#plugin` subpath so the node-only build is
|
|
14
|
+
// re-exported in test environments, avoiding the browser-only `MarkdownPlugin.tsx`
|
|
15
|
+
// which references React-surface capabilities that are intentionally omitted
|
|
16
|
+
// from `capabilities/node.ts`.
|
|
17
|
+
export * from '#plugin';
|
|
12
18
|
|
|
13
19
|
// TODO(wittjosiah): Factor out.
|
|
14
20
|
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
21
|
Effect.zipRight(
|
|
16
22
|
Effect.gen(function* () {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
+
const collection = Collection.make({ objects: [] });
|
|
24
|
+
const properties = Obj.make(SpaceProperties, {});
|
|
25
|
+
yield* Database.add(collection);
|
|
26
|
+
yield* Database.add(properties);
|
|
27
|
+
// Both entities are in the DB before setting the annotation so Database.load
|
|
28
|
+
// works in CollectionModel.add (which uses the Effect DB context, not Ref.load).
|
|
29
|
+
Obj.update(properties, (properties) => {
|
|
30
|
+
const meta = Obj.getMeta(properties);
|
|
31
|
+
if (!meta.annotations) {
|
|
32
|
+
meta.annotations = {};
|
|
33
|
+
}
|
|
34
|
+
Annotation.setDictionary(meta.annotations, RootCollectionAnnotation, Ref.make(collection));
|
|
35
|
+
});
|
|
23
36
|
}),
|
|
24
37
|
effect,
|
|
25
38
|
);
|
package/src/translations.ts
CHANGED
|
@@ -2,52 +2,41 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
5
6
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
7
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor/translations';
|
|
7
8
|
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { Markdown } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { Markdown } from '#types';
|
|
10
11
|
|
|
11
12
|
export const translations = [
|
|
12
13
|
{
|
|
13
14
|
'en-US': {
|
|
14
|
-
[Markdown.Document
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'typename
|
|
19
|
-
'object
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'object
|
|
15
|
+
[Type.getTypename(Markdown.Document)]: {
|
|
16
|
+
'typename.label': 'Document',
|
|
17
|
+
'typename.label_zero': 'Documents',
|
|
18
|
+
'typename.label_one': 'Document',
|
|
19
|
+
'typename.label_other': 'Documents',
|
|
20
|
+
'object-name.placeholder': 'New document',
|
|
21
|
+
'add-object.label': 'Add document',
|
|
22
|
+
'rename-object.label': 'Rename document',
|
|
23
|
+
'delete-object.label': 'Delete document',
|
|
24
|
+
'object-deleted.label': 'Document deleted',
|
|
23
25
|
},
|
|
24
26
|
[meta.id]: {
|
|
25
|
-
'plugin
|
|
26
|
-
'
|
|
27
|
-
'choose
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'settings numbered headings label': 'Numbered headings',
|
|
39
|
-
'settings folding label': 'Folding',
|
|
40
|
-
'settings experimental label': 'Enable experimental features',
|
|
41
|
-
'settings debug label': 'Enable debugging features',
|
|
42
|
-
'settings debug placeholder': 'Typewriter script...',
|
|
43
|
-
'toggle view mode label': 'Toggle read-only',
|
|
44
|
-
'default view mode label': 'Default view mode',
|
|
45
|
-
'upload image label': 'Upload image',
|
|
46
|
-
'fallback title': 'Untitled',
|
|
47
|
-
'navigate to document label': 'Open document',
|
|
48
|
-
'words label_zero': 'words',
|
|
49
|
-
'words label_one': 'word',
|
|
50
|
-
'words label_other': 'words',
|
|
27
|
+
'plugin.name': 'Editor',
|
|
28
|
+
'choose-markdown-from-space-dialog.title': 'Choose one or more documents to add',
|
|
29
|
+
'empty-choose-markdown-from-space.message': 'None available; try creating a new one instead?',
|
|
30
|
+
'chooser-done.label': 'Add selected',
|
|
31
|
+
'editor.placeholder': 'Enter text…',
|
|
32
|
+
'toggle-view-mode.label': 'Toggle read-only',
|
|
33
|
+
'upload-image.label': 'Upload image',
|
|
34
|
+
'fallback.title': 'Untitled',
|
|
35
|
+
'navigate-to-document.label': 'Open document',
|
|
36
|
+
'words.label': 'words',
|
|
37
|
+
'words.label_zero': 'words',
|
|
38
|
+
'words.label_one': 'word',
|
|
39
|
+
'words.label_other': 'words',
|
|
51
40
|
},
|
|
52
41
|
},
|
|
53
42
|
},
|
package/src/types/Markdown.ts
CHANGED
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { BlueprintsAnnotation, GraphPropsAnnotation } from '@dxos/app-toolkit';
|
|
8
|
+
import { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
9
|
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
10
|
import { Text } from '@dxos/schema';
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
export const BLUEPRINT_KEY = 'org.dxos.blueprint.markdown';
|
|
13
|
+
|
|
14
|
+
// Re-export Settings as merged const/type (not as namespace).
|
|
15
|
+
import * as SettingsModule from './Settings';
|
|
16
|
+
export const Settings = SettingsModule.Settings;
|
|
17
|
+
export type Settings = SettingsModule.Settings;
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Document Item type.
|
|
@@ -18,19 +25,15 @@ export const Document = Schema.Struct({
|
|
|
18
25
|
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
26
|
content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
27
|
}).pipe(
|
|
21
|
-
Type.object({
|
|
22
|
-
typename: 'dxos.org/type/Document',
|
|
23
|
-
version: '0.1.0',
|
|
24
|
-
}),
|
|
25
28
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
29
|
DescriptionAnnotation.set('description'),
|
|
27
|
-
Annotation.IconAnnotation.set({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
Annotation.IconAnnotation.set({ icon: 'ph--text-aa--regular', hue: 'indigo' }),
|
|
31
|
+
BlueprintsAnnotation.set([BLUEPRINT_KEY]),
|
|
32
|
+
GraphPropsAnnotation.set({ managesAutofocus: true }),
|
|
33
|
+
Type.makeObject(DXN.make('org.dxos.type.document', '0.1.0')),
|
|
31
34
|
);
|
|
32
35
|
|
|
33
|
-
export type Document =
|
|
36
|
+
export type Document = Type.InstanceType<typeof Document>;
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* Document factory.
|
|
@@ -39,27 +42,8 @@ export const make = ({
|
|
|
39
42
|
content = '',
|
|
40
43
|
...props
|
|
41
44
|
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {
|
|
42
|
-
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
45
|
+
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make({ content })) });
|
|
43
46
|
// TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.
|
|
44
47
|
Obj.setParent(doc.content.target!, doc);
|
|
45
48
|
return doc;
|
|
46
49
|
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Plugin settings.
|
|
50
|
-
*/
|
|
51
|
-
export const Settings = Schema.mutable(
|
|
52
|
-
Schema.Struct({
|
|
53
|
-
defaultViewMode: EditorViewMode,
|
|
54
|
-
editorInputMode: Schema.optional(EditorInputMode),
|
|
55
|
-
experimental: Schema.optional(Schema.Boolean),
|
|
56
|
-
debug: Schema.optional(Schema.Boolean),
|
|
57
|
-
toolbar: Schema.optional(Schema.Boolean),
|
|
58
|
-
typewriter: Schema.optional(Schema.String),
|
|
59
|
-
// TODO(burdon): Per document settings.
|
|
60
|
-
numberedHeadings: Schema.optional(Schema.Boolean),
|
|
61
|
-
folding: Schema.optional(Schema.Boolean),
|
|
62
|
-
}),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type EditorView } from '@codemirror/view';
|
|
8
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
import { Capability } from '@dxos/app-framework';
|
|
12
|
+
import { type EditorStateStore } from '@dxos/ui-editor';
|
|
13
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
|
|
17
|
+
import type * as Markdown from './Markdown';
|
|
18
|
+
import { type MarkdownExtensionProvider } from './types';
|
|
19
|
+
|
|
20
|
+
/** Schema for persisted markdown state. */
|
|
21
|
+
export const StateSchema = Schema.mutable(
|
|
22
|
+
Schema.Struct({
|
|
23
|
+
viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export type MarkdownState = {
|
|
28
|
+
viewMode: Record<string, EditorViewMode>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type EditorViewEntry = { view: EditorView; documentId: string };
|
|
32
|
+
|
|
33
|
+
export type EditorViewRegistry = {
|
|
34
|
+
register: (attendableId: string, view: EditorView, documentId: string) => void;
|
|
35
|
+
unregister: (attendableId: string) => void;
|
|
36
|
+
get: (attendableId: string) => EditorViewEntry | undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}.capability.settings`);
|
|
40
|
+
|
|
41
|
+
/** Persisted state atom for view mode per document. */
|
|
42
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}.capability.state`);
|
|
43
|
+
|
|
44
|
+
/** Editor state store for cursor positions, scroll state, etc. */
|
|
45
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}.capability.editor-state`);
|
|
46
|
+
|
|
47
|
+
/** Registry of active EditorView instances keyed by attendable ID. */
|
|
48
|
+
export const EditorViews = Capability.make<EditorViewRegistry>(`${meta.id}.capability.editor-views`);
|
|
49
|
+
|
|
50
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
51
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}.capability.extensions`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
13
|
+
`${meta.id}.event.setup-extensions`,
|
|
14
|
+
);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Database, Ref, Type, DXN } from '@dxos/echo';
|
|
12
|
+
import { EditorViewMode } from '@dxos/ui-editor/types';
|
|
13
|
+
import { trim } from '@dxos/util';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
|
|
17
|
+
import * as Markdown from './Markdown';
|
|
18
|
+
|
|
19
|
+
const makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);
|
|
20
|
+
|
|
21
|
+
const Edit = Schema.Struct({
|
|
22
|
+
oldString: Schema.String.annotations({
|
|
23
|
+
description: 'The text to find in the document.',
|
|
24
|
+
}),
|
|
25
|
+
newString: Schema.String.annotations({
|
|
26
|
+
description: 'The text to replace it with.',
|
|
27
|
+
}),
|
|
28
|
+
replaceAll: Schema.optional(Schema.Boolean).annotations({
|
|
29
|
+
description: 'If true, replaces all occurrences. Defaults to false (first occurrence only).',
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Create = Operation.make({
|
|
34
|
+
meta: {
|
|
35
|
+
key: DXN.make('org.dxos.function.markdown.create'),
|
|
36
|
+
name: 'Create',
|
|
37
|
+
description: 'Creates a new markdown document and adds it to the space.',
|
|
38
|
+
icon: 'ph--file-text--regular',
|
|
39
|
+
},
|
|
40
|
+
input: Schema.Struct({
|
|
41
|
+
name: Schema.String,
|
|
42
|
+
content: Schema.String,
|
|
43
|
+
}),
|
|
44
|
+
output: Schema.Struct({
|
|
45
|
+
id: Schema.String.annotations({
|
|
46
|
+
description: 'The DXN of the created document.',
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
services: [Database.Service],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const CreateMarkdown = Operation.make({
|
|
53
|
+
meta: {
|
|
54
|
+
key: makeKey('create'),
|
|
55
|
+
name: 'Create Markdown Document',
|
|
56
|
+
icon: 'ph--file-text--regular',
|
|
57
|
+
},
|
|
58
|
+
services: [Capability.Service],
|
|
59
|
+
input: Schema.Struct({
|
|
60
|
+
name: Schema.optional(Schema.String),
|
|
61
|
+
content: Schema.optional(Schema.String),
|
|
62
|
+
}),
|
|
63
|
+
output: Schema.Struct({
|
|
64
|
+
object: Type.getSchema(Markdown.Document),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const Open = Operation.make({
|
|
69
|
+
meta: {
|
|
70
|
+
key: DXN.make('org.dxos.function.markdown.open'),
|
|
71
|
+
name: 'Open',
|
|
72
|
+
description: 'Opens and reads the contents of a new markdown document.',
|
|
73
|
+
icon: 'ph--arrow-square-out--regular',
|
|
74
|
+
},
|
|
75
|
+
input: Schema.Struct({
|
|
76
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
77
|
+
description: 'The ID of the markdown document.',
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
80
|
+
output: Schema.Struct({
|
|
81
|
+
content: Schema.String,
|
|
82
|
+
}),
|
|
83
|
+
services: [Database.Service],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const ScrollToAnchor = Operation.make({
|
|
87
|
+
meta: {
|
|
88
|
+
key: makeKey('scrollToAnchor'),
|
|
89
|
+
name: 'Scroll To Anchor',
|
|
90
|
+
icon: 'ph--anchor-simple--regular',
|
|
91
|
+
},
|
|
92
|
+
services: [Capability.Service],
|
|
93
|
+
input: Schema.Struct({
|
|
94
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the markdown editor.' }),
|
|
95
|
+
cursor: Schema.String.annotations({ description: 'Cursor position to scroll to.' }),
|
|
96
|
+
ref: Schema.optional(Schema.String.annotations({ description: 'Reference ID (e.g. thread ID).' })),
|
|
97
|
+
}),
|
|
98
|
+
output: Schema.Void,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
102
|
+
export const SetViewMode = Operation.make({
|
|
103
|
+
meta: { key: makeKey('setViewMode'), name: 'Set View Mode', icon: 'ph--layout--regular' },
|
|
104
|
+
services: [Capability.Service],
|
|
105
|
+
input: Schema.Struct({
|
|
106
|
+
id: Schema.String,
|
|
107
|
+
viewMode: EditorViewMode,
|
|
108
|
+
}),
|
|
109
|
+
output: Schema.Void,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export const Update = Operation.make({
|
|
113
|
+
meta: {
|
|
114
|
+
key: DXN.make('org.dxos.function.markdown.update'),
|
|
115
|
+
name: 'Update',
|
|
116
|
+
description: trim`
|
|
117
|
+
Applies a set of edits to the markdown document.
|
|
118
|
+
`,
|
|
119
|
+
icon: 'ph--pencil-simple--regular',
|
|
120
|
+
},
|
|
121
|
+
input: Schema.Struct({
|
|
122
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
123
|
+
description: 'The ID of the markdown document.',
|
|
124
|
+
}),
|
|
125
|
+
edits: Schema.Array(Edit).annotations({
|
|
126
|
+
description: 'The edits to apply to the document. Each edit finds oldString and replaces it with newString.',
|
|
127
|
+
}),
|
|
128
|
+
}),
|
|
129
|
+
output: Schema.Struct({
|
|
130
|
+
newContent: Schema.String,
|
|
131
|
+
}),
|
|
132
|
+
services: [Database.Service],
|
|
133
|
+
});
|