@dxos/plugin-markdown 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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-HFNNE4B4.mjs +12 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +12 -0
- package/dist/lib/browser/{anchor-sort-3MYLO74J.mjs → anchor-sort-WQ3TL7ZI.mjs} +7 -7
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +58 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs +702 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +7 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +8 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BE3IO2CM.mjs → chunk-FWQQW6KU.mjs} +41 -47
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NXT2E2BG.mjs → chunk-JOXYQLKH.mjs} +3 -5
- package/dist/lib/browser/{chunk-NXT2E2BG.mjs.map → chunk-JOXYQLKH.mjs.map} +1 -1
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +104 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +7 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +167 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +7 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs +101 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +7 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs +60 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +32 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +121 -129
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +53 -0
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs +213 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +7 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs +35 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +7 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs +29 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/{MarkdownCard-FTEHVH7P.mjs → MarkdownCard-GMNXUWWR.mjs} +5 -5
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/{anchor-sort-W4HCTYUQ.mjs → anchor-sort-G7D5TAI6.mjs} +7 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +59 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +105 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-I5JSQBPI.mjs → chunk-44VJC3QF.mjs} +3 -5
- package/dist/lib/node-esm/{chunk-I5JSQBPI.mjs.map → chunk-44VJC3QF.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +703 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3DN4DPVA.mjs → chunk-EYAFC4N7.mjs} +41 -47
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs +61 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +168 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7GN66TDQ.mjs → chunk-SDTYEGGL.mjs} +56 -6
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +10 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +33 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +121 -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-2HIS2AQZ.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs +214 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +7 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +36 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +7 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +30 -0
- package/dist/lib/node-esm/state-LXE5XIN4.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.map +1 -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 +5 -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 +10 -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 +6 -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 -3
- 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 +19 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.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 +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 +12 -8
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +4 -4
- 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/components/index.d.ts +5 -2
- package/dist/types/src/components/index.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 +1 -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 +2 -2
- package/dist/types/src/testing.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 +3 -0
- 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 +81 -66
- package/src/MarkdownPlugin.tsx +61 -74
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/create.test.ts +20 -23
- package/src/{functions → blueprints/functions}/create.ts +1 -1
- package/src/blueprints/functions/index.ts +7 -0
- package/src/{functions → blueprints/functions}/open.ts +4 -3
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/update.test.ts +23 -25
- package/src/{functions → blueprints/functions}/update.ts +4 -3
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +36 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +59 -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 +25 -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 +100 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +36 -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 +29 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +25 -43
- package/src/components/MarkdownCard/MarkdownCard.tsx +17 -44
- package/src/components/MarkdownContainer.stories.tsx +47 -60
- package/src/components/MarkdownContainer.tsx +86 -88
- package/src/components/MarkdownEditor/FileUpload.tsx +3 -3
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +16 -17
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +14 -15
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +44 -18
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +7 -4
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +21 -32
- package/src/components/index.ts +8 -3
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +23 -28
- package/src/hooks/useLinkQuery.ts +13 -13
- package/src/hooks/useSelectCurrentThread.tsx +37 -42
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +3 -3
- 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 +13 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +75 -5
- package/dist/lib/browser/MarkdownCard-TC3GGUSX.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-YF22DV4M.mjs +0 -15
- 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-HED54GGW.mjs +0 -13
- package/dist/lib/browser/chunk-3IPVL3E4.mjs +0 -20
- package/dist/lib/browser/chunk-3IPVL3E4.mjs.map +0 -7
- package/dist/lib/browser/chunk-BE3IO2CM.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-DLZ5RR3P.mjs +0 -96
- package/dist/lib/browser/chunk-DLZ5RR3P.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-OKNQ57GF.mjs +0 -51
- package/dist/lib/browser/chunk-OKNQ57GF.mjs.map +0 -7
- package/dist/lib/browser/chunk-V7P7EIWG.mjs +0 -829
- package/dist/lib/browser/chunk-V7P7EIWG.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-GPD6T435.mjs +0 -211
- package/dist/lib/browser/react-surface-GPD6T435.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/MarkdownContainer-L75AIJFM.mjs +0 -16
- 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-HAQGJOMQ.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-HAQGJOMQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3DN4DPVA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7GN66TDQ.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-SHAMSMKQ.mjs +0 -29
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TYUGABTD.mjs +0 -22
- package/dist/lib/node-esm/chunk-TYUGABTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UVLACSAE.mjs +0 -830
- package/dist/lib/node-esm/chunk-UVLACSAE.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/chunk-ZNS55FS3.mjs +0 -97
- package/dist/lib/node-esm/chunk-ZNS55FS3.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-QWG7CJ5U.mjs +0 -212
- package/dist/lib/node-esm/react-surface-QWG7CJ5U.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.map +0 -1
- 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 -93
- 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/index.ts +0 -13
- package/src/functions/update.conversations.json +0 -1
- package/src/toolkit.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-TC3GGUSX.mjs.map → MarkdownCard-HFNNE4B4.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-YF22DV4M.mjs.map → MarkdownContainer-V7EAADMF.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-HED54GGW.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/MarkdownCard-GMNXUWWR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-FTEHVH7P.mjs.map → MarkdownContainer-LUSMORP2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-L75AIJFM.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}/open.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.test.d.ts +0 -0
|
@@ -6,16 +6,17 @@ import { type ViewUpdate } from '@codemirror/view';
|
|
|
6
6
|
import React, { type AnchorHTMLAttributes, type ReactNode, useMemo } from 'react';
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
11
11
|
import { debounceAndThrottle } from '@dxos/async';
|
|
12
12
|
import { Obj } from '@dxos/echo';
|
|
13
13
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
14
14
|
import { invariant } from '@dxos/invariant';
|
|
15
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
16
16
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
17
17
|
import { Icon, ThemeProvider } from '@dxos/react-ui';
|
|
18
18
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
19
20
|
import {
|
|
20
21
|
Cursor,
|
|
21
22
|
type EditorStateStore,
|
|
@@ -36,9 +37,8 @@ import {
|
|
|
36
37
|
replacer,
|
|
37
38
|
selectionState,
|
|
38
39
|
typewriter,
|
|
39
|
-
} from '@dxos/
|
|
40
|
-
import { defaultTx } from '@dxos/
|
|
41
|
-
import { Text } from '@dxos/schema';
|
|
40
|
+
} from '@dxos/ui-editor';
|
|
41
|
+
import { defaultTx } from '@dxos/ui-theme';
|
|
42
42
|
import { isTruthy } from '@dxos/util';
|
|
43
43
|
|
|
44
44
|
import { Markdown } from '../types';
|
|
@@ -49,7 +49,7 @@ export type DocumentType = Markdown.Document | Text.Text | { id: string; text: s
|
|
|
49
49
|
export type ExtensionsOptions = {
|
|
50
50
|
id: string;
|
|
51
51
|
object?: DocumentType;
|
|
52
|
-
|
|
52
|
+
invokePromise?: Common.Capability.OperationInvoker['invokePromise'];
|
|
53
53
|
settings?: Markdown.Settings;
|
|
54
54
|
selectionManager?: SelectionManager;
|
|
55
55
|
viewMode?: EditorViewMode;
|
|
@@ -67,16 +67,16 @@ export const useExtensions = ({
|
|
|
67
67
|
editorStateStore,
|
|
68
68
|
previewOptions,
|
|
69
69
|
}: ExtensionsOptions): Extension[] => {
|
|
70
|
-
const {
|
|
70
|
+
const { invokePromise } = useOperationInvoker();
|
|
71
71
|
const identity = useIdentity();
|
|
72
72
|
const space = getSpace(object);
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
// Get the content reference from Document objects.
|
|
75
|
+
const contentRef = Obj.instanceOf(Markdown.Document, object) ? (object as Markdown.Document).content : undefined;
|
|
76
|
+
// Use useObject to trigger re-render when the reference loads (returns snapshot for reactivity).
|
|
77
|
+
useObject(contentRef);
|
|
78
|
+
// Get the actual live object target via .target (needed for createDocAccessor).
|
|
79
|
+
const target = contentRef?.target ?? (Obj.instanceOf(Text.Text, object) ? object : undefined);
|
|
80
80
|
|
|
81
81
|
// TODO(wittjosiah): Autocomplete is not working and this query is causing performance issues.
|
|
82
82
|
// TODO(burdon): Unsubscribe.
|
|
@@ -92,13 +92,13 @@ export const useExtensions = ({
|
|
|
92
92
|
selectionManager,
|
|
93
93
|
viewMode,
|
|
94
94
|
previewOptions,
|
|
95
|
-
|
|
95
|
+
invokePromise,
|
|
96
96
|
}),
|
|
97
97
|
[
|
|
98
98
|
id,
|
|
99
99
|
object,
|
|
100
100
|
viewMode,
|
|
101
|
-
|
|
101
|
+
invokePromise,
|
|
102
102
|
previewOptions,
|
|
103
103
|
settings,
|
|
104
104
|
settings?.debug,
|
|
@@ -144,7 +144,7 @@ export const useExtensions = ({
|
|
|
144
144
|
const createBaseExtensions = ({
|
|
145
145
|
id,
|
|
146
146
|
object,
|
|
147
|
-
|
|
147
|
+
invokePromise,
|
|
148
148
|
settings,
|
|
149
149
|
selectionManager,
|
|
150
150
|
viewMode,
|
|
@@ -169,17 +169,12 @@ const createBaseExtensions = ({
|
|
|
169
169
|
// TODO(wittjosiah): For internal links, consider ignoring the link text and rendering the label of the object being linked to.
|
|
170
170
|
// TODO(burdon): Create dx-tag.
|
|
171
171
|
renderLinkButton:
|
|
172
|
-
|
|
173
|
-
? createLinkRenderer((
|
|
174
|
-
void
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
options: {
|
|
179
|
-
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
180
|
-
},
|
|
181
|
-
}),
|
|
182
|
-
);
|
|
172
|
+
invokePromise && (object || id)
|
|
173
|
+
? createLinkRenderer((targetId: string) => {
|
|
174
|
+
void invokePromise(Common.LayoutOperation.Open, {
|
|
175
|
+
subject: [targetId],
|
|
176
|
+
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
177
|
+
});
|
|
183
178
|
})
|
|
184
179
|
: undefined,
|
|
185
180
|
}),
|
|
@@ -5,41 +5,41 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Common } from '@dxos/app-framework';
|
|
9
9
|
import { usePluginManager } from '@dxos/app-framework/react';
|
|
10
|
-
import { Filter, Obj, Query, Type } from '@dxos/echo';
|
|
10
|
+
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
11
|
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
13
12
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
14
|
-
import { type EditorMenuGroup, type EditorMenuItem
|
|
13
|
+
import { type EditorMenuGroup, type EditorMenuItem } from '@dxos/react-ui-editor';
|
|
14
|
+
import { insertAtCursor, insertAtLineStart } from '@dxos/ui-editor';
|
|
15
15
|
|
|
16
|
-
export const useLinkQuery = (
|
|
16
|
+
export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
18
|
|
|
19
19
|
const manager = usePluginManager();
|
|
20
20
|
const resolve = useCallback(
|
|
21
21
|
(typename: string) =>
|
|
22
|
-
manager.
|
|
22
|
+
manager.capabilities.getAll(Common.Capability.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
23
23
|
[manager],
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
const filter = useMemo(
|
|
27
27
|
() =>
|
|
28
28
|
Filter.or(
|
|
29
|
-
...(
|
|
29
|
+
...(db?.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync() ?? [])
|
|
30
30
|
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
31
31
|
.filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))
|
|
32
32
|
.map((schema) => Filter.typename(Type.getTypename(schema))),
|
|
33
33
|
),
|
|
34
|
-
[
|
|
34
|
+
[db],
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const handleLinkQuery = useCallback(
|
|
38
38
|
async (query?: string): Promise<EditorMenuGroup[]> => {
|
|
39
39
|
const name = query?.startsWith('@') ? query.slice(1).toLowerCase() : (query?.toLowerCase() ?? '');
|
|
40
|
-
const results = await
|
|
40
|
+
const results = await db?.query(Query.select(filter)).run();
|
|
41
41
|
|
|
42
|
-
// TODO(wittjosiah): Use `Obj.
|
|
42
|
+
// TODO(wittjosiah): Use `Obj.Unknown` type.
|
|
43
43
|
const getLabel = (object: any) => {
|
|
44
44
|
const label = Obj.getLabel(object);
|
|
45
45
|
if (label) {
|
|
@@ -53,8 +53,8 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const items =
|
|
56
|
-
results
|
|
57
|
-
|
|
56
|
+
results
|
|
57
|
+
?.filter((object) => toLocalizedString(getLabel(object), t).toLowerCase().includes(name))
|
|
58
58
|
// TODO(wittjosiah): Remove `any` type.
|
|
59
59
|
.map((object: any): EditorMenuItem => {
|
|
60
60
|
const metadata = resolve(Obj.getTypename(object)!);
|
|
@@ -76,7 +76,7 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
76
76
|
|
|
77
77
|
return [{ id: 'echo', items }];
|
|
78
78
|
},
|
|
79
|
-
[
|
|
79
|
+
[db, filter, resolve],
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
return handleLinkQuery;
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { EditorView } from '@codemirror/view';
|
|
6
|
-
import * as
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationResolver } from '@dxos/app-framework/react';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
12
|
+
import { OperationResolver } from '@dxos/operation';
|
|
13
|
+
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
13
14
|
|
|
14
15
|
import { meta } from '../meta';
|
|
15
16
|
|
|
@@ -17,50 +18,44 @@ import { meta } from '../meta';
|
|
|
17
18
|
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
18
19
|
*/
|
|
19
20
|
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
20
|
-
const
|
|
21
|
+
const scrollIntoViewHandler = useMemo(
|
|
21
22
|
() =>
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
OperationResolver.make({
|
|
24
|
+
operation: Common.LayoutOperation.ScrollIntoView,
|
|
24
25
|
position: 'hoist',
|
|
25
|
-
filter: (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return !!editorView && data.subject === documentId && !!data.options?.cursor;
|
|
37
|
-
},
|
|
38
|
-
resolve: ({ options: { cursor } }) => {
|
|
39
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
40
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor!);
|
|
41
|
-
if (range) {
|
|
42
|
-
const selection = editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
43
|
-
const effects = [
|
|
44
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
45
|
-
EditorView.scrollIntoView(range.from, {
|
|
46
|
-
y: 'start',
|
|
47
|
-
yMargin: 96,
|
|
48
|
-
}),
|
|
49
|
-
];
|
|
50
|
-
if (selection) {
|
|
51
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
52
|
-
effects.push(setSelection.of({ current: documentId }));
|
|
26
|
+
filter: (input) => !!editorView && input.subject === documentId && !!input.cursor,
|
|
27
|
+
handler: (input) =>
|
|
28
|
+
Effect.sync(() => {
|
|
29
|
+
invariant(editorView, 'Editor view is not defined.');
|
|
30
|
+
const cursor = input.cursor;
|
|
31
|
+
if (!cursor) {
|
|
32
|
+
return;
|
|
53
33
|
}
|
|
34
|
+
const range = Cursor.getRangeFromCursor(editorView.state, cursor);
|
|
35
|
+
if (range) {
|
|
36
|
+
const selection =
|
|
37
|
+
editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
38
|
+
const effects = [
|
|
39
|
+
// NOTE: This does not use the DOM scrollIntoView function.
|
|
40
|
+
EditorView.scrollIntoView(range.from, {
|
|
41
|
+
y: 'start',
|
|
42
|
+
yMargin: 96,
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
if (selection) {
|
|
46
|
+
// Update the editor selection to get bi-directional highlighting.
|
|
47
|
+
effects.push(setSelection.of({ current: documentId }));
|
|
48
|
+
}
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
editorView.dispatch({
|
|
51
|
+
effects,
|
|
52
|
+
selection: selection ? { anchor: range.from } : undefined,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
61
56
|
}),
|
|
62
57
|
[documentId, editorView],
|
|
63
58
|
);
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
66
61
|
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/markdown',
|
|
10
10
|
name: 'Markdown',
|
|
11
11
|
description: trim`
|
package/src/testing.ts
CHANGED
|
@@ -7,15 +7,15 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
|
|
8
8
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
9
|
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
11
|
import { Collection } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
// TODO(wittjosiah): Factor out.
|
|
14
|
-
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R |
|
|
14
|
+
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield*
|
|
18
|
+
yield* Database.Service.add(
|
|
19
19
|
Obj.make(SpaceProperties, {
|
|
20
20
|
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
21
|
}) as any,
|
package/src/types/Markdown.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
-
import { EditorInputMode, EditorViewMode } from '@dxos/react-ui-editor/types';
|
|
10
9
|
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Document Item type.
|
|
@@ -18,7 +18,7 @@ export const Document = Schema.Struct({
|
|
|
18
18
|
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
19
|
content: Type.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
20
|
}).pipe(
|
|
21
|
-
Type.
|
|
21
|
+
Type.object({
|
|
22
22
|
typename: 'dxos.org/type/Document',
|
|
23
23
|
version: '0.1.0',
|
|
24
24
|
}),
|
|
@@ -4,26 +4,56 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
10
|
+
import { Collection } from '@dxos/schema';
|
|
11
|
+
import { EditorViewMode } from '@dxos/ui-editor/types';
|
|
8
12
|
|
|
9
13
|
import { meta } from '../meta';
|
|
10
14
|
|
|
11
15
|
import { Document } from './Markdown';
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const MARKDOWN_OPERATION = `${meta.id}/operation`;
|
|
18
|
+
|
|
19
|
+
export namespace MarkdownOperation {
|
|
20
|
+
export const OnCreateSpace = Operation.make({
|
|
21
|
+
meta: { key: `${MARKDOWN_OPERATION}/on-create-space`, name: 'On Create Space' },
|
|
22
|
+
services: [Capability.Service],
|
|
23
|
+
schema: {
|
|
24
|
+
input: Schema.Struct({
|
|
25
|
+
space: SpaceSchema,
|
|
26
|
+
rootCollection: Collection.Collection,
|
|
27
|
+
isDefault: Schema.optional(Schema.Boolean),
|
|
28
|
+
}),
|
|
29
|
+
output: Schema.Void,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Create = Operation.make({
|
|
34
|
+
meta: { key: `${MARKDOWN_OPERATION}/create`, name: 'Create Markdown Document' },
|
|
35
|
+
services: [Capability.Service],
|
|
36
|
+
schema: {
|
|
37
|
+
input: Schema.Struct({
|
|
38
|
+
name: Schema.optional(Schema.String),
|
|
39
|
+
content: Schema.optional(Schema.String),
|
|
40
|
+
}),
|
|
41
|
+
output: Schema.Struct({
|
|
42
|
+
object: Document,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
48
|
+
export const SetViewMode = Operation.make({
|
|
49
|
+
meta: { key: `${MARKDOWN_OPERATION}/set-view-mode`, name: 'Set View Mode' },
|
|
50
|
+
services: [Capability.Service],
|
|
51
|
+
schema: {
|
|
52
|
+
input: Schema.Struct({
|
|
53
|
+
id: Schema.String,
|
|
54
|
+
viewMode: EditorViewMode,
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Void,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type EditorStateStore, type EditorViewMode } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
|
|
13
|
+
import type * as Markdown from './Markdown';
|
|
14
|
+
import { type MarkdownExtensionProvider } from './types';
|
|
15
|
+
|
|
16
|
+
/** Schema for persisted markdown state. */
|
|
17
|
+
export const MarkdownStateSchema = Schema.mutable(
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export type MarkdownState = {
|
|
24
|
+
viewMode: Record<string, EditorViewMode>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export namespace MarkdownCapabilities {
|
|
28
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}/capability/settings`);
|
|
29
|
+
|
|
30
|
+
/** Persisted state atom for view mode per document. */
|
|
31
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}/capability/state`);
|
|
32
|
+
|
|
33
|
+
/** Editor state store for cursor positions, scroll state, etc. */
|
|
34
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}/capability/editor-state`);
|
|
35
|
+
|
|
36
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
37
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}/capability/extensions`);
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent, Common } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
export namespace MarkdownEvents {
|
|
10
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = Common.ActivationEvent.createStateEvent(
|
|
11
|
+
`${meta.id}/event/setup-extensions`,
|
|
12
|
+
);
|
|
13
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Extension } from '@
|
|
6
|
-
|
|
5
|
+
import { type Extension } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
7
8
|
|
|
8
9
|
import { type Document } from './Markdown';
|
|
9
10
|
|
package/src/util.test.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { getFallbackName } from './util';
|
|
10
|
+
|
|
11
|
+
describe('markdown utils', () => {
|
|
12
|
+
it('getFallbackName', () => {
|
|
13
|
+
const tests = [
|
|
14
|
+
{
|
|
15
|
+
content: '',
|
|
16
|
+
expected: '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
content: trim`
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
# Welcome to Composer by DXOS
|
|
23
|
+
|
|
24
|
+
## What is Composer?
|
|
25
|
+
`,
|
|
26
|
+
expected: 'Welcome to Composer by DXOS',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
content: trim`
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
This document is about the decetralized platform DXOS.
|
|
35
|
+
`,
|
|
36
|
+
expected: 'This document is about the…',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
tests.forEach(({ content, expected }) => {
|
|
41
|
+
expect(getFallbackName(content)).toBe(expected);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/util.tsx
CHANGED
|
@@ -32,23 +32,93 @@ export const isMarkdownProperties = (data: unknown): data is MarkdownProperties
|
|
|
32
32
|
|
|
33
33
|
const nonTitleChars = /[^\w ]/g;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
// Lines matching these patterns are skipped.
|
|
36
|
+
const skipPatterns = [
|
|
37
|
+
/^!\[/, // Image.
|
|
38
|
+
/^---\s*$/, // Horizontal rule.
|
|
39
|
+
/^```/, // Code block fence.
|
|
40
|
+
/^\s*$/, // Empty or whitespace-only.
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// Patterns to extract title text (first capture group is used).
|
|
44
|
+
const titlePatterns = [
|
|
45
|
+
/^#{1,6}\s+(.+)/, // Heading.
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extracts a fallback name by scanning lines for the first heading or text fragment.
|
|
50
|
+
*/
|
|
51
|
+
export const getFallbackName = (content = ''): string => {
|
|
52
|
+
const len = content.length;
|
|
53
|
+
|
|
54
|
+
let i = 0;
|
|
55
|
+
while (i < len) {
|
|
56
|
+
// Find end of line.
|
|
57
|
+
let lineEnd = i;
|
|
58
|
+
while (lineEnd < len && content[lineEnd] !== '\n') {
|
|
59
|
+
lineEnd++;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const line = content.slice(i, lineEnd).trim();
|
|
63
|
+
i = lineEnd + 1;
|
|
64
|
+
|
|
65
|
+
// Skip lines matching skip patterns.
|
|
66
|
+
if (skipPatterns.some((pattern) => pattern.test(line))) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Check for title patterns.
|
|
71
|
+
for (const pattern of titlePatterns) {
|
|
72
|
+
const match = pattern.exec(line);
|
|
73
|
+
if (match) {
|
|
74
|
+
const text = match[1].replaceAll(nonTitleChars, '').trim();
|
|
75
|
+
if (text.length > 0) {
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use line as plain text fallback.
|
|
82
|
+
const maxLen = 32;
|
|
83
|
+
const text = line.replaceAll(nonTitleChars, '').trim();
|
|
84
|
+
if (text.length > 0) {
|
|
85
|
+
if (text.length > maxLen) {
|
|
86
|
+
const words = text.split(/\s+/);
|
|
87
|
+
let result = '';
|
|
88
|
+
for (const word of words) {
|
|
89
|
+
const next = result.length === 0 ? word : result + ' ' + word;
|
|
90
|
+
if (next.length > maxLen) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
result = next;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return result + '…';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return text;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return '';
|
|
37
104
|
};
|
|
38
105
|
|
|
106
|
+
// TODO(burdon): Option to strip Markdown.
|
|
39
107
|
export const getContentSnippet = (content = '') => {
|
|
40
108
|
const abstract = content
|
|
41
109
|
.split('\n')
|
|
42
|
-
.filter((line) => !line.startsWith('
|
|
110
|
+
.filter((line) => !line.startsWith('!'))
|
|
43
111
|
.filter((line) => line.trim() !== '');
|
|
44
112
|
|
|
45
|
-
return abstract.
|
|
113
|
+
return abstract.slice(0, 3).join('\n') ?? '';
|
|
46
114
|
};
|
|
47
115
|
|
|
48
116
|
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
49
117
|
const name = getFallbackName(content);
|
|
50
118
|
if (doc.fallbackName !== name) {
|
|
51
|
-
doc
|
|
119
|
+
Obj.change(doc, (d) => {
|
|
120
|
+
d.fallbackName = name;
|
|
121
|
+
});
|
|
52
122
|
}
|
|
53
123
|
}, 200);
|
|
54
124
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownCard,
|
|
3
|
-
MarkdownCard_default
|
|
4
|
-
} from "./chunk-DLZ5RR3P.mjs";
|
|
5
|
-
import "./chunk-OKNQ57GF.mjs";
|
|
6
|
-
import "./chunk-CN35HEBX.mjs";
|
|
7
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownCard,
|
|
10
|
-
MarkdownCard_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownCard-TC3GGUSX.mjs.map
|