@dxos/plugin-markdown 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs +61 -0
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs +108 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs +106 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs +34 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs +60 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs +783 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +7 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs +8 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs.map +7 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs +154 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NGXGBWSS.mjs → chunk-RJO5W5YX.mjs} +12 -6
- package/dist/lib/browser/chunk-RJO5W5YX.mjs.map +7 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs +178 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ODB2PTBP.mjs → chunk-YBMRREXE.mjs} +4 -4
- package/dist/lib/browser/chunk-YBMRREXE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +35 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -143
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs +54 -0
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +7 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +115 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +7 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs +38 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs.map +7 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs +31 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -3
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs +62 -0
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs +109 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs +107 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs +35 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs +61 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +10 -0
- package/dist/lib/node-esm/{chunk-YGSNWTGP.mjs → chunk-ANIFP6M2.mjs} +12 -6
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs +10 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs +784 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs +179 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VCG2U522.mjs → chunk-W7AM4HCG.mjs} +4 -4
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs +155 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +36 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -143
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs +55 -0
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs +116 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +7 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs +39 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs.map +7 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs +32 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -3
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/{functions/open.d.ts → blueprints/functions/create.d.ts} +5 -4
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +42 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/open.d.ts +14 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +19 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -17
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +5 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +11 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +43 -23
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +5 -110
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +30 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +12 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -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/{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/MarkdownContainer/MarkdownContainer.d.ts +27 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.d.ts +34 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +3 -0
- 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 +21 -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/hooks/useSelectCurrentThread.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/testing.d.ts +6 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +33 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +16 -14
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -30
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -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 +3 -0
- 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 +6 -3
- 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 +95 -57
- package/src/MarkdownPlugin.tsx +65 -94
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +92 -0
- package/src/blueprints/functions/create.ts +35 -0
- package/src/blueprints/functions/index.ts +15 -0
- package/src/{functions → blueprints/functions}/open.ts +11 -10
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/blueprints/functions/update.test.ts +215 -0
- package/src/blueprints/functions/update.ts +79 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +46 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +37 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +60 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +110 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +6 -12
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +102 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +37 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +31 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +30 -0
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +59 -39
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +235 -271
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +161 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +67 -0
- package/src/components/index.ts +2 -7
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +68 -0
- package/src/containers/MarkdownCard/MarkdownCard.tsx +61 -0
- package/src/{components → containers}/MarkdownCard/index.ts +0 -2
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +136 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +114 -0
- package/src/containers/MarkdownContainer/index.ts +7 -0
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +122 -0
- package/src/containers/MarkdownSettings/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/hooks/useExtensions.tsx +245 -0
- package/src/hooks/useLinkQuery.ts +83 -0
- package/src/hooks/useSelectCurrentThread.tsx +37 -32
- package/src/index.ts +3 -2
- package/src/meta.ts +5 -5
- package/src/testing.ts +27 -0
- package/src/translations.ts +6 -0
- package/src/types/Markdown.ts +20 -11
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +4 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +82 -7
- package/dist/lib/browser/MarkdownCard-ZHTH6EVA.mjs +0 -80
- package/dist/lib/browser/MarkdownCard-ZHTH6EVA.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-XDYFBDCI.mjs +0 -750
- package/dist/lib/browser/MarkdownContainer-XDYFBDCI.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-53E7TJGF.mjs +0 -32
- package/dist/lib/browser/anchor-sort-53E7TJGF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-IEPNJZBR.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-IEPNJZBR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-XDLVVSUN.mjs +0 -11
- package/dist/lib/browser/chunk-EVQGTH3P.mjs +0 -22
- package/dist/lib/browser/chunk-EVQGTH3P.mjs.map +0 -7
- package/dist/lib/browser/chunk-NGXGBWSS.mjs.map +0 -7
- package/dist/lib/browser/chunk-ODB2PTBP.mjs.map +0 -7
- package/dist/lib/browser/chunk-OY6CGPOO.mjs +0 -16
- package/dist/lib/browser/chunk-OY6CGPOO.mjs.map +0 -7
- package/dist/lib/browser/chunk-PMBWHKDI.mjs +0 -78
- package/dist/lib/browser/chunk-PMBWHKDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-VZU7BRGW.mjs +0 -106
- package/dist/lib/browser/chunk-VZU7BRGW.mjs.map +0 -7
- package/dist/lib/browser/chunk-XYQDM6PM.mjs +0 -50
- package/dist/lib/browser/chunk-XYQDM6PM.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs +0 -62
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ONX5RNFM.mjs +0 -215
- package/dist/lib/browser/react-surface-ONX5RNFM.mjs.map +0 -7
- package/dist/lib/browser/settings-HXM36BCZ.mjs +0 -28
- package/dist/lib/browser/settings-HXM36BCZ.mjs.map +0 -7
- package/dist/lib/browser/state-6QODXCSZ.mjs +0 -37
- package/dist/lib/browser/state-6QODXCSZ.mjs.map +0 -7
- package/dist/lib/browser/toolkit-73U3A7SD.mjs +0 -76
- package/dist/lib/browser/toolkit-73U3A7SD.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-MEA4QAAI.mjs +0 -81
- package/dist/lib/node-esm/MarkdownCard-MEA4QAAI.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-7GYMOJVT.mjs +0 -751
- package/dist/lib/node-esm/MarkdownContainer-7GYMOJVT.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-V2FWEYDN.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-V2FWEYDN.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-HIN4NMUG.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-HIN4NMUG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-PDXZ67UQ.mjs +0 -12
- package/dist/lib/node-esm/chunk-35WAARP4.mjs +0 -79
- package/dist/lib/node-esm/chunk-35WAARP4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs +0 -17
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IOC54NCF.mjs +0 -51
- package/dist/lib/node-esm/chunk-IOC54NCF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs +0 -107
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs +0 -24
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YGSNWTGP.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-X2GV6WQH.mjs +0 -216
- package/dist/lib/node-esm/react-surface-X2GV6WQH.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KPLQ5ONI.mjs +0 -29
- package/dist/lib/node-esm/settings-KPLQ5ONI.mjs.map +0 -7
- package/dist/lib/node-esm/state-W3PECOJX.mjs +0 -38
- package/dist/lib/node-esm/state-W3PECOJX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs +0 -77
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -4
- 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 -18
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +0 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +0 -48
- 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 -22
- package/dist/types/src/extensions.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.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -21
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -115
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/capabilities/toolkit.ts +0 -49
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +0 -76
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -75
- package/src/components/MarkdownContainer.stories.tsx +0 -109
- package/src/components/MarkdownContainer.tsx +0 -257
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +0 -108
- package/src/components/MarkdownSettings/index.ts +0 -5
- package/src/components/Suggestions.stories.tsx +0 -221
- package/src/components/Toolbar.stories.tsx +0 -118
- package/src/events.ts +0 -11
- package/src/extensions.tsx +0 -300
- package/src/functions/diff.ts +0 -37
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{blueprint-definition-XDLVVSUN.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-PDXZ67UQ.mjs.map → blueprints/index.mjs.map} +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
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 { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
+
import { OperationResolver } from '@dxos/operation';
|
|
10
|
+
import { ManagedCollection } 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(Capabilities.OperationResolver, [
|
|
17
|
+
OperationResolver.make({
|
|
18
|
+
operation: MarkdownOperation.OnCreateSpace,
|
|
19
|
+
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
+
const collection = ManagedCollection.makeManagedCollection({ 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* Capabilities.updateAtomValue(MarkdownCapabilities.State, (current) => ({
|
|
38
|
+
...current,
|
|
39
|
+
viewMode: { ...current.viewMode, [id]: viewMode },
|
|
40
|
+
}));
|
|
41
|
+
}),
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
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 { AppCapabilities } from '@dxos/app-toolkit';
|
|
17
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
18
|
+
import { Obj } from '@dxos/echo';
|
|
19
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
21
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
22
|
+
|
|
23
|
+
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../containers';
|
|
24
|
+
import { meta } from '../../meta';
|
|
25
|
+
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
26
|
+
|
|
27
|
+
export default Capability.makeModule(() =>
|
|
28
|
+
Effect.succeed(
|
|
29
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
30
|
+
Surface.create({
|
|
31
|
+
id: `${meta.id}/surface/document`,
|
|
32
|
+
role: ['article', 'section', 'tabpanel'],
|
|
33
|
+
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
34
|
+
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
35
|
+
component: ({ data, role, ref }) => {
|
|
36
|
+
return <Container id={Obj.getDXN(data.subject).toString()} subject={data.subject} role={role} ref={ref} />;
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
Surface.create({
|
|
40
|
+
id: `${meta.id}/surface/text`,
|
|
41
|
+
role: ['article', 'section', 'tabpanel'],
|
|
42
|
+
filter: (data): data is { id: string; subject: Text.Text } =>
|
|
43
|
+
typeof data.id === 'string' && Obj.instanceOf(Text.Text, data.subject),
|
|
44
|
+
component: ({ data, role }) => {
|
|
45
|
+
return <Container id={data.id} subject={data.subject} role={role} />;
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
Surface.create({
|
|
49
|
+
id: `${meta.id}/surface/plugin-settings`,
|
|
50
|
+
role: 'article',
|
|
51
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
52
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
53
|
+
component: ({ data: { subject } }) => {
|
|
54
|
+
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
55
|
+
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
Surface.create({
|
|
59
|
+
id: `${meta.id}/surface/preview`,
|
|
60
|
+
role: 'card--content',
|
|
61
|
+
filter: (data): data is { subject: Markdown.Document | Text.Text } =>
|
|
62
|
+
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(Text.Text, data.subject),
|
|
63
|
+
component: ({ data }) => <MarkdownCard {...data} />,
|
|
64
|
+
}),
|
|
65
|
+
]),
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Common wrapper.
|
|
71
|
+
*/
|
|
72
|
+
const Container = forwardRef<HTMLDivElement, SurfaceComponentProps<Markdown.Document | Text.Text, { id: string }>>(
|
|
73
|
+
({ id, subject, role }, forwardedRef) => {
|
|
74
|
+
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
75
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
76
|
+
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
77
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
78
|
+
const extensions = useCapability(MarkdownCapabilities.Extensions);
|
|
79
|
+
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
80
|
+
|
|
81
|
+
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
82
|
+
const handleViewModeChange = useCallback<NonNullable<MarkdownContainerProps['onViewModeChange']>>(
|
|
83
|
+
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
84
|
+
[id, setState],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<MarkdownContainer
|
|
89
|
+
role={role}
|
|
90
|
+
subject={subject}
|
|
91
|
+
id={id}
|
|
92
|
+
settings={settings}
|
|
93
|
+
selectionManager={selectionManager}
|
|
94
|
+
extensionProviders={extensionProviders}
|
|
95
|
+
editorStateStore={editorState}
|
|
96
|
+
viewMode={viewMode}
|
|
97
|
+
onViewModeChange={handleViewModeChange}
|
|
98
|
+
ref={forwardedRef}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { createKvsStore } from '@dxos/effect';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(() =>
|
|
15
|
+
Effect.sync(() => {
|
|
16
|
+
const settingsAtom = createKvsStore({
|
|
17
|
+
key: meta.id,
|
|
18
|
+
schema: Markdown.Settings,
|
|
19
|
+
defaultValue: () => ({
|
|
20
|
+
defaultViewMode: 'preview' as const,
|
|
21
|
+
toolbar: true,
|
|
22
|
+
numberedHeadings: true,
|
|
23
|
+
folding: true,
|
|
24
|
+
experimental: false,
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return [
|
|
29
|
+
Capability.contributes(MarkdownCapabilities.Settings, settingsAtom),
|
|
30
|
+
Capability.contributes(AppCapabilities.Settings, {
|
|
31
|
+
prefix: meta.id,
|
|
32
|
+
schema: Markdown.Settings,
|
|
33
|
+
atom: settingsAtom,
|
|
34
|
+
}),
|
|
35
|
+
];
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
);
|
package/src/cli/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
// NOTE: Must not import from index to avoid pulling in react dependencies.
|
|
13
|
+
import { OperationResolver } from '../capabilities/operation-resolver';
|
|
14
|
+
import { meta } from '../meta';
|
|
15
|
+
import { Markdown } from '../types';
|
|
16
|
+
|
|
17
|
+
export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
18
|
+
AppPlugin.addMetadataModule({
|
|
19
|
+
metadata: {
|
|
20
|
+
id: Markdown.Document.typename,
|
|
21
|
+
metadata: {
|
|
22
|
+
createObject: ((props) => Effect.sync(() => Markdown.make(props))) satisfies CreateObject,
|
|
23
|
+
addToCollectionOnCreate: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
28
|
+
AppPlugin.addSchemaModule({ schema: [Markdown.Document, Text.Text] }),
|
|
29
|
+
Plugin.make,
|
|
30
|
+
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
6
|
+
import React, { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
8
|
+
import { useDropzone } from 'react-dropzone';
|
|
9
|
+
|
|
10
|
+
import { type FileInfo } from '@dxos/app-toolkit';
|
|
11
|
+
import { addLink } from '@dxos/ui-editor';
|
|
12
|
+
|
|
13
|
+
export const IMAGE_FILES = ['.jpg', '.jpeg', '.png', '.gif'];
|
|
14
|
+
|
|
15
|
+
export type FileUploadAction = () => void;
|
|
16
|
+
|
|
17
|
+
export type FileUploadProps = {
|
|
18
|
+
editorView?: EditorView;
|
|
19
|
+
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// TODO(burdon): Factor out.
|
|
23
|
+
// TODO(burdon): Move to root? (support drag into document via dropzone).
|
|
24
|
+
export const FileUpload = forwardRef<FileUploadAction, FileUploadProps>(
|
|
25
|
+
({ editorView, onFileUpload }, forwardedRef) => {
|
|
26
|
+
// https://react-dropzone.js.org
|
|
27
|
+
const { acceptedFiles, open, inputRef } = useDropzone({
|
|
28
|
+
disabled: !onFileUpload,
|
|
29
|
+
multiple: false,
|
|
30
|
+
noDrag: true,
|
|
31
|
+
accept: {
|
|
32
|
+
'image/*': IMAGE_FILES,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
useImperativeHandle(forwardedRef, () => open, []);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (editorView && acceptedFiles.length && onFileUpload) {
|
|
40
|
+
requestAnimationFrame(async () => {
|
|
41
|
+
// NOTE: Clone file since react-dropzone patches in a non-standard `path` property, which confuses IPFS.
|
|
42
|
+
const f = acceptedFiles[0];
|
|
43
|
+
const file = new File([f], f.name, {
|
|
44
|
+
type: f.type,
|
|
45
|
+
lastModified: f.lastModified,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// TODO(burdon): Factor out.
|
|
49
|
+
const info = await onFileUpload(file);
|
|
50
|
+
if (info) {
|
|
51
|
+
addLink({ url: info.url, image: true })(editorView);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, [editorView, acceptedFiles, onFileUpload]);
|
|
56
|
+
|
|
57
|
+
if (!onFileUpload) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return <>{createPortal(<input ref={inputRef} />, document.body)} </>;
|
|
62
|
+
},
|
|
63
|
+
);
|
|
@@ -3,63 +3,83 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
13
|
+
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
14
|
+
import { Panel } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
17
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
15
18
|
|
|
16
19
|
import { translations } from '../../translations';
|
|
20
|
+
import { Markdown } from '../../types';
|
|
17
21
|
|
|
18
|
-
import { MarkdownEditor, type
|
|
22
|
+
import { MarkdownEditor, type MarkdownEditorRootProps } from './MarkdownEditor';
|
|
19
23
|
|
|
20
24
|
const content = Array.from({ length: 100 }, (_, i) => `Line ${i + 1}`).join('\n');
|
|
21
25
|
|
|
22
|
-
type StoryProps =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
type StoryProps = Omit<MarkdownEditorRootProps, 'id' | 'extensions'>;
|
|
27
|
+
|
|
28
|
+
const DefaultStory = (props: StoryProps) => {
|
|
29
|
+
const space = useSpace();
|
|
30
|
+
const [doc] = useQuery(space?.db, Filter.type(Markdown.Document));
|
|
31
|
+
const id = doc && Obj.getDXN(doc).toString();
|
|
32
|
+
const attentionAttrs = useAttentionAttributes(id);
|
|
33
|
+
if (!id) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
26
36
|
|
|
27
|
-
const DefaultStory = ({ content = '# Test', toolbar }: StoryProps) => {
|
|
28
|
-
const doc = useMemo(() => createObject({ content }), [content]); // TODO(burdon): Remove dependency on createObject.
|
|
29
|
-
const extensions = useMemo(() => [automerge(createDocAccessor(doc, ['content']))], [doc]);
|
|
30
37
|
return (
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
<MarkdownEditor.Root id={id} object={doc} {...props}>
|
|
39
|
+
<Panel.Root {...attentionAttrs}>
|
|
40
|
+
<Panel.Toolbar asChild>
|
|
41
|
+
<MarkdownEditor.Toolbar id={id} />
|
|
42
|
+
</Panel.Toolbar>
|
|
43
|
+
<Panel.Content asChild>
|
|
44
|
+
<MarkdownEditor.Content />
|
|
45
|
+
</Panel.Content>
|
|
46
|
+
</Panel.Root>
|
|
47
|
+
</MarkdownEditor.Root>
|
|
36
48
|
);
|
|
37
49
|
};
|
|
38
50
|
|
|
39
|
-
const meta = {
|
|
40
|
-
title: 'plugins/plugin-markdown/MarkdownEditor',
|
|
41
|
-
component:
|
|
42
|
-
render: DefaultStory,
|
|
43
|
-
decorators: [
|
|
51
|
+
const meta: Meta<typeof DefaultStory> = {
|
|
52
|
+
title: 'plugins/plugin-markdown/components/MarkdownEditor',
|
|
53
|
+
component: DefaultStory,
|
|
54
|
+
render: DefaultStory as any,
|
|
55
|
+
decorators: [
|
|
56
|
+
withTheme(),
|
|
57
|
+
withLayout({ layout: 'column' }),
|
|
58
|
+
withPluginManager({
|
|
59
|
+
plugins: [
|
|
60
|
+
...corePlugins(),
|
|
61
|
+
ClientPlugin({
|
|
62
|
+
types: [Markdown.Document],
|
|
63
|
+
onClientInitialized: ({ client }) =>
|
|
64
|
+
Effect.gen(function* () {
|
|
65
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
66
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
67
|
+
const space = client.spaces.default;
|
|
68
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
69
|
+
|
|
70
|
+
space.db.add(Markdown.make({ content }));
|
|
71
|
+
}),
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
44
76
|
parameters: {
|
|
45
|
-
layout: 'fullscreen',
|
|
46
77
|
translations: [...translations, ...editorTranslations],
|
|
47
78
|
},
|
|
48
|
-
}
|
|
79
|
+
};
|
|
49
80
|
|
|
50
81
|
export default meta;
|
|
51
82
|
|
|
52
83
|
type Story = StoryObj<typeof meta>;
|
|
53
84
|
|
|
54
|
-
export const Default: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
content,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const WithToolbar: Story = {
|
|
61
|
-
args: {
|
|
62
|
-
toolbar: true,
|
|
63
|
-
content,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
85
|
+
export const Default: Story = {};
|