@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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import {
|
|
10
|
+
type SurfaceComponentProps,
|
|
11
|
+
useAtomCapability,
|
|
12
|
+
useAtomCapabilityState,
|
|
13
|
+
useCapability,
|
|
14
|
+
useSettingsState,
|
|
15
|
+
} from '@dxos/app-framework/react';
|
|
16
|
+
import { Obj } from '@dxos/echo';
|
|
17
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
18
|
+
import { Text } from '@dxos/schema';
|
|
19
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
20
|
+
|
|
21
|
+
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../components';
|
|
22
|
+
import { meta } from '../../meta';
|
|
23
|
+
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
24
|
+
|
|
25
|
+
export default Capability.makeModule(() =>
|
|
26
|
+
Effect.succeed(
|
|
27
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
28
|
+
Common.createSurface({
|
|
29
|
+
id: `${meta.id}/surface/document`,
|
|
30
|
+
role: ['article', 'section', 'tabpanel'],
|
|
31
|
+
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
32
|
+
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
33
|
+
component: ({ data, role, ref }) => {
|
|
34
|
+
return <Container id={Obj.getDXN(data.subject).toString()} subject={data.subject} role={role} ref={ref} />;
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
Common.createSurface({
|
|
38
|
+
id: `${meta.id}/surface/text`,
|
|
39
|
+
role: ['article', 'section', 'tabpanel'],
|
|
40
|
+
filter: (data): data is { id: string; subject: Text.Text } =>
|
|
41
|
+
typeof data.id === 'string' && Obj.instanceOf(Text.Text, data.subject),
|
|
42
|
+
component: ({ data, role }) => {
|
|
43
|
+
return <Container id={data.id} subject={data.subject} role={role} />;
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
Common.createSurface({
|
|
47
|
+
id: `${meta.id}/surface/plugin-settings`,
|
|
48
|
+
role: 'article',
|
|
49
|
+
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
50
|
+
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
51
|
+
component: ({ data: { subject } }) => {
|
|
52
|
+
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
53
|
+
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
Common.createSurface({
|
|
57
|
+
id: `${meta.id}/surface/preview`,
|
|
58
|
+
role: 'card--content',
|
|
59
|
+
filter: (data): data is { subject: Markdown.Document | Text.Text } =>
|
|
60
|
+
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(Text.Text, data.subject),
|
|
61
|
+
component: ({ data }) => <MarkdownCard {...data} />,
|
|
62
|
+
}),
|
|
63
|
+
]),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Common wrapper.
|
|
69
|
+
*/
|
|
70
|
+
const Container = forwardRef<HTMLDivElement, SurfaceComponentProps<Markdown.Document | Text.Text, { id: string }>>(
|
|
71
|
+
({ id, subject, role }, forwardedRef) => {
|
|
72
|
+
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
73
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
74
|
+
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
75
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
76
|
+
const extensions = useCapability(MarkdownCapabilities.Extensions);
|
|
77
|
+
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
78
|
+
|
|
79
|
+
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
80
|
+
const handleViewModeChange = useCallback<NonNullable<MarkdownContainerProps['onViewModeChange']>>(
|
|
81
|
+
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
82
|
+
[id, setState],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<MarkdownContainer
|
|
87
|
+
role={role}
|
|
88
|
+
subject={subject}
|
|
89
|
+
id={id}
|
|
90
|
+
settings={settings}
|
|
91
|
+
selectionManager={selectionManager}
|
|
92
|
+
extensionProviders={extensionProviders}
|
|
93
|
+
editorStateStore={editorState}
|
|
94
|
+
viewMode={viewMode}
|
|
95
|
+
onViewModeChange={handleViewModeChange}
|
|
96
|
+
ref={forwardedRef}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.sync(() => {
|
|
15
|
+
const settingsAtom = createKvsStore({
|
|
16
|
+
key: meta.id,
|
|
17
|
+
schema: Markdown.Settings,
|
|
18
|
+
defaultValue: () => ({
|
|
19
|
+
defaultViewMode: 'preview' as const,
|
|
20
|
+
toolbar: true,
|
|
21
|
+
numberedHeadings: true,
|
|
22
|
+
folding: true,
|
|
23
|
+
experimental: false,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return [
|
|
28
|
+
Capability.contributes(MarkdownCapabilities.Settings, settingsAtom),
|
|
29
|
+
Capability.contributes(Common.Capability.Settings, {
|
|
30
|
+
prefix: meta.id,
|
|
31
|
+
schema: Markdown.Settings,
|
|
32
|
+
atom: settingsAtom,
|
|
33
|
+
}),
|
|
34
|
+
];
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
import { createEditorStateStore } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
import { MarkdownCapabilities, MarkdownStateSchema } from '../../types';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
// Persisted state using KVS store.
|
|
17
|
+
const stateAtom = createKvsStore({
|
|
18
|
+
key: `${meta.id}/state`,
|
|
19
|
+
schema: MarkdownStateSchema,
|
|
20
|
+
defaultValue: () => ({ viewMode: {} }),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// TODO(wittjosiah): Fold into state.
|
|
24
|
+
const editorState = createEditorStateStore(`${meta.id}/editor`);
|
|
25
|
+
|
|
26
|
+
return [
|
|
27
|
+
Capability.contributes(MarkdownCapabilities.State, stateAtom),
|
|
28
|
+
Capability.contributes(MarkdownCapabilities.EditorState, editorState),
|
|
29
|
+
];
|
|
30
|
+
}),
|
|
31
|
+
);
|
package/src/cli/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
|
|
11
|
+
// NOTE: Must not import from index to avoid pulling in react dependencies.
|
|
12
|
+
import { OperationResolver } from '../capabilities/operation-resolver';
|
|
13
|
+
import { meta } from '../meta';
|
|
14
|
+
import { Markdown } from '../types';
|
|
15
|
+
|
|
16
|
+
export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
17
|
+
Common.Plugin.addSchemaModule({ schema: [Markdown.Document, Text.Text] }),
|
|
18
|
+
Common.Plugin.addMetadataModule({
|
|
19
|
+
metadata: {
|
|
20
|
+
id: Markdown.Document.typename,
|
|
21
|
+
metadata: {
|
|
22
|
+
createObject: ((props) => Effect.sync(() => Markdown.make(props))) satisfies CreateObject,
|
|
23
|
+
addToCollectionOnCreate: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
Common.Plugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
28
|
+
Plugin.make,
|
|
29
|
+
);
|
|
@@ -3,35 +3,45 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
-
import { CardContainer } from '@dxos/react-ui-
|
|
13
|
+
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
14
14
|
|
|
15
15
|
import { translations } from '../../translations';
|
|
16
16
|
|
|
17
|
-
import { MarkdownCard } from './MarkdownCard';
|
|
17
|
+
import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
18
18
|
|
|
19
19
|
faker.seed(1234);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
22
|
+
const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
23
|
+
const subject = useMemo(
|
|
24
|
+
() =>
|
|
25
|
+
Markdown.make({
|
|
26
|
+
name: faker.lorem.words(3),
|
|
27
|
+
content: faker.lorem.paragraphs(3),
|
|
28
|
+
}),
|
|
29
|
+
[],
|
|
30
|
+
);
|
|
31
|
+
return (
|
|
32
|
+
<CardContainer icon='ph--text-aa--regular'>
|
|
33
|
+
<MarkdownCard subject={subject} {...args} />
|
|
34
|
+
</CardContainer>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const meta: Meta<typeof MarkdownCardStory> = {
|
|
22
39
|
title: 'plugins/plugin-markdown/Card',
|
|
23
|
-
component:
|
|
24
|
-
render: ({ role, subject, ...args }) => {
|
|
25
|
-
return (
|
|
26
|
-
<CardContainer icon='ph--text-aa--regular' role={role}>
|
|
27
|
-
<MarkdownCard role={role} subject={subject} {...args} />
|
|
28
|
-
</CardContainer>
|
|
29
|
-
);
|
|
30
|
-
},
|
|
40
|
+
component: MarkdownCardStory,
|
|
31
41
|
decorators: [
|
|
32
42
|
withTheme,
|
|
33
43
|
withPluginManager({
|
|
34
|
-
plugins: [
|
|
44
|
+
plugins: [OperationPlugin()],
|
|
35
45
|
}),
|
|
36
46
|
],
|
|
37
47
|
parameters: {
|
|
@@ -45,32 +55,4 @@ export default meta;
|
|
|
45
55
|
|
|
46
56
|
type Story = StoryObj<typeof meta>;
|
|
47
57
|
|
|
48
|
-
export const
|
|
49
|
-
args: {
|
|
50
|
-
role: 'card--popover',
|
|
51
|
-
subject: Markdown.makeDocument({
|
|
52
|
-
name: faker.lorem.words(3),
|
|
53
|
-
content: faker.lorem.paragraphs(3),
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const Intrinsic: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
role: 'card--intrinsic',
|
|
61
|
-
subject: Markdown.makeDocument({
|
|
62
|
-
name: faker.lorem.words(3),
|
|
63
|
-
content: faker.lorem.paragraphs(3),
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Extrinsic: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
role: 'card--extrinsic',
|
|
71
|
-
subject: Markdown.makeDocument({
|
|
72
|
-
name: faker.lorem.words(3),
|
|
73
|
-
content: faker.lorem.paragraphs(3),
|
|
74
|
-
}),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
58
|
+
export const Default: Story = {};
|
|
@@ -2,84 +2,63 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
7
6
|
|
|
8
|
-
import { LayoutAction, chain, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
7
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Card } from '@dxos/react-ui-stack';
|
|
14
|
-
import { DataType } from '@dxos/schema';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Card } from '@dxos/react-ui-mosaic';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
15
11
|
|
|
16
12
|
import { meta } from '../../meta';
|
|
17
13
|
import { Markdown } from '../../types';
|
|
18
14
|
import { getContentSnippet, getFallbackName } from '../../util';
|
|
15
|
+
import { MarkdownEditor } from '../MarkdownEditor';
|
|
19
16
|
|
|
20
|
-
export type MarkdownCardProps =
|
|
17
|
+
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
21
18
|
|
|
22
|
-
export const MarkdownCard = ({ subject
|
|
23
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
19
|
+
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
24
20
|
const { t } = useTranslation(meta.id);
|
|
25
|
-
const snippet = getSnippet(subject,
|
|
21
|
+
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
26
22
|
const info = getInfo(subject);
|
|
27
23
|
|
|
28
|
-
// TODO(wittjosiah): Factor out so this component isn't dependent on the app framework.
|
|
29
|
-
const handleNavigate = useCallback(
|
|
30
|
-
() =>
|
|
31
|
-
dispatch(
|
|
32
|
-
Function.pipe(
|
|
33
|
-
createIntent(LayoutAction.UpdatePopover, {
|
|
34
|
-
part: 'popover',
|
|
35
|
-
subject: null,
|
|
36
|
-
options: { state: false, anchorId: '' },
|
|
37
|
-
}),
|
|
38
|
-
chain(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(subject)] }),
|
|
39
|
-
),
|
|
40
|
-
),
|
|
41
|
-
[dispatch, subject],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
24
|
return (
|
|
45
|
-
<Card.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Card.Text>
|
|
60
|
-
</Card.SurfaceRoot>
|
|
25
|
+
<Card.Content>
|
|
26
|
+
{snippet && (
|
|
27
|
+
<Card.Row className='max-h-[300px] overflow-hidden'>
|
|
28
|
+
<MarkdownEditor.Root id={subject.id} viewMode='readonly'>
|
|
29
|
+
<MarkdownEditor.Content initialValue={snippet} slots={{}} classNames='!bg-transparent' />
|
|
30
|
+
</MarkdownEditor.Root>
|
|
31
|
+
</Card.Row>
|
|
32
|
+
)}
|
|
33
|
+
<Card.Row>
|
|
34
|
+
<Card.Text classNames='text-xs text-description'>
|
|
35
|
+
{info.words} {t('words label', { count: info.words })}
|
|
36
|
+
</Card.Text>
|
|
37
|
+
</Card.Row>
|
|
38
|
+
</Card.Content>
|
|
61
39
|
);
|
|
62
40
|
};
|
|
63
41
|
|
|
64
|
-
const getInfo = (subject: Markdown.Document |
|
|
42
|
+
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
65
43
|
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
66
44
|
return { words: text.split(' ').length };
|
|
67
45
|
};
|
|
68
46
|
|
|
69
47
|
// TODO(burdon): Factor out.
|
|
70
|
-
const getTitle = (subject: Markdown.Document |
|
|
48
|
+
const getTitle = (subject: Markdown.Document | Text.Text, fallback: string) => {
|
|
71
49
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
const title = Obj.getLabel(subject);
|
|
51
|
+
return title ?? getFallbackName(subject.content?.target?.content ?? fallback);
|
|
52
|
+
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
74
53
|
return getFallbackName(subject.content);
|
|
75
54
|
}
|
|
76
55
|
};
|
|
77
56
|
|
|
78
57
|
// TODO(burdon): Factor out.
|
|
79
|
-
const getSnippet = (subject: Markdown.Document |
|
|
58
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
80
59
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
81
60
|
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback);
|
|
82
|
-
} else if (Obj.instanceOf(
|
|
61
|
+
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
83
62
|
return getContentSnippet(subject.content ?? fallback);
|
|
84
63
|
}
|
|
85
64
|
};
|
|
@@ -3,34 +3,24 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
IntentPlugin,
|
|
11
|
-
LayoutAction,
|
|
12
|
-
SettingsPlugin,
|
|
13
|
-
Surface,
|
|
14
|
-
createIntent,
|
|
15
|
-
useIntentDispatcher,
|
|
16
|
-
} from '@dxos/app-framework';
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/react';
|
|
17
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
18
12
|
import { Obj, Query } from '@dxos/echo';
|
|
19
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
20
13
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
21
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
22
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
23
|
-
import {
|
|
24
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
25
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
26
16
|
import { faker } from '@dxos/random';
|
|
27
|
-
import {
|
|
17
|
+
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
28
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
29
19
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
30
20
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
31
|
-
import {
|
|
32
|
-
import { DataType } from '@dxos/schema';
|
|
21
|
+
import { Text } from '@dxos/schema';
|
|
33
22
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
23
|
+
import { Organization, Person } from '@dxos/types';
|
|
34
24
|
|
|
35
25
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
36
26
|
import { translations } from '../translations';
|
|
@@ -41,18 +31,18 @@ faker.seed(1);
|
|
|
41
31
|
const generator: ValueGenerator = faker as any;
|
|
42
32
|
|
|
43
33
|
const DefaultStory = () => {
|
|
44
|
-
const {
|
|
34
|
+
const { invokePromise } = useOperationInvoker();
|
|
45
35
|
const space = useSpace();
|
|
46
|
-
const [doc] = useQuery(space, Query.type(Markdown.Document));
|
|
36
|
+
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
47
37
|
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
48
|
-
const id = doc &&
|
|
38
|
+
const id = doc && Obj.getDXN(doc).toString();
|
|
49
39
|
const attentionAttrs = useAttentionAttributes(id);
|
|
50
40
|
|
|
51
41
|
useAsyncEffect(async () => {
|
|
52
42
|
if (space) {
|
|
53
|
-
await
|
|
43
|
+
await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: space.id });
|
|
54
44
|
}
|
|
55
|
-
}, [space,
|
|
45
|
+
}, [space, invokePromise]);
|
|
56
46
|
|
|
57
47
|
return (
|
|
58
48
|
<div className='contents' {...attentionAttrs}>
|
|
@@ -66,55 +56,51 @@ const meta = {
|
|
|
66
56
|
render: DefaultStory,
|
|
67
57
|
decorators: [
|
|
68
58
|
withTheme,
|
|
69
|
-
withLayout({
|
|
59
|
+
withLayout({ layout: 'column' }),
|
|
70
60
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
71
61
|
plugins: [
|
|
62
|
+
...corePlugins(),
|
|
63
|
+
StorybookPlugin({}),
|
|
72
64
|
ClientPlugin({
|
|
73
|
-
types: [Markdown.Document,
|
|
74
|
-
onClientInitialized:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
65
|
+
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
66
|
+
onClientInitialized: ({ client }) =>
|
|
67
|
+
Effect.gen(function* () {
|
|
68
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
69
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
70
|
+
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
71
|
+
|
|
72
|
+
const space = client.spaces.default;
|
|
73
|
+
const createObjects = createObjectFactory(space.db, generator);
|
|
74
|
+
yield* Effect.promise(() => createObjects([{ type: Organization.Organization, count: 10 }]));
|
|
75
|
+
|
|
76
|
+
const queue = space.queues.create();
|
|
77
|
+
const kai = Obj.make(Person.Person, { fullName: 'Kai' });
|
|
78
|
+
const dxos = Obj.make(Organization.Organization, { name: 'DXOS' });
|
|
79
|
+
yield* Effect.promise(() => queue.append([kai, dxos]));
|
|
80
|
+
|
|
81
|
+
space.db.add(
|
|
82
|
+
Markdown.make({
|
|
83
|
+
name: context.args.title ?? 'Testing',
|
|
84
|
+
content: [
|
|
85
|
+
`# ${context.args.title ?? 'Testing'}`,
|
|
86
|
+
context.args.content ?? '',
|
|
87
|
+
// TODO(burdon): Popovers not currently working.
|
|
88
|
+
'## Here are some objects',
|
|
89
|
+
`})`,
|
|
90
|
+
`})`,
|
|
91
|
+
'',
|
|
92
|
+
'END',
|
|
93
|
+
'',
|
|
94
|
+
].join('\n\n'),
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
yield* Effect.promise(() => space.db.flush({ indexes: true }));
|
|
99
|
+
}),
|
|
107
100
|
}),
|
|
108
|
-
|
|
109
|
-
GraphPlugin(),
|
|
110
|
-
IntentPlugin(),
|
|
111
|
-
SettingsPlugin(),
|
|
112
|
-
// UI
|
|
113
|
-
ThemePlugin({ tx: defaultTx }),
|
|
114
|
-
AttentionPlugin(),
|
|
101
|
+
|
|
115
102
|
MarkdownPlugin(),
|
|
116
103
|
PreviewPlugin(),
|
|
117
|
-
StorybookLayoutPlugin({}),
|
|
118
104
|
],
|
|
119
105
|
})),
|
|
120
106
|
],
|
|
@@ -123,7 +109,7 @@ const meta = {
|
|
|
123
109
|
controls: { disable: true },
|
|
124
110
|
translations,
|
|
125
111
|
},
|
|
126
|
-
} satisfies Meta<typeof
|
|
112
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
127
113
|
|
|
128
114
|
export default meta;
|
|
129
115
|
|