@dxos/plugin-markdown 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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-62YSRY7L.mjs +32 -0
- package/dist/lib/browser/MarkdownSettings-62YSRY7L.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +51 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-4KOZEH2H.mjs +121 -0
- package/dist/lib/browser/chunk-4KOZEH2H.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-QFPZONKP.mjs +158 -0
- package/dist/lib/browser/chunk-QFPZONKP.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +39 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/create-YL5ELZWP.mjs +30 -0
- package/dist/lib/browser/create-YL5ELZWP.mjs.map +7 -0
- package/dist/lib/browser/create-markdown-LU5IDKMH.mjs +22 -0
- package/dist/lib/browser/create-markdown-LU5IDKMH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +614 -142
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-AFSOZZ6G.mjs +21 -0
- package/dist/lib/browser/open-AFSOZZ6G.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-IPXV32A6.mjs +49 -0
- package/dist/lib/browser/scroll-to-anchor-IPXV32A6.mjs.map +7 -0
- package/dist/lib/browser/set-view-mode-2QWB24RR.mjs +26 -0
- package/dist/lib/browser/set-view-mode-2QWB24RR.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +12 -14
- package/dist/lib/browser/update-HZNVYBMO.mjs +45 -0
- package/dist/lib/browser/update-HZNVYBMO.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-QMPISOEU.mjs +33 -0
- package/dist/lib/node-esm/MarkdownSettings-QMPISOEU.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +52 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3OPDJJJH.mjs +122 -0
- package/dist/lib/node-esm/chunk-3OPDJJJH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JUGS6RKO.mjs +159 -0
- package/dist/lib/node-esm/chunk-JUGS6RKO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +40 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-SMQAIM3V.mjs +31 -0
- package/dist/lib/node-esm/create-SMQAIM3V.mjs.map +7 -0
- package/dist/lib/node-esm/create-markdown-X2OASYKG.mjs +23 -0
- package/dist/lib/node-esm/create-markdown-X2OASYKG.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +614 -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-SRWLLOKE.mjs +22 -0
- package/dist/lib/node-esm/open-SRWLLOKE.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-M76GXKYQ.mjs +50 -0
- package/dist/lib/node-esm/scroll-to-anchor-M76GXKYQ.mjs.map +7 -0
- package/dist/lib/node-esm/set-view-mode-6BB6KIDS.mjs +27 -0
- package/dist/lib/node-esm/set-view-mode-6BB6KIDS.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +12 -14
- package/dist/lib/node-esm/update-4CELTLXK.mjs +46 -0
- package/dist/lib/node-esm/update-4CELTLXK.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.d.ts +4 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +3 -2
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -9
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- 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 +9 -16
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +4 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -9
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- 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 +11 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +44 -21
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +8 -15
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +32 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +13 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -4
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +94 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +1 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -3
- 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/containers/MarkdownCard/index.d.ts +2 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +17 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +36 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +77 -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 +3 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts +9 -0
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -0
- package/dist/types/src/hooks/useExtensions.d.ts +24 -0
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts +4 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- 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 +2 -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 +2 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +6 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +54 -29
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +44 -0
- package/dist/types/src/types/Markdown.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +17 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +33 -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 +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +4 -60
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +17 -5
- 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 +124 -56
- package/src/MarkdownPlugin.tsx +90 -107
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +44 -0
- package/src/capabilities/anchor-sort.ts +29 -22
- package/src/capabilities/app-graph-serializer.ts +55 -42
- package/src/capabilities/artifact-definition.ts +93 -99
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +12 -10
- package/src/capabilities/node.ts +11 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +110 -102
- package/src/capabilities/settings.ts +30 -18
- package/src/capabilities/state.ts +40 -24
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +39 -0
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +63 -37
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +251 -266
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +170 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +47 -0
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +39 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +22 -92
- package/src/components/MarkdownSettings/index.ts +1 -1
- package/src/components/index.ts +4 -5
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +67 -0
- package/src/containers/MarkdownCard/MarkdownCard.tsx +68 -0
- package/src/containers/MarkdownCard/index.ts +5 -0
- package/src/containers/MarkdownCard/snippet.ts +52 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +135 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +145 -0
- package/src/containers/MarkdownContainer/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +3 -1
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/hooks/useExtensions.tsx +264 -0
- package/src/hooks/useLinkQuery.ts +108 -0
- package/src/index.ts +8 -3
- package/src/meta.ts +9 -10
- package/src/operations/create-markdown.ts +20 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/operations/create.test.ts +98 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/definitions.ts +120 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +39 -0
- package/src/operations/set-view-mode.ts +24 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/operations/update.test.ts +215 -0
- package/src/operations/update.ts +51 -0
- package/src/testing.ts +27 -0
- package/src/translations.ts +27 -30
- package/src/types/Markdown.ts +50 -0
- package/src/types/Settings.ts +65 -0
- package/src/types/capabilities.ts +50 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +5 -1
- package/src/types/types.ts +7 -50
- package/src/util.test.ts +44 -0
- package/src/util.tsx +100 -11
- package/dist/lib/browser/MarkdownContainer-BO5MZWA4.mjs +0 -771
- package/dist/lib/browser/MarkdownContainer-BO5MZWA4.mjs.map +0 -7
- package/dist/lib/browser/MarkdownPreview-XYP2VXI2.mjs +0 -80
- package/dist/lib/browser/MarkdownPreview-XYP2VXI2.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-UKJJ7ZNP.mjs +0 -32
- package/dist/lib/browser/anchor-sort-UKJJ7ZNP.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-7DKUUZSJ.mjs +0 -52
- package/dist/lib/browser/app-graph-serializer-7DKUUZSJ.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-JSUG6XPF.mjs +0 -145
- package/dist/lib/browser/artifact-definition-JSUG6XPF.mjs.map +0 -7
- package/dist/lib/browser/chunk-5JRBJCZM.mjs +0 -50
- package/dist/lib/browser/chunk-5JRBJCZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-777RIED6.mjs +0 -16
- package/dist/lib/browser/chunk-777RIED6.mjs.map +0 -7
- package/dist/lib/browser/chunk-EPTSAJZM.mjs +0 -22
- package/dist/lib/browser/chunk-EPTSAJZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-IZLATPXQ.mjs +0 -20
- package/dist/lib/browser/chunk-IZLATPXQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-LFML7LC6.mjs +0 -51
- package/dist/lib/browser/chunk-LFML7LC6.mjs.map +0 -7
- package/dist/lib/browser/chunk-UANWRJZU.mjs +0 -79
- package/dist/lib/browser/chunk-UANWRJZU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs +0 -64
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NAXBGUR3.mjs +0 -205
- package/dist/lib/browser/react-surface-NAXBGUR3.mjs.map +0 -7
- package/dist/lib/browser/settings-KN75ZQY6.mjs +0 -28
- package/dist/lib/browser/settings-KN75ZQY6.mjs.map +0 -7
- package/dist/lib/browser/state-LZWTAS65.mjs +0 -37
- package/dist/lib/browser/state-LZWTAS65.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-J2NVCX2H.mjs +0 -772
- package/dist/lib/node-esm/MarkdownContainer-J2NVCX2H.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownPreview-JEXD3KSQ.mjs +0 -81
- package/dist/lib/node-esm/MarkdownPreview-JEXD3KSQ.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-IPIS5D5B.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-IPIS5D5B.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-YRMRPW7A.mjs +0 -53
- package/dist/lib/node-esm/app-graph-serializer-YRMRPW7A.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-6C2MOHGP.mjs +0 -146
- package/dist/lib/node-esm/artifact-definition-6C2MOHGP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ACFGXH2K.mjs +0 -17
- package/dist/lib/node-esm/chunk-ACFGXH2K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CWTFQSN7.mjs +0 -52
- package/dist/lib/node-esm/chunk-CWTFQSN7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs +0 -24
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FWKOJW6J.mjs +0 -22
- package/dist/lib/node-esm/chunk-FWKOJW6J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs +0 -80
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q5DIKLN5.mjs +0 -51
- package/dist/lib/node-esm/chunk-Q5DIKLN5.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs +0 -65
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-BSAGEIN6.mjs +0 -206
- package/dist/lib/node-esm/react-surface-BSAGEIN6.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KVP7TVX7.mjs +0 -29
- package/dist/lib/node-esm/settings-KVP7TVX7.mjs.map +0 -7
- package/dist/lib/node-esm/state-NW3W4JCQ.mjs +0 -38
- package/dist/lib/node-esm/state-NW3W4JCQ.mjs.map +0 -7
- 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/components/MarkdownContainer.d.ts +0 -18
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +0 -9
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts +0 -6
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts +0 -17
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownPreview/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -12
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +0 -11
- package/dist/types/src/components/Toolbar.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/extensions.d.ts +0 -24
- package/dist/types/src/extensions.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/schema.d.ts +0 -35
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -63
- package/src/components/MarkdownContainer.stories.tsx +0 -103
- package/src/components/MarkdownContainer.tsx +0 -241
- package/src/components/MarkdownPreview/MarkdownPreview.stories.tsx +0 -74
- package/src/components/MarkdownPreview/MarkdownPreview.tsx +0 -71
- package/src/components/MarkdownPreview/index.ts +0 -9
- package/src/components/Suggestions.stories.tsx +0 -215
- package/src/components/Toolbar.stories.tsx +0 -113
- package/src/events.ts +0 -11
- package/src/extensions.tsx +0 -328
- package/src/hooks/useSelectCurrentThread.tsx +0 -56
- package/src/types/schema.ts +0 -39
|
@@ -2,51 +2,64 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
+
import { Collection } from '@dxos/echo';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
10
12
|
import { isSpace } from '@dxos/react-client/echo';
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
import { MarkdownOperation } from '#operations';
|
|
15
|
+
import { Markdown } from '#types';
|
|
12
16
|
|
|
13
17
|
import { translations } from '../translations';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
|
|
19
|
+
export default Capability.makeModule(
|
|
20
|
+
Effect.fnUntraced(function* () {
|
|
21
|
+
// Get context for lazy capability access in callbacks.
|
|
22
|
+
const capabilities = yield* Capability.Service;
|
|
23
|
+
|
|
24
|
+
return Capability.contributes(AppCapabilities.AppGraphSerializer, [
|
|
25
|
+
{
|
|
26
|
+
inputType: Markdown.Document.typename,
|
|
27
|
+
outputType: 'text/markdown',
|
|
28
|
+
// Reconcile with metadata serializers.
|
|
29
|
+
serialize: async (node) => {
|
|
30
|
+
const doc = node.data;
|
|
31
|
+
const content = await doc.content.load();
|
|
32
|
+
return {
|
|
33
|
+
name:
|
|
34
|
+
doc.name ||
|
|
35
|
+
doc.fallbackName ||
|
|
36
|
+
translations[0]['en-US'][Markdown.Document.typename]['object-name.placeholder'],
|
|
37
|
+
data: content.content,
|
|
38
|
+
type: 'text/markdown',
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
deserialize: async (data, ancestors) => {
|
|
42
|
+
const space = ancestors.find(isSpace);
|
|
43
|
+
const target =
|
|
44
|
+
ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ??
|
|
45
|
+
space?.properties[Collection.Collection.typename]?.target;
|
|
46
|
+
if (!space || !target) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
|
|
51
|
+
const createResult = await invokePromise(MarkdownOperation.CreateMarkdown, {
|
|
52
|
+
name: data.name,
|
|
53
|
+
content: data.data,
|
|
54
|
+
});
|
|
55
|
+
if (!createResult.data?.object) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
await invokePromise(SpaceOperation.AddObject, { target, object: createResult.data.object });
|
|
59
|
+
|
|
60
|
+
return createResult.data.object;
|
|
61
|
+
},
|
|
50
62
|
},
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
]);
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
@@ -2,115 +2,109 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
6
7
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { ArtifactId, defineArtifact } from '@dxos/artifact';
|
|
10
|
-
import { createArtifactElement } from '@dxos/assistant';
|
|
11
|
-
import { Obj } from '@dxos/echo';
|
|
12
|
-
import { invariant, assertArgument } from '@dxos/invariant';
|
|
13
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Filter, fullyQualifiedId, type Space } from '@dxos/react-client/echo';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
15
10
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
11
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
12
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
13
|
+
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
14
|
+
import { defineArtifact } from '@dxos/blueprints';
|
|
15
|
+
import { Obj } from '@dxos/echo';
|
|
16
|
+
import { assertArgument, invariant } from '@dxos/invariant';
|
|
17
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
18
|
+
import { Filter } from '@dxos/react-client/echo';
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
interface ToolContextExtensions {
|
|
22
|
-
space?: Space;
|
|
23
|
-
dispatch?: PromiseIntentDispatcher;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
20
|
+
import { meta } from '#meta';
|
|
21
|
+
import { Markdown } from '#types';
|
|
26
22
|
|
|
27
|
-
export default () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
export default Capability.makeModule(() =>
|
|
24
|
+
Effect.sync(() => {
|
|
25
|
+
const definition = defineArtifact({
|
|
26
|
+
id: `artifact:${meta.id}`, // TODO(burdon): meta.id/artifact?
|
|
27
|
+
name: meta.name,
|
|
28
|
+
instructions: `
|
|
29
|
+
The markdown plugin allows you to work with text documents in the current space.
|
|
30
|
+
Use these tools to interact with documents, including listing available documents and retrieving their content.
|
|
31
|
+
Documents are stored in Markdown format.
|
|
35
32
|
`,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
schema: Markdown.Document,
|
|
34
|
+
tools: [
|
|
35
|
+
createTool(meta.id, {
|
|
36
|
+
name: 'create',
|
|
37
|
+
description: 'Create a new markdown document',
|
|
38
|
+
caption: 'Creating document...',
|
|
39
|
+
schema: Schema.Struct({
|
|
40
|
+
name: Schema.optional(Schema.String).annotations({
|
|
41
|
+
description: 'Optional name for the document.',
|
|
42
|
+
}),
|
|
43
|
+
content: Schema.String.annotations({
|
|
44
|
+
description: 'The content of the document.',
|
|
45
|
+
}),
|
|
48
46
|
}),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
47
|
+
execute: async ({ name, content }, { extensions }) => {
|
|
48
|
+
invariant(extensions?.space, 'No space');
|
|
49
|
+
invariant(extensions?.invoke, 'No operation invoker');
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
createIntent(MarkdownAction.Create, {
|
|
56
|
-
spaceId: extensions.space.id,
|
|
57
|
-
name,
|
|
58
|
-
content,
|
|
59
|
-
}),
|
|
60
|
-
chain(SpaceAction.AddObject, { target: extensions.space }),
|
|
61
|
-
);
|
|
51
|
+
const document = Markdown.make({ name, content });
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
const { error } = await extensions.invoke(SpaceOperation.AddObject, {
|
|
54
|
+
target: extensions.space,
|
|
55
|
+
object: document,
|
|
56
|
+
});
|
|
57
|
+
if (error) {
|
|
58
|
+
return ToolResult.Error(error?.message ?? 'Failed to add document to space');
|
|
59
|
+
}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
return ToolResult.Success(createArtifactElement(document.id));
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
createTool(meta.id, {
|
|
65
|
+
name: 'list',
|
|
66
|
+
description: 'List all markdown documents in the current space.',
|
|
67
|
+
caption: 'Listing markdown documents...',
|
|
68
|
+
schema: Schema.Struct({}),
|
|
69
|
+
execute: async (_input, { extensions }) => {
|
|
70
|
+
invariant(extensions?.space, 'No space');
|
|
71
|
+
const space = extensions.space;
|
|
72
|
+
const { objects: documents } = await space.db.query(Filter.type(Markdown.Document)).run();
|
|
73
|
+
const documentInfo = documents.map((doc) => {
|
|
74
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
75
|
+
return {
|
|
76
|
+
id: Obj.getDXN(doc).toString(),
|
|
77
|
+
name: doc.name || doc.fallbackName || 'Unnamed Document',
|
|
78
|
+
// TODO(ZaymonFC): Include updatedAt?
|
|
79
|
+
};
|
|
80
|
+
});
|
|
88
81
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}),
|
|
92
|
-
createTool(meta.id, {
|
|
93
|
-
name: 'inspect',
|
|
94
|
-
description: 'Read the content of a markdown document.',
|
|
95
|
-
caption: 'Inspecting markdown document...',
|
|
96
|
-
schema: Schema.Struct({
|
|
97
|
-
id: ArtifactId,
|
|
82
|
+
return ToolResult.Success(documentInfo);
|
|
83
|
+
},
|
|
98
84
|
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
createTool(meta.id, {
|
|
86
|
+
name: 'inspect',
|
|
87
|
+
description: 'Read the content of a markdown document.',
|
|
88
|
+
caption: 'Inspecting markdown document...',
|
|
89
|
+
schema: Schema.Struct({
|
|
90
|
+
id: ArtifactId,
|
|
91
|
+
}),
|
|
92
|
+
execute: async ({ id }, { extensions }) => {
|
|
93
|
+
invariant(extensions?.space, 'No space');
|
|
94
|
+
const document = await extensions.space.db.query(Filter.id(ArtifactId.toDXN(id).toString())).first();
|
|
95
|
+
assertArgument(Obj.instanceOf(Markdown.Document, document), 'document', 'Invalid type');
|
|
103
96
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
const { content } = await document.content?.load();
|
|
98
|
+
return ToolResult.Success({
|
|
99
|
+
id: Obj.getDXN(document).toString(),
|
|
100
|
+
name: document.name || document.fallbackName || 'Unnamed Document',
|
|
101
|
+
content,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
],
|
|
106
|
+
});
|
|
114
107
|
|
|
115
|
-
|
|
116
|
-
}
|
|
108
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { MarkdownBlueprint } from '#blueprints';
|
|
11
|
+
|
|
12
|
+
const blueprintDefinition = Capability.makeModule<
|
|
13
|
+
[],
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
15
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, MarkdownBlueprint)]));
|
|
16
|
+
|
|
17
|
+
export default blueprintDefinition;
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
6
7
|
|
|
7
|
-
export const AnchorSort = lazy(() => import('./anchor-sort'));
|
|
8
|
-
export const AppGraphSerializer = lazy(() => import('./app-graph-serializer'));
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
8
|
+
export const AnchorSort = Capability.lazy('AnchorSort', () => import('./anchor-sort'));
|
|
9
|
+
export const AppGraphSerializer = Capability.lazy('AppGraphSerializer', () => import('./app-graph-serializer'));
|
|
10
|
+
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
11
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
12
|
+
'OperationHandler',
|
|
13
|
+
() => import('./operation-handler'),
|
|
14
|
+
);
|
|
15
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
16
|
+
export const MarkdownSettings = Capability.lazy('MarkdownSettings', () => import('./settings'));
|
|
17
|
+
export const MarkdownState = Capability.lazy('MarkdownState', () => import('./state'));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
7
|
+
|
|
8
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
9
|
+
'OperationHandler',
|
|
10
|
+
() => import('./operation-handler'),
|
|
11
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { MarkdownOperationHandlerSet } from '#operations';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(Capabilities.OperationHandler, MarkdownOperationHandlerSet);
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
@@ -2,112 +2,120 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import {
|
|
10
|
+
Surface,
|
|
11
|
+
useAtomCapability,
|
|
12
|
+
useAtomCapabilityState,
|
|
13
|
+
useCapability,
|
|
14
|
+
useSettingsState,
|
|
15
|
+
} from '@dxos/app-framework/ui';
|
|
16
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
17
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { DataType } from '@dxos/schema';
|
|
18
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention/types';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
20
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
13
21
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
22
|
+
import { MarkdownSettings } from '#components';
|
|
23
|
+
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps } from '#containers';
|
|
24
|
+
import { meta } from '#meta';
|
|
25
|
+
import { Markdown, MarkdownCapabilities } from '#types';
|
|
18
26
|
|
|
19
|
-
export default () =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
export default Capability.makeModule(() =>
|
|
28
|
+
Effect.succeed(
|
|
29
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
30
|
+
Surface.create({
|
|
31
|
+
id: 'surface.document',
|
|
32
|
+
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
33
|
+
role: ['article', 'section', 'tabpanel'],
|
|
34
|
+
filter: (data): data is { subject: Markdown.Document; attendableId: string; variant: undefined } =>
|
|
35
|
+
typeof data.attendableId === 'string' && Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
36
|
+
component: ({ data, role, ref }) => {
|
|
37
|
+
return (
|
|
38
|
+
<Container
|
|
39
|
+
id={Obj.getDXN(data.subject).toString()}
|
|
40
|
+
attendableId={data.attendableId}
|
|
41
|
+
subject={data.subject}
|
|
42
|
+
role={role}
|
|
43
|
+
ref={ref}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
Surface.create({
|
|
49
|
+
id: 'surface.text',
|
|
50
|
+
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
51
|
+
// TODO(burdon): Why is attendableId required? See EventArticle.tsx
|
|
52
|
+
filter: AppSurface.oneOf(
|
|
53
|
+
AppSurface.object(AppSurface.Article, Text.Text),
|
|
54
|
+
AppSurface.object(AppSurface.Section, Text.Text),
|
|
55
|
+
AppSurface.object(AppSurface.Tabpanel, Text.Text),
|
|
56
|
+
),
|
|
57
|
+
component: ({ data, role, ref }) => {
|
|
58
|
+
return (
|
|
59
|
+
<Container
|
|
60
|
+
id={Obj.getDXN(data.subject).toString()}
|
|
61
|
+
attendableId={data.attendableId}
|
|
62
|
+
subject={data.subject}
|
|
63
|
+
role={role}
|
|
64
|
+
ref={ref}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
Surface.create({
|
|
70
|
+
id: 'surface.plugin-settings',
|
|
71
|
+
filter: AppSurface.settings(AppSurface.Article, meta.id),
|
|
72
|
+
component: ({ data: { subject } }) => {
|
|
73
|
+
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
74
|
+
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
Surface.create({
|
|
78
|
+
id: 'surface.preview',
|
|
79
|
+
filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text]),
|
|
80
|
+
component: ({ data }) => <MarkdownCard {...data} />,
|
|
81
|
+
}),
|
|
82
|
+
]),
|
|
83
|
+
),
|
|
84
|
+
);
|
|
32
85
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
createSurface({
|
|
49
|
-
id: `${MARKDOWN_PLUGIN}/text`,
|
|
50
|
-
role: ['article', 'section', 'tabpanel'],
|
|
51
|
-
filter: (data): data is { id: string; subject: DataType.Text } =>
|
|
52
|
-
typeof data.id === 'string' && Obj.instanceOf(DataType.Text, data.subject),
|
|
53
|
-
component: ({ data, role }) => {
|
|
54
|
-
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
55
|
-
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
56
|
-
const settings = settingsStore.getStore<MarkdownSettingsProps>(MARKDOWN_PLUGIN)!.value;
|
|
57
|
-
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
86
|
+
/**
|
|
87
|
+
* Common wrapper.
|
|
88
|
+
*/
|
|
89
|
+
const Container = forwardRef<
|
|
90
|
+
HTMLDivElement,
|
|
91
|
+
AppSurface.ObjectArticleProps<Markdown.Document | Text.Text, { id: string }>
|
|
92
|
+
>(({ id, attendableId, subject, role }, forwardedRef) => {
|
|
93
|
+
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
94
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
95
|
+
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
96
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
97
|
+
const extensions = useCapability(MarkdownCapabilities.Extensions);
|
|
98
|
+
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
58
99
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
settings={settings}
|
|
65
|
-
selectionManager={selectionManager}
|
|
66
|
-
extensionProviders={state.extensionProviders}
|
|
67
|
-
viewMode={getViewMode(data.id)}
|
|
68
|
-
editorStateStore={editorState}
|
|
69
|
-
onViewModeChange={setViewMode}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
},
|
|
73
|
-
}),
|
|
74
|
-
createSurface({
|
|
75
|
-
id: `${MARKDOWN_PLUGIN}/editor`,
|
|
76
|
-
role: ['article', 'section'],
|
|
77
|
-
filter: (data): data is { subject: { id: string; text: string } } => isEditorModel(data.subject),
|
|
78
|
-
component: ({ data, role }) => {
|
|
79
|
-
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
80
|
-
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
81
|
-
const settings = settingsStore.getStore<MarkdownSettingsProps>(MARKDOWN_PLUGIN)!.value;
|
|
82
|
-
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
100
|
+
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
101
|
+
const handleViewModeChange = useCallback<NonNullable<MarkdownContainerProps['onViewModeChange']>>(
|
|
102
|
+
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
103
|
+
[id, setState],
|
|
104
|
+
);
|
|
83
105
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
id: `${MARKDOWN_PLUGIN}/plugin-settings`,
|
|
101
|
-
role: 'article',
|
|
102
|
-
filter: (data): data is { subject: SettingsStore<MarkdownSettingsProps> } =>
|
|
103
|
-
data.subject instanceof SettingsStore && data.subject.prefix === MARKDOWN_PLUGIN,
|
|
104
|
-
component: ({ data: { subject } }) => <MarkdownSettings settings={subject.value} />,
|
|
105
|
-
}),
|
|
106
|
-
createSurface({
|
|
107
|
-
id: `${MARKDOWN_PLUGIN}/preview`,
|
|
108
|
-
role: ['popover', 'card--kanban', 'card--document', 'card'],
|
|
109
|
-
filter: (data): data is { subject: DocumentType | DataType.Text } =>
|
|
110
|
-
Obj.instanceOf(DocumentType, data.subject) || Obj.instanceOf(DataType.Text, data.subject),
|
|
111
|
-
component: ({ data, role }) => <MarkdownPreview {...data} role={role} />,
|
|
112
|
-
}),
|
|
113
|
-
]);
|
|
106
|
+
return (
|
|
107
|
+
<MarkdownContainer
|
|
108
|
+
role={role}
|
|
109
|
+
subject={subject}
|
|
110
|
+
id={id}
|
|
111
|
+
attendableId={attendableId}
|
|
112
|
+
settings={settings}
|
|
113
|
+
selectionManager={selectionManager}
|
|
114
|
+
extensionProviders={extensionProviders}
|
|
115
|
+
editorStateStore={editorState}
|
|
116
|
+
viewMode={viewMode}
|
|
117
|
+
onViewModeChange={handleViewModeChange}
|
|
118
|
+
ref={forwardedRef}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
});
|