@dxos/plugin-markdown 0.8.3-staging.0fa589b → 0.8.4-main.1da679c
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/{MarkdownPreview-F4PYFW5L.mjs → MarkdownCard-JLUQITYK.mjs} +18 -18
- package/dist/lib/browser/MarkdownCard-JLUQITYK.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownContainer-EFWQ6DHD.mjs → MarkdownContainer-OZ5DHEIA.mjs} +282 -302
- package/dist/lib/browser/MarkdownContainer-OZ5DHEIA.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-BMAN2ABT.mjs → anchor-sort-SUD373SW.mjs} +8 -8
- package/dist/lib/browser/anchor-sort-SUD373SW.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-EI6TEHRQ.mjs → app-graph-serializer-GH7JJZB7.mjs} +16 -17
- package/dist/lib/browser/app-graph-serializer-GH7JJZB7.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-JSNGFAZB.mjs +11 -0
- package/dist/lib/browser/blueprint-definition-JSNGFAZB.mjs.map +7 -0
- package/dist/lib/browser/chunk-BEE7VQPU.mjs +78 -0
- package/dist/lib/browser/chunk-BEE7VQPU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LXSRQPEP.mjs → chunk-LAVZ2W6X.mjs} +9 -10
- package/dist/lib/browser/chunk-LAVZ2W6X.mjs.map +7 -0
- package/dist/lib/browser/chunk-ODB2PTBP.mjs +28 -0
- package/dist/lib/browser/chunk-ODB2PTBP.mjs.map +7 -0
- package/dist/lib/browser/chunk-OY6CGPOO.mjs +16 -0
- package/dist/lib/browser/chunk-OY6CGPOO.mjs.map +7 -0
- package/dist/lib/browser/chunk-SQLSKQRQ.mjs +22 -0
- package/dist/lib/browser/chunk-SQLSKQRQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-UM2GILLR.mjs +102 -0
- package/dist/lib/browser/chunk-UM2GILLR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-D767LUGU.mjs → chunk-Z7P6JGGW.mjs} +14 -12
- package/dist/lib/browser/chunk-Z7P6JGGW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +38 -25
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-SUBIHVU7.mjs +62 -0
- package/dist/lib/browser/intent-resolver-SUBIHVU7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/{node-esm/react-surface-YHFOQTVO.mjs → browser/react-surface-JBQHF4GR.mjs} +64 -55
- package/dist/lib/browser/react-surface-JBQHF4GR.mjs.map +7 -0
- package/dist/lib/browser/{settings-PLH54VC7.mjs → settings-T5ZMC5TH.mjs} +8 -8
- package/dist/lib/browser/settings-T5ZMC5TH.mjs.map +7 -0
- package/dist/lib/browser/{state-KI6PJ6DT.mjs → state-6QODXCSZ.mjs} +10 -10
- package/dist/lib/browser/state-6QODXCSZ.mjs.map +7 -0
- package/dist/lib/browser/toolkit-GNADYSGW.mjs +74 -0
- package/dist/lib/browser/toolkit-GNADYSGW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -14
- package/dist/lib/node-esm/{MarkdownPreview-KFDRV4GC.mjs → MarkdownCard-XL5EVSJ7.mjs} +18 -18
- package/dist/lib/node-esm/MarkdownCard-XL5EVSJ7.mjs.map +7 -0
- package/dist/lib/node-esm/{MarkdownContainer-O3SGMH4G.mjs → MarkdownContainer-Z4I23DPN.mjs} +282 -302
- package/dist/lib/node-esm/MarkdownContainer-Z4I23DPN.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-BXL7BE67.mjs → anchor-sort-J2BK2XLZ.mjs} +8 -8
- package/dist/lib/node-esm/anchor-sort-J2BK2XLZ.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-F7DGNF3G.mjs → app-graph-serializer-LRYCXG7N.mjs} +16 -17
- package/dist/lib/node-esm/app-graph-serializer-LRYCXG7N.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-KX3Y5JHC.mjs +12 -0
- package/dist/lib/node-esm/blueprint-definition-KX3Y5JHC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs +17 -0
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FXILAQ5F.mjs +79 -0
- package/dist/lib/node-esm/chunk-FXILAQ5F.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BWDDFDJY.mjs → chunk-J7A6TUB2.mjs} +14 -12
- package/dist/lib/node-esm/chunk-J7A6TUB2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KAXL7TWD.mjs +103 -0
- package/dist/lib/node-esm/chunk-KAXL7TWD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MJZPYYIH.mjs +24 -0
- package/dist/lib/node-esm/chunk-MJZPYYIH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K26TX5V4.mjs → chunk-O6EXWGGS.mjs} +9 -10
- package/dist/lib/node-esm/chunk-O6EXWGGS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VCG2U522.mjs +29 -0
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +38 -25
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-YZEGYWGA.mjs +63 -0
- package/dist/lib/node-esm/intent-resolver-YZEGYWGA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/{browser/react-surface-4B5ELMEW.mjs → node-esm/react-surface-JOXUHXQJ.mjs} +65 -54
- package/dist/lib/node-esm/react-surface-JOXUHXQJ.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-SIY33P3F.mjs → settings-LGG22OH4.mjs} +8 -8
- package/dist/lib/node-esm/settings-LGG22OH4.mjs.map +7 -0
- package/dist/lib/node-esm/{state-LLGVRYKL.mjs → state-W3PECOJX.mjs} +10 -10
- package/dist/lib/node-esm/state-W3PECOJX.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-ZCFWOGNH.mjs +75 -0
- package/dist/lib/node-esm/toolkit-ZCFWOGNH.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -14
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +2 -2
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -9
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +12 -10
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +7 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +10 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts +4 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownContainer.d.ts +5 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +51 -4
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +110 -12
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +2 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +3 -3
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +44 -7
- package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/extensions.d.ts +3 -5
- package/dist/types/src/extensions.d.ts.map +1 -1
- package/dist/types/src/functions/diff.d.ts +6 -0
- package/dist/types/src/functions/diff.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +7 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +36 -80
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +43 -0
- package/dist/types/src/types/Markdown.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownAction.d.ts +33 -0
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +4 -59
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +12 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -48
- package/src/MarkdownPlugin.tsx +22 -13
- package/src/capabilities/anchor-sort.ts +3 -3
- package/src/capabilities/app-graph-serializer.ts +10 -8
- package/src/capabilities/artifact-definition.ts +19 -24
- package/src/capabilities/blueprint-definition.ts +39 -0
- package/src/capabilities/capabilities.ts +5 -4
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/intent-resolver.ts +15 -21
- package/src/capabilities/react-surface.tsx +22 -20
- package/src/capabilities/settings.ts +3 -3
- package/src/capabilities/state.ts +8 -8
- package/src/capabilities/toolkit.ts +47 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +79 -0
- package/src/components/{MarkdownPreview/MarkdownPreview.tsx → MarkdownCard/MarkdownCard.tsx} +21 -17
- package/src/components/MarkdownCard/index.ts +9 -0
- package/src/components/MarkdownContainer.stories.tsx +39 -31
- package/src/components/MarkdownContainer.tsx +36 -21
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +10 -7
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +28 -30
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +81 -78
- package/src/components/Suggestions.stories.tsx +36 -33
- package/src/components/Toolbar.stories.tsx +19 -14
- package/src/components/index.ts +1 -1
- package/src/events.ts +2 -2
- package/src/extensions.tsx +28 -52
- package/src/functions/diff.ts +35 -0
- package/src/functions/index.ts +6 -0
- package/src/functions/open.ts +30 -0
- package/src/hooks/useSelectCurrentThread.tsx +3 -3
- package/src/index.ts +4 -1
- package/src/meta.ts +7 -8
- package/src/translations.ts +10 -7
- package/src/types/Markdown.ts +56 -0
- package/src/types/MarkdownAction.ts +29 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +7 -51
- package/src/util.tsx +20 -6
- package/dist/lib/browser/MarkdownContainer-EFWQ6DHD.mjs.map +0 -7
- package/dist/lib/browser/MarkdownPreview-F4PYFW5L.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-BMAN2ABT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-EI6TEHRQ.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-FQ2R6KPT.mjs +0 -145
- package/dist/lib/browser/artifact-definition-FQ2R6KPT.mjs.map +0 -7
- package/dist/lib/browser/chunk-354IBM5X.mjs +0 -20
- package/dist/lib/browser/chunk-354IBM5X.mjs.map +0 -7
- package/dist/lib/browser/chunk-D767LUGU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JX6XNEHE.mjs +0 -22
- package/dist/lib/browser/chunk-JX6XNEHE.mjs.map +0 -7
- package/dist/lib/browser/chunk-LXSRQPEP.mjs.map +0 -7
- package/dist/lib/browser/chunk-N2D26K6W.mjs +0 -79
- package/dist/lib/browser/chunk-N2D26K6W.mjs.map +0 -7
- package/dist/lib/browser/chunk-QVJETNGS.mjs +0 -16
- package/dist/lib/browser/chunk-QVJETNGS.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6ZOABX2J.mjs +0 -64
- package/dist/lib/browser/intent-resolver-6ZOABX2J.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4B5ELMEW.mjs.map +0 -7
- package/dist/lib/browser/settings-PLH54VC7.mjs.map +0 -7
- package/dist/lib/browser/state-KI6PJ6DT.mjs.map +0 -7
- package/dist/lib/node/MarkdownContainer-KYGUEZIL.cjs +0 -783
- package/dist/lib/node/MarkdownContainer-KYGUEZIL.cjs.map +0 -7
- package/dist/lib/node/MarkdownPreview-GCJJCXY6.cjs +0 -103
- package/dist/lib/node/MarkdownPreview-GCJJCXY6.cjs.map +0 -7
- package/dist/lib/node/anchor-sort-V3T4SFFI.cjs +0 -48
- package/dist/lib/node/anchor-sort-V3T4SFFI.cjs.map +0 -7
- package/dist/lib/node/app-graph-serializer-E6BXEDEL.cjs +0 -65
- package/dist/lib/node/app-graph-serializer-E6BXEDEL.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-U27MH5SC.cjs +0 -158
- package/dist/lib/node/artifact-definition-U27MH5SC.cjs.map +0 -7
- package/dist/lib/node/chunk-3HHV4MM6.cjs +0 -101
- package/dist/lib/node/chunk-3HHV4MM6.cjs.map +0 -7
- package/dist/lib/node/chunk-CJLYFGPI.cjs +0 -74
- package/dist/lib/node/chunk-CJLYFGPI.cjs.map +0 -7
- package/dist/lib/node/chunk-FU3XZZCO.cjs +0 -58
- package/dist/lib/node/chunk-FU3XZZCO.cjs.map +0 -7
- package/dist/lib/node/chunk-IFYSBQE5.cjs +0 -35
- package/dist/lib/node/chunk-IFYSBQE5.cjs.map +0 -7
- package/dist/lib/node/chunk-LQAC5HL7.cjs +0 -68
- package/dist/lib/node/chunk-LQAC5HL7.cjs.map +0 -7
- package/dist/lib/node/chunk-ZU5OIHCY.cjs +0 -45
- package/dist/lib/node/chunk-ZU5OIHCY.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -165
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-OEFLRNEJ.cjs +0 -77
- package/dist/lib/node/intent-resolver-OEFLRNEJ.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-456HQ4KZ.cjs +0 -218
- package/dist/lib/node/react-surface-456HQ4KZ.cjs.map +0 -7
- package/dist/lib/node/settings-E3NUTXJ4.cjs +0 -42
- package/dist/lib/node/settings-E3NUTXJ4.cjs.map +0 -7
- package/dist/lib/node/state-KKDRAG7X.cjs +0 -51
- package/dist/lib/node/state-KKDRAG7X.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -40
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-O3SGMH4G.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownPreview-KFDRV4GC.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-BXL7BE67.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-F7DGNF3G.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-NQOHB6S5.mjs +0 -146
- package/dist/lib/node-esm/artifact-definition-NQOHB6S5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BWDDFDJY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JXXDCSMW.mjs +0 -17
- package/dist/lib/node-esm/chunk-JXXDCSMW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K26TX5V4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RX63ZNML.mjs +0 -24
- package/dist/lib/node-esm/chunk-RX63ZNML.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T2Y2BT53.mjs +0 -80
- package/dist/lib/node-esm/chunk-T2Y2BT53.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YOABAQ7A.mjs +0 -22
- package/dist/lib/node-esm/chunk-YOABAQ7A.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-CLMSVF2K.mjs +0 -65
- package/dist/lib/node-esm/intent-resolver-CLMSVF2K.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-YHFOQTVO.mjs.map +0 -7
- package/dist/lib/node-esm/settings-SIY33P3F.mjs.map +0 -7
- package/dist/lib/node-esm/state-LLGVRYKL.mjs.map +0 -7
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts +0 -6
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts +0 -17
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownPreview/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -35
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/MarkdownPreview/MarkdownPreview.stories.tsx +0 -74
- package/src/components/MarkdownPreview/index.ts +0 -9
- package/src/types/schema.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-markdown",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.1da679c",
|
|
4
4
|
"description": "DXOS Surface plugin for interacting with Markdown",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
17
18
|
"./types": {
|
|
19
|
+
"source": "./src/types/index.ts",
|
|
18
20
|
"types": "./dist/types/src/types/index.d.ts",
|
|
19
21
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
20
22
|
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
@@ -33,68 +35,69 @@
|
|
|
33
35
|
"src"
|
|
34
36
|
],
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@automerge/automerge": "3.
|
|
37
|
-
"@codemirror/search": "^6.5.
|
|
38
|
-
"@codemirror/view": "^6.
|
|
38
|
+
"@automerge/automerge": "3.1.1",
|
|
39
|
+
"@codemirror/search": "^6.5.11",
|
|
40
|
+
"@codemirror/view": "^6.38.2",
|
|
41
|
+
"@effect/ai": "0.25.2",
|
|
39
42
|
"@preact-signals/safe-react": "^0.9.0",
|
|
40
43
|
"@preact/signals-core": "^1.9.0",
|
|
41
44
|
"react-dropzone": "^14.2.3",
|
|
42
|
-
"@dxos/ai": "0.8.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/plugin-client": "0.8.
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/plugin-
|
|
59
|
-
"@dxos/plugin-graph": "0.8.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/plugin-
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-
|
|
64
|
-
"@dxos/react-
|
|
65
|
-
"@dxos/react-ui-
|
|
66
|
-
"@dxos/react-
|
|
67
|
-
"@dxos/react-ui-stack": "0.8.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
45
|
+
"@dxos/ai": "0.8.4-main.1da679c",
|
|
46
|
+
"@dxos/assistant": "0.8.4-main.1da679c",
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.1da679c",
|
|
48
|
+
"@dxos/async": "0.8.4-main.1da679c",
|
|
49
|
+
"@dxos/echo": "0.8.4-main.1da679c",
|
|
50
|
+
"@dxos/echo-db": "0.8.4-main.1da679c",
|
|
51
|
+
"@dxos/blueprints": "0.8.4-main.1da679c",
|
|
52
|
+
"@dxos/echo-schema": "0.8.4-main.1da679c",
|
|
53
|
+
"@dxos/functions": "0.8.4-main.1da679c",
|
|
54
|
+
"@dxos/invariant": "0.8.4-main.1da679c",
|
|
55
|
+
"@dxos/lit-ui": "0.8.4-main.1da679c",
|
|
56
|
+
"@dxos/live-object": "0.8.4-main.1da679c",
|
|
57
|
+
"@dxos/keys": "0.8.4-main.1da679c",
|
|
58
|
+
"@dxos/local-storage": "0.8.4-main.1da679c",
|
|
59
|
+
"@dxos/plugin-client": "0.8.4-main.1da679c",
|
|
60
|
+
"@dxos/plugin-attention": "0.8.4-main.1da679c",
|
|
61
|
+
"@dxos/plugin-deck": "0.8.4-main.1da679c",
|
|
62
|
+
"@dxos/plugin-graph": "0.8.4-main.1da679c",
|
|
63
|
+
"@dxos/log": "0.8.4-main.1da679c",
|
|
64
|
+
"@dxos/plugin-space": "0.8.4-main.1da679c",
|
|
65
|
+
"@dxos/plugin-preview": "0.8.4-main.1da679c",
|
|
66
|
+
"@dxos/react-client": "0.8.4-main.1da679c",
|
|
67
|
+
"@dxos/react-hooks": "0.8.4-main.1da679c",
|
|
68
|
+
"@dxos/react-ui-attention": "0.8.4-main.1da679c",
|
|
69
|
+
"@dxos/react-ui-editor": "0.8.4-main.1da679c",
|
|
70
|
+
"@dxos/react-ui-stack": "0.8.4-main.1da679c",
|
|
71
|
+
"@dxos/react-ui-form": "0.8.4-main.1da679c",
|
|
72
|
+
"@dxos/schema": "0.8.4-main.1da679c",
|
|
73
|
+
"@dxos/util": "0.8.4-main.1da679c",
|
|
74
|
+
"@dxos/plugin-theme": "0.8.4-main.1da679c"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
72
|
-
"@effect-rx/rx-react": "
|
|
73
|
-
"@effect/platform": "0.
|
|
74
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
77
|
+
"@effect-rx/rx-react": "0.38.0",
|
|
78
|
+
"@effect/platform": "0.90.2",
|
|
75
79
|
"@types/react": "~18.2.0",
|
|
76
80
|
"@types/react-dom": "~18.2.0",
|
|
77
|
-
"effect": "3.
|
|
81
|
+
"effect": "3.17.7",
|
|
78
82
|
"react": "~18.2.0",
|
|
79
83
|
"react-dom": "~18.2.0",
|
|
80
|
-
"vite": "
|
|
81
|
-
"@dxos/debug": "0.8.
|
|
82
|
-
"@dxos/plugin-
|
|
83
|
-
"@dxos/plugin-
|
|
84
|
-
"@dxos/random": "0.8.
|
|
85
|
-
"@dxos/react-ui": "0.8.
|
|
86
|
-
"@dxos/react-ui-theme": "0.8.
|
|
87
|
-
"@dxos/storybook-utils": "0.8.
|
|
84
|
+
"vite": "7.1.1",
|
|
85
|
+
"@dxos/debug": "0.8.4-main.1da679c",
|
|
86
|
+
"@dxos/plugin-storybook-layout": "0.8.4-main.1da679c",
|
|
87
|
+
"@dxos/plugin-theme": "0.8.4-main.1da679c",
|
|
88
|
+
"@dxos/random": "0.8.4-main.1da679c",
|
|
89
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
90
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c",
|
|
91
|
+
"@dxos/storybook-utils": "0.8.4-main.1da679c"
|
|
88
92
|
},
|
|
89
93
|
"peerDependencies": {
|
|
90
94
|
"@effect-rx/rx-react": "^0.34.1",
|
|
91
|
-
"@effect/platform": "0.80.12",
|
|
92
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
95
|
+
"@effect/platform": "^0.80.12",
|
|
93
96
|
"effect": "^3.13.3",
|
|
94
97
|
"react": "~18.2.0",
|
|
95
98
|
"react-dom": "~18.2.0",
|
|
96
|
-
"@dxos/react-ui": "0.8.
|
|
97
|
-
"@dxos/react-ui-theme": "0.8.
|
|
99
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
100
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c"
|
|
98
101
|
},
|
|
99
102
|
"publishConfig": {
|
|
100
103
|
"access": "public"
|
package/src/MarkdownPlugin.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, createIntent, defineModule, definePlugin
|
|
5
|
+
import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
import { type Obj, Ref } from '@dxos/echo';
|
|
7
7
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
8
|
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
@@ -14,16 +14,18 @@ import { DataType } from '@dxos/schema';
|
|
|
14
14
|
import {
|
|
15
15
|
AnchorSort,
|
|
16
16
|
AppGraphSerializer,
|
|
17
|
-
|
|
17
|
+
BLUEPRINT_KEY,
|
|
18
|
+
BlueprintDefinition,
|
|
18
19
|
IntentResolver,
|
|
19
|
-
MarkdownState,
|
|
20
20
|
MarkdownSettings,
|
|
21
|
+
MarkdownState,
|
|
21
22
|
ReactSurface,
|
|
23
|
+
Toolkit,
|
|
22
24
|
} from './capabilities';
|
|
23
25
|
import { MarkdownEvents } from './events';
|
|
24
26
|
import { meta } from './meta';
|
|
25
|
-
import translations from './translations';
|
|
26
|
-
import {
|
|
27
|
+
import { translations } from './translations';
|
|
28
|
+
import { Markdown, MarkdownAction } from './types';
|
|
27
29
|
import { serializer } from './util';
|
|
28
30
|
|
|
29
31
|
export const MarkdownPlugin = () =>
|
|
@@ -51,20 +53,21 @@ export const MarkdownPlugin = () =>
|
|
|
51
53
|
activatesOn: Events.SetupMetadata,
|
|
52
54
|
activate: () =>
|
|
53
55
|
contributes(Capabilities.Metadata, {
|
|
54
|
-
id:
|
|
56
|
+
id: Markdown.Document.typename,
|
|
55
57
|
metadata: {
|
|
56
|
-
label: (object:
|
|
58
|
+
label: (object: Markdown.Document) => object.name || object.fallbackName,
|
|
57
59
|
icon: 'ph--text-aa--regular',
|
|
60
|
+
blueprints: [BLUEPRINT_KEY],
|
|
58
61
|
graphProps: {
|
|
59
62
|
managesAutofocus: true,
|
|
60
63
|
},
|
|
61
64
|
// TODO(wittjosiah): Move out of metadata.
|
|
62
|
-
loadReferences: async (doc:
|
|
65
|
+
loadReferences: async (doc: Markdown.Document) => await Ref.Array.loadAll<Obj.Any>([doc.content]),
|
|
63
66
|
serializer,
|
|
64
67
|
// TODO(wittjosiah): Consider how to do generic comments without these.
|
|
65
68
|
comments: 'anchored',
|
|
66
69
|
selectionMode: 'multi-range',
|
|
67
|
-
getAnchorLabel: (doc:
|
|
70
|
+
getAnchorLabel: (doc: Markdown.Document, anchor: string): string | undefined => {
|
|
68
71
|
if (doc.content) {
|
|
69
72
|
const [start, end] = anchor.split(':');
|
|
70
73
|
return getTextInRange(createDocAccessor(doc.content.target!, ['content']), start, end);
|
|
@@ -80,8 +83,8 @@ export const MarkdownPlugin = () =>
|
|
|
80
83
|
contributes(
|
|
81
84
|
SpaceCapabilities.ObjectForm,
|
|
82
85
|
defineObjectForm({
|
|
83
|
-
objectSchema:
|
|
84
|
-
getIntent: (
|
|
86
|
+
objectSchema: Markdown.Document,
|
|
87
|
+
getIntent: () => createIntent(MarkdownAction.Create, {}),
|
|
85
88
|
}),
|
|
86
89
|
),
|
|
87
90
|
}),
|
|
@@ -114,8 +117,14 @@ export const MarkdownPlugin = () =>
|
|
|
114
117
|
activate: AnchorSort,
|
|
115
118
|
}),
|
|
116
119
|
defineModule({
|
|
117
|
-
id: `${meta.id}/module/
|
|
120
|
+
id: `${meta.id}/module/blueprint`,
|
|
118
121
|
activatesOn: Events.SetupArtifactDefinition,
|
|
119
|
-
activate:
|
|
122
|
+
activate: BlueprintDefinition,
|
|
123
|
+
}),
|
|
124
|
+
defineModule({
|
|
125
|
+
id: `${meta.id}/module/toolkit`,
|
|
126
|
+
// TODO(wittjosiah): Use a different event.
|
|
127
|
+
activatesOn: Events.Startup,
|
|
128
|
+
activate: Toolkit,
|
|
120
129
|
}),
|
|
121
130
|
]);
|
|
@@ -6,13 +6,13 @@ import { Capabilities, contributes } from '@dxos/app-framework';
|
|
|
6
6
|
import { Type } from '@dxos/echo';
|
|
7
7
|
import { createDocAccessor, getRangeFromCursor, getTarget } from '@dxos/react-client/echo';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Markdown } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () =>
|
|
12
12
|
contributes(Capabilities.AnchorSort, {
|
|
13
|
-
key: Type.getTypename(
|
|
13
|
+
key: Type.getTypename(Markdown.Document)!,
|
|
14
14
|
sort: (anchorA, anchorB) => {
|
|
15
|
-
const doc = getTarget(anchorA) as
|
|
15
|
+
const doc = getTarget(anchorA) as Markdown.Document;
|
|
16
16
|
const accessor = doc.content.target ? createDocAccessor(doc.content.target, ['content']) : undefined;
|
|
17
17
|
if (doc !== getTarget(anchorB) || !accessor) {
|
|
18
18
|
return 0;
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import { pipe } from 'effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { Obj
|
|
7
|
+
import { Capabilities, type PluginContext, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
10
10
|
import { isSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { DataType } from '@dxos/schema';
|
|
12
12
|
|
|
13
|
-
import translations from '../translations';
|
|
14
|
-
import {
|
|
13
|
+
import { translations } from '../translations';
|
|
14
|
+
import { Markdown, MarkdownAction } from '../types';
|
|
15
15
|
|
|
16
16
|
export default (context: PluginContext) =>
|
|
17
17
|
contributes(Capabilities.AppGraphSerializer, [
|
|
18
18
|
{
|
|
19
|
-
inputType:
|
|
19
|
+
inputType: Markdown.Document.typename,
|
|
20
20
|
outputType: 'text/markdown',
|
|
21
21
|
// Reconcile with metadata serializers.
|
|
22
22
|
serialize: async (node) => {
|
|
@@ -24,7 +24,9 @@ export default (context: PluginContext) =>
|
|
|
24
24
|
const content = await doc.content.load();
|
|
25
25
|
return {
|
|
26
26
|
name:
|
|
27
|
-
doc.name ||
|
|
27
|
+
doc.name ||
|
|
28
|
+
doc.fallbackName ||
|
|
29
|
+
translations[0]['en-US'][Markdown.Document.typename]['object name placeholder'],
|
|
28
30
|
data: content.content,
|
|
29
31
|
type: 'text/markdown',
|
|
30
32
|
};
|
|
@@ -33,7 +35,7 @@ export default (context: PluginContext) =>
|
|
|
33
35
|
const space = ancestors.find(isSpace);
|
|
34
36
|
const target =
|
|
35
37
|
ancestors.findLast((ancestor) => Obj.instanceOf(DataType.Collection, ancestor)) ??
|
|
36
|
-
space?.properties[
|
|
38
|
+
space?.properties[DataType.Collection.typename]?.target;
|
|
37
39
|
if (!space || !target) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
@@ -41,7 +43,7 @@ export default (context: PluginContext) =>
|
|
|
41
43
|
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
42
44
|
const result = await dispatch(
|
|
43
45
|
pipe(
|
|
44
|
-
createIntent(MarkdownAction.Create, {
|
|
46
|
+
createIntent(MarkdownAction.Create, { name: data.name, content: data.data }),
|
|
45
47
|
chain(SpaceAction.AddObject, { target }),
|
|
46
48
|
),
|
|
47
49
|
);
|
|
@@ -2,38 +2,33 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { Schema, pipe } from 'effect';
|
|
9
|
+
|
|
10
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
11
|
+
import { Capabilities, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
12
|
+
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
13
|
+
import { defineArtifact } from '@dxos/blueprints';
|
|
11
14
|
import { Obj } from '@dxos/echo';
|
|
12
|
-
import {
|
|
15
|
+
import { assertArgument, invariant } from '@dxos/invariant';
|
|
13
16
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Filter, fullyQualifiedId
|
|
17
|
+
import { Filter, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
15
18
|
|
|
16
19
|
import { meta } from '../meta';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
// TODO(burdon): Factor out.
|
|
20
|
-
declare global {
|
|
21
|
-
interface ToolContextExtensions {
|
|
22
|
-
space?: Space;
|
|
23
|
-
dispatch?: PromiseIntentDispatcher;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
20
|
+
import { Markdown, MarkdownAction } from '../types';
|
|
26
21
|
|
|
27
22
|
export default () => {
|
|
28
23
|
const definition = defineArtifact({
|
|
29
|
-
id: `artifact:${meta.id}`,
|
|
24
|
+
id: `artifact:${meta.id}`, // TODO(burdon): meta.id/artifact?
|
|
30
25
|
name: meta.name,
|
|
31
26
|
instructions: `
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
The markdown plugin allows you to work with text documents in the current space.
|
|
28
|
+
Use these tools to interact with documents, including listing available documents and retrieving their content.
|
|
29
|
+
Documents are stored in Markdown format.
|
|
35
30
|
`,
|
|
36
|
-
schema:
|
|
31
|
+
schema: Markdown.Document,
|
|
37
32
|
tools: [
|
|
38
33
|
createTool(meta.id, {
|
|
39
34
|
name: 'create',
|
|
@@ -76,9 +71,9 @@ export default () => {
|
|
|
76
71
|
execute: async (_input, { extensions }) => {
|
|
77
72
|
invariant(extensions?.space, 'No space');
|
|
78
73
|
const space = extensions.space;
|
|
79
|
-
const { objects: documents } = await space.db.query(Filter.type(
|
|
74
|
+
const { objects: documents } = await space.db.query(Filter.type(Markdown.Document)).run();
|
|
80
75
|
const documentInfo = documents.map((doc) => {
|
|
81
|
-
invariant(Obj.instanceOf(
|
|
76
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
82
77
|
return {
|
|
83
78
|
id: fullyQualifiedId(doc),
|
|
84
79
|
name: doc.name || doc.fallbackName || 'Unnamed Document',
|
|
@@ -99,7 +94,7 @@ export default () => {
|
|
|
99
94
|
execute: async ({ id }, { extensions }) => {
|
|
100
95
|
invariant(extensions?.space, 'No space');
|
|
101
96
|
const document = await extensions.space.db.query(Filter.ids(ArtifactId.toDXN(id).toString())).first();
|
|
102
|
-
assertArgument(Obj.instanceOf(
|
|
97
|
+
assertArgument(Obj.instanceOf(Markdown.Document, document), 'document', 'Invalid type');
|
|
103
98
|
|
|
104
99
|
const { content } = await document.content?.load();
|
|
105
100
|
return ToolResult.Success({
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, type Capability, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
+
import { trim } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { diff, open } from '../functions';
|
|
11
|
+
|
|
12
|
+
const functions: FunctionDefinition[] = [diff, open];
|
|
13
|
+
const tools = ['add-proposals', 'create-document'];
|
|
14
|
+
|
|
15
|
+
export const BLUEPRINT_KEY = 'dxos.org/blueprint/markdown';
|
|
16
|
+
|
|
17
|
+
export default (): Capability<any>[] => [
|
|
18
|
+
contributes(Capabilities.Functions, functions),
|
|
19
|
+
contributes(
|
|
20
|
+
Capabilities.BlueprintDefinition,
|
|
21
|
+
Blueprint.make({
|
|
22
|
+
key: BLUEPRINT_KEY,
|
|
23
|
+
name: 'Markdown',
|
|
24
|
+
tools: Blueprint.toolDefinitions({ functions, tools }),
|
|
25
|
+
instructions: Template.make({
|
|
26
|
+
source: trim`
|
|
27
|
+
You can create and update markdown documents.
|
|
28
|
+
When asked to edit or update documents return updates as a set of compact diff string pairs.
|
|
29
|
+
For each diff, respond with the smallest possible matching span.
|
|
30
|
+
For example:
|
|
31
|
+
- "There is a tyop in this sentence."
|
|
32
|
+
+ "There is a typo in this sentence."
|
|
33
|
+
- "This id goof."
|
|
34
|
+
+ "This is good."
|
|
35
|
+
`,
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
39
|
+
];
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type
|
|
6
|
+
import { type EditorStateStore, type EditorViewMode } from '@dxos/react-ui-editor';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { meta } from '../meta';
|
|
9
9
|
import { type MarkdownExtensionProvider, type MarkdownPluginState } from '../types';
|
|
10
10
|
|
|
11
11
|
export namespace MarkdownCapabilities {
|
|
@@ -14,7 +14,8 @@ export namespace MarkdownCapabilities {
|
|
|
14
14
|
editorState: EditorStateStore;
|
|
15
15
|
getViewMode: (id: string) => EditorViewMode;
|
|
16
16
|
setViewMode: (id: string, viewMode: EditorViewMode) => void;
|
|
17
|
-
}>(`${
|
|
17
|
+
}>(`${meta.id}/capability/state`);
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
20
|
+
export const Extensions = defineCapability<MarkdownExtensionProvider[]>(`${meta.id}/capability/extensions`);
|
|
20
21
|
}
|
|
@@ -6,10 +6,12 @@ import { lazy } from '@dxos/app-framework';
|
|
|
6
6
|
|
|
7
7
|
export const AnchorSort = lazy(() => import('./anchor-sort'));
|
|
8
8
|
export const AppGraphSerializer = lazy(() => import('./app-graph-serializer'));
|
|
9
|
-
export const
|
|
9
|
+
export const BlueprintDefinition = lazy(() => import('./blueprint-definition'));
|
|
10
10
|
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
11
11
|
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
12
12
|
export const MarkdownSettings = lazy(() => import('./settings'));
|
|
13
13
|
export const MarkdownState = lazy(() => import('./state'));
|
|
14
|
+
export const Toolkit = lazy(() => import('./toolkit'));
|
|
14
15
|
|
|
16
|
+
export * from './blueprint-definition';
|
|
15
17
|
export * from './capabilities';
|
|
@@ -3,33 +3,28 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { next as A } from '@automerge/automerge';
|
|
6
|
-
import { Option,
|
|
6
|
+
import { Option, type Schema } from 'effect';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
10
10
|
CollaborationActions,
|
|
11
|
+
type PluginContext,
|
|
11
12
|
contributes,
|
|
12
13
|
createResolver,
|
|
13
|
-
type PluginContext,
|
|
14
14
|
} from '@dxos/app-framework';
|
|
15
15
|
import { Obj } from '@dxos/echo';
|
|
16
|
-
import { createDocAccessor, getRangeFromCursor
|
|
17
|
-
|
|
16
|
+
import { createDocAccessor, getRangeFromCursor } from '@dxos/react-client/echo';
|
|
17
|
+
|
|
18
|
+
import { Markdown, MarkdownAction } from '../types';
|
|
18
19
|
|
|
19
20
|
import { MarkdownCapabilities } from './capabilities';
|
|
20
|
-
import { DocumentType, MarkdownAction } from '../types';
|
|
21
21
|
|
|
22
22
|
export default (context: PluginContext) =>
|
|
23
23
|
contributes(Capabilities.IntentResolver, [
|
|
24
24
|
createResolver({
|
|
25
25
|
intent: MarkdownAction.Create,
|
|
26
26
|
resolve: ({ name, content }) => {
|
|
27
|
-
|
|
28
|
-
name,
|
|
29
|
-
content: Ref.make(Obj.make(DataType.Text, { content: content ?? '' })),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return { data: { object: doc } };
|
|
27
|
+
return { data: { object: Markdown.makeDocument({ name, content }) } };
|
|
33
28
|
},
|
|
34
29
|
}),
|
|
35
30
|
createResolver({
|
|
@@ -40,23 +35,22 @@ export default (context: PluginContext) =>
|
|
|
40
35
|
},
|
|
41
36
|
}),
|
|
42
37
|
createResolver({
|
|
43
|
-
intent: CollaborationActions.
|
|
38
|
+
intent: CollaborationActions.AcceptProposal,
|
|
44
39
|
filter: (
|
|
45
40
|
data,
|
|
46
|
-
): data is Omit<Schema.Schema.Type<typeof CollaborationActions.
|
|
47
|
-
|
|
48
|
-
} => Obj.instanceOf(
|
|
49
|
-
resolve: async ({
|
|
50
|
-
const text = await
|
|
41
|
+
): data is Omit<Schema.Schema.Type<typeof CollaborationActions.AcceptProposal.fields.input>, 'subject'> & {
|
|
42
|
+
subject: Markdown.Document;
|
|
43
|
+
} => Obj.instanceOf(Markdown.Document, data.subject),
|
|
44
|
+
resolve: async ({ subject, anchor, proposal }) => {
|
|
45
|
+
const text = await subject.content.load();
|
|
51
46
|
const accessor = createDocAccessor(text, ['content']);
|
|
52
|
-
const { start, end } = pipe(
|
|
53
|
-
Option.fromNullable(at),
|
|
47
|
+
const { start, end } = Option.fromNullable(anchor).pipe(
|
|
54
48
|
Option.flatMap((at) => Option.fromNullable(getRangeFromCursor(accessor, at))),
|
|
49
|
+
// Fallback to the end of the document.
|
|
55
50
|
Option.getOrElse(() => ({ start: text.content.length - 1, end: text.content.length - 1 })),
|
|
56
51
|
);
|
|
57
52
|
accessor.handle.change((doc) => {
|
|
58
|
-
|
|
59
|
-
A.splice(doc, accessor.path.slice(), start, end - start, ref);
|
|
53
|
+
A.splice(doc, accessor.path.slice(), start, end - start, proposal.text);
|
|
60
54
|
});
|
|
61
55
|
},
|
|
62
56
|
}),
|
|
@@ -4,29 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { SettingsStore } from '@dxos/local-storage';
|
|
10
10
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
11
11
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
12
12
|
import { DataType } from '@dxos/schema';
|
|
13
13
|
|
|
14
|
+
import { MarkdownCard, MarkdownContainer, MarkdownSettings } from '../components';
|
|
15
|
+
import { meta } from '../meta';
|
|
16
|
+
import { Markdown } from '../types';
|
|
17
|
+
import { isEditorModel } from '../util';
|
|
18
|
+
|
|
14
19
|
import { MarkdownCapabilities } from './capabilities';
|
|
15
|
-
import { MarkdownContainer, MarkdownSettings, MarkdownPreview } from '../components';
|
|
16
|
-
import { MARKDOWN_PLUGIN } from '../meta';
|
|
17
|
-
import { DocumentType, isEditorModel, type MarkdownSettingsProps } from '../types';
|
|
18
20
|
|
|
19
21
|
export default () =>
|
|
20
22
|
contributes(Capabilities.ReactSurface, [
|
|
21
23
|
createSurface({
|
|
22
|
-
id: `${
|
|
24
|
+
id: `${meta.id}/surface/document`,
|
|
23
25
|
role: ['article', 'section', 'tabpanel'],
|
|
24
|
-
filter: (data): data is { subject:
|
|
25
|
-
Obj.instanceOf(
|
|
26
|
+
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
27
|
+
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
26
28
|
component: ({ data, role }) => {
|
|
27
29
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
28
30
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
29
|
-
const settings = settingsStore.getStore<
|
|
31
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
30
32
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
31
33
|
const viewMode = getViewMode(fullyQualifiedId(data.subject));
|
|
32
34
|
|
|
@@ -46,14 +48,14 @@ export default () =>
|
|
|
46
48
|
},
|
|
47
49
|
}),
|
|
48
50
|
createSurface({
|
|
49
|
-
id: `${
|
|
51
|
+
id: `${meta.id}/surface/text`,
|
|
50
52
|
role: ['article', 'section', 'tabpanel'],
|
|
51
53
|
filter: (data): data is { id: string; subject: DataType.Text } =>
|
|
52
54
|
typeof data.id === 'string' && Obj.instanceOf(DataType.Text, data.subject),
|
|
53
55
|
component: ({ data, role }) => {
|
|
54
56
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
55
57
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
56
|
-
const settings = settingsStore.getStore<
|
|
58
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
57
59
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
58
60
|
|
|
59
61
|
return (
|
|
@@ -72,13 +74,13 @@ export default () =>
|
|
|
72
74
|
},
|
|
73
75
|
}),
|
|
74
76
|
createSurface({
|
|
75
|
-
id: `${
|
|
77
|
+
id: `${meta.id}/surface/editor`,
|
|
76
78
|
role: ['article', 'section'],
|
|
77
79
|
filter: (data): data is { subject: { id: string; text: string } } => isEditorModel(data.subject),
|
|
78
80
|
component: ({ data, role }) => {
|
|
79
81
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
80
82
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
81
|
-
const settings = settingsStore.getStore<
|
|
83
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
82
84
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
83
85
|
|
|
84
86
|
return (
|
|
@@ -97,17 +99,17 @@ export default () =>
|
|
|
97
99
|
},
|
|
98
100
|
}),
|
|
99
101
|
createSurface({
|
|
100
|
-
id: `${
|
|
102
|
+
id: `${meta.id}/surface/plugin-settings`,
|
|
101
103
|
role: 'article',
|
|
102
|
-
filter: (data): data is { subject: SettingsStore<
|
|
103
|
-
data.subject instanceof SettingsStore && data.subject.prefix ===
|
|
104
|
+
filter: (data): data is { subject: SettingsStore<Markdown.Settings> } =>
|
|
105
|
+
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
104
106
|
component: ({ data: { subject } }) => <MarkdownSettings settings={subject.value} />,
|
|
105
107
|
}),
|
|
106
108
|
createSurface({
|
|
107
|
-
id: `${
|
|
108
|
-
role: ['popover', 'card--
|
|
109
|
-
filter: (data): data is { subject:
|
|
110
|
-
Obj.instanceOf(
|
|
111
|
-
component: ({ data, role }) => <
|
|
109
|
+
id: `${meta.id}/surface/preview`,
|
|
110
|
+
role: ['card--popover', 'card--intrinsic', 'card--extrinsic', 'card--transclusion', 'card'],
|
|
111
|
+
filter: (data): data is { subject: Markdown.Document | DataType.Text } =>
|
|
112
|
+
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(DataType.Text, data.subject),
|
|
113
|
+
component: ({ data, role }) => <MarkdownCard {...data} role={role} />,
|
|
112
114
|
}),
|
|
113
115
|
]);
|