@dxos/plugin-markdown 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownSettings-YZFNSJJY.mjs +121 -0
- package/dist/lib/browser/MarkdownSettings-YZFNSJJY.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +47 -4
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-46WIDM4R.mjs +98 -0
- package/dist/lib/browser/chunk-46WIDM4R.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-XKUKZNUS.mjs +158 -0
- package/dist/lib/browser/chunk-XKUKZNUS.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +26 -19
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/create-HSXPXCC5.mjs +30 -0
- package/dist/lib/browser/create-HSXPXCC5.mjs.map +7 -0
- package/dist/lib/browser/create-markdown-WB7DH3UF.mjs +22 -0
- package/dist/lib/browser/create-markdown-WB7DH3UF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +606 -85
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-N6PAX6DY.mjs +21 -0
- package/dist/lib/browser/open-N6PAX6DY.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-5M4F24AB.mjs +49 -0
- package/dist/lib/browser/scroll-to-anchor-5M4F24AB.mjs.map +7 -0
- package/dist/lib/browser/set-view-mode-NBNF2I5W.mjs +26 -0
- package/dist/lib/browser/set-view-mode-NBNF2I5W.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -7
- package/dist/lib/browser/update-5QIRVGTL.mjs +45 -0
- package/dist/lib/browser/update-5QIRVGTL.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-X6SDS35F.mjs +122 -0
- package/dist/lib/node-esm/MarkdownSettings-X6SDS35F.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +47 -4
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs +99 -0
- package/dist/lib/node-esm/chunk-4MSJO6IJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E4BQCEXF.mjs +159 -0
- package/dist/lib/node-esm/chunk-E4BQCEXF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/cli/index.mjs +26 -19
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/create-6Z2KYISY.mjs +31 -0
- package/dist/lib/node-esm/create-6Z2KYISY.mjs.map +7 -0
- package/dist/lib/node-esm/create-markdown-JWQZICKY.mjs +23 -0
- package/dist/lib/node-esm/create-markdown-JWQZICKY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +606 -85
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-DSNFRSNZ.mjs +22 -0
- package/dist/lib/node-esm/open-DSNFRSNZ.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-D6SHGU2R.mjs +50 -0
- package/dist/lib/node-esm/scroll-to-anchor-D6SHGU2R.mjs.map +7 -0
- package/dist/lib/node-esm/set-view-mode-REYB4L7J.mjs +27 -0
- package/dist/lib/node-esm/set-view-mode-REYB4L7J.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -7
- package/dist/lib/node-esm/update-YMQAIKOF.mjs +46 -0
- package/dist/lib/node-esm/update-YMQAIKOF.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +27 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +4 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +24 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +25 -22
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +3 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +4 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +7 -6
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +138 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +1 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts +2 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +15 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +36 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +99 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +7 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-markdown.d.ts +5 -0
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/create.test.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +64 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/operations/set-view-mode.d.ts +5 -0
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -0
- package/dist/types/src/operations/update.d.ts +5 -0
- package/dist/types/src/operations/update.d.ts.map +1 -0
- package/dist/types/src/operations/update.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +75 -35
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +15 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +16 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +31 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +2 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +92 -60
- package/src/MarkdownPlugin.tsx +47 -42
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/markdown-blueprint.ts +14 -8
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +15 -9
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +13 -7
- package/src/capabilities/node.ts +11 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +120 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/state.ts +47 -0
- package/src/cli/plugin.ts +20 -10
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +38 -34
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +139 -102
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +25 -17
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +46 -54
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +39 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +114 -98
- package/src/components/MarkdownSettings/index.ts +1 -1
- package/src/components/index.ts +4 -12
- package/src/{components → containers}/MarkdownCard/MarkdownCard.stories.tsx +21 -12
- package/src/containers/MarkdownCard/MarkdownCard.tsx +62 -0
- package/src/containers/MarkdownCard/index.ts +5 -0
- package/src/containers/MarkdownCard/snippet.ts +78 -0
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.tsx +34 -23
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +145 -0
- package/src/containers/MarkdownContainer/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +3 -3
- package/src/hooks/useExtensions.tsx +81 -92
- package/src/hooks/useLinkQuery.ts +31 -6
- package/src/index.ts +3 -0
- package/src/meta.ts +1 -1
- package/src/operations/create-markdown.ts +20 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/operations/create.test.ts +98 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/definitions.ts +120 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +39 -0
- package/src/operations/set-view-mode.ts +24 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/operations/update.test.ts +215 -0
- package/src/operations/update.ts +51 -0
- package/src/testing.ts +2 -2
- package/src/translations.ts +49 -35
- package/src/types/Markdown.ts +18 -25
- package/src/types/Settings.ts +28 -0
- package/src/types/capabilities.ts +17 -5
- package/src/types/events.ts +5 -4
- package/src/types/index.ts +3 -4
- package/src/util.tsx +5 -5
- package/dist/lib/browser/MarkdownCard-HFNNE4B4.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +0 -12
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs +0 -32
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +0 -58
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +0 -19
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BX73DASG.mjs +0 -702
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +0 -7
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +0 -8
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWQQW6KU.mjs +0 -144
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXYQLKH.mjs +0 -55
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +0 -7
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +0 -104
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +0 -167
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +0 -7
- package/dist/lib/browser/chunk-S45ULIOG.mjs +0 -101
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs +0 -60
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +0 -53
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs +0 -213
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +0 -7
- package/dist/lib/browser/settings-JY5JE7MI.mjs +0 -35
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +0 -7
- package/dist/lib/browser/state-QE7VSJWJ.mjs +0 -29
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs +0 -13
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +0 -13
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +0 -59
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +0 -20
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +0 -105
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs +0 -56
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +0 -703
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs +0 -145
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs +0 -61
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +0 -168
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +0 -102
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +0 -10
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs +0 -54
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs +0 -214
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +0 -36
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +0 -7
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +0 -30
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +0 -7
- package/dist/types/src/blueprints/functions/create.d.ts +0 -8
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -4
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/open.d.ts +0 -7
- package/dist/types/src/blueprints/functions/open.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -6
- package/dist/types/src/blueprints/functions/update.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +0 -5
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -5
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -10
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -6
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -5
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +0 -28
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +0 -59
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +0 -6
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +0 -1
- package/dist/types/src/types/MarkdownAction.d.ts +0 -66
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/src/blueprints/functions/create.conversations.json +0 -1
- package/src/blueprints/functions/create.test.ts +0 -125
- package/src/blueprints/functions/create.ts +0 -34
- package/src/blueprints/functions/index.ts +0 -7
- package/src/blueprints/functions/open.ts +0 -33
- package/src/blueprints/functions/update.conversations.json +0 -1
- package/src/blueprints/functions/update.test.ts +0 -149
- package/src/blueprints/functions/update.ts +0 -38
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/app-graph-serializer/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -25
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -45
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -100
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/state/state.ts +0 -31
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -62
- package/src/components/MarkdownCard/index.ts +0 -9
- package/src/components/MarkdownContainer.tsx +0 -111
- package/src/components/Suggestions.stories.tsx +0 -215
- package/src/hooks/useSelectCurrentThread.tsx +0 -61
- package/src/types/MarkdownAction.ts +0 -59
- /package/dist/lib/browser/{MarkdownCard-HFNNE4B4.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/MarkdownContainer-V7EAADMF.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.stories.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/create.test.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/update.test.d.ts +0 -0
|
@@ -4,119 +4,135 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
7
8
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
9
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
9
10
|
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/ui-editor';
|
|
10
11
|
|
|
11
|
-
import { meta } from '
|
|
12
|
-
import { type Markdown } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
import { type Markdown } from '#types';
|
|
13
14
|
|
|
14
|
-
export type
|
|
15
|
-
settings: Markdown.Settings;
|
|
16
|
-
onSettingsChange: (fn: (current: Markdown.Settings) => Markdown.Settings) => void;
|
|
17
|
-
};
|
|
15
|
+
export type MarkdownSettingsProps = AppSurface.SettingsArticleProps<Markdown.Settings>;
|
|
18
16
|
|
|
19
|
-
export const MarkdownSettings = ({ settings, onSettingsChange }:
|
|
17
|
+
export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSettingsProps) => {
|
|
20
18
|
const { t } = useTranslation(meta.id);
|
|
21
19
|
|
|
22
20
|
// TODO(wittjosiah): Add skill test confirmation for entering vim mode.
|
|
23
21
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<ControlItemInput title={t('editor input mode label')}>
|
|
51
|
-
<Select.Root
|
|
52
|
-
value={settings.editorInputMode ?? 'default'}
|
|
53
|
-
onValueChange={(value) => {
|
|
54
|
-
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
58
|
-
<Select.Portal>
|
|
59
|
-
<Select.Content>
|
|
60
|
-
<Select.Viewport>
|
|
61
|
-
{EditorInputModes.map((mode) => (
|
|
62
|
-
<Select.Option key={mode} value={mode}>
|
|
63
|
-
{t(`settings editor input mode ${mode} label`)}
|
|
64
|
-
</Select.Option>
|
|
65
|
-
))}
|
|
66
|
-
</Select.Viewport>
|
|
67
|
-
<Select.Arrow />
|
|
68
|
-
</Select.Content>
|
|
69
|
-
</Select.Portal>
|
|
70
|
-
</Select.Root>
|
|
71
|
-
</ControlItemInput>
|
|
22
|
+
<SettingsForm.Viewport>
|
|
23
|
+
<SettingsForm.Section title={t('settings.title', { ns: meta.id })}>
|
|
24
|
+
<SettingsForm.Item title={t('default-view-mode.label')} description={t('default-view-mode.description')}>
|
|
25
|
+
<Select.Root
|
|
26
|
+
disabled={!onSettingsChange}
|
|
27
|
+
value={settings.defaultViewMode}
|
|
28
|
+
onValueChange={(value) => {
|
|
29
|
+
onSettingsChange?.((s) => ({ ...s, defaultViewMode: value as EditorViewMode }));
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Select.TriggerButton disabled={!onSettingsChange} />
|
|
33
|
+
<Select.Portal>
|
|
34
|
+
<Select.Content>
|
|
35
|
+
<Select.Viewport>
|
|
36
|
+
{EditorViewModes.map((mode) => (
|
|
37
|
+
<Select.Option key={mode} value={mode}>
|
|
38
|
+
{t(`view-mode.${mode}.label`, { ns: '@dxos/react-ui-editor' })}
|
|
39
|
+
</Select.Option>
|
|
40
|
+
))}
|
|
41
|
+
</Select.Viewport>
|
|
42
|
+
<Select.Arrow />
|
|
43
|
+
</Select.Content>
|
|
44
|
+
</Select.Portal>
|
|
45
|
+
</Select.Root>
|
|
46
|
+
</SettingsForm.Item>
|
|
72
47
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
<SettingsForm.Item title={t('editor-input-mode.label')} description={t('editor-input-mode.description')}>
|
|
49
|
+
<Select.Root
|
|
50
|
+
disabled={!onSettingsChange}
|
|
51
|
+
value={settings.editorInputMode ?? 'default'}
|
|
52
|
+
onValueChange={(value) => {
|
|
53
|
+
onSettingsChange?.((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Select.TriggerButton
|
|
57
|
+
disabled={!onSettingsChange}
|
|
58
|
+
placeholder={t('select-editor-input-mode.placeholder')}
|
|
77
59
|
/>
|
|
78
|
-
|
|
60
|
+
<Select.Portal>
|
|
61
|
+
<Select.Content>
|
|
62
|
+
<Select.Viewport>
|
|
63
|
+
{EditorInputModes.map((mode) => (
|
|
64
|
+
<Select.Option key={mode} value={mode}>
|
|
65
|
+
{t(`settings.editor-input-mode.${mode}.label`)}
|
|
66
|
+
</Select.Option>
|
|
67
|
+
))}
|
|
68
|
+
</Select.Viewport>
|
|
69
|
+
<Select.Arrow />
|
|
70
|
+
</Select.Content>
|
|
71
|
+
</Select.Portal>
|
|
72
|
+
</Select.Root>
|
|
73
|
+
</SettingsForm.Item>
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
<SettingsForm.Item title={t('settings.toolbar.label')} description={t('settings.toolbar.description')}>
|
|
76
|
+
<Input.Switch
|
|
77
|
+
disabled={!onSettingsChange}
|
|
78
|
+
checked={settings.toolbar}
|
|
79
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, toolbar: !!checked }))}
|
|
80
|
+
/>
|
|
81
|
+
</SettingsForm.Item>
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
<SettingsForm.Item
|
|
84
|
+
title={t('settings.numbered-headings.label')}
|
|
85
|
+
description={t('settings.numbered-headings.description')}
|
|
86
|
+
>
|
|
87
|
+
<Input.Switch
|
|
88
|
+
disabled={!onSettingsChange}
|
|
89
|
+
checked={settings.numberedHeadings}
|
|
90
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, numberedHeadings: !!checked }))}
|
|
91
|
+
/>
|
|
92
|
+
</SettingsForm.Item>
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
<SettingsForm.Item title={t('settings.folding.label')} description={t('settings.folding.description')}>
|
|
95
|
+
<Input.Switch
|
|
96
|
+
disabled={!onSettingsChange}
|
|
97
|
+
checked={settings.folding}
|
|
98
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, folding: !!checked }))}
|
|
99
|
+
/>
|
|
100
|
+
</SettingsForm.Item>
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
<SettingsForm.Item
|
|
103
|
+
title={t('settings.experimental.label')}
|
|
104
|
+
description={t('settings.experimental.description')}
|
|
105
|
+
>
|
|
106
|
+
<Input.Switch
|
|
107
|
+
disabled={!onSettingsChange}
|
|
108
|
+
checked={settings.experimental}
|
|
109
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, experimental: !!checked }))}
|
|
110
|
+
/>
|
|
111
|
+
</SettingsForm.Item>
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
<SettingsForm.Item title={t('settings.debug.label')} description={t('settings.debug.description')}>
|
|
114
|
+
<Input.Switch
|
|
115
|
+
disabled={!onSettingsChange}
|
|
116
|
+
checked={settings.debug}
|
|
117
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, debug: !!checked }))}
|
|
118
|
+
/>
|
|
119
|
+
</SettingsForm.Item>
|
|
120
|
+
|
|
121
|
+
{settings.debug && (
|
|
122
|
+
<SettingsForm.Item
|
|
123
|
+
title={t('settings.debug-typewriter.label', { ns: meta.id })}
|
|
124
|
+
description={t('settings.debug-typewriter.description')}
|
|
125
|
+
>
|
|
126
|
+
<Input.TextArea
|
|
127
|
+
disabled={!onSettingsChange}
|
|
128
|
+
rows={5}
|
|
129
|
+
value={settings.typewriter}
|
|
130
|
+
onChange={({ target: { value } }) => onSettingsChange?.((s) => ({ ...s, typewriter: value }))}
|
|
131
|
+
placeholder={t('settings.debug-typewriter.placeholder')}
|
|
132
|
+
/>
|
|
133
|
+
</SettingsForm.Item>
|
|
134
|
+
)}
|
|
135
|
+
</SettingsForm.Section>
|
|
136
|
+
</SettingsForm.Viewport>
|
|
121
137
|
);
|
|
122
138
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { type MarkdownContainer as MarkdownContainerType } from './MarkdownContainer';
|
|
7
|
+
export * from './MarkdownEditor';
|
|
9
8
|
|
|
10
|
-
export
|
|
11
|
-
export * from './MarkdownContainer';
|
|
12
|
-
export * from './MarkdownSettings';
|
|
13
|
-
|
|
14
|
-
export const MarkdownCard: LazyExoticComponent<typeof MarkdownCardType> = lazy(() => import('./MarkdownCard'));
|
|
15
|
-
export const MarkdownContainer: LazyExoticComponent<typeof MarkdownContainerType> = lazy(
|
|
16
|
-
() => import('./MarkdownContainer'),
|
|
17
|
-
);
|
|
9
|
+
export const MarkdownSettings: ComponentType<any> = lazy(() => import('./MarkdownSettings'));
|
|
@@ -5,43 +5,52 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { OperationPlugin } from '@dxos/app-framework';
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
12
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
+
import { random } from '@dxos/random';
|
|
14
|
+
import { Card } from '@dxos/react-ui';
|
|
13
15
|
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
16
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
17
|
|
|
15
18
|
import { translations } from '../../translations';
|
|
16
|
-
|
|
17
19
|
import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
random.seed(1234);
|
|
20
22
|
|
|
21
|
-
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
22
23
|
const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
23
24
|
const subject = useMemo(
|
|
24
25
|
() =>
|
|
25
26
|
Markdown.make({
|
|
26
|
-
name:
|
|
27
|
-
content:
|
|
27
|
+
name: random.lorem.words(3),
|
|
28
|
+
content: random.lorem.paragraphs(5),
|
|
28
29
|
}),
|
|
29
30
|
[],
|
|
30
31
|
);
|
|
32
|
+
|
|
31
33
|
return (
|
|
32
34
|
<CardContainer icon='ph--text-aa--regular'>
|
|
33
|
-
<
|
|
35
|
+
<Card.Root border={false}>
|
|
36
|
+
<Card.Toolbar>
|
|
37
|
+
<Card.DragHandle />
|
|
38
|
+
<Card.Title>{Obj.getLabel(subject)}</Card.Title>
|
|
39
|
+
<Card.Menu />
|
|
40
|
+
</Card.Toolbar>
|
|
41
|
+
<MarkdownCard subject={subject} {...args} />
|
|
42
|
+
</Card.Root>
|
|
34
43
|
</CardContainer>
|
|
35
44
|
);
|
|
36
45
|
};
|
|
37
46
|
|
|
38
47
|
const meta: Meta<typeof MarkdownCardStory> = {
|
|
39
|
-
title: 'plugins/plugin-markdown/
|
|
48
|
+
title: 'plugins/plugin-markdown/containers/MarkdownCard',
|
|
40
49
|
component: MarkdownCardStory,
|
|
41
50
|
decorators: [
|
|
42
|
-
withTheme,
|
|
51
|
+
withTheme(),
|
|
43
52
|
withPluginManager({
|
|
44
|
-
plugins: [OperationPlugin()],
|
|
53
|
+
plugins: [OperationPlugin(), RuntimePlugin(), ClientPlugin({})],
|
|
45
54
|
}),
|
|
46
55
|
],
|
|
47
56
|
parameters: {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { Card, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
import { MarkdownEditor, MarkdownEditorProvider } from '#components';
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { Markdown } from '#types';
|
|
15
|
+
|
|
16
|
+
import { getContentSnippet } from '../../util';
|
|
17
|
+
import { snippet as snippetExtension } from './snippet';
|
|
18
|
+
|
|
19
|
+
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
20
|
+
|
|
21
|
+
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
24
|
+
const extensions = useMemo(() => [snippetExtension({ height: 240, scale: 0.8 })], []);
|
|
25
|
+
const info = getInfo(subject);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Card.Content>
|
|
29
|
+
{snippet && (
|
|
30
|
+
<Card.Section className='px-1'>
|
|
31
|
+
<MarkdownEditorProvider id={subject.id} viewMode='readonly' extensions={extensions}>
|
|
32
|
+
{(editorRootProps) => (
|
|
33
|
+
<Editor.Root {...editorRootProps}>
|
|
34
|
+
<MarkdownEditor.Content initialValue={snippet} slots={{ content: { className: 'm-0' } }} />
|
|
35
|
+
</Editor.Root>
|
|
36
|
+
)}
|
|
37
|
+
</MarkdownEditorProvider>
|
|
38
|
+
</Card.Section>
|
|
39
|
+
)}
|
|
40
|
+
<Card.Section>
|
|
41
|
+
<Card.Text classNames='px-1.5 text-xs text-description'>
|
|
42
|
+
{info.words} {t('words.label', { count: info.words })}
|
|
43
|
+
</Card.Text>
|
|
44
|
+
</Card.Section>
|
|
45
|
+
</Card.Content>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const MAX_LINES = 5;
|
|
50
|
+
|
|
51
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
52
|
+
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
53
|
+
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, MAX_LINES);
|
|
54
|
+
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
55
|
+
return getContentSnippet(subject.content ?? fallback, MAX_LINES);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
60
|
+
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
61
|
+
return { words: text.split(' ').length };
|
|
62
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type PluginValue, EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
|
6
|
+
|
|
7
|
+
export type SnippetOptions = {
|
|
8
|
+
/** Maximum height of the editor in pixels. Content is clipped to whole lines within this height. */
|
|
9
|
+
height: number;
|
|
10
|
+
/** Zoom factor applied to the editor (e.g. 0.5 renders at 50%). @default 1 */
|
|
11
|
+
scale?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* CodeMirror extension for rendering a non-scrollable snippet of editor content.
|
|
16
|
+
* Constrains the editor to the given height, clips to whole line boundaries,
|
|
17
|
+
* and disables scrolling entirely.
|
|
18
|
+
* Uses requestMeasure to read post-layout heights and lineBlockAtHeight to handle
|
|
19
|
+
* varying line heights from headings and other decorated blocks.
|
|
20
|
+
*/
|
|
21
|
+
export const snippet = ({ height, scale = 1 }: SnippetOptions) => {
|
|
22
|
+
// Internal height is divided by scale so the visible area matches the requested height.
|
|
23
|
+
const internalHeight = Math.round(height / scale);
|
|
24
|
+
|
|
25
|
+
const clipPlugin = ViewPlugin.fromClass(
|
|
26
|
+
class SnippetPlugin implements PluginValue {
|
|
27
|
+
private clipHeight = 0;
|
|
28
|
+
|
|
29
|
+
update(update: ViewUpdate) {
|
|
30
|
+
update.view.requestMeasure({
|
|
31
|
+
// key deduplicates concurrent requests within the same animation frame.
|
|
32
|
+
key: this,
|
|
33
|
+
read: (view) => {
|
|
34
|
+
const containerHeight = view.dom.clientHeight;
|
|
35
|
+
if (containerHeight === 0) {
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
// With CSS zoom, clientHeight can be in visual pixels while line positions use
|
|
39
|
+
// layout pixels (same space as internalHeight / theme maxHeight).
|
|
40
|
+
const clipLimit = scale === 1 ? containerHeight : Math.min(internalHeight, containerHeight / scale);
|
|
41
|
+
// Find the block (line) at the very bottom of the visible area.
|
|
42
|
+
const block = view.lineBlockAtHeight(clipLimit - 1);
|
|
43
|
+
// If the block overflows the container, clip at the block's top edge.
|
|
44
|
+
return block.top + block.height > clipLimit ? block.top : clipLimit;
|
|
45
|
+
},
|
|
46
|
+
write: (clipHeight, view) => {
|
|
47
|
+
if (clipHeight > 0 && clipHeight !== this.clipHeight) {
|
|
48
|
+
this.clipHeight = clipHeight;
|
|
49
|
+
view.dom.style.maxHeight = `${clipHeight}px`;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return [
|
|
58
|
+
clipPlugin,
|
|
59
|
+
EditorView.theme({
|
|
60
|
+
'&': {
|
|
61
|
+
maxHeight: `${internalHeight}px`,
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
...(scale !== 1 && { zoom: `${scale}` }),
|
|
64
|
+
},
|
|
65
|
+
'.cm-content': {
|
|
66
|
+
whiteSpace: 'pre',
|
|
67
|
+
margin: '0',
|
|
68
|
+
padding: '0',
|
|
69
|
+
},
|
|
70
|
+
'.cm-line': {
|
|
71
|
+
padding: '0',
|
|
72
|
+
},
|
|
73
|
+
'.cm-scroller': {
|
|
74
|
+
overflow: 'hidden !important',
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
];
|
|
78
|
+
};
|
|
@@ -6,33 +6,46 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Surface, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
11
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
12
|
+
import { AppActivationEvents, LayoutOperation } from '@dxos/app-toolkit';
|
|
12
13
|
import { Obj, Query } from '@dxos/echo';
|
|
13
14
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
14
16
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
15
17
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
-
import {
|
|
17
|
-
import { useQuery,
|
|
18
|
+
import { random } from '@dxos/random';
|
|
19
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
18
20
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
21
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
22
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
21
23
|
import { Text } from '@dxos/schema';
|
|
22
24
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
23
25
|
import { Organization, Person } from '@dxos/types';
|
|
24
26
|
|
|
25
|
-
import {
|
|
26
|
-
import { translations } from '../translations';
|
|
27
|
-
import { Markdown } from '../types';
|
|
27
|
+
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '#types';
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
import { MarkdownPlugin } from '../../MarkdownPlugin';
|
|
30
|
+
import { translations } from '../../translations';
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
random.seed(1);
|
|
33
|
+
|
|
34
|
+
const generator: ValueGenerator = random as any;
|
|
35
|
+
|
|
36
|
+
/** Minimal plugin that contributes an empty Extensions capability for stories. */
|
|
37
|
+
const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions', name: 'Story Extensions' }).pipe(
|
|
38
|
+
Plugin.addModule({
|
|
39
|
+
id: 'extensions',
|
|
40
|
+
activatesOn: MarkdownEvents.SetupExtensions,
|
|
41
|
+
activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.Extensions, [])),
|
|
42
|
+
}),
|
|
43
|
+
Plugin.make,
|
|
44
|
+
);
|
|
32
45
|
|
|
33
46
|
const DefaultStory = () => {
|
|
34
47
|
const { invokePromise } = useOperationInvoker();
|
|
35
|
-
const space =
|
|
48
|
+
const [space] = useSpaces();
|
|
36
49
|
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
37
50
|
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
38
51
|
const id = doc && Obj.getDXN(doc).toString();
|
|
@@ -40,45 +53,43 @@ const DefaultStory = () => {
|
|
|
40
53
|
|
|
41
54
|
useAsyncEffect(async () => {
|
|
42
55
|
if (space) {
|
|
43
|
-
await invokePromise(
|
|
56
|
+
await invokePromise(LayoutOperation.SwitchWorkspace, { subject: space.id });
|
|
44
57
|
}
|
|
45
58
|
}, [space, invokePromise]);
|
|
46
59
|
|
|
47
60
|
return (
|
|
48
61
|
<div className='contents' {...attentionAttrs}>
|
|
49
|
-
<Surface role='article' data={data} limit={1} />
|
|
62
|
+
<Surface.Surface role='article' data={data} limit={1} />
|
|
50
63
|
</div>
|
|
51
64
|
);
|
|
52
65
|
};
|
|
53
66
|
|
|
54
67
|
const meta = {
|
|
55
|
-
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
68
|
+
title: 'plugins/plugin-markdown/containers/MarkdownContainer',
|
|
56
69
|
render: DefaultStory,
|
|
57
70
|
decorators: [
|
|
58
|
-
withTheme,
|
|
59
71
|
withLayout({ layout: 'column' }),
|
|
60
72
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
73
|
+
setupEvents: [AppActivationEvents.SetupSettings, MarkdownEvents.SetupExtensions],
|
|
61
74
|
plugins: [
|
|
62
75
|
...corePlugins(),
|
|
63
76
|
StorybookPlugin({}),
|
|
77
|
+
MarkdownExtensionsPlugin(),
|
|
64
78
|
ClientPlugin({
|
|
65
79
|
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
66
80
|
onClientInitialized: ({ client }) =>
|
|
67
81
|
Effect.gen(function* () {
|
|
68
|
-
yield*
|
|
69
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
70
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
82
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
71
83
|
|
|
72
|
-
const
|
|
73
|
-
const createObjects = createObjectFactory(space.db, generator);
|
|
84
|
+
const createObjects = createObjectFactory(personalSpace.db, generator);
|
|
74
85
|
yield* Effect.promise(() => createObjects([{ type: Organization.Organization, count: 10 }]));
|
|
75
86
|
|
|
76
|
-
const queue =
|
|
87
|
+
const queue = personalSpace.queues.create();
|
|
77
88
|
const kai = Obj.make(Person.Person, { fullName: 'Kai' });
|
|
78
89
|
const dxos = Obj.make(Organization.Organization, { name: 'DXOS' });
|
|
79
90
|
yield* Effect.promise(() => queue.append([kai, dxos]));
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
personalSpace.db.add(
|
|
82
93
|
Markdown.make({
|
|
83
94
|
name: context.args.title ?? 'Testing',
|
|
84
95
|
content: [
|
|
@@ -95,7 +106,7 @@ const meta = {
|
|
|
95
106
|
}),
|
|
96
107
|
);
|
|
97
108
|
|
|
98
|
-
yield* Effect.promise(() =>
|
|
109
|
+
yield* Effect.promise(() => personalSpace.db.flush({ indexes: true }));
|
|
99
110
|
}),
|
|
100
111
|
}),
|
|
101
112
|
|