@dxos/plugin-markdown 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownCard-ZHQBD4AV.mjs +122 -0
- package/dist/lib/browser/MarkdownCard-ZHQBD4AV.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-XEUOYBPA.mjs +125 -0
- package/dist/lib/browser/MarkdownContainer-XEUOYBPA.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSettings-OD7AJSSJ.mjs +106 -0
- package/dist/lib/browser/MarkdownSettings-OD7AJSSJ.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-PSCEA6EJ.mjs +34 -0
- package/dist/lib/browser/anchor-sort-PSCEA6EJ.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-DAVFEX7R.mjs +63 -0
- package/dist/lib/browser/app-graph-serializer-DAVFEX7R.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-LHVNOMJT.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-LHVNOMJT.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +10 -0
- package/dist/lib/browser/chunk-5VT6IW5B.mjs +84 -0
- package/dist/lib/browser/chunk-5VT6IW5B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-22XSSNBS.mjs → chunk-CJSWKCKU.mjs} +9 -5
- package/dist/lib/browser/chunk-CJSWKCKU.mjs.map +7 -0
- package/dist/lib/browser/chunk-G6BRWY3G.mjs +158 -0
- package/dist/lib/browser/chunk-G6BRWY3G.mjs.map +7 -0
- package/dist/lib/browser/chunk-M2XFCKXA.mjs +8 -0
- package/dist/lib/browser/chunk-M2XFCKXA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BQTYJOFB.mjs → chunk-RYZHVXZ5.mjs} +2 -2
- package/dist/lib/browser/chunk-RYZHVXZ5.mjs.map +7 -0
- package/dist/lib/browser/chunk-XWYF5LFE.mjs +8 -0
- package/dist/lib/browser/chunk-XWYF5LFE.mjs.map +7 -0
- package/dist/lib/browser/chunk-YALLVET2.mjs +757 -0
- package/dist/lib/browser/chunk-YALLVET2.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZN75YHSV.mjs +50 -0
- package/dist/lib/browser/chunk-ZN75YHSV.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +44 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/create-QD27F6E7.mjs +30 -0
- package/dist/lib/browser/create-QD27F6E7.mjs.map +7 -0
- package/dist/lib/browser/create-markdown-LEAJPLHT.mjs +22 -0
- package/dist/lib/browser/create-markdown-LEAJPLHT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +132 -142
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-YDABYPCA.mjs +21 -0
- package/dist/lib/browser/open-YDABYPCA.mjs.map +7 -0
- package/dist/lib/browser/operation-handler-W3QXMMMQ.mjs +17 -0
- package/dist/lib/browser/operation-handler-W3QXMMMQ.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/react-surface-N7FV3PXH.mjs +120 -0
- package/dist/lib/browser/react-surface-N7FV3PXH.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-3CGV3XI7.mjs +49 -0
- package/dist/lib/browser/scroll-to-anchor-3CGV3XI7.mjs.map +7 -0
- package/dist/lib/browser/set-view-mode-XLD3RXW4.mjs +26 -0
- package/dist/lib/browser/set-view-mode-XLD3RXW4.mjs.map +7 -0
- package/dist/lib/browser/settings-3UMXG4TP.mjs +38 -0
- package/dist/lib/browser/settings-3UMXG4TP.mjs.map +7 -0
- package/dist/lib/browser/state-IYKJ6EV3.mjs +48 -0
- package/dist/lib/browser/state-IYKJ6EV3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -4
- package/dist/lib/browser/update-WKAMI4AD.mjs +45 -0
- package/dist/lib/browser/update-WKAMI4AD.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownCard-VB3NHVX4.mjs +123 -0
- package/dist/lib/node-esm/MarkdownCard-VB3NHVX4.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-25WFZLCC.mjs +126 -0
- package/dist/lib/node-esm/MarkdownContainer-25WFZLCC.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-U7GJ4OP3.mjs +107 -0
- package/dist/lib/node-esm/MarkdownSettings-U7GJ4OP3.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-PCDXEBJ2.mjs → anchor-sort-6GD4SGQL.mjs} +13 -10
- package/dist/lib/node-esm/anchor-sort-6GD4SGQL.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-JURUUUBI.mjs +64 -0
- package/dist/lib/node-esm/app-graph-serializer-JURUUUBI.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-3LUZEJ4Z.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-3LUZEJ4Z.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +11 -0
- package/dist/lib/node-esm/chunk-6LHNAAMP.mjs +159 -0
- package/dist/lib/node-esm/chunk-6LHNAAMP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CRUJMQR2.mjs +758 -0
- package/dist/lib/node-esm/chunk-CRUJMQR2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SHAMSMKQ.mjs → chunk-CW4FZNMZ.mjs} +2 -2
- package/dist/lib/node-esm/chunk-CW4FZNMZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EPNCYA73.mjs +85 -0
- package/dist/lib/node-esm/chunk-EPNCYA73.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AMHACOXW.mjs → chunk-FC3GPLJG.mjs} +9 -5
- package/dist/lib/node-esm/chunk-FC3GPLJG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G6W4DJBM.mjs +51 -0
- package/dist/lib/node-esm/chunk-G6W4DJBM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JLOCBILO.mjs +10 -0
- package/dist/lib/node-esm/chunk-JLOCBILO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YWQQYV76.mjs +10 -0
- package/dist/lib/node-esm/chunk-YWQQYV76.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +45 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-X7H4LYI5.mjs +31 -0
- package/dist/lib/node-esm/create-X7H4LYI5.mjs.map +7 -0
- package/dist/lib/node-esm/create-markdown-7POKQDVQ.mjs +23 -0
- package/dist/lib/node-esm/create-markdown-7POKQDVQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +132 -142
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-FZVFWXC7.mjs +22 -0
- package/dist/lib/node-esm/open-FZVFWXC7.mjs.map +7 -0
- package/dist/lib/node-esm/operation-handler-TP26H7QE.mjs +18 -0
- package/dist/lib/node-esm/operation-handler-TP26H7QE.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/react-surface-XSKLSF6A.mjs +121 -0
- package/dist/lib/node-esm/react-surface-XSKLSF6A.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-KWBJLM5Q.mjs +50 -0
- package/dist/lib/node-esm/scroll-to-anchor-KWBJLM5Q.mjs.map +7 -0
- package/dist/lib/node-esm/set-view-mode-FFEKYLU3.mjs +27 -0
- package/dist/lib/node-esm/set-view-mode-FFEKYLU3.mjs.map +7 -0
- package/dist/lib/node-esm/settings-UAN22O42.mjs +39 -0
- package/dist/lib/node-esm/settings-UAN22O42.mjs.map +7 -0
- package/dist/lib/node-esm/state-62IBFPTK.mjs +49 -0
- package/dist/lib/node-esm/state-62IBFPTK.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +8 -4
- package/dist/lib/node-esm/update-WPEFBY4M.mjs +46 -0
- package/dist/lib/node-esm/update-WPEFBY4M.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -13
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +6 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +17 -11
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +16 -10
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +10 -5
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts +8 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/MarkdownCard/index.d.ts +0 -1
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +15 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +30 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.d.ts +32 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +7 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +2 -2
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-markdown.d.ts +5 -0
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/create.test.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +61 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/operations/set-view-mode.d.ts +5 -0
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -0
- package/dist/types/src/operations/update.d.ts +5 -0
- package/dist/types/src/operations/update.d.ts.map +1 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +2 -2
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +31 -0
- 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/capabilities.d.ts +34 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +4 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/src/util.test.d.ts +2 -0
- package/dist/types/src/util.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +99 -68
- package/src/MarkdownPlugin.tsx +71 -96
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +44 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +37 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +64 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +110 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +6 -11
- package/src/capabilities/operation-handler/index.ts +11 -0
- package/src/capabilities/operation-handler/operation-handler.ts +16 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +120 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +37 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +47 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +40 -0
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +35 -36
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +74 -44
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +62 -25
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +48 -53
- package/src/components/index.ts +2 -9
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +68 -0
- package/src/containers/MarkdownCard/MarkdownCard.tsx +57 -0
- package/src/{components → containers}/MarkdownCard/index.ts +0 -2
- package/src/containers/MarkdownCard/snippet.ts +75 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +133 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +134 -0
- package/src/containers/MarkdownContainer/index.ts +6 -0
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +122 -0
- package/src/containers/MarkdownSettings/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +90 -108
- package/src/hooks/useLinkQuery.ts +21 -19
- package/src/index.ts +3 -2
- package/src/meta.ts +3 -3
- package/src/operations/create-markdown.ts +21 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/operations/create.test.ts +93 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/definitions.ts +119 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +40 -0
- package/src/operations/set-view-mode.ts +25 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/operations/update.test.ts +216 -0
- package/src/operations/update.ts +51 -0
- package/src/testing.ts +6 -6
- package/src/translations.ts +4 -0
- package/src/types/Markdown.ts +18 -11
- package/src/types/capabilities.ts +50 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +76 -6
- package/dist/lib/browser/MarkdownCard-JYMDPKV5.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-Y75XSVBX.mjs +0 -15
- package/dist/lib/browser/anchor-sort-3HGPGCOO.mjs +0 -31
- package/dist/lib/browser/anchor-sort-3HGPGCOO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-POZN234F.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-POZN234F.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-GIPKFDY5.mjs +0 -13
- package/dist/lib/browser/chunk-22XSSNBS.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MLGSYRN.mjs +0 -20
- package/dist/lib/browser/chunk-2MLGSYRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQTYJOFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-GH6GQSBL.mjs +0 -51
- package/dist/lib/browser/chunk-GH6GQSBL.mjs.map +0 -7
- package/dist/lib/browser/chunk-IBCHVMZW.mjs +0 -16
- package/dist/lib/browser/chunk-IBCHVMZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-K3LXOU3E.mjs +0 -827
- package/dist/lib/browser/chunk-K3LXOU3E.mjs.map +0 -7
- package/dist/lib/browser/chunk-PBJLFIOX.mjs +0 -96
- package/dist/lib/browser/chunk-PBJLFIOX.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYSEJ5GP.mjs +0 -79
- package/dist/lib/browser/chunk-QYSEJ5GP.mjs.map +0 -7
- package/dist/lib/browser/chunk-Y53FQREH.mjs +0 -150
- package/dist/lib/browser/chunk-Y53FQREH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-Z5L7TXUK.mjs +0 -62
- package/dist/lib/browser/intent-resolver-Z5L7TXUK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GO5ZOKNN.mjs +0 -211
- package/dist/lib/browser/react-surface-GO5ZOKNN.mjs.map +0 -7
- package/dist/lib/browser/settings-TZUDB5EW.mjs +0 -28
- package/dist/lib/browser/settings-TZUDB5EW.mjs.map +0 -7
- package/dist/lib/browser/state-BTUKVZHY.mjs +0 -37
- package/dist/lib/browser/state-BTUKVZHY.mjs.map +0 -7
- package/dist/lib/browser/toolkit.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-ZXPJLUYO.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-ZXPJLUYO.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-YRDSRDCS.mjs +0 -16
- package/dist/lib/node-esm/MarkdownContainer-YRDSRDCS.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-PCDXEBJ2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-NF65JYAS.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-NF65JYAS.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-ENKJZYQS.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-ENKJZYQS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AMHACOXW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CT7CFX5G.mjs +0 -828
- package/dist/lib/node-esm/chunk-CT7CFX5G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs +0 -17
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HAIEWPU7.mjs +0 -151
- package/dist/lib/node-esm/chunk-HAIEWPU7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KCHUTL3Q.mjs +0 -22
- package/dist/lib/node-esm/chunk-KCHUTL3Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NGYJNQ6A.mjs +0 -80
- package/dist/lib/node-esm/chunk-NGYJNQ6A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PIOOG7A5.mjs +0 -97
- package/dist/lib/node-esm/chunk-PIOOG7A5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PLZ7EVCT.mjs +0 -52
- package/dist/lib/node-esm/chunk-PLZ7EVCT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-6B3PFQ5F.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-6B3PFQ5F.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-I46BPCWT.mjs +0 -212
- package/dist/lib/node-esm/react-surface-I46BPCWT.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CJ3T5EX4.mjs +0 -29
- package/dist/lib/node-esm/settings-CJ3T5EX4.mjs.map +0 -7
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs +0 -38
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit.mjs +0 -14
- package/dist/lib/node-esm/toolkit.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +0 -7
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +0 -9
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +0 -14
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +0 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts +0 -8
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/update.d.ts +0 -6
- package/dist/types/src/functions/update.d.ts.map +0 -1
- package/dist/types/src/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +0 -6
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +0 -1
- package/dist/types/src/toolkit.d.ts +0 -3
- package/dist/types/src/toolkit.d.ts.map +0 -1
- package/dist/types/src/types/MarkdownAction.d.ts +0 -34
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -43
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -93
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +0 -76
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -89
- package/src/components/MarkdownContainer.stories.tsx +0 -136
- package/src/components/MarkdownContainer.tsx +0 -113
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +0 -108
- package/src/components/MarkdownSettings/index.ts +0 -5
- package/src/components/Suggestions.stories.tsx +0 -225
- package/src/events.ts +0 -11
- package/src/functions/create.conversations.json +0 -1
- package/src/functions/create.test.ts +0 -128
- package/src/functions/create.ts +0 -34
- package/src/functions/index.ts +0 -13
- package/src/functions/open.ts +0 -32
- package/src/functions/update.conversations.json +0 -1
- package/src/functions/update.test.ts +0 -151
- package/src/functions/update.ts +0 -37
- package/src/hooks/useSelectCurrentThread.tsx +0 -66
- package/src/toolkit.ts +0 -6
- package/src/types/MarkdownAction.ts +0 -29
- /package/dist/lib/browser/{MarkdownCard-JYMDPKV5.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-Y75XSVBX.mjs.map → operations/index.mjs.map} +0 -0
- /package/dist/lib/{browser/blueprint-definition-GIPKFDY5.mjs.map → node-esm/blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/operations/index.mjs.map} +0 -0
- /package/dist/types/src/{functions → operations}/create.test.d.ts +0 -0
- /package/dist/types/src/{functions → operations}/update.test.d.ts +0 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
|
|
9
|
+
import { 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
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
14
|
+
import { Database, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { Collection } from '@dxos/echo';
|
|
16
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
|
+
import { FunctionInvocationService } from '@dxos/functions';
|
|
18
|
+
import { invariant } from '@dxos/invariant';
|
|
19
|
+
import { ObjectId } from '@dxos/keys';
|
|
20
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
21
|
+
import { HasSubject } from '@dxos/types';
|
|
22
|
+
import { trim } from '@dxos/util';
|
|
23
|
+
|
|
24
|
+
import { WithProperties } from '../testing';
|
|
25
|
+
import MarkdownBlueprint from '../blueprints/markdown-blueprint';
|
|
26
|
+
|
|
27
|
+
import { Update } from './definitions';
|
|
28
|
+
import { MarkdownOperationHandlerSet } from './index';
|
|
29
|
+
|
|
30
|
+
ObjectId.dangerouslyDisableRandomness();
|
|
31
|
+
|
|
32
|
+
const TestLayer = AssistantTestLayer({
|
|
33
|
+
operationHandlers: MarkdownOperationHandlerSet,
|
|
34
|
+
types: [SpaceProperties, Collection.Collection, Blueprint.Blueprint, Markdown.Document, HasSubject.HasSubject],
|
|
35
|
+
tracing: 'pretty',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('update', () => {
|
|
39
|
+
it.effect(
|
|
40
|
+
'call a function to update a markdown document',
|
|
41
|
+
Effect.fnUntraced(
|
|
42
|
+
function* (_) {
|
|
43
|
+
const doc = Markdown.make({
|
|
44
|
+
name: 'BlueYard',
|
|
45
|
+
content: 'Founders and portfolio of BlueYard.',
|
|
46
|
+
});
|
|
47
|
+
yield* Database.add(doc);
|
|
48
|
+
|
|
49
|
+
yield* FunctionInvocationService.invokeFunction(Update, {
|
|
50
|
+
doc: Ref.make(doc),
|
|
51
|
+
edits: [{ oldString: 'Founders', newString: '# Founders' }],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const updatedDoc = yield* Database.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
55
|
+
expect(updatedDoc.name).toBe(doc.name);
|
|
56
|
+
const text = yield* Database.load(updatedDoc.content);
|
|
57
|
+
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
58
|
+
},
|
|
59
|
+
WithProperties,
|
|
60
|
+
Effect.provide(TestLayer),
|
|
61
|
+
TestHelpers.provideTestContext,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
it.scoped(
|
|
66
|
+
'create and update a markdown document',
|
|
67
|
+
Effect.fnUntraced(
|
|
68
|
+
function* (_) {
|
|
69
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
70
|
+
yield* AiContextService.bindContext({
|
|
71
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
yield* AiConversationService.run({
|
|
75
|
+
prompt: `Create a document with a cookie recipe.`,
|
|
76
|
+
});
|
|
77
|
+
{
|
|
78
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
79
|
+
if (docs.length !== 1) {
|
|
80
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const doc = docs[0];
|
|
84
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
85
|
+
console.log({
|
|
86
|
+
name: doc.name,
|
|
87
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
yield* AiConversationService.run({
|
|
92
|
+
prompt: 'Add a section with a holiday-themed variation.',
|
|
93
|
+
});
|
|
94
|
+
{
|
|
95
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
96
|
+
if (docs.length !== 1) {
|
|
97
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const doc = docs[0];
|
|
101
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
102
|
+
console.log({
|
|
103
|
+
name: doc.name,
|
|
104
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
WithProperties,
|
|
109
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
110
|
+
TestHelpers.provideTestContext,
|
|
111
|
+
),
|
|
112
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
it.scoped(
|
|
116
|
+
'update existing document',
|
|
117
|
+
Effect.fnUntraced(
|
|
118
|
+
function* (_) {
|
|
119
|
+
const document = yield* Database.add(
|
|
120
|
+
Markdown.make({
|
|
121
|
+
name: 'Cookie Recipe',
|
|
122
|
+
content: trim`
|
|
123
|
+
Ingredients:
|
|
124
|
+
- 2 cups of ???
|
|
125
|
+
- 1 cup of sugar
|
|
126
|
+
- 1 cup of butter
|
|
127
|
+
- 1 cup of eggs
|
|
128
|
+
`,
|
|
129
|
+
}),
|
|
130
|
+
);
|
|
131
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
132
|
+
yield* AiContextService.bindContext({
|
|
133
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
134
|
+
objects: [Ref.make(document)],
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
yield* AiConversationService.run({
|
|
138
|
+
prompt: 'Add the missing ingredient (its flour).',
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
143
|
+
if (docs.length !== 1) {
|
|
144
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const doc = docs[0];
|
|
148
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
149
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
150
|
+
console.log({
|
|
151
|
+
name: doc.name,
|
|
152
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
153
|
+
});
|
|
154
|
+
expect(content.toLowerCase()).toContain('flour');
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
WithProperties,
|
|
158
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
159
|
+
TestHelpers.provideTestContext,
|
|
160
|
+
),
|
|
161
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
it.scoped(
|
|
165
|
+
'add lines to document one by one',
|
|
166
|
+
Effect.fnUntraced(
|
|
167
|
+
function* (_) {
|
|
168
|
+
const document = yield* Database.add(
|
|
169
|
+
Markdown.make({
|
|
170
|
+
name: 'Shopping list',
|
|
171
|
+
content: trim`
|
|
172
|
+
# Shopping list
|
|
173
|
+
`,
|
|
174
|
+
}),
|
|
175
|
+
);
|
|
176
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
177
|
+
yield* AiContextService.bindContext({
|
|
178
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
179
|
+
objects: [Ref.make(document)],
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
yield* AiConversationService.run({
|
|
183
|
+
prompt: 'Add milk to the shopping list.',
|
|
184
|
+
});
|
|
185
|
+
yield* AiConversationService.run({
|
|
186
|
+
prompt: 'Add bread to the shopping list.',
|
|
187
|
+
});
|
|
188
|
+
yield* AiConversationService.run({
|
|
189
|
+
prompt: 'Add eggs to the shopping list.',
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
{
|
|
193
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
194
|
+
if (docs.length !== 1) {
|
|
195
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const doc = docs[0];
|
|
199
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
200
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
201
|
+
console.log({
|
|
202
|
+
name: doc.name,
|
|
203
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
204
|
+
});
|
|
205
|
+
expect(content.toLowerCase()).toContain('milk');
|
|
206
|
+
expect(content.toLowerCase()).toContain('bread');
|
|
207
|
+
expect(content.toLowerCase()).toContain('eggs');
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
WithProperties,
|
|
211
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
212
|
+
TestHelpers.provideTestContext,
|
|
213
|
+
),
|
|
214
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
215
|
+
);
|
|
216
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { next as A, type Doc } from '@automerge/automerge';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
11
|
+
|
|
12
|
+
import { Update } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof Update> = Update.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fn(function* ({ doc, edits }) {
|
|
17
|
+
const content = yield* doc.pipe(
|
|
18
|
+
Database.load,
|
|
19
|
+
Effect.map((_) => _.content),
|
|
20
|
+
Effect.flatMap(Database.load),
|
|
21
|
+
);
|
|
22
|
+
const accessor = createDocAccessor(content, ['content']);
|
|
23
|
+
|
|
24
|
+
for (const edit of edits) {
|
|
25
|
+
accessor.handle.change((doc: Doc<typeof content>) => {
|
|
26
|
+
const text = DocAccessor.getValue<string>(accessor);
|
|
27
|
+
if (edit.replaceAll) {
|
|
28
|
+
let idx = text.indexOf(edit.oldString);
|
|
29
|
+
while (idx !== -1) {
|
|
30
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
31
|
+
const updated = DocAccessor.getValue<string>(accessor);
|
|
32
|
+
idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
const idx = text.indexOf(edit.oldString);
|
|
36
|
+
if (idx === -1) {
|
|
37
|
+
throw new Error(`Edit not found: ${JSON.stringify(edit.oldString)}`);
|
|
38
|
+
}
|
|
39
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
newContent: DocAccessor.getValue<string>(accessor),
|
|
46
|
+
};
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default handler;
|
package/src/testing.ts
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
9
|
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import { Collection } from '@dxos/
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
|
+
import { Collection } from '@dxos/echo';
|
|
12
12
|
|
|
13
13
|
// TODO(wittjosiah): Factor out.
|
|
14
|
-
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R |
|
|
14
|
+
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield*
|
|
19
|
-
Obj.make(
|
|
18
|
+
yield* Database.add(
|
|
19
|
+
Obj.make(SpaceProperties, {
|
|
20
20
|
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
21
|
}) as any,
|
|
22
22
|
);
|
package/src/translations.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
9
|
import { Markdown } from './types';
|
|
@@ -16,8 +17,10 @@ export const translations = [
|
|
|
16
17
|
'typename label_one': 'Document',
|
|
17
18
|
'typename label_other': 'Documents',
|
|
18
19
|
'object name placeholder': 'New document',
|
|
20
|
+
'add object label': 'Add document',
|
|
19
21
|
'rename object label': 'Rename document',
|
|
20
22
|
'delete object label': 'Delete document',
|
|
23
|
+
'object deleted label': 'Document deleted',
|
|
21
24
|
},
|
|
22
25
|
[meta.id]: {
|
|
23
26
|
'plugin name': 'Editor',
|
|
@@ -49,4 +52,5 @@ export const translations = [
|
|
|
49
52
|
},
|
|
50
53
|
},
|
|
51
54
|
},
|
|
55
|
+
...editorTranslations,
|
|
52
56
|
] as const satisfies Resource[];
|
package/src/types/Markdown.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { DescriptionAnnotation,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Document Item type.
|
|
@@ -15,16 +15,19 @@ import { ItemAnnotation, Text } from '@dxos/schema';
|
|
|
15
15
|
export const Document = Schema.Struct({
|
|
16
16
|
name: Schema.optional(Schema.String),
|
|
17
17
|
description: Schema.optional(Schema.String),
|
|
18
|
-
fallbackName: Schema.String.pipe(
|
|
19
|
-
content:
|
|
18
|
+
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
|
+
content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
20
|
}).pipe(
|
|
21
|
-
Type.
|
|
22
|
-
typename: 'dxos.
|
|
21
|
+
Type.object({
|
|
22
|
+
typename: 'org.dxos.type.document',
|
|
23
23
|
version: '0.1.0',
|
|
24
24
|
}),
|
|
25
25
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
26
|
DescriptionAnnotation.set('description'),
|
|
27
|
-
|
|
27
|
+
Annotation.IconAnnotation.set({
|
|
28
|
+
icon: 'ph--text-aa--regular',
|
|
29
|
+
hue: 'indigo',
|
|
30
|
+
}),
|
|
28
31
|
);
|
|
29
32
|
|
|
30
33
|
export type Document = Schema.Schema.Type<typeof Document>;
|
|
@@ -35,8 +38,12 @@ export type Document = Schema.Schema.Type<typeof Document>;
|
|
|
35
38
|
export const make = ({
|
|
36
39
|
content = '',
|
|
37
40
|
...props
|
|
38
|
-
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) =>
|
|
39
|
-
Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
41
|
+
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {
|
|
42
|
+
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
43
|
+
// TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.
|
|
44
|
+
Obj.setParent(doc.content.target!, doc);
|
|
45
|
+
return doc;
|
|
46
|
+
};
|
|
40
47
|
|
|
41
48
|
/**
|
|
42
49
|
* Plugin settings.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
6
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { type EditorStateStore, type EditorViewMode } from '@dxos/ui-editor';
|
|
11
|
+
|
|
12
|
+
import { meta } from '../meta';
|
|
13
|
+
|
|
14
|
+
import type * as Markdown from './Markdown';
|
|
15
|
+
import { type MarkdownExtensionProvider } from './types';
|
|
16
|
+
|
|
17
|
+
/** Schema for persisted markdown state. */
|
|
18
|
+
export const MarkdownStateSchema = Schema.mutable(
|
|
19
|
+
Schema.Struct({
|
|
20
|
+
viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export type MarkdownState = {
|
|
25
|
+
viewMode: Record<string, EditorViewMode>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type EditorViewEntry = { view: EditorView; documentId: string };
|
|
29
|
+
|
|
30
|
+
export type EditorViewRegistry = {
|
|
31
|
+
register: (attendableId: string, view: EditorView, documentId: string) => void;
|
|
32
|
+
unregister: (attendableId: string) => void;
|
|
33
|
+
get: (attendableId: string) => EditorViewEntry | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export namespace MarkdownCapabilities {
|
|
37
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}.capability.settings`);
|
|
38
|
+
|
|
39
|
+
/** Persisted state atom for view mode per document. */
|
|
40
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}.capability.state`);
|
|
41
|
+
|
|
42
|
+
/** Editor state store for cursor positions, scroll state, etc. */
|
|
43
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}.capability.editor-state`);
|
|
44
|
+
|
|
45
|
+
/** Registry of active EditorView instances keyed by attendable ID. */
|
|
46
|
+
export const EditorViews = Capability.make<EditorViewRegistry>(`${meta.id}.capability.editor-views`);
|
|
47
|
+
|
|
48
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
49
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}.capability.extensions`);
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { meta } from '../meta';
|
|
9
|
+
|
|
10
|
+
export namespace MarkdownEvents {
|
|
11
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
12
|
+
`${meta.id}.event.setup-extensions`,
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Extension } from '@
|
|
6
|
-
|
|
5
|
+
import { type Extension } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
7
8
|
|
|
8
9
|
import { type Document } from './Markdown';
|
|
9
10
|
|
package/src/util.test.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { getFallbackName } from './util';
|
|
10
|
+
|
|
11
|
+
describe('markdown utils', () => {
|
|
12
|
+
it('getFallbackName', () => {
|
|
13
|
+
const tests = [
|
|
14
|
+
{
|
|
15
|
+
content: '',
|
|
16
|
+
expected: '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
content: trim`
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
# Welcome to Composer by DXOS
|
|
23
|
+
|
|
24
|
+
## What is Composer?
|
|
25
|
+
`,
|
|
26
|
+
expected: 'Welcome to Composer by DXOS',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
content: trim`
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
This document is about the decetralized platform DXOS.
|
|
35
|
+
`,
|
|
36
|
+
expected: 'This document is about the…',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
tests.forEach(({ content, expected }) => {
|
|
41
|
+
expect(getFallbackName(content)).toBe(expected);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/util.tsx
CHANGED
|
@@ -32,23 +32,93 @@ export const isMarkdownProperties = (data: unknown): data is MarkdownProperties
|
|
|
32
32
|
|
|
33
33
|
const nonTitleChars = /[^\w ]/g;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
// Lines matching these patterns are skipped.
|
|
36
|
+
const skipPatterns = [
|
|
37
|
+
/^!\[/, // Image.
|
|
38
|
+
/^---\s*$/, // Horizontal rule.
|
|
39
|
+
/^```/, // Code block fence.
|
|
40
|
+
/^\s*$/, // Empty or whitespace-only.
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// Patterns to extract title text (first capture group is used).
|
|
44
|
+
const titlePatterns = [
|
|
45
|
+
/^#{1,6}\s+(.+)/, // Heading.
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extracts a fallback name by scanning lines for the first heading or text fragment.
|
|
50
|
+
*/
|
|
51
|
+
export const getFallbackName = (content = ''): string => {
|
|
52
|
+
const len = content.length;
|
|
53
|
+
|
|
54
|
+
let i = 0;
|
|
55
|
+
while (i < len) {
|
|
56
|
+
// Find end of line.
|
|
57
|
+
let lineEnd = i;
|
|
58
|
+
while (lineEnd < len && content[lineEnd] !== '\n') {
|
|
59
|
+
lineEnd++;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const line = content.slice(i, lineEnd).trim();
|
|
63
|
+
i = lineEnd + 1;
|
|
64
|
+
|
|
65
|
+
// Skip lines matching skip patterns.
|
|
66
|
+
if (skipPatterns.some((pattern) => pattern.test(line))) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Check for title patterns.
|
|
71
|
+
for (const pattern of titlePatterns) {
|
|
72
|
+
const match = pattern.exec(line);
|
|
73
|
+
if (match) {
|
|
74
|
+
const text = match[1].replaceAll(nonTitleChars, '').trim();
|
|
75
|
+
if (text.length > 0) {
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use line as plain text fallback.
|
|
82
|
+
const maxLen = 32;
|
|
83
|
+
const text = line.replaceAll(nonTitleChars, '').trim();
|
|
84
|
+
if (text.length > 0) {
|
|
85
|
+
if (text.length > maxLen) {
|
|
86
|
+
const words = text.split(/\s+/);
|
|
87
|
+
let result = '';
|
|
88
|
+
for (const word of words) {
|
|
89
|
+
const next = result.length === 0 ? word : result + ' ' + word;
|
|
90
|
+
if (next.length > maxLen) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
result = next;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return result + '…';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return text;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return '';
|
|
37
104
|
};
|
|
38
105
|
|
|
39
|
-
|
|
106
|
+
// TODO(burdon): Option to strip Markdown.
|
|
107
|
+
export const getContentSnippet = (content = '', maxLines = 3) => {
|
|
40
108
|
const abstract = content
|
|
41
109
|
.split('\n')
|
|
42
|
-
.filter((line) => !line.startsWith('
|
|
110
|
+
.filter((line) => !line.startsWith('!'))
|
|
43
111
|
.filter((line) => line.trim() !== '');
|
|
44
112
|
|
|
45
|
-
return abstract.
|
|
113
|
+
return abstract.slice(0, maxLines).join('\n') ?? '';
|
|
46
114
|
};
|
|
47
115
|
|
|
48
116
|
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
49
117
|
const name = getFallbackName(content);
|
|
50
118
|
if (doc.fallbackName !== name) {
|
|
51
|
-
doc
|
|
119
|
+
Obj.change(doc, (obj) => {
|
|
120
|
+
obj.fallbackName = name;
|
|
121
|
+
});
|
|
52
122
|
}
|
|
53
123
|
}, 200);
|
|
54
124
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownCard,
|
|
3
|
-
MarkdownCard_default
|
|
4
|
-
} from "./chunk-PBJLFIOX.mjs";
|
|
5
|
-
import "./chunk-GH6GQSBL.mjs";
|
|
6
|
-
import "./chunk-QYSEJ5GP.mjs";
|
|
7
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownCard,
|
|
10
|
-
MarkdownCard_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownCard-JYMDPKV5.mjs.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownContainer,
|
|
3
|
-
MarkdownContainer_default
|
|
4
|
-
} from "./chunk-K3LXOU3E.mjs";
|
|
5
|
-
import "./chunk-2MLGSYRN.mjs";
|
|
6
|
-
import "./chunk-Y53FQREH.mjs";
|
|
7
|
-
import "./chunk-IBCHVMZW.mjs";
|
|
8
|
-
import "./chunk-GH6GQSBL.mjs";
|
|
9
|
-
import "./chunk-QYSEJ5GP.mjs";
|
|
10
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
11
|
-
export {
|
|
12
|
-
MarkdownContainer,
|
|
13
|
-
MarkdownContainer_default as default
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=MarkdownContainer-Y75XSVBX.mjs.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Markdown_exports
|
|
3
|
-
} from "./chunk-QYSEJ5GP.mjs";
|
|
4
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/anchor-sort.ts
|
|
7
|
-
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
8
|
-
import { createDocAccessor, getRangeFromCursor, getTarget } from "@dxos/react-client/echo";
|
|
9
|
-
var anchor_sort_default = (() => contributes(Capabilities.AnchorSort, {
|
|
10
|
-
key: Markdown_exports.Document.typename,
|
|
11
|
-
sort: (anchorA, anchorB) => {
|
|
12
|
-
const doc = getTarget(anchorA);
|
|
13
|
-
const accessor = doc.content.target ? createDocAccessor(doc.content.target, [
|
|
14
|
-
"content"
|
|
15
|
-
]) : void 0;
|
|
16
|
-
if (doc !== getTarget(anchorB) || !accessor) {
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
const getStartPosition = (cursor) => {
|
|
20
|
-
const range = cursor ? getRangeFromCursor(accessor, cursor) : void 0;
|
|
21
|
-
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
22
|
-
};
|
|
23
|
-
const posA = getStartPosition(anchorA.anchor);
|
|
24
|
-
const posB = getStartPosition(anchorB.anchor);
|
|
25
|
-
return posA - posB;
|
|
26
|
-
}
|
|
27
|
-
}));
|
|
28
|
-
export {
|
|
29
|
-
anchor_sort_default as default
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=anchor-sort-3HGPGCOO.mjs.map
|