@dxos/plugin-markdown 0.8.4-main.ae835ea → 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 +51 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- 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 +39 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- 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 +632 -153
- 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 +11 -5
- 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 +52 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- 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 +40 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- 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 +632 -153
- 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 +11 -5
- 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 +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 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +27 -18
- 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 +22 -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 +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +19 -13
- 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 +20 -14
- 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/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 +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 -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 +31 -0
- 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 +1 -2
- 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 +10 -8
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +3 -3
- 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 +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 +75 -34
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +30 -31
- 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 +51 -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 -2
- 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 +7 -4
- 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 +119 -59
- package/src/MarkdownPlugin.tsx +77 -103
- 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 +51 -41
- package/src/capabilities/artifact-definition.ts +82 -84
- package/src/capabilities/blueprint-definition.ts +9 -31
- package/src/capabilities/index.ts +12 -12
- package/src/capabilities/node.ts +11 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +108 -80
- package/src/capabilities/settings.ts +30 -18
- package/src/capabilities/state.ts +41 -25
- 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 +39 -41
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +87 -57
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +69 -34
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +48 -53
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +40 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +116 -86
- package/src/components/MarkdownSettings/index.ts +3 -1
- package/src/components/index.ts +4 -7
- 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/index.ts +10 -0
- package/src/hooks/index.ts +1 -2
- package/src/hooks/{usePopoverMenuOptions.ts → useEditorMenuOptions.ts} +20 -23
- package/src/hooks/useExtensions.tsx +100 -109
- package/src/hooks/useLinkQuery.ts +49 -23
- 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 +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 +27 -0
- package/src/translations.ts +49 -34
- package/src/types/Markdown.ts +23 -31
- package/src/types/Settings.ts +28 -0
- package/src/types/capabilities.ts +50 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +5 -2
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +80 -12
- package/dist/lib/browser/MarkdownCard-SLM6QZYC.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-UZFQC6XY.mjs +0 -15
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs +0 -32
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-BC5R3T72.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-BC5R3T72.mjs.map +0 -7
- package/dist/lib/browser/chunk-2LLVTQCK.mjs +0 -51
- package/dist/lib/browser/chunk-2LLVTQCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-3VILQLA4.mjs +0 -95
- package/dist/lib/browser/chunk-3VILQLA4.mjs.map +0 -7
- package/dist/lib/browser/chunk-5AYTOIUF.mjs +0 -822
- package/dist/lib/browser/chunk-5AYTOIUF.mjs.map +0 -7
- package/dist/lib/browser/chunk-A3CQYGCN.mjs +0 -56
- package/dist/lib/browser/chunk-A3CQYGCN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQTYJOFB.mjs +0 -28
- package/dist/lib/browser/chunk-BQTYJOFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLEYXJX3.mjs +0 -22
- package/dist/lib/browser/chunk-GLEYXJX3.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-JAETS5LE.mjs +0 -106
- package/dist/lib/browser/chunk-JAETS5LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-UKTCPHLI.mjs +0 -79
- package/dist/lib/browser/chunk-UKTCPHLI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs +0 -62
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs +0 -217
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs.map +0 -7
- package/dist/lib/browser/settings-LBXJHVBU.mjs +0 -28
- package/dist/lib/browser/settings-LBXJHVBU.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-YPIVDB4A.mjs +0 -66
- package/dist/lib/browser/toolkit-YPIVDB4A.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-MCWEFW4F.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-MCWEFW4F.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-KAQOK7K5.mjs +0 -16
- package/dist/lib/node-esm/MarkdownContainer-KAQOK7K5.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-4SXYVYXT.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-4SXYVYXT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FPNOTEYC.mjs +0 -12
- package/dist/lib/node-esm/blueprint-definition-FPNOTEYC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs +0 -823
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs +0 -107
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GGKPPGWA.mjs +0 -24
- package/dist/lib/node-esm/chunk-GGKPPGWA.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-JELROKGD.mjs +0 -80
- package/dist/lib/node-esm/chunk-JELROKGD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QH4MC5BE.mjs +0 -52
- package/dist/lib/node-esm/chunk-QH4MC5BE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs +0 -29
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SJ2QRGPM.mjs +0 -57
- package/dist/lib/node-esm/chunk-SJ2QRGPM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs +0 -96
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs +0 -218
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2YRA67H6.mjs +0 -29
- package/dist/lib/node-esm/settings-2YRA67H6.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-36BFLIR3.mjs +0 -67
- package/dist/lib/node-esm/toolkit-36BFLIR3.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/capabilities/toolkit.d.ts +0 -20
- package/dist/types/src/capabilities/toolkit.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 +0 -58
- 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/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/diff.d.ts +0 -6
- package/dist/types/src/functions/diff.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- 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/hooks/usePopoverMenuOptions.d.ts +0 -9
- package/dist/types/src/hooks/usePopoverMenuOptions.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 -34
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/toolkit.ts +0 -53
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +0 -76
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -85
- package/src/components/MarkdownContainer.stories.tsx +0 -137
- package/src/components/MarkdownContainer.tsx +0 -121
- package/src/components/Suggestions.stories.tsx +0 -219
- package/src/events.ts +0 -11
- package/src/functions/diff.ts +0 -37
- package/src/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -32
- package/src/hooks/useSelectCurrentThread.tsx +0 -56
- package/src/types/MarkdownAction.ts +0 -29
- /package/dist/lib/browser/{MarkdownCard-SLM6QZYC.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/MarkdownContainer-UZFQC6XY.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React, { useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
type Capabilities,
|
|
10
|
-
IntentPlugin,
|
|
11
|
-
LayoutAction,
|
|
12
|
-
SettingsPlugin,
|
|
13
|
-
Surface,
|
|
14
|
-
createIntent,
|
|
15
|
-
useIntentDispatcher,
|
|
16
|
-
} from '@dxos/app-framework';
|
|
17
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
18
|
-
import { Obj, Query } from '@dxos/echo';
|
|
19
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
20
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
21
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
22
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
23
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
24
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
25
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
26
|
-
import { faker } from '@dxos/random';
|
|
27
|
-
import { fullyQualifiedId, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
28
|
-
import { useAsyncEffect } from '@dxos/react-ui';
|
|
29
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
30
|
-
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
31
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
32
|
-
import { DataType } from '@dxos/schema';
|
|
33
|
-
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
34
|
-
|
|
35
|
-
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
36
|
-
import { translations } from '../translations';
|
|
37
|
-
import { Markdown } from '../types';
|
|
38
|
-
|
|
39
|
-
faker.seed(1);
|
|
40
|
-
|
|
41
|
-
const generator: ValueGenerator = faker as any;
|
|
42
|
-
|
|
43
|
-
const DefaultStory = () => {
|
|
44
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
45
|
-
const space = useSpace();
|
|
46
|
-
const [doc] = useQuery(space, Query.type(Markdown.Document));
|
|
47
|
-
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
48
|
-
const id = doc && fullyQualifiedId(doc);
|
|
49
|
-
const attentionAttrs = useAttentionAttributes(id);
|
|
50
|
-
|
|
51
|
-
useAsyncEffect(async () => {
|
|
52
|
-
if (space) {
|
|
53
|
-
await dispatch(createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: space.id }));
|
|
54
|
-
}
|
|
55
|
-
}, [space, dispatch]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div className='contents' {...attentionAttrs}>
|
|
59
|
-
<Surface role='article' data={data} limit={1} />
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const meta = {
|
|
65
|
-
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
66
|
-
render: DefaultStory,
|
|
67
|
-
decorators: [
|
|
68
|
-
withTheme,
|
|
69
|
-
withLayout({ container: 'column' }),
|
|
70
|
-
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
71
|
-
plugins: [
|
|
72
|
-
ClientPlugin({
|
|
73
|
-
types: [Markdown.Document, DataType.Text, DataType.Person, DataType.Organization],
|
|
74
|
-
onClientInitialized: async ({ client }) => {
|
|
75
|
-
await client.halo.createIdentity();
|
|
76
|
-
await client.spaces.waitUntilReady();
|
|
77
|
-
await client.spaces.default.waitUntilReady();
|
|
78
|
-
|
|
79
|
-
const space = client.spaces.default;
|
|
80
|
-
const createObjects = createObjectFactory(space.db, generator);
|
|
81
|
-
await createObjects([{ type: DataType.Organization, count: 10 }]);
|
|
82
|
-
|
|
83
|
-
const queue = space.queues.create();
|
|
84
|
-
const kai = Obj.make(DataType.Person, { fullName: 'Kai' });
|
|
85
|
-
const dxos = Obj.make(DataType.Organization, { name: 'DXOS' });
|
|
86
|
-
await queue.append([kai, dxos]);
|
|
87
|
-
|
|
88
|
-
space.db.add(
|
|
89
|
-
Markdown.makeDocument({
|
|
90
|
-
name: context.args.title ?? 'Testing',
|
|
91
|
-
content: [
|
|
92
|
-
`# ${context.args.title ?? 'Testing'}`,
|
|
93
|
-
context.args.content ?? '',
|
|
94
|
-
// TODO(burdon): Popovers not currently working.
|
|
95
|
-
'## Here are some objects',
|
|
96
|
-
`})`,
|
|
97
|
-
`})`,
|
|
98
|
-
'',
|
|
99
|
-
'END',
|
|
100
|
-
'',
|
|
101
|
-
].join('\n\n'),
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
await space.db.flush({ indexes: true });
|
|
106
|
-
},
|
|
107
|
-
}),
|
|
108
|
-
SpacePlugin({}),
|
|
109
|
-
GraphPlugin(),
|
|
110
|
-
IntentPlugin(),
|
|
111
|
-
SettingsPlugin(),
|
|
112
|
-
// UI
|
|
113
|
-
ThemePlugin({ tx: defaultTx }),
|
|
114
|
-
AttentionPlugin(),
|
|
115
|
-
MarkdownPlugin(),
|
|
116
|
-
PreviewPlugin(),
|
|
117
|
-
StorybookLayoutPlugin({}),
|
|
118
|
-
],
|
|
119
|
-
})),
|
|
120
|
-
],
|
|
121
|
-
parameters: {
|
|
122
|
-
layout: 'fullscreen',
|
|
123
|
-
controls: { disable: true },
|
|
124
|
-
translations,
|
|
125
|
-
},
|
|
126
|
-
} satisfies Meta<typeof Capabilities>;
|
|
127
|
-
|
|
128
|
-
export default meta;
|
|
129
|
-
|
|
130
|
-
type Story = StoryObj<typeof meta>;
|
|
131
|
-
|
|
132
|
-
export const Default: Story = {
|
|
133
|
-
args: {
|
|
134
|
-
title: 'Testing',
|
|
135
|
-
content: ['This is a line with **some** formatting.'].join('\n\n'),
|
|
136
|
-
},
|
|
137
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Extension } from '@codemirror/state';
|
|
6
|
-
import { Rx } from '@effect-rx/rx-react';
|
|
7
|
-
import React, { useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
import { Capabilities, useAppGraph, useCapabilities } from '@dxos/app-framework';
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { fullyQualifiedId, getSpace } from '@dxos/react-client/echo';
|
|
12
|
-
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
13
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
14
|
-
import { DataType } from '@dxos/schema';
|
|
15
|
-
|
|
16
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
17
|
-
import { type DocumentType, useLinkQuery } from '../hooks';
|
|
18
|
-
import { Markdown, type MarkdownPluginState } from '../types';
|
|
19
|
-
|
|
20
|
-
import { MarkdownEditor, type MarkdownEditorContentProps, type MarkdownEditorRootProps } from './MarkdownEditor';
|
|
21
|
-
|
|
22
|
-
export type MarkdownContainerProps = {
|
|
23
|
-
role?: string;
|
|
24
|
-
object: DocumentType;
|
|
25
|
-
settings: Markdown.Settings;
|
|
26
|
-
selectionManager?: SelectionManager;
|
|
27
|
-
} & (Pick<MarkdownEditorRootProps, 'id' | 'viewMode' | 'onViewModeChange'> &
|
|
28
|
-
Pick<MarkdownEditorContentProps, 'editorStateStore'> &
|
|
29
|
-
Pick<MarkdownPluginState, 'extensionProviders'>);
|
|
30
|
-
|
|
31
|
-
// TODO(burdon): Attention doesn't update in storybook.
|
|
32
|
-
// TODO(burdon): Toolbar state (currently not working in labs: e.g., heading, list, table).
|
|
33
|
-
// Heading state is correct (see react-ui-editor headings.ts, but the toolbar isn't updated).
|
|
34
|
-
// TODO(burdon): View mode (currently not working in labs).
|
|
35
|
-
// TODO(burdon): Test update document name.
|
|
36
|
-
// TODO(burdon): Test comment threads.
|
|
37
|
-
// TODO(burdon): Test preview blocks.
|
|
38
|
-
// TODO(burdon): Test file upload.
|
|
39
|
-
|
|
40
|
-
export const MarkdownContainer = ({
|
|
41
|
-
id,
|
|
42
|
-
role,
|
|
43
|
-
object,
|
|
44
|
-
settings,
|
|
45
|
-
extensionProviders,
|
|
46
|
-
...props
|
|
47
|
-
}: MarkdownContainerProps) => {
|
|
48
|
-
const space = getSpace(object);
|
|
49
|
-
const isDocument = Obj.instanceOf(Markdown.Document, object);
|
|
50
|
-
const isText = Obj.instanceOf(DataType.Text, object);
|
|
51
|
-
const attendableId = isDocument ? fullyQualifiedId(object) : undefined;
|
|
52
|
-
|
|
53
|
-
// Extensions from other plugins.
|
|
54
|
-
// TODO(burdon): Document MarkdownPluginState.extensionProviders
|
|
55
|
-
const otherExtensionProviders = useCapabilities(MarkdownCapabilities.Extensions);
|
|
56
|
-
const extensions = useMemo<Extension[]>(() => {
|
|
57
|
-
if (!Obj.instanceOf(Markdown.Document, object)) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]
|
|
62
|
-
.flat()
|
|
63
|
-
.reduce((acc: Extension[], provider) => {
|
|
64
|
-
const extension =
|
|
65
|
-
typeof provider === 'function' ? provider({ document: object as Markdown.Document }) : provider;
|
|
66
|
-
if (extension) {
|
|
67
|
-
acc.push(extension);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return acc;
|
|
71
|
-
}, []);
|
|
72
|
-
}, [extensionProviders, otherExtensionProviders, object]);
|
|
73
|
-
|
|
74
|
-
// Toolbar actions from app graph.
|
|
75
|
-
const { graph } = useAppGraph();
|
|
76
|
-
const customActions = useMemo(() => {
|
|
77
|
-
return Rx.make((get) => {
|
|
78
|
-
const actions = get(graph.actions(id));
|
|
79
|
-
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
80
|
-
const edges = nodes.map((node) => ({ source: 'root', target: node.id }));
|
|
81
|
-
return { nodes, edges };
|
|
82
|
-
});
|
|
83
|
-
}, [graph]);
|
|
84
|
-
|
|
85
|
-
// File upload.
|
|
86
|
-
const [upload] = useCapabilities(Capabilities.FileUploader);
|
|
87
|
-
const handleFileUpload = useMemo(() => {
|
|
88
|
-
if (!space || !upload) {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return async (file: File) => upload(space, file);
|
|
93
|
-
}, [space, upload]);
|
|
94
|
-
|
|
95
|
-
// Query for @ refs.
|
|
96
|
-
const handleLinkQuery = useLinkQuery(space);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<StackItem.Content toolbar={settings.toolbar}>
|
|
100
|
-
<MarkdownEditor.Root
|
|
101
|
-
id={attendableId ?? id}
|
|
102
|
-
object={object}
|
|
103
|
-
extensions={extensions}
|
|
104
|
-
onFileUpload={handleFileUpload}
|
|
105
|
-
onLinkQuery={handleLinkQuery}
|
|
106
|
-
{...props}
|
|
107
|
-
>
|
|
108
|
-
{settings.toolbar && (
|
|
109
|
-
<MarkdownEditor.Toolbar id={attendableId ?? id} role={role} customActions={customActions} />
|
|
110
|
-
)}
|
|
111
|
-
<MarkdownEditor.Content
|
|
112
|
-
initialValue={isDocument ? object.content?.target?.content : isText ? object.content : object.text}
|
|
113
|
-
scrollPastEnd={role === 'article'}
|
|
114
|
-
/>
|
|
115
|
-
<MarkdownEditor.Blocks />
|
|
116
|
-
</MarkdownEditor.Root>
|
|
117
|
-
</StackItem.Content>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default MarkdownContainer;
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta } from '@storybook/react-vite';
|
|
6
|
-
import * as Function from 'effect/Function';
|
|
7
|
-
import * as Match from 'effect/Match';
|
|
8
|
-
import * as Option from 'effect/Option';
|
|
9
|
-
import * as Schema from 'effect/Schema';
|
|
10
|
-
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
import { Capabilities, IntentPlugin, SettingsPlugin, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
13
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
14
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
15
|
-
import { invariant } from '@dxos/invariant';
|
|
16
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
17
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
18
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
19
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
20
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
21
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
22
|
-
import { faker } from '@dxos/random';
|
|
23
|
-
import { createDocAccessor, fullyQualifiedId, toCursorRange, useQueue, useSpace } from '@dxos/react-client/echo';
|
|
24
|
-
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
25
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
26
|
-
import { type EditorSelection, type Range, useTextEditor } from '@dxos/react-ui-editor';
|
|
27
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
28
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
29
|
-
import { DataType } from '@dxos/schema';
|
|
30
|
-
import { render } from '@dxos/storybook-utils';
|
|
31
|
-
|
|
32
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
33
|
-
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
34
|
-
import { meta } from '../meta';
|
|
35
|
-
import { translations } from '../translations';
|
|
36
|
-
import { Markdown } from '../types';
|
|
37
|
-
|
|
38
|
-
import { MarkdownContainer } from './MarkdownContainer';
|
|
39
|
-
|
|
40
|
-
faker.seed(1);
|
|
41
|
-
|
|
42
|
-
const TestItem = Schema.Struct({
|
|
43
|
-
title: Schema.String.annotations({
|
|
44
|
-
title: 'Title',
|
|
45
|
-
description: 'Product title',
|
|
46
|
-
}),
|
|
47
|
-
description: Schema.String.annotations({
|
|
48
|
-
title: 'Description',
|
|
49
|
-
description: 'Product description',
|
|
50
|
-
}),
|
|
51
|
-
}).pipe(
|
|
52
|
-
Type.Obj({
|
|
53
|
-
typename: 'dxos.org/type/Test',
|
|
54
|
-
version: '0.1.0',
|
|
55
|
-
}),
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
59
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
60
|
-
const { parentRef } = useTextEditor({ initialValue: content });
|
|
61
|
-
const { editorState } = useCapability(MarkdownCapabilities.State);
|
|
62
|
-
|
|
63
|
-
const space = useSpace();
|
|
64
|
-
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
65
|
-
const queue = useQueue<DataType.Message>(queueDxn);
|
|
66
|
-
|
|
67
|
-
const handleInsert = async () => {
|
|
68
|
-
invariant(space);
|
|
69
|
-
invariant(queue);
|
|
70
|
-
await queue.append([
|
|
71
|
-
Obj.make(DataType.Message, {
|
|
72
|
-
created: new Date().toISOString(),
|
|
73
|
-
sender: { role: 'assistant' },
|
|
74
|
-
blocks: [{ _tag: 'text', text: 'Hello' }],
|
|
75
|
-
}),
|
|
76
|
-
]);
|
|
77
|
-
const message = queue.objects.at(-1);
|
|
78
|
-
invariant(message);
|
|
79
|
-
|
|
80
|
-
const text = await doc.content.load();
|
|
81
|
-
const accessor = createDocAccessor(text, ['content']);
|
|
82
|
-
const cursor = Function.pipe(
|
|
83
|
-
editorState.getState(fullyQualifiedId(doc))?.selection,
|
|
84
|
-
Option.fromNullable,
|
|
85
|
-
Option.map(selectionToRange),
|
|
86
|
-
Option.map((range) => toCursorRange(accessor, range.from, range.to)),
|
|
87
|
-
Option.getOrUndefined,
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// {
|
|
91
|
-
// const ref = refFromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id]));
|
|
92
|
-
// const message = deref(ref);
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// void dispatch(
|
|
96
|
-
// createIntent(CollaborationActions.InsertContent, {
|
|
97
|
-
// target: doc as any as Type.Expando,
|
|
98
|
-
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
99
|
-
// at: cursor,
|
|
100
|
-
// label: 'Proposal',
|
|
101
|
-
// }),
|
|
102
|
-
// );
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<StackItem.Content toolbar>
|
|
107
|
-
<Toolbar.Root>
|
|
108
|
-
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
109
|
-
</Toolbar.Root>
|
|
110
|
-
<div ref={parentRef} className='p-4' />
|
|
111
|
-
</StackItem.Content>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
116
|
-
const space = useSpace();
|
|
117
|
-
const [doc, setDoc] = useState<Markdown.Document>();
|
|
118
|
-
const settings = useCapability(Capabilities.SettingsStore).getStore<Markdown.Settings>(meta.id)!.value;
|
|
119
|
-
const { editorState } = useCapability(MarkdownCapabilities.State);
|
|
120
|
-
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (!space) {
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const doc = space.db.add(
|
|
127
|
-
Markdown.makeDocument({
|
|
128
|
-
name: 'Test',
|
|
129
|
-
content: document.replaceAll(/\[(\w+)\]/g, (_, label) => {
|
|
130
|
-
const obj = space.db.add(Obj.make(TestItem, { title: label, description: faker.lorem.paragraph() }));
|
|
131
|
-
const dxn = Ref.make(obj).dxn.toString();
|
|
132
|
-
return `[${label}](${dxn})`;
|
|
133
|
-
}),
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
setDoc(doc);
|
|
138
|
-
}, [space]);
|
|
139
|
-
|
|
140
|
-
if (!space || !doc) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// TODO(burdon): Layout issue.
|
|
145
|
-
return (
|
|
146
|
-
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
147
|
-
<MarkdownContainer id={doc.id} object={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
|
-
ClientPlugin({
|
|
161
|
-
types: [Markdown.Document, TestItem],
|
|
162
|
-
onClientInitialized: async ({ client }) => {
|
|
163
|
-
await client.halo.createIdentity();
|
|
164
|
-
},
|
|
165
|
-
}),
|
|
166
|
-
SpacePlugin({}),
|
|
167
|
-
GraphPlugin(),
|
|
168
|
-
IntentPlugin(),
|
|
169
|
-
SettingsPlugin(),
|
|
170
|
-
|
|
171
|
-
// UI
|
|
172
|
-
ThemePlugin({ tx: defaultTx }),
|
|
173
|
-
MarkdownPlugin(),
|
|
174
|
-
PreviewPlugin(),
|
|
175
|
-
StorybookLayoutPlugin({}),
|
|
176
|
-
],
|
|
177
|
-
}),
|
|
178
|
-
],
|
|
179
|
-
parameters: {
|
|
180
|
-
layout: 'fullscreen',
|
|
181
|
-
controls: {
|
|
182
|
-
disable: true,
|
|
183
|
-
},
|
|
184
|
-
translations,
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
export default storybook;
|
|
189
|
-
|
|
190
|
-
type Story = Meta<typeof DefaultStory>;
|
|
191
|
-
|
|
192
|
-
export const Default: Story = {
|
|
193
|
-
args: {
|
|
194
|
-
chat: 'Hello\n',
|
|
195
|
-
document: [
|
|
196
|
-
'# Test',
|
|
197
|
-
'',
|
|
198
|
-
faker.lorem.paragraph(1),
|
|
199
|
-
'',
|
|
200
|
-
'This is a [DXOS] story that tests [ECHO] references inside the Markdown plugin.',
|
|
201
|
-
'',
|
|
202
|
-
faker.lorem.paragraph(3),
|
|
203
|
-
'',
|
|
204
|
-
].join('\n'),
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// TODO(wittjosiah): Factor out.
|
|
209
|
-
const selectionToRange = Match.type<EditorSelection>().pipe(
|
|
210
|
-
Match.when(
|
|
211
|
-
({ head, anchor }) => (head ? head > anchor : false),
|
|
212
|
-
({ head, anchor }) => ({ from: anchor, to: head! }) as Range,
|
|
213
|
-
),
|
|
214
|
-
Match.when(
|
|
215
|
-
({ head, anchor }) => (head ? head < anchor : false),
|
|
216
|
-
({ head, anchor }) => ({ from: head!, to: anchor }) as Range,
|
|
217
|
-
),
|
|
218
|
-
Match.orElse(({ anchor }) => ({ from: anchor, to: anchor }) as Range),
|
|
219
|
-
);
|
package/src/events.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Events } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
import { meta } from './meta';
|
|
8
|
-
|
|
9
|
-
export namespace MarkdownEvents {
|
|
10
|
-
export const SetupExtensions = Events.createStateEvent(`${meta.id}/event/setup-extensions`);
|
|
11
|
-
}
|
package/src/functions/diff.ts
DELETED
|
@@ -1,37 +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 { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
11
|
-
import { trim } from '@dxos/util';
|
|
12
|
-
|
|
13
|
-
import { Markdown } from '../types';
|
|
14
|
-
|
|
15
|
-
// TODO(wittjosiah): Reconcile with ThreadAction.AddProposal.
|
|
16
|
-
export default defineFunction({
|
|
17
|
-
key: 'dxos.org/function/markdown/diff',
|
|
18
|
-
name: 'Diff',
|
|
19
|
-
description: trim`
|
|
20
|
-
Applies a set of diffs to the markdown document.
|
|
21
|
-
`,
|
|
22
|
-
inputSchema: Schema.Struct({
|
|
23
|
-
id: ArtifactId.annotations({
|
|
24
|
-
description: 'The ID of the markdown document.',
|
|
25
|
-
}),
|
|
26
|
-
diffs: Schema.Array(Schema.String).annotations({
|
|
27
|
-
description: 'The diffs to apply to the document.',
|
|
28
|
-
}),
|
|
29
|
-
}),
|
|
30
|
-
outputSchema: Schema.Void,
|
|
31
|
-
handler: Effect.fn(function* ({ data: { id, diffs } }) {
|
|
32
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Markdown.Document);
|
|
33
|
-
const content = yield* Effect.promise(() => object.content.load());
|
|
34
|
-
const accessor = createDocAccessor(content, ['content']);
|
|
35
|
-
applyDiffs(accessor, diffs);
|
|
36
|
-
}),
|
|
37
|
-
});
|
package/src/functions/index.ts
DELETED
package/src/functions/open.ts
DELETED
|
@@ -1,32 +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 } from '@dxos/assistant';
|
|
9
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
-
|
|
11
|
-
import { Markdown } from '../types';
|
|
12
|
-
|
|
13
|
-
export default defineFunction({
|
|
14
|
-
key: 'dxos.org/function/markdown/open',
|
|
15
|
-
name: 'Open',
|
|
16
|
-
description: 'Opens and reads the contents of a new markdown document.',
|
|
17
|
-
inputSchema: Schema.Struct({
|
|
18
|
-
id: ArtifactId.annotations({
|
|
19
|
-
description: 'The ID of the markdown document.',
|
|
20
|
-
}),
|
|
21
|
-
}),
|
|
22
|
-
outputSchema: Schema.Struct({
|
|
23
|
-
content: Schema.String,
|
|
24
|
-
}),
|
|
25
|
-
handler: Effect.fn(function* ({ data: { id } }) {
|
|
26
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Markdown.Document);
|
|
27
|
-
const { content } = yield* Effect.promise(() => object.content.load());
|
|
28
|
-
return {
|
|
29
|
-
content,
|
|
30
|
-
};
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { EditorView } from '@codemirror/view';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
import { LayoutAction, createResolver, useIntentResolver } from '@dxos/app-framework';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { Cursor, setSelection } from '@dxos/react-ui-editor';
|
|
12
|
-
|
|
13
|
-
import { meta } from '../meta';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
17
|
-
*/
|
|
18
|
-
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
19
|
-
const scrollIntoViewResolver = useMemo(
|
|
20
|
-
() =>
|
|
21
|
-
createResolver({
|
|
22
|
-
intent: LayoutAction.UpdateLayout,
|
|
23
|
-
position: 'hoist',
|
|
24
|
-
filter: (data): data is { part: 'current'; subject: string; options: { cursor: string } } => {
|
|
25
|
-
if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return !!editorView && data.subject === documentId && !!data.options?.cursor;
|
|
30
|
-
},
|
|
31
|
-
resolve: ({ options: { cursor } }) => {
|
|
32
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
33
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor!);
|
|
34
|
-
if (range) {
|
|
35
|
-
const selection = editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
36
|
-
const effects = [
|
|
37
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
38
|
-
EditorView.scrollIntoView(range.from, { y: 'start', yMargin: 96 }),
|
|
39
|
-
];
|
|
40
|
-
if (selection) {
|
|
41
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
42
|
-
effects.push(setSelection.of({ current: documentId }));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
editorView.dispatch({
|
|
46
|
-
effects,
|
|
47
|
-
selection: selection ? { anchor: range.from } : undefined,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
[documentId, editorView],
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
useIntentResolver(meta.id, scrollIntoViewResolver);
|
|
56
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { EditorViewMode } from '@dxos/react-ui-editor/types';
|
|
8
|
-
|
|
9
|
-
import { meta } from '../meta';
|
|
10
|
-
|
|
11
|
-
import { Document } from './Markdown';
|
|
12
|
-
|
|
13
|
-
export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
|
|
14
|
-
input: Schema.Struct({
|
|
15
|
-
name: Schema.optional(Schema.String),
|
|
16
|
-
content: Schema.optional(Schema.String),
|
|
17
|
-
}),
|
|
18
|
-
output: Schema.Struct({
|
|
19
|
-
object: Document,
|
|
20
|
-
}),
|
|
21
|
-
}) {}
|
|
22
|
-
|
|
23
|
-
export class SetViewMode extends Schema.TaggedClass<SetViewMode>()(`${meta.id}/action/set-view-mode`, {
|
|
24
|
-
input: Schema.Struct({
|
|
25
|
-
id: Schema.String,
|
|
26
|
-
viewMode: EditorViewMode,
|
|
27
|
-
}),
|
|
28
|
-
output: Schema.Void,
|
|
29
|
-
}) {}
|
|
File without changes
|
/package/dist/lib/{browser/MarkdownContainer-UZFQC6XY.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map}
RENAMED
|
File without changes
|