@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
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type Common } from '@dxos/app-framework';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
-
import { EditorToolbar, type EditorToolbarProps
|
|
11
|
+
import { EditorToolbar, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
12
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
12
13
|
|
|
13
14
|
import { FileUpload, type FileUploadAction } from './FileUpload';
|
|
14
15
|
|
|
@@ -16,8 +17,8 @@ export type MarkdownEditorToolbarProps = ThemedClassName<
|
|
|
16
17
|
{
|
|
17
18
|
id: string;
|
|
18
19
|
editorView?: EditorView;
|
|
19
|
-
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
20
|
-
} & Pick<EditorToolbarProps, 'role' | 'state' | 'customActions' | 'onViewModeChange'>
|
|
20
|
+
onFileUpload?: (file: File) => Promise<Common.FileInfo | undefined>;
|
|
21
|
+
} & Pick<EditorToolbarProps, 'role' | 'state' | 'customActions' | 'onAction' | 'onViewModeChange'>
|
|
21
22
|
>;
|
|
22
23
|
|
|
23
24
|
export const MarkdownEditorToolbar = ({
|
|
@@ -27,11 +28,12 @@ export const MarkdownEditorToolbar = ({
|
|
|
27
28
|
state,
|
|
28
29
|
editorView,
|
|
29
30
|
customActions,
|
|
31
|
+
onAction,
|
|
30
32
|
onFileUpload,
|
|
31
33
|
onViewModeChange,
|
|
32
34
|
}: MarkdownEditorToolbarProps) => {
|
|
33
35
|
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
34
|
-
const
|
|
36
|
+
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
35
37
|
|
|
36
38
|
const handleViewModeChange = useCallback((mode: EditorViewMode) => onViewModeChange?.(mode), [onViewModeChange]);
|
|
37
39
|
|
|
@@ -53,11 +55,12 @@ export const MarkdownEditorToolbar = ({
|
|
|
53
55
|
state={state}
|
|
54
56
|
customActions={customActions}
|
|
55
57
|
getView={getView}
|
|
58
|
+
onAction={onAction}
|
|
56
59
|
onImageUpload={upload ?? undefined}
|
|
57
60
|
onViewModeChange={handleViewModeChange}
|
|
58
61
|
/>
|
|
59
62
|
|
|
60
|
-
{onFileUpload && <FileUpload ref={
|
|
63
|
+
{onFileUpload && <FileUpload ref={uploadRef} editorView={editorView} onFileUpload={onFileUpload} />}
|
|
61
64
|
</>
|
|
62
65
|
);
|
|
63
66
|
};
|
|
@@ -5,13 +5,18 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/react-ui-editor';
|
|
9
8
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
|
+
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/ui-editor';
|
|
10
10
|
|
|
11
11
|
import { meta } from '../../meta';
|
|
12
12
|
import { type Markdown } from '../../types';
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type MarkdownSettingsComponentProps = {
|
|
15
|
+
settings: Markdown.Settings;
|
|
16
|
+
onSettingsChange: (fn: (current: Markdown.Settings) => Markdown.Settings) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSettingsComponentProps) => {
|
|
15
20
|
const { t } = useTranslation(meta.id);
|
|
16
21
|
|
|
17
22
|
// TODO(wittjosiah): Add skill test confirmation for entering vim mode.
|
|
@@ -23,7 +28,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
23
28
|
<Select.Root
|
|
24
29
|
value={settings.defaultViewMode}
|
|
25
30
|
onValueChange={(value) => {
|
|
26
|
-
|
|
31
|
+
onSettingsChange((s) => ({ ...s, defaultViewMode: value as EditorViewMode }));
|
|
27
32
|
}}
|
|
28
33
|
>
|
|
29
34
|
<Select.TriggerButton />
|
|
@@ -46,7 +51,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
46
51
|
<Select.Root
|
|
47
52
|
value={settings.editorInputMode ?? 'default'}
|
|
48
53
|
onValueChange={(value) => {
|
|
49
|
-
|
|
54
|
+
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
50
55
|
}}
|
|
51
56
|
>
|
|
52
57
|
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
@@ -66,29 +71,38 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
66
71
|
</ControlItemInput>
|
|
67
72
|
|
|
68
73
|
<ControlItemInput title={t('settings toolbar label')}>
|
|
69
|
-
<Input.Switch
|
|
74
|
+
<Input.Switch
|
|
75
|
+
checked={settings.toolbar}
|
|
76
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, toolbar: !!checked }))}
|
|
77
|
+
/>
|
|
70
78
|
</ControlItemInput>
|
|
71
79
|
|
|
72
80
|
<ControlItemInput title={t('settings numbered headings label')}>
|
|
73
81
|
<Input.Switch
|
|
74
82
|
checked={settings.numberedHeadings}
|
|
75
|
-
onCheckedChange={(checked) => (
|
|
83
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, numberedHeadings: !!checked }))}
|
|
76
84
|
/>
|
|
77
85
|
</ControlItemInput>
|
|
78
86
|
|
|
79
87
|
<ControlItemInput title={t('settings folding label')}>
|
|
80
|
-
<Input.Switch
|
|
88
|
+
<Input.Switch
|
|
89
|
+
checked={settings.folding}
|
|
90
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, folding: !!checked }))}
|
|
91
|
+
/>
|
|
81
92
|
</ControlItemInput>
|
|
82
93
|
|
|
83
94
|
<ControlItemInput title={t('settings experimental label')}>
|
|
84
95
|
<Input.Switch
|
|
85
96
|
checked={settings.experimental}
|
|
86
|
-
onCheckedChange={(checked) => (
|
|
97
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, experimental: !!checked }))}
|
|
87
98
|
/>
|
|
88
99
|
</ControlItemInput>
|
|
89
100
|
|
|
90
101
|
<ControlItemInput title={t('settings debug label')}>
|
|
91
|
-
<Input.Switch
|
|
102
|
+
<Input.Switch
|
|
103
|
+
checked={settings.debug}
|
|
104
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, debug: !!checked }))}
|
|
105
|
+
/>
|
|
92
106
|
</ControlItemInput>
|
|
93
107
|
|
|
94
108
|
{settings.debug && (
|
|
@@ -96,7 +110,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
96
110
|
<Input.TextArea
|
|
97
111
|
rows={5}
|
|
98
112
|
value={settings.typewriter}
|
|
99
|
-
onChange={({ target: { value } }) => (
|
|
113
|
+
onChange={({ target: { value } }) => onSettingsChange((s) => ({ ...s, typewriter: value }))}
|
|
100
114
|
placeholder={t('settings debug placeholder')}
|
|
101
115
|
/>
|
|
102
116
|
</ControlItemInput>
|
|
@@ -3,37 +3,34 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import * as Function from 'effect/Function';
|
|
7
8
|
import * as Match from 'effect/Match';
|
|
8
9
|
import * as Option from 'effect/Option';
|
|
9
10
|
import * as Schema from 'effect/Schema';
|
|
10
11
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
13
14
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
14
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
|
+
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
15
17
|
import { invariant } from '@dxos/invariant';
|
|
16
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
17
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
18
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
19
|
-
import {
|
|
20
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
21
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
22
21
|
import { faker } from '@dxos/random';
|
|
23
|
-
import {
|
|
22
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
24
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
25
24
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
29
|
-
import { DataType } from '@dxos/schema';
|
|
25
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
26
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
30
27
|
import { render } from '@dxos/storybook-utils';
|
|
28
|
+
import { Message } from '@dxos/types';
|
|
29
|
+
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
31
30
|
|
|
32
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
33
31
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
34
|
-
import { meta } from '../meta';
|
|
35
32
|
import { translations } from '../translations';
|
|
36
|
-
import { Markdown } from '../types';
|
|
33
|
+
import { Markdown, MarkdownCapabilities } from '../types';
|
|
37
34
|
|
|
38
35
|
import { MarkdownContainer } from './MarkdownContainer';
|
|
39
36
|
|
|
@@ -49,26 +46,25 @@ const TestItem = Schema.Struct({
|
|
|
49
46
|
description: 'Product description',
|
|
50
47
|
}),
|
|
51
48
|
}).pipe(
|
|
52
|
-
Type.
|
|
49
|
+
Type.object({
|
|
53
50
|
typename: 'dxos.org/type/Test',
|
|
54
51
|
version: '0.1.0',
|
|
55
52
|
}),
|
|
56
53
|
);
|
|
57
54
|
|
|
58
55
|
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
59
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
60
56
|
const { parentRef } = useTextEditor({ initialValue: content });
|
|
61
|
-
const
|
|
57
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
62
58
|
|
|
63
59
|
const space = useSpace();
|
|
64
60
|
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
65
|
-
const queue = useQueue<
|
|
61
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
66
62
|
|
|
67
63
|
const handleInsert = async () => {
|
|
68
64
|
invariant(space);
|
|
69
65
|
invariant(queue);
|
|
70
66
|
await queue.append([
|
|
71
|
-
Obj.make(
|
|
67
|
+
Obj.make(Message.Message, {
|
|
72
68
|
created: new Date().toISOString(),
|
|
73
69
|
sender: { role: 'assistant' },
|
|
74
70
|
blocks: [{ _tag: 'text', text: 'Hello' }],
|
|
@@ -80,7 +76,7 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
80
76
|
const text = await doc.content.load();
|
|
81
77
|
const accessor = createDocAccessor(text, ['content']);
|
|
82
78
|
const cursor = Function.pipe(
|
|
83
|
-
editorState.getState(
|
|
79
|
+
editorState.getState(Obj.getDXN(doc).toString())?.selection,
|
|
84
80
|
Option.fromNullable,
|
|
85
81
|
Option.map(selectionToRange),
|
|
86
82
|
Option.map((range) => toCursorRange(accessor, range.from, range.to)),
|
|
@@ -94,7 +90,7 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
94
90
|
|
|
95
91
|
// void dispatch(
|
|
96
92
|
// createIntent(CollaborationActions.InsertContent, {
|
|
97
|
-
// target: doc as any as
|
|
93
|
+
// target: doc as any as TestSchema.Expando,
|
|
98
94
|
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
99
95
|
// at: cursor,
|
|
100
96
|
// label: 'Proposal',
|
|
@@ -103,20 +99,20 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
return (
|
|
106
|
-
<
|
|
102
|
+
<Layout.Main toolbar>
|
|
107
103
|
<Toolbar.Root>
|
|
108
104
|
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
109
105
|
</Toolbar.Root>
|
|
110
106
|
<div ref={parentRef} className='p-4' />
|
|
111
|
-
</
|
|
107
|
+
</Layout.Main>
|
|
112
108
|
);
|
|
113
109
|
};
|
|
114
110
|
|
|
115
111
|
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
116
112
|
const space = useSpace();
|
|
117
113
|
const [doc, setDoc] = useState<Markdown.Document>();
|
|
118
|
-
const settings =
|
|
119
|
-
const
|
|
114
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
120
116
|
|
|
121
117
|
useEffect(() => {
|
|
122
118
|
if (!space) {
|
|
@@ -124,10 +120,15 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
124
120
|
}
|
|
125
121
|
|
|
126
122
|
const doc = space.db.add(
|
|
127
|
-
Markdown.
|
|
123
|
+
Markdown.make({
|
|
128
124
|
name: 'Test',
|
|
129
125
|
content: document.replaceAll(/\[(\w+)\]/g, (_, label) => {
|
|
130
|
-
const obj = space.db.add(
|
|
126
|
+
const obj = space.db.add(
|
|
127
|
+
Obj.make(TestItem, {
|
|
128
|
+
title: label,
|
|
129
|
+
description: faker.lorem.paragraph(),
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
131
132
|
const dxn = Ref.make(obj).dxn.toString();
|
|
132
133
|
return `[${label}](${dxn})`;
|
|
133
134
|
}),
|
|
@@ -141,10 +142,9 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
141
142
|
return null;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
// TODO(burdon): Layout issue.
|
|
145
145
|
return (
|
|
146
146
|
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
147
|
-
<MarkdownContainer id={doc.id}
|
|
147
|
+
<MarkdownContainer id={doc.id} subject={doc} settings={settings} editorStateStore={editorState} />
|
|
148
148
|
<TestChat doc={doc} content={chat} />
|
|
149
149
|
</div>
|
|
150
150
|
);
|
|
@@ -157,22 +157,18 @@ const storybook: Meta<typeof DefaultStory> = {
|
|
|
157
157
|
withTheme,
|
|
158
158
|
withPluginManager({
|
|
159
159
|
plugins: [
|
|
160
|
+
...corePlugins(),
|
|
161
|
+
StorybookPlugin({}),
|
|
160
162
|
ClientPlugin({
|
|
161
163
|
types: [Markdown.Document, TestItem],
|
|
162
|
-
onClientInitialized:
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
onClientInitialized: ({ client }) =>
|
|
165
|
+
Effect.gen(function* () {
|
|
166
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
+
}),
|
|
165
168
|
}),
|
|
166
|
-
SpacePlugin({}),
|
|
167
|
-
GraphPlugin(),
|
|
168
|
-
IntentPlugin(),
|
|
169
|
-
SettingsPlugin(),
|
|
170
169
|
|
|
171
|
-
// UI
|
|
172
|
-
ThemePlugin({ tx: defaultTx }),
|
|
173
170
|
MarkdownPlugin(),
|
|
174
171
|
PreviewPlugin(),
|
|
175
|
-
StorybookLayoutPlugin({}),
|
|
176
172
|
],
|
|
177
173
|
}),
|
|
178
174
|
],
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type LazyExoticComponent, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type MarkdownCard as MarkdownCardType } from './MarkdownCard';
|
|
8
|
+
import { type MarkdownContainer as MarkdownContainerType } from './MarkdownContainer';
|
|
6
9
|
|
|
7
10
|
export * from './MarkdownCard';
|
|
8
11
|
export * from './MarkdownContainer';
|
|
9
12
|
export * from './MarkdownSettings';
|
|
10
13
|
|
|
11
|
-
export const MarkdownCard = lazy(() => import('./MarkdownCard'));
|
|
12
|
-
export const MarkdownContainer = lazy(
|
|
14
|
+
export const MarkdownCard: LazyExoticComponent<typeof MarkdownCardType> = lazy(() => import('./MarkdownCard'));
|
|
15
|
+
export const MarkdownContainer: LazyExoticComponent<typeof MarkdownContainerType> = lazy(
|
|
16
|
+
() => import('./MarkdownContainer'),
|
|
17
|
+
);
|
package/src/hooks/index.ts
CHANGED
|
@@ -5,31 +5,32 @@
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import { useCallback, useMemo, useRef } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import {
|
|
10
|
-
type
|
|
11
|
-
type
|
|
10
|
+
type EditorMenuGroup,
|
|
11
|
+
type UseEditorMenuProps,
|
|
12
12
|
filterMenuGroups,
|
|
13
13
|
formattingCommands,
|
|
14
14
|
linkSlashCommands,
|
|
15
15
|
} from '@dxos/react-ui-editor';
|
|
16
|
+
import { Domino } from '@dxos/ui';
|
|
16
17
|
|
|
17
18
|
import { meta } from '../meta';
|
|
18
19
|
|
|
19
|
-
export type
|
|
20
|
+
export type UseEditorMenuOptionsProps = {
|
|
20
21
|
editorView?: EditorView;
|
|
21
|
-
slashCommandGroups?:
|
|
22
|
-
onLinkQuery?: (query?: string) => Promise<
|
|
22
|
+
slashCommandGroups?: EditorMenuGroup[];
|
|
23
|
+
onLinkQuery?: (query?: string) => Promise<EditorMenuGroup[]>;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
export const
|
|
26
|
+
export const useEditorMenuOptions = ({
|
|
26
27
|
editorView,
|
|
27
28
|
slashCommandGroups,
|
|
28
29
|
onLinkQuery,
|
|
29
|
-
}:
|
|
30
|
+
}: UseEditorMenuOptionsProps): UseEditorMenuProps => {
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
|
|
32
|
-
const getMenu = useCallback<NonNullable<
|
|
33
|
+
const getMenu = useCallback<NonNullable<UseEditorMenuProps['getMenu']>>(
|
|
33
34
|
({ text, trigger }) => {
|
|
34
35
|
switch (trigger) {
|
|
35
36
|
case '@': {
|
|
@@ -48,22 +49,18 @@ export const usePopoverMenuOptions = ({
|
|
|
48
49
|
);
|
|
49
50
|
|
|
50
51
|
const viewRef = useRef(editorView);
|
|
51
|
-
return useMemo<
|
|
52
|
+
return useMemo<UseEditorMenuProps>(() => {
|
|
52
53
|
const trigger = onLinkQuery ? ['/', '@'] : ['/'];
|
|
53
54
|
const placeholder = {
|
|
54
55
|
delay: 3_000,
|
|
55
|
-
content: () =>
|
|
56
|
-
Domino.of('
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
Domino.of('span').text('for commands.'),
|
|
65
|
-
)
|
|
66
|
-
.build(),
|
|
56
|
+
content: () => {
|
|
57
|
+
const pressEl = Domino.of('span').text('Press');
|
|
58
|
+
const triggerEls = trigger.map((text) =>
|
|
59
|
+
Domino.of('span').classNames('mx-1 pli-1.5 pt-[1px] pb-[2px] border border-separator rounded-sm').text(text),
|
|
60
|
+
);
|
|
61
|
+
const forCommandsEl = Domino.of('span').text('for commands.');
|
|
62
|
+
return Domino.of('div').children(pressEl, ...triggerEls, forCommandsEl).root;
|
|
63
|
+
},
|
|
67
64
|
};
|
|
68
65
|
|
|
69
66
|
return { viewRef, getMenu, trigger, placeholder };
|
|
@@ -6,15 +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 {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
10
11
|
import { debounceAndThrottle } from '@dxos/async';
|
|
11
12
|
import { Obj } from '@dxos/echo';
|
|
13
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
12
14
|
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import {
|
|
14
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
15
16
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
16
17
|
import { Icon, ThemeProvider } from '@dxos/react-ui';
|
|
17
18
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
18
20
|
import {
|
|
19
21
|
Cursor,
|
|
20
22
|
type EditorStateStore,
|
|
@@ -32,22 +34,22 @@ import {
|
|
|
32
34
|
linkTooltip,
|
|
33
35
|
listener,
|
|
34
36
|
preview,
|
|
37
|
+
replacer,
|
|
35
38
|
selectionState,
|
|
36
39
|
typewriter,
|
|
37
|
-
} from '@dxos/
|
|
38
|
-
import { defaultTx } from '@dxos/
|
|
39
|
-
import { DataType } from '@dxos/schema';
|
|
40
|
+
} from '@dxos/ui-editor';
|
|
41
|
+
import { defaultTx } from '@dxos/ui-theme';
|
|
40
42
|
import { isTruthy } from '@dxos/util';
|
|
41
43
|
|
|
42
44
|
import { Markdown } from '../types';
|
|
43
45
|
import { setFallbackName } from '../util';
|
|
44
46
|
|
|
45
|
-
export type DocumentType = Markdown.Document |
|
|
47
|
+
export type DocumentType = Markdown.Document | Text.Text | { id: string; text: string };
|
|
46
48
|
|
|
47
49
|
export type ExtensionsOptions = {
|
|
48
50
|
id: string;
|
|
49
51
|
object?: DocumentType;
|
|
50
|
-
|
|
52
|
+
invokePromise?: Common.Capability.OperationInvoker['invokePromise'];
|
|
51
53
|
settings?: Markdown.Settings;
|
|
52
54
|
selectionManager?: SelectionManager;
|
|
53
55
|
viewMode?: EditorViewMode;
|
|
@@ -65,16 +67,16 @@ export const useExtensions = ({
|
|
|
65
67
|
editorStateStore,
|
|
66
68
|
previewOptions,
|
|
67
69
|
}: ExtensionsOptions): Extension[] => {
|
|
68
|
-
const {
|
|
70
|
+
const { invokePromise } = useOperationInvoker();
|
|
69
71
|
const identity = useIdentity();
|
|
70
72
|
const space = getSpace(object);
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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);
|
|
78
80
|
|
|
79
81
|
// TODO(wittjosiah): Autocomplete is not working and this query is causing performance issues.
|
|
80
82
|
// TODO(burdon): Unsubscribe.
|
|
@@ -90,13 +92,13 @@ export const useExtensions = ({
|
|
|
90
92
|
selectionManager,
|
|
91
93
|
viewMode,
|
|
92
94
|
previewOptions,
|
|
93
|
-
|
|
95
|
+
invokePromise,
|
|
94
96
|
}),
|
|
95
97
|
[
|
|
96
98
|
id,
|
|
97
99
|
object,
|
|
98
100
|
viewMode,
|
|
99
|
-
|
|
101
|
+
invokePromise,
|
|
100
102
|
previewOptions,
|
|
101
103
|
settings,
|
|
102
104
|
settings?.debug,
|
|
@@ -113,7 +115,13 @@ export const useExtensions = ({
|
|
|
113
115
|
[
|
|
114
116
|
// TODO(burdon): Pass this in?
|
|
115
117
|
// NOTE: Data extensions must be first so that automerge is updated before other extensions compute their state.
|
|
116
|
-
target &&
|
|
118
|
+
target &&
|
|
119
|
+
createDataExtensions({
|
|
120
|
+
id,
|
|
121
|
+
text: createDocAccessor(target, ['content']),
|
|
122
|
+
messenger: space,
|
|
123
|
+
identity,
|
|
124
|
+
}),
|
|
117
125
|
|
|
118
126
|
// TODO(burdon): Reconcile with effect in parent.
|
|
119
127
|
Obj.instanceOf(Markdown.Document, object) &&
|
|
@@ -136,7 +144,7 @@ export const useExtensions = ({
|
|
|
136
144
|
const createBaseExtensions = ({
|
|
137
145
|
id,
|
|
138
146
|
object,
|
|
139
|
-
|
|
147
|
+
invokePromise,
|
|
140
148
|
settings,
|
|
141
149
|
selectionManager,
|
|
142
150
|
viewMode,
|
|
@@ -161,22 +169,18 @@ const createBaseExtensions = ({
|
|
|
161
169
|
// TODO(wittjosiah): For internal links, consider ignoring the link text and rendering the label of the object being linked to.
|
|
162
170
|
// TODO(burdon): Create dx-tag.
|
|
163
171
|
renderLinkButton:
|
|
164
|
-
|
|
165
|
-
? createLinkRenderer((
|
|
166
|
-
void
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
options: {
|
|
171
|
-
pivotId: object ? fullyQualifiedId(object) : id,
|
|
172
|
-
},
|
|
173
|
-
}),
|
|
174
|
-
);
|
|
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
|
+
});
|
|
175
178
|
})
|
|
176
179
|
: undefined,
|
|
177
180
|
}),
|
|
178
181
|
linkTooltip(renderLinkTooltip),
|
|
179
182
|
preview(previewOptions),
|
|
183
|
+
replacer(),
|
|
180
184
|
],
|
|
181
185
|
);
|
|
182
186
|
}
|
|
@@ -2,43 +2,44 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
5
6
|
import { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
+
import { Common } from '@dxos/app-framework';
|
|
9
|
+
import { usePluginManager } from '@dxos/app-framework/react';
|
|
10
|
+
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
|
+
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
12
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { type
|
|
13
|
+
import { type EditorMenuGroup, type EditorMenuItem } from '@dxos/react-ui-editor';
|
|
14
|
+
import { insertAtCursor, insertAtLineStart } from '@dxos/ui-editor';
|
|
14
15
|
|
|
15
|
-
export const useLinkQuery = (
|
|
16
|
+
export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
16
17
|
const { t } = useTranslation();
|
|
17
18
|
|
|
18
19
|
const manager = usePluginManager();
|
|
19
20
|
const resolve = useCallback(
|
|
20
21
|
(typename: string) =>
|
|
21
|
-
manager.
|
|
22
|
+
manager.capabilities.getAll(Common.Capability.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
22
23
|
[manager],
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
const objectForms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
26
|
-
const schemaWhiteList = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
27
26
|
const filter = useMemo(
|
|
28
27
|
() =>
|
|
29
28
|
Filter.or(
|
|
30
|
-
...
|
|
31
|
-
|
|
29
|
+
...(db?.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync() ?? [])
|
|
30
|
+
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
31
|
+
.filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))
|
|
32
|
+
.map((schema) => Filter.typename(Type.getTypename(schema))),
|
|
32
33
|
),
|
|
33
|
-
[
|
|
34
|
+
[db],
|
|
34
35
|
);
|
|
35
36
|
|
|
36
37
|
const handleLinkQuery = useCallback(
|
|
37
|
-
async (query?: string): Promise<
|
|
38
|
+
async (query?: string): Promise<EditorMenuGroup[]> => {
|
|
38
39
|
const name = query?.startsWith('@') ? query.slice(1).toLowerCase() : (query?.toLowerCase() ?? '');
|
|
39
|
-
const results = await
|
|
40
|
+
const results = await db?.query(Query.select(filter)).run();
|
|
40
41
|
|
|
41
|
-
// TODO(wittjosiah): Use `Obj.
|
|
42
|
+
// TODO(wittjosiah): Use `Obj.Unknown` type.
|
|
42
43
|
const getLabel = (object: any) => {
|
|
43
44
|
const label = Obj.getLabel(object);
|
|
44
45
|
if (label) {
|
|
@@ -52,17 +53,17 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
const items =
|
|
55
|
-
results
|
|
56
|
-
|
|
56
|
+
results
|
|
57
|
+
?.filter((object) => toLocalizedString(getLabel(object), t).toLowerCase().includes(name))
|
|
57
58
|
// TODO(wittjosiah): Remove `any` type.
|
|
58
|
-
.map((object: any):
|
|
59
|
+
.map((object: any): EditorMenuItem => {
|
|
59
60
|
const metadata = resolve(Obj.getTypename(object)!);
|
|
60
61
|
const label = toLocalizedString(getLabel(object), t);
|
|
61
62
|
return {
|
|
62
63
|
id: object.id,
|
|
63
64
|
label,
|
|
64
65
|
icon: metadata.icon,
|
|
65
|
-
onSelect: (view, head) => {
|
|
66
|
+
onSelect: ({ view, head }) => {
|
|
66
67
|
const link = `[${label}](${Obj.getDXN(object)})`;
|
|
67
68
|
if (query?.startsWith('@')) {
|
|
68
69
|
insertAtLineStart(view, head, `!${link}\n`);
|
|
@@ -75,7 +76,7 @@ export const useLinkQuery = (space: Space | undefined) => {
|
|
|
75
76
|
|
|
76
77
|
return [{ id: 'echo', items }];
|
|
77
78
|
},
|
|
78
|
-
[
|
|
79
|
+
[db, filter, resolve],
|
|
79
80
|
);
|
|
80
81
|
|
|
81
82
|
return handleLinkQuery;
|