@dxos/plugin-markdown 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-WHK3ORP7.mjs +12 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +12 -0
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs +32 -0
- 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-FWQQW6KU.mjs +144 -0
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-A3CQYGCN.mjs → chunk-JOXYQLKH.mjs} +5 -6
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +7 -0
- 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-WIPSLZ6L.mjs +60 -0
- package/dist/lib/browser/chunk-WIPSLZ6L.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 +122 -144
- 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-SRPLD3ED.mjs +213 -0
- package/dist/lib/browser/react-surface-SRPLD3ED.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-MCWEFW4F.mjs → MarkdownCard-WJPLQTFS.mjs} +5 -5
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/{anchor-sort-4SXYVYXT.mjs → anchor-sort-G7D5TAI6.mjs} +12 -12
- 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-SJ2QRGPM.mjs → chunk-44VJC3QF.mjs} +5 -6
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +7 -0
- 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-EYAFC4N7.mjs +145 -0
- package/dist/lib/node-esm/chunk-EYAFC4N7.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-RQP7G7XW.mjs +61 -0
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +102 -0
- 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 +122 -144
- 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-RONSOJIQ.mjs +214 -0
- package/dist/lib/node-esm/react-surface-RONSOJIQ.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 +8 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/functions}/open.d.ts +1 -1
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/{functions/diff.d.ts → blueprints/functions/update.d.ts} +2 -2
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +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 -17
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +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 +5 -4
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +5 -5
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +19 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +1 -0
- 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 +10 -9
- 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 +16 -12
- 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/index.d.ts +1 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts +9 -0
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -0
- package/dist/types/src/hooks/useExtensions.d.ts +5 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +3 -3
- 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 +6 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +16 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -31
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/src/util.test.d.ts +2 -0
- package/dist/types/src/util.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +86 -58
- package/src/MarkdownPlugin.tsx +61 -92
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +125 -0
- package/src/blueprints/functions/create.ts +34 -0
- 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/blueprints/functions/update.test.ts +149 -0
- package/src/{functions/diff.ts → blueprints/functions/update.ts} +6 -5
- 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 -12
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +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 +29 -50
- package/src/components/MarkdownContainer.stories.tsx +52 -66
- package/src/components/MarkdownContainer.tsx +97 -107
- package/src/components/MarkdownEditor/FileUpload.tsx +3 -3
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +19 -21
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +28 -29
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +50 -22
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +9 -6
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +34 -38
- package/src/components/index.ts +8 -3
- package/src/hooks/index.ts +1 -1
- package/src/hooks/{usePopoverMenuOptions.ts → useEditorMenuOptions.ts} +19 -22
- package/src/hooks/useExtensions.tsx +34 -30
- package/src/hooks/useLinkQuery.ts +22 -21
- package/src/hooks/useSelectCurrentThread.tsx +37 -32
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +27 -0
- package/src/translations.ts +1 -0
- package/src/types/Markdown.ts +8 -9
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +13 -0
- package/src/types/index.ts +4 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +79 -11
- package/dist/lib/browser/MarkdownCard-SLM6QZYC.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-UZFQC6XY.mjs +0 -15
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs +0 -32
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-BC5R3T72.mjs +0 -11
- package/dist/lib/browser/chunk-2LLVTQCK.mjs +0 -51
- package/dist/lib/browser/chunk-2LLVTQCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-3VILQLA4.mjs +0 -95
- package/dist/lib/browser/chunk-3VILQLA4.mjs.map +0 -7
- package/dist/lib/browser/chunk-5AYTOIUF.mjs +0 -822
- package/dist/lib/browser/chunk-5AYTOIUF.mjs.map +0 -7
- package/dist/lib/browser/chunk-A3CQYGCN.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-GLEYXJX3.mjs +0 -22
- package/dist/lib/browser/chunk-GLEYXJX3.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-JAETS5LE.mjs +0 -106
- package/dist/lib/browser/chunk-JAETS5LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-UKTCPHLI.mjs +0 -79
- package/dist/lib/browser/chunk-UKTCPHLI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs +0 -62
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs +0 -217
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs.map +0 -7
- package/dist/lib/browser/settings-LBXJHVBU.mjs +0 -28
- package/dist/lib/browser/settings-LBXJHVBU.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-YPIVDB4A.mjs +0 -66
- package/dist/lib/browser/toolkit-YPIVDB4A.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-KAQOK7K5.mjs +0 -16
- package/dist/lib/node-esm/anchor-sort-4SXYVYXT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FPNOTEYC.mjs +0 -12
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs +0 -823
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs +0 -107
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GGKPPGWA.mjs +0 -24
- package/dist/lib/node-esm/chunk-GGKPPGWA.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-JELROKGD.mjs +0 -80
- package/dist/lib/node-esm/chunk-JELROKGD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QH4MC5BE.mjs +0 -52
- package/dist/lib/node-esm/chunk-QH4MC5BE.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-SJ2QRGPM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs +0 -96
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs +0 -218
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2YRA67H6.mjs +0 -29
- package/dist/lib/node-esm/settings-2YRA67H6.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-36BFLIR3.mjs +0 -67
- package/dist/lib/node-esm/toolkit-36BFLIR3.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -20
- package/dist/types/src/capabilities/toolkit.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/diff.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/hooks/usePopoverMenuOptions.d.ts +0 -9
- package/dist/types/src/hooks/usePopoverMenuOptions.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -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/capabilities/toolkit.ts +0 -53
- package/src/events.ts +0 -11
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-SLM6QZYC.mjs.map → MarkdownCard-WHK3ORP7.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-UZFQC6XY.mjs.map → MarkdownContainer-V7EAADMF.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-BC5R3T72.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-MCWEFW4F.mjs.map → MarkdownCard-WJPLQTFS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-KAQOK7K5.mjs.map → MarkdownContainer-LUSMORP2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-FPNOTEYC.mjs.map → blueprints/index.mjs.map} +0 -0
|
@@ -3,12 +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 {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationResolver } from '@dxos/app-framework/react';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import {
|
|
12
|
+
import { OperationResolver } from '@dxos/operation';
|
|
13
|
+
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
12
14
|
|
|
13
15
|
import { meta } from '../meta';
|
|
14
16
|
|
|
@@ -16,41 +18,44 @@ import { meta } from '../meta';
|
|
|
16
18
|
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
17
19
|
*/
|
|
18
20
|
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
19
|
-
const
|
|
21
|
+
const scrollIntoViewHandler = useMemo(
|
|
20
22
|
() =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
OperationResolver.make({
|
|
24
|
+
operation: Common.LayoutOperation.ScrollIntoView,
|
|
23
25
|
position: 'hoist',
|
|
24
|
-
filter: (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
resolve: ({ options: { cursor } }) => {
|
|
32
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
33
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor!);
|
|
34
|
-
if (range) {
|
|
35
|
-
const selection = editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
36
|
-
const effects = [
|
|
37
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
38
|
-
EditorView.scrollIntoView(range.from, { y: 'start', yMargin: 96 }),
|
|
39
|
-
];
|
|
40
|
-
if (selection) {
|
|
41
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
42
|
-
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;
|
|
43
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
|
+
}
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
editorView.dispatch({
|
|
51
|
+
effects,
|
|
52
|
+
selection: selection ? { anchor: range.from } : undefined,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
51
56
|
}),
|
|
52
57
|
[documentId, editorView],
|
|
53
58
|
);
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
56
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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
|
+
import { Collection } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
// TODO(wittjosiah): Factor out.
|
|
14
|
+
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
|
+
Effect.zipRight(
|
|
16
|
+
Effect.gen(function* () {
|
|
17
|
+
// TODO(wittjosiah): Remove cast.
|
|
18
|
+
yield* Database.Service.add(
|
|
19
|
+
Obj.make(SpaceProperties, {
|
|
20
|
+
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
|
+
}) as any,
|
|
22
|
+
);
|
|
23
|
+
}),
|
|
24
|
+
effect,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const testToolkit = Toolkit.empty as Toolkit.Toolkit<any>;
|
package/src/translations.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const translations = [
|
|
|
18
18
|
'object name placeholder': 'New document',
|
|
19
19
|
'rename object label': 'Rename document',
|
|
20
20
|
'delete object label': 'Delete document',
|
|
21
|
+
'object deleted label': 'Document deleted',
|
|
21
22
|
},
|
|
22
23
|
[meta.id]: {
|
|
23
24
|
'plugin name': 'Editor',
|
package/src/types/Markdown.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { DescriptionAnnotation,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Document Item type.
|
|
@@ -15,16 +15,15 @@ import { DataType, ItemAnnotation } from '@dxos/schema';
|
|
|
15
15
|
export const Document = Schema.Struct({
|
|
16
16
|
name: Schema.optional(Schema.String),
|
|
17
17
|
description: Schema.optional(Schema.String),
|
|
18
|
-
fallbackName: Schema.String.pipe(
|
|
19
|
-
content: Type.Ref(
|
|
18
|
+
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
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
|
}),
|
|
25
25
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
26
|
DescriptionAnnotation.set('description'),
|
|
27
|
-
ItemAnnotation.set(true),
|
|
28
27
|
);
|
|
29
28
|
|
|
30
29
|
export type Document = Schema.Schema.Type<typeof Document>;
|
|
@@ -32,11 +31,11 @@ export type Document = Schema.Schema.Type<typeof Document>;
|
|
|
32
31
|
/**
|
|
33
32
|
* Document factory.
|
|
34
33
|
*/
|
|
35
|
-
export const
|
|
34
|
+
export const make = ({
|
|
36
35
|
content = '',
|
|
37
36
|
...props
|
|
38
37
|
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) =>
|
|
39
|
-
Obj.make(Document, { ...props, content: Ref.make(
|
|
38
|
+
Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Plugin settings.
|
|
@@ -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,25 +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
|
|
|
39
|
-
|
|
106
|
+
// TODO(burdon): Option to strip Markdown.
|
|
107
|
+
export const getContentSnippet = (content = '') => {
|
|
40
108
|
const abstract = content
|
|
41
109
|
.split('\n')
|
|
42
|
-
.filter((line) => !line.startsWith('
|
|
43
|
-
.filter((line) => line.trim() !== '')
|
|
44
|
-
.replaceAll(nonTitleChars, '')
|
|
45
|
-
.trim();
|
|
110
|
+
.filter((line) => !line.startsWith('!'))
|
|
111
|
+
.filter((line) => line.trim() !== '');
|
|
46
112
|
|
|
47
|
-
return abstract
|
|
113
|
+
return abstract.slice(0, 3).join('\n') ?? '';
|
|
48
114
|
};
|
|
49
115
|
|
|
50
|
-
export const setFallbackName = debounce((doc: Markdown.Document, content
|
|
116
|
+
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
51
117
|
const name = getFallbackName(content);
|
|
52
118
|
if (doc.fallbackName !== name) {
|
|
53
|
-
doc
|
|
119
|
+
Obj.change(doc, (d) => {
|
|
120
|
+
d.fallbackName = name;
|
|
121
|
+
});
|
|
54
122
|
}
|
|
55
123
|
}, 200);
|
|
56
124
|
|
|
@@ -62,6 +130,6 @@ export const serializer: TypedObjectSerializer<Markdown.Document> = {
|
|
|
62
130
|
|
|
63
131
|
deserialize: async ({ content: serialized }) => {
|
|
64
132
|
const { name, fallbackName, content } = JSON.parse(serialized);
|
|
65
|
-
return Markdown.
|
|
133
|
+
return Markdown.make({ name, fallbackName, content });
|
|
66
134
|
},
|
|
67
135
|
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownCard,
|
|
3
|
-
MarkdownCard_default
|
|
4
|
-
} from "./chunk-3VILQLA4.mjs";
|
|
5
|
-
import "./chunk-2LLVTQCK.mjs";
|
|
6
|
-
import "./chunk-UKTCPHLI.mjs";
|
|
7
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownCard,
|
|
10
|
-
MarkdownCard_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownCard-SLM6QZYC.mjs.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownContainer,
|
|
3
|
-
MarkdownContainer_default
|
|
4
|
-
} from "./chunk-5AYTOIUF.mjs";
|
|
5
|
-
import "./chunk-GLEYXJX3.mjs";
|
|
6
|
-
import "./chunk-JAETS5LE.mjs";
|
|
7
|
-
import "./chunk-IBCHVMZW.mjs";
|
|
8
|
-
import "./chunk-2LLVTQCK.mjs";
|
|
9
|
-
import "./chunk-UKTCPHLI.mjs";
|
|
10
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
11
|
-
export {
|
|
12
|
-
MarkdownContainer,
|
|
13
|
-
MarkdownContainer_default as default
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=MarkdownContainer-UZFQC6XY.mjs.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Markdown_exports
|
|
3
|
-
} from "./chunk-UKTCPHLI.mjs";
|
|
4
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/anchor-sort.ts
|
|
7
|
-
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
8
|
-
import { Type } from "@dxos/echo";
|
|
9
|
-
import { createDocAccessor, getRangeFromCursor, getTarget } from "@dxos/react-client/echo";
|
|
10
|
-
var anchor_sort_default = (() => contributes(Capabilities.AnchorSort, {
|
|
11
|
-
key: Type.getTypename(Markdown_exports.Document),
|
|
12
|
-
sort: (anchorA, anchorB) => {
|
|
13
|
-
const doc = getTarget(anchorA);
|
|
14
|
-
const accessor = doc.content.target ? createDocAccessor(doc.content.target, [
|
|
15
|
-
"content"
|
|
16
|
-
]) : void 0;
|
|
17
|
-
if (doc !== getTarget(anchorB) || !accessor) {
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
const getStartPosition = (cursor) => {
|
|
21
|
-
const range = cursor ? getRangeFromCursor(accessor, cursor) : void 0;
|
|
22
|
-
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
23
|
-
};
|
|
24
|
-
const posA = getStartPosition(anchorA.anchor);
|
|
25
|
-
const posB = getStartPosition(anchorB.anchor);
|
|
26
|
-
return posA - posB;
|
|
27
|
-
}
|
|
28
|
-
}));
|
|
29
|
-
export {
|
|
30
|
-
anchor_sort_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=anchor-sort-4XPPLMZS.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/anchor-sort.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { Type } from '@dxos/echo';\nimport { createDocAccessor, getRangeFromCursor, getTarget } from '@dxos/react-client/echo';\n\nimport { Markdown } from '../types';\n\nexport default () =>\n contributes(Capabilities.AnchorSort, {\n key: Type.getTypename(Markdown.Document)!,\n sort: (anchorA, anchorB) => {\n const doc = getTarget(anchorA) as Markdown.Document;\n const accessor = doc.content.target ? createDocAccessor(doc.content.target, ['content']) : undefined;\n if (doc !== getTarget(anchorB) || !accessor) {\n return 0;\n }\n\n const getStartPosition = (cursor: string | undefined) => {\n const range = cursor ? getRangeFromCursor(accessor, cursor) : undefined;\n return range?.start ?? Number.MAX_SAFE_INTEGER;\n };\n\n const posA = getStartPosition(anchorA.anchor);\n const posB = getStartPosition(anchorB.anchor);\n return posA - posB;\n },\n });\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,cAAcC,mBAAmB;AAC1C,SAASC,YAAY;AACrB,SAASC,mBAAmBC,oBAAoBC,iBAAiB;AAIjE,IAAA,uBAAe,MACbC,YAAYC,aAAaC,YAAY;EACnCC,KAAKC,KAAKC,YAAYC,iBAASC,QAAQ;EACvCC,MAAM,CAACC,SAASC,YAAAA;AACd,UAAMC,MAAMC,UAAUH,OAAAA;AACtB,UAAMI,WAAWF,IAAIG,QAAQC,SAASC,kBAAkBL,IAAIG,QAAQC,QAAQ;MAAC;KAAU,IAAIE;AAC3F,QAAIN,QAAQC,UAAUF,OAAAA,KAAY,CAACG,UAAU;AAC3C,aAAO;IACT;AAEA,UAAMK,mBAAmB,CAACC,WAAAA;AACxB,YAAMC,QAAQD,SAASE,mBAAmBR,UAAUM,MAAAA,IAAUF;AAC9D,aAAOG,OAAOE,SAASC,OAAOC;IAChC;AAEA,UAAMC,OAAOP,iBAAiBT,QAAQiB,MAAM;AAC5C,UAAMC,OAAOT,iBAAiBR,QAAQgB,MAAM;AAC5C,WAAOD,OAAOE;EAChB;AACF,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "Type", "createDocAccessor", "getRangeFromCursor", "getTarget", "contributes", "Capabilities", "AnchorSort", "key", "Type", "getTypename", "Markdown", "Document", "sort", "anchorA", "anchorB", "doc", "getTarget", "accessor", "content", "target", "createDocAccessor", "undefined", "getStartPosition", "cursor", "range", "getRangeFromCursor", "start", "Number", "MAX_SAFE_INTEGER", "posA", "anchor", "posB"]
|
|
7
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
translations
|
|
3
|
-
} from "./chunk-A3CQYGCN.mjs";
|
|
4
|
-
import {
|
|
5
|
-
MarkdownAction_exports,
|
|
6
|
-
Markdown_exports
|
|
7
|
-
} from "./chunk-UKTCPHLI.mjs";
|
|
8
|
-
import "./chunk-BQTYJOFB.mjs";
|
|
9
|
-
|
|
10
|
-
// src/capabilities/app-graph-serializer.ts
|
|
11
|
-
import * as Function from "effect/Function";
|
|
12
|
-
import { Capabilities, chain, contributes, createIntent } from "@dxos/app-framework";
|
|
13
|
-
import { Obj } from "@dxos/echo";
|
|
14
|
-
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
15
|
-
import { isSpace } from "@dxos/react-client/echo";
|
|
16
|
-
import { DataType } from "@dxos/schema";
|
|
17
|
-
var app_graph_serializer_default = ((context) => contributes(Capabilities.AppGraphSerializer, [
|
|
18
|
-
{
|
|
19
|
-
inputType: Markdown_exports.Document.typename,
|
|
20
|
-
outputType: "text/markdown",
|
|
21
|
-
// Reconcile with metadata serializers.
|
|
22
|
-
serialize: async (node) => {
|
|
23
|
-
const doc = node.data;
|
|
24
|
-
const content = await doc.content.load();
|
|
25
|
-
return {
|
|
26
|
-
name: doc.name || doc.fallbackName || translations[0]["en-US"][Markdown_exports.Document.typename]["object name placeholder"],
|
|
27
|
-
data: content.content,
|
|
28
|
-
type: "text/markdown"
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
deserialize: async (data, ancestors) => {
|
|
32
|
-
const space = ancestors.find(isSpace);
|
|
33
|
-
const target = ancestors.findLast((ancestor) => Obj.instanceOf(DataType.Collection, ancestor)) ?? space?.properties[DataType.Collection.typename]?.target;
|
|
34
|
-
if (!space || !target) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
38
|
-
const result = await dispatch(Function.pipe(createIntent(MarkdownAction_exports.Create, {
|
|
39
|
-
name: data.name,
|
|
40
|
-
content: data.data
|
|
41
|
-
}), chain(SpaceAction.AddObject, {
|
|
42
|
-
target
|
|
43
|
-
})));
|
|
44
|
-
return result.data?.object;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
]));
|
|
48
|
-
export {
|
|
49
|
-
app_graph_serializer_default as default
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=app-graph-serializer-QQFV4K6P.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-serializer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Function from 'effect/Function';\n\nimport { Capabilities, type PluginContext, chain, contributes, createIntent } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { isSpace } from '@dxos/react-client/echo';\nimport { DataType } from '@dxos/schema';\n\nimport { translations } from '../translations';\nimport { Markdown, MarkdownAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphSerializer, [\n {\n inputType: Markdown.Document.typename,\n outputType: 'text/markdown',\n // Reconcile with metadata serializers.\n serialize: async (node) => {\n const doc = node.data;\n const content = await doc.content.load();\n return {\n name:\n doc.name ||\n doc.fallbackName ||\n translations[0]['en-US'][Markdown.Document.typename]['object name placeholder'],\n data: content.content,\n type: 'text/markdown',\n };\n },\n deserialize: async (data, ancestors) => {\n const space = ancestors.find(isSpace);\n const target =\n ancestors.findLast((ancestor) => Obj.instanceOf(DataType.Collection, ancestor)) ??\n space?.properties[DataType.Collection.typename]?.target;\n if (!space || !target) {\n return;\n }\n\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const result = await dispatch(\n Function.pipe(\n createIntent(MarkdownAction.Create, { name: data.name, content: data.data }),\n chain(SpaceAction.AddObject, { target }),\n ),\n );\n\n return result.data?.object;\n },\n },\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,YAAYA,cAAc;AAE1B,SAASC,cAAkCC,OAAOC,aAAaC,oBAAoB;AACnF,SAASC,WAAW;AACpB,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,gBAAgB;AAKzB,IAAA,gCAAe,CAACC,YACdC,YAAYC,aAAaC,oBAAoB;EAC3C;IACEC,WAAWC,iBAASC,SAASC;IAC7BC,YAAY;;IAEZC,WAAW,OAAOC,SAAAA;AAChB,YAAMC,MAAMD,KAAKE;AACjB,YAAMC,UAAU,MAAMF,IAAIE,QAAQC,KAAI;AACtC,aAAO;QACLC,MACEJ,IAAII,QACJJ,IAAIK,gBACJC,aAAa,CAAA,EAAG,OAAA,EAASZ,iBAASC,SAASC,QAAQ,EAAE,yBAAA;QACvDK,MAAMC,QAAQA;QACdK,MAAM;MACR;IACF;IACAC,aAAa,OAAOP,MAAMQ,cAAAA;AACxB,YAAMC,QAAQD,UAAUE,KAAKC,OAAAA;AAC7B,YAAMC,SACJJ,UAAUK,SAAS,CAACC,aAAaC,IAAIC,WAAWC,SAASC,YAAYJ,QAAAA,CAAAA,KACrEL,OAAOU,WAAWF,SAASC,WAAWvB,QAAQ,GAAGiB;AACnD,UAAI,CAACH,SAAS,CAACG,QAAQ;AACrB;MACF;AAEA,YAAM,EAAEQ,iBAAiBC,SAAQ,IAAKjC,QAAQkC,cAAchC,aAAaiC,gBAAgB;AACzF,YAAMC,SAAS,MAAMH,SACVI,cACPC,aAAaC,uBAAeC,QAAQ;QAAEzB,MAAMH,KAAKG;QAAMF,SAASD,KAAKA;MAAK,CAAA,GAC1E6B,MAAMC,YAAYC,WAAW;QAAEnB;MAAO,CAAA,CAAA,CAAA;AAI1C,aAAOY,OAAOxB,MAAMgC;IACtB;EACF;CACD;",
|
|
6
|
-
"names": ["Function", "Capabilities", "chain", "contributes", "createIntent", "Obj", "SpaceAction", "isSpace", "DataType", "context", "contributes", "Capabilities", "AppGraphSerializer", "inputType", "Markdown", "Document", "typename", "outputType", "serialize", "node", "doc", "data", "content", "load", "name", "fallbackName", "translations", "type", "deserialize", "ancestors", "space", "find", "isSpace", "target", "findLast", "ancestor", "Obj", "instanceOf", "DataType", "Collection", "properties", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "result", "pipe", "createIntent", "MarkdownAction", "Create", "chain", "SpaceAction", "AddObject", "object"]
|
|
7
|
-
}
|