@dxos/plugin-markdown 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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-7VIO7R66.mjs +11 -0
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs +11 -0
- package/dist/lib/browser/anchor-sort-JBAZRPE7.mjs +33 -0
- package/dist/lib/browser/anchor-sort-JBAZRPE7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs +59 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs +20 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/{chunk-O6XUPW6S.mjs → chunk-2AAD3W6X.mjs} +12 -8
- package/dist/lib/browser/chunk-2AAD3W6X.mjs.map +7 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs +167 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs +8 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs +105 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs +58 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs.map +7 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs +796 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs.map +7 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs +176 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +33 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +125 -143
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs +53 -0
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs.map +7 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs +213 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs.map +7 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs +36 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs.map +7 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs +29 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs +12 -0
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs +12 -0
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-IQMDZRA3.mjs +34 -0
- package/dist/lib/node-esm/anchor-sort-IQMDZRA3.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs +60 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs +21 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AGZOFIK2.mjs +10 -0
- package/dist/lib/node-esm/chunk-AGZOFIK2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs +797 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs +59 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs +106 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs +177 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XO3IEQJE.mjs → chunk-MLZQCT2N.mjs} +12 -8
- package/dist/lib/node-esm/chunk-MLZQCT2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs +168 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +34 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +125 -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-QAGXDA5E.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-QAGXDA5E.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs +214 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs.map +7 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs +37 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs.map +7 -0
- package/dist/lib/node-esm/state-TVF2XT2T.mjs +30 -0
- package/dist/lib/node-esm/state-TVF2XT2T.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -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 +4 -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 +21 -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 +11 -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/MarkdownCard/MarkdownCard.d.ts +5 -4
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +5 -5
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +21 -11
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +33 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- 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/MarkdownSettings/MarkdownSettings.d.ts +4 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -31
- 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 +94 -56
- 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 +7 -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 +38 -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 +26 -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/MarkdownCard/MarkdownCard.stories.tsx +26 -44
- package/src/components/MarkdownCard/MarkdownCard.tsx +41 -53
- package/src/components/MarkdownContainer.stories.tsx +68 -54
- package/src/components/MarkdownContainer.tsx +106 -250
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +56 -38
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +227 -273
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +162 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +66 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +48 -34
- package/src/components/Suggestions.stories.tsx +35 -39
- package/src/components/index.ts +10 -3
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/{extensions.tsx → hooks/useExtensions.tsx} +70 -95
- 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 +8 -9
- 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 +80 -11
- package/dist/lib/browser/MarkdownCard-AGWOTODZ.mjs +0 -83
- package/dist/lib/browser/MarkdownCard-AGWOTODZ.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-MV2UNAUV.mjs +0 -751
- package/dist/lib/browser/MarkdownContainer-MV2UNAUV.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-YWJI3BKT.mjs +0 -32
- package/dist/lib/browser/anchor-sort-YWJI3BKT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-KYDFCUOW.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-KYDFCUOW.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-BHRMFZAC.mjs +0 -11
- package/dist/lib/browser/chunk-6KU5DKP7.mjs +0 -51
- package/dist/lib/browser/chunk-6KU5DKP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-HBBEHOP3.mjs +0 -106
- package/dist/lib/browser/chunk-HBBEHOP3.mjs.map +0 -7
- package/dist/lib/browser/chunk-O6XUPW6S.mjs.map +0 -7
- package/dist/lib/browser/chunk-ODB2PTBP.mjs +0 -28
- 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-XMT6PMU5.mjs +0 -79
- package/dist/lib/browser/chunk-XMT6PMU5.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5PDJNBV.mjs +0 -22
- package/dist/lib/browser/chunk-Z5PDJNBV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XHVCZZHU.mjs +0 -62
- package/dist/lib/browser/intent-resolver-XHVCZZHU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3A2GO3BN.mjs +0 -215
- package/dist/lib/browser/react-surface-3A2GO3BN.mjs.map +0 -7
- package/dist/lib/browser/settings-XY265Y2Q.mjs +0 -28
- package/dist/lib/browser/settings-XY265Y2Q.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-YA65QX2S.mjs +0 -76
- package/dist/lib/browser/toolkit-YA65QX2S.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-B2IWTFOC.mjs +0 -84
- package/dist/lib/node-esm/MarkdownCard-B2IWTFOC.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-J2R3DLCQ.mjs +0 -752
- package/dist/lib/node-esm/MarkdownContainer-J2R3DLCQ.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-FCRYL2FX.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-FCRYL2FX.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-FAUQM3BH.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-FAUQM3BH.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-XYFKMIDR.mjs +0 -12
- package/dist/lib/node-esm/chunk-7RDNIMTF.mjs +0 -24
- package/dist/lib/node-esm/chunk-7RDNIMTF.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-FVI7LPC3.mjs +0 -107
- package/dist/lib/node-esm/chunk-FVI7LPC3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FWZKC6X5.mjs +0 -80
- package/dist/lib/node-esm/chunk-FWZKC6X5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCG2U522.mjs +0 -29
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XO3IEQJE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZBXV4ON7.mjs +0 -52
- package/dist/lib/node-esm/chunk-ZBXV4ON7.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-7A2EXGZQ.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-7A2EXGZQ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RCLL5WVQ.mjs +0 -216
- package/dist/lib/node-esm/react-surface-RCLL5WVQ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-H3UDD3KO.mjs +0 -29
- package/dist/lib/node-esm/settings-H3UDD3KO.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-HSIKUGNK.mjs +0 -77
- package/dist/lib/node-esm/toolkit-HSIKUGNK.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/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/Toolbar.stories.tsx +0 -118
- package/src/events.ts +0 -11
- package/src/functions/diff.ts +0 -37
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{blueprint-definition-BHRMFZAC.mjs.map → MarkdownCard-7VIO7R66.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-XYFKMIDR.mjs.map → browser/MarkdownContainer-6E43EDAU.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 { Collection } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
import { Markdown, MarkdownCapabilities, MarkdownOperation } from '../../types';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
17
|
+
OperationResolver.make({
|
|
18
|
+
operation: MarkdownOperation.OnCreateSpace,
|
|
19
|
+
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
+
const collection = Collection.makeManaged({ key: Type.getTypename(Markdown.Document) });
|
|
21
|
+
Obj.change(rootCollection, (c) => {
|
|
22
|
+
c.objects.push(Ref.make(collection));
|
|
23
|
+
});
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
OperationResolver.make({
|
|
27
|
+
operation: MarkdownOperation.Create,
|
|
28
|
+
handler: ({ name, content }) =>
|
|
29
|
+
Effect.succeed({
|
|
30
|
+
object: Markdown.make({ name, content }),
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
34
|
+
OperationResolver.make({
|
|
35
|
+
operation: MarkdownOperation.SetViewMode,
|
|
36
|
+
handler: Effect.fnUntraced(function* ({ id, viewMode }) {
|
|
37
|
+
yield* 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 '../../components';
|
|
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
|
+
);
|
|
@@ -3,35 +3,45 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
-
import { CardContainer } from '@dxos/react-ui-
|
|
13
|
+
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
14
14
|
|
|
15
15
|
import { translations } from '../../translations';
|
|
16
16
|
|
|
17
|
-
import { MarkdownCard } from './MarkdownCard';
|
|
17
|
+
import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
18
18
|
|
|
19
19
|
faker.seed(1234);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
22
|
+
const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
23
|
+
const subject = useMemo(
|
|
24
|
+
() =>
|
|
25
|
+
Markdown.make({
|
|
26
|
+
name: faker.lorem.words(3),
|
|
27
|
+
content: faker.lorem.paragraphs(3),
|
|
28
|
+
}),
|
|
29
|
+
[],
|
|
30
|
+
);
|
|
31
|
+
return (
|
|
32
|
+
<CardContainer icon='ph--text-aa--regular'>
|
|
33
|
+
<MarkdownCard subject={subject} {...args} />
|
|
34
|
+
</CardContainer>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const meta: Meta<typeof MarkdownCardStory> = {
|
|
22
39
|
title: 'plugins/plugin-markdown/Card',
|
|
23
|
-
component:
|
|
24
|
-
render: ({ role, subject, ...args }) => {
|
|
25
|
-
return (
|
|
26
|
-
<CardContainer icon='ph--text-aa--regular' role={role}>
|
|
27
|
-
<MarkdownCard role={role} subject={subject} {...args} />
|
|
28
|
-
</CardContainer>
|
|
29
|
-
);
|
|
30
|
-
},
|
|
40
|
+
component: MarkdownCardStory,
|
|
31
41
|
decorators: [
|
|
32
|
-
withTheme,
|
|
42
|
+
withTheme(),
|
|
33
43
|
withPluginManager({
|
|
34
|
-
plugins: [
|
|
44
|
+
plugins: [OperationPlugin()],
|
|
35
45
|
}),
|
|
36
46
|
],
|
|
37
47
|
parameters: {
|
|
@@ -45,32 +55,4 @@ export default meta;
|
|
|
45
55
|
|
|
46
56
|
type Story = StoryObj<typeof meta>;
|
|
47
57
|
|
|
48
|
-
export const
|
|
49
|
-
args: {
|
|
50
|
-
role: 'card--popover',
|
|
51
|
-
subject: Markdown.makeDocument({
|
|
52
|
-
name: faker.lorem.words(3),
|
|
53
|
-
content: faker.lorem.paragraphs(3),
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const Intrinsic: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
role: 'card--intrinsic',
|
|
61
|
-
subject: Markdown.makeDocument({
|
|
62
|
-
name: faker.lorem.words(3),
|
|
63
|
-
content: faker.lorem.paragraphs(3),
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Extrinsic: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
role: 'card--extrinsic',
|
|
71
|
-
subject: Markdown.makeDocument({
|
|
72
|
-
name: faker.lorem.words(3),
|
|
73
|
-
content: faker.lorem.paragraphs(3),
|
|
74
|
-
}),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
58
|
+
export const Default: Story = {};
|
|
@@ -2,75 +2,63 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
7
6
|
|
|
8
|
-
import { LayoutAction, chain, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
7
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Card } from '@dxos/react-ui-stack';
|
|
14
|
-
import { DataType } from '@dxos/schema';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Card } from '@dxos/react-ui-mosaic';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
15
11
|
|
|
16
12
|
import { meta } from '../../meta';
|
|
17
13
|
import { Markdown } from '../../types';
|
|
18
14
|
import { getContentSnippet, getFallbackName } from '../../util';
|
|
15
|
+
import { MarkdownEditor } from '../MarkdownEditor';
|
|
16
|
+
|
|
17
|
+
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
18
|
+
|
|
19
|
+
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
21
|
+
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
22
|
+
const info = getInfo(subject);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Card.Content>
|
|
26
|
+
{snippet && (
|
|
27
|
+
<Card.Row className='max-h-[300px] overflow-hidden'>
|
|
28
|
+
<MarkdownEditor.Root id={subject.id} viewMode='readonly'>
|
|
29
|
+
<MarkdownEditor.Content initialValue={snippet} slots={{}} classNames='!bg-transparent' />
|
|
30
|
+
</MarkdownEditor.Root>
|
|
31
|
+
</Card.Row>
|
|
32
|
+
)}
|
|
33
|
+
<Card.Row>
|
|
34
|
+
<Card.Text classNames='text-xs text-description'>
|
|
35
|
+
{info.words} {t('words label', { count: info.words })}
|
|
36
|
+
</Card.Text>
|
|
37
|
+
</Card.Row>
|
|
38
|
+
</Card.Content>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
43
|
+
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
44
|
+
return { words: text.split(' ').length };
|
|
45
|
+
};
|
|
19
46
|
|
|
20
47
|
// TODO(burdon): Factor out.
|
|
21
|
-
const getTitle = (subject: Markdown.Document |
|
|
48
|
+
const getTitle = (subject: Markdown.Document | Text.Text, fallback: string) => {
|
|
22
49
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
23
|
-
|
|
24
|
-
|
|
50
|
+
const title = Obj.getLabel(subject);
|
|
51
|
+
return title ?? getFallbackName(subject.content?.target?.content ?? fallback);
|
|
52
|
+
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
25
53
|
return getFallbackName(subject.content);
|
|
26
54
|
}
|
|
27
55
|
};
|
|
28
56
|
|
|
29
57
|
// TODO(burdon): Factor out.
|
|
30
|
-
const getSnippet = (subject: Markdown.Document |
|
|
58
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
31
59
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
32
60
|
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback);
|
|
33
|
-
} else if (Obj.instanceOf(
|
|
61
|
+
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
34
62
|
return getContentSnippet(subject.content ?? fallback);
|
|
35
63
|
}
|
|
36
64
|
};
|
|
37
|
-
|
|
38
|
-
export type MarkdownCardProps = PreviewProps<Markdown.Document | DataType.Text>;
|
|
39
|
-
|
|
40
|
-
export const MarkdownCard = ({ subject, role }: MarkdownCardProps) => {
|
|
41
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
42
|
-
const { t } = useTranslation(meta.id);
|
|
43
|
-
const snippet = getSnippet(subject, t('fallback abstract'));
|
|
44
|
-
|
|
45
|
-
// TODO(wittjosiah): Factor out so this component isn't dependent on the app framework.
|
|
46
|
-
const handleNavigate = useCallback(
|
|
47
|
-
() =>
|
|
48
|
-
dispatch(
|
|
49
|
-
Function.pipe(
|
|
50
|
-
createIntent(LayoutAction.UpdatePopover, {
|
|
51
|
-
part: 'popover',
|
|
52
|
-
subject: null,
|
|
53
|
-
options: { state: false, anchorId: '' },
|
|
54
|
-
}),
|
|
55
|
-
chain(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(subject)] }),
|
|
56
|
-
),
|
|
57
|
-
),
|
|
58
|
-
[dispatch, subject],
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Card.SurfaceRoot role={role}>
|
|
63
|
-
<Card.Heading classNames='flex items-center'>
|
|
64
|
-
{getTitle(subject, t('fallback title'))}
|
|
65
|
-
<span className='grow' />
|
|
66
|
-
<IconButton
|
|
67
|
-
iconOnly
|
|
68
|
-
icon='ph--arrow-right--regular'
|
|
69
|
-
label={t('navigate to document label')}
|
|
70
|
-
onClick={handleNavigate}
|
|
71
|
-
/>
|
|
72
|
-
</Card.Heading>
|
|
73
|
-
{snippet && <Card.Text classNames='line-clamp-3 text-sm text-description'>{snippet}</Card.Text>}
|
|
74
|
-
</Card.SurfaceRoot>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
@@ -3,33 +3,24 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
type Capabilities,
|
|
10
|
-
IntentPlugin,
|
|
11
|
-
LayoutAction,
|
|
12
|
-
SettingsPlugin,
|
|
13
|
-
Surface,
|
|
14
|
-
createIntent,
|
|
15
|
-
useIntentDispatcher,
|
|
16
|
-
} from '@dxos/app-framework';
|
|
17
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
18
12
|
import { Obj, Query } from '@dxos/echo';
|
|
19
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
20
13
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
21
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
22
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
23
|
-
import {
|
|
24
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
25
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
26
16
|
import { faker } from '@dxos/random';
|
|
27
17
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
28
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
29
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
19
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
21
|
+
import { Text } from '@dxos/schema';
|
|
32
22
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
23
|
+
import { Organization, Person } from '@dxos/types';
|
|
33
24
|
|
|
34
25
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
35
26
|
import { translations } from '../translations';
|
|
@@ -40,70 +31,93 @@ faker.seed(1);
|
|
|
40
31
|
const generator: ValueGenerator = faker as any;
|
|
41
32
|
|
|
42
33
|
const DefaultStory = () => {
|
|
43
|
-
const {
|
|
34
|
+
const { invokePromise } = useOperationInvoker();
|
|
44
35
|
const space = useSpace();
|
|
45
|
-
const [doc] = useQuery(space, Query.type(Markdown.Document));
|
|
36
|
+
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
46
37
|
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
38
|
+
const id = doc && Obj.getDXN(doc).toString();
|
|
39
|
+
const attentionAttrs = useAttentionAttributes(id);
|
|
47
40
|
|
|
48
41
|
useAsyncEffect(async () => {
|
|
49
42
|
if (space) {
|
|
50
|
-
await
|
|
43
|
+
await invokePromise(LayoutOperation.SwitchWorkspace, { subject: space.id });
|
|
51
44
|
}
|
|
52
|
-
}, [space,
|
|
45
|
+
}, [space, invokePromise]);
|
|
53
46
|
|
|
54
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<div className='contents' {...attentionAttrs}>
|
|
49
|
+
<Surface.Surface role='article' data={data} limit={1} />
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
55
52
|
};
|
|
56
53
|
|
|
57
54
|
const meta = {
|
|
58
55
|
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
59
56
|
render: DefaultStory,
|
|
60
57
|
decorators: [
|
|
61
|
-
withTheme,
|
|
62
|
-
|
|
58
|
+
withTheme(),
|
|
59
|
+
withLayout({ layout: 'column' }),
|
|
60
|
+
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
63
61
|
plugins: [
|
|
62
|
+
...corePlugins(),
|
|
63
|
+
StorybookPlugin({}),
|
|
64
64
|
ClientPlugin({
|
|
65
|
-
types: [Markdown.Document,
|
|
66
|
-
onClientInitialized:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
65
|
+
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
66
|
+
onClientInitialized: ({ client }) =>
|
|
67
|
+
Effect.gen(function* () {
|
|
68
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
69
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
70
|
+
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
71
|
+
|
|
72
|
+
const space = client.spaces.default;
|
|
73
|
+
const createObjects = createObjectFactory(space.db, generator);
|
|
74
|
+
yield* Effect.promise(() => createObjects([{ type: Organization.Organization, count: 10 }]));
|
|
75
|
+
|
|
76
|
+
const queue = space.queues.create();
|
|
77
|
+
const kai = Obj.make(Person.Person, { fullName: 'Kai' });
|
|
78
|
+
const dxos = Obj.make(Organization.Organization, { name: 'DXOS' });
|
|
79
|
+
yield* Effect.promise(() => queue.append([kai, dxos]));
|
|
80
|
+
|
|
81
|
+
space.db.add(
|
|
82
|
+
Markdown.make({
|
|
83
|
+
name: context.args.title ?? 'Testing',
|
|
84
|
+
content: [
|
|
85
|
+
`# ${context.args.title ?? 'Testing'}`,
|
|
86
|
+
context.args.content ?? '',
|
|
87
|
+
// TODO(burdon): Popovers not currently working.
|
|
88
|
+
'## Here are some objects',
|
|
89
|
+
`})`,
|
|
90
|
+
`})`,
|
|
91
|
+
'',
|
|
92
|
+
'END',
|
|
93
|
+
'',
|
|
94
|
+
].join('\n\n'),
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
yield* Effect.promise(() => space.db.flush({ indexes: true }));
|
|
99
|
+
}),
|
|
84
100
|
}),
|
|
85
|
-
|
|
86
|
-
GraphPlugin(),
|
|
87
|
-
IntentPlugin(),
|
|
88
|
-
SettingsPlugin(),
|
|
89
|
-
// UI
|
|
90
|
-
ThemePlugin({ tx: defaultTx }),
|
|
91
|
-
AttentionPlugin(),
|
|
101
|
+
|
|
92
102
|
MarkdownPlugin(),
|
|
93
103
|
PreviewPlugin(),
|
|
94
|
-
StorybookLayoutPlugin({}),
|
|
95
104
|
],
|
|
96
|
-
}),
|
|
105
|
+
})),
|
|
97
106
|
],
|
|
98
107
|
parameters: {
|
|
99
108
|
layout: 'fullscreen',
|
|
100
109
|
controls: { disable: true },
|
|
101
110
|
translations,
|
|
102
111
|
},
|
|
103
|
-
} satisfies Meta<typeof
|
|
112
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
104
113
|
|
|
105
114
|
export default meta;
|
|
106
115
|
|
|
107
116
|
type Story = StoryObj<typeof meta>;
|
|
108
117
|
|
|
109
|
-
export const Default: Story = {
|
|
118
|
+
export const Default: Story = {
|
|
119
|
+
args: {
|
|
120
|
+
title: 'Testing',
|
|
121
|
+
content: ['This is a line with **some** formatting.'].join('\n\n'),
|
|
122
|
+
},
|
|
123
|
+
};
|