@dxos/plugin-markdown 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
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/neutral/EditableMarkdownCard-P4F4TIUM.mjs +32 -0
- package/dist/lib/neutral/EditableMarkdownCard-P4F4TIUM.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownCard-INMBLUL4.mjs +102 -0
- package/dist/lib/neutral/MarkdownCard-INMBLUL4.mjs.map +7 -0
- package/dist/lib/{browser/MarkdownContainer-KER2N5M2.mjs → neutral/MarkdownContainer-2BDGD3PL.mjs} +51 -33
- package/dist/lib/neutral/MarkdownContainer-2BDGD3PL.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/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-L4VCKDO6.mjs} +5 -7
- package/dist/lib/neutral/anchor-sort-L4VCKDO6.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-serializer-QBZDVASK.mjs → neutral/app-graph-serializer-3XFKP4ER.mjs} +10 -14
- package/dist/lib/neutral/app-graph-serializer-3XFKP4ER.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/{browser/chunk-YBMRREXE.mjs → neutral/chunk-3LYCPEVP.mjs} +2 -9
- package/dist/lib/{browser/chunk-YBMRREXE.mjs.map → neutral/chunk-3LYCPEVP.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-6N7AD3IU.mjs +8 -0
- package/dist/lib/neutral/chunk-6N7AD3IU.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/chunk-SOLAMEK3.mjs +276 -0
- package/dist/lib/neutral/chunk-SOLAMEK3.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-7VTHRUIZ.mjs +30 -0
- package/dist/lib/neutral/comment-config-7VTHRUIZ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +370 -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-3PGJ2NEK.mjs +28 -0
- package/dist/lib/neutral/create-3PGJ2NEK.mjs.map +7 -0
- package/dist/lib/neutral/create-markdown-5LS46GMH.mjs +20 -0
- package/dist/lib/neutral/create-markdown-5LS46GMH.mjs.map +7 -0
- package/dist/lib/neutral/create-object-ZA6VXLJJ.mjs +27 -0
- package/dist/lib/neutral/create-object-ZA6VXLJJ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +322 -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-WCYGBLAG.mjs +20 -0
- package/dist/lib/neutral/open-WCYGBLAG.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-TB4TY57T.mjs} +41 -38
- package/dist/lib/neutral/react-surface-TB4TY57T.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-6FIOKVKT.mjs +47 -0
- package/dist/lib/neutral/scroll-to-anchor-6FIOKVKT.mjs.map +7 -0
- package/dist/lib/neutral/set-view-mode-37RSPFEN.mjs +24 -0
- package/dist/lib/neutral/set-view-mode-37RSPFEN.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 +20 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +43 -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-5EDRD3SH.mjs +44 -0
- package/dist/lib/neutral/update-markdown-5EDRD3SH.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/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/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/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/index.d.ts +3 -0
- package/dist/types/src/containers/EditableMarkdownCard/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/MarkdownContainer/MarkdownContainer.d.ts +18 -9
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +70 -61
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +2 -2
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -2
- 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/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.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 +15 -15
- 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 +17 -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 +125 -85
- package/src/MarkdownPlugin.node.ts +20 -0
- package/src/MarkdownPlugin.test.ts +26 -0
- package/src/MarkdownPlugin.tsx +15 -55
- package/src/blueprints/markdown-blueprint.ts +9 -12
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +1 -1
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +9 -5
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -4
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/comment-config.ts +32 -0
- package/src/capabilities/create-object.ts +30 -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 +127 -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 +38 -35
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +120 -92
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +25 -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.tsx +42 -0
- package/src/containers/EditableMarkdownCard/index.ts +6 -0
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +8 -8
- package/src/containers/MarkdownCard/MarkdownCard.tsx +28 -22
- package/src/containers/MarkdownCard/index.ts +1 -3
- package/src/containers/MarkdownCard/snippet.ts +54 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +20 -21
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +65 -33
- package/src/containers/MarkdownContainer/index.ts +2 -3
- package/src/containers/index.ts +2 -2
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +57 -40
- package/src/hooks/useLinkQuery.ts +35 -26
- package/src/index.ts +2 -6
- package/src/meta.ts +1 -1
- package/src/operations/create-markdown.ts +19 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/{blueprints/functions → operations}/create.test.ts +27 -22
- 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 +47 -48
- package/src/plugin.ts +11 -0
- package/src/translations.ts +25 -37
- package/src/types/Markdown.ts +13 -23
- package/src/types/MarkdownCapabilities.ts +51 -0
- package/src/types/MarkdownEvents.ts +14 -0
- package/src/types/MarkdownOperation.ts +122 -0
- package/src/types/Settings.ts +65 -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/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.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/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/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/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/{artifact-definition/artifact-definition.d.ts → artifact-definition.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,41 @@
|
|
|
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 {
|
|
10
|
+
import { Blueprint, Operation } from '@dxos/compute';
|
|
11
|
+
import { Database, Feed, Obj, Query, Ref } from '@dxos/echo';
|
|
15
12
|
import { Collection } from '@dxos/echo';
|
|
16
13
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
|
-
import {
|
|
14
|
+
import { AgentService } from '@dxos/functions-runtime';
|
|
15
|
+
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
18
16
|
import { invariant } from '@dxos/invariant';
|
|
19
17
|
import { ObjectId } from '@dxos/keys';
|
|
20
|
-
import { Markdown } from '@dxos/plugin-markdown
|
|
18
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
21
19
|
import { HasSubject } from '@dxos/types';
|
|
22
20
|
import { trim } from '@dxos/util';
|
|
23
21
|
|
|
24
|
-
import { WithProperties } from '
|
|
25
|
-
import MarkdownBlueprint from '../markdown-blueprint';
|
|
22
|
+
import { WithProperties } from '#testing';
|
|
26
23
|
|
|
27
|
-
import
|
|
24
|
+
import MarkdownBlueprint from '../blueprints/markdown-blueprint';
|
|
25
|
+
import { MarkdownOperation } from '../types';
|
|
26
|
+
import { MarkdownOperationHandlerSet } from './index';
|
|
28
27
|
|
|
29
28
|
ObjectId.dangerouslyDisableRandomness();
|
|
30
29
|
|
|
31
30
|
const TestLayer = AssistantTestLayer({
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
aiServicePreset: 'edge-remote',
|
|
32
|
+
operationHandlers: MarkdownOperationHandlerSet,
|
|
33
|
+
types: [
|
|
34
|
+
SpaceProperties,
|
|
35
|
+
Collection.Collection,
|
|
36
|
+
Blueprint.Blueprint,
|
|
37
|
+
Markdown.Document,
|
|
38
|
+
HasSubject.HasSubject,
|
|
39
|
+
Feed.Feed,
|
|
40
|
+
],
|
|
41
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
34
42
|
tracing: 'pretty',
|
|
35
43
|
});
|
|
36
44
|
|
|
@@ -45,7 +53,7 @@ describe('update', () => {
|
|
|
45
53
|
});
|
|
46
54
|
yield* Database.add(doc);
|
|
47
55
|
|
|
48
|
-
yield*
|
|
56
|
+
yield* Operation.invoke(MarkdownOperation.Update, {
|
|
49
57
|
doc: Ref.make(doc),
|
|
50
58
|
edits: [{ oldString: 'Founders', newString: '# Founders' }],
|
|
51
59
|
});
|
|
@@ -61,18 +69,16 @@ describe('update', () => {
|
|
|
61
69
|
),
|
|
62
70
|
);
|
|
63
71
|
|
|
64
|
-
it.
|
|
72
|
+
it.effect(
|
|
65
73
|
'create and update a markdown document',
|
|
66
74
|
Effect.fnUntraced(
|
|
67
75
|
function* (_) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
blueprints: [Ref.make(markdownBlueprint)],
|
|
76
|
+
const agent = yield* AgentService.createSession({
|
|
77
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
71
78
|
});
|
|
72
79
|
|
|
73
|
-
yield*
|
|
74
|
-
|
|
75
|
-
});
|
|
80
|
+
yield* agent.submitPrompt('Create a document with a cookie recipe.');
|
|
81
|
+
yield* agent.waitForCompletion();
|
|
76
82
|
{
|
|
77
83
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
78
84
|
if (docs.length !== 1) {
|
|
@@ -87,9 +93,8 @@ describe('update', () => {
|
|
|
87
93
|
});
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
yield*
|
|
91
|
-
|
|
92
|
-
});
|
|
96
|
+
yield* agent.submitPrompt('Add a section with a holiday-themed variation.');
|
|
97
|
+
yield* agent.waitForCompletion();
|
|
93
98
|
{
|
|
94
99
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
95
100
|
if (docs.length !== 1) {
|
|
@@ -105,13 +110,13 @@ describe('update', () => {
|
|
|
105
110
|
}
|
|
106
111
|
},
|
|
107
112
|
WithProperties,
|
|
108
|
-
Effect.provide(
|
|
113
|
+
Effect.provide(TestLayer),
|
|
109
114
|
TestHelpers.provideTestContext,
|
|
110
115
|
),
|
|
111
116
|
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
112
117
|
);
|
|
113
118
|
|
|
114
|
-
it.
|
|
119
|
+
it.effect(
|
|
115
120
|
'update existing document',
|
|
116
121
|
Effect.fnUntraced(
|
|
117
122
|
function* (_) {
|
|
@@ -127,15 +132,13 @@ describe('update', () => {
|
|
|
127
132
|
`,
|
|
128
133
|
}),
|
|
129
134
|
);
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
objects: [Ref.make(document)],
|
|
135
|
+
const agent = yield* AgentService.createSession({
|
|
136
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
137
|
+
context: [Ref.make(document)],
|
|
134
138
|
});
|
|
135
139
|
|
|
136
|
-
yield*
|
|
137
|
-
|
|
138
|
-
});
|
|
140
|
+
yield* agent.submitPrompt('Add the missing ingredient (its flour).');
|
|
141
|
+
yield* agent.waitForCompletion();
|
|
139
142
|
|
|
140
143
|
{
|
|
141
144
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
@@ -154,13 +157,13 @@ describe('update', () => {
|
|
|
154
157
|
}
|
|
155
158
|
},
|
|
156
159
|
WithProperties,
|
|
157
|
-
Effect.provide(
|
|
160
|
+
Effect.provide(TestLayer),
|
|
158
161
|
TestHelpers.provideTestContext,
|
|
159
162
|
),
|
|
160
163
|
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
161
164
|
);
|
|
162
165
|
|
|
163
|
-
it.
|
|
166
|
+
it.effect(
|
|
164
167
|
'add lines to document one by one',
|
|
165
168
|
Effect.fnUntraced(
|
|
166
169
|
function* (_) {
|
|
@@ -172,21 +175,17 @@ describe('update', () => {
|
|
|
172
175
|
`,
|
|
173
176
|
}),
|
|
174
177
|
);
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
objects: [Ref.make(document)],
|
|
178
|
+
const agent = yield* AgentService.createSession({
|
|
179
|
+
blueprints: [MarkdownBlueprint.make()],
|
|
180
|
+
context: [Ref.make(document)],
|
|
179
181
|
});
|
|
180
182
|
|
|
181
|
-
yield*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
yield*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
yield* AiConversationService.run({
|
|
188
|
-
prompt: 'Add eggs to the shopping list.',
|
|
189
|
-
});
|
|
183
|
+
yield* agent.submitPrompt('Add milk to the shopping list.');
|
|
184
|
+
yield* agent.waitForCompletion();
|
|
185
|
+
yield* agent.submitPrompt('Add bread to the shopping list.');
|
|
186
|
+
yield* agent.waitForCompletion();
|
|
187
|
+
yield* agent.submitPrompt('Add eggs to the shopping list.');
|
|
188
|
+
yield* agent.waitForCompletion();
|
|
190
189
|
|
|
191
190
|
{
|
|
192
191
|
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
@@ -207,7 +206,7 @@ describe('update', () => {
|
|
|
207
206
|
}
|
|
208
207
|
},
|
|
209
208
|
WithProperties,
|
|
210
|
-
Effect.provide(
|
|
209
|
+
Effect.provide(TestLayer),
|
|
211
210
|
TestHelpers.provideTestContext,
|
|
212
211
|
),
|
|
213
212
|
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/translations.ts
CHANGED
|
@@ -3,51 +3,39 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
6
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor/translations';
|
|
7
7
|
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { Markdown } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
|
+
import { Markdown } from '#types';
|
|
10
10
|
|
|
11
11
|
export const translations = [
|
|
12
12
|
{
|
|
13
13
|
'en-US': {
|
|
14
14
|
[Markdown.Document.typename]: {
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'typename
|
|
19
|
-
'object
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'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',
|
|
23
24
|
},
|
|
24
25
|
[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',
|
|
26
|
+
'plugin.name': 'Editor',
|
|
27
|
+
'choose-markdown-from-space-dialog.title': 'Choose one or more documents to add',
|
|
28
|
+
'empty-choose-markdown-from-space.message': 'None available; try creating a new one instead?',
|
|
29
|
+
'chooser-done.label': 'Add selected',
|
|
30
|
+
'editor.placeholder': 'Enter text…',
|
|
31
|
+
'toggle-view-mode.label': 'Toggle read-only',
|
|
32
|
+
'upload-image.label': 'Upload image',
|
|
33
|
+
'fallback.title': 'Untitled',
|
|
34
|
+
'navigate-to-document.label': 'Open document',
|
|
35
|
+
'words.label': 'words',
|
|
36
|
+
'words.label_zero': 'words',
|
|
37
|
+
'words.label_one': 'word',
|
|
38
|
+
'words.label_other': 'words',
|
|
51
39
|
},
|
|
52
40
|
},
|
|
53
41
|
},
|
package/src/types/Markdown.ts
CHANGED
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
+
import { BlueprintsAnnotation, GraphPropsAnnotation } from '@dxos/app-toolkit';
|
|
7
8
|
import { 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.
|
|
@@ -19,15 +26,17 @@ export const Document = Schema.Struct({
|
|
|
19
26
|
content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
27
|
}).pipe(
|
|
21
28
|
Type.object({
|
|
22
|
-
typename: 'dxos.
|
|
29
|
+
typename: 'org.dxos.type.document',
|
|
23
30
|
version: '0.1.0',
|
|
24
31
|
}),
|
|
25
32
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
33
|
DescriptionAnnotation.set('description'),
|
|
27
34
|
Annotation.IconAnnotation.set({
|
|
28
35
|
icon: 'ph--text-aa--regular',
|
|
29
|
-
hue: '
|
|
36
|
+
hue: 'indigo',
|
|
30
37
|
}),
|
|
38
|
+
BlueprintsAnnotation.set([BLUEPRINT_KEY]),
|
|
39
|
+
GraphPropsAnnotation.set({ managesAutofocus: true }),
|
|
31
40
|
);
|
|
32
41
|
|
|
33
42
|
export type Document = Schema.Schema.Type<typeof Document>;
|
|
@@ -39,27 +48,8 @@ export const make = ({
|
|
|
39
48
|
content = '',
|
|
40
49
|
...props
|
|
41
50
|
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {
|
|
42
|
-
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
51
|
+
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make({ content })) });
|
|
43
52
|
// TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.
|
|
44
53
|
Obj.setParent(doc.content.target!, doc);
|
|
45
54
|
return doc;
|
|
46
55
|
};
|
|
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,122 @@
|
|
|
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 } 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 MARKDOWN_OPERATION = `${meta.id}.operation`;
|
|
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: 'org.dxos.function.markdown.create',
|
|
36
|
+
name: 'Create',
|
|
37
|
+
description: 'Creates a new markdown document and adds it to the space.',
|
|
38
|
+
},
|
|
39
|
+
input: Schema.Struct({
|
|
40
|
+
name: Schema.String,
|
|
41
|
+
content: Schema.String,
|
|
42
|
+
}),
|
|
43
|
+
output: Schema.Struct({
|
|
44
|
+
id: Schema.String.annotations({
|
|
45
|
+
description: 'The DXN of the created document.',
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
48
|
+
services: [Database.Service],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const CreateMarkdown = Operation.make({
|
|
52
|
+
meta: { key: `${MARKDOWN_OPERATION}.create`, name: 'Create Markdown Document' },
|
|
53
|
+
services: [Capability.Service],
|
|
54
|
+
input: Schema.Struct({
|
|
55
|
+
name: Schema.optional(Schema.String),
|
|
56
|
+
content: Schema.optional(Schema.String),
|
|
57
|
+
}),
|
|
58
|
+
output: Schema.Struct({
|
|
59
|
+
object: Markdown.Document,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const Open = Operation.make({
|
|
64
|
+
meta: {
|
|
65
|
+
key: 'org.dxos.function.markdown.open',
|
|
66
|
+
name: 'Open',
|
|
67
|
+
description: 'Opens and reads the contents of a new markdown document.',
|
|
68
|
+
},
|
|
69
|
+
input: Schema.Struct({
|
|
70
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
71
|
+
description: 'The ID of the markdown document.',
|
|
72
|
+
}),
|
|
73
|
+
}),
|
|
74
|
+
output: Schema.Struct({
|
|
75
|
+
content: Schema.String,
|
|
76
|
+
}),
|
|
77
|
+
services: [Database.Service],
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const ScrollToAnchor = Operation.make({
|
|
81
|
+
meta: { key: `${MARKDOWN_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
|
|
82
|
+
services: [Capability.Service],
|
|
83
|
+
input: Schema.Struct({
|
|
84
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the markdown editor.' }),
|
|
85
|
+
cursor: Schema.String.annotations({ description: 'Cursor position to scroll to.' }),
|
|
86
|
+
ref: Schema.optional(Schema.String.annotations({ description: 'Reference ID (e.g. thread ID).' })),
|
|
87
|
+
}),
|
|
88
|
+
output: Schema.Void,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
92
|
+
export const SetViewMode = Operation.make({
|
|
93
|
+
meta: { key: `${MARKDOWN_OPERATION}.set-view-mode`, name: 'Set View Mode' },
|
|
94
|
+
services: [Capability.Service],
|
|
95
|
+
input: Schema.Struct({
|
|
96
|
+
id: Schema.String,
|
|
97
|
+
viewMode: EditorViewMode,
|
|
98
|
+
}),
|
|
99
|
+
output: Schema.Void,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const Update = Operation.make({
|
|
103
|
+
meta: {
|
|
104
|
+
key: 'org.dxos.function.markdown.update',
|
|
105
|
+
name: 'Update',
|
|
106
|
+
description: trim`
|
|
107
|
+
Applies a set of edits to the markdown document.
|
|
108
|
+
`,
|
|
109
|
+
},
|
|
110
|
+
input: Schema.Struct({
|
|
111
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
112
|
+
description: 'The ID of the markdown document.',
|
|
113
|
+
}),
|
|
114
|
+
edits: Schema.Array(Edit).annotations({
|
|
115
|
+
description: 'The edits to apply to the document. Each edit finds oldString and replaces it with newString.',
|
|
116
|
+
}),
|
|
117
|
+
}),
|
|
118
|
+
output: Schema.Struct({
|
|
119
|
+
newContent: Schema.String,
|
|
120
|
+
}),
|
|
121
|
+
services: [Database.Service],
|
|
122
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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.annotations({
|
|
17
|
+
title: 'Default view mode',
|
|
18
|
+
description: 'Set whether documents open in editing or read-only mode.',
|
|
19
|
+
}),
|
|
20
|
+
editorInputMode: Schema.optional(
|
|
21
|
+
EditorInputMode.annotations({
|
|
22
|
+
title: 'Editor input mode',
|
|
23
|
+
description: 'Choose keyboard bindings for the editor.',
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
toolbar: Schema.optional(
|
|
27
|
+
Schema.Boolean.annotations({
|
|
28
|
+
title: 'Show toolbar',
|
|
29
|
+
description: 'Display a formatting toolbar above the editor.',
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
numberedHeadings: Schema.optional(
|
|
33
|
+
Schema.Boolean.annotations({
|
|
34
|
+
title: 'Numbered headings',
|
|
35
|
+
description: 'Automatically number heading levels in the document.',
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
folding: Schema.optional(
|
|
39
|
+
Schema.Boolean.annotations({
|
|
40
|
+
title: 'Folding',
|
|
41
|
+
description: 'Allow collapsing and expanding sections by heading.',
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
experimental: Schema.optional(
|
|
45
|
+
Schema.Boolean.annotations({
|
|
46
|
+
title: 'Enable experimental features',
|
|
47
|
+
description: 'Turn on features that are still in development.',
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
debug: Schema.optional(
|
|
51
|
+
Schema.Boolean.annotations({
|
|
52
|
+
title: 'Enable debugging features',
|
|
53
|
+
description: 'Show developer tools and diagnostics for the editor.',
|
|
54
|
+
}),
|
|
55
|
+
),
|
|
56
|
+
snippets: Schema.optional(
|
|
57
|
+
Schema.String.annotations({
|
|
58
|
+
title: 'Snippets',
|
|
59
|
+
description: 'Input snippets to replay for testing purposes.',
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
package/src/types/index.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
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
|
-
export * from './capabilities';
|
|
10
|
-
export * from './events';
|
|
11
5
|
export * from './types';
|
|
6
|
+
|
|
7
|
+
export * as Markdown from './Markdown';
|
|
8
|
+
export * as MarkdownCapabilities from './MarkdownCapabilities';
|
|
9
|
+
export * as MarkdownEvents from './MarkdownEvents';
|
|
10
|
+
export * as MarkdownOperation from './MarkdownOperation';
|
|
11
|
+
export * as Settings from './Settings';
|
package/src/types/types.ts
CHANGED
|
@@ -12,7 +12,10 @@ import { type Document } from './Markdown';
|
|
|
12
12
|
// TODO(wittjosiah): MarkdownExtensionProvider is a part of the MarkdownCapabilities api which should be in ./types.
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Async?
|
|
15
|
-
export type MarkdownExtensionProvider = (props: {
|
|
15
|
+
export type MarkdownExtensionProvider = (props: {
|
|
16
|
+
document?: Document;
|
|
17
|
+
viewMode?: EditorViewMode;
|
|
18
|
+
}) => Extension | undefined;
|
|
16
19
|
|
|
17
20
|
export type MarkdownPluginState = {
|
|
18
21
|
// Codemirror extensions provided by other plugins.
|
package/src/util.tsx
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { debounce } from '@dxos/async';
|
|
6
6
|
import { Obj } from '@dxos/echo';
|
|
7
|
-
import { type TypedObjectSerializer } from '@dxos/plugin-space
|
|
7
|
+
import { type TypedObjectSerializer } from '@dxos/plugin-space';
|
|
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.
|
|
@@ -116,8 +116,8 @@ export const getContentSnippet = (content = '', maxLines = 3) => {
|
|
|
116
116
|
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
117
117
|
const name = getFallbackName(content);
|
|
118
118
|
if (doc.fallbackName !== name) {
|
|
119
|
-
Obj.
|
|
120
|
-
|
|
119
|
+
Obj.update(doc, (doc) => {
|
|
120
|
+
doc.fallbackName = name;
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
}, 200);
|