@dxos/plugin-markdown 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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-3MYLO74J.mjs → anchor-sort-JBAZRPE7.mjs} +8 -7
- 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/{chunk-NXT2E2BG.mjs → chunk-2AAD3W6X.mjs} +6 -6
- 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 +124 -129
- 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/MarkdownContainer-TTRUOXU6.mjs +12 -0
- package/dist/lib/node-esm/{anchor-sort-W4HCTYUQ.mjs → anchor-sort-IQMDZRA3.mjs} +8 -7
- 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/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-I5JSQBPI.mjs → chunk-MLZQCT2N.mjs} +6 -6
- 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 +124 -129
- 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/blueprints/functions/create.d.ts.map +1 -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.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 -13
- 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 +4 -16
- 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 +16 -7
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +29 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- 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 +8 -7
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +6 -5
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +3 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- 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/hooks/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +3 -3
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +2 -2
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- 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/translations.d.ts +29 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +12 -12
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +62 -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.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +88 -66
- package/src/MarkdownPlugin.tsx +64 -76
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +92 -0
- package/src/{functions → blueprints/functions}/create.ts +4 -3
- package/src/blueprints/functions/index.ts +7 -0
- package/src/{functions → blueprints/functions}/open.ts +10 -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 -11
- 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 +23 -55
- package/src/components/MarkdownContainer.stories.tsx +49 -62
- package/src/components/MarkdownContainer.tsx +37 -32
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +17 -18
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +26 -21
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +22 -12
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +6 -3
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +48 -34
- package/src/components/Suggestions.stories.tsx +22 -33
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +24 -28
- package/src/hooks/useLinkQuery.ts +12 -12
- package/src/hooks/useSelectCurrentThread.tsx +37 -42
- package/src/index.ts +3 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +1 -1
- package/src/translations.ts +2 -0
- package/src/types/Markdown.ts +2 -2
- 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 +3 -0
- package/src/types/types.ts +3 -2
- package/src/util.tsx +3 -1
- package/dist/lib/browser/MarkdownCard-THZFDOOV.mjs +0 -13
- package/dist/lib/browser/MarkdownContainer-VKPSVI5F.mjs +0 -16
- package/dist/lib/browser/anchor-sort-3MYLO74J.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-R5T6LTPN.mjs +0 -13
- package/dist/lib/browser/chunk-56SUMOIZ.mjs +0 -734
- package/dist/lib/browser/chunk-56SUMOIZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6OMOMVO7.mjs +0 -107
- package/dist/lib/browser/chunk-6OMOMVO7.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-CN35HEBX.mjs +0 -79
- package/dist/lib/browser/chunk-CN35HEBX.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-KCOBZZIL.mjs +0 -111
- package/dist/lib/browser/chunk-KCOBZZIL.mjs.map +0 -7
- package/dist/lib/browser/chunk-KPH4ZPQN.mjs +0 -99
- package/dist/lib/browser/chunk-KPH4ZPQN.mjs.map +0 -7
- package/dist/lib/browser/chunk-NXT2E2BG.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJPOHSYN.mjs +0 -152
- package/dist/lib/browser/chunk-RJPOHSYN.mjs.map +0 -7
- package/dist/lib/browser/chunk-U6Y53XZK.mjs +0 -20
- package/dist/lib/browser/chunk-U6Y53XZK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs +0 -62
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Q3C5H2KT.mjs +0 -215
- package/dist/lib/browser/react-surface-Q3C5H2KT.mjs.map +0 -7
- package/dist/lib/browser/settings-G3ZOXJQY.mjs +0 -28
- package/dist/lib/browser/settings-G3ZOXJQY.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.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-QHSSZGIY.mjs +0 -14
- package/dist/lib/node-esm/MarkdownContainer-G3ZQJS7A.mjs +0 -17
- package/dist/lib/node-esm/anchor-sort-W4HCTYUQ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-2JV3WV22.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-2JV3WV22.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6F6FCTIA.mjs +0 -100
- package/dist/lib/node-esm/chunk-6F6FCTIA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C5KXP2ZE.mjs +0 -153
- package/dist/lib/node-esm/chunk-C5KXP2ZE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FR6RW6DH.mjs +0 -735
- package/dist/lib/node-esm/chunk-FR6RW6DH.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-I5JSQBPI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KM7KYV6W.mjs +0 -22
- package/dist/lib/node-esm/chunk-KM7KYV6W.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KYWXTMKI.mjs +0 -108
- package/dist/lib/node-esm/chunk-KYWXTMKI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R3SGV4ES.mjs +0 -112
- package/dist/lib/node-esm/chunk-R3SGV4ES.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-YFRTKXTB.mjs +0 -80
- package/dist/lib/node-esm/chunk-YFRTKXTB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QWRT4SD6.mjs +0 -216
- package/dist/lib/node-esm/react-surface-QWRT4SD6.mjs.map +0 -7
- package/dist/lib/node-esm/settings-IBFFCGNL.mjs +0 -29
- package/dist/lib/node-esm/settings-IBFFCGNL.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.mjs +0 -14
- package/dist/lib/node-esm/toolkit.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -4
- 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 -7
- 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/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- 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/functions/update.d.ts +0 -6
- package/dist/types/src/functions/update.d.ts.map +0 -1
- package/dist/types/src/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/toolkit.d.ts +0 -3
- package/dist/types/src/toolkit.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -31
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -43
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -97
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/events.ts +0 -11
- package/src/functions/create.conversations.json +0 -1
- package/src/functions/create.test.ts +0 -124
- package/src/functions/index.ts +0 -13
- package/src/functions/update.conversations.json +0 -1
- package/src/functions/update.test.ts +0 -147
- package/src/functions/update.ts +0 -38
- package/src/toolkit.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-THZFDOOV.mjs.map → MarkdownCard-7VIO7R66.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-VKPSVI5F.mjs.map → MarkdownContainer-6E43EDAU.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-R5T6LTPN.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/MarkdownCard-YC3R2TQW.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-QHSSZGIY.mjs.map → MarkdownContainer-TTRUOXU6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-G3ZQJS7A.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.test.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.test.d.ts +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.make({
|
|
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.make({
|
|
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.make({
|
|
72
|
-
name: faker.lorem.words(3),
|
|
73
|
-
content: faker.lorem.paragraphs(3),
|
|
74
|
-
}),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
58
|
+
export const Default: Story = {};
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
7
6
|
|
|
8
|
-
import { LayoutAction, chain, createIntent } from '@dxos/app-framework';
|
|
9
|
-
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
10
7
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Card } from '@dxos/react-ui-stack';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Card } from '@dxos/react-ui-mosaic';
|
|
14
10
|
import { Text } from '@dxos/schema';
|
|
15
11
|
|
|
16
12
|
import { meta } from '../../meta';
|
|
@@ -18,58 +14,30 @@ import { Markdown } from '../../types';
|
|
|
18
14
|
import { getContentSnippet, getFallbackName } from '../../util';
|
|
19
15
|
import { MarkdownEditor } from '../MarkdownEditor';
|
|
20
16
|
|
|
21
|
-
export type MarkdownCardProps =
|
|
17
|
+
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
22
18
|
|
|
23
|
-
export const MarkdownCard =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const snippet = useMemo(() => getSnippet(subject, t('fallback abstract')), [subject]);
|
|
28
|
-
const info = getInfo(subject);
|
|
19
|
+
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
21
|
+
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
22
|
+
const info = getInfo(subject);
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
part: 'main',
|
|
41
|
-
subject: [Obj.getDXN(subject).toString()],
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
44
|
-
);
|
|
45
|
-
}, [dispatch, subject]);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Card.SurfaceRoot role={role} ref={forwardedRef}>
|
|
49
|
-
<Card.Heading classNames='flex items-center'>
|
|
50
|
-
{getTitle(subject, t('fallback title'))}
|
|
51
|
-
<span className='grow' />
|
|
52
|
-
<IconButton
|
|
53
|
-
iconOnly
|
|
54
|
-
icon='ph--arrow-right--regular'
|
|
55
|
-
label={t('navigate to document label')}
|
|
56
|
-
onClick={handleNavigate}
|
|
57
|
-
/>
|
|
58
|
-
</Card.Heading>
|
|
59
|
-
{snippet && (
|
|
60
|
-
<Card.Text classNames='flex max-h-[300px] overflow-hidden'>
|
|
61
|
-
<MarkdownEditor.Root id={subject.id} viewMode='readonly'>
|
|
62
|
-
<MarkdownEditor.Content initialValue={snippet} slots={{}} classNames='!bg-transparent' />
|
|
63
|
-
</MarkdownEditor.Root>
|
|
64
|
-
</Card.Text>
|
|
65
|
-
)}
|
|
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>
|
|
66
34
|
<Card.Text classNames='text-xs text-description'>
|
|
67
35
|
{info.words} {t('words label', { count: info.words })}
|
|
68
36
|
</Card.Text>
|
|
69
|
-
</Card.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
</Card.Row>
|
|
38
|
+
</Card.Content>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
73
41
|
|
|
74
42
|
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
75
43
|
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
@@ -87,7 +55,7 @@ const getTitle = (subject: Markdown.Document | Text.Text, fallback: string) => {
|
|
|
87
55
|
};
|
|
88
56
|
|
|
89
57
|
// TODO(burdon): Factor out.
|
|
90
|
-
const getSnippet = (subject: Markdown.Document | Text.Text, fallback
|
|
58
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
91
59
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
92
60
|
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback);
|
|
93
61
|
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
@@ -3,25 +3,21 @@
|
|
|
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 { type Capabilities, IntentPlugin, LayoutAction, SettingsPlugin, createIntent } from '@dxos/app-framework';
|
|
9
|
-
import { Surface, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
10
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
12
|
import { Obj, Query } from '@dxos/echo';
|
|
12
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
13
13
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
15
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
16
|
-
import {
|
|
17
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
18
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
19
16
|
import { faker } from '@dxos/random';
|
|
20
17
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
21
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
22
19
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
23
20
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
24
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
25
21
|
import { Text } from '@dxos/schema';
|
|
26
22
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
27
23
|
import { Organization, Person } from '@dxos/types';
|
|
@@ -35,27 +31,22 @@ faker.seed(1);
|
|
|
35
31
|
const generator: ValueGenerator = faker as any;
|
|
36
32
|
|
|
37
33
|
const DefaultStory = () => {
|
|
38
|
-
const {
|
|
34
|
+
const { invokePromise } = useOperationInvoker();
|
|
39
35
|
const space = useSpace();
|
|
40
|
-
const [doc] = useQuery(space, Query.type(Markdown.Document));
|
|
36
|
+
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
41
37
|
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
42
38
|
const id = doc && Obj.getDXN(doc).toString();
|
|
43
39
|
const attentionAttrs = useAttentionAttributes(id);
|
|
44
40
|
|
|
45
41
|
useAsyncEffect(async () => {
|
|
46
42
|
if (space) {
|
|
47
|
-
await
|
|
48
|
-
createIntent(LayoutAction.SwitchWorkspace, {
|
|
49
|
-
part: 'workspace',
|
|
50
|
-
subject: space.id,
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
43
|
+
await invokePromise(LayoutOperation.SwitchWorkspace, { subject: space.id });
|
|
53
44
|
}
|
|
54
|
-
}, [space,
|
|
45
|
+
}, [space, invokePromise]);
|
|
55
46
|
|
|
56
47
|
return (
|
|
57
48
|
<div className='contents' {...attentionAttrs}>
|
|
58
|
-
<Surface role='article' data={data} limit={1} />
|
|
49
|
+
<Surface.Surface role='article' data={data} limit={1} />
|
|
59
50
|
</div>
|
|
60
51
|
);
|
|
61
52
|
};
|
|
@@ -64,56 +55,52 @@ const meta = {
|
|
|
64
55
|
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
65
56
|
render: DefaultStory,
|
|
66
57
|
decorators: [
|
|
67
|
-
withTheme,
|
|
68
|
-
withLayout({
|
|
58
|
+
withTheme(),
|
|
59
|
+
withLayout({ layout: 'column' }),
|
|
69
60
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
70
61
|
plugins: [
|
|
62
|
+
...corePlugins(),
|
|
63
|
+
StorybookPlugin({}),
|
|
71
64
|
ClientPlugin({
|
|
72
65
|
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
73
|
-
onClientInitialized:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
}),
|
|
106
100
|
}),
|
|
107
|
-
|
|
108
|
-
GraphPlugin(),
|
|
109
|
-
IntentPlugin(),
|
|
110
|
-
SettingsPlugin(),
|
|
111
|
-
// UI
|
|
112
|
-
ThemePlugin({ tx: defaultTx }),
|
|
113
|
-
AttentionPlugin(),
|
|
101
|
+
|
|
114
102
|
MarkdownPlugin(),
|
|
115
103
|
PreviewPlugin(),
|
|
116
|
-
StorybookLayoutPlugin({}),
|
|
117
104
|
],
|
|
118
105
|
})),
|
|
119
106
|
],
|
|
@@ -122,7 +109,7 @@ const meta = {
|
|
|
122
109
|
controls: { disable: true },
|
|
123
110
|
translations,
|
|
124
111
|
},
|
|
125
|
-
} satisfies Meta<typeof
|
|
112
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
126
113
|
|
|
127
114
|
export default meta;
|
|
128
115
|
|