@dxos/plugin-markdown 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownSettings-5AD3X3II.mjs +124 -0
- package/dist/lib/browser/MarkdownSettings-5AD3X3II.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +47 -4
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-46WIDM4R.mjs +98 -0
- package/dist/lib/browser/chunk-46WIDM4R.mjs.map +7 -0
- package/dist/lib/browser/chunk-GQKARRJU.mjs +158 -0
- package/dist/lib/browser/chunk-GQKARRJU.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/cli/index.mjs +26 -19
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/create-I7QWPBMS.mjs +30 -0
- package/dist/lib/browser/create-I7QWPBMS.mjs.map +7 -0
- package/dist/lib/browser/create-markdown-6QQXSF3Q.mjs +22 -0
- package/dist/lib/browser/create-markdown-6QQXSF3Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +586 -85
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-NSBN4NKR.mjs +21 -0
- package/dist/lib/browser/open-NSBN4NKR.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-RA5OMQCP.mjs +49 -0
- package/dist/lib/browser/scroll-to-anchor-RA5OMQCP.mjs.map +7 -0
- package/dist/lib/browser/set-view-mode-75MBU6CB.mjs +26 -0
- package/dist/lib/browser/set-view-mode-75MBU6CB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -7
- package/dist/lib/browser/update-QQJYONAC.mjs +45 -0
- package/dist/lib/browser/update-QQJYONAC.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-ODDM67XG.mjs +125 -0
- package/dist/lib/node-esm/MarkdownSettings-ODDM67XG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +47 -4
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs +99 -0
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-QRCQ55W7.mjs +159 -0
- package/dist/lib/node-esm/chunk-QRCQ55W7.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +26 -19
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/create-VJ5SIKYF.mjs +31 -0
- package/dist/lib/node-esm/create-VJ5SIKYF.mjs.map +7 -0
- package/dist/lib/node-esm/create-markdown-P5KNGLZ5.mjs +23 -0
- package/dist/lib/node-esm/create-markdown-P5KNGLZ5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +586 -85
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-U3T6IVHN.mjs +22 -0
- package/dist/lib/node-esm/open-U3T6IVHN.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-CVM3LVSQ.mjs +50 -0
- package/dist/lib/node-esm/scroll-to-anchor-CVM3LVSQ.mjs.map +7 -0
- package/dist/lib/node-esm/set-view-mode-WQJBCUXY.mjs +27 -0
- package/dist/lib/node-esm/set-view-mode-WQJBCUXY.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -7
- package/dist/lib/node-esm/update-24CQM75C.mjs +46 -0
- package/dist/lib/node-esm/update-24CQM75C.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +27 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +4 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +24 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +14 -9
- 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 +4 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +11 -6
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +138 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +2 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/{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/{components → containers/MarkdownContainer}/MarkdownContainer.d.ts +10 -7
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +99 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +7 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-markdown.d.ts +5 -0
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/create.test.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +64 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/operations/set-view-mode.d.ts +5 -0
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -0
- package/dist/types/src/operations/update.d.ts +5 -0
- package/dist/types/src/operations/update.d.ts.map +1 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +75 -35
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +15 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +16 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +31 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +2 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +89 -57
- package/src/MarkdownPlugin.tsx +49 -44
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/markdown-blueprint.ts +14 -8
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +14 -9
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +13 -7
- package/src/capabilities/node.ts +11 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +48 -27
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/state.ts +47 -0
- package/src/cli/plugin.ts +21 -10
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +29 -29
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +63 -32
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +24 -17
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +47 -55
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +40 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +114 -98
- package/src/components/MarkdownSettings/index.ts +3 -1
- package/src/components/index.ts +4 -12
- package/src/{components → containers}/MarkdownCard/MarkdownCard.stories.tsx +17 -7
- package/src/{components → containers}/MarkdownCard/MarkdownCard.tsx +23 -30
- package/src/{components → containers}/MarkdownCard/index.ts +0 -2
- package/src/containers/MarkdownCard/snippet.ts +75 -0
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.tsx +28 -18
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.tsx +59 -36
- package/src/containers/MarkdownContainer/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +80 -93
- package/src/hooks/useLinkQuery.ts +31 -6
- package/src/index.ts +2 -0
- package/src/meta.ts +1 -1
- package/src/operations/create-markdown.ts +21 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/operations/create.test.ts +98 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/definitions.ts +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 +215 -0
- package/src/operations/update.ts +51 -0
- package/src/testing.ts +2 -2
- package/src/translations.ts +49 -35
- package/src/types/Markdown.ts +18 -25
- package/src/types/Settings.ts +28 -0
- package/src/types/capabilities.ts +17 -5
- package/src/types/events.ts +5 -4
- package/src/types/index.ts +3 -4
- package/src/util.tsx +5 -5
- package/dist/lib/browser/MarkdownCard-WHK3ORP7.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +0 -12
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs +0 -32
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +0 -58
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +0 -19
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BX73DASG.mjs +0 -702
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +0 -7
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +0 -8
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWQQW6KU.mjs +0 -144
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXYQLKH.mjs +0 -55
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +0 -7
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +0 -104
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +0 -167
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +0 -7
- package/dist/lib/browser/chunk-S45ULIOG.mjs +0 -101
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +0 -7
- package/dist/lib/browser/chunk-WIPSLZ6L.mjs +0 -60
- package/dist/lib/browser/chunk-WIPSLZ6L.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +0 -53
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SRPLD3ED.mjs +0 -213
- package/dist/lib/browser/react-surface-SRPLD3ED.mjs.map +0 -7
- package/dist/lib/browser/settings-JY5JE7MI.mjs +0 -35
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +0 -7
- package/dist/lib/browser/state-QE7VSJWJ.mjs +0 -29
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-WJPLQTFS.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-WJPLQTFS.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +0 -13
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +0 -59
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +0 -20
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +0 -105
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs +0 -56
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +0 -703
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs +0 -145
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +0 -168
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs +0 -61
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +0 -102
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +0 -10
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs +0 -54
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RONSOJIQ.mjs +0 -214
- package/dist/lib/node-esm/react-surface-RONSOJIQ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +0 -36
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +0 -7
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +0 -30
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +0 -7
- package/dist/types/src/blueprints/functions/create.d.ts +0 -8
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -4
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/open.d.ts +0 -7
- package/dist/types/src/blueprints/functions/open.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -6
- package/dist/types/src/blueprints/functions/update.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +0 -5
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -5
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -10
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -6
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -5
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +0 -59
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +0 -6
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +0 -1
- package/dist/types/src/types/MarkdownAction.d.ts +0 -66
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/src/blueprints/functions/create.conversations.json +0 -1
- package/src/blueprints/functions/create.test.ts +0 -125
- package/src/blueprints/functions/create.ts +0 -34
- package/src/blueprints/functions/index.ts +0 -7
- package/src/blueprints/functions/open.ts +0 -33
- package/src/blueprints/functions/update.conversations.json +0 -1
- package/src/blueprints/functions/update.test.ts +0 -149
- package/src/blueprints/functions/update.ts +0 -38
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/app-graph-serializer/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -25
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -45
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/state/state.ts +0 -31
- package/src/components/Suggestions.stories.tsx +0 -215
- package/src/hooks/useSelectCurrentThread.tsx +0 -61
- package/src/types/MarkdownAction.ts +0 -59
- /package/dist/lib/browser/{MarkdownCard-WHK3ORP7.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/MarkdownContainer-V7EAADMF.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.stories.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/create.test.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/update.test.d.ts +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Layer from 'effect/Layer';
|
|
8
|
-
|
|
9
|
-
import { AiService, ConsolePrinter } from '@dxos/ai';
|
|
10
|
-
import { MemoizedAiService, TestAiService } from '@dxos/ai/testing';
|
|
11
|
-
import {
|
|
12
|
-
AiConversation,
|
|
13
|
-
type ContextBinding,
|
|
14
|
-
GenerationObserver,
|
|
15
|
-
makeToolExecutionServiceFromFunctions,
|
|
16
|
-
makeToolResolverFromFunctions,
|
|
17
|
-
} from '@dxos/assistant';
|
|
18
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
19
|
-
import { SpaceProperties } from '@dxos/client-protocol';
|
|
20
|
-
import { Obj, Query, Ref } from '@dxos/echo';
|
|
21
|
-
import { Database } from '@dxos/echo';
|
|
22
|
-
import { acquireReleaseResource } from '@dxos/effect';
|
|
23
|
-
import { TestHelpers } from '@dxos/effect/testing';
|
|
24
|
-
import { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';
|
|
25
|
-
import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
26
|
-
import { invariant } from '@dxos/invariant';
|
|
27
|
-
import { ObjectId } from '@dxos/keys';
|
|
28
|
-
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
29
|
-
import { Collection } from '@dxos/schema';
|
|
30
|
-
import { HasSubject, type Message } from '@dxos/types';
|
|
31
|
-
|
|
32
|
-
import { WithProperties, testToolkit } from '../../testing';
|
|
33
|
-
import * as MarkdownBlueprint from '../markdown-blueprint';
|
|
34
|
-
|
|
35
|
-
import update from './update';
|
|
36
|
-
|
|
37
|
-
ObjectId.dangerouslyDisableRandomness();
|
|
38
|
-
|
|
39
|
-
const TestLayer = Layer.mergeAll(
|
|
40
|
-
AiService.model('@anthropic/claude-opus-4-0'),
|
|
41
|
-
makeToolResolverFromFunctions(MarkdownBlueprint.functions, testToolkit),
|
|
42
|
-
makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
|
|
43
|
-
).pipe(
|
|
44
|
-
Layer.provideMerge(
|
|
45
|
-
FunctionInvocationServiceLayerTest({
|
|
46
|
-
functions: MarkdownBlueprint.functions,
|
|
47
|
-
}),
|
|
48
|
-
),
|
|
49
|
-
Layer.provideMerge(
|
|
50
|
-
Layer.mergeAll(
|
|
51
|
-
TestAiService(),
|
|
52
|
-
TestDatabaseLayer({
|
|
53
|
-
spaceKey: 'fixed',
|
|
54
|
-
indexing: { vector: true },
|
|
55
|
-
types: [SpaceProperties, Collection.Collection, Blueprint.Blueprint, Markdown.Document, HasSubject.HasSubject],
|
|
56
|
-
}),
|
|
57
|
-
CredentialsService.configuredLayer([]),
|
|
58
|
-
TracingService.layerNoop,
|
|
59
|
-
),
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
describe('update', () => {
|
|
64
|
-
it.effect(
|
|
65
|
-
'call a function to update a markdown document',
|
|
66
|
-
Effect.fnUntraced(
|
|
67
|
-
function* (_) {
|
|
68
|
-
const doc = Markdown.make({
|
|
69
|
-
name: 'BlueYard',
|
|
70
|
-
content: 'Founders and portfolio of BlueYard.',
|
|
71
|
-
});
|
|
72
|
-
yield* Database.Service.add(doc);
|
|
73
|
-
|
|
74
|
-
yield* FunctionInvocationService.invokeFunction(update, {
|
|
75
|
-
id: doc.id,
|
|
76
|
-
diffs: ['- Founders', '+ # Founders'],
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const updatedDoc = yield* Database.Service.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
80
|
-
expect(updatedDoc.name).toBe(doc.name);
|
|
81
|
-
const text = yield* Database.Service.load(updatedDoc.content);
|
|
82
|
-
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
83
|
-
},
|
|
84
|
-
WithProperties,
|
|
85
|
-
Effect.provide(TestLayer),
|
|
86
|
-
TestHelpers.provideTestContext,
|
|
87
|
-
),
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
it.scoped(
|
|
91
|
-
'create and update a markdown document',
|
|
92
|
-
Effect.fnUntraced(
|
|
93
|
-
function* (_) {
|
|
94
|
-
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
95
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
96
|
-
|
|
97
|
-
yield* Database.Service.flush({ indexes: true });
|
|
98
|
-
const markdownBlueprint = yield* Database.Service.add(Obj.clone(MarkdownBlueprint.make()));
|
|
99
|
-
yield* Effect.promise(() =>
|
|
100
|
-
conversation.context.bind({
|
|
101
|
-
blueprints: [Ref.make(markdownBlueprint)],
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const observer = GenerationObserver.fromPrinter(new ConsolePrinter());
|
|
106
|
-
|
|
107
|
-
yield* conversation.createRequest({
|
|
108
|
-
observer,
|
|
109
|
-
prompt: `Create a document with a cookie recipe.`,
|
|
110
|
-
});
|
|
111
|
-
{
|
|
112
|
-
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
113
|
-
if (docs.length !== 1) {
|
|
114
|
-
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const doc = docs[0];
|
|
118
|
-
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
119
|
-
console.log({
|
|
120
|
-
name: doc.name,
|
|
121
|
-
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
yield* conversation.createRequest({
|
|
126
|
-
observer,
|
|
127
|
-
prompt: 'Add a section with a holiday-themed variation.',
|
|
128
|
-
});
|
|
129
|
-
{
|
|
130
|
-
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
131
|
-
if (docs.length !== 1) {
|
|
132
|
-
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const doc = docs[0];
|
|
136
|
-
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
137
|
-
console.log({
|
|
138
|
-
name: doc.name,
|
|
139
|
-
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
WithProperties,
|
|
144
|
-
Effect.provide(TestLayer),
|
|
145
|
-
TestHelpers.provideTestContext,
|
|
146
|
-
),
|
|
147
|
-
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
148
|
-
);
|
|
149
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { ArtifactId, applyDiffs } from '@dxos/assistant';
|
|
9
|
-
import { Database } from '@dxos/echo';
|
|
10
|
-
import { createDocAccessor } from '@dxos/echo-db';
|
|
11
|
-
import { defineFunction } from '@dxos/functions';
|
|
12
|
-
import { trim } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { Markdown } from '../../types';
|
|
15
|
-
|
|
16
|
-
// TODO(wittjosiah): Reconcile with ThreadAction.AddProposal.
|
|
17
|
-
export default defineFunction({
|
|
18
|
-
key: 'dxos.org/function/markdown/update',
|
|
19
|
-
name: 'Update',
|
|
20
|
-
description: trim`
|
|
21
|
-
Applies a set of diffs to the markdown document.
|
|
22
|
-
`,
|
|
23
|
-
inputSchema: Schema.Struct({
|
|
24
|
-
id: ArtifactId.annotations({
|
|
25
|
-
description: 'The ID of the markdown document.',
|
|
26
|
-
}),
|
|
27
|
-
diffs: Schema.Array(Schema.String).annotations({
|
|
28
|
-
description: 'The diffs to apply to the document.',
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
outputSchema: Schema.Void,
|
|
32
|
-
handler: Effect.fn(function* ({ data: { id, diffs } }) {
|
|
33
|
-
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Markdown.Document);
|
|
34
|
-
const content = yield* Effect.promise(() => object.content.load());
|
|
35
|
-
const accessor = createDocAccessor(content, ['content']);
|
|
36
|
-
applyDiffs(accessor, diffs);
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { MarkdownBlueprint } from '../../blueprints';
|
|
10
|
-
|
|
11
|
-
export const functions = MarkdownBlueprint.functions;
|
|
12
|
-
|
|
13
|
-
export type BlueprintCapabilities = [
|
|
14
|
-
Capability.Capability<typeof Common.Capability.Functions>,
|
|
15
|
-
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
19
|
-
Effect.succeed([
|
|
20
|
-
Capability.contributes(Common.Capability.Functions, functions),
|
|
21
|
-
Capability.contributes(Common.Capability.BlueprintDefinition, MarkdownBlueprint.make()),
|
|
22
|
-
]),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export default blueprintDefinition;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { OperationResolver } from '@dxos/operation';
|
|
10
|
-
import { Collection } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { Markdown, MarkdownCapabilities, MarkdownOperation } from '../../types';
|
|
13
|
-
|
|
14
|
-
export default Capability.makeModule(
|
|
15
|
-
Effect.fnUntraced(function* () {
|
|
16
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
17
|
-
OperationResolver.make({
|
|
18
|
-
operation: MarkdownOperation.OnCreateSpace,
|
|
19
|
-
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
-
const collection = Collection.makeManaged({ key: Type.getTypename(Markdown.Document) });
|
|
21
|
-
Obj.change(rootCollection, (c) => {
|
|
22
|
-
c.objects.push(Ref.make(collection));
|
|
23
|
-
});
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
OperationResolver.make({
|
|
27
|
-
operation: MarkdownOperation.Create,
|
|
28
|
-
handler: ({ name, content }) =>
|
|
29
|
-
Effect.succeed({
|
|
30
|
-
object: Markdown.make({ name, content }),
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
// TODO(wittjosiah): This appears to be unused.
|
|
34
|
-
OperationResolver.make({
|
|
35
|
-
operation: MarkdownOperation.SetViewMode,
|
|
36
|
-
handler: Effect.fnUntraced(function* ({ id, viewMode }) {
|
|
37
|
-
yield* Common.Capability.updateAtomValue(MarkdownCapabilities.State, (current) => ({
|
|
38
|
-
...current,
|
|
39
|
-
viewMode: { ...current.viewMode, [id]: viewMode },
|
|
40
|
-
}));
|
|
41
|
-
}),
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
44
|
-
}),
|
|
45
|
-
);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { createKvsStore } from '@dxos/effect';
|
|
9
|
-
import { createEditorStateStore } from '@dxos/ui-editor';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../../meta';
|
|
12
|
-
import { MarkdownCapabilities, MarkdownStateSchema } from '../../types';
|
|
13
|
-
|
|
14
|
-
export default Capability.makeModule(
|
|
15
|
-
Effect.fnUntraced(function* () {
|
|
16
|
-
// Persisted state using KVS store.
|
|
17
|
-
const stateAtom = createKvsStore({
|
|
18
|
-
key: `${meta.id}/state`,
|
|
19
|
-
schema: MarkdownStateSchema,
|
|
20
|
-
defaultValue: () => ({ viewMode: {} }),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// TODO(wittjosiah): Fold into state.
|
|
24
|
-
const editorState = createEditorStateStore(`${meta.id}/editor`);
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
Capability.contributes(MarkdownCapabilities.State, stateAtom),
|
|
28
|
-
Capability.contributes(MarkdownCapabilities.EditorState, editorState),
|
|
29
|
-
];
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta } from '@storybook/react-vite';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Function from 'effect/Function';
|
|
8
|
-
import * as Match from 'effect/Match';
|
|
9
|
-
import * as Option from 'effect/Option';
|
|
10
|
-
import * as Schema from 'effect/Schema';
|
|
11
|
-
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
12
|
-
|
|
13
|
-
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
14
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
15
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
|
-
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
17
|
-
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
20
|
-
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
21
|
-
import { faker } from '@dxos/random';
|
|
22
|
-
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
23
|
-
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
24
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
25
|
-
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
26
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
27
|
-
import { render } from '@dxos/storybook-utils';
|
|
28
|
-
import { Message } from '@dxos/types';
|
|
29
|
-
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
30
|
-
|
|
31
|
-
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
32
|
-
import { translations } from '../translations';
|
|
33
|
-
import { Markdown, MarkdownCapabilities } from '../types';
|
|
34
|
-
|
|
35
|
-
import { MarkdownContainer } from './MarkdownContainer';
|
|
36
|
-
|
|
37
|
-
faker.seed(1);
|
|
38
|
-
|
|
39
|
-
const TestItem = Schema.Struct({
|
|
40
|
-
title: Schema.String.annotations({
|
|
41
|
-
title: 'Title',
|
|
42
|
-
description: 'Product title',
|
|
43
|
-
}),
|
|
44
|
-
description: Schema.String.annotations({
|
|
45
|
-
title: 'Description',
|
|
46
|
-
description: 'Product description',
|
|
47
|
-
}),
|
|
48
|
-
}).pipe(
|
|
49
|
-
Type.object({
|
|
50
|
-
typename: 'dxos.org/type/Test',
|
|
51
|
-
version: '0.1.0',
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
56
|
-
const { parentRef } = useTextEditor({ initialValue: content });
|
|
57
|
-
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
58
|
-
|
|
59
|
-
const space = useSpace();
|
|
60
|
-
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
61
|
-
const queue = useQueue<Message.Message>(queueDxn);
|
|
62
|
-
|
|
63
|
-
const handleInsert = async () => {
|
|
64
|
-
invariant(space);
|
|
65
|
-
invariant(queue);
|
|
66
|
-
await queue.append([
|
|
67
|
-
Obj.make(Message.Message, {
|
|
68
|
-
created: new Date().toISOString(),
|
|
69
|
-
sender: { role: 'assistant' },
|
|
70
|
-
blocks: [{ _tag: 'text', text: 'Hello' }],
|
|
71
|
-
}),
|
|
72
|
-
]);
|
|
73
|
-
const message = queue.objects.at(-1);
|
|
74
|
-
invariant(message);
|
|
75
|
-
|
|
76
|
-
const text = await doc.content.load();
|
|
77
|
-
const accessor = createDocAccessor(text, ['content']);
|
|
78
|
-
const cursor = Function.pipe(
|
|
79
|
-
editorState.getState(Obj.getDXN(doc).toString())?.selection,
|
|
80
|
-
Option.fromNullable,
|
|
81
|
-
Option.map(selectionToRange),
|
|
82
|
-
Option.map((range) => toCursorRange(accessor, range.from, range.to)),
|
|
83
|
-
Option.getOrUndefined,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// {
|
|
87
|
-
// const ref = refFromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id]));
|
|
88
|
-
// const message = deref(ref);
|
|
89
|
-
// }
|
|
90
|
-
|
|
91
|
-
// void dispatch(
|
|
92
|
-
// createIntent(CollaborationActions.InsertContent, {
|
|
93
|
-
// target: doc as any as TestSchema.Expando,
|
|
94
|
-
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
95
|
-
// at: cursor,
|
|
96
|
-
// label: 'Proposal',
|
|
97
|
-
// }),
|
|
98
|
-
// );
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<Layout.Main toolbar>
|
|
103
|
-
<Toolbar.Root>
|
|
104
|
-
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
105
|
-
</Toolbar.Root>
|
|
106
|
-
<div ref={parentRef} className='p-4' />
|
|
107
|
-
</Layout.Main>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
112
|
-
const space = useSpace();
|
|
113
|
-
const [doc, setDoc] = useState<Markdown.Document>();
|
|
114
|
-
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
-
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
116
|
-
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
if (!space) {
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const doc = space.db.add(
|
|
123
|
-
Markdown.make({
|
|
124
|
-
name: 'Test',
|
|
125
|
-
content: document.replaceAll(/\[(\w+)\]/g, (_, label) => {
|
|
126
|
-
const obj = space.db.add(
|
|
127
|
-
Obj.make(TestItem, {
|
|
128
|
-
title: label,
|
|
129
|
-
description: faker.lorem.paragraph(),
|
|
130
|
-
}),
|
|
131
|
-
);
|
|
132
|
-
const dxn = Ref.make(obj).dxn.toString();
|
|
133
|
-
return `[${label}](${dxn})`;
|
|
134
|
-
}),
|
|
135
|
-
}),
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
setDoc(doc);
|
|
139
|
-
}, [space]);
|
|
140
|
-
|
|
141
|
-
if (!space || !doc) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
147
|
-
<MarkdownContainer id={doc.id} subject={doc} settings={settings} editorStateStore={editorState} />
|
|
148
|
-
<TestChat doc={doc} content={chat} />
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const storybook: Meta<typeof DefaultStory> = {
|
|
154
|
-
title: 'plugins/plugin-markdown/Suggestions',
|
|
155
|
-
render: render(DefaultStory),
|
|
156
|
-
decorators: [
|
|
157
|
-
withTheme,
|
|
158
|
-
withPluginManager({
|
|
159
|
-
plugins: [
|
|
160
|
-
...corePlugins(),
|
|
161
|
-
StorybookPlugin({}),
|
|
162
|
-
ClientPlugin({
|
|
163
|
-
types: [Markdown.Document, TestItem],
|
|
164
|
-
onClientInitialized: ({ client }) =>
|
|
165
|
-
Effect.gen(function* () {
|
|
166
|
-
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
-
}),
|
|
168
|
-
}),
|
|
169
|
-
|
|
170
|
-
MarkdownPlugin(),
|
|
171
|
-
PreviewPlugin(),
|
|
172
|
-
],
|
|
173
|
-
}),
|
|
174
|
-
],
|
|
175
|
-
parameters: {
|
|
176
|
-
layout: 'fullscreen',
|
|
177
|
-
controls: {
|
|
178
|
-
disable: true,
|
|
179
|
-
},
|
|
180
|
-
translations,
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export default storybook;
|
|
185
|
-
|
|
186
|
-
type Story = Meta<typeof DefaultStory>;
|
|
187
|
-
|
|
188
|
-
export const Default: Story = {
|
|
189
|
-
args: {
|
|
190
|
-
chat: 'Hello\n',
|
|
191
|
-
document: [
|
|
192
|
-
'# Test',
|
|
193
|
-
'',
|
|
194
|
-
faker.lorem.paragraph(1),
|
|
195
|
-
'',
|
|
196
|
-
'This is a [DXOS] story that tests [ECHO] references inside the Markdown plugin.',
|
|
197
|
-
'',
|
|
198
|
-
faker.lorem.paragraph(3),
|
|
199
|
-
'',
|
|
200
|
-
].join('\n'),
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
// TODO(wittjosiah): Factor out.
|
|
205
|
-
const selectionToRange = Match.type<EditorSelection>().pipe(
|
|
206
|
-
Match.when(
|
|
207
|
-
({ head, anchor }) => (head ? head > anchor : false),
|
|
208
|
-
({ head, anchor }) => ({ from: anchor, to: head! }) as Range,
|
|
209
|
-
),
|
|
210
|
-
Match.when(
|
|
211
|
-
({ head, anchor }) => (head ? head < anchor : false),
|
|
212
|
-
({ head, anchor }) => ({ from: head!, to: anchor }) as Range,
|
|
213
|
-
),
|
|
214
|
-
Match.orElse(({ anchor }) => ({ from: anchor, to: anchor }) as Range),
|
|
215
|
-
);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { EditorView } from '@codemirror/view';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
|
-
import { useOperationResolver } from '@dxos/app-framework/react';
|
|
11
|
-
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import { OperationResolver } from '@dxos/operation';
|
|
13
|
-
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
14
|
-
|
|
15
|
-
import { meta } from '../meta';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
19
|
-
*/
|
|
20
|
-
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
21
|
-
const scrollIntoViewHandler = useMemo(
|
|
22
|
-
() =>
|
|
23
|
-
OperationResolver.make({
|
|
24
|
-
operation: Common.LayoutOperation.ScrollIntoView,
|
|
25
|
-
position: 'hoist',
|
|
26
|
-
filter: (input) => !!editorView && input.subject === documentId && !!input.cursor,
|
|
27
|
-
handler: (input) =>
|
|
28
|
-
Effect.sync(() => {
|
|
29
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
30
|
-
const cursor = input.cursor;
|
|
31
|
-
if (!cursor) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor);
|
|
35
|
-
if (range) {
|
|
36
|
-
const selection =
|
|
37
|
-
editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
38
|
-
const effects = [
|
|
39
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
40
|
-
EditorView.scrollIntoView(range.from, {
|
|
41
|
-
y: 'start',
|
|
42
|
-
yMargin: 96,
|
|
43
|
-
}),
|
|
44
|
-
];
|
|
45
|
-
if (selection) {
|
|
46
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
47
|
-
effects.push(setSelection.of({ current: documentId }));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
editorView.dispatch({
|
|
51
|
-
effects,
|
|
52
|
-
selection: selection ? { anchor: range.from } : undefined,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
[documentId, editorView],
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
61
|
-
};
|